gantt-source_management 3.37.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +9 -0
- package/.eslintrc.json +39 -0
- package/.prettierrc.cjs +5 -0
- package/README.md +129 -0
- package/cypress/e2e/add-rows-items.test.ts +26 -0
- package/cypress/e2e/basic.test.ts +173 -0
- package/cypress/e2e/calculated-zoom-mode.test.ts +163 -0
- package/cypress/e2e/calendar-dates.test.ts +285 -0
- package/cypress/e2e/dst.test.ts +691 -0
- package/cypress/e2e/grid-cells.test.ts +72 -0
- package/cypress/e2e/items-vertical.test.ts +305 -0
- package/cypress/e2e/items.test.ts +501 -0
- package/cypress/e2e/list-columns-toggle.test.ts +124 -0
- package/cypress/e2e/list-header-resize.test.ts +30 -0
- package/cypress/e2e/locale.test.ts +102 -0
- package/cypress/e2e/move-items-outside.test.ts +437 -0
- package/cypress/e2e/rows.test.ts +50 -0
- package/cypress/e2e/scroll-bar.test.ts +357 -0
- package/cypress/e2e/time-bookmarks.test.ts +92 -0
- package/cypress/e2e/utc-mode.test.ts +51 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/helpers.ts +12 -0
- package/cypress/plugins/index.js +22 -0
- package/cypress/support/commands.ts +175 -0
- package/cypress/support/e2e.ts +31 -0
- package/cypress.config.js +24 -0
- package/dist/api/api.d.ts +182 -0
- package/dist/api/helpers.d.ts +9 -0
- package/dist/api/id.d.ts +14 -0
- package/dist/api/locale.d.ts +3 -0
- package/dist/api/main.d.ts +47 -0
- package/dist/api/public.d.ts +32 -0
- package/dist/api/slots.d.ts +22 -0
- package/dist/api/time.d.ts +104 -0
- package/dist/assets/2f1f893a.wasm +0 -0
- package/dist/gstc.d.ts +708 -0
- package/dist/gstc.esm.min.d.ts +708 -0
- package/dist/gstc.esm.min.js +574 -0
- package/dist/gstc.umd.min.d.ts +708 -0
- package/dist/gstc.umd.min.js +701 -0
- package/dist/gstc.wasm.esm.min.d.ts +708 -0
- package/dist/gstc.wasm.esm.min.js +574 -0
- package/dist/gstc.wasm.umd.min.d.ts +708 -0
- package/dist/gstc.wasm.umd.min.js +701 -0
- package/dist/plugins/calendar-scroll.d.ts +15 -0
- package/dist/plugins/calendar-scroll.esm.min.d.ts +15 -0
- package/dist/plugins/calendar-scroll.esm.min.js +13 -0
- package/dist/plugins/calendar-scroll.umd.min.d.ts +15 -0
- package/dist/plugins/calendar-scroll.umd.min.js +13 -0
- package/dist/plugins/dependency-lines.d.ts +47 -0
- package/dist/plugins/dependency-lines.esm.min.d.ts +47 -0
- package/dist/plugins/dependency-lines.esm.min.js +38 -0
- package/dist/plugins/dependency-lines.umd.min.d.ts +47 -0
- package/dist/plugins/dependency-lines.umd.min.js +38 -0
- package/dist/plugins/export-image.d.ts +12 -0
- package/dist/plugins/export-image.esm.min.d.ts +12 -0
- package/dist/plugins/export-image.esm.min.js +28 -0
- package/dist/plugins/export-image.umd.min.d.ts +12 -0
- package/dist/plugins/export-image.umd.min.js +34 -0
- package/dist/plugins/export-pdf.d.ts +12 -0
- package/dist/plugins/export-pdf.esm.min.d.ts +12 -0
- package/dist/plugins/export-pdf.esm.min.js +389 -0
- package/dist/plugins/export-pdf.umd.min.d.ts +12 -0
- package/dist/plugins/export-pdf.umd.min.js +511 -0
- package/dist/plugins/grab-scroll.d.ts +14 -0
- package/dist/plugins/grab-scroll.esm.min.d.ts +14 -0
- package/dist/plugins/grab-scroll.umd.min.d.ts +14 -0
- package/dist/plugins/highlight-weekends.d.ts +12 -0
- package/dist/plugins/highlight-weekends.esm.min.d.ts +12 -0
- package/dist/plugins/highlight-weekends.esm.min.js +14 -0
- package/dist/plugins/highlight-weekends.umd.min.d.ts +12 -0
- package/dist/plugins/highlight-weekends.umd.min.js +14 -0
- package/dist/plugins/item-movement.d.ts +97 -0
- package/dist/plugins/item-movement.esm.min.d.ts +97 -0
- package/dist/plugins/item-movement.esm.min.js +25 -0
- package/dist/plugins/item-movement.umd.min.d.ts +97 -0
- package/dist/plugins/item-movement.umd.min.js +25 -0
- package/dist/plugins/item-resizing.d.ts +102 -0
- package/dist/plugins/item-resizing.esm.min.d.ts +102 -0
- package/dist/plugins/item-resizing.esm.min.js +37 -0
- package/dist/plugins/item-resizing.umd.min.d.ts +102 -0
- package/dist/plugins/item-resizing.umd.min.js +37 -0
- package/dist/plugins/item-types.d.ts +13 -0
- package/dist/plugins/item-types.esm.min.d.ts +13 -0
- package/dist/plugins/item-types.esm.min.js +127 -0
- package/dist/plugins/item-types.umd.min.d.ts +13 -0
- package/dist/plugins/item-types.umd.min.js +127 -0
- package/dist/plugins/progress-bar.d.ts +13 -0
- package/dist/plugins/progress-bar.esm.min.d.ts +13 -0
- package/dist/plugins/progress-bar.esm.min.js +27 -0
- package/dist/plugins/progress-bar.umd.min.d.ts +13 -0
- package/dist/plugins/progress-bar.umd.min.js +27 -0
- package/dist/plugins/selection.d.ts +94 -0
- package/dist/plugins/selection.esm.min.d.ts +94 -0
- package/dist/plugins/selection.esm.min.js +26 -0
- package/dist/plugins/selection.umd.min.d.ts +94 -0
- package/dist/plugins/selection.umd.min.js +26 -0
- package/dist/plugins/time-bookmarks.d.ts +38 -0
- package/dist/plugins/time-bookmarks.esm.min.d.ts +38 -0
- package/dist/plugins/time-bookmarks.esm.min.js +50 -0
- package/dist/plugins/time-bookmarks.umd.min.d.ts +38 -0
- package/dist/plugins/time-bookmarks.umd.min.js +50 -0
- package/dist/plugins/timeline-pointer.d.ts +83 -0
- package/dist/plugins/timeline-pointer.esm.min.d.ts +83 -0
- package/dist/plugins/timeline-pointer.esm.min.js +13 -0
- package/dist/plugins/timeline-pointer.umd.min.d.ts +83 -0
- package/dist/plugins/timeline-pointer.umd.min.js +13 -0
- package/dist/style.css +811 -0
- package/dist/vendor.esm.min.js +128 -0
- package/examples/complex-1/faces/face-1.jpg +0 -0
- package/examples/complex-1/faces/face-10.jpg +0 -0
- package/examples/complex-1/faces/face-11.jpg +0 -0
- package/examples/complex-1/faces/face-12.jpg +0 -0
- package/examples/complex-1/faces/face-13.jpg +0 -0
- package/examples/complex-1/faces/face-14.jpg +0 -0
- package/examples/complex-1/faces/face-15.jpg +0 -0
- package/examples/complex-1/faces/face-16.jpg +0 -0
- package/examples/complex-1/faces/face-17.jpg +0 -0
- package/examples/complex-1/faces/face-18.jpg +0 -0
- package/examples/complex-1/faces/face-19.jpg +0 -0
- package/examples/complex-1/faces/face-2.jpg +0 -0
- package/examples/complex-1/faces/face-20.jpg +0 -0
- package/examples/complex-1/faces/face-21.jpg +0 -0
- package/examples/complex-1/faces/face-22.jpg +0 -0
- package/examples/complex-1/faces/face-23.jpg +0 -0
- package/examples/complex-1/faces/face-24.jpg +0 -0
- package/examples/complex-1/faces/face-25.jpg +0 -0
- package/examples/complex-1/faces/face-26.jpg +0 -0
- package/examples/complex-1/faces/face-27.jpg +0 -0
- package/examples/complex-1/faces/face-28.jpg +0 -0
- package/examples/complex-1/faces/face-29.jpg +0 -0
- package/examples/complex-1/faces/face-3.jpg +0 -0
- package/examples/complex-1/faces/face-30.jpg +0 -0
- package/examples/complex-1/faces/face-31.jpg +0 -0
- package/examples/complex-1/faces/face-32.jpg +0 -0
- package/examples/complex-1/faces/face-33.jpg +0 -0
- package/examples/complex-1/faces/face-34.jpg +0 -0
- package/examples/complex-1/faces/face-35.jpg +0 -0
- package/examples/complex-1/faces/face-36.jpg +0 -0
- package/examples/complex-1/faces/face-37.jpg +0 -0
- package/examples/complex-1/faces/face-38.jpg +0 -0
- package/examples/complex-1/faces/face-39.jpg +0 -0
- package/examples/complex-1/faces/face-4.jpg +0 -0
- package/examples/complex-1/faces/face-40.jpg +0 -0
- package/examples/complex-1/faces/face-41.jpg +0 -0
- package/examples/complex-1/faces/face-42.jpg +0 -0
- package/examples/complex-1/faces/face-43.jpg +0 -0
- package/examples/complex-1/faces/face-44.jpg +0 -0
- package/examples/complex-1/faces/face-45.jpg +0 -0
- package/examples/complex-1/faces/face-46.jpg +0 -0
- package/examples/complex-1/faces/face-47.jpg +0 -0
- package/examples/complex-1/faces/face-48.jpg +0 -0
- package/examples/complex-1/faces/face-49.jpg +0 -0
- package/examples/complex-1/faces/face-5.jpg +0 -0
- package/examples/complex-1/faces/face-50.jpg +0 -0
- package/examples/complex-1/faces/face-6.jpg +0 -0
- package/examples/complex-1/faces/face-7.jpg +0 -0
- package/examples/complex-1/faces/face-8.jpg +0 -0
- package/examples/complex-1/faces/face-9.jpg +0 -0
- package/examples/complex-1/index.html +61 -0
- package/examples/complex-1/index.js +923 -0
- package/examples/index.html +22 -0
- package/examples/reset.css +455 -0
- package/examples/server.js +18 -0
- package/package.json +150 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Selection={})}(this,(function(t){"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TimelinePointer plugin
|
|
4
|
+
*
|
|
5
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
6
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
7
|
+
* @module gantt-schedule-timeline-calendar
|
|
8
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
9
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
10
|
+
* @version 3.37.5
|
|
11
|
+
* @released 2024-07-19
|
|
12
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
13
|
+
*/const e="chart-timeline-grid-row-cell",i="chart-timeline-items-row-item";const s="config.plugin.Selection";function a(t){return Object.assign({enabled:!0,showOverlay:!0,isSelecting:!1,pointerState:"up",selectKey:"",multiKey:"shift",multipleSelection:!0,targetType:"",targetData:null,initialPosition:{x:0,y:0},currentPosition:{x:0,y:0},selectionAreaLocal:{x:0,y:0,width:0,height:0},selectionAreaGlobal:{x:0,y:0,width:0,height:0},selecting:{[i]:[],[e]:[]},selected:{[i]:[],[e]:[]},lastSelected:{[i]:[],[e]:[]},lastSelecting:{[i]:[],[e]:[]},automaticallySelected:{[i]:[],[e]:[]},events:{onStart(){},onSelecting:t=>t,onEnd:t=>t},pointerEvents:{down:null,move:null,up:null}},t)}class l{constructor(t,l){this.onDestroy=[],this.started=!1,this.lastAllEvents={down:null,move:null,up:null},this.vido=t,this.state=t.state,this.api=t.api,this.merge=this.state.get("config.merge"),this.state.update(s,a(l)),this.data=a(l),this.slotClassName=this.api.getClass("chart-selection"),this.slotStyleMap=new t.StyleMap({display:"none"}),this.html=t.html,this.slot=this.slot.bind(this),this.destroy=this.destroy.bind(this),this.setSlot(),this.onCellCreate=this.onCellCreate.bind(this),this.apiGetSelection=this.apiGetSelection.bind(this),this.apiGetSelecting=this.apiGetSelecting.bind(this),this.apiGetSelected=this.apiGetSelected.bind(this),this.apiSetSelection=this.apiSetSelection.bind(this),this.apiSelectCells=this.apiSelectCells.bind(this),this.apiSelectItems=this.apiSelectItems.bind(this),this.api.plugins.Selection={ITEM:i,CELL:e,getSelection:this.apiGetSelection,getSelected:this.apiGetSelected,getSelecting:this.apiGetSelecting,setSelection:this.apiSetSelection,selectCells:this.apiSelectCells,selectItems:this.apiSelectItems},this.state.update("config.chart.grid.cell.onCreate",(t=>(t.includes(this.onCellCreate)||t.push(this.onCellCreate),t))),this.updateData(),this.onDestroy.push(this.state.subscribe(s,(t=>{this.data=t}))),this.updateSelectionClassName=this.updateSelectionClassName.bind(this),this.selectedAction=this.selectedAction.bind(this),this.state.update("config.actions.chart-timeline-grid-row-cell",(t=>(t.includes(this.selectedAction)||t.push(this.selectedAction),t))),this.state.update("config.actions.chart-timeline-items-row-item",(t=>(t.includes(this.selectedAction)||t.push(this.selectedAction),t))),this.onDestroy.push(this.state.subscribe("config.chart.items.*;",(()=>{const t=this.api.getAllItems();this.data.selected[i]=this.data.selected[i].filter((e=>!!t[e])),this.data.selecting[i]=this.data.selecting[i].filter((e=>!!t[e]));const e=this.api.getItemsData();for(const t in e){const s=e[t];s.selected=this.data.selected[i].includes(t),s.selecting=this.data.selecting[i].includes(t)}}),{bulk:!0,bulkValue:!1})),this.onTimelinePointerDown=this.onTimelinePointerDown.bind(this),this.onTimelinePointerMove=this.onTimelinePointerMove.bind(this),this.onTimelinePointerUp=this.onTimelinePointerUp.bind(this),this.api.plugins.TimelinePointer.addPointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.addPointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.addPointerListener("up",this.onTimelinePointerUp)}setSlot(){this.state.update("config.slots.chart-timeline-items.outer",(t=>(t.includes(this.slot)||t.push(this.slot),t)))}destroy(){this.api.plugins.TimelinePointer.removePointerListener("move",this.onTimelinePointerMove),this.api.plugins.TimelinePointer.removePointerListener("down",this.onTimelinePointerDown),this.api.plugins.TimelinePointer.removePointerListener("up",this.onTimelinePointerUp),this.state.update("config.slots.chart-timeline-items.outer",(t=>t.filter((t=>t!==this.slot)))),this.state.update("config.actions.chart-timeline-grid-row-cell",(t=>t.filter((t=>t!==this.selectedAction)))),this.state.update("config.actions.chart-timeline-items-row-item",(t=>t.filter((t=>t!==this.selectedAction)))),this.state.update("config.chart.grid.cell.onCreate",(t=>t.filter((t=>t!==this.onCellCreate)))),this.onDestroy.forEach((t=>t()))}updateData(){this.state.update(s,Object.assign({},this.data)),this.vido.update()}apiSetSelection(t){this.data.selected=this.api.mergeDeep({},t);let e=this.state.multi(!0);e=this.updateCells(e),e=this.updateItems(e),e.done(),this.updateData()}apiSelectCells(t){this.data.selected[e]=[...t];let i=this.state.multi(!0);i=this.updateCells(i),i.done(),this.updateData()}apiSelectItems(t){this.data.selected[i]=[...t];let e=this.state.multi(!0);e=this.updateItems(e),e.done(),this.updateData()}apiGetSelection(){return{selecting:this.getSelectionWithData(this.data.selecting),selected:this.getSelectionWithData(this.data.selected)}}apiGetSelecting(){return this.getSelectionWithData(this.data.selecting)}apiGetSelected(){return this.getSelectionWithData(this.data.selected)}modKeyPressed(t,e){switch(t){case"shift":return e.shiftKey;case"alt":return e.altKey;case"ctrl":return e.ctrlKey}}canSelect(){let t=this.data.enabled;const e=this.lastAllEvents.down;return e&&this.data.selectKey&&(t=t&&this.modKeyPressed(this.data.selectKey,e)),t&&(this.data.cells||this.data.items)}getSelectionAreaLocal(t){const e={x:0,y:0,width:0,height:0},i=Object.assign({},t.initialPosition),s=Object.assign({},t.currentPosition),a=s.x-i.x,l=s.y-i.y;return a>=0?(e.x=i.x,e.width=a):(e.x=s.x,e.width=Math.abs(a)),l>=0?(e.y=i.y,e.height=l):(e.y=s.y,e.height=Math.abs(l)),e}translateAreaLocalToGlobal(t){const e=this.state.get("$data.chart.time.leftPx"),i=this.state.get("$data.scroll.vertical.absolutePosPx");return Object.assign(Object.assign({},t),{x:t.x+e,y:t.y+i})}collectLinkedItems(t,e=this.api.getItemsData()){if(!e[t])throw console.error('"config.chart.items"',this.state.get("config.chart.items")),console.error('"$data.chart.items"',this.state.get("$data.chart.items")),new Error(`Item with id "${t}" does not exists in "$data.chart.items".`);return[t,...e[t].linkedWith]}getSelectedItem(t){let e,s=this.data.automaticallySelected[i].slice();const a=this.collectLinkedItems(t.id);if(this.data.selected[i].find((e=>e===t.id)))if(e=this.data.selected[i],s.find((e=>e===t.id))){const i=s,a=e.find((e=>t.linkedWith.includes(e)&&!i.includes(e)));s=s.filter((e=>e!==t.id)),s.push(a)}else s=this.data.automaticallySelected[i];else e=this.isMulti()?Array.from(new Set([...this.data.selected[i],...a])):a,s=a.filter((e=>e!==t.id));return e=e.map((e=>(t=this.api.getItem(e),e))),{selected:e,automaticallySelected:s}}isItemVerticallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.y+e.height,s=t.position.viewTop,a=s+t.actualHeight;return s>=e.y&&s<=i||a>=e.y&&a<=i||s>=e.y&&a<=i||s<=e.y&&a>=i}isItemHorizontallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.x+e.width;return t.position.actualLeft>=e.x&&t.position.actualLeft<=i||t.position.actualRight>=e.x&&t.position.actualRight<=i||t.position.actualLeft<=e.x&&t.position.actualRight>=i||t.position.actualLeft>=e.x&&t.position.actualRight<=i}isMulti(){const t=this.lastAllEvents.move;return t&&this.data.multiKey&&this.modKeyPressed(this.data.multiKey,t)}getItemsUnderSelectionArea(t){const e=this.state.get("$data.chart.visibleItems"),i=this.api.getItems(e),s=[],a=[];for(let e of i){e=this.merge({},e);const i=this.api.getItemData(e.id);if(this.isItemVerticallyInsideArea(i,t)&&this.isItemHorizontallyInsideArea(i,t)){s.find((t=>t===e.id))||s.push(e.id);const t=this.collectLinkedItems(e.id);for(const e of t){const t=this.api.getItem(e);s.find((e=>e===t.id))||(s.push(t.id),a.push(t.id))}}}return{selectedItems:s,automaticallySelectedItems:a}}isCellVerticallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.y+e.height,s=t.top,a=s+t.rowData.actualHeight;return s>=e.y&&s<=i||a>=e.y&&a<=i||s>=e.y&&a<=i||s<=e.y&&a>=i}isCellHorizontallyInsideArea(t,e){if(!e.width||!e.height)return!1;const i=e.x+e.width,s=t.time.currentView.leftPx,a=t.time.currentView.rightPx;return s>=e.x&&s<=i||a>=e.x&&a<=i||s<=e.x&&a>=i||s>=e.x&&a<=i}getCellsUnderSelectionArea(t){const e=this.state.get("$data.chart.grid.cells"),i=[];for(const s in e){const a=e[s];this.isCellVerticallyInsideArea(a,t)&&this.isCellHorizontallyInsideArea(a,t)&&(i.find((t=>t===a.id))||i.push(a.id))}return{selectedCells:i}}updateItems(t){if(!this.data.items)return t;const e=this.api.getAllItems(),s=Array.from(new Set([...this.data.selecting[i],...this.data.selected[i]]));return t=t.update("$data.chart.items",(t=>{for(const a in t)if(a in e)if(s.includes(a)){const e=this.data.selecting[i].includes(a),s=this.data.selected[i].includes(a);t[a].selected=s,t[a].selecting=e}else t[a].selected=!1,t[a].selecting=!1;return t}),{data:"selection"})}updateCurrentItems(t){if(!this.data.items)return t;const e=this.state.get("$data.chart.items"),s=Array.from(new Set([...this.data.lastSelecting[i],...this.data.selecting[i],...this.data.selected[i]]));for(const t of s)e[t].selecting=this.data.selecting[i].includes(t),e[t].selected=this.data.selected[i].includes(t);return t}updateCells(t){if(!this.data.cells)return t;const i=this.api.getAllGridCells();return t.update("$data.chart.grid.cells",(t=>{for(const s in t){if(!(s in i))continue;const a=t[s];a&&(a.selected=this.data.selected[e].includes(a.id),a.selecting=this.data.selecting[e].includes(a.id))}return t})),t}updateCurrentCells(t){if(!this.data.items)return t;const i=Array.from(new Set([...this.data.lastSelecting[e],...this.data.selecting[e],...this.data.selected[e]]));for(const s of i){this.state.get(`$data.chart.grid.cells.${s}`)&&(t=t.update(`$data.chart.grid.cells.${s}`,(t=>(t.selected=this.data.selected[e].includes(s),t.selecting=this.data.selecting[e].includes(s),t))))}return t}deselectItems(){if(!this.data.items)return;this.data.selected[i].length=0,this.data.selecting[i].length=0;let t=this.state.multi(!0);t=this.updateItems(t),t.done()}deselectCells(){if(!this.data.cells)return;this.data.selecting[e].length=0,this.data.selected[e].length=0;let t=this.state.multi(!0);t=this.updateCells(t),t.done()}getSelectionWithData(t){const s=this.state.get("config.chart.items"),a=this.state.get("$data.chart.grid.cells");return{[e]:t[e].map((t=>a[t]?a[t]:t)),[i]:t[i].map((t=>s[t]?s[t]:t))}}onSelecting(t,s){const a=this.getSelectionWithData(t),l=this.getSelectionWithData(s);this.started||(this.data.events.onStart(l),this.started=!0,this.api.muteMethod("fullReload"),this.api.muteMethod("prepareExpanded"),this.api.muteMethod("calculateRowsHeight"),this.api.muteMethod("recalculateRowPercents"),this.api.muteMethod("getLastPageRowsHeight"),this.api.muteMethod("calculateVerticalScrollArea"),this.api.muteMethod("calculateVisibleRowsHeights"),this.api.muteMethod("generateVisibleRowsAndItems"),this.api.muteMethod("recalculateTimes"),this.api.muteMethod("heightChange"));const n=this.data.events.onSelecting(a,l);return{[e]:n[e].map((t=>"string"!=typeof t?t.id:t)),[i]:n[i].map((t=>"string"!=typeof t?t.id:t))}}onSelected(t,s){const a=this.getSelectionWithData(t),l=this.getSelectionWithData(s),n=this.data.events.onEnd(a,l);return this.started=!1,this.api.unmuteMethod("heightChange"),this.api.unmuteMethod("recalculateTimes"),this.api.unmuteMethod("generateVisibleRowsAndItems"),this.api.unmuteMethod("calculateVisibleRowsHeights"),this.api.unmuteMethod("calculateVerticalScrollArea"),this.api.unmuteMethod("getLastPageRowsHeight"),this.api.unmuteMethod("recalculateRowPercents"),this.api.unmuteMethod("calculateRowsHeight"),this.api.unmuteMethod("prepareExpanded"),this.api.unmuteMethod("fullReload"),{[e]:n[e].map((t=>"string"!=typeof t?t.id:t)),[i]:n[i].map((t=>"string"!=typeof t?t.id:t))}}updateBodyClass(){this.data.isSelecting?document.body.classList.add(this.data.bodySelectingClassName):document.body.classList.remove(this.data.bodySelectingClassName),this.data.selected[e].length||this.data.selected[i].length?document.body.classList.add(this.data.bodySelectedClassName):document.body.classList.remove(this.data.bodySelectedClassName)}selectMultipleCellsAndItems(t){if(!this.canSelect())return;if(!this.data.multipleSelection)return this.deselectItems(),this.deselectCells(),void this.updateData();this.data.isSelecting=!0,this.data.selectionAreaLocal=this.getSelectionAreaLocal(t),this.data.selectionAreaGlobal=this.translateAreaLocalToGlobal(this.data.selectionAreaLocal);const s={[e]:[],[i]:[]},a=this.isMulti();if(this.data.cells){const{selectedCells:t}=this.getCellsUnderSelectionArea(this.data.selectionAreaLocal);0===t.length?(s[e].length=0,a||(this.data.selected[e].length=0)):s[e]=t}if(this.data.items){const{selectedItems:t,automaticallySelectedItems:e}=this.getItemsUnderSelectionArea(this.data.selectionAreaLocal);this.data.automaticallySelected[i]=e,0===t.length?(s[i].length=0,a||(this.data.selected[i].length=0)):s[i]=t}if(this.data.cells||this.data.items){this.data.lastSelecting={[i]:[...this.data.selecting[i]],[e]:[...this.data.selecting[e]]},this.data.selecting=this.onSelecting(s,this.api.mergeDeep({},this.data.lastSelected));let t=this.state.multi(!0);this.data.cells&&(t=this.updateCurrentCells(t)),this.data.items&&(t=this.updateCurrentItems(t)),t.done()}}selectItemsIndividually(t){if(this.data.isSelecting=!1,this.data.selectionAreaLocal=this.getSelectionAreaLocal(t),this.data.currentPosition=t.currentPosition,this.data.initialPosition=t.initialPosition,!this.data.items)return;if(!this.canSelect())return;if(!t.targetData)return;const s=this.merge({},t.targetData),a=this.api.getItemData(s.id);if(!a)throw console.error('"config.chart.items"',this.state.get("config.chart.items")),console.error('"$data.chart.items"',this.state.get("$data.chart.items")),new Error(`Item with id "${s.id}" does not exists in "$data.chart.items". TIP: For performance reasons, state is mutable, so try not to modify items from the "state.get" method before you copy them (with "gstc.api.clone(items)" for example).`);if(this.data.selected[i].includes(s.id))return;let{selected:l,automaticallySelected:n}=this.getSelectedItem(s);l.length>1&&!this.data.multipleSelection&&(l=[s.id],n=[]),this.isMulti()?a.selected?this.data.selected[i]=l.filter((t=>t!==s.id&&!n.includes(t))):this.data.selected[i]=l:(this.data.selected[i]=l,this.data.selected[e].length=0),this.data.automaticallySelected[i]=n,this.data.lastSelecting={[i]:[...this.data.selected[i]],[e]:[...this.data.selected[e]]},this.data.selected=this.onSelected(this.api.mergeDeep({},this.data.selected),this.api.mergeDeep({},this.data.lastSelected));let c=this.state.multi(!0);c=this.updateCells(c),c=this.updateItems(c),c.done()}removeMultiUnselected(t){const e=this.data.selected[t].filter((e=>this.data.selecting[t].includes(e))),i=[...this.data.selected[t],...this.data.selecting[t]];return Array.from(new Set(i.filter((t=>!e.includes(t)))))}finishSelection(){if(!this.canSelect())return;let t;t=this.isMulti()?{[e]:this.data.cells?this.removeMultiUnselected(e):[],[i]:this.data.items?this.removeMultiUnselected(i):[]}:{[e]:this.data.cells?[...this.data.selecting[e]]:[],[i]:this.data.items?[...this.data.selecting[i]]:[]},this.data.selected=this.onSelected(t,this.api.mergeDeep({},this.data.lastSelected)),this.data.lastSelected=this.api.mergeDeep({},this.data.selected),this.data.cells&&(this.data.selecting[e].length=0),this.data.items&&(this.data.selecting[i].length=0);let s=this.state.multi(!0);s=this.updateItems(s),s=this.updateCells(s),s.done()}onPointerData(t){if(this.lastAllEvents=t.allEvents,t.isMoving&&t.targetType===e&&this.data.rectangularSelection?this.selectMultipleCellsAndItems(t):t.isMoving&&t.targetType===e&&!this.data.rectangularSelection?this.deselectItems():t.targetType===i?this.selectItemsIndividually(t):t.isMoving||(this.data.isSelecting&&this.finishSelection(),this.data.isSelecting=!1),t.isMoving&&t.targetType!==e&&t.targetType!==i&&this.deselectItems(),this.data.pointerState=t.type,this.data.targetType=t.targetType,this.data.targetData=t.targetData,"down"===this.data.pointerState){let t=this.state.multi(!0);t=this.updateItems(t),t=this.updateCells(t),t.done()}this.updateData(),this.updateBodyClass()}onTimelinePointerDown(t){this.data.enabled&&this.onPointerData(t)}onTimelinePointerMove(t){this.data.enabled&&this.onPointerData(t)}onTimelinePointerUp(t){this.data.enabled&&this.onPointerData(t)}slot(){let t,e=!0;return i=>(e=!0,this.canSelect()&&this.data.isSelecting&&this.data.showOverlay&&this.data.multipleSelection&&this.data.rectangularSelection&&(this.slotStyleMap.style.display="block",this.slotStyleMap.style.left=this.data.selectionAreaLocal.x+"px",this.slotStyleMap.style.top=this.data.selectionAreaLocal.y+"px",this.slotStyleMap.style.width=this.data.selectionAreaLocal.width+"px",this.slotStyleMap.style.height=this.data.selectionAreaLocal.height+"px",e=!1),t=this.html`<div class=${this.slotClassName} style=${this.slotStyleMap.directive()}></div>`,this.html`${i}${e?null:t}`)}updateSelectionClassName(t,e){if(!e&&!e.itemData)return;const i="boolean"==typeof e.selected?e.selected:e.itemData.selected,s="boolean"==typeof e.selecting?e.selecting:e.itemData.selecting;i?(t.classList.contains(this.data.selectedClassName)||t.classList.add(this.data.selectedClassName),t.classList.contains(this.data.selectingClassName)&&t.classList.remove(this.data.selectingClassName)):t.classList.contains(this.data.selectedClassName)&&t.classList.remove(this.data.selectedClassName),s?(t.classList.contains(this.data.selectingClassName)||t.classList.add(this.data.selectingClassName),t.classList.contains(this.data.selectedClassName)&&t.classList.remove(this.data.selectedClassName)):t.classList.contains(this.data.selectingClassName)&&t.classList.remove(this.data.selectingClassName)}selectedAction(t,e){this.updateSelectionClassName(t,e);const i=this;return{update(t,e){i.updateSelectionClassName(t,e)},destroy(t,e){i.updateSelectionClassName(t,e)}}}onCellCreate(t){return t.selected=!!this.data.selected[e].find((e=>e===t.id)),t.selecting=!!this.data.selecting[e].find((e=>e===t.id)),t.content}}t.Plugin=function(t={}){return t=function(t){!
|
|
14
|
+
/**
|
|
15
|
+
* Selection plugin
|
|
16
|
+
*
|
|
17
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
18
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
19
|
+
* @module gantt-schedule-timeline-calendar
|
|
20
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
21
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
22
|
+
* @version 3.37.5
|
|
23
|
+
* @released 2024-07-19
|
|
24
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
25
|
+
*/
|
|
26
|
+
function(t){t.events||(t.events={}),t.onStart&&(t.events.onStart=t.onStart),t.onSelecting&&(t.events.onSelecting=t.onSelecting),t.onSelected&&(t.events.onEnd=t.onSelected)}(t);const e={enabled:!0,cells:!0,items:!0,showOverlay:!0,rectangularSelection:!0,multipleSelection:!0,selectedClassName:"gstc__selected",selectingClassName:"gstc__selecting",bodySelectedClassName:"gstc__is-selected",bodySelectingClassName:"gstc__is-selecting",events:{onStart(){},onSelecting:t=>t,onEnd:t=>t}};return t.events=Object.assign(Object.assign({},e.events),t.events),Object.assign(Object.assign({},e),t)}(t),function(e){const i=e.api.mergeDeep,a=e.api;if(!a.isPluginInitialized("TimelinePointer"))throw new Error("TimelinePointer plugin must be initialized before Selection plugin.");const n=e.state.get(s);n&&(t=i({},t,n));const c=new l(e,t);return a.pluginInitialized("Selection"),c.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeBookmarks plugin
|
|
3
|
+
*
|
|
4
|
+
* @header --gstc--header--
|
|
5
|
+
*/
|
|
6
|
+
import type { Vido } from '../gstc';
|
|
7
|
+
import type { Dayjs } from 'dayjs';
|
|
8
|
+
import type { StyleInfo, StyleMap } from '@neuronet.io/vido';
|
|
9
|
+
export declare const pluginPath = "config.plugin.TimeBookmarks";
|
|
10
|
+
export declare const slotPath = "config.slots.chart-timeline-items.outer";
|
|
11
|
+
export interface Bookmark {
|
|
12
|
+
time: string | number;
|
|
13
|
+
label: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use style instead of color
|
|
17
|
+
*/
|
|
18
|
+
color?: string;
|
|
19
|
+
style?: StyleInfo;
|
|
20
|
+
}
|
|
21
|
+
export interface InternalBookmark extends Bookmark {
|
|
22
|
+
id: string;
|
|
23
|
+
leftViewPx: number;
|
|
24
|
+
absoluteLeftPx: number;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
date: Dayjs;
|
|
27
|
+
styleMap: StyleMap;
|
|
28
|
+
}
|
|
29
|
+
export interface Bookmarks {
|
|
30
|
+
[key: string]: Bookmark;
|
|
31
|
+
}
|
|
32
|
+
export interface Options {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
bookmarks?: Bookmarks;
|
|
36
|
+
}
|
|
37
|
+
export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
|
|
38
|
+
//# sourceMappingURL=time-bookmarks.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeBookmarks plugin
|
|
3
|
+
*
|
|
4
|
+
* @header --gstc--header--
|
|
5
|
+
*/
|
|
6
|
+
import type { Vido } from '../gstc';
|
|
7
|
+
import type { Dayjs } from 'dayjs';
|
|
8
|
+
import type { StyleInfo, StyleMap } from '@neuronet.io/vido';
|
|
9
|
+
export declare const pluginPath = "config.plugin.TimeBookmarks";
|
|
10
|
+
export declare const slotPath = "config.slots.chart-timeline-items.outer";
|
|
11
|
+
export interface Bookmark {
|
|
12
|
+
time: string | number;
|
|
13
|
+
label: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use style instead of color
|
|
17
|
+
*/
|
|
18
|
+
color?: string;
|
|
19
|
+
style?: StyleInfo;
|
|
20
|
+
}
|
|
21
|
+
export interface InternalBookmark extends Bookmark {
|
|
22
|
+
id: string;
|
|
23
|
+
leftViewPx: number;
|
|
24
|
+
absoluteLeftPx: number;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
date: Dayjs;
|
|
27
|
+
styleMap: StyleMap;
|
|
28
|
+
}
|
|
29
|
+
export interface Bookmarks {
|
|
30
|
+
[key: string]: Bookmark;
|
|
31
|
+
}
|
|
32
|
+
export interface Options {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
bookmarks?: Bookmarks;
|
|
36
|
+
}
|
|
37
|
+
export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
|
|
38
|
+
//# sourceMappingURL=time-bookmarks.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gantt-Schedule-Timeline-Calendar helpers
|
|
3
|
+
*
|
|
4
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
5
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
6
|
+
* @module gantt-schedule-timeline-calendar
|
|
7
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
8
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
9
|
+
* @version 3.37.5
|
|
10
|
+
* @released 2024-07-19
|
|
11
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
12
|
+
*/
|
|
13
|
+
const t="gstc";
|
|
14
|
+
/**
|
|
15
|
+
* TimeBookmarks plugin
|
|
16
|
+
*
|
|
17
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
18
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
19
|
+
* @module gantt-schedule-timeline-calendar
|
|
20
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
21
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
22
|
+
* @version 3.37.5
|
|
23
|
+
* @released 2024-07-19
|
|
24
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
25
|
+
*/
|
|
26
|
+
const s="config.plugin.TimeBookmarks",e="config.slots.chart-timeline-items.outer";class i{constructor(i,a){this.unsub=[],this.options=function(t){return Object.assign({enabled:!0,className:""},t)}(i),this.vido=a,this.state=a.state,this.className=function(s,e=""){let i=`${t}__${s}`;return s===t&&(i=t),e?`${i} ${i}--${e.replace(":","-")}`:i}("chart-time-bookmark")+(this.options.className?` ${this.options.className}`:""),this.PluginTimeBookmarksSlot=this.PluginTimeBookmarksSlot.bind(this),this.destroy=this.destroy.bind(this),this.state.update(s,this.options),this.state.update(e,(t=>(t.includes(this.PluginTimeBookmarksSlot)||t.push(this.PluginTimeBookmarksSlot),t))),this.unsub.push(this.state.subscribe(s,(t=>this.options=t)))}destroy(){this.unsub.forEach((t=>t())),this.state.update(e,(t=>t.filter((t=>t!==this.PluginTimeBookmarksSlot)))),this.vido.api.pluginDestroyed("TimeBookmarks")}PluginTimeBookmarksSlot(t){const{html:e,onDestroy:i,state:a,update:l,api:o,StyleMap:n}=t,c=[];i(a.subscribeAll([s,"$data.chart.time","$data.scroll.horizontal.dataIndex"],(()=>{var t;const e=a.get("$data.chart.time"),i=a.get(s);c.length=0;for(const s in i.bookmarks){const a=o.time.date(i.bookmarks[s].time);if(!o.time.isInCurrentView(a,e))continue;const l=Object.assign(Object.assign({},i.bookmarks[s]),{id:s,leftViewPx:0,absoluteLeftPx:0,visible:!1,date:null,styleMap:new n(Object.assign(null!==(t=i.bookmarks[s].style)&&void 0!==t?t:{},{left:"",height:""}))});l.styleMap.style.background=l.styleMap.style.background||l.color||"#3498DB",l.id=s,l.date=a,l.leftViewPx=o.time.getViewOffsetPxFromDates(a,!1,e),l.absoluteLeftPx=o.time.getGlobalOffsetPxFromDates(l.date,!1,e),l.visible=l.absoluteLeftPx>=e.leftPx&&l.absoluteLeftPx<=e.rightPx,c.push(l)}l()}),{group:!0}));let r=0,h=0;i(a.subscribe("$data.scroll.vertical",(t=>{r=Math.round(o.getRealChartHeight()),h=Math.round(-t.preciseOffset),l()})));const m=t=>e`<div
|
|
27
|
+
class="${this.className}-line ${this.className}-line--${t.id}${t.className?` ${t.className}`:""}"
|
|
28
|
+
style="left:${t.leftViewPx}px;top: ${h}px;"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
class="${this.className}-line-content ${this.className}-line-content--${t.id}"
|
|
32
|
+
style="border-left: 1px solid ${t.styleMap.style.background};"
|
|
33
|
+
></div>
|
|
34
|
+
</div>`,d=t=>e`<div
|
|
35
|
+
class="${this.className}-label ${this.className}-label--${t.id}${t.className?` ${t.className}`:""}"
|
|
36
|
+
style="left:${t.leftViewPx}px;top: ${h}px;"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
class="${this.className}-label-content ${this.className}-label-content--${t.id}"
|
|
40
|
+
style=${t.styleMap.directive()}
|
|
41
|
+
>
|
|
42
|
+
${t.label}
|
|
43
|
+
</div>
|
|
44
|
+
</div>`;return t=>e`<div class="${this.className}s ${this.className}s--lines" style="height: ${r}px;">
|
|
45
|
+
${c.filter((t=>t.visible)).map((t=>m(t)))}
|
|
46
|
+
</div>
|
|
47
|
+
${t}
|
|
48
|
+
<div class="${this.className}s ${this.className}s--labels" style="height: ${r}px;">
|
|
49
|
+
${c.filter((t=>t.visible)).map((t=>d(t)))}
|
|
50
|
+
</div>`}}function a(t={}){return function(e){const a=e.state.get(s);a&&(t=e.api.mergeDeep({},t,a));const l=new i(t,e);return e.api.pluginInitialized("TimeBookmarks"),l.destroy}}export{a as Plugin,s as pluginPath,e as slotPath};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeBookmarks plugin
|
|
3
|
+
*
|
|
4
|
+
* @header --gstc--header--
|
|
5
|
+
*/
|
|
6
|
+
import type { Vido } from '../gstc';
|
|
7
|
+
import type { Dayjs } from 'dayjs';
|
|
8
|
+
import type { StyleInfo, StyleMap } from '@neuronet.io/vido';
|
|
9
|
+
export declare const pluginPath = "config.plugin.TimeBookmarks";
|
|
10
|
+
export declare const slotPath = "config.slots.chart-timeline-items.outer";
|
|
11
|
+
export interface Bookmark {
|
|
12
|
+
time: string | number;
|
|
13
|
+
label: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Use style instead of color
|
|
17
|
+
*/
|
|
18
|
+
color?: string;
|
|
19
|
+
style?: StyleInfo;
|
|
20
|
+
}
|
|
21
|
+
export interface InternalBookmark extends Bookmark {
|
|
22
|
+
id: string;
|
|
23
|
+
leftViewPx: number;
|
|
24
|
+
absoluteLeftPx: number;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
date: Dayjs;
|
|
27
|
+
styleMap: StyleMap;
|
|
28
|
+
}
|
|
29
|
+
export interface Bookmarks {
|
|
30
|
+
[key: string]: Bookmark;
|
|
31
|
+
}
|
|
32
|
+
export interface Options {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
className?: string;
|
|
35
|
+
bookmarks?: Bookmarks;
|
|
36
|
+
}
|
|
37
|
+
export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
|
|
38
|
+
//# sourceMappingURL=time-bookmarks.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
!function(t,s){"object"==typeof exports&&"undefined"!=typeof module?s(exports):"function"==typeof define&&define.amd?define(["exports"],s):s((t="undefined"!=typeof globalThis?globalThis:t||self).TimeBookmarks={})}(this,(function(t){"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Gantt-Schedule-Timeline-Calendar helpers
|
|
4
|
+
*
|
|
5
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
6
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
7
|
+
* @module gantt-schedule-timeline-calendar
|
|
8
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
9
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
10
|
+
* @version 3.37.5
|
|
11
|
+
* @released 2024-07-19
|
|
12
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
13
|
+
*/const s="gstc";
|
|
14
|
+
/**
|
|
15
|
+
* TimeBookmarks plugin
|
|
16
|
+
*
|
|
17
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
18
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
19
|
+
* @module gantt-schedule-timeline-calendar
|
|
20
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
21
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
22
|
+
* @version 3.37.5
|
|
23
|
+
* @released 2024-07-19
|
|
24
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
25
|
+
*/
|
|
26
|
+
const e="config.plugin.TimeBookmarks",i="config.slots.chart-timeline-items.outer";class a{constructor(t,a){this.unsub=[],this.options=function(t){return Object.assign({enabled:!0,className:""},t)}(t),this.vido=a,this.state=a.state,this.className=function(t,e=""){let i=`${s}__${t}`;return t===s&&(i=s),e?`${i} ${i}--${e.replace(":","-")}`:i}("chart-time-bookmark")+(this.options.className?` ${this.options.className}`:""),this.PluginTimeBookmarksSlot=this.PluginTimeBookmarksSlot.bind(this),this.destroy=this.destroy.bind(this),this.state.update(e,this.options),this.state.update(i,(t=>(t.includes(this.PluginTimeBookmarksSlot)||t.push(this.PluginTimeBookmarksSlot),t))),this.unsub.push(this.state.subscribe(e,(t=>this.options=t)))}destroy(){this.unsub.forEach((t=>t())),this.state.update(i,(t=>t.filter((t=>t!==this.PluginTimeBookmarksSlot)))),this.vido.api.pluginDestroyed("TimeBookmarks")}PluginTimeBookmarksSlot(t){const{html:s,onDestroy:i,state:a,update:l,api:o,StyleMap:n}=t,c=[];i(a.subscribeAll([e,"$data.chart.time","$data.scroll.horizontal.dataIndex"],(()=>{var t;const s=a.get("$data.chart.time"),i=a.get(e);c.length=0;for(const e in i.bookmarks){const a=o.time.date(i.bookmarks[e].time);if(!o.time.isInCurrentView(a,s))continue;const l=Object.assign(Object.assign({},i.bookmarks[e]),{id:e,leftViewPx:0,absoluteLeftPx:0,visible:!1,date:null,styleMap:new n(Object.assign(null!==(t=i.bookmarks[e].style)&&void 0!==t?t:{},{left:"",height:""}))});l.styleMap.style.background=l.styleMap.style.background||l.color||"#3498DB",l.id=e,l.date=a,l.leftViewPx=o.time.getViewOffsetPxFromDates(a,!1,s),l.absoluteLeftPx=o.time.getGlobalOffsetPxFromDates(l.date,!1,s),l.visible=l.absoluteLeftPx>=s.leftPx&&l.absoluteLeftPx<=s.rightPx,c.push(l)}l()}),{group:!0}));let r=0,d=0;i(a.subscribe("$data.scroll.vertical",(t=>{r=Math.round(o.getRealChartHeight()),d=Math.round(-t.preciseOffset),l()})));const h=t=>s`<div
|
|
27
|
+
class="${this.className}-line ${this.className}-line--${t.id}${t.className?` ${t.className}`:""}"
|
|
28
|
+
style="left:${t.leftViewPx}px;top: ${d}px;"
|
|
29
|
+
>
|
|
30
|
+
<div
|
|
31
|
+
class="${this.className}-line-content ${this.className}-line-content--${t.id}"
|
|
32
|
+
style="border-left: 1px solid ${t.styleMap.style.background};"
|
|
33
|
+
></div>
|
|
34
|
+
</div>`,m=t=>s`<div
|
|
35
|
+
class="${this.className}-label ${this.className}-label--${t.id}${t.className?` ${t.className}`:""}"
|
|
36
|
+
style="left:${t.leftViewPx}px;top: ${d}px;"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
class="${this.className}-label-content ${this.className}-label-content--${t.id}"
|
|
40
|
+
style=${t.styleMap.directive()}
|
|
41
|
+
>
|
|
42
|
+
${t.label}
|
|
43
|
+
</div>
|
|
44
|
+
</div>`;return t=>s`<div class="${this.className}s ${this.className}s--lines" style="height: ${r}px;">
|
|
45
|
+
${c.filter((t=>t.visible)).map((t=>h(t)))}
|
|
46
|
+
</div>
|
|
47
|
+
${t}
|
|
48
|
+
<div class="${this.className}s ${this.className}s--labels" style="height: ${r}px;">
|
|
49
|
+
${c.filter((t=>t.visible)).map((t=>m(t)))}
|
|
50
|
+
</div>`}}t.Plugin=function(t={}){return function(s){const i=s.state.get(e);i&&(t=s.api.mergeDeep({},t,i));const l=new a(t,s);return s.api.pluginInitialized("TimeBookmarks"),l.destroy}},t.pluginPath=e,t.slotPath=i,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimelinePointer plugin
|
|
3
|
+
*
|
|
4
|
+
* @header --gstc--header--
|
|
5
|
+
*/
|
|
6
|
+
import type { Vido } from '../gstc';
|
|
7
|
+
export declare const CELL = "chart-timeline-grid-row-cell";
|
|
8
|
+
export type CELL_TYPE = 'chart-timeline-grid-row-cell';
|
|
9
|
+
export declare const ITEM = "chart-timeline-items-row-item";
|
|
10
|
+
export type ITEM_TYPE = 'chart-timeline-items-row-item';
|
|
11
|
+
export type SELECTION_TYPE = typeof CELL | typeof ITEM;
|
|
12
|
+
export interface TimelinePointerEvents {
|
|
13
|
+
down: PointerEvent | null;
|
|
14
|
+
move: PointerEvent | null;
|
|
15
|
+
up: PointerEvent | null;
|
|
16
|
+
}
|
|
17
|
+
export interface TimelinePointerPoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
export type TimelinePointerState = 'up' | 'down' | 'move';
|
|
22
|
+
export interface TimelinePointerCaptureEvents {
|
|
23
|
+
up?: boolean;
|
|
24
|
+
down?: boolean;
|
|
25
|
+
move?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TimelinePointerLocked {
|
|
28
|
+
up: boolean | string;
|
|
29
|
+
down: boolean | string;
|
|
30
|
+
move: boolean | string;
|
|
31
|
+
}
|
|
32
|
+
export interface Options {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
captureEvents?: TimelinePointerCaptureEvents;
|
|
35
|
+
}
|
|
36
|
+
export interface TimelinePointerOffset {
|
|
37
|
+
top: number;
|
|
38
|
+
left: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Movement {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
}
|
|
44
|
+
export type TargetType = ITEM_TYPE | CELL_TYPE | '';
|
|
45
|
+
export interface PluginData extends Options {
|
|
46
|
+
isMoving: boolean;
|
|
47
|
+
pointerState: TimelinePointerState;
|
|
48
|
+
currentTarget: HTMLElement | null;
|
|
49
|
+
realTarget: HTMLElement | null;
|
|
50
|
+
targetType: TargetType;
|
|
51
|
+
targetData: any | null;
|
|
52
|
+
events: TimelinePointerEvents;
|
|
53
|
+
initialPosition: TimelinePointerPoint;
|
|
54
|
+
currentPosition: TimelinePointerPoint;
|
|
55
|
+
movement: Movement;
|
|
56
|
+
}
|
|
57
|
+
export interface ScrollPosPx {
|
|
58
|
+
horizontal: number;
|
|
59
|
+
vertical: number;
|
|
60
|
+
}
|
|
61
|
+
export interface TimelinePointerEvent {
|
|
62
|
+
type: TimelinePointerState;
|
|
63
|
+
originalEvent: PointerEvent;
|
|
64
|
+
targetElement: HTMLElement;
|
|
65
|
+
targetData: any;
|
|
66
|
+
targetType: TargetType;
|
|
67
|
+
initialScrollPosPx: ScrollPosPx;
|
|
68
|
+
initialPosition: TimelinePointerPoint;
|
|
69
|
+
currentPosition: TimelinePointerPoint;
|
|
70
|
+
movement: Movement;
|
|
71
|
+
isMoving: boolean;
|
|
72
|
+
allEvents: TimelinePointerEvents;
|
|
73
|
+
}
|
|
74
|
+
export type PointerListener = (event: TimelinePointerEvent) => void;
|
|
75
|
+
export interface ApiPointerListeners {
|
|
76
|
+
down: Set<PointerListener>;
|
|
77
|
+
move: Set<PointerListener>;
|
|
78
|
+
up: Set<PointerListener>;
|
|
79
|
+
}
|
|
80
|
+
export type AddPointerListener = (type: TimelinePointerState, callback: PointerListener) => void;
|
|
81
|
+
export type RemovePointerListener = (type: TimelinePointerState, callback: PointerListener) => void;
|
|
82
|
+
export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
|
|
83
|
+
//# sourceMappingURL=timeline-pointer.d.ts.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimelinePointer plugin
|
|
3
|
+
*
|
|
4
|
+
* @header --gstc--header--
|
|
5
|
+
*/
|
|
6
|
+
import type { Vido } from '../gstc';
|
|
7
|
+
export declare const CELL = "chart-timeline-grid-row-cell";
|
|
8
|
+
export type CELL_TYPE = 'chart-timeline-grid-row-cell';
|
|
9
|
+
export declare const ITEM = "chart-timeline-items-row-item";
|
|
10
|
+
export type ITEM_TYPE = 'chart-timeline-items-row-item';
|
|
11
|
+
export type SELECTION_TYPE = typeof CELL | typeof ITEM;
|
|
12
|
+
export interface TimelinePointerEvents {
|
|
13
|
+
down: PointerEvent | null;
|
|
14
|
+
move: PointerEvent | null;
|
|
15
|
+
up: PointerEvent | null;
|
|
16
|
+
}
|
|
17
|
+
export interface TimelinePointerPoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
export type TimelinePointerState = 'up' | 'down' | 'move';
|
|
22
|
+
export interface TimelinePointerCaptureEvents {
|
|
23
|
+
up?: boolean;
|
|
24
|
+
down?: boolean;
|
|
25
|
+
move?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TimelinePointerLocked {
|
|
28
|
+
up: boolean | string;
|
|
29
|
+
down: boolean | string;
|
|
30
|
+
move: boolean | string;
|
|
31
|
+
}
|
|
32
|
+
export interface Options {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
captureEvents?: TimelinePointerCaptureEvents;
|
|
35
|
+
}
|
|
36
|
+
export interface TimelinePointerOffset {
|
|
37
|
+
top: number;
|
|
38
|
+
left: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Movement {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
}
|
|
44
|
+
export type TargetType = ITEM_TYPE | CELL_TYPE | '';
|
|
45
|
+
export interface PluginData extends Options {
|
|
46
|
+
isMoving: boolean;
|
|
47
|
+
pointerState: TimelinePointerState;
|
|
48
|
+
currentTarget: HTMLElement | null;
|
|
49
|
+
realTarget: HTMLElement | null;
|
|
50
|
+
targetType: TargetType;
|
|
51
|
+
targetData: any | null;
|
|
52
|
+
events: TimelinePointerEvents;
|
|
53
|
+
initialPosition: TimelinePointerPoint;
|
|
54
|
+
currentPosition: TimelinePointerPoint;
|
|
55
|
+
movement: Movement;
|
|
56
|
+
}
|
|
57
|
+
export interface ScrollPosPx {
|
|
58
|
+
horizontal: number;
|
|
59
|
+
vertical: number;
|
|
60
|
+
}
|
|
61
|
+
export interface TimelinePointerEvent {
|
|
62
|
+
type: TimelinePointerState;
|
|
63
|
+
originalEvent: PointerEvent;
|
|
64
|
+
targetElement: HTMLElement;
|
|
65
|
+
targetData: any;
|
|
66
|
+
targetType: TargetType;
|
|
67
|
+
initialScrollPosPx: ScrollPosPx;
|
|
68
|
+
initialPosition: TimelinePointerPoint;
|
|
69
|
+
currentPosition: TimelinePointerPoint;
|
|
70
|
+
movement: Movement;
|
|
71
|
+
isMoving: boolean;
|
|
72
|
+
allEvents: TimelinePointerEvents;
|
|
73
|
+
}
|
|
74
|
+
export type PointerListener = (event: TimelinePointerEvent) => void;
|
|
75
|
+
export interface ApiPointerListeners {
|
|
76
|
+
down: Set<PointerListener>;
|
|
77
|
+
move: Set<PointerListener>;
|
|
78
|
+
up: Set<PointerListener>;
|
|
79
|
+
}
|
|
80
|
+
export type AddPointerListener = (type: TimelinePointerState, callback: PointerListener) => void;
|
|
81
|
+
export type RemovePointerListener = (type: TimelinePointerState, callback: PointerListener) => void;
|
|
82
|
+
export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
|
|
83
|
+
//# sourceMappingURL=timeline-pointer.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimelinePointer plugin
|
|
3
|
+
*
|
|
4
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
5
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
6
|
+
* @module gantt-schedule-timeline-calendar
|
|
7
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
8
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
9
|
+
* @version 3.37.5
|
|
10
|
+
* @released 2024-07-19
|
|
11
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
12
|
+
*/
|
|
13
|
+
const t="chart-timeline-grid-row-cell",i="chart-timeline-items-row-item";function e(t={}){const i={enabled:!0,isMoving:!1,pointerState:"up",currentTarget:null,realTarget:null,targetType:"",targetData:null,captureEvents:{down:!1,up:!1,move:!1},initialPosition:{x:0,y:0},currentPosition:{x:0,y:0},movement:{x:0,y:0},events:{down:null,move:null,up:null}};return t.captureEvents&&(i.captureEvents=Object.assign(Object.assign({},i.captureEvents),t.captureEvents)),i}const a="TimelinePointer",s=`config.plugin.${a}`;class n{constructor(a,n){this.locked={up:!1,move:!1,down:!1},this.initialScrollPosPx={horizontal:0,vertical:0},this.onDestroy=[],this.classNames={cell:"",item:""},this.api=n.api,this.state=n.state,this.apiPointerListeners={down:new Set,move:new Set,up:new Set},this.pointerDown=this.pointerDown.bind(this),this.pointerMove=this.pointerMove.bind(this),this.pointerMove=n.schedule(this.pointerMove),this.pointerUp=this.pointerUp.bind(this),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>{t&&(this.element=t,this.element.removeEventListener("pointerdown",this.pointerDown),this.element.addEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.addEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove),document.addEventListener("pointermove",this.pointerMove))}))),this.apiLock=this.apiLock.bind(this),this.apiUnlock=this.apiUnlock.bind(this),this.apiIsLocked=this.apiIsLocked.bind(this),this.apiAddPointerListener=this.apiAddPointerListener.bind(this),this.apiRemovePointerListener=this.apiRemovePointerListener.bind(this),this.getRealPosition=this.getRealPosition.bind(this),this.data=e(a),this.classNames.cell=this.api.getClass(t),this.classNames.item=this.api.getClass(i),this.destroy=this.destroy.bind(this),this.api.plugins.TimelinePointer={lock:this.apiLock,unlock:this.apiUnlock,isLocked:this.apiIsLocked,addPointerListener:this.apiAddPointerListener,removePointerListener:this.apiRemovePointerListener},this.onDestroy.push(this.state.subscribe(s,(t=>this.data=t)))}destroy(){this.onDestroy.forEach((t=>t())),this.element.removeEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove),this.api.pluginDestroyed(a)}updateData(){this.state.update(s,(()=>Object.assign({},this.data)))}apiLock(t,i=!0){this.locked[t]=i}apiUnlock(t){this.locked[t]=!1}apiIsLocked(t){return this.locked[t]}apiAddPointerListener(t,i){this.apiPointerListeners[t].add(i)}apiRemovePointerListener(t,i){this.apiPointerListeners[t].delete(i)}apiTriggerPointerListener(t,i){this.apiPointerListeners[t].forEach((t=>t(i)))}getRealTarget(e){let a=e.target.closest("."+this.classNames.item);return a||(a=e.target.closest("."+this.classNames.cell),a||(a=e.target.closest(`[data-type="${i}"]`),a||(a=e.target.closest(`[data-type="${t}"]`),a||null)))}getRealPosition(t){const i={x:0,y:0};if(this.element){const e=this.element.getBoundingClientRect();i.x=t.clientX-e.x,i.y=t.clientY-e.y;const a=this.state.get("$data.scroll.vertical.preciseOffset")||0;i.y-=a}return i}pointerDown(e){if(!this.data.enabled)return;this.initialScrollPosPx.horizontal=this.state.get("$data.scroll.horizontal.handlePosPx"),this.initialScrollPosPx.vertical=this.state.get("$data.scroll.vertical.handlePosPx"),this.data.pointerState="down",this.data.currentTarget=e.target;const a=this.getRealTarget(e);if(this.data.realTarget=a,this.data.targetType="",this.data.targetData=null,this.data.realTarget)if(this.data.realTarget.classList.contains(this.classNames.item))this.data.targetType=i,this.data.targetData=this.data.realTarget.vido.item;else if(this.data.realTarget.classList.contains(this.classNames.cell))this.data.targetType=t,this.data.targetData=this.data.realTarget.vido;else if(this.data.realTarget.dataset.type===i){this.data.targetType=i;const t=this.data.realTarget.dataset.gstcid;this.data.targetData=this.api.getItem(t)}else if(this.data.realTarget.dataset.type===t){this.data.targetType=t;const i=this.data.realTarget.dataset.gstcid;this.data.targetData=this.state.get(`$data.chart.grid.cells.${i}`)}this.data.isMoving=!!this.data.targetType,this.data.events.down=e,this.data.events.move=e;const s=this.getRealPosition(e);this.data.initialPosition=s,this.data.currentPosition=s;const n={type:this.data.pointerState,originalEvent:e,targetElement:a,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:{x:0,y:0},initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("down",n),this.updateData()}pointerUp(t){if(!this.data.enabled)return;this.data.pointerState="up",this.data.isMoving=!1,this.data.events.up=t,this.data.currentPosition=this.getRealPosition(t);const i={type:this.data.pointerState,originalEvent:t,targetElement:this.data.realTarget,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:this.data.movement,initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("up",i),this.data.realTarget=null,this.data.targetData=null,this.updateData()}pointerMove(t){if(!this.data.enabled||!this.data.isMoving)return;const i=this.state.get("$data.scroll.horizontal.handlePosPx");this.data.pointerState="move",this.data.events.move=t,this.data.currentPosition=this.getRealPosition(t),this.data.movement.x=this.data.currentPosition.x-this.data.initialPosition.x,this.data.movement.y=this.data.currentPosition.y-this.data.initialPosition.y,this.data.movement.x+=i-this.initialScrollPosPx.horizontal;const e={type:this.data.pointerState,originalEvent:t,targetElement:this.data.realTarget,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:this.data.movement,initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("move",e),this.updateData()}}function o(t={}){return function(i){const a=i.api,o=i.api.mergeDeep,r=i.state.get(s);r&&(t=o(o({},t),r));const h=e(t);i.state.update(s,h);const l=new n(t,i);return a.pluginInitialized("TimelinePointer"),l.destroy}}export{t as CELL,i as ITEM,o as Plugin};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimelinePointer plugin
|
|
3
|
+
*
|
|
4
|
+
* @header --gstc--header--
|
|
5
|
+
*/
|
|
6
|
+
import type { Vido } from '../gstc';
|
|
7
|
+
export declare const CELL = "chart-timeline-grid-row-cell";
|
|
8
|
+
export type CELL_TYPE = 'chart-timeline-grid-row-cell';
|
|
9
|
+
export declare const ITEM = "chart-timeline-items-row-item";
|
|
10
|
+
export type ITEM_TYPE = 'chart-timeline-items-row-item';
|
|
11
|
+
export type SELECTION_TYPE = typeof CELL | typeof ITEM;
|
|
12
|
+
export interface TimelinePointerEvents {
|
|
13
|
+
down: PointerEvent | null;
|
|
14
|
+
move: PointerEvent | null;
|
|
15
|
+
up: PointerEvent | null;
|
|
16
|
+
}
|
|
17
|
+
export interface TimelinePointerPoint {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}
|
|
21
|
+
export type TimelinePointerState = 'up' | 'down' | 'move';
|
|
22
|
+
export interface TimelinePointerCaptureEvents {
|
|
23
|
+
up?: boolean;
|
|
24
|
+
down?: boolean;
|
|
25
|
+
move?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TimelinePointerLocked {
|
|
28
|
+
up: boolean | string;
|
|
29
|
+
down: boolean | string;
|
|
30
|
+
move: boolean | string;
|
|
31
|
+
}
|
|
32
|
+
export interface Options {
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
captureEvents?: TimelinePointerCaptureEvents;
|
|
35
|
+
}
|
|
36
|
+
export interface TimelinePointerOffset {
|
|
37
|
+
top: number;
|
|
38
|
+
left: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Movement {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
}
|
|
44
|
+
export type TargetType = ITEM_TYPE | CELL_TYPE | '';
|
|
45
|
+
export interface PluginData extends Options {
|
|
46
|
+
isMoving: boolean;
|
|
47
|
+
pointerState: TimelinePointerState;
|
|
48
|
+
currentTarget: HTMLElement | null;
|
|
49
|
+
realTarget: HTMLElement | null;
|
|
50
|
+
targetType: TargetType;
|
|
51
|
+
targetData: any | null;
|
|
52
|
+
events: TimelinePointerEvents;
|
|
53
|
+
initialPosition: TimelinePointerPoint;
|
|
54
|
+
currentPosition: TimelinePointerPoint;
|
|
55
|
+
movement: Movement;
|
|
56
|
+
}
|
|
57
|
+
export interface ScrollPosPx {
|
|
58
|
+
horizontal: number;
|
|
59
|
+
vertical: number;
|
|
60
|
+
}
|
|
61
|
+
export interface TimelinePointerEvent {
|
|
62
|
+
type: TimelinePointerState;
|
|
63
|
+
originalEvent: PointerEvent;
|
|
64
|
+
targetElement: HTMLElement;
|
|
65
|
+
targetData: any;
|
|
66
|
+
targetType: TargetType;
|
|
67
|
+
initialScrollPosPx: ScrollPosPx;
|
|
68
|
+
initialPosition: TimelinePointerPoint;
|
|
69
|
+
currentPosition: TimelinePointerPoint;
|
|
70
|
+
movement: Movement;
|
|
71
|
+
isMoving: boolean;
|
|
72
|
+
allEvents: TimelinePointerEvents;
|
|
73
|
+
}
|
|
74
|
+
export type PointerListener = (event: TimelinePointerEvent) => void;
|
|
75
|
+
export interface ApiPointerListeners {
|
|
76
|
+
down: Set<PointerListener>;
|
|
77
|
+
move: Set<PointerListener>;
|
|
78
|
+
up: Set<PointerListener>;
|
|
79
|
+
}
|
|
80
|
+
export type AddPointerListener = (type: TimelinePointerState, callback: PointerListener) => void;
|
|
81
|
+
export type RemovePointerListener = (type: TimelinePointerState, callback: PointerListener) => void;
|
|
82
|
+
export declare function Plugin(options?: Options): (vidoInstance: Vido) => () => void;
|
|
83
|
+
//# sourceMappingURL=timeline-pointer.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).TimelinePointer={})}(this,(function(t){"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TimelinePointer plugin
|
|
4
|
+
*
|
|
5
|
+
* @copyright NEURONET - Rafal Pospiech
|
|
6
|
+
* @author Rafal Pospiech <neuronet.io@gmail.com>
|
|
7
|
+
* @module gantt-schedule-timeline-calendar
|
|
8
|
+
* @link https://github.com/neuronetio/gantt-schedule-timeline-calendar
|
|
9
|
+
* @link https://gantt-schedule-timeline-calendar.neuronet.io
|
|
10
|
+
* @version 3.37.5
|
|
11
|
+
* @released 2024-07-19
|
|
12
|
+
* @license SEE LICENSE IN LICENSE FILE
|
|
13
|
+
*/const e="chart-timeline-grid-row-cell",i="chart-timeline-items-row-item";function a(t={}){const e={enabled:!0,isMoving:!1,pointerState:"up",currentTarget:null,realTarget:null,targetType:"",targetData:null,captureEvents:{down:!1,up:!1,move:!1},initialPosition:{x:0,y:0},currentPosition:{x:0,y:0},movement:{x:0,y:0},events:{down:null,move:null,up:null}};return t.captureEvents&&(e.captureEvents=Object.assign(Object.assign({},e.captureEvents),t.captureEvents)),e}const s="TimelinePointer",n=`config.plugin.${s}`;class o{constructor(t,s){this.locked={up:!1,move:!1,down:!1},this.initialScrollPosPx={horizontal:0,vertical:0},this.onDestroy=[],this.classNames={cell:"",item:""},this.api=s.api,this.state=s.state,this.apiPointerListeners={down:new Set,move:new Set,up:new Set},this.pointerDown=this.pointerDown.bind(this),this.pointerMove=this.pointerMove.bind(this),this.pointerMove=s.schedule(this.pointerMove),this.pointerUp=this.pointerUp.bind(this),this.onDestroy.push(this.state.subscribe("$data.elements.chart-timeline",(t=>{t&&(this.element=t,this.element.removeEventListener("pointerdown",this.pointerDown),this.element.addEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.addEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove),document.addEventListener("pointermove",this.pointerMove))}))),this.apiLock=this.apiLock.bind(this),this.apiUnlock=this.apiUnlock.bind(this),this.apiIsLocked=this.apiIsLocked.bind(this),this.apiAddPointerListener=this.apiAddPointerListener.bind(this),this.apiRemovePointerListener=this.apiRemovePointerListener.bind(this),this.getRealPosition=this.getRealPosition.bind(this),this.data=a(t),this.classNames.cell=this.api.getClass(e),this.classNames.item=this.api.getClass(i),this.destroy=this.destroy.bind(this),this.api.plugins.TimelinePointer={lock:this.apiLock,unlock:this.apiUnlock,isLocked:this.apiIsLocked,addPointerListener:this.apiAddPointerListener,removePointerListener:this.apiRemovePointerListener},this.onDestroy.push(this.state.subscribe(n,(t=>this.data=t)))}destroy(){this.onDestroy.forEach((t=>t())),this.element.removeEventListener("pointerdown",this.pointerDown),document.removeEventListener("pointerup",this.pointerUp),document.removeEventListener("pointermove",this.pointerMove),this.api.pluginDestroyed(s)}updateData(){this.state.update(n,(()=>Object.assign({},this.data)))}apiLock(t,e=!0){this.locked[t]=e}apiUnlock(t){this.locked[t]=!1}apiIsLocked(t){return this.locked[t]}apiAddPointerListener(t,e){this.apiPointerListeners[t].add(e)}apiRemovePointerListener(t,e){this.apiPointerListeners[t].delete(e)}apiTriggerPointerListener(t,e){this.apiPointerListeners[t].forEach((t=>t(e)))}getRealTarget(t){let a=t.target.closest("."+this.classNames.item);return a||(a=t.target.closest("."+this.classNames.cell),a||(a=t.target.closest(`[data-type="${i}"]`),a||(a=t.target.closest(`[data-type="${e}"]`),a||null)))}getRealPosition(t){const e={x:0,y:0};if(this.element){const i=this.element.getBoundingClientRect();e.x=t.clientX-i.x,e.y=t.clientY-i.y;const a=this.state.get("$data.scroll.vertical.preciseOffset")||0;e.y-=a}return e}pointerDown(t){if(!this.data.enabled)return;this.initialScrollPosPx.horizontal=this.state.get("$data.scroll.horizontal.handlePosPx"),this.initialScrollPosPx.vertical=this.state.get("$data.scroll.vertical.handlePosPx"),this.data.pointerState="down",this.data.currentTarget=t.target;const a=this.getRealTarget(t);if(this.data.realTarget=a,this.data.targetType="",this.data.targetData=null,this.data.realTarget)if(this.data.realTarget.classList.contains(this.classNames.item))this.data.targetType=i,this.data.targetData=this.data.realTarget.vido.item;else if(this.data.realTarget.classList.contains(this.classNames.cell))this.data.targetType=e,this.data.targetData=this.data.realTarget.vido;else if(this.data.realTarget.dataset.type===i){this.data.targetType=i;const t=this.data.realTarget.dataset.gstcid;this.data.targetData=this.api.getItem(t)}else if(this.data.realTarget.dataset.type===e){this.data.targetType=e;const t=this.data.realTarget.dataset.gstcid;this.data.targetData=this.state.get(`$data.chart.grid.cells.${t}`)}this.data.isMoving=!!this.data.targetType,this.data.events.down=t,this.data.events.move=t;const s=this.getRealPosition(t);this.data.initialPosition=s,this.data.currentPosition=s;const n={type:this.data.pointerState,originalEvent:t,targetElement:a,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:{x:0,y:0},initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("down",n),this.updateData()}pointerUp(t){if(!this.data.enabled)return;this.data.pointerState="up",this.data.isMoving=!1,this.data.events.up=t,this.data.currentPosition=this.getRealPosition(t);const e={type:this.data.pointerState,originalEvent:t,targetElement:this.data.realTarget,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:this.data.movement,initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("up",e),this.data.realTarget=null,this.data.targetData=null,this.updateData()}pointerMove(t){if(!this.data.enabled||!this.data.isMoving)return;const e=this.state.get("$data.scroll.horizontal.handlePosPx");this.data.pointerState="move",this.data.events.move=t,this.data.currentPosition=this.getRealPosition(t),this.data.movement.x=this.data.currentPosition.x-this.data.initialPosition.x,this.data.movement.y=this.data.currentPosition.y-this.data.initialPosition.y,this.data.movement.x+=e-this.initialScrollPosPx.horizontal;const i={type:this.data.pointerState,originalEvent:t,targetElement:this.data.realTarget,targetData:this.data.targetData,targetType:this.data.targetType,initialPosition:this.data.initialPosition,currentPosition:this.data.currentPosition,movement:this.data.movement,initialScrollPosPx:this.initialScrollPosPx,isMoving:this.data.isMoving,allEvents:this.data.events};this.apiTriggerPointerListener("move",i),this.updateData()}}t.CELL=e,t.ITEM=i,t.Plugin=function(t={}){return function(e){const i=e.api,s=e.api.mergeDeep,r=e.state.get(n);r&&(t=s(s({},t),r));const h=a(t);e.state.update(n,h);const l=new o(t,e);return i.pluginInitialized("TimelinePointer"),l.destroy}},Object.defineProperty(t,"__esModule",{value:!0})}));
|