Timeline.js 50 KB

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