Timeline.js 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = function (d, b) {
  3. extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  6. return extendStatics(d, b);
  7. };
  8. return function (d, b) {
  9. extendStatics(d, b);
  10. function __() { this.constructor = d; }
  11. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12. };
  13. })();
  14. var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
  15. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  16. return cooked;
  17. };
  18. var __assign = (this && this.__assign) || function () {
  19. __assign = Object.assign || function(t) {
  20. for (var s, i = 1, n = arguments.length; i < n; i++) {
  21. s = arguments[i];
  22. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  23. t[p] = s[p];
  24. }
  25. return t;
  26. };
  27. return __assign.apply(this, arguments);
  28. };
  29. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  30. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  31. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  32. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  33. return c > 3 && r && Object.defineProperty(target, key, r), r;
  34. };
  35. var __spreadArrays = (this && this.__spreadArrays) || function () {
  36. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  37. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  38. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  39. r[k] = a[j];
  40. return r;
  41. };
  42. import dayjs from 'dayjs';
  43. import { Event } from './Event';
  44. import { Ressource } from './Ressource';
  45. import { LitElement, html, customElement, property, css } from 'lit-element';
  46. import { styleMap } from 'lit-html/directives/style-map';
  47. import syncronizeElementsScrolling from './utils/syncroScroll';
  48. var Timeline = (function (_super) {
  49. __extends(Timeline, _super);
  50. function Timeline(options) {
  51. if (options === void 0) { options = {}; }
  52. var _this = _super.call(this) || this;
  53. _this._slotDuration = 30;
  54. _this._legendSpan = 2;
  55. _this.rowHeight = 32;
  56. _this.slotWidth = 20;
  57. _this.legendUnitFormat = { "y": "YYYY", "M": "MMMM", "d": 'D', "h": "H[h]", "m": "m'", 's': "s[s]" };
  58. _this._clearSelectionhandler = function () {
  59. _this._clearSelectedItems();
  60. window.removeEventListener("click", _this._clearSelectionhandler);
  61. };
  62. _this.rows = options.ressources ? options.ressources.map(Ressource.toRessource) : [];
  63. _this.items = options.items ? options.items.map(Event.toTimeSlot) : [];
  64. _this._start = dayjs().startOf("day");
  65. _this._end = _this._start.endOf("day");
  66. _this.rowsTitle = "Ressources";
  67. _this.ressourceWidth = 200;
  68. _this.selectedList = [];
  69. _this.legend = [];
  70. _this.defaultBackground = "";
  71. _this.updateLegend();
  72. _this.render();
  73. return _this;
  74. }
  75. Object.defineProperty(Timeline.prototype, "start", {
  76. get: function () {
  77. return this._start.toISOString();
  78. },
  79. set: function (value) {
  80. this._start = dayjs(value);
  81. this.updateLegend();
  82. },
  83. enumerable: false,
  84. configurable: true
  85. });
  86. Object.defineProperty(Timeline.prototype, "end", {
  87. get: function () {
  88. return this._end.toISOString();
  89. },
  90. set: function (value) {
  91. this._end = dayjs(value);
  92. this.updateLegend();
  93. },
  94. enumerable: false,
  95. configurable: true
  96. });
  97. Object.defineProperty(Timeline.prototype, "slotDuration", {
  98. get: function () {
  99. return this._slotDuration;
  100. },
  101. set: function (value) {
  102. this._slotDuration = value;
  103. this.updateLegend();
  104. },
  105. enumerable: false,
  106. configurable: true
  107. });
  108. Object.defineProperty(Timeline.prototype, "legendSpan", {
  109. get: function () {
  110. return this._legendSpan;
  111. },
  112. set: function (value) {
  113. this._legendSpan = value;
  114. this.updateLegend();
  115. },
  116. enumerable: false,
  117. configurable: true
  118. });
  119. Object.defineProperty(Timeline.prototype, "defaultBackground", {
  120. get: function () {
  121. return this.style.getPropertyValue("--default-background");
  122. },
  123. set: function (value) {
  124. this.style.setProperty("--default-background", value);
  125. },
  126. enumerable: false,
  127. configurable: true
  128. });
  129. Timeline.prototype.setLegendUnitFormatAll = function (legend) {
  130. this.legendUnitFormat = __assign(__assign({}, this.legendUnitFormat), legend);
  131. this.updateLegend();
  132. };
  133. Timeline.prototype.setLegendUnitFormat = function (unit, format) {
  134. this.legendUnitFormat[unit] = format;
  135. this.updateLegend();
  136. };
  137. Timeline.prototype.addRessources = function (list) {
  138. var _this = this;
  139. return list.map(function (r) { return _this.addRessource(r); });
  140. };
  141. Timeline.prototype.addRessource = function (ressource) {
  142. if (this.rows.filter(function (o) { return o.id == ressource.id; }).length > 0) {
  143. return;
  144. }
  145. var r = Ressource.toRessource(ressource);
  146. if (r.parent !== undefined) {
  147. var idx = this.rows.indexOf(r.parent);
  148. if (idx > -1) {
  149. this.rows[idx].children.push(r);
  150. this.rows.splice(idx + 1, 0, r);
  151. }
  152. else {
  153. return;
  154. }
  155. }
  156. else {
  157. this.rows = __spreadArrays(this.rows, [r]);
  158. }
  159. this.updateTimeslotPosition(r);
  160. return r;
  161. };
  162. Timeline.prototype.removeRessourceById = function (id) {
  163. return this._removeRessourceById(id);
  164. };
  165. Timeline.prototype._removeRessourceById = function (id, depth) {
  166. var _a;
  167. if (depth === void 0) { depth = 0; }
  168. var output = { ressources: [], items: [] };
  169. var _loop_1 = function (i) {
  170. var _a, _b;
  171. var ressource = this_1.rows[i];
  172. if (ressource.id === id) {
  173. output.ressources.push(ressource);
  174. if (ressource.parent && depth === 0) {
  175. ressource.parent.children = ressource.parent.children.filter(function (o) { return o.id !== ressource.id; });
  176. }
  177. this_1.rows.splice(i, 1);
  178. }
  179. else if (ressource.parentId === id) {
  180. var partialOutput = this_1._removeRessourceById(ressource.id, depth + 1);
  181. (_a = output.ressources).push.apply(_a, partialOutput.ressources);
  182. (_b = output.items).push.apply(_b, partialOutput.items);
  183. }
  184. else {
  185. i++;
  186. }
  187. out_i_1 = i;
  188. };
  189. var this_1 = this, out_i_1;
  190. for (var i = 0; i < this.rows.length; i) {
  191. _loop_1(i);
  192. i = out_i_1;
  193. }
  194. (_a = output.items).push.apply(_a, this.items.filter(function (i) { return i.ressourceId === id; }));
  195. this.items = this.items.filter(function (i) { return i.ressourceId !== id; });
  196. return output;
  197. };
  198. Timeline.prototype.getRessources = function () {
  199. return this.rows;
  200. };
  201. Timeline.prototype.getRessourceFromId = function (id) {
  202. var tmp = this.rows.filter(function (r) { return r.id === id; });
  203. return tmp.length > 0 ? tmp[0] : null;
  204. };
  205. Timeline.prototype.setRowsTitle = function (title) {
  206. this.rowsTitle = title;
  207. };
  208. Timeline.prototype.addTimeSlots = function (list) {
  209. var _this = this;
  210. return list.map(function (e) { return _this.addTimeSlot(e); });
  211. };
  212. Timeline.prototype.addTimeSlot = function (slot) {
  213. if (this.items.filter(function (o) { return o.id == slot.id; }).length > 0) {
  214. return null;
  215. }
  216. var ressource = this.rows.find(function (r) { return r.id === slot.ressourceId; });
  217. if (ressource === undefined) {
  218. return null;
  219. }
  220. var timeslot = Event.toTimeSlot(slot);
  221. this.items = __spreadArrays(this.items, [timeslot]);
  222. timeslot.isDisplayed = timeslot.end > this._start.toDate() || timeslot.start < this._end.toDate();
  223. this.updateTimeslotPosition(ressource);
  224. return timeslot;
  225. };
  226. Timeline.prototype.removeTimeslotById = function (id) {
  227. var output = this.items.filter(function (o) { return o.id === id; });
  228. this.items = this.items.filter(function (o) { return o.id !== id; });
  229. return output;
  230. };
  231. Timeline.prototype.updateTimeslotById = function (id) {
  232. var output = this.removeTimeslotById(id);
  233. if (output.length > 0) {
  234. this.addTimeSlot(output[0]);
  235. return output[0];
  236. }
  237. else {
  238. return null;
  239. }
  240. };
  241. Timeline.prototype.updateTimeslotPosition = function (ressource) {
  242. var timeslots = this.items.filter(function (i) { return i.ressourceId === ressource.id; });
  243. if (timeslots.length === 0) {
  244. ressource.height = this.rowHeight + (ressource.collapseChildren ? 5 : 0);
  245. return;
  246. }
  247. var start = this._start.toDate().getTime();
  248. var end = this._end.toDate().getTime();
  249. var points = [start, end];
  250. var populateInterval = function (d) {
  251. var t = d.getTime();
  252. if (start < t && t < end && !points.includes(t)) {
  253. points.push(t);
  254. }
  255. };
  256. timeslots.forEach(function (element) {
  257. populateInterval(element.start);
  258. populateInterval(element.end);
  259. });
  260. points.sort();
  261. var intervals = [];
  262. var _loop_2 = function (i) {
  263. var startTime = points[i];
  264. var endTime = points[i + 1];
  265. intervals.push({
  266. start: points[i],
  267. end: points[i + 1],
  268. slots: timeslots.filter(function (slot) { return (slot.start.getTime() <= startTime && endTime <= slot.end.getTime()); })
  269. });
  270. };
  271. for (var i = 0; i < points.length - 1; i++) {
  272. _loop_2(i);
  273. }
  274. var lineCount = intervals.reduce(function (acc, interval) { return Math.max(acc, interval.slots.length); }, 0);
  275. ressource.height = this.rowHeight * Math.max(lineCount, 1) + (ressource.collapseChildren ? 5 : 0);
  276. var sortTimeslots = function (a, b) {
  277. var t = a.start.getTime() - b.start.getTime();
  278. if (t === 0) {
  279. var tend = b.end.getTime() - a.end.getTime();
  280. return tend === 0 ? ('' + a.id).localeCompare(b.id) : tend;
  281. }
  282. return t;
  283. };
  284. timeslots.forEach(function (slot) { return slot.offset = -1; });
  285. timeslots.sort(sortTimeslots);
  286. timeslots[0].offset = 0;
  287. var potentialOffset = [];
  288. for (var i = 0; i < lineCount; i++) {
  289. potentialOffset.push(i);
  290. }
  291. intervals.forEach(function (intervals) {
  292. intervals.slots.sort(sortTimeslots);
  293. var usedOffset = intervals.slots.map(function (o) { return o.offset; }).filter(function (i) { return i > -1; });
  294. var availableOffset = potentialOffset.filter(function (i) { return !usedOffset.includes(i); });
  295. intervals.slots.forEach(function (slot) {
  296. if (slot.offset === -1) {
  297. slot.offset = availableOffset.shift() || 0;
  298. }
  299. });
  300. });
  301. };
  302. Timeline.prototype.getTimeSlots = function () {
  303. return this.items;
  304. };
  305. Timeline.prototype.updateLegend = function () {
  306. var legend = [];
  307. var legendUnitList = ["y", "M", "d", "h", "m", 's'];
  308. var legendMinUnitSpan = this.slotDuration * this.legendSpan;
  309. for (var _i = 0, legendUnitList_1 = legendUnitList; _i < legendUnitList_1.length; _i++) {
  310. var legendUnit = legendUnitList_1[_i];
  311. var currentDate = dayjs(this._start);
  312. var nextColumn = currentDate.add(legendMinUnitSpan, "m");
  313. var isLegendPossible = this._end.diff(this._start, legendUnit) > 0 &&
  314. (nextColumn.format(this.legendUnitFormat[legendUnit]) !== currentDate.format(this.legendUnitFormat[legendUnit])
  315. || currentDate.add(1, legendUnit).diff(currentDate, "m") >= legendMinUnitSpan);
  316. if (isLegendPossible) {
  317. var row = [];
  318. var i = 0;
  319. while (currentDate.isBefore(this._end)) {
  320. i += this.legendSpan;
  321. if (nextColumn.diff(currentDate, legendUnit) > 0) {
  322. row.push({ colspan: i, title: '' + currentDate.format(this.legendUnitFormat[legendUnit]) });
  323. i = 0;
  324. currentDate = nextColumn;
  325. }
  326. nextColumn = nextColumn.add(legendMinUnitSpan, "m");
  327. }
  328. legend.push(row);
  329. }
  330. }
  331. this.legend = legend;
  332. };
  333. Timeline.prototype._handleResizeX = function (e) {
  334. e.stopPropagation();
  335. this.ressourceWidth += e.detail;
  336. if (this.ressourceWidth < 0) {
  337. this.ressourceWidth = 0;
  338. }
  339. };
  340. Timeline.prototype._grabHeader = function (e) {
  341. var root = this.shadowRoot;
  342. if (root !== null) {
  343. var gridContainer_1 = root.querySelector(".jc-timeline-grid-container");
  344. var headerContainer_1 = root.querySelector(".jc-timeline-grid-title-container");
  345. var lastPosX_1 = e.clientX;
  346. var scroll_1 = function (e) {
  347. var scrollLeft = (lastPosX_1 - e.clientX);
  348. headerContainer_1.scrollLeft += scrollLeft;
  349. gridContainer_1.scrollLeft += scrollLeft;
  350. lastPosX_1 = e.clientX;
  351. };
  352. var mouseUpListener_1 = function (e) {
  353. window.removeEventListener("mousemove", scroll_1);
  354. window.removeEventListener("mouseup", mouseUpListener_1);
  355. };
  356. window.addEventListener("mousemove", scroll_1);
  357. window.addEventListener("mouseup", mouseUpListener_1);
  358. }
  359. };
  360. Timeline.prototype._getEventResizerHandler = function (slot, direction) {
  361. var _this = this;
  362. return function (evt) {
  363. evt.stopPropagation();
  364. evt.preventDefault();
  365. var startPos = evt.clientX;
  366. var localSlot = slot;
  367. var localDir = direction;
  368. var startDate = slot[direction];
  369. var resizeListener = function (e) {
  370. var newDate = dayjs(startDate).add(Math.round((e.clientX - startPos) / _this.slotWidth) * _this.slotDuration, "m").toDate();
  371. if (direction === "start" ? (newDate < localSlot.end) : (localSlot.start < newDate)) {
  372. localSlot[localDir] = newDate;
  373. _this.updateTimeslotById(slot.id);
  374. }
  375. };
  376. var mouseUpListener = function (e) {
  377. window.removeEventListener("mousemove", resizeListener);
  378. window.removeEventListener("mouseup", mouseUpListener);
  379. localSlot.moving = false;
  380. _this.updateTimeslotById(slot.id);
  381. };
  382. localSlot.moving = true;
  383. window.addEventListener("mousemove", resizeListener);
  384. window.addEventListener("mouseup", mouseUpListener);
  385. };
  386. };
  387. Timeline.prototype._getEventGrabHandler = function (slot, editable, ressourceEditable, callback) {
  388. var _this = this;
  389. return function (evt) {
  390. evt.stopPropagation();
  391. evt.preventDefault();
  392. var startPos = evt.clientX;
  393. var hasChanged = false;
  394. var localSlot = slot;
  395. var localSlots = _this.selectedList.filter(function (s) { return s instanceof Event; }).map(function (s) { return s; });
  396. if (!localSlots.includes(localSlot)) {
  397. localSlots = [localSlot];
  398. }
  399. var startDates = localSlots.map(function (slot) { return slot.start; });
  400. var endDates = localSlots.map(function (slot) { return slot.end; });
  401. var updatePosition = editable ? function (e) {
  402. var changeTime = Math.round((e.clientX - startPos) / _this.slotWidth) * _this.slotDuration;
  403. return localSlots.map(function (slot, index) {
  404. var prevStart = slot.start;
  405. slot.start = dayjs(startDates[index]).add(changeTime, "m").toDate();
  406. slot.end = dayjs(endDates[index]).add(changeTime, "m").toDate();
  407. return prevStart.getTime() !== slot.start.getTime();
  408. }).reduce(function (prev, curr) { return prev || curr; });
  409. } : function (e) { return false; };
  410. var updateRessource = ressourceEditable ? function (e) {
  411. var _a, _b, _c;
  412. var rowId = (_c = (_b = (_a = _this.shadowRoot) === null || _a === void 0 ? void 0 : _a.elementsFromPoint(e.clientX, e.clientY).find(function (e) { return e.tagName == "TD"; })) === null || _b === void 0 ? void 0 : _b.parentElement) === null || _c === void 0 ? void 0 : _c.getAttribute('row-id');
  413. if (rowId) {
  414. var ressourceId = _this.rows[Number(rowId)].id;
  415. if (ressourceId !== localSlot.ressourceId) {
  416. var oldRessource = _this.getRessourceFromId(localSlot.ressourceId);
  417. localSlot.ressourceId = ressourceId;
  418. _this.updateTimeslotPosition(oldRessource);
  419. return true;
  420. }
  421. }
  422. return false;
  423. } : function (e) { return false; };
  424. var moveListener = function (e) {
  425. var a = updatePosition(e);
  426. if (updateRessource(e) || a) {
  427. hasChanged = true;
  428. _this.updateTimeslotById(localSlot.id);
  429. }
  430. };
  431. var mouseUpListener = function (e) {
  432. window.removeEventListener("mousemove", moveListener);
  433. window.removeEventListener("mouseup", mouseUpListener);
  434. localSlot.moving = false;
  435. _this.updateTimeslotById(slot.id);
  436. callback(e, hasChanged);
  437. };
  438. localSlot.moving = true;
  439. window.addEventListener("mousemove", moveListener);
  440. window.addEventListener("mouseup", mouseUpListener);
  441. };
  442. };
  443. Timeline.prototype._clearSelectedItems = function () {
  444. var _this = this;
  445. this.selectedList.map(function (e) {
  446. e.selected = false;
  447. _this.updateTimeslotById(e.id);
  448. });
  449. this.selectedList = [];
  450. };
  451. Timeline.prototype._getEventClickHandler = function (clickedItem) {
  452. var _this = this;
  453. var item = clickedItem;
  454. return function (e, wasModified) {
  455. if (wasModified === void 0) { wasModified = false; }
  456. e.stopPropagation();
  457. var idx = _this.selectedList.indexOf(item);
  458. if (idx > -1) {
  459. if (wasModified) {
  460. }
  461. else if (e.ctrlKey) {
  462. _this.selectedList.splice(idx, 1);
  463. item.selected = false;
  464. _this.updateTimeslotById(item.id);
  465. }
  466. else {
  467. _this._clearSelectedItems();
  468. }
  469. }
  470. else {
  471. if (_this.selectedList.length > 0 && !e.ctrlKey) {
  472. _this._clearSelectedItems();
  473. }
  474. item.selected = true;
  475. _this.selectedList.push(item);
  476. _this.updateTimeslotById(item.id);
  477. }
  478. var myEvent = new CustomEvent('item-selected', {
  479. detail: { items: _this.selectedList },
  480. bubbles: true,
  481. composed: true
  482. });
  483. _this.dispatchEvent(myEvent);
  484. };
  485. };
  486. Timeline.prototype.firstUpdated = function () {
  487. var root = this.shadowRoot;
  488. if (root !== null) {
  489. var gridContainer = root.querySelector(".jc-timeline-grid-container");
  490. syncronizeElementsScrolling([gridContainer, root.querySelector(".jc-timeline-grid-title-container")], "h");
  491. syncronizeElementsScrolling([gridContainer, root.querySelector(".jc-timeline-rows")], "v");
  492. }
  493. if (this.defaultBackground === "") {
  494. this.style.setProperty("--default-background", "SteelBlue");
  495. }
  496. };
  497. Timeline.prototype.renderTimeslot = function (slot) {
  498. if (!slot.isDisplayed) {
  499. return html(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
  500. }
  501. var rowTop = 0;
  502. var ressource;
  503. var i;
  504. for (i = 0; i < this.rows.length && this.rows[i].id !== slot.ressourceId; i++) {
  505. ressource = this.rows[i];
  506. if (ressource.show) {
  507. rowTop += ressource.height ? ressource.height : this.rowHeight;
  508. }
  509. }
  510. ressource = this.rows[i];
  511. var minute2pixel = this.slotWidth / this.slotDuration;
  512. var left = dayjs(slot.start).diff(this._start, "m") * minute2pixel;
  513. var right = -dayjs(slot.end).diff(this._end, "m") * minute2pixel;
  514. var style = {
  515. height: this.rowHeight - 4 + "px",
  516. top: rowTop + slot.offset * this.rowHeight + "px",
  517. left: left + "px",
  518. right: right + "px",
  519. backgroundColor: ""
  520. };
  521. var bgColor = slot.bgColor ? slot.bgColor : ressource.eventBgColor;
  522. if (bgColor) {
  523. style.backgroundColor = bgColor;
  524. }
  525. if (!ressource.show) {
  526. style.height = "";
  527. style.top = rowTop - 6 + "px";
  528. return html(templateObject_2 || (templateObject_2 = __makeTemplateObject(["<div class=\"jc-timeslot empty\" style=\"", "\"></div>"], ["<div class=\"jc-timeslot empty\" style=\"", "\"></div>"])), styleMap(style));
  529. }
  530. var content = html(templateObject_3 || (templateObject_3 = __makeTemplateObject(["", ""], ["", ""])), slot.title);
  531. var resizer = slot.editable === null ? ressource.eventEditable : slot.editable;
  532. var editableRessource = slot.ressourceEditable === null ? ressource.eventRessourceEditable : slot.ressourceEditable;
  533. if (resizer) {
  534. content = html(templateObject_4 || (templateObject_4 = __makeTemplateObject(["<div class=\"jc-timeslot-resizer-start\" @mousedown=\"", "\"></div>", "\n <div class=\"jc-timeslot-resizer-end\" @mousedown=\"", "\"></div>"], ["<div class=\"jc-timeslot-resizer-start\" @mousedown=\"", "\"></div>", "\n <div class=\"jc-timeslot-resizer-end\" @mousedown=\"", "\"></div>"])), this._getEventResizerHandler(slot, "start"), content, this._getEventResizerHandler(slot, "end"));
  535. }
  536. return html(templateObject_5 || (templateObject_5 = __makeTemplateObject(["<div class=\"jc-timeslot ", " ", "\" \n start=\"", "\" \n end=\"", "\" \n style=\"", "\"\n @mousedown=\"", "\"\n >", "</div>"], ["<div class=\"jc-timeslot ", " ", "\" \n start=\"", "\" \n end=\"", "\" \n style=\"", "\"\n @mousedown=\"", "\"\n >", "</div>"])), slot.moving ? "moving" : "", slot.selected ? "selected" : "", slot.start.getHours(), slot.end.getHours(), styleMap(style), this._getEventGrabHandler(slot, resizer, editableRessource, this._getEventClickHandler(slot)), content);
  537. };
  538. Timeline.prototype._getCollapseRessourceHandler = function (item) {
  539. var _this = this;
  540. return function (e) {
  541. item.collapseChildren = !item.collapseChildren;
  542. _this.updateTimeslotPosition(item);
  543. _this.rows = __spreadArrays(_this.rows);
  544. };
  545. };
  546. Timeline.prototype._onRessourceDragStart = function (item) {
  547. return function (event) {
  548. var _a;
  549. (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.setData("text", item.id);
  550. };
  551. };
  552. Timeline.prototype._onRessourceDragEnter = function (event) {
  553. if (event.target instanceof HTMLElement) {
  554. var tgt = event.target;
  555. tgt.classList.add("target");
  556. }
  557. else if (event.target instanceof Node) {
  558. }
  559. };
  560. Timeline.prototype._onRessourceDragLeave = function (event) {
  561. if (event.target instanceof HTMLElement) {
  562. event.target.classList.remove("target");
  563. }
  564. };
  565. Timeline.prototype._onRessourceDrop = function (event) {
  566. var _a, _b;
  567. event.preventDefault();
  568. if (event.target instanceof HTMLElement) {
  569. event.target.classList.remove("target");
  570. var srcId = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.getData("text");
  571. var destinationId_1 = (_b = event.target.parentElement) === null || _b === void 0 ? void 0 : _b.getAttribute("ressourceId");
  572. if (srcId && destinationId_1 && (destinationId_1 !== srcId)) {
  573. var src = this.getRessourceFromId(srcId);
  574. var destination = this.getRessourceFromId(destinationId_1);
  575. if (destination.childOf(src)) {
  576. return;
  577. }
  578. var movedContent = this.removeRessourceById(src.id);
  579. if (event.target.classList.contains("jc-ressource")) {
  580. movedContent.ressources[0].parent = destination;
  581. }
  582. else {
  583. movedContent.ressources[0].parent = destination.parent;
  584. var idx = this.rows.findIndex(function (v) { return v.id === destinationId_1; });
  585. if (event.target.classList.contains("jc-ressource-below")) {
  586. idx += 1;
  587. while ((idx < this.rows.length)
  588. && this.rows[idx].childOf(destination)) {
  589. idx += 1;
  590. }
  591. }
  592. var arr = this.rows;
  593. this.rows = __spreadArrays(arr.splice(0, idx), [src], arr);
  594. }
  595. this.addRessources(movedContent.ressources);
  596. this.addTimeSlots(movedContent.items);
  597. }
  598. }
  599. };
  600. Timeline.prototype.renderRessource = function (item) {
  601. var depth = item.depth;
  602. var style = "--depth:" + depth + ";" + (item.height ? "height:" + item.height + "px;" : "");
  603. var hasChild = item.children.length > 0;
  604. var collapseHandler = this._getCollapseRessourceHandler(item);
  605. return html(templateObject_9 || (templateObject_9 = __makeTemplateObject(["<tr>\n <td class=\"", "\" style=\"", "\" ressourceId=\"", "\" @click=\"", "\">\n <div class=\"jc-ressource-above\"></div> \n <div class=\"jc-ressource\" draggable=\"true\" @dragstart=\"", "\">\n ", "", "\n <span>", "</span>\n </div>\n <div class=\"jc-ressource-below\"></div>\n </td>\n </tr>"], ["<tr>\n <td class=\"", "\" style=\"", "\" ressourceId=\"", "\" @click=\"", "\">\n <div class=\"jc-ressource-above\"></div> \n <div class=\"jc-ressource\" draggable=\"true\" @dragstart=\"", "\">\n ", "", "\n <span>", "</span>\n </div>\n <div class=\"jc-ressource-below\"></div>\n </td>\n </tr>"])), item.selected ? "jc-ressource-selected" : "", style, item.id, this._getEventClickHandler(item), this._onRessourceDragStart(item), Array(depth).fill(0).map(function (i) { return html(templateObject_6 || (templateObject_6 = __makeTemplateObject(["<i class=\"jc-spacer\"></i>"], ["<i class=\"jc-spacer\"></i>"]))); }), hasChild ? html(templateObject_7 || (templateObject_7 = __makeTemplateObject(["<i class=\"jc-spacer ", "\" @click=\"", "\"></i>"], ["<i class=\"jc-spacer ", "\" @click=\"", "\"></i>"])), item.collapseChildren ? "extend" : "collapse", collapseHandler) : html(templateObject_8 || (templateObject_8 = __makeTemplateObject(["<i class=\"jc-spacer\"></i>"], ["<i class=\"jc-spacer\"></i>"]))), item.title);
  606. };
  607. Timeline.prototype.renderGridRow = function (columns, rowId, height) {
  608. var _this = this;
  609. if (rowId === void 0) { rowId = -1; }
  610. if (height === void 0) { height = 30; }
  611. return html(templateObject_11 || (templateObject_11 = __makeTemplateObject(["<tr row-id=\"", "\">", "</tr>"], ["<tr row-id=\"", "\">", "</tr>"])), rowId, columns.map(function (d, i) { return html(templateObject_10 || (templateObject_10 = __makeTemplateObject(["<td style=\"height:", "px;\" class=\"jc-slot ", "\" start=\"", "\">&nbsp;</td>"], ["<td style=\"height:", "px;\" class=\"jc-slot ", "\" start=\"", "\">&nbsp;</td>"])), height, (i % _this.legendSpan) === 0 ? "jc-major-slot" : "", d.toISOString()); }));
  612. };
  613. Timeline.prototype.render = function () {
  614. var _this = this;
  615. var nCol = Math.floor(this._end.diff(this._start, 'm') / this.slotDuration) + 1;
  616. var columns = [];
  617. for (var i = 0; i < nCol; i++) {
  618. columns.push(this._start.add(this.slotDuration * i, 'm'));
  619. }
  620. var displayedRows = this.rows.map(function (r, i) { return { i: i, r: r }; }).filter(function (o) { return o.r.show; });
  621. return html(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n <div class=\"jc-timeline-header\">\n <div class=\"jc-timeline-rows-title\" style=", ">", "</div>\n <horizontal-resizer @resize-x=\"", "\"></horizontal-resizer>\n <div class=\"jc-timeline-grid-title-container\">\n <table @mousedown=\"", "\" style=\"width:", "px;\">\n <colgroup>\n ", "\n </colgroup>\n <tbody>\n ", "\n </tbody>\n </table>\n </div>\n </div>\n <div class=\"jc-timeline-content\">\n <table class=\"jc-timeline-rows\"\n style=\"", "\"\n @dragover=\"", "\"\n @dragenter=\"", "\"\n @dragleave=\"", "\"\n @drop=\"", "\">\n ", "\n </table>\n <horizontal-resizer @resize-x=\"", "\"></horizontal-resizer>\n <div class=\"jc-timeline-grid-container\">\n <table style=\"width:", "px;\">\n <colgroup>\n ", "\n </colgroup>\n <tbody>\n ", "\n </tbody>\n </table>\n <div class=\"jc-timeslots\" style=\"width:", "px;\">\n ", "\n </div>\n </div>\n </div>\n "], ["\n <div class=\"jc-timeline-header\">\n <div class=\"jc-timeline-rows-title\" style=", ">", "</div>\n <horizontal-resizer @resize-x=\"", "\"></horizontal-resizer>\n <div class=\"jc-timeline-grid-title-container\">\n <table @mousedown=\"", "\" style=\"width:", "px;\">\n <colgroup>\n ", "\n </colgroup>\n <tbody>\n ", "\n </tbody>\n </table>\n </div>\n </div>\n <div class=\"jc-timeline-content\">\n <table class=\"jc-timeline-rows\"\n style=\"", "\"\n @dragover=\"", "\"\n @dragenter=\"", "\"\n @dragleave=\"", "\"\n @drop=\"", "\">\n ", "\n </table>\n <horizontal-resizer @resize-x=\"", "\"></horizontal-resizer>\n <div class=\"jc-timeline-grid-container\">\n <table style=\"width:", "px;\">\n <colgroup>\n ", "\n </colgroup>\n <tbody>\n ", "\n </tbody>\n </table>\n <div class=\"jc-timeslots\" style=\"width:", "px;\">\n ", "\n </div>\n </div>\n </div>\n "])), styleMap({ minWidth: this.ressourceWidth + "px", width: this.ressourceWidth + "px" }), this.rowsTitle, this._handleResizeX, this._grabHeader, nCol * this.slotWidth, columns.map(function (o) { return html(templateObject_12 || (templateObject_12 = __makeTemplateObject(["<col style=\"min-width:", "px\">"], ["<col style=\"min-width:", "px\">"])), _this.slotWidth); }), this.legend.map(function (arr) { return html(templateObject_14 || (templateObject_14 = __makeTemplateObject(["<tr class=\"jc-timeline-grid-title\">", "</tr>"], ["<tr class=\"jc-timeline-grid-title\">", "</tr>"])), arr.map(function (o) { return html(templateObject_13 || (templateObject_13 = __makeTemplateObject(["<th colspan=\"", "\">", "</th>"], ["<th colspan=\"", "\">", "</th>"])), o.colspan, o.title); })); }), styleMap({ "--width": this.ressourceWidth + "px" }), function (e) { return e.preventDefault(); }, this._onRessourceDragEnter, this._onRessourceDragLeave, this._onRessourceDrop, this.rows.length > 0 ? displayedRows.map(function (o) { return _this.renderRessource(o.r); }) : html(templateObject_15 || (templateObject_15 = __makeTemplateObject(["<tr class=\"empty\"><td>No ressource</td></tr>"], ["<tr class=\"empty\"><td>No ressource</td></tr>"]))), this._handleResizeX, nCol * this.slotWidth, columns.map(function (o) { return html(templateObject_16 || (templateObject_16 = __makeTemplateObject(["<col style=\"min-width:", "px\">"], ["<col style=\"min-width:", "px\">"])), _this.slotWidth); }), this.rows.length > 0 ? displayedRows.map(function (o) { return _this.renderGridRow(columns, o.i, o.r.height); }) : this.renderGridRow(columns), nCol * this.slotWidth, this.items.map(function (slot) { return _this.renderTimeslot(slot); }));
  622. };
  623. Timeline.styles = css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n body{\n font-family:Roboto;\n }\n div {\n box-sizing: border-box;\n }\n .jc-timeline-content,\n .jc-timeline-header{\n width:100%;\n position:relative;\n display: flex;\n flex-direction:row;\n height:max-content;\n align-items: stretch;\n }\n \n .jc-timeline-rows-title,\n .jc-timeline-rows > tr > td{ \n padding: 8px;\n min-width:40px;\n }\n .jc-timeline-rows > tr > td {\n max-width:calc( var(--width) - 8px );\n padding: 0px; \n vertical-align:top;\n }\n .jc-timeline-rows > tr.empty > td{\n padding: 6px 0px 4px 8px;\n }\n i.jc-spacer {\n display:inline-block;\n width : 1rem;\n height: 1rem;\n position:relative;\n box-sizing: border-box;\n }\n i.jc-spacer:after{\n content: \" \";\n position:absolute;\n background-repeat: no-repeat;\n background-size: 1.05rem;\n width: 1.05rem;\n height: 1.05rem;\n }\n .jc-spacer.extend,\n .jc-spacer.collapse {\n cursor:pointer;\n }\n i.jc-spacer.extend:after{\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iYmxhY2siIHdpZHRoPSIxOHB4IiBoZWlnaHQ9IjE4cHgiPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMFYweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik0xOSAzSDVjLTEuMTEgMC0yIC45LTIgMnYxNGMwIDEuMS44OSAyIDIgMmgxNGMxLjEgMCAyLS45IDItMlY1YzAtMS4xLS45LTItMi0yem0wIDE2SDVWNWgxNHYxNHptLTgtMmgydi00aDR2LTJoLTRWN2gtMnY0SDd2Mmg0eiIvPjwvc3ZnPg==\")\n }\n i.jc-spacer.collapse:after{\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTE5IDNINWMtMS4xIDAtMiAuOS0yIDJ2MTRjMCAxLjEuOSAyIDIgMmgxNGMxLjEgMCAyLS45IDItMlY1YzAtMS4xLS45LTItMi0yem0wIDE2SDVWNWgxNHYxNHpNNyAxMWgxMHYySDd6Ii8+PC9zdmc+\")\n }\n \n .jc-timeline-rows > tr{\n box-sizing: border-box;\n white-space: nowrap;\n border: 1px solid grey;\n border-style: solid none;\n }\n .jc-timeline-rows,\n .jc-timeline-rows-title{\n width:var(--width, 200px);\n overflow: hidden;\n border-collapse:collapse;\n }\n .jc-timeline-grid-title-container,\n .jc-timeline-grid-container{\n position:relative;\n width: 600px;\n display: block;\n overflow: hidden;\n }\n .jc-timeline-grid-container{\n overflow-x: auto;\n }\n .jc-timeline-grid-title-container > table,\n .jc-timeline-grid-container > table {\n width:100%;\n table-layout: fixed;\n border-collapse: collapse;\n box-sizing: border-box;\n }\n\n .jc-timeline-grid-title-container {\n white-space: nowrap;\n cursor: grab;\n user-select: none; /* supported by Chrome and Opera */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n }\n .jc-timeline-grid-title:first-child > th{\n border-top:0;\n } \n .jc-timeline-grid-title:first-child > th:before,\n .jc-timeline-grid-title:first-child > th:last-child:after {\n content:\" \";\n display: block;\n position:absolute;\n left:-1px;\n top:0px;\n height:calc( 100% - 8px);\n border-left: 2px solid white;\n z-index:2;\n }\n .jc-timeline-grid-title:first-child > th:last-child:after\n {\n left:auto;\n right:-1px;\n }\n .jc-timeline-grid-title:first-child:last-child >th{\n padding:8px 0;\n }\n .jc-timeline-grid-title:last-child > th{\n border-bottom:none;\n }\n .jc-timeline-grid-title > th,\n .jc-slot { \n height:100%;\n border: solid 1px lightgray;\n border-left-style: dotted;\n border-right:0;\n text-align: center;\n position:relative;\n box-sizing: border-box;\n }\n .jc-timeline-grid-title > th:last-child,\n .jc-slot:last-child{\n border-right:solid 1px lightgray;\n }\n .jc-timeline-grid-title > th,\n .jc-major-slot{\n border-left-style: solid;\n }\n\n\n\n .jc-timeslots{\n position:absolute;\n top:0px;\n left:0px;\n bottom:0px;\n overflow: hidden;\n }\n .jc-timeslot{\n position:absolute;\n white-space: nowrap;\n overflow-x:hidden;\n background-color:var(--default-background);\n color:#fff;\n border-radius:3px;\n padding:4px;\n margin:2px 0px;\n z-index:1;\n cursor:auto;\n }\n .jc-timeslot.empty{\n height:5px;\n padding:2px 2px;\n margin:0px;\n cursor:pointer;\n }\n .jc-timeslot.moving{\n opacity:0.7;\n cursor:grabbing;\n }\n .jc-timeslot.selected:before{\n border:solid 2px black;\n position:absolute;\n top:0;\n bottom:0;\n left:0;\n right:0;\n content:\" \";\n }\n .jc-timeslot-resizer-start,\n .jc-timeslot-resizer-end{\n position:absolute;\n top:0;\n bottom:0;\n width:4px;\n min-width:4px;\n display:block;\n cursor: ew-resize;\n }\n .jc-timeslot-resizer-start,\n .jc-timeslot-resizer-end{\n display:block;\n }\n .jc-timeslot-resizer-start{\n left:0px;\n }\n .jc-timeslot-resizer-end{\n right:0px;\n }\n .jc-timeline-rows > tr >td{\n height:100%;\n }\n .jc-ressource{\n padding-top: 2px;\n height: calc( 100% - 8px);\n }\n .jc-ressource > span {\n pointer-events: none;\n }\n .jc-ressource.target{\n background-color: lightgrey;\n }\n .jc-ressource-selected{\n border:1px solid var(--default-background, SteelBlue);\n border-right:0;\n border-left:0;\n background-color:#4682b46b;\n }\n .jc-ressource-above{\n height:4px;\n }\n .jc-ressource-above.target{\n margin-left: calc( var(--depth) * 16px );\n background-color: var(--default-background, SteelBlue);\n border-radius: 0 0 0 4px;\n }\n .jc-ressource-below{\n height:4px;\n }\n .jc-ressource-below.target{\n margin-left: calc( var(--depth) * 16px);\n background-color: var(--default-background, SteelBlue);\n border-radius: 4px 0 0 0;\n }\n "], ["\n body{\n font-family:Roboto;\n }\n div {\n box-sizing: border-box;\n }\n .jc-timeline-content,\n .jc-timeline-header{\n width:100%;\n position:relative;\n display: flex;\n flex-direction:row;\n height:max-content;\n align-items: stretch;\n }\n \n .jc-timeline-rows-title,\n .jc-timeline-rows > tr > td{ \n padding: 8px;\n min-width:40px;\n }\n .jc-timeline-rows > tr > td {\n max-width:calc( var(--width) - 8px );\n padding: 0px; \n vertical-align:top;\n }\n .jc-timeline-rows > tr.empty > td{\n padding: 6px 0px 4px 8px;\n }\n i.jc-spacer {\n display:inline-block;\n width : 1rem;\n height: 1rem;\n position:relative;\n box-sizing: border-box;\n }\n i.jc-spacer:after{\n content: \" \";\n position:absolute;\n background-repeat: no-repeat;\n background-size: 1.05rem;\n width: 1.05rem;\n height: 1.05rem;\n }\n .jc-spacer.extend,\n .jc-spacer.collapse {\n cursor:pointer;\n }\n i.jc-spacer.extend:after{\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0iYmxhY2siIHdpZHRoPSIxOHB4IiBoZWlnaHQ9IjE4cHgiPjxwYXRoIGQ9Ik0wIDBoMjR2MjRIMFYweiIgZmlsbD0ibm9uZSIvPjxwYXRoIGQ9Ik0xOSAzSDVjLTEuMTEgMC0yIC45LTIgMnYxNGMwIDEuMS44OSAyIDIgMmgxNGMxLjEgMCAyLS45IDItMlY1YzAtMS4xLS45LTItMi0yem0wIDE2SDVWNWgxNHYxNHptLTgtMmgydi00aDR2LTJoLTRWN2gtMnY0SDd2Mmg0eiIvPjwvc3ZnPg==\")\n }\n i.jc-spacer.collapse:after{\n background-image: url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0Ij48cGF0aCBkPSJNMCAwaDI0djI0SDB6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTE5IDNINWMtMS4xIDAtMiAuOS0yIDJ2MTRjMCAxLjEuOSAyIDIgMmgxNGMxLjEgMCAyLS45IDItMlY1YzAtMS4xLS45LTItMi0yem0wIDE2SDVWNWgxNHYxNHpNNyAxMWgxMHYySDd6Ii8+PC9zdmc+\")\n }\n \n .jc-timeline-rows > tr{\n box-sizing: border-box;\n white-space: nowrap;\n border: 1px solid grey;\n border-style: solid none;\n }\n .jc-timeline-rows,\n .jc-timeline-rows-title{\n width:var(--width, 200px);\n overflow: hidden;\n border-collapse:collapse;\n }\n .jc-timeline-grid-title-container,\n .jc-timeline-grid-container{\n position:relative;\n width: 600px;\n display: block;\n overflow: hidden;\n }\n .jc-timeline-grid-container{\n overflow-x: auto;\n }\n .jc-timeline-grid-title-container > table,\n .jc-timeline-grid-container > table {\n width:100%;\n table-layout: fixed;\n border-collapse: collapse;\n box-sizing: border-box;\n }\n\n .jc-timeline-grid-title-container {\n white-space: nowrap;\n cursor: grab;\n user-select: none; /* supported by Chrome and Opera */\n -webkit-user-select: none; /* Safari */\n -khtml-user-select: none; /* Konqueror HTML */\n -moz-user-select: none; /* Firefox */\n -ms-user-select: none; /* Internet Explorer/Edge */\n }\n .jc-timeline-grid-title:first-child > th{\n border-top:0;\n } \n .jc-timeline-grid-title:first-child > th:before,\n .jc-timeline-grid-title:first-child > th:last-child:after {\n content:\" \";\n display: block;\n position:absolute;\n left:-1px;\n top:0px;\n height:calc( 100% - 8px);\n border-left: 2px solid white;\n z-index:2;\n }\n .jc-timeline-grid-title:first-child > th:last-child:after\n {\n left:auto;\n right:-1px;\n }\n .jc-timeline-grid-title:first-child:last-child >th{\n padding:8px 0;\n }\n .jc-timeline-grid-title:last-child > th{\n border-bottom:none;\n }\n .jc-timeline-grid-title > th,\n .jc-slot { \n height:100%;\n border: solid 1px lightgray;\n border-left-style: dotted;\n border-right:0;\n text-align: center;\n position:relative;\n box-sizing: border-box;\n }\n .jc-timeline-grid-title > th:last-child,\n .jc-slot:last-child{\n border-right:solid 1px lightgray;\n }\n .jc-timeline-grid-title > th,\n .jc-major-slot{\n border-left-style: solid;\n }\n\n\n\n .jc-timeslots{\n position:absolute;\n top:0px;\n left:0px;\n bottom:0px;\n overflow: hidden;\n }\n .jc-timeslot{\n position:absolute;\n white-space: nowrap;\n overflow-x:hidden;\n background-color:var(--default-background);\n color:#fff;\n border-radius:3px;\n padding:4px;\n margin:2px 0px;\n z-index:1;\n cursor:auto;\n }\n .jc-timeslot.empty{\n height:5px;\n padding:2px 2px;\n margin:0px;\n cursor:pointer;\n }\n .jc-timeslot.moving{\n opacity:0.7;\n cursor:grabbing;\n }\n .jc-timeslot.selected:before{\n border:solid 2px black;\n position:absolute;\n top:0;\n bottom:0;\n left:0;\n right:0;\n content:\" \";\n }\n .jc-timeslot-resizer-start,\n .jc-timeslot-resizer-end{\n position:absolute;\n top:0;\n bottom:0;\n width:4px;\n min-width:4px;\n display:block;\n cursor: ew-resize;\n }\n .jc-timeslot-resizer-start,\n .jc-timeslot-resizer-end{\n display:block;\n }\n .jc-timeslot-resizer-start{\n left:0px;\n }\n .jc-timeslot-resizer-end{\n right:0px;\n }\n .jc-timeline-rows > tr >td{\n height:100%;\n }\n .jc-ressource{\n padding-top: 2px;\n height: calc( 100% - 8px);\n }\n .jc-ressource > span {\n pointer-events: none;\n }\n .jc-ressource.target{\n background-color: lightgrey;\n }\n .jc-ressource-selected{\n border:1px solid var(--default-background, SteelBlue);\n border-right:0;\n border-left:0;\n background-color:#4682b46b;\n }\n .jc-ressource-above{\n height:4px;\n }\n .jc-ressource-above.target{\n margin-left: calc( var(--depth) * 16px );\n background-color: var(--default-background, SteelBlue);\n border-radius: 0 0 0 4px;\n }\n .jc-ressource-below{\n height:4px;\n }\n .jc-ressource-below.target{\n margin-left: calc( var(--depth) * 16px);\n background-color: var(--default-background, SteelBlue);\n border-radius: 4px 0 0 0;\n }\n "])));
  624. __decorate([
  625. property({ type: Array })
  626. ], Timeline.prototype, "rows", void 0);
  627. __decorate([
  628. property({ type: Array })
  629. ], Timeline.prototype, "items", void 0);
  630. __decorate([
  631. property({ type: Number })
  632. ], Timeline.prototype, "ressourceWidth", void 0);
  633. __decorate([
  634. property({ type: Object })
  635. ], Timeline.prototype, "_start", void 0);
  636. __decorate([
  637. property({ type: String })
  638. ], Timeline.prototype, "start", null);
  639. __decorate([
  640. property({ type: String })
  641. ], Timeline.prototype, "end", null);
  642. __decorate([
  643. property({ type: Number })
  644. ], Timeline.prototype, "slotDuration", null);
  645. __decorate([
  646. property({ type: Number })
  647. ], Timeline.prototype, "legendSpan", null);
  648. __decorate([
  649. property({ type: Number })
  650. ], Timeline.prototype, "rowHeight", void 0);
  651. __decorate([
  652. property({ type: Number })
  653. ], Timeline.prototype, "slotWidth", void 0);
  654. __decorate([
  655. property({ type: String })
  656. ], Timeline.prototype, "rowsTitle", void 0);
  657. __decorate([
  658. property({ type: Array })
  659. ], Timeline.prototype, "legend", void 0);
  660. __decorate([
  661. property({ type: String })
  662. ], Timeline.prototype, "defaultBackground", null);
  663. Timeline = __decorate([
  664. customElement('jc-timeline')
  665. ], Timeline);
  666. return Timeline;
  667. }(LitElement));
  668. export default Timeline;
  669. var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18;
  670. //# sourceMappingURL=Timeline.js.map