@revolist/revogrid 4.9.9 → 4.9.11
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/dist/cjs/column.drag.plugin-e636b5af.js +1686 -0
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +1 -0
- package/dist/cjs/{column.service-bfaba0e0.js → column.service-15c8352d.js} +443 -56
- package/dist/cjs/column.service-15c8352d.js.map +1 -0
- package/dist/cjs/{toNumber-838e6ff5.js → debounce-cb5f4e35.js} +229 -12
- package/dist/cjs/debounce-cb5f4e35.js.map +1 -0
- package/dist/cjs/{edit.utils-983f1a82.js → edit.utils-1172677c.js} +2 -2
- package/dist/cjs/{edit.utils-983f1a82.js.map → edit.utils-1172677c.js.map} +1 -1
- package/dist/cjs/{header-cell-renderer-53e4fd75.js → header-cell-renderer-375a879f.js} +42 -4
- package/dist/cjs/header-cell-renderer-375a879f.js.map +1 -0
- package/dist/cjs/{index-464d1aaf.js → index-28b6fdfb.js} +31 -31
- package/dist/cjs/{index-464d1aaf.js.map → index-28b6fdfb.js.map} +1 -1
- package/dist/cjs/index.cjs.js +39 -28
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{key.utils-12715159.js → key.utils-c62ab1e1.js} +2 -12
- package/dist/cjs/key.utils-c62ab1e1.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +704 -2034
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +17 -18
- package/dist/cjs/revogr-attribution_6.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +6 -77
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +117 -123
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +1 -2
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/{row-header-utils-e71dc7bf.js → row-header-utils-22ffee54.js} +2 -2
- package/dist/cjs/{row-header-utils-e71dc7bf.js.map → row-header-utils-22ffee54.js.map} +1 -1
- package/dist/cjs/sorting.sign-8bf92449.js +19 -0
- package/dist/cjs/sorting.sign-8bf92449.js.map +1 -0
- package/dist/cjs/text-editor-91a9f5b5.js +82 -0
- package/dist/cjs/text-editor-91a9f5b5.js.map +1 -0
- package/dist/cjs/{throttle-c893457e.js → throttle-5da5df51.js} +4 -5
- package/dist/cjs/throttle-5da5df51.js.map +1 -0
- package/dist/cjs/viewport.helpers-e59a544e.js +58 -0
- package/dist/cjs/viewport.helpers-e59a544e.js.map +1 -0
- package/dist/collection/components/editors/text-editor.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +1 -1
- package/dist/collection/components/overlay/keyboard.service.js +2 -2
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid-style.css +6 -0
- package/dist/collection/index.js +2 -2
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/plugins/index.js +16 -0
- package/dist/collection/plugins/index.js.map +1 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -1
- package/dist/collection/types/selection.js.map +1 -1
- package/dist/collection/utils/key.utils.js +0 -9
- package/dist/collection/utils/key.utils.js.map +1 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js +1665 -0
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +1 -0
- package/dist/esm/{column.service-6f1faf2d.js → column.service-414e9cba.js} +435 -51
- package/dist/esm/column.service-414e9cba.js.map +1 -0
- package/dist/esm/{toNumber-8de324a7.js → debounce-e8e9464a.js} +229 -13
- package/dist/esm/debounce-e8e9464a.js.map +1 -0
- package/dist/esm/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
- package/dist/esm/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-66d01daa.js → header-cell-renderer-ca570fcf.js} +40 -4
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +1 -0
- package/dist/esm/{index-c428acf6.js → index-74b9801b.js} +3 -3
- package/dist/esm/{index-c428acf6.js.map → index-74b9801b.js.map} +1 -1
- package/dist/esm/index.js +10 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{key.utils-b1f93f7e.js → key.utils-d3df5db8.js} +3 -12
- package/dist/esm/key.utils-d3df5db8.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +675 -2005
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +9 -10
- package/dist/esm/revogr-attribution_6.entry.js.map +1 -1
- package/dist/esm/revogr-clipboard_3.entry.js +5 -76
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/esm/revogr-data_4.entry.js +50 -56
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +1 -2
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
- package/dist/esm/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +1 -1
- package/dist/esm/sorting.sign-1afddea1.js +15 -0
- package/dist/esm/sorting.sign-1afddea1.js.map +1 -0
- package/dist/esm/text-editor-96d69516.js +80 -0
- package/dist/esm/text-editor-96d69516.js.map +1 -0
- package/dist/esm/{throttle-f9cda5b0.js → throttle-262c3ed2.js} +3 -4
- package/dist/esm/throttle-262c3ed2.js.map +1 -0
- package/dist/esm/viewport.helpers-7e7f9dad.js +52 -0
- package/dist/esm/viewport.helpers-7e7f9dad.js.map +1 -0
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +5 -0
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +1 -0
- package/dist/revo-grid/column.service-414e9cba.js +5 -0
- package/dist/revo-grid/column.service-414e9cba.js.map +1 -0
- package/dist/revo-grid/debounce-e8e9464a.js +5 -0
- package/dist/revo-grid/debounce-e8e9464a.js.map +1 -0
- package/dist/revo-grid/{edit.utils-c3f5c9f4.js → edit.utils-0666e5bd.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js +5 -0
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +1 -0
- package/dist/revo-grid/{index-c428acf6.js → index-74b9801b.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/key.utils-d3df5db8.js +5 -0
- package/dist/revo-grid/key.utils-d3df5db8.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +1 -1
- package/dist/revo-grid/revo-grid.entry.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js.map +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js +1 -1
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js +1 -1
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -1
- package/dist/revo-grid/{row-header-utils-3a6f6adc.js → row-header-utils-c7e3e2d5.js} +2 -2
- package/dist/revo-grid/sorting.sign-1afddea1.js +5 -0
- package/dist/revo-grid/sorting.sign-1afddea1.js.map +1 -0
- package/dist/revo-grid/text-editor-96d69516.js +5 -0
- package/dist/revo-grid/text-editor-96d69516.js.map +1 -0
- package/dist/revo-grid/throttle-262c3ed2.js +5 -0
- package/dist/revo-grid/{throttle-f9cda5b0.js.map → throttle-262c3ed2.js.map} +1 -1
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js +5 -0
- package/dist/revo-grid/viewport.helpers-7e7f9dad.js.map +1 -0
- package/dist/types/components/editors/text-editor.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/index.d.ts +12 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +1 -13
- package/dist/types/types/selection.d.ts +1 -1
- package/dist/types/utils/key.utils.d.ts +0 -1
- package/hydrate/index.js +2 -11
- package/hydrate/index.mjs +2 -11
- package/package.json +1 -1
- package/standalone/_stringToPath.js +1 -1
- package/standalone/column.service.js +1 -1
- package/standalone/data.store.js +2 -2
- package/standalone/debounce.js +1 -1
- package/standalone/dimension.helpers.js +1 -1
- package/standalone/index.js +7 -5
- package/standalone/index.js.map +1 -1
- package/standalone/isObjectLike.js +1 -1
- package/standalone/revo-grid.js +1948 -1948
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-edit.js +1 -1
- package/standalone/revogr-edit2.js +1 -10
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-header.js +1 -1
- package/standalone/revogr-header2.js +54 -52
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-overlay-selection2.js +2 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/throttle.js +1 -1
- package/standalone/toNumber.js +1 -1
- package/dist/cjs/column.service-bfaba0e0.js.map +0 -1
- package/dist/cjs/column.utils-4a450d27.js +0 -345
- package/dist/cjs/column.utils-4a450d27.js.map +0 -1
- package/dist/cjs/debounce-e2b7c6fb.js +0 -226
- package/dist/cjs/debounce-e2b7c6fb.js.map +0 -1
- package/dist/cjs/dispatcher-998aa470.js +0 -46
- package/dist/cjs/dispatcher-998aa470.js.map +0 -1
- package/dist/cjs/header-cell-renderer-53e4fd75.js.map +0 -1
- package/dist/cjs/key.utils-12715159.js.map +0 -1
- package/dist/cjs/selection.helpers-2c90d546.js +0 -450
- package/dist/cjs/selection.helpers-2c90d546.js.map +0 -1
- package/dist/cjs/throttle-c893457e.js.map +0 -1
- package/dist/cjs/toNumber-838e6ff5.js.map +0 -1
- package/dist/esm/column.service-6f1faf2d.js.map +0 -1
- package/dist/esm/column.utils-1a402ff9.js +0 -333
- package/dist/esm/column.utils-1a402ff9.js.map +0 -1
- package/dist/esm/debounce-7781346d.js +0 -224
- package/dist/esm/debounce-7781346d.js.map +0 -1
- package/dist/esm/dispatcher-ea08404f.js +0 -43
- package/dist/esm/dispatcher-ea08404f.js.map +0 -1
- package/dist/esm/header-cell-renderer-66d01daa.js.map +0 -1
- package/dist/esm/key.utils-b1f93f7e.js.map +0 -1
- package/dist/esm/selection.helpers-ac4368b0.js +0 -441
- package/dist/esm/selection.helpers-ac4368b0.js.map +0 -1
- package/dist/esm/throttle-f9cda5b0.js.map +0 -1
- package/dist/esm/toNumber-8de324a7.js.map +0 -1
- package/dist/revo-grid/column.service-6f1faf2d.js +0 -5
- package/dist/revo-grid/column.service-6f1faf2d.js.map +0 -1
- package/dist/revo-grid/column.utils-1a402ff9.js +0 -5
- package/dist/revo-grid/column.utils-1a402ff9.js.map +0 -1
- package/dist/revo-grid/debounce-7781346d.js +0 -5
- package/dist/revo-grid/debounce-7781346d.js.map +0 -1
- package/dist/revo-grid/dispatcher-ea08404f.js +0 -5
- package/dist/revo-grid/dispatcher-ea08404f.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-66d01daa.js +0 -5
- package/dist/revo-grid/header-cell-renderer-66d01daa.js.map +0 -1
- package/dist/revo-grid/key.utils-b1f93f7e.js +0 -5
- package/dist/revo-grid/key.utils-b1f93f7e.js.map +0 -1
- package/dist/revo-grid/selection.helpers-ac4368b0.js +0 -5
- package/dist/revo-grid/selection.helpers-ac4368b0.js.map +0 -1
- package/dist/revo-grid/throttle-f9cda5b0.js +0 -5
- package/dist/revo-grid/toNumber-8de324a7.js +0 -5
- package/dist/revo-grid/toNumber-8de324a7.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-c3f5c9f4.js.map → edit.utils-0666e5bd.js.map} +0 -0
- /package/dist/revo-grid/{index-c428acf6.js.map → index-74b9801b.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-3a6f6adc.js.map → row-header-utils-c7e3e2d5.js.map} +0 -0
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist OU ❤️
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Dispatches a custom event to a specified target element.
|
|
8
|
-
*
|
|
9
|
-
* @param target - The target element to dispatch the event to.
|
|
10
|
-
* @param eventName - The name of the custom event.
|
|
11
|
-
* @param detail - Optional. The detail of the custom event.
|
|
12
|
-
* @returns The custom event that was dispatched.
|
|
13
|
-
*/
|
|
14
|
-
function dispatch(target, eventName, detail) {
|
|
15
|
-
// Create a new CustomEvent with the specified event name and detail.
|
|
16
|
-
const event = new CustomEvent(eventName, {
|
|
17
|
-
detail,
|
|
18
|
-
cancelable: true, // Indicates whether the event can be canceled.
|
|
19
|
-
bubbles: true, // Indicates whether the event bubbles up through the DOM.
|
|
20
|
-
});
|
|
21
|
-
// Dispatch the event on the target element.
|
|
22
|
-
target === null || target === void 0 ? void 0 : target.dispatchEvent(event);
|
|
23
|
-
// Return the custom event that was dispatched.
|
|
24
|
-
return event;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Dispatches a custom event based on an existing event object and prevents the default behavior of the original event.
|
|
28
|
-
*
|
|
29
|
-
* @param e - The original event object containing the target and preventDefault method.
|
|
30
|
-
* @param eventName - The name of the custom event.
|
|
31
|
-
* @param detail - Optional. The detail of the custom event.
|
|
32
|
-
* @returns The custom event that was dispatched.
|
|
33
|
-
*/
|
|
34
|
-
function dispatchByEvent(e, // The original event object containing the target and preventDefault method.
|
|
35
|
-
eventName, // The name of the custom event.
|
|
36
|
-
detail) {
|
|
37
|
-
// Prevent the default behavior of the original event.
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
// Dispatch the custom event to the target element specified in the original event object.
|
|
40
|
-
return dispatch(e.target, eventName, detail);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
exports.dispatch = dispatch;
|
|
44
|
-
exports.dispatchByEvent = dispatchByEvent;
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=dispatcher-998aa470.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"dispatcher-998aa470.js","mappings":";;;;;AAAA;;;;;;;;SAQgB,QAAQ,CACtB,MAA4B,EAC5B,SAAiB,EACjB,MAAuB;;IAGvB,MAAM,KAAK,GAAG,IAAI,WAAW,CAAiB,SAAS,EAAE;QACvD,MAAM;QACN,UAAU,EAAE,IAAI;QAChB,OAAO,EAAE,IAAI;KACd,CAAC,CAAC;;IAGH,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,KAAK,CAAC,CAAC;;IAG7B,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;;SAQgB,eAAe,CAC7B,CAAgD;AAChD,SAAiB;AACjB,MAAuB;;IAGvB,CAAC,CAAC,cAAc,EAAE,CAAC;;IAGnB,OAAO,QAAQ,CAAiB,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAC/D;;;;;","names":[],"sources":["src/plugins/dispatcher.ts"],"sourcesContent":["/**\n * Dispatches a custom event to a specified target element.\n *\n * @param target - The target element to dispatch the event to.\n * @param eventName - The name of the custom event.\n * @param detail - Optional. The detail of the custom event.\n * @returns The custom event that was dispatched.\n */\nexport function dispatch<DispatchDetail = any>(\n target: MouseEvent['target'],\n eventName: string,\n detail?: DispatchDetail,\n) {\n // Create a new CustomEvent with the specified event name and detail.\n const event = new CustomEvent<DispatchDetail>(eventName, {\n detail,\n cancelable: true, // Indicates whether the event can be canceled.\n bubbles: true, // Indicates whether the event bubbles up through the DOM.\n });\n\n // Dispatch the event on the target element.\n target?.dispatchEvent(event);\n\n // Return the custom event that was dispatched.\n return event;\n}\n\n/**\n * Dispatches a custom event based on an existing event object and prevents the default behavior of the original event.\n *\n * @param e - The original event object containing the target and preventDefault method.\n * @param eventName - The name of the custom event.\n * @param detail - Optional. The detail of the custom event.\n * @returns The custom event that was dispatched.\n */\nexport function dispatchByEvent<DispatchDetail = any>(\n e: Pick<MouseEvent, 'target' | 'preventDefault'>, // The original event object containing the target and preventDefault method.\n eventName: string, // The name of the custom event.\n detail?: DispatchDetail, // Optional. The detail of the custom event.\n): CustomEvent {\n // Prevent the default behavior of the original event.\n e.preventDefault();\n\n // Dispatch the custom event to the target element specified in the original event object.\n return dispatch<DispatchDetail>(e.target, eventName, detail);\n}\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"header-cell-renderer-53e4fd75.js","mappings":";;;;;;;;;AAsBA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,sCAAsB,CAAA;IACtB,oCAAoB,CAAA;IACpB,kCAAkB,CAAA;AACpB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,WAAW,GAA2B;IAC1C,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE;IACnD,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE;IACpD,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;IAClD,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE;IACpD,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;IAClD,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE;IACpD,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;IAClD,cAAc,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE;CACrD,CAAC;AAEF,MAAM,YAAY,GAAG;IACnB,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,MAAM;IAC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CAAC,EAAE,GACzD,CACH,CAAC;aACH;SACF;KACF;IACD,QACEA,iCAAS,KAAK,IAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,KAAI,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,GAAG,CAAC,CAAC,CAAC,CAAA;QAC/C,QAAQ;QACR,SAAS,CACN,EACN;AACJ,CAAC;;MCzCY,eAAe,GAAG,cAAc;MAEhC,kBAAkB,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAS,EAAE,QAAiB;IAC1F,IAAI,WAAW,GAA6B,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,KAAI,EAAE,CAAC;IAC7D,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,cAAc,EAAE;QACxB,WAAW,GAAG,IAAI,CAAC,cAAc,CAACA,OAAC,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;KAC5D;IACD,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,gBAAgB,EAAE;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACtC,SAAS,GAAGC,0BAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;SACvC;KACF;IACD,QACED,QAAC,gBAAgB,oBAAK,SAAS,IAAE,WAAW,EAAE,CAAC,CAAa;YAC1DE,mBAAQ,CAAC,CAAC,CAAC,aAA4B,EAAE,eAAe,EAAE;gBACxD,IAAI;gBACJ,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;SACH;QACAF,iBAAK,KAAK,EAAC,gBAAgB,IAAE,WAAW,CAAO;QAC9C,QAAQ,CACQ,EACnB;AACJ;;;;;","names":["h","doPropMerge","dispatch"],"sources":["src/components/header/resizable.directive.tsx","src/components/header/resizable.element.tsx","src/components/header/header-cell-renderer.tsx"],"sourcesContent":["export type ResizeProps = {\n active: ('r' | 'rb' | 'b' | 'lb' | 'l' | 'lt' | 't' | 'rt')[]; // all\n fitParent: boolean; // false\n minWidth: number; // 0\n minHeight: number; // 0\n\n disableAttributes: ('l' | 't' | 'w' | 'h')[]; // []\n maxWidth?: number;\n maxHeight?: number;\n\n onResize?(e: ResizeEvent): void;\n onDoubleClick?(originalEvent: MouseEvent): void;\n};\n\nexport type ResizeEvent = {\n eventName: string;\n changedX?: number;\n changedY?: number;\n width?: number;\n height?: number;\n};\n\nexport enum ResizeEvents {\n start = 'resize:start',\n move = 'resize:move',\n end = 'resize:end',\n}\n\nconst RESIZE_MASK: { [key: string]: any } = {\n 'resizable-r': { bit: 0b0001, cursor: 'ew-resize' },\n 'resizable-rb': { bit: 0b0011, cursor: 'se-resize' },\n 'resizable-b': { bit: 0b0010, cursor: 's-resize' },\n 'resizable-lb': { bit: 0b0110, cursor: 'sw-resize' },\n 'resizable-l': { bit: 0b0100, cursor: 'w-resize' },\n 'resizable-lt': { bit: 0b1100, cursor: 'nw-resize' },\n 'resizable-t': { bit: 0b1000, cursor: 'n-resize' },\n 'resizable-rt': { bit: 0b1001, cursor: 'ne-resize' },\n};\n\nconst DISABLE_MASK = {\n l: 0b0001,\n t: 0b0010,\n w: 0b0100,\n h: 0b1000,\n};\n\nconst defaultProps = (props: Partial<ResizeProps>): ResizeProps => {\n return {\n ...props,\n fitParent: props.fitParent || false,\n active: props.active || [],\n disableAttributes: props.disableAttributes || [],\n minWidth: props.minWidth || 0,\n minHeight: props.minHeight || 0,\n };\n};\n\nexport class ResizeDirective {\n private $el: HTMLElement;\n private props: ResizeProps;\n private minW: number;\n private minH: number;\n private maxW: number;\n private maxH: number;\n\n private mouseX = 0;\n private mouseY = 0;\n\n private width = 0;\n private height = 0;\n\n private changeX = 0;\n private changeY = 0;\n\n private parent: { width: number; height: number };\n private resizeState: number;\n private activeResizer?: HTMLElement;\n private disableCalcMap = 0b1111;\n\n private mouseMoveFunc: () => void;\n private mouseUpFunc: () => void;\n\n constructor(\n private initialProps: Partial<ResizeProps>,\n private $event?: (e: ResizeEvent) => void,\n ) {\n this.props = defaultProps(initialProps);\n this.mouseMoveFunc = this.handleMove.bind(this);\n this.mouseUpFunc = this.handleUp.bind(this);\n\n this.minW = this.props.minWidth;\n this.minH = this.props.minHeight;\n this.maxW = this.props.maxWidth ?? 0;\n this.maxH = this.props.maxHeight ?? 0;\n this.parent = { width: 0, height: 0 };\n this.resizeState = 0;\n }\n\n set($el: HTMLElement) {\n this.$el = $el;\n this.props.disableAttributes.forEach(attr => {\n switch (attr) {\n case 'l':\n this.disableCalcMap &= ~DISABLE_MASK.l;\n break;\n case 't':\n this.disableCalcMap &= ~DISABLE_MASK.t;\n break;\n case 'w':\n this.disableCalcMap &= ~DISABLE_MASK.w;\n break;\n case 'h':\n this.disableCalcMap &= ~DISABLE_MASK.h;\n }\n });\n }\n emitEvent(eventName: string, additionalOptions?: any) {\n if (!this.$event) {\n return;\n }\n const isLeft = this.activeResizer?.classList.contains('resizable-l');\n this.$event({\n eventName,\n width: this.width + this.changeX * (isLeft ? -1 : 1),\n height: this.height + this.changeY,\n changedX: this.changeX,\n changedY: this.changeY,\n ...additionalOptions,\n });\n }\n\n private static isTouchEvent(e: MouseEvent | TouchEvent): e is TouchEvent {\n const event = e as TouchEvent;\n return event.touches?.length >= 0;\n }\n\n handleMove(event: MouseEvent | TouchEvent) {\n if (!this.resizeState) {\n return;\n }\n let eventY, eventX;\n if (ResizeDirective.isTouchEvent(event)) {\n eventY = event.touches[0].clientY;\n eventX = event.touches[0].clientX;\n } else {\n eventY = event.clientY;\n eventX = event.clientX;\n }\n let isX =\n this.resizeState & RESIZE_MASK['resizable-r'].bit ||\n this.resizeState & RESIZE_MASK['resizable-l'].bit;\n\n let isY =\n this.resizeState & RESIZE_MASK['resizable-t'].bit ||\n this.resizeState & RESIZE_MASK['resizable-b'].bit;\n\n if (isY && this.disableCalcMap & DISABLE_MASK.h) {\n let diffY = eventY - this.mouseY;\n let changedY = this.changeY + diffY;\n const newHeight = this.height + changedY;\n // if overcrossed min height\n if (newHeight < this.minH) {\n changedY = -(this.height - this.minH);\n }\n // if overcrossed max heiht\n if (this.maxH && newHeight > this.maxH) {\n changedY = this.maxH - this.height;\n }\n\n this.changeY = changedY;\n this.mouseY = eventY;\n\n if (this.activeResizer) {\n this.activeResizer.style.bottom = `${-this.changeY}px`;\n }\n }\n if (isX && this.disableCalcMap & DISABLE_MASK.w) {\n const isLeft = this.activeResizer?.classList.contains('resizable-l');\n let diffX = eventX - this.mouseX;\n let changedX = this.changeX + diffX;\n const newWidth = this.width + changedX * (isLeft ? -1 : 1);\n\n // if overcrossed min width\n if (newWidth < this.minW) {\n changedX = -(this.width - this.minW);\n }\n // if overcrossed max width\n if (this.maxW && newWidth > this.maxW) {\n changedX = this.maxW - this.width;\n }\n\n this.changeX = changedX;\n this.mouseX = eventX;\n\n if (this.activeResizer) {\n if (!isLeft) {\n this.activeResizer.style.right = `${-this.changeX}px`;\n } else {\n this.activeResizer.style.left = `${this.changeX}px`;\n }\n }\n }\n this.emitEvent(ResizeEvents.move);\n }\n\n handleDown(event: MouseEvent | TouchEvent) {\n if (event.defaultPrevented) {\n return;\n }\n // stop other events if resize in progress\n event.preventDefault();\n\n this.dropInitial();\n for (let elClass in RESIZE_MASK) {\n const target = event.target as HTMLElement | null;\n if (this.$el.contains(target) && target?.classList.contains(elClass)) {\n document.body.style.cursor = RESIZE_MASK[elClass].cursor;\n if (ResizeDirective.isTouchEvent(event)) {\n this.setInitials(event.touches[0], target);\n } else {\n event.preventDefault && event.preventDefault();\n this.setInitials(event, target);\n }\n this.resizeState = RESIZE_MASK[elClass].bit;\n const eventName = ResizeEvents.start;\n this.emitEvent(eventName);\n break;\n }\n }\n this.bindMove();\n }\n\n handleUp(e: MouseEvent) {\n e.preventDefault();\n if (this.resizeState !== 0) {\n this.resizeState = 0;\n document.body.style.cursor = '';\n const eventName = ResizeEvents.end;\n this.emitEvent(eventName);\n }\n this.dropInitial();\n this.unbindMove();\n }\n\n private setInitials(\n { clientX, clientY }: { clientX: number; clientY: number },\n target?: HTMLElement,\n ) {\n const computedStyle = getComputedStyle(this.$el);\n this.$el.classList.add('active');\n this.activeResizer = target;\n\n if (this.disableCalcMap & DISABLE_MASK.w) {\n this.mouseX = clientX;\n this.width = this.$el.clientWidth;\n this.parent.width = this.$el.parentElement?.clientWidth ?? 0;\n\n // min width\n const minPaddingX =\n parseFloat(computedStyle.paddingLeft) +\n parseFloat(computedStyle.paddingRight);\n this.minW = Math.max(minPaddingX, this.initialProps.minWidth || 0);\n\n // max width\n if (this.initialProps.maxWidth) {\n this.maxW = Math.max(this.width, this.initialProps.maxWidth);\n }\n }\n\n if (this.disableCalcMap & DISABLE_MASK.h) {\n this.mouseY = clientY;\n this.height = this.$el.clientHeight;\n this.parent.height = this.$el.parentElement?.clientHeight ?? 0;\n\n // min height\n const minPaddingY =\n parseFloat(computedStyle.paddingTop) +\n parseFloat(computedStyle.paddingBottom);\n this.minH = Math.max(minPaddingY, this.initialProps.minHeight || 0);\n // max height\n if (this.initialProps.maxHeight) {\n this.maxH = Math.max(this.height, this.initialProps.maxHeight);\n }\n }\n }\n\n private dropInitial() {\n this.changeX = this.changeY = this.minW = this.minH;\n this.width = this.height = 0;\n if (this.activeResizer) {\n this.activeResizer.removeAttribute('style');\n }\n this.$el.classList.remove('active');\n this.activeResizer = undefined;\n }\n\n private bindMove() {\n document.documentElement.addEventListener(\n 'mouseup',\n this.mouseUpFunc,\n true,\n );\n document.documentElement.addEventListener(\n 'touchend',\n this.mouseUpFunc,\n true,\n );\n document.documentElement.addEventListener(\n 'mousemove',\n this.mouseMoveFunc,\n true,\n );\n document.documentElement.addEventListener(\n 'touchmove',\n this.mouseMoveFunc,\n true,\n );\n document.documentElement.addEventListener('mouseleave', this.mouseUpFunc);\n }\n\n private unbindMove() {\n document.documentElement.removeEventListener(\n 'mouseup',\n this.mouseUpFunc,\n true,\n );\n document.documentElement.removeEventListener(\n 'touchend',\n this.mouseUpFunc,\n true,\n );\n document.documentElement.removeEventListener(\n 'mousemove',\n this.mouseMoveFunc,\n true,\n );\n document.documentElement.removeEventListener(\n 'touchmove',\n this.mouseMoveFunc,\n true,\n );\n document.documentElement.removeEventListener(\n 'mouseleave',\n this.mouseUpFunc,\n );\n }\n}\n","import { h, VNode } from '@stencil/core';\nimport { ResizeProps, ResizeDirective, ResizeEvents } from './resizable.directive';\nimport type { CellProps } from '@type';\n\nexport const ResizableElement = (props: Partial<ResizeProps> & CellProps, children: VNode[]) => {\n const resizeEls: VNode[] = [];\n const directive =\n (props.canResize &&\n new ResizeDirective(props, e => {\n if (e.eventName === ResizeEvents.end) {\n props.onResize && props.onResize(e);\n }\n })) ||\n null;\n if (props.canResize) {\n if (props.active) {\n for (let p in props.active) {\n resizeEls.push(\n <div\n onClick={e => e.preventDefault()}\n onDblClick={e => {\n e.preventDefault();\n props.onDoubleClick?.(e);\n }}\n onMouseDown={(e: MouseEvent) => directive?.handleDown(e)}\n onTouchStart={(e: TouchEvent) => directive?.handleDown(e)}\n class={`resizable resizable-${props.active[p]}`}\n />,\n );\n }\n }\n } else {\n if (props.active) {\n for (let p in props.active) {\n resizeEls.push(\n <div\n onClick={e => e.preventDefault()}\n onTouchStart={(e: TouchEvent) => e.preventDefault()}\n onDblClick={e => {\n e.preventDefault();\n props.onDoubleClick?.(e);\n }}\n class={`no-resize resizable resizable-${props.active[p]}`}\n />,\n );\n }\n }\n }\n return (\n <div {...props} ref={(e) => e && directive?.set(e)}>\n {children}\n {resizeEls}\n </div>\n );\n};\n","import { h, VNode } from '@stencil/core';\nimport { dispatch } from '../../plugins/dispatcher';\nimport { doPropMerge } from '../data/column.service';\nimport { ResizableElement } from './resizable.element';\nimport { ResizeProps } from './resizable.directive';\nimport { CellProps, ColumnTemplateProp } from '@type';\n\ntype Props = {\n props: CellProps & Partial<ResizeProps>;\n additionalData: any;\n data?: ColumnTemplateProp;\n};\n\nexport const ON_COLUMN_CLICK = 'columnclick';\n\nexport const HeaderCellRenderer = ({ data, props, additionalData }: Props, children: VNode[]): VNode => {\n let colTemplate: VNode | VNode[] | string = data?.name || '';\n let cellProps = props;\n if (data?.columnTemplate) {\n colTemplate = data.columnTemplate(h, data, additionalData);\n }\n if (data?.columnProperties) {\n const extra = data.columnProperties(data);\n if (extra && typeof extra === 'object') {\n cellProps = doPropMerge(props, extra);\n }\n }\n return (\n <ResizableElement {...cellProps} onMouseDown={(e: MouseEvent) => {\n dispatch(e.currentTarget as HTMLElement, ON_COLUMN_CLICK, {\n data,\n event: e,\n });\n }}>\n <div class=\"header-content\">{colTemplate}</div>\n {children}\n </ResizableElement>\n );\n};\n"],"version":3}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"key.utils-12715159.js","mappings":";;;;;;;SAGgB,WAAW,CAAC,IAAY;IACtC,QACE,IAAI,KAAK,EAAE;SACV,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;SACzB,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,GAAG,CAAC;SAC1B,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC;SAC3B,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC;QAC5B,IAAI,IAAI,GAAG;SACV,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC,EAC1B;AACJ,CAAC;SAEe,SAAS,CAAC,IAAY;IACpC,MAAM,IAAI,GAAmB;QAC3BA,kBAAY,CAAC,UAAU;QACvBA,kBAAY,CAAC,QAAQ;QACrBA,kBAAY,CAAC,UAAU;QACvBA,kBAAY,CAAC,WAAW;QACxBA,kBAAY,CAAC,IAAI;QACjBA,kBAAY,CAAC,GAAG;QAChBA,kBAAY,CAAC,MAAM;QACnBA,kBAAY,CAAC,SAAS;QACtBA,kBAAY,CAAC,EAAE;QACfA,kBAAY,CAAC,EAAE;QACfA,kBAAY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AAW,CAAC,GAAG,KAAK,IAAI,CAAC;AAClC,CAAC;SACe,aAAa,CAAC,GAAW;IACvC,OAAOC,eAAS,CAAC,GAAG,KAAK,GAAG,CAAC;AAC/B,CAAC;SAEe,eAAe,CAAC,GAAW;IACzC,OAAOA,eAAS,CAAC,KAAK,KAAK,GAAG,CAAC;AACjC,CAAC;SAEe,KAAK,CAAC,KAAoB;IACxC,QACE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;SACtC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EACxC;AACJ,CAAC;SACe,MAAM,CAAC,KAAoB;IACzC,QACE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;SACtC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EACxC;AACJ,CAAC;SACe,OAAO,CAAC,KAAoB;IAC1C,QACE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;SACtC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EACxC;AACJ,CAAC;SACe,KAAK,CAAC,KAAoB;IACxC,QACE,CAAC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;SACtC,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,EACxC;AACJ;;;;;;;;;;;;;;;","names":["KeyCodesEnum","OsPlatform","codesLetter","keyValues"],"sources":["src/utils/key.utils.ts"],"sourcesContent":["import KeyCodesEnum, { codesLetter, keyValues } from './key.codes';\nimport OsPlatform from './platform';\n\nexport function isLetterKey(code: number): boolean {\n return (\n code === 32 || // space\n (code >= 48 && code <= 57) ||\n (code >= 96 && code <= 111) ||\n (code >= 186 && code <= 192) ||\n (code >= 219 && code <= 222) ||\n code >= 226 ||\n (code >= 65 && code <= 90)\n ); // a-z\n}\n\nexport function isMetaKey(code: number): boolean {\n const keys: KeyCodesEnum[] = [\n KeyCodesEnum.ARROW_DOWN,\n KeyCodesEnum.ARROW_UP,\n KeyCodesEnum.ARROW_LEFT,\n KeyCodesEnum.ARROW_RIGHT,\n KeyCodesEnum.HOME,\n KeyCodesEnum.END,\n KeyCodesEnum.DELETE,\n KeyCodesEnum.BACKSPACE,\n KeyCodesEnum.F1,\n KeyCodesEnum.F2,\n KeyCodesEnum.F3,\n KeyCodesEnum.F4,\n KeyCodesEnum.F5,\n KeyCodesEnum.F6,\n KeyCodesEnum.F7,\n KeyCodesEnum.F8,\n KeyCodesEnum.F9,\n KeyCodesEnum.F10,\n KeyCodesEnum.F11,\n KeyCodesEnum.F12,\n KeyCodesEnum.TAB,\n KeyCodesEnum.PAGE_DOWN,\n KeyCodesEnum.PAGE_UP,\n KeyCodesEnum.ENTER,\n KeyCodesEnum.ESCAPE,\n KeyCodesEnum.SHIFT,\n KeyCodesEnum.CAPS_LOCK,\n KeyCodesEnum.ALT,\n ];\n\n return keys.indexOf(code) !== -1;\n}\n\n// navigator.platform\nexport function isCtrlKey(code: number, platform: string): boolean {\n if (platform.includes(OsPlatform.mac)) {\n return [\n KeyCodesEnum.COMMAND_LEFT,\n KeyCodesEnum.COMMAND_RIGHT,\n KeyCodesEnum.COMMAND_FIREFOX,\n ].includes(code);\n }\n\n return code === KeyCodesEnum.CONTROL;\n}\n\nexport function isCtrlMetaKey(code: KeyCodesEnum): boolean {\n return [\n KeyCodesEnum.CONTROL,\n KeyCodesEnum.COMMAND_LEFT,\n KeyCodesEnum.COMMAND_RIGHT,\n KeyCodesEnum.COMMAND_FIREFOX,\n ].includes(code);\n}\n\nexport function isClear(code: string): boolean {\n return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;\n}\n\nexport function isTab(code: string): boolean {\n return codesLetter.TAB === code;\n}\nexport function isTabKeyValue(key: string): boolean {\n return keyValues.TAB === key;\n}\n\nexport function isEnterKeyValue(key: string): boolean {\n return keyValues.ENTER === key;\n}\n\nexport function isCut(event: KeyboardEvent): boolean {\n return (\n (event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows\n (event.metaKey && event.code === 'KeyX')\n ); // Cmd + X on Mac\n}\nexport function isCopy(event: KeyboardEvent): boolean {\n return (\n (event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows\n (event.metaKey && event.code === 'KeyC')\n ); // Cmd + C on Mac\n}\nexport function isPaste(event: KeyboardEvent): boolean {\n return (\n (event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows\n (event.metaKey && event.code === 'KeyV')\n ); // Cmd + V on Mac\n}\nexport function isAll(event: KeyboardEvent): boolean {\n return (\n (event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows\n (event.metaKey && event.code === 'KeyA')\n ); // Cmd + A on Mac\n}\n"],"version":3}
|
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built by Revolist OU ❤️
|
|
3
|
-
*/
|
|
4
|
-
'use strict';
|
|
5
|
-
|
|
6
|
-
const index = require('./index-464d1aaf.js');
|
|
7
|
-
require('./toNumber-838e6ff5.js');
|
|
8
|
-
require('./index-10d10c55.js');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Selection store
|
|
12
|
-
*/
|
|
13
|
-
function defaultState() {
|
|
14
|
-
return {
|
|
15
|
-
range: null,
|
|
16
|
-
tempRange: null,
|
|
17
|
-
tempRangeType: null,
|
|
18
|
-
focus: null,
|
|
19
|
-
edit: null,
|
|
20
|
-
lastCell: null,
|
|
21
|
-
nextFocus: null,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
class SelectionStore {
|
|
25
|
-
constructor() {
|
|
26
|
-
this.unsubscribe = [];
|
|
27
|
-
this.store = index.createStore(defaultState());
|
|
28
|
-
this.store.on('set', (key, newVal) => {
|
|
29
|
-
if (key === 'tempRange' && !newVal) {
|
|
30
|
-
this.store.set('tempRangeType', null);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
onChange(propName, cb) {
|
|
35
|
-
this.unsubscribe.push(this.store.onChange(propName, cb));
|
|
36
|
-
}
|
|
37
|
-
clearFocus() {
|
|
38
|
-
index.setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });
|
|
39
|
-
}
|
|
40
|
-
setFocus(focus, end) {
|
|
41
|
-
if (!end) {
|
|
42
|
-
index.setStore(this.store, { focus });
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
index.setStore(this.store, {
|
|
46
|
-
focus,
|
|
47
|
-
range: getRange(focus, end),
|
|
48
|
-
edit: null,
|
|
49
|
-
tempRange: null,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
setNextFocus(focus) {
|
|
54
|
-
index.setStore(this.store, { nextFocus: focus });
|
|
55
|
-
}
|
|
56
|
-
setTempArea(range) {
|
|
57
|
-
index.setStore(this.store, { tempRange: range === null || range === void 0 ? void 0 : range.area, tempRangeType: range === null || range === void 0 ? void 0 : range.type, edit: null });
|
|
58
|
-
}
|
|
59
|
-
clearTemp() {
|
|
60
|
-
index.setStore(this.store, { tempRange: null });
|
|
61
|
-
}
|
|
62
|
-
/** Can be applied from selection change or from simple keyboard change clicks */
|
|
63
|
-
setRangeArea(range) {
|
|
64
|
-
index.setStore(this.store, { range, edit: null, tempRange: null });
|
|
65
|
-
}
|
|
66
|
-
setRange(start, end) {
|
|
67
|
-
const range = getRange(start, end);
|
|
68
|
-
this.setRangeArea(range);
|
|
69
|
-
}
|
|
70
|
-
setLastCell(lastCell) {
|
|
71
|
-
index.setStore(this.store, { lastCell });
|
|
72
|
-
}
|
|
73
|
-
setEdit(val) {
|
|
74
|
-
const focus = this.store.get('focus');
|
|
75
|
-
if (focus && typeof val === 'string') {
|
|
76
|
-
index.setStore(this.store, {
|
|
77
|
-
edit: { x: focus.x, y: focus.y, val },
|
|
78
|
-
});
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
index.setStore(this.store, { edit: null });
|
|
82
|
-
}
|
|
83
|
-
dispose() {
|
|
84
|
-
this.unsubscribe.forEach(f => f());
|
|
85
|
-
this.store.dispose();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const EMPTY_INDEX = -1;
|
|
90
|
-
class SelectionStoreConnector {
|
|
91
|
-
constructor() {
|
|
92
|
-
// dirty flag required to cleanup whole store in case visibility of panels changed
|
|
93
|
-
this.dirty = false;
|
|
94
|
-
this.stores = {};
|
|
95
|
-
this.columnStores = {};
|
|
96
|
-
this.rowStores = {};
|
|
97
|
-
/**
|
|
98
|
-
* Helpers for data conversion
|
|
99
|
-
*/
|
|
100
|
-
this.storesByType = {};
|
|
101
|
-
this.storesXToType = {};
|
|
102
|
-
this.storesYToType = {};
|
|
103
|
-
this.sections = [];
|
|
104
|
-
}
|
|
105
|
-
get focusedStore() {
|
|
106
|
-
var _a;
|
|
107
|
-
for (let y in this.stores) {
|
|
108
|
-
for (let x in this.stores[y]) {
|
|
109
|
-
const focused = (_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.store.get('focus');
|
|
110
|
-
if (focused) {
|
|
111
|
-
return {
|
|
112
|
-
entity: this.stores[y][x],
|
|
113
|
-
cell: focused,
|
|
114
|
-
position: {
|
|
115
|
-
x: parseInt(x, 10),
|
|
116
|
-
y: parseInt(y, 10),
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
get edit() {
|
|
125
|
-
var _a;
|
|
126
|
-
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('edit');
|
|
127
|
-
}
|
|
128
|
-
get focused() {
|
|
129
|
-
var _a;
|
|
130
|
-
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('focus');
|
|
131
|
-
}
|
|
132
|
-
get selectedRange() {
|
|
133
|
-
var _a;
|
|
134
|
-
return (_a = this.focusedStore) === null || _a === void 0 ? void 0 : _a.entity.store.get('range');
|
|
135
|
-
}
|
|
136
|
-
registerSection(e) {
|
|
137
|
-
if (!e) {
|
|
138
|
-
this.sections.length = 0;
|
|
139
|
-
// some elements removed, rebuild stores
|
|
140
|
-
this.dirty = true;
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
if (this.sections.indexOf(e) === -1) {
|
|
144
|
-
this.sections.push(e);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
// check if require to cleanup all stores
|
|
148
|
-
beforeUpdate() {
|
|
149
|
-
if (this.dirty) {
|
|
150
|
-
for (let y in this.stores) {
|
|
151
|
-
for (let x in this.stores[y]) {
|
|
152
|
-
this.stores[y][x].dispose();
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
this.dirty = false;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
registerColumn(x, type) {
|
|
159
|
-
// if hidden just create store but no operations needed
|
|
160
|
-
if (isHiddenStore(x)) {
|
|
161
|
-
return new SelectionStore();
|
|
162
|
-
}
|
|
163
|
-
if (this.columnStores[x]) {
|
|
164
|
-
return this.columnStores[x];
|
|
165
|
-
}
|
|
166
|
-
this.columnStores[x] = new SelectionStore();
|
|
167
|
-
// build cross-linking type to position
|
|
168
|
-
this.storesByType[type] = x;
|
|
169
|
-
this.storesXToType[x] = type;
|
|
170
|
-
return this.columnStores[x];
|
|
171
|
-
}
|
|
172
|
-
registerRow(y, type) {
|
|
173
|
-
// if hidden just create store
|
|
174
|
-
if (isHiddenStore(y)) {
|
|
175
|
-
return new SelectionStore();
|
|
176
|
-
}
|
|
177
|
-
if (this.rowStores[y]) {
|
|
178
|
-
return this.rowStores[y];
|
|
179
|
-
}
|
|
180
|
-
this.rowStores[y] = new SelectionStore();
|
|
181
|
-
// build cross linking type to position
|
|
182
|
-
this.storesByType[type] = y;
|
|
183
|
-
this.storesYToType[y] = type;
|
|
184
|
-
return this.rowStores[y];
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Cross store proxy, based on multiple dimensions
|
|
188
|
-
*/
|
|
189
|
-
register({ x, y }) {
|
|
190
|
-
var _a, _b;
|
|
191
|
-
// if hidden just create store
|
|
192
|
-
if (isHiddenStore(x) || isHiddenStore(y)) {
|
|
193
|
-
return new SelectionStore();
|
|
194
|
-
}
|
|
195
|
-
if (!this.stores[y]) {
|
|
196
|
-
this.stores[y] = {};
|
|
197
|
-
}
|
|
198
|
-
if (this.stores[y][x]) {
|
|
199
|
-
// Store already registered. Do not register twice
|
|
200
|
-
return this.stores[y][x];
|
|
201
|
-
}
|
|
202
|
-
this.stores[y][x] = new SelectionStore();
|
|
203
|
-
// proxy update, column store trigger only range area
|
|
204
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.onChange('range', c => {
|
|
205
|
-
this.columnStores[x].setRangeArea(c);
|
|
206
|
-
this.rowStores[y].setRangeArea(c);
|
|
207
|
-
});
|
|
208
|
-
// clean up on remove
|
|
209
|
-
(_b = this.stores[y][x]) === null || _b === void 0 ? void 0 : _b.store.on('dispose', () => this.destroy(x, y));
|
|
210
|
-
return this.stores[y][x];
|
|
211
|
-
}
|
|
212
|
-
destroy(x, y) {
|
|
213
|
-
var _a, _b;
|
|
214
|
-
(_a = this.columnStores[x]) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
215
|
-
(_b = this.rowStores[y]) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
216
|
-
delete this.rowStores[y];
|
|
217
|
-
delete this.columnStores[x];
|
|
218
|
-
// clear x cross-link
|
|
219
|
-
if (this.storesXToType[x]) {
|
|
220
|
-
const type = this.storesXToType[x];
|
|
221
|
-
delete this.storesXToType[x];
|
|
222
|
-
delete this.storesByType[type];
|
|
223
|
-
}
|
|
224
|
-
// clear y cross-link
|
|
225
|
-
if (this.storesYToType[y]) {
|
|
226
|
-
const type = this.storesYToType[y];
|
|
227
|
-
delete this.storesYToType[y];
|
|
228
|
-
delete this.storesByType[type];
|
|
229
|
-
}
|
|
230
|
-
if (this.stores[y]) {
|
|
231
|
-
delete this.stores[y][x];
|
|
232
|
-
}
|
|
233
|
-
// clear empty rows
|
|
234
|
-
if (!Object.keys(this.stores[y] || {}).length) {
|
|
235
|
-
delete this.stores[y];
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
setEditByCell(storePos, editCell) {
|
|
239
|
-
this.focusByCell(storePos, editCell, editCell);
|
|
240
|
-
this.setEdit('');
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Sets the next focus cell before the current one.
|
|
244
|
-
*
|
|
245
|
-
* @param focus - The cell to set as the next focus.
|
|
246
|
-
*/
|
|
247
|
-
beforeNextFocusCell(focus) {
|
|
248
|
-
var _a;
|
|
249
|
-
// If there is no focused store, return early.
|
|
250
|
-
if (!this.focusedStore) {
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
// Get the next store based on the current focus and the last cell.
|
|
254
|
-
const lastCell = this.focusedStore.entity.store.get('lastCell');
|
|
255
|
-
const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);
|
|
256
|
-
// Set the next focus cell in the store.
|
|
257
|
-
(_a = next === null || next === void 0 ? void 0 : next.store) === null || _a === void 0 ? void 0 : _a.setNextFocus(Object.assign(Object.assign({}, focus), next.item));
|
|
258
|
-
}
|
|
259
|
-
focusByCell(storePos, start, end) {
|
|
260
|
-
const store = this.stores[storePos.y][storePos.x];
|
|
261
|
-
this.focus(store, { focus: start, end });
|
|
262
|
-
}
|
|
263
|
-
focus(store, { focus, end }) {
|
|
264
|
-
const currentStorePointer = this.getCurrentStorePointer(store);
|
|
265
|
-
if (!currentStorePointer) {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
// check for the focus in nearby store/viewport
|
|
269
|
-
const lastCell = store.store.get('lastCell');
|
|
270
|
-
const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);
|
|
271
|
-
// if next store present - update
|
|
272
|
-
if (next === null || next === void 0 ? void 0 : next.store) {
|
|
273
|
-
const item = Object.assign(Object.assign({}, focus), next.item);
|
|
274
|
-
this.focus(next.store, { focus: item, end: item });
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
if (lastCell) {
|
|
278
|
-
focus = cropCellToMax(focus, lastCell);
|
|
279
|
-
end = cropCellToMax(end, lastCell);
|
|
280
|
-
}
|
|
281
|
-
store.setFocus(focus, end);
|
|
282
|
-
return focus;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Retrieves the current store pointer based on the active store.
|
|
286
|
-
* Clears focus from all stores except the active one.
|
|
287
|
-
*/
|
|
288
|
-
getCurrentStorePointer(store) {
|
|
289
|
-
let currentStorePointer;
|
|
290
|
-
// Iterate through all stores
|
|
291
|
-
for (let y in this.stores) {
|
|
292
|
-
for (let x in this.stores[y]) {
|
|
293
|
-
const s = this.stores[y][x];
|
|
294
|
-
// Clear focus from stores other than the active one
|
|
295
|
-
if (s !== store) {
|
|
296
|
-
s.clearFocus();
|
|
297
|
-
}
|
|
298
|
-
else {
|
|
299
|
-
// Update the current store pointer with the active store coordinates
|
|
300
|
-
currentStorePointer = {
|
|
301
|
-
x: parseInt(x, 10),
|
|
302
|
-
y: parseInt(y, 10)
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return currentStorePointer;
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* Retrieves the next store based on the focus cell and current store pointer.
|
|
311
|
-
* If the next store exists, returns an object with the next store and the item in the new store.
|
|
312
|
-
* If the next store does not exist, returns null.
|
|
313
|
-
*/
|
|
314
|
-
getNextStore(focus, currentStorePointer, lastCell) {
|
|
315
|
-
// item in new store
|
|
316
|
-
const nextItem = nextCell(focus, lastCell);
|
|
317
|
-
let nextStore;
|
|
318
|
-
if (nextItem) {
|
|
319
|
-
Object.entries(nextItem).forEach(([type, nextItemCoord]) => {
|
|
320
|
-
let stores;
|
|
321
|
-
switch (type) {
|
|
322
|
-
case 'x':
|
|
323
|
-
// Get the X stores for the current Y coordinate of the current store pointer
|
|
324
|
-
stores = this.getXStores(currentStorePointer.y);
|
|
325
|
-
break;
|
|
326
|
-
case 'y':
|
|
327
|
-
// Get the Y stores for the current X coordinate of the current store pointer
|
|
328
|
-
stores = this.getYStores(currentStorePointer.x);
|
|
329
|
-
break;
|
|
330
|
-
}
|
|
331
|
-
// Get the next store based on the item in the new store
|
|
332
|
-
if (nextItemCoord >= 0) {
|
|
333
|
-
nextStore = stores[++currentStorePointer[type]];
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
nextStore = stores[--currentStorePointer[type]];
|
|
337
|
-
const nextLastCell = nextStore === null || nextStore === void 0 ? void 0 : nextStore.store.get('lastCell');
|
|
338
|
-
if (nextLastCell) {
|
|
339
|
-
nextItem[type] = nextLastCell[type] + nextItemCoord;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
store: nextStore,
|
|
346
|
-
item: nextItem,
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
clearAll() {
|
|
350
|
-
var _a;
|
|
351
|
-
for (let y in this.stores) {
|
|
352
|
-
for (let x in this.stores[y]) {
|
|
353
|
-
(_a = this.stores[y][x]) === null || _a === void 0 ? void 0 : _a.clearFocus();
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
setEdit(val) {
|
|
358
|
-
if (!this.focusedStore) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
this.focusedStore.entity.setEdit(val);
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Select all cells across all stores
|
|
365
|
-
*/
|
|
366
|
-
selectAll() {
|
|
367
|
-
for (let y in this.stores) {
|
|
368
|
-
for (let x in this.stores[y]) {
|
|
369
|
-
const store = this.stores[y][x];
|
|
370
|
-
if (!store) {
|
|
371
|
-
continue;
|
|
372
|
-
}
|
|
373
|
-
const lastCell = store.store.get('lastCell');
|
|
374
|
-
if (lastCell) {
|
|
375
|
-
store.setRange({ x: 0, y: 0 }, { x: lastCell.x - 1, y: lastCell.y - 1 });
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
getXStores(y) {
|
|
381
|
-
return this.stores[y];
|
|
382
|
-
}
|
|
383
|
-
getYStores(x) {
|
|
384
|
-
const stores = {};
|
|
385
|
-
for (let i in this.stores) {
|
|
386
|
-
stores[i] = this.stores[i][x];
|
|
387
|
-
}
|
|
388
|
-
return stores;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function isHiddenStore(pos) {
|
|
393
|
-
return pos === EMPTY_INDEX;
|
|
394
|
-
}
|
|
395
|
-
function nextCell(cell, lastCell) {
|
|
396
|
-
const nextItem = {};
|
|
397
|
-
let types = ['x', 'y'];
|
|
398
|
-
// previous item check
|
|
399
|
-
for (let t of types) {
|
|
400
|
-
if (cell[t] < 0) {
|
|
401
|
-
nextItem[t] = cell[t];
|
|
402
|
-
return nextItem;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
// next item check
|
|
406
|
-
for (let t of types) {
|
|
407
|
-
if (cell[t] >= lastCell[t]) {
|
|
408
|
-
nextItem[t] = cell[t] - lastCell[t];
|
|
409
|
-
return nextItem;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
return null;
|
|
413
|
-
}
|
|
414
|
-
function cropCellToMax(cell, lastCell) {
|
|
415
|
-
const croppedCell = Object.assign({}, cell);
|
|
416
|
-
const cellCoordinates = ['x', 'y'];
|
|
417
|
-
for (const coordinate of cellCoordinates) {
|
|
418
|
-
if (cell[coordinate] < 0) {
|
|
419
|
-
croppedCell[coordinate] = 0;
|
|
420
|
-
}
|
|
421
|
-
else if (cell[coordinate] >= lastCell[coordinate]) {
|
|
422
|
-
croppedCell[coordinate] = lastCell[coordinate] - 1;
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
return croppedCell;
|
|
426
|
-
}
|
|
427
|
-
function getRange(start, end) {
|
|
428
|
-
return start && end
|
|
429
|
-
? {
|
|
430
|
-
x: Math.min(start.x, end.x),
|
|
431
|
-
y: Math.min(start.y, end.y),
|
|
432
|
-
x1: Math.max(start.x, end.x),
|
|
433
|
-
y1: Math.max(start.y, end.y),
|
|
434
|
-
}
|
|
435
|
-
: null;
|
|
436
|
-
}
|
|
437
|
-
function isRangeSingleCell(a) {
|
|
438
|
-
return a.x === a.x1 && a.y === a.y1;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
exports.EMPTY_INDEX = EMPTY_INDEX;
|
|
442
|
-
exports.SelectionStore = SelectionStore;
|
|
443
|
-
exports.SelectionStoreConnector = SelectionStoreConnector;
|
|
444
|
-
exports.cropCellToMax = cropCellToMax;
|
|
445
|
-
exports.getRange = getRange;
|
|
446
|
-
exports.isHiddenStore = isHiddenStore;
|
|
447
|
-
exports.isRangeSingleCell = isRangeSingleCell;
|
|
448
|
-
exports.nextCell = nextCell;
|
|
449
|
-
|
|
450
|
-
//# sourceMappingURL=selection.helpers-2c90d546.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"selection.helpers-2c90d546.js","mappings":";;;;;;;;;AAAA;;;AASA,SAAS,YAAY;IACnB,OAAO;QACL,KAAK,EAAE,IAAI;QACX,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,IAAI;QACnB,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,IAAI;KAChB,CAAC;AACJ,CAAC;MAEY,cAAc;IAGzB;QADQ,gBAAW,GAAmB,EAAE,CAAC;QAEvC,IAAI,CAAC,KAAK,GAAGA,iBAAW,CAAC,YAAY,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,KA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KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC3B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAC5B,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;SAC7B;UACD,IAAI,CAAC;AACX,CAAC;SAEe,iBAAiB,CAAC,CAAY;IAC5C,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;AACtC;;;;;;;;;;;","names":["createStore","setStore"],"sources":["src/store/selection/selection.store.ts","src/services/selection.store.connector.ts","src/store/selection/selection.helpers.ts"],"sourcesContent":["/**\n * Selection store\n */\n\nimport { setStore, Observable } from '../../utils/store.utils';\nimport { getRange } from '@store';\nimport { SelectionStoreState, Cell, TempRange, RangeArea, Nullable } from '@type';\nimport { createStore } from '@stencil/store';\n\nfunction defaultState(): SelectionStoreState {\n return {\n range: null,\n tempRange: null,\n tempRangeType: null,\n focus: null,\n edit: null,\n lastCell: null,\n nextFocus: null,\n };\n}\n\nexport class SelectionStore {\n readonly store: Observable<SelectionStoreState>;\n private unsubscribe: { (): void }[] = [];\n constructor() {\n this.store = createStore(defaultState());\n this.store.on('set', (key, newVal) => {\n if (key === 'tempRange' && !newVal) {\n this.store.set('tempRangeType', null);\n }\n });\n }\n\n onChange<Key extends keyof SelectionStoreState>(propName: Key, cb: (newValue: SelectionStoreState[Key]) => void) {\n this.unsubscribe.push(this.store.onChange(propName, cb));\n }\n\n clearFocus() {\n setStore(this.store, { focus: null, range: null, edit: null, tempRange: null });\n }\n\n setFocus(focus: Cell, end?: Cell) {\n if (!end) {\n setStore(this.store, { focus });\n } else {\n setStore(this.store, {\n focus,\n range: getRange(focus, end),\n edit: null,\n tempRange: null,\n });\n }\n }\n\n setNextFocus(focus: Cell) {\n setStore(this.store, { nextFocus: focus });\n }\n\n setTempArea(range: Nullable<TempRange> | null) {\n setStore(this.store, { tempRange: range?.area, tempRangeType: range?.type, edit: null });\n }\n\n clearTemp() {\n setStore(this.store, { tempRange: null });\n }\n\n /** Can be applied from selection change or from simple keyboard change clicks */\n setRangeArea(range: RangeArea | null) {\n setStore(this.store, { range, edit: null, tempRange: null });\n }\n setRange(start: Cell, end: Cell) {\n const range = getRange(start, end);\n this.setRangeArea(range);\n }\n\n setLastCell(lastCell: Cell) {\n setStore(this.store, { lastCell });\n }\n\n setEdit(val?: string | boolean) {\n const focus = this.store.get('focus');\n if (focus && typeof val === 'string') {\n setStore(this.store, {\n edit: { x: focus.x, y: focus.y, val },\n });\n return;\n }\n setStore(this.store, { edit: null });\n }\n\n dispose() {\n this.unsubscribe.forEach(f => f());\n this.store.dispose();\n }\n}\n","import { cropCellToMax, isHiddenStore, nextCell, SelectionStore } from '@store';\nimport type {\n MultiDimensionType,\n DimensionCols,\n DimensionRows,\n Cell,\n} from '@type';\n\ntype StoreByDimension = Record<number, SelectionStore>;\ntype FocusedStore = {\n entity: SelectionStore;\n cell: Cell;\n position: Cell;\n};\n\ntype StoresMapping<T> = { [xOrY: number]: Partial<T> };\n\nexport const EMPTY_INDEX = -1;\n\nexport default class SelectionStoreConnector {\n // dirty flag required to cleanup whole store in case visibility of panels changed\n private dirty = false;\n readonly stores: { [y: number]: { [x: number]: SelectionStore } } = {};\n\n readonly columnStores: StoreByDimension = {};\n readonly rowStores: { [y: number]: SelectionStore } = {};\n\n /**\n * Helpers for data conversion\n */\n readonly storesByType: Partial<Record<MultiDimensionType, number>> = {};\n readonly storesXToType: StoresMapping<DimensionCols> = {};\n readonly storesYToType: StoresMapping<DimensionRows> = {};\n\n get focusedStore(): FocusedStore | null {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const focused = this.stores[y][x]?.store.get('focus');\n if (focused) {\n return {\n entity: this.stores[y][x],\n cell: focused,\n position: {\n x: parseInt(x, 10),\n y: parseInt(y, 10),\n },\n };\n }\n }\n }\n return null;\n }\n\n get edit() {\n return this.focusedStore?.entity.store.get('edit');\n }\n\n get focused() {\n return this.focusedStore?.entity.store.get('focus');\n }\n\n get selectedRange() {\n return this.focusedStore?.entity.store.get('range');\n }\n\n private readonly sections: Element[] = [];\n\n registerSection(e?: Element) {\n if (!e) {\n this.sections.length = 0;\n // some elements removed, rebuild stores\n this.dirty = true;\n return;\n }\n if (this.sections.indexOf(e) === -1) {\n this.sections.push(e);\n }\n }\n\n // check if require to cleanup all stores\n beforeUpdate() {\n if (this.dirty) {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x].dispose();\n }\n }\n this.dirty = false;\n }\n }\n\n registerColumn(x: number, type: DimensionCols): SelectionStore {\n // if hidden just create store but no operations needed\n if (isHiddenStore(x)) {\n return new SelectionStore();\n }\n if (this.columnStores[x]) {\n return this.columnStores[x];\n }\n this.columnStores[x] = new SelectionStore();\n // build cross-linking type to position\n this.storesByType[type] = x;\n this.storesXToType[x] = type;\n return this.columnStores[x];\n }\n\n registerRow(y: number, type: DimensionRows): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (this.rowStores[y]) {\n return this.rowStores[y];\n }\n this.rowStores[y] = new SelectionStore();\n // build cross linking type to position\n this.storesByType[type] = y;\n this.storesYToType[y] = type;\n return this.rowStores[y];\n }\n\n /**\n * Cross store proxy, based on multiple dimensions\n */\n register({ x, y }: Cell): SelectionStore {\n // if hidden just create store\n if (isHiddenStore(x) || isHiddenStore(y)) {\n return new SelectionStore();\n }\n if (!this.stores[y]) {\n this.stores[y] = {};\n }\n if (this.stores[y][x]) {\n // Store already registered. Do not register twice\n return this.stores[y][x];\n }\n this.stores[y][x] = new SelectionStore();\n // proxy update, column store trigger only range area\n this.stores[y][x]?.onChange('range', c => {\n this.columnStores[x].setRangeArea(c);\n this.rowStores[y].setRangeArea(c);\n });\n // clean up on remove\n this.stores[y][x]?.store.on('dispose', () => this.destroy(x, y));\n return this.stores[y][x];\n }\n\n private destroy(x: number, y: number) {\n this.columnStores[x]?.dispose();\n this.rowStores[y]?.dispose();\n\n delete this.rowStores[y];\n delete this.columnStores[x];\n // clear x cross-link\n if (this.storesXToType[x]) {\n const type = this.storesXToType[x];\n delete this.storesXToType[x];\n delete this.storesByType[type];\n }\n // clear y cross-link\n if (this.storesYToType[y]) {\n const type = this.storesYToType[y];\n delete this.storesYToType[y];\n delete this.storesByType[type];\n }\n if (this.stores[y]) {\n delete this.stores[y][x];\n }\n // clear empty rows\n if (!Object.keys(this.stores[y] || {}).length) {\n delete this.stores[y];\n }\n }\n\n setEditByCell<T extends Cell>(storePos: T, editCell: T) {\n this.focusByCell(storePos, editCell, editCell);\n this.setEdit('');\n }\n\n /**\n * Sets the next focus cell before the current one.\n * \n * @param focus - The cell to set as the next focus.\n */\n beforeNextFocusCell(focus: Cell) {\n // If there is no focused store, return early.\n if (!this.focusedStore) {\n return;\n }\n\n // Get the next store based on the current focus and the last cell.\n const lastCell = this.focusedStore.entity.store.get('lastCell');\n const next = lastCell && this.getNextStore(focus, this.focusedStore.position, lastCell);\n\n // Set the next focus cell in the store.\n next?.store?.setNextFocus({ ...focus, ...next.item });\n }\n\n focusByCell<T extends Cell>(storePos: T, start: T, end: T) {\n const store = this.stores[storePos.y][storePos.x];\n this.focus(store, { focus: start, end });\n }\n\n focus(store: SelectionStore, { focus, end }: { focus: Cell; end: Cell }) {\n const currentStorePointer = this.getCurrentStorePointer(store);\n if (!currentStorePointer) {\n return null;\n }\n\n // check for the focus in nearby store/viewport\n const lastCell = store.store.get('lastCell');\n const next = lastCell && this.getNextStore(focus, currentStorePointer, lastCell);\n\n // if next store present - update\n if (next?.store) {\n const item = { ...focus, ...next.item };\n this.focus(next.store, { focus: item, end: item });\n return null;\n }\n\n if (lastCell) {\n focus = cropCellToMax(focus, lastCell);\n end = cropCellToMax(end, lastCell); \n }\n store.setFocus(focus, end);\n return focus;\n }\n\n /**\n * Retrieves the current store pointer based on the active store.\n * Clears focus from all stores except the active one.\n */\n getCurrentStorePointer(store: SelectionStore) {\n let currentStorePointer: Cell | undefined;\n\n // Iterate through all stores\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const s = this.stores[y][x];\n\n // Clear focus from stores other than the active one\n if (s !== store) {\n s.clearFocus();\n } else {\n // Update the current store pointer with the active store coordinates\n currentStorePointer = { \n x: parseInt(x, 10), \n y: parseInt(y, 10) \n };\n }\n }\n }\n\n return currentStorePointer;\n }\n\n /**\n * Retrieves the next store based on the focus cell and current store pointer.\n * If the next store exists, returns an object with the next store and the item in the new store.\n * If the next store does not exist, returns null.\n */\n getNextStore(\n focus: Cell,\n currentStorePointer: Cell,\n lastCell: Cell,\n ) {\n // item in new store\n const nextItem: Partial<Cell> | null = nextCell(focus, lastCell);\n\n let nextStore: SelectionStore | undefined;\n if (nextItem) {\n Object.entries(nextItem).forEach(([type, nextItemCoord]: [keyof Cell, number]) => {\n let stores;\n switch (type) {\n case 'x':\n // Get the X stores for the current Y coordinate of the current store pointer\n stores = this.getXStores(currentStorePointer.y);\n break;\n case 'y':\n // Get the Y stores for the current X coordinate of the current store pointer\n stores = this.getYStores(currentStorePointer.x);\n break;\n }\n\n // Get the next store based on the item in the new store\n if (nextItemCoord >= 0) {\n nextStore = stores[++currentStorePointer[type]];\n } else {\n nextStore = stores[--currentStorePointer[type]];\n const nextLastCell = nextStore?.store.get('lastCell');\n if (nextLastCell) {\n nextItem[type] = nextLastCell[type] + nextItemCoord;\n }\n }\n });\n }\n return {\n store: nextStore,\n item: nextItem,\n };\n }\n\n clearAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n this.stores[y][x]?.clearFocus();\n }\n }\n }\n\n setEdit(val?: string | boolean) {\n if (!this.focusedStore) {\n return;\n }\n this.focusedStore.entity.setEdit(val);\n }\n\n /**\n * Select all cells across all stores\n */\n selectAll() {\n for (let y in this.stores) {\n for (let x in this.stores[y]) {\n const store = this.stores[y][x];\n if (!store) {\n continue;\n }\n const lastCell = store.store.get('lastCell');\n if (lastCell) {\n store.setRange(\n { x: 0, y: 0 },\n { x: lastCell.x - 1, y: lastCell.y - 1 },\n );\n }\n }\n }\n }\n\n private getXStores(y: number) {\n return this.stores[y];\n }\n\n private getYStores(x: number) {\n const stores: { [p: number]: SelectionStore } = {};\n for (let i in this.stores) {\n stores[i] = this.stores[i][x];\n }\n return stores;\n }\n}\n","import { EMPTY_INDEX } from '../../services/selection.store.connector';\nimport { Cell, RangeArea } from '@type';\n\nexport function isHiddenStore(pos: number) {\n return pos === EMPTY_INDEX;\n}\n\nexport function nextCell(cell: Cell, lastCell: Cell): Partial<Cell> | null {\n const nextItem: Partial<Cell> = {};\n let types: (keyof Cell)[] = ['x', 'y'];\n\n // previous item check\n for (let t of types) {\n if (cell[t] < 0) {\n nextItem[t] = cell[t];\n return nextItem;\n }\n }\n // next item check\n for (let t of types) {\n if (cell[t] >= lastCell[t]) {\n nextItem[t] = cell[t] - lastCell[t];\n return nextItem;\n }\n }\n return null;\n}\n\nexport function cropCellToMax(cell: Cell, lastCell: Cell): Cell {\n const croppedCell: Cell = { ...cell };\n const cellCoordinates: (keyof Cell)[] = ['x', 'y'];\n\n for (const coordinate of cellCoordinates) {\n if (cell[coordinate] < 0) {\n croppedCell[coordinate] = 0;\n } else if (cell[coordinate] >= lastCell[coordinate]) {\n croppedCell[coordinate] = lastCell[coordinate] - 1;\n }\n }\n\n return croppedCell;\n}\n\nexport function getRange(start?: Cell | null, end?: Cell | null): RangeArea | null {\n return start && end\n ? {\n x: Math.min(start.x, end.x),\n y: Math.min(start.y, end.y),\n x1: Math.max(start.x, end.x),\n y1: Math.max(start.y, end.y),\n }\n : null;\n}\n\nexport function isRangeSingleCell(a: RangeArea): boolean {\n return a.x === a.x1 && a.y === a.y1;\n}\n"],"version":3}
|