@revolist/revogrid 4.9.13 → 4.9.16
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 → column.drag.plugin-a5cc161a.js} +106 -186
- package/dist/cjs/column.drag.plugin-a5cc161a.js.map +1 -0
- package/dist/cjs/{column.service-15c8352d.js → column.service-d45dbb3f.js} +141 -14
- package/dist/cjs/column.service-d45dbb3f.js.map +1 -0
- package/dist/cjs/{header-cell-renderer-375a879f.js → header-cell-renderer-28f7f21d.js} +14 -14
- package/dist/cjs/header-cell-renderer-28f7f21d.js.map +1 -0
- package/dist/cjs/index.cjs.js +15 -13
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/revo-grid.cjs.entry.js +23 -17
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/revo-grid.cjs.js +1 -1
- package/dist/cjs/revogr-attribution_6.cjs.entry.js +1 -1
- package/dist/cjs/revogr-data_4.cjs.entry.js +7 -7
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -1
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +17 -10
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/data/cell-renderer.js +2 -2
- package/dist/collection/components/data/cell-renderer.js.map +1 -1
- package/dist/collection/components/data/column.service.js +5 -14
- package/dist/collection/components/data/column.service.js.map +1 -1
- package/dist/collection/components/header/header-cell-renderer.js +5 -4
- package/dist/collection/components/header/header-cell-renderer.js.map +1 -1
- package/dist/collection/components/header/header-renderer.js +2 -2
- package/dist/collection/components/header/header-renderer.js.map +1 -1
- package/dist/collection/components/header/resizable.directive.js.map +1 -1
- package/dist/collection/components/header/resizable.element.js +9 -10
- package/dist/collection/components/header/resizable.element.js.map +1 -1
- package/dist/collection/components/header/revogr-header.js +3 -3
- package/dist/collection/components/header/revogr-header.js.map +1 -1
- package/dist/collection/components/revoGrid/revo-grid.js +6 -6
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -1
- package/dist/collection/global/global.js +2 -2
- package/dist/collection/global/global.js.map +1 -1
- package/dist/collection/plugins/filter/{filter.service.js → filter.indexed.js} +18 -18
- package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
- package/dist/collection/plugins/filter/filter.panel.js +32 -46
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -1
- package/dist/collection/plugins/filter/filter.plugin.js +86 -40
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -1
- package/dist/collection/plugins/filter/filter.types.js.map +1 -1
- package/dist/collection/plugins/wcag/index.js +7 -1
- package/dist/collection/plugins/wcag/index.js.map +1 -1
- package/dist/collection/serve/controller.js +1 -1
- package/dist/collection/themeManager/theme.compact.js +1 -1
- package/dist/collection/themeManager/theme.compact.js.map +1 -1
- package/dist/collection/themeManager/theme.default.js +1 -1
- package/dist/collection/themeManager/theme.default.js.map +1 -1
- package/dist/collection/themeManager/theme.material.js +1 -1
- package/dist/collection/themeManager/theme.material.js.map +1 -1
- package/dist/collection/themeManager/theme.service.js +9 -9
- package/dist/collection/themeManager/theme.service.js.map +1 -1
- package/dist/collection/types/interfaces.js.map +1 -1
- package/dist/collection/utils/column.utils.js +10 -0
- package/dist/collection/utils/column.utils.js.map +1 -1
- package/dist/esm/{column.drag.plugin-30dc4e24.js → column.drag.plugin-18125693.js} +107 -181
- package/dist/esm/column.drag.plugin-18125693.js.map +1 -0
- package/dist/esm/{column.service-414e9cba.js → column.service-00a51837.js} +136 -16
- package/dist/esm/column.service-00a51837.js.map +1 -0
- package/dist/esm/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
- package/dist/esm/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +1 -1
- package/dist/esm/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +14 -14
- package/dist/esm/header-cell-renderer-6d89f141.js.map +1 -0
- package/dist/esm/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
- package/dist/esm/{index-74b9801b.js.map → index-00cb6ac1.js.map} +1 -1
- package/dist/esm/index.js +7 -7
- package/dist/esm/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
- package/dist/esm/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/revo-grid.entry.js +18 -12
- package/dist/esm/revo-grid.entry.js.map +1 -1
- package/dist/esm/revo-grid.js +1 -1
- package/dist/esm/revogr-attribution_6.entry.js +6 -6
- package/dist/esm/revogr-clipboard_3.entry.js +4 -4
- package/dist/esm/revogr-data_4.entry.js +9 -9
- package/dist/esm/revogr-data_4.entry.js.map +1 -1
- package/dist/esm/revogr-filter-panel.entry.js +17 -10
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -1
- package/dist/esm/{row-header-utils-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
- package/dist/esm/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +1 -1
- package/dist/esm/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +3 -3
- package/dist/esm/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +1 -1
- package/dist/esm/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
- package/dist/esm/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +1 -1
- package/dist/revo-grid/column.drag.plugin-18125693.js +5 -0
- package/dist/revo-grid/column.drag.plugin-18125693.js.map +1 -0
- package/dist/revo-grid/column.service-00a51837.js +5 -0
- package/dist/revo-grid/column.service-00a51837.js.map +1 -0
- package/dist/revo-grid/{edit.utils-0666e5bd.js → edit.utils-b50f9378.js} +2 -2
- package/dist/revo-grid/{header-cell-renderer-ca570fcf.js → header-cell-renderer-6d89f141.js} +2 -2
- package/dist/revo-grid/header-cell-renderer-6d89f141.js.map +1 -0
- package/dist/revo-grid/{index-74b9801b.js → index-00cb6ac1.js} +2 -2
- package/dist/revo-grid/index.esm.js +1 -1
- package/dist/revo-grid/{key.utils-d3df5db8.js → key.utils-b8a11f7d.js} +2 -2
- 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/revo-grid.esm.js +1 -1
- package/dist/revo-grid/revo-grid.esm.js.map +1 -1
- package/dist/revo-grid/revogr-attribution_6.entry.js +1 -1
- package/dist/revo-grid/revogr-clipboard_3.entry.js +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-c7e3e2d5.js → row-header-utils-30750b8e.js} +2 -2
- package/dist/revo-grid/{text-editor-96d69516.js → text-editor-f8a9ff85.js} +2 -2
- package/dist/revo-grid/{throttle-262c3ed2.js → throttle-9b08685d.js} +2 -2
- package/dist/types/components/data/column.service.d.ts +1 -2
- package/dist/types/components/header/header-cell-renderer.d.ts +7 -9
- package/dist/types/components/header/header-renderer.d.ts +2 -3
- package/dist/types/components/header/resizable.directive.d.ts +0 -1
- package/dist/types/components/header/resizable.element.d.ts +3 -2
- package/dist/types/components/revoGrid/revo-grid.d.ts +1 -1
- package/dist/types/components.d.ts +2 -8
- package/dist/types/plugins/filter/{filter.service.d.ts → filter.indexed.d.ts} +2 -2
- package/dist/types/plugins/filter/filter.panel.d.ts +3 -27
- package/dist/types/plugins/filter/filter.plugin.d.ts +14 -47
- package/dist/types/plugins/filter/filter.types.d.ts +86 -1
- package/dist/types/themeManager/theme.compact.d.ts +1 -1
- package/dist/types/themeManager/theme.default.d.ts +1 -1
- package/dist/types/themeManager/theme.material.d.ts +1 -1
- package/dist/types/themeManager/theme.service.d.ts +2 -2
- package/dist/types/types/interfaces.d.ts +9 -12
- package/dist/types/utils/column.utils.d.ts +3 -1
- package/hydrate/index.js +1007 -949
- package/hydrate/index.mjs +1007 -949
- package/package.json +1 -1
- package/standalone/column.service.js +136 -15
- package/standalone/column.service.js.map +1 -1
- package/standalone/dimension.helpers.js +2 -216
- package/standalone/dimension.helpers.js.map +1 -1
- package/standalone/index.js +7 -6
- package/standalone/index.js.map +1 -1
- package/standalone/index2.js +2 -84
- package/standalone/index2.js.map +1 -1
- package/standalone/platform.js +89 -0
- package/standalone/platform.js.map +1 -0
- package/standalone/{data.store.js → reduce.js} +252 -38
- package/standalone/reduce.js.map +1 -0
- package/standalone/revo-grid.js +119 -186
- package/standalone/revo-grid.js.map +1 -1
- package/standalone/revogr-data2.js +3 -2
- package/standalone/revogr-data2.js.map +1 -1
- package/standalone/revogr-edit2.js +2 -1
- package/standalone/revogr-edit2.js.map +1 -1
- package/standalone/revogr-filter-panel.js +17 -11
- package/standalone/revogr-filter-panel.js.map +1 -1
- package/standalone/revogr-focus2.js +1 -1
- package/standalone/revogr-header2.js +20 -20
- package/standalone/revogr-header2.js.map +1 -1
- package/standalone/revogr-order-editor2.js +1 -1
- package/standalone/revogr-overlay-selection2.js +3 -2
- package/standalone/revogr-overlay-selection2.js.map +1 -1
- package/standalone/revogr-row-headers2.js +1 -1
- package/standalone/selection.utils.js +1 -1
- package/dist/cjs/column.drag.plugin-e636b5af.js.map +0 -1
- package/dist/cjs/column.service-15c8352d.js.map +0 -1
- package/dist/cjs/header-cell-renderer-375a879f.js.map +0 -1
- package/dist/collection/plugins/filter/filter.service.js.map +0 -1
- package/dist/esm/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/esm/column.service-414e9cba.js.map +0 -1
- package/dist/esm/header-cell-renderer-ca570fcf.js.map +0 -1
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js +0 -5
- package/dist/revo-grid/column.drag.plugin-30dc4e24.js.map +0 -1
- package/dist/revo-grid/column.service-414e9cba.js +0 -5
- package/dist/revo-grid/column.service-414e9cba.js.map +0 -1
- package/dist/revo-grid/header-cell-renderer-ca570fcf.js.map +0 -1
- package/standalone/data.store.js.map +0 -1
- /package/dist/revo-grid/{edit.utils-0666e5bd.js.map → edit.utils-b50f9378.js.map} +0 -0
- /package/dist/revo-grid/{index-74b9801b.js.map → index-00cb6ac1.js.map} +0 -0
- /package/dist/revo-grid/{key.utils-d3df5db8.js.map → key.utils-b8a11f7d.js.map} +0 -0
- /package/dist/revo-grid/{row-header-utils-c7e3e2d5.js.map → row-header-utils-30750b8e.js.map} +0 -0
- /package/dist/revo-grid/{text-editor-96d69516.js.map → text-editor-f8a9ff85.js.map} +0 -0
- /package/dist/revo-grid/{throttle-262c3ed2.js.map → throttle-9b08685d.js.map} +0 -0
package/hydrate/index.mjs
CHANGED
|
@@ -2435,55 +2435,6 @@ class Clipboard {
|
|
|
2435
2435
|
}; }
|
|
2436
2436
|
}
|
|
2437
2437
|
|
|
2438
|
-
const FILTER_BUTTON_CLASS = 'rv-filter';
|
|
2439
|
-
const FILTER_BUTTON_ACTIVE = 'active';
|
|
2440
|
-
const FILTER_PROP = 'hasFilter';
|
|
2441
|
-
const AND_OR_BUTTON = 'and-or-button';
|
|
2442
|
-
const TRASH_BUTTON = 'trash-button';
|
|
2443
|
-
const FilterButton = ({ column }) => {
|
|
2444
|
-
return (hAsync("span", null,
|
|
2445
|
-
hAsync("button", { class: {
|
|
2446
|
-
[FILTER_BUTTON_CLASS]: true,
|
|
2447
|
-
[FILTER_BUTTON_ACTIVE]: column && !!column[FILTER_PROP],
|
|
2448
|
-
} },
|
|
2449
|
-
hAsync("svg", { class: "filter-img", viewBox: "0 0 64 64" },
|
|
2450
|
-
hAsync("g", { stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" },
|
|
2451
|
-
hAsync("path", { d: "M43,48 L43,56 L21,56 L21,48 L43,48 Z M53,28 L53,36 L12,36 L12,28 L53,28 Z M64,8 L64,16 L0,16 L0,8 L64,8 Z", fill: "currentColor" }))))));
|
|
2452
|
-
};
|
|
2453
|
-
const TrashButton = () => {
|
|
2454
|
-
return (hAsync("div", { class: { [TRASH_BUTTON]: true } },
|
|
2455
|
-
hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
|
|
2456
|
-
hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
|
|
2457
|
-
};
|
|
2458
|
-
const AndOrButton = ({ text }) => {
|
|
2459
|
-
return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
|
|
2460
|
-
};
|
|
2461
|
-
function isFilterBtn(e) {
|
|
2462
|
-
if (e.classList.contains(FILTER_BUTTON_CLASS)) {
|
|
2463
|
-
return true;
|
|
2464
|
-
}
|
|
2465
|
-
return e === null || e === void 0 ? void 0 : e.closest(`.${FILTER_BUTTON_CLASS}`);
|
|
2466
|
-
}
|
|
2467
|
-
|
|
2468
|
-
(function closest() {
|
|
2469
|
-
if (!Element.prototype.matches) {
|
|
2470
|
-
Element.prototype.matches =
|
|
2471
|
-
Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
2472
|
-
}
|
|
2473
|
-
if (!Element.prototype.closest) {
|
|
2474
|
-
Element.prototype.closest = function (s) {
|
|
2475
|
-
let el = this;
|
|
2476
|
-
do {
|
|
2477
|
-
if (Element.prototype.matches.call(el, s)) {
|
|
2478
|
-
return el;
|
|
2479
|
-
}
|
|
2480
|
-
el = el.parentElement || el.parentNode;
|
|
2481
|
-
} while (el !== null && el.nodeType === 1);
|
|
2482
|
-
return null;
|
|
2483
|
-
};
|
|
2484
|
-
}
|
|
2485
|
-
})();
|
|
2486
|
-
|
|
2487
2438
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
2488
2439
|
|
|
2489
2440
|
/**
|
|
@@ -3025,6 +2976,55 @@ function debounce$2(func, wait, options) {
|
|
|
3025
2976
|
|
|
3026
2977
|
var debounce_1 = debounce$2;
|
|
3027
2978
|
|
|
2979
|
+
const FILTER_BUTTON_CLASS = 'rv-filter';
|
|
2980
|
+
const FILTER_BUTTON_ACTIVE = 'active';
|
|
2981
|
+
const FILTER_PROP = 'hasFilter';
|
|
2982
|
+
const AND_OR_BUTTON = 'and-or-button';
|
|
2983
|
+
const TRASH_BUTTON = 'trash-button';
|
|
2984
|
+
const FilterButton = ({ column }) => {
|
|
2985
|
+
return (hAsync("span", null,
|
|
2986
|
+
hAsync("button", { class: {
|
|
2987
|
+
[FILTER_BUTTON_CLASS]: true,
|
|
2988
|
+
[FILTER_BUTTON_ACTIVE]: column && !!column[FILTER_PROP],
|
|
2989
|
+
} },
|
|
2990
|
+
hAsync("svg", { class: "filter-img", viewBox: "0 0 64 64" },
|
|
2991
|
+
hAsync("g", { stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" },
|
|
2992
|
+
hAsync("path", { d: "M43,48 L43,56 L21,56 L21,48 L43,48 Z M53,28 L53,36 L12,36 L12,28 L53,28 Z M64,8 L64,16 L0,16 L0,8 L64,8 Z", fill: "currentColor" }))))));
|
|
2993
|
+
};
|
|
2994
|
+
const TrashButton = () => {
|
|
2995
|
+
return (hAsync("div", { class: { [TRASH_BUTTON]: true } },
|
|
2996
|
+
hAsync("svg", { class: "trash-img", viewBox: "0 0 24 24" },
|
|
2997
|
+
hAsync("path", { fill: "currentColor", d: "M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z" }))));
|
|
2998
|
+
};
|
|
2999
|
+
const AndOrButton = ({ text }) => {
|
|
3000
|
+
return hAsync("button", { class: { [AND_OR_BUTTON]: true, 'light revo-button': true } }, text);
|
|
3001
|
+
};
|
|
3002
|
+
function isFilterBtn(e) {
|
|
3003
|
+
if (e.classList.contains(FILTER_BUTTON_CLASS)) {
|
|
3004
|
+
return true;
|
|
3005
|
+
}
|
|
3006
|
+
return e === null || e === void 0 ? void 0 : e.closest(`.${FILTER_BUTTON_CLASS}`);
|
|
3007
|
+
}
|
|
3008
|
+
|
|
3009
|
+
(function closest() {
|
|
3010
|
+
if (!Element.prototype.matches) {
|
|
3011
|
+
Element.prototype.matches =
|
|
3012
|
+
Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
3013
|
+
}
|
|
3014
|
+
if (!Element.prototype.closest) {
|
|
3015
|
+
Element.prototype.closest = function (s) {
|
|
3016
|
+
let el = this;
|
|
3017
|
+
do {
|
|
3018
|
+
if (Element.prototype.matches.call(el, s)) {
|
|
3019
|
+
return el;
|
|
3020
|
+
}
|
|
3021
|
+
el = el.parentElement || el.parentNode;
|
|
3022
|
+
} while (el !== null && el.nodeType === 1);
|
|
3023
|
+
return null;
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
})();
|
|
3027
|
+
|
|
3028
3028
|
const filterStyleCss = ".revo-drag-icon{width:11px;opacity:0.8}.revo-drag-icon::before{content:\"::\"}.revo-alt-icon{-webkit-mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg viewBox='0 0 384 383' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg%3E%3Cpath d='M192.4375,383 C197.424479,383 201.663411,381.254557 205.154297,377.763672 L205.154297,377.763672 L264.25,318.667969 C270.234375,312.683594 271.605794,306.075846 268.364258,298.844727 C265.122721,291.613607 259.51237,287.998047 251.533203,287.998047 L251.533203,287.998047 L213.382812,287.998047 L213.382812,212.445312 L288.935547,212.445312 L288.935547,250.595703 C288.935547,258.57487 292.551107,264.185221 299.782227,267.426758 C307.013346,270.668294 313.621094,269.296875 319.605469,263.3125 L319.605469,263.3125 L378.701172,204.216797 C382.192057,200.725911 383.9375,196.486979 383.9375,191.5 C383.9375,186.513021 382.192057,182.274089 378.701172,178.783203 L378.701172,178.783203 L319.605469,119.6875 C313.621094,114.201823 307.013346,112.955078 299.782227,115.947266 C292.551107,118.939453 288.935547,124.42513 288.935547,132.404297 L288.935547,132.404297 L288.935547,170.554688 L213.382812,170.554688 L213.382812,95.0019531 L251.533203,95.0019531 C259.51237,95.0019531 264.998047,91.3863932 267.990234,84.1552734 C270.982422,76.9241536 269.735677,70.3164062 264.25,64.3320312 L264.25,64.3320312 L205.154297,5.23632812 C201.663411,1.74544271 197.424479,0 192.4375,0 C187.450521,0 183.211589,1.74544271 179.720703,5.23632812 L179.720703,5.23632812 L120.625,64.3320312 C114.640625,70.3164062 113.269206,76.9241536 116.510742,84.1552734 C119.752279,91.3863932 125.36263,95.0019531 133.341797,95.0019531 L133.341797,95.0019531 L171.492188,95.0019531 L171.492188,170.554688 L95.9394531,170.554688 L95.9394531,132.404297 C95.9394531,124.42513 92.3238932,118.814779 85.0927734,115.573242 C77.8616536,112.331706 71.2539062,113.703125 65.2695312,119.6875 L65.2695312,119.6875 L6.17382812,178.783203 C2.68294271,182.274089 0.9375,186.513021 0.9375,191.5 C0.9375,196.486979 2.68294271,200.725911 6.17382812,204.216797 L6.17382812,204.216797 L65.2695312,263.3125 C71.2539062,268.798177 77.8616536,270.044922 85.0927734,267.052734 C92.3238932,264.060547 95.9394531,258.57487 95.9394531,250.595703 L95.9394531,250.595703 L95.9394531,212.445312 L171.492188,212.445312 L171.492188,287.998047 L133.341797,287.998047 C125.36263,287.998047 119.876953,291.613607 116.884766,298.844727 C113.892578,306.075846 115.139323,312.683594 120.625,318.667969 L120.625,318.667969 L179.720703,377.763672 C183.211589,381.254557 187.450521,383 192.4375,383 Z'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\");width:11px;height:11px;background-size:cover;background-repeat:no-repeat}.arrow-down{position:absolute;right:5px;top:0}.arrow-down svg{width:8px;margin-top:5px;margin-left:5px;opacity:0.4}.cell-value-wrapper{margin-right:10px;overflow:hidden;text-overflow:ellipsis}.revo-button{position:relative;overflow:hidden;color:#fff;background-color:#6200ee;height:34px;line-height:34px;padding:0 15px;outline:0;border:0;border-radius:7px;box-sizing:border-box;cursor:pointer}.revo-button.green{background-color:#009037;border:1px solid #00772d}.revo-button.red{background-color:#E0662E;border:1px solid #d55920}.revo-button:disabled,.revo-button[disabled]{cursor:not-allowed !important;filter:opacity(0.35) !important}.revo-button.light{border:1px solid #cedefa;line-height:32px;background:none;color:#000;box-shadow:none}revogr-filter-panel{position:absolute;display:block;top:0;left:0;z-index:100;opacity:1;transform:none;background-color:#fff;transform-origin:62px 0px;box-shadow:0 5px 18px -2px rgba(0, 0, 0, 0.2);padding:10px;border-radius:4px;min-width:220px;text-align:left}revogr-filter-panel .filter-holder>div{display:flex;flex-direction:column}revogr-filter-panel label{font-size:13px;display:block;padding:8px 0}revogr-filter-panel select{width:100%}revogr-filter-panel input[type=text]{border:0;min-height:34px;margin:5px 0;background:#f3f3f3;border-radius:5px;padding:0 10px;box-sizing:border-box;width:100%}revogr-filter-panel button{margin-top:10px;margin-right:5px}revogr-filter-panel .filter-actions{text-align:right;margin-right:-5px}.rgHeaderCell:hover .rv-filter{transition:opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms}.rgHeaderCell:hover .rv-filter,.rgHeaderCell .rv-filter.active{opacity:1}.rgHeaderCell .rv-filter{height:24px;width:24px;background:none;border:0;opacity:0;visibility:visible;cursor:pointer;border-radius:4px}.rgHeaderCell .rv-filter.active{color:#10224a}.rgHeaderCell .rv-filter .filter-img{color:gray;width:11px}.select-css{display:block;font-family:sans-serif;font-weight:600;color:#444;line-height:1.3;padding:0.6em 1.4em 0.5em 0.8em;width:100%;max-width:100%;box-sizing:border-box;margin:0;border:1px solid #f1f1f1;box-shadow:transparent;border-radius:0.5em;appearance:none;background-color:#fff;background-image:url(\"data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007CB2%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E\"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%);background-repeat:no-repeat, repeat;background-position:right 0.7em top 50%, 0 0;background-size:0.65em auto, 100%;}.select-css::-ms-expand{display:none}.select-css:hover{border-color:rgb(197, 197, 197)}.select-css:focus{border-color:#f1f1f1;box-shadow:0 0 1px 3px rgba(59, 153, 252, 0.7);box-shadow:0 0 0 3px -moz-mac-focusring;color:#222;outline:none}.select-css option{font-weight:normal}.select-css:disabled,.select-css[aria-disabled=true]{color:gray;background-image:url(\"data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22graytext%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E\"), linear-gradient(to bottom, #ffffff 0%, #ffffff 100%)}.select-css:disabled:hover,.select-css[aria-disabled=true]{border-color:#f1f1f1}.multi-filter-list{margin-top:5px;margin-bottom:5px}.multi-filter-list div{white-space:nowrap}.multi-filter-list .multi-filter-list-action{display:flex;justify-content:space-between;align-items:center}.multi-filter-list .and-or-button{margin:0 0 0 10px;min-width:58px;cursor:pointer}.multi-filter-list .trash-button{margin:0 0 -2px 6px;cursor:pointer;width:22px;height:100%;font-size:16px}.multi-filter-list .trash-button .trash-img{width:1em}.add-filter-divider{display:block;margin:0 -10px 10px -10px;border-bottom:1px solid #d9d9d9;height:10px}.select-input{display:flex;justify-content:space-between;align-items:center}";
|
|
3029
3029
|
var RevogrFilterPanelStyle0 = filterStyleCss;
|
|
3030
3030
|
|
|
@@ -3062,7 +3062,6 @@ class FilterPanel {
|
|
|
3062
3062
|
this.currentFilterType = defaultType;
|
|
3063
3063
|
this.changes = undefined;
|
|
3064
3064
|
this.filterItems = {};
|
|
3065
|
-
this.filterTypes = {};
|
|
3066
3065
|
this.filterNames = {};
|
|
3067
3066
|
this.filterEntities = {};
|
|
3068
3067
|
this.filterCaptions = undefined;
|
|
@@ -3088,7 +3087,9 @@ class FilterPanel {
|
|
|
3088
3087
|
}
|
|
3089
3088
|
this.currentFilterId = -1;
|
|
3090
3089
|
const isOutside = !path.includes(this.element);
|
|
3091
|
-
if (e.target instanceof HTMLElement &&
|
|
3090
|
+
if (e.target instanceof HTMLElement &&
|
|
3091
|
+
isOutside &&
|
|
3092
|
+
!isFilterBtn(e.target)) {
|
|
3092
3093
|
this.changes = undefined;
|
|
3093
3094
|
}
|
|
3094
3095
|
}
|
|
@@ -3112,15 +3113,19 @@ class FilterPanel {
|
|
|
3112
3113
|
}
|
|
3113
3114
|
}
|
|
3114
3115
|
renderSelectOptions(type, isDefaultTypeRemoved = false) {
|
|
3115
|
-
|
|
3116
|
+
if (!this.changes) {
|
|
3117
|
+
return;
|
|
3118
|
+
}
|
|
3116
3119
|
const options = [];
|
|
3117
|
-
const prop =
|
|
3120
|
+
const prop = this.changes.prop;
|
|
3118
3121
|
if (!isDefaultTypeRemoved) {
|
|
3119
3122
|
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3120
|
-
options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
|
|
3123
|
+
options.push(hAsync("option", { selected: this.currentFilterType === defaultType, value: defaultType }, prop && this.filterItems[prop] && this.filterItems[prop].length > 0
|
|
3124
|
+
? capts.add
|
|
3125
|
+
: this.filterNames[defaultType]));
|
|
3121
3126
|
}
|
|
3122
|
-
for (let gIndex in this.filterTypes) {
|
|
3123
|
-
options.push(...this.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
|
|
3127
|
+
for (let gIndex in this.changes.filterTypes) {
|
|
3128
|
+
options.push(...this.changes.filterTypes[gIndex].map(k => (hAsync("option", { value: k, selected: type === k }, this.filterNames[k]))));
|
|
3124
3129
|
options.push(hAsync("option", { disabled: true }));
|
|
3125
3130
|
}
|
|
3126
3131
|
return options;
|
|
@@ -3171,8 +3176,10 @@ class FilterPanel {
|
|
|
3171
3176
|
top: `${this.changes.y}px`,
|
|
3172
3177
|
};
|
|
3173
3178
|
const capts = Object.assign(this.filterCaptionsInternal, this.filterCaptions);
|
|
3174
|
-
return (hAsync(Host, { style: style, ref:
|
|
3175
|
-
|
|
3179
|
+
return (hAsync(Host, { style: style, ref: el => {
|
|
3180
|
+
var _a;
|
|
3181
|
+
((_a = this.changes) === null || _a === void 0 ? void 0 : _a.autoCorrect) && this.autoCorrect(el);
|
|
3182
|
+
} }, hAsync("label", null, capts.title), hAsync("div", { class: "filter-holder" }, this.getFilterItemsList()), hAsync("div", { class: "add-filter" }, hAsync("select", { id: FILTER_ID, class: "select-css", onChange: e => this.onAddNewFilter(e) }, this.renderSelectOptions(this.currentFilterType))), hAsync("div", { class: "filter-actions" }, this.disableDynamicFiltering && (hAsync("button", { id: "revo-button-save", "aria-label": "save", class: "revo-button green", onClick: () => this.onSave() }, capts.save)), hAsync("button", { id: "revo-button-reset", "aria-label": "reset", class: "revo-button light", onClick: () => this.onReset() }, capts.reset), hAsync("button", { id: "revo-button-cancel", "aria-label": "cancel", class: "revo-button light", onClick: () => this.onCancel() }, capts.cancel))));
|
|
3176
3183
|
}
|
|
3177
3184
|
onFilterTypeChange(e, prop, index) {
|
|
3178
3185
|
if (!(e.target instanceof HTMLSelectElement)) {
|
|
@@ -3310,7 +3317,6 @@ class FilterPanel {
|
|
|
3310
3317
|
"$tagName$": "revogr-filter-panel",
|
|
3311
3318
|
"$members$": {
|
|
3312
3319
|
"filterItems": [16],
|
|
3313
|
-
"filterTypes": [16],
|
|
3314
3320
|
"filterNames": [16],
|
|
3315
3321
|
"filterEntities": [16],
|
|
3316
3322
|
"filterCaptions": [16],
|
|
@@ -8644,507 +8650,133 @@ class OrderEditor {
|
|
|
8644
8650
|
}; }
|
|
8645
8651
|
}
|
|
8646
8652
|
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
|
|
8651
|
-
const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
|
|
8652
|
-
const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
|
|
8653
|
-
const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
|
|
8654
|
-
const GROUP_EXPAND_BTN = `group-expand`;
|
|
8655
|
-
const GROUP_EXPAND_EVENT = `groupexpandclick`;
|
|
8656
|
-
const GROUPING_ROW_TYPE = 'rgRow';
|
|
8657
|
-
|
|
8658
|
-
function getGroupValueDefault(item, prop) {
|
|
8659
|
-
return item[prop] || null;
|
|
8660
|
-
}
|
|
8661
|
-
/**
|
|
8662
|
-
* Gather data for grouping
|
|
8663
|
-
* @param array - flat data array
|
|
8664
|
-
* @param groupIds - ids of groups
|
|
8665
|
-
* @param expanded - potentially expanded items if present
|
|
8666
|
-
*/
|
|
8667
|
-
function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
|
|
8668
|
-
const groupedItems = new Map();
|
|
8669
|
-
array.forEach((item, originalIndex) => {
|
|
8670
|
-
const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
|
|
8671
|
-
const lastLevelValue = groupLevelValues.pop();
|
|
8672
|
-
let currentGroupLevel = groupedItems;
|
|
8673
|
-
groupLevelValues.forEach(value => {
|
|
8674
|
-
if (!currentGroupLevel.has(value)) {
|
|
8675
|
-
currentGroupLevel.set(value, new Map());
|
|
8676
|
-
}
|
|
8677
|
-
currentGroupLevel = currentGroupLevel.get(value);
|
|
8678
|
-
});
|
|
8679
|
-
if (!currentGroupLevel.has(lastLevelValue)) {
|
|
8680
|
-
currentGroupLevel.set(lastLevelValue, []);
|
|
8681
|
-
}
|
|
8682
|
-
const lastLevelItems = currentGroupLevel.get(lastLevelValue);
|
|
8683
|
-
lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
|
|
8684
|
-
});
|
|
8685
|
-
let itemIndex = -1;
|
|
8686
|
-
const groupingDepth = groupIds.length;
|
|
8687
|
-
// collapse all groups in the beginning
|
|
8688
|
-
const trimmed = {};
|
|
8689
|
-
// index mapping
|
|
8690
|
-
const oldNewIndexMap = {};
|
|
8691
|
-
// check if group header exists
|
|
8692
|
-
const pseudoGroupTest = {};
|
|
8693
|
-
const sourceWithGroups = [];
|
|
8694
|
-
function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
|
|
8695
|
-
const depth = parentIds.length;
|
|
8696
|
-
groupedValues.forEach((innerGroupedValues, groupId) => {
|
|
8697
|
-
const levelIds = [...parentIds, groupId];
|
|
8698
|
-
const mergedIds = levelIds.join(',');
|
|
8699
|
-
const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
|
|
8700
|
-
sourceWithGroups.push({
|
|
8701
|
-
[PSEUDO_GROUP_ITEM]: groupId,
|
|
8702
|
-
[GROUP_DEPTH]: depth,
|
|
8703
|
-
[PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
|
|
8704
|
-
[PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
|
|
8705
|
-
[GROUP_EXPANDED]: isGroupExpanded,
|
|
8706
|
-
});
|
|
8707
|
-
itemIndex += 1;
|
|
8708
|
-
if (!isGroupExpanded && depth) {
|
|
8709
|
-
trimmed[itemIndex] = true;
|
|
8710
|
-
}
|
|
8711
|
-
if (Array.isArray(innerGroupedValues)) {
|
|
8712
|
-
innerGroupedValues.forEach(value => {
|
|
8713
|
-
itemIndex += 1;
|
|
8714
|
-
if (!isGroupExpanded) {
|
|
8715
|
-
trimmed[itemIndex] = true;
|
|
8716
|
-
}
|
|
8717
|
-
oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
|
|
8718
|
-
const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
|
|
8719
|
-
pseudoGroupTestIds.forEach(pseudoGroupTestId => {
|
|
8720
|
-
if (!pseudoGroupTest[pseudoGroupTestId]) {
|
|
8721
|
-
pseudoGroupTest[pseudoGroupTestId] = [];
|
|
8722
|
-
}
|
|
8723
|
-
pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
|
|
8724
|
-
});
|
|
8725
|
-
});
|
|
8726
|
-
sourceWithGroups.push(...innerGroupedValues);
|
|
8727
|
-
}
|
|
8728
|
-
else {
|
|
8729
|
-
flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
|
|
8730
|
-
}
|
|
8731
|
-
});
|
|
8653
|
+
function getCellData(val) {
|
|
8654
|
+
if (typeof val === 'undefined' || val === null) {
|
|
8655
|
+
return '';
|
|
8732
8656
|
}
|
|
8733
|
-
|
|
8734
|
-
return {
|
|
8735
|
-
sourceWithGroups, // updates source mirror
|
|
8736
|
-
depth: groupingDepth, // largest depth for grouping
|
|
8737
|
-
trimmed, // used for expand/collapse grouping values
|
|
8738
|
-
oldNewIndexMap, // used for mapping old values to new
|
|
8739
|
-
childrenByGroup: pseudoGroupTest, // used to get child items in group
|
|
8740
|
-
};
|
|
8741
|
-
}
|
|
8742
|
-
function getGroupingName(rgRow) {
|
|
8743
|
-
return rgRow && rgRow[PSEUDO_GROUP_ITEM];
|
|
8744
|
-
}
|
|
8745
|
-
function isGrouping(rgRow) {
|
|
8746
|
-
return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
|
|
8657
|
+
return val;
|
|
8747
8658
|
}
|
|
8748
|
-
function
|
|
8749
|
-
|
|
8659
|
+
function getCellDataParsed(model, column) {
|
|
8660
|
+
const val = column.cellParser ? column.cellParser(model, column) : model[column.prop];
|
|
8661
|
+
return getCellData(val);
|
|
8750
8662
|
}
|
|
8751
|
-
function
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
for (; i < ln; i++) {
|
|
8755
|
-
if (groupA[i] !== groupB[i]) {
|
|
8756
|
-
return i;
|
|
8757
|
-
}
|
|
8663
|
+
function getColumnType(rgCol) {
|
|
8664
|
+
if (rgCol.pin) {
|
|
8665
|
+
return rgCol.pin;
|
|
8758
8666
|
}
|
|
8759
|
-
return
|
|
8667
|
+
return 'rgCol';
|
|
8760
8668
|
}
|
|
8761
|
-
function
|
|
8762
|
-
const
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
|
|
8669
|
+
function getColumnSizes(cols) {
|
|
8670
|
+
const res = {};
|
|
8671
|
+
for (const [i, c] of cols.entries()) {
|
|
8672
|
+
if (c.size) {
|
|
8673
|
+
res[i] = c.size;
|
|
8674
|
+
}
|
|
8766
8675
|
}
|
|
8767
|
-
return
|
|
8676
|
+
return res;
|
|
8768
8677
|
}
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8774
|
-
}
|
|
8775
|
-
const depth = measureEqualDepth(currentGroup, nextGroup);
|
|
8776
|
-
return currentModel[GROUP_DEPTH] < depth;
|
|
8678
|
+
/**
|
|
8679
|
+
* Check if column is grouping column
|
|
8680
|
+
*/
|
|
8681
|
+
function isColGrouping(colData) {
|
|
8682
|
+
return !!colData.children;
|
|
8777
8683
|
}
|
|
8778
|
-
|
|
8779
8684
|
/**
|
|
8780
|
-
*
|
|
8781
|
-
*
|
|
8782
|
-
* @private
|
|
8783
|
-
* @param {Array} array The array to slice.
|
|
8784
|
-
* @param {number} [start=0] The start position.
|
|
8785
|
-
* @param {number} [end=array.length] The end position.
|
|
8786
|
-
* @returns {Array} Returns the slice of `array`.
|
|
8685
|
+
* This function is used to create a collection of columns.
|
|
8787
8686
|
*/
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
}
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
isIterateeCall$1 = _isIterateeCall,
|
|
8814
|
-
toInteger$2 = toInteger_1;
|
|
8815
|
-
|
|
8816
|
-
/**
|
|
8817
|
-
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
8818
|
-
*
|
|
8819
|
-
* **Note:** This method is used instead of
|
|
8820
|
-
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
8821
|
-
* returned.
|
|
8822
|
-
*
|
|
8823
|
-
* @static
|
|
8824
|
-
* @memberOf _
|
|
8825
|
-
* @since 3.0.0
|
|
8826
|
-
* @category Array
|
|
8827
|
-
* @param {Array} array The array to slice.
|
|
8828
|
-
* @param {number} [start=0] The start position.
|
|
8829
|
-
* @param {number} [end=array.length] The end position.
|
|
8830
|
-
* @returns {Array} Returns the slice of `array`.
|
|
8831
|
-
*/
|
|
8832
|
-
function slice(array, start, end) {
|
|
8833
|
-
var length = array == null ? 0 : array.length;
|
|
8834
|
-
if (!length) {
|
|
8835
|
-
return [];
|
|
8836
|
-
}
|
|
8837
|
-
if (end && typeof end != 'number' && isIterateeCall$1(array, start, end)) {
|
|
8838
|
-
start = 0;
|
|
8839
|
-
end = length;
|
|
8840
|
-
}
|
|
8841
|
-
else {
|
|
8842
|
-
start = start == null ? 0 : toInteger$2(start);
|
|
8843
|
-
end = end === undefined ? length : toInteger$2(end);
|
|
8844
|
-
}
|
|
8845
|
-
return baseSlice(array, start, end);
|
|
8846
|
-
}
|
|
8847
|
-
|
|
8848
|
-
var slice_1 = slice;
|
|
8849
|
-
|
|
8850
|
-
class ColumnService {
|
|
8851
|
-
get columns() {
|
|
8852
|
-
return getVisibleSourceItem(this.source);
|
|
8853
|
-
}
|
|
8854
|
-
constructor(dataStore, source) {
|
|
8855
|
-
this.dataStore = dataStore;
|
|
8856
|
-
this.source = source;
|
|
8857
|
-
this.unsubscribe = [];
|
|
8858
|
-
this.hasGrouping = false;
|
|
8859
|
-
this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
|
|
8860
|
-
this.checkGrouping(source.get('source'));
|
|
8861
|
-
this.type = source.get('type');
|
|
8862
|
-
}
|
|
8863
|
-
checkGrouping(cols) {
|
|
8864
|
-
for (let rgCol of cols) {
|
|
8865
|
-
if (isGroupingColumn(rgCol)) {
|
|
8866
|
-
this.hasGrouping = true;
|
|
8867
|
-
return;
|
|
8868
|
-
}
|
|
8869
|
-
this.hasGrouping = false;
|
|
8870
|
-
}
|
|
8871
|
-
}
|
|
8872
|
-
isReadOnly(r, c) {
|
|
8873
|
-
var _a;
|
|
8874
|
-
const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
|
|
8875
|
-
if (typeof readOnly === 'function') {
|
|
8876
|
-
const data = this.rowDataModel(r, c);
|
|
8877
|
-
return readOnly(data);
|
|
8878
|
-
}
|
|
8879
|
-
return !!readOnly;
|
|
8880
|
-
}
|
|
8881
|
-
mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
|
|
8882
|
-
const cellClass = {
|
|
8883
|
-
[CELL_CLASS]: true,
|
|
8884
|
-
[DISABLED_CLASS]: this.isReadOnly(r, c),
|
|
8885
|
-
};
|
|
8886
|
-
let props = Object.assign(Object.assign({}, defaultProps), { class: cellClass });
|
|
8887
|
-
const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
|
|
8888
|
-
if (!extra) {
|
|
8889
|
-
return props;
|
|
8687
|
+
function getColumns(columns, level = 0, types) {
|
|
8688
|
+
const collection = {
|
|
8689
|
+
// columns as they are in stores per type
|
|
8690
|
+
columns: {
|
|
8691
|
+
rgCol: [],
|
|
8692
|
+
colPinStart: [],
|
|
8693
|
+
colPinEnd: [],
|
|
8694
|
+
},
|
|
8695
|
+
// columns indexed by prop for quick access
|
|
8696
|
+
columnByProp: {},
|
|
8697
|
+
// column grouping
|
|
8698
|
+
columnGrouping: {
|
|
8699
|
+
rgCol: [],
|
|
8700
|
+
colPinStart: [],
|
|
8701
|
+
colPinEnd: [],
|
|
8702
|
+
},
|
|
8703
|
+
// max depth level for column grouping
|
|
8704
|
+
maxLevel: level,
|
|
8705
|
+
// sorting
|
|
8706
|
+
sort: {},
|
|
8707
|
+
};
|
|
8708
|
+
return reduce_1(columns, (res, colData) => {
|
|
8709
|
+
// Grouped column
|
|
8710
|
+
if (isColGrouping(colData)) {
|
|
8711
|
+
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
8890
8712
|
}
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
getCellData(r, c) {
|
|
8898
|
-
const data = this.rowDataModel(r, c);
|
|
8899
|
-
return getCellData(data.model[data.prop]);
|
|
8900
|
-
}
|
|
8901
|
-
getSaveData(rowIndex, colIndex, val) {
|
|
8902
|
-
if (typeof val === 'undefined') {
|
|
8903
|
-
val = this.getCellData(rowIndex, colIndex);
|
|
8713
|
+
// Regular column
|
|
8714
|
+
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
8715
|
+
// Regular column, no Pin
|
|
8716
|
+
if (!regularColumn.pin) {
|
|
8717
|
+
res.columns.rgCol.push(regularColumn);
|
|
8718
|
+
// Pin
|
|
8904
8719
|
}
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
prop: data.prop,
|
|
8908
|
-
rowIndex,
|
|
8909
|
-
colIndex,
|
|
8910
|
-
val,
|
|
8911
|
-
model: data.model,
|
|
8912
|
-
colType: this.type,
|
|
8913
|
-
type: this.dataStore.get('type'),
|
|
8914
|
-
};
|
|
8915
|
-
}
|
|
8916
|
-
getCellEditor(_r, c, editors) {
|
|
8917
|
-
var _a;
|
|
8918
|
-
const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
|
|
8919
|
-
if (!editor) {
|
|
8920
|
-
return undefined;
|
|
8720
|
+
else {
|
|
8721
|
+
res.columns[regularColumn.pin].push(regularColumn);
|
|
8921
8722
|
}
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
return editors[editor];
|
|
8723
|
+
if (regularColumn.order) {
|
|
8724
|
+
res.sort[regularColumn.prop] = regularColumn;
|
|
8925
8725
|
}
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
* Get cell data model for given rowIndex and colIndex
|
|
8930
|
-
* Used to pass data to editor/renderer
|
|
8931
|
-
*/
|
|
8932
|
-
rowDataModel(rowIndex, colIndex) {
|
|
8933
|
-
const column = this.columns[colIndex];
|
|
8934
|
-
const prop = column === null || column === void 0 ? void 0 : column.prop;
|
|
8935
|
-
const model = getSourceItem(this.dataStore, rowIndex) || {};
|
|
8936
|
-
const value = model[prop];
|
|
8937
|
-
const type = this.dataStore.get('type');
|
|
8938
|
-
return {
|
|
8939
|
-
prop,
|
|
8940
|
-
model,
|
|
8941
|
-
data: this.dataStore.get('source'),
|
|
8942
|
-
column,
|
|
8943
|
-
rowIndex,
|
|
8944
|
-
colIndex,
|
|
8945
|
-
colType: this.type,
|
|
8946
|
-
type,
|
|
8947
|
-
value,
|
|
8948
|
-
};
|
|
8949
|
-
}
|
|
8950
|
-
getRangeData(d, columns) {
|
|
8951
|
-
var _a;
|
|
8952
|
-
const changed = {};
|
|
8953
|
-
// get original length sizes
|
|
8954
|
-
const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
|
|
8955
|
-
const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
|
|
8956
|
-
const mapping = {};
|
|
8957
|
-
// rows
|
|
8958
|
-
for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
|
|
8959
|
-
// copy original data link
|
|
8960
|
-
const oldRowIndex = d.oldRange.y + (i % copyRowLength);
|
|
8961
|
-
const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
|
|
8962
|
-
// columns
|
|
8963
|
-
for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
|
|
8964
|
-
// check if old range area
|
|
8965
|
-
if (rowIndex >= d.oldRange.y &&
|
|
8966
|
-
rowIndex <= d.oldRange.y1 &&
|
|
8967
|
-
colIndex >= d.oldRange.x &&
|
|
8968
|
-
colIndex <= d.oldRange.x1) {
|
|
8969
|
-
continue;
|
|
8970
|
-
}
|
|
8971
|
-
// requested column beyond range
|
|
8972
|
-
if (!this.columns[colIndex]) {
|
|
8973
|
-
continue;
|
|
8974
|
-
}
|
|
8975
|
-
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
8976
|
-
const copyColIndex = d.oldRange.x + (j % copyColLength);
|
|
8977
|
-
const copyColumnProp = columns[copyColIndex].prop;
|
|
8978
|
-
/** if can write */
|
|
8979
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
8980
|
-
/** to show before save */
|
|
8981
|
-
if (!changed[rowIndex]) {
|
|
8982
|
-
changed[rowIndex] = {};
|
|
8983
|
-
}
|
|
8984
|
-
changed[rowIndex][prop] = copyRow[copyColumnProp];
|
|
8985
|
-
/** Generate mapping object */
|
|
8986
|
-
if (!mapping[rowIndex]) {
|
|
8987
|
-
mapping[rowIndex] = {};
|
|
8988
|
-
}
|
|
8989
|
-
mapping[rowIndex][prop] = {
|
|
8990
|
-
colIndex: copyColIndex,
|
|
8991
|
-
colProp: copyColumnProp,
|
|
8992
|
-
rowIndex: oldRowIndex,
|
|
8993
|
-
};
|
|
8994
|
-
}
|
|
8995
|
-
}
|
|
8726
|
+
// it's possible that some columns have same prop, but better to avoid it
|
|
8727
|
+
if (!res.columnByProp[regularColumn.prop]) {
|
|
8728
|
+
res.columnByProp[regularColumn.prop] = [];
|
|
8996
8729
|
}
|
|
8997
|
-
|
|
8998
|
-
|
|
8999
|
-
|
|
9000
|
-
|
|
9001
|
-
}
|
|
9002
|
-
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
9006
|
-
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
const currentCol = j % colLength;
|
|
9019
|
-
/** if can write */
|
|
9020
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9021
|
-
/** to show before save */
|
|
9022
|
-
if (!changed[rowIndex]) {
|
|
9023
|
-
changed[rowIndex] = {};
|
|
9024
|
-
}
|
|
9025
|
-
changed[rowIndex][p] = copyRow[currentCol];
|
|
9026
|
-
}
|
|
8730
|
+
res.columnByProp[regularColumn.prop].push(regularColumn);
|
|
8731
|
+
// trigger setup hook if present
|
|
8732
|
+
regularColumn.beforeSetup && regularColumn.beforeSetup(regularColumn);
|
|
8733
|
+
return res;
|
|
8734
|
+
}, collection);
|
|
8735
|
+
}
|
|
8736
|
+
function gatherGroup(res, colData, collection, level = 0) {
|
|
8737
|
+
// group template
|
|
8738
|
+
const group = Object.assign(Object.assign({}, colData), { level, ids: [] });
|
|
8739
|
+
// check columns for update
|
|
8740
|
+
for (let k in collection.columns) {
|
|
8741
|
+
const key = k;
|
|
8742
|
+
const resultItem = res.columns[key];
|
|
8743
|
+
const collectionItem = collection.columns[key];
|
|
8744
|
+
// if column data
|
|
8745
|
+
if (isArray_1(resultItem) && isArray_1(collectionItem)) {
|
|
8746
|
+
// fill columns
|
|
8747
|
+
resultItem.push(...collectionItem);
|
|
8748
|
+
// fill grouping
|
|
8749
|
+
if (collectionItem.length) {
|
|
8750
|
+
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
9027
8751
|
}
|
|
9028
|
-
maxCol = Math.max(maxCol, colIndex - 1);
|
|
9029
8752
|
}
|
|
9030
|
-
const range = getRange(start, {
|
|
9031
|
-
y: rowIndex - 1,
|
|
9032
|
-
x: maxCol,
|
|
9033
|
-
});
|
|
9034
|
-
return {
|
|
9035
|
-
changed,
|
|
9036
|
-
range,
|
|
9037
|
-
};
|
|
9038
8753
|
}
|
|
9039
|
-
|
|
9040
|
-
|
|
9041
|
-
|
|
9042
|
-
|
|
9043
|
-
|
|
9044
|
-
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
9045
|
-
// requested column beyond range
|
|
9046
|
-
if (!this.columns[colIndex]) {
|
|
9047
|
-
continue;
|
|
9048
|
-
}
|
|
9049
|
-
const p = this.columns[colIndex].prop;
|
|
9050
|
-
/** if can write */
|
|
9051
|
-
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9052
|
-
/** to show before save */
|
|
9053
|
-
if (!changed[rowIndex]) {
|
|
9054
|
-
changed[rowIndex] = {};
|
|
9055
|
-
}
|
|
9056
|
-
changed[rowIndex][p] = value;
|
|
9057
|
-
}
|
|
9058
|
-
}
|
|
9059
|
-
}
|
|
9060
|
-
return changed;
|
|
8754
|
+
// merge column groupings
|
|
8755
|
+
for (let k in collection.columnGrouping) {
|
|
8756
|
+
const key = k;
|
|
8757
|
+
const collectionItem = collection.columnGrouping[key];
|
|
8758
|
+
res.columnGrouping[key].push(...collectionItem);
|
|
9061
8759
|
}
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
prop,
|
|
9073
|
-
rowIndex,
|
|
9074
|
-
colIndex,
|
|
9075
|
-
model: getSourceItem(store, rowIndex),
|
|
9076
|
-
type,
|
|
9077
|
-
colType: this.type,
|
|
9078
|
-
});
|
|
8760
|
+
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
8761
|
+
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
8762
|
+
return res;
|
|
8763
|
+
}
|
|
8764
|
+
function findColumn(columns, prop) {
|
|
8765
|
+
for (const c of columns) {
|
|
8766
|
+
if (isColGrouping(c)) {
|
|
8767
|
+
const found = findColumn(c.children, prop);
|
|
8768
|
+
if (found) {
|
|
8769
|
+
return found;
|
|
9079
8770
|
}
|
|
9080
8771
|
}
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
copyRangeArray(range, store) {
|
|
9084
|
-
const cols = [...this.columns];
|
|
9085
|
-
const props = slice_1(cols, range.x, range.x1 + 1).map(v => v.prop);
|
|
9086
|
-
const toCopy = [];
|
|
9087
|
-
const mapping = {};
|
|
9088
|
-
// rows indexes
|
|
9089
|
-
for (let i = range.y; i <= range.y1; i++) {
|
|
9090
|
-
const rgRow = [];
|
|
9091
|
-
mapping[i] = {};
|
|
9092
|
-
// columns indexes
|
|
9093
|
-
for (let prop of props) {
|
|
9094
|
-
const item = getSourceItem(store, i);
|
|
9095
|
-
// if no item - skip
|
|
9096
|
-
if (!item) {
|
|
9097
|
-
continue;
|
|
9098
|
-
}
|
|
9099
|
-
const val = item[prop];
|
|
9100
|
-
rgRow.push(val);
|
|
9101
|
-
mapping[i][prop] = val;
|
|
9102
|
-
}
|
|
9103
|
-
toCopy.push(rgRow);
|
|
8772
|
+
else if (c.prop === prop) {
|
|
8773
|
+
return c;
|
|
9104
8774
|
}
|
|
9105
|
-
return {
|
|
9106
|
-
data: toCopy,
|
|
9107
|
-
mapping,
|
|
9108
|
-
};
|
|
9109
8775
|
}
|
|
9110
|
-
|
|
9111
|
-
this.unsubscribe.forEach(f => f());
|
|
9112
|
-
}
|
|
9113
|
-
}
|
|
9114
|
-
function getCellData(val) {
|
|
9115
|
-
if (typeof val === 'undefined' || val === null) {
|
|
9116
|
-
return '';
|
|
9117
|
-
}
|
|
9118
|
-
return val;
|
|
9119
|
-
}
|
|
9120
|
-
/**
|
|
9121
|
-
* Checks if the given rowDrag is a service for dragging rows.
|
|
9122
|
-
*/
|
|
9123
|
-
function isRowDragService(rowDrag, model) {
|
|
9124
|
-
if (typeof rowDrag === 'function') {
|
|
9125
|
-
return rowDrag(model);
|
|
9126
|
-
}
|
|
9127
|
-
return !!rowDrag;
|
|
8776
|
+
return undefined;
|
|
9128
8777
|
}
|
|
9129
|
-
function
|
|
9130
|
-
|
|
9131
|
-
// extend existing props
|
|
9132
|
-
if (extra.class) {
|
|
9133
|
-
if (typeof extra.class === 'object' && typeof props.class === 'object') {
|
|
9134
|
-
props.class = Object.assign(Object.assign({}, extra.class), props.class);
|
|
9135
|
-
}
|
|
9136
|
-
else if (typeof extra.class === 'string' &&
|
|
9137
|
-
typeof props.class === 'object') {
|
|
9138
|
-
props.class[extra.class] = true;
|
|
9139
|
-
}
|
|
9140
|
-
else if (typeof props.class === 'string') {
|
|
9141
|
-
props.class += ' ' + extra.class;
|
|
9142
|
-
}
|
|
9143
|
-
}
|
|
9144
|
-
if (extra.style) {
|
|
9145
|
-
props.style = Object.assign(Object.assign({}, extra.style), props.style);
|
|
9146
|
-
}
|
|
9147
|
-
return props;
|
|
8778
|
+
function getColumnByProp(columns, prop) {
|
|
8779
|
+
return findColumn(columns, prop);
|
|
9148
8780
|
}
|
|
9149
8781
|
|
|
9150
8782
|
var codes;
|
|
@@ -9223,386 +8855,761 @@ var keyValues;
|
|
|
9223
8855
|
keyValues["TAB"] = "Tab";
|
|
9224
8856
|
})(keyValues || (keyValues = {}));
|
|
9225
8857
|
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
if (focusClass && touchEvent) {
|
|
9231
|
-
if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
|
|
9232
|
-
return false;
|
|
9233
|
-
}
|
|
9234
|
-
}
|
|
9235
|
-
return true;
|
|
9236
|
-
}
|
|
9237
|
-
/**
|
|
9238
|
-
* Function to get the value of a specific property from a MouseEvent or TouchEvent object.
|
|
9239
|
-
*/
|
|
9240
|
-
function getPropertyFromEvent(e, prop, focusClass // for touch events
|
|
9241
|
-
) {
|
|
9242
|
-
// Check if the event is a touch event
|
|
9243
|
-
if (isTouch(e)) {
|
|
9244
|
-
// If the event has touches, get the first touch
|
|
9245
|
-
if (e.touches.length > 0) {
|
|
9246
|
-
const touchEvent = e.touches[0];
|
|
9247
|
-
// Check if the target of the touch event is the specified element
|
|
9248
|
-
if (!verifyTouchTarget(touchEvent, focusClass)) {
|
|
9249
|
-
// If not, return null
|
|
9250
|
-
return null;
|
|
9251
|
-
}
|
|
9252
|
-
// Get the value of the specified property from the touch event and return it
|
|
9253
|
-
return touchEvent[prop] || 0;
|
|
9254
|
-
}
|
|
9255
|
-
// If there are no touches, return null
|
|
9256
|
-
return null;
|
|
9257
|
-
}
|
|
9258
|
-
// If the event is not a touch event, get the value of the specified property from the event and return it
|
|
9259
|
-
return e[prop] || 0;
|
|
9260
|
-
}
|
|
8858
|
+
var osPlatform;
|
|
8859
|
+
(function (osPlatform) {
|
|
8860
|
+
osPlatform["mac"] = "Mac";
|
|
8861
|
+
})(osPlatform || (osPlatform = {}));
|
|
9261
8862
|
|
|
9262
|
-
function
|
|
9263
|
-
|
|
9264
|
-
for (let i in data) {
|
|
9265
|
-
const rowIndex = parseInt(i, 10);
|
|
9266
|
-
models[rowIndex] = getSourceItem(store, rowIndex);
|
|
9267
|
-
}
|
|
9268
|
-
return models;
|
|
8863
|
+
function isClear(code) {
|
|
8864
|
+
return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;
|
|
9269
8865
|
}
|
|
9270
|
-
function
|
|
9271
|
-
|
|
9272
|
-
|
|
9273
|
-
|
|
9274
|
-
|
|
9275
|
-
|
|
9276
|
-
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
8866
|
+
function isTab(code) {
|
|
8867
|
+
return codesLetter.TAB === code;
|
|
8868
|
+
}
|
|
8869
|
+
function isEnterKeyValue(key) {
|
|
8870
|
+
return keyValues.ENTER === key;
|
|
8871
|
+
}
|
|
8872
|
+
function isCut(event) {
|
|
8873
|
+
return ((event.ctrlKey && event.code === 'KeyX') || // Ctrl + X on Windows
|
|
8874
|
+
(event.metaKey && event.code === 'KeyX')); // Cmd + X on Mac
|
|
8875
|
+
}
|
|
8876
|
+
function isCopy(event) {
|
|
8877
|
+
return ((event.ctrlKey && event.code === 'KeyC') || // Ctrl + C on Windows
|
|
8878
|
+
(event.metaKey && event.code === 'KeyC')); // Cmd + C on Mac
|
|
8879
|
+
}
|
|
8880
|
+
function isPaste(event) {
|
|
8881
|
+
return ((event.ctrlKey && event.code === 'KeyV') || // Ctrl + V on Windows
|
|
8882
|
+
(event.metaKey && event.code === 'KeyV')); // Cmd + V on Mac
|
|
8883
|
+
}
|
|
8884
|
+
function isAll(event) {
|
|
8885
|
+
return ((event.ctrlKey && event.code === 'KeyA') || // Ctrl + A on Windows
|
|
8886
|
+
(event.metaKey && event.code === 'KeyA')); // Cmd + A on Mac
|
|
9289
8887
|
}
|
|
8888
|
+
|
|
8889
|
+
const LETTER_BLOCK_SIZE$1 = 10;
|
|
8890
|
+
const calculateRowHeaderSize = (itemsLength, rowHeaderColumn, minWidth = 50) => {
|
|
8891
|
+
return ((rowHeaderColumn === null || rowHeaderColumn === void 0 ? void 0 : rowHeaderColumn.size) ||
|
|
8892
|
+
Math.max((itemsLength.toString().length + 1) * LETTER_BLOCK_SIZE$1, minWidth));
|
|
8893
|
+
};
|
|
8894
|
+
|
|
9290
8895
|
/**
|
|
9291
|
-
* Calculate
|
|
8896
|
+
* Calculate system scrollbar size
|
|
9292
8897
|
*/
|
|
9293
|
-
function
|
|
9294
|
-
//
|
|
9295
|
-
const
|
|
9296
|
-
//
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
//
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
//
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
if (rgCol.itemIndex < 0) {
|
|
9312
|
-
rgCol.itemIndex = 0;
|
|
9313
|
-
}
|
|
9314
|
-
if (rgRow.itemIndex < 0) {
|
|
9315
|
-
rgRow.itemIndex = 0;
|
|
9316
|
-
}
|
|
9317
|
-
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
8898
|
+
function getScrollbarSize(document) {
|
|
8899
|
+
// Create a temporary div container and append it to the body
|
|
8900
|
+
const container = document.createElement('div');
|
|
8901
|
+
// Apply styling to ensure the div is scrollable
|
|
8902
|
+
container.style.overflow = 'scroll';
|
|
8903
|
+
container.style.visibility = 'hidden'; // make sure the container isn't visible
|
|
8904
|
+
container.style.position = 'absolute';
|
|
8905
|
+
container.style.top = '-9999px'; // move it out of the screen
|
|
8906
|
+
container.style.width = '50px'; // arbitrary width
|
|
8907
|
+
container.style.height = '50px'; // arbitrary height
|
|
8908
|
+
// Append the div to the body
|
|
8909
|
+
document.body.appendChild(container);
|
|
8910
|
+
// Calculate the width of the scrollbar
|
|
8911
|
+
const scrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
8912
|
+
// Remove the div from the body after calculation
|
|
8913
|
+
document.body.removeChild(container);
|
|
8914
|
+
// Return the calculated width of the scrollbar
|
|
8915
|
+
return scrollbarWidth;
|
|
9318
8916
|
}
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
return null;
|
|
8917
|
+
/* Scale a value between 2 ranges
|
|
8918
|
+
*
|
|
8919
|
+
* Sample:
|
|
8920
|
+
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
8921
|
+
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
8922
|
+
*
|
|
8923
|
+
* Ranges of two values
|
|
8924
|
+
* @from
|
|
8925
|
+
* @to
|
|
8926
|
+
*
|
|
8927
|
+
* ~~ return value does the equivalent of Math.floor but faster.
|
|
8928
|
+
*/
|
|
8929
|
+
function scaleValue(value, from, to) {
|
|
8930
|
+
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
9334
8931
|
}
|
|
9335
8932
|
/**
|
|
9336
|
-
*
|
|
9337
|
-
* or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
|
|
8933
|
+
* Async timeout
|
|
9338
8934
|
*/
|
|
9339
|
-
function
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
function isBeforeFirst({ x, y }) {
|
|
9344
|
-
return x < 0 || y < 0;
|
|
8935
|
+
async function timeout(delay = 0) {
|
|
8936
|
+
await new Promise((r) => {
|
|
8937
|
+
setTimeout(() => r(), delay);
|
|
8938
|
+
});
|
|
9345
8939
|
}
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
// cell[k] = Math.abs(initial[k] - last[k]);
|
|
9361
|
-
// }
|
|
9362
|
-
// if (cell.x > cell.y) {
|
|
9363
|
-
// return { x: 1 };
|
|
9364
|
-
// }
|
|
9365
|
-
// if (cell.y > cell.x) {
|
|
9366
|
-
// return { y: 1 };
|
|
9367
|
-
// }
|
|
9368
|
-
// return null;
|
|
9369
|
-
// }
|
|
9370
|
-
function styleByCellProps(styles) {
|
|
9371
|
-
return {
|
|
9372
|
-
left: `${styles.left}px`,
|
|
9373
|
-
top: `${styles.top}px`,
|
|
9374
|
-
width: `${styles.width}px`,
|
|
9375
|
-
height: `${styles.height}px`,
|
|
9376
|
-
};
|
|
8940
|
+
|
|
8941
|
+
const GROUP_DEPTH = `${GRID_INTERNALS}-depth`;
|
|
8942
|
+
const PSEUDO_GROUP_ITEM = `${GRID_INTERNALS}-name`;
|
|
8943
|
+
const PSEUDO_GROUP_ITEM_ID = `${GRID_INTERNALS}-id`;
|
|
8944
|
+
const PSEUDO_GROUP_ITEM_VALUE = `${GRID_INTERNALS}-value`;
|
|
8945
|
+
const PSEUDO_GROUP_COLUMN = `${GRID_INTERNALS}-column`;
|
|
8946
|
+
const GROUP_EXPANDED = `${GRID_INTERNALS}-expanded`;
|
|
8947
|
+
const GROUP_ORIGINAL_INDEX = `${GRID_INTERNALS}-original-index`;
|
|
8948
|
+
const GROUP_EXPAND_BTN = `group-expand`;
|
|
8949
|
+
const GROUP_EXPAND_EVENT = `groupexpandclick`;
|
|
8950
|
+
const GROUPING_ROW_TYPE = 'rgRow';
|
|
8951
|
+
|
|
8952
|
+
function getGroupValueDefault(item, prop) {
|
|
8953
|
+
return item[prop] || null;
|
|
9377
8954
|
}
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
8955
|
+
/**
|
|
8956
|
+
* Gather data for grouping
|
|
8957
|
+
* @param array - flat data array
|
|
8958
|
+
* @param groupIds - ids of groups
|
|
8959
|
+
* @param expanded - potentially expanded items if present
|
|
8960
|
+
*/
|
|
8961
|
+
function gatherGrouping(array, groupIds, { prevExpanded, expandedAll, getGroupValue = getGroupValueDefault, }) {
|
|
8962
|
+
const groupedItems = new Map();
|
|
8963
|
+
array.forEach((item, originalIndex) => {
|
|
8964
|
+
const groupLevelValues = groupIds.map(groupId => getGroupValue(item, groupId));
|
|
8965
|
+
const lastLevelValue = groupLevelValues.pop();
|
|
8966
|
+
let currentGroupLevel = groupedItems;
|
|
8967
|
+
groupLevelValues.forEach(value => {
|
|
8968
|
+
if (!currentGroupLevel.has(value)) {
|
|
8969
|
+
currentGroupLevel.set(value, new Map());
|
|
8970
|
+
}
|
|
8971
|
+
currentGroupLevel = currentGroupLevel.get(value);
|
|
8972
|
+
});
|
|
8973
|
+
if (!currentGroupLevel.has(lastLevelValue)) {
|
|
8974
|
+
currentGroupLevel.set(lastLevelValue, []);
|
|
8975
|
+
}
|
|
8976
|
+
const lastLevelItems = currentGroupLevel.get(lastLevelValue);
|
|
8977
|
+
lastLevelItems.push(Object.assign(Object.assign({}, item), { [GROUP_ORIGINAL_INDEX]: originalIndex }));
|
|
8978
|
+
});
|
|
8979
|
+
let itemIndex = -1;
|
|
8980
|
+
const groupingDepth = groupIds.length;
|
|
8981
|
+
// collapse all groups in the beginning
|
|
8982
|
+
const trimmed = {};
|
|
8983
|
+
// index mapping
|
|
8984
|
+
const oldNewIndexMap = {};
|
|
8985
|
+
// check if group header exists
|
|
8986
|
+
const pseudoGroupTest = {};
|
|
8987
|
+
const sourceWithGroups = [];
|
|
8988
|
+
function flattenGroupMaps(groupedValues, parentIds, isExpanded) {
|
|
8989
|
+
const depth = parentIds.length;
|
|
8990
|
+
groupedValues.forEach((innerGroupedValues, groupId) => {
|
|
8991
|
+
const levelIds = [...parentIds, groupId];
|
|
8992
|
+
const mergedIds = levelIds.join(',');
|
|
8993
|
+
const isGroupExpanded = isExpanded && (!!expandedAll || !!(prevExpanded === null || prevExpanded === void 0 ? void 0 : prevExpanded[mergedIds]));
|
|
8994
|
+
sourceWithGroups.push({
|
|
8995
|
+
[PSEUDO_GROUP_ITEM]: groupId,
|
|
8996
|
+
[GROUP_DEPTH]: depth,
|
|
8997
|
+
[PSEUDO_GROUP_ITEM_ID]: JSON.stringify(levelIds),
|
|
8998
|
+
[PSEUDO_GROUP_ITEM_VALUE]: mergedIds,
|
|
8999
|
+
[GROUP_EXPANDED]: isGroupExpanded,
|
|
9000
|
+
});
|
|
9001
|
+
itemIndex += 1;
|
|
9002
|
+
if (!isGroupExpanded && depth) {
|
|
9003
|
+
trimmed[itemIndex] = true;
|
|
9004
|
+
}
|
|
9005
|
+
if (Array.isArray(innerGroupedValues)) {
|
|
9006
|
+
innerGroupedValues.forEach(value => {
|
|
9007
|
+
itemIndex += 1;
|
|
9008
|
+
if (!isGroupExpanded) {
|
|
9009
|
+
trimmed[itemIndex] = true;
|
|
9010
|
+
}
|
|
9011
|
+
oldNewIndexMap[value[GROUP_ORIGINAL_INDEX]] = itemIndex;
|
|
9012
|
+
const pseudoGroupTestIds = levelIds.map((_value, index) => levelIds.slice(0, index + 1).join(','));
|
|
9013
|
+
pseudoGroupTestIds.forEach(pseudoGroupTestId => {
|
|
9014
|
+
if (!pseudoGroupTest[pseudoGroupTestId]) {
|
|
9015
|
+
pseudoGroupTest[pseudoGroupTestId] = [];
|
|
9016
|
+
}
|
|
9017
|
+
pseudoGroupTest[pseudoGroupTestId].push(itemIndex);
|
|
9018
|
+
});
|
|
9019
|
+
});
|
|
9020
|
+
sourceWithGroups.push(...innerGroupedValues);
|
|
9021
|
+
}
|
|
9022
|
+
else {
|
|
9023
|
+
flattenGroupMaps(innerGroupedValues, levelIds, isGroupExpanded);
|
|
9024
|
+
}
|
|
9025
|
+
});
|
|
9026
|
+
}
|
|
9027
|
+
flattenGroupMaps(groupedItems, [], true);
|
|
9383
9028
|
return {
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
};
|
|
9391
|
-
}
|
|
9392
|
-
function getElStyle(range, dimensionRow, dimensionCol) {
|
|
9393
|
-
const styles = getCell(range, dimensionRow, dimensionCol);
|
|
9394
|
-
return styleByCellProps(styles);
|
|
9395
|
-
}
|
|
9396
|
-
|
|
9397
|
-
// is edit input
|
|
9398
|
-
function isEditInput(el) {
|
|
9399
|
-
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
9029
|
+
sourceWithGroups, // updates source mirror
|
|
9030
|
+
depth: groupingDepth, // largest depth for grouping
|
|
9031
|
+
trimmed, // used for expand/collapse grouping values
|
|
9032
|
+
oldNewIndexMap, // used for mapping old values to new
|
|
9033
|
+
childrenByGroup: pseudoGroupTest, // used to get child items in group
|
|
9034
|
+
};
|
|
9400
9035
|
}
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
return typeof editor === 'function' && typeof editor.prototype === 'object';
|
|
9036
|
+
function getGroupingName(rgRow) {
|
|
9037
|
+
return rgRow && rgRow[PSEUDO_GROUP_ITEM];
|
|
9404
9038
|
}
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
(function (osPlatform) {
|
|
9408
|
-
osPlatform["mac"] = "Mac";
|
|
9409
|
-
})(osPlatform || (osPlatform = {}));
|
|
9410
|
-
|
|
9411
|
-
function isClear(code) {
|
|
9412
|
-
return codesLetter.BACKSPACE === code || codesLetter.DELETE === code;
|
|
9039
|
+
function isGrouping(rgRow) {
|
|
9040
|
+
return typeof (rgRow === null || rgRow === void 0 ? void 0 : rgRow[PSEUDO_GROUP_ITEM]) !== 'undefined';
|
|
9413
9041
|
}
|
|
9414
|
-
function
|
|
9415
|
-
return
|
|
9042
|
+
function isGroupingColumn(column) {
|
|
9043
|
+
return column && typeof column[PSEUDO_GROUP_COLUMN] !== 'undefined';
|
|
9416
9044
|
}
|
|
9417
|
-
function
|
|
9418
|
-
|
|
9045
|
+
function measureEqualDepth(groupA, groupB) {
|
|
9046
|
+
const ln = groupA.length;
|
|
9047
|
+
let i = 0;
|
|
9048
|
+
for (; i < ln; i++) {
|
|
9049
|
+
if (groupA[i] !== groupB[i]) {
|
|
9050
|
+
return i;
|
|
9051
|
+
}
|
|
9052
|
+
}
|
|
9053
|
+
return i;
|
|
9419
9054
|
}
|
|
9420
|
-
function
|
|
9421
|
-
|
|
9422
|
-
|
|
9055
|
+
function getParsedGroup(id) {
|
|
9056
|
+
const parseGroup = JSON.parse(id);
|
|
9057
|
+
// extra precaution and type safeguard
|
|
9058
|
+
if (!Array.isArray(parseGroup)) {
|
|
9059
|
+
return null;
|
|
9060
|
+
}
|
|
9061
|
+
return parseGroup;
|
|
9423
9062
|
}
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9063
|
+
// check if items is child of current clicked group
|
|
9064
|
+
function isSameGroup(currentGroup, currentModel, nextModel) {
|
|
9065
|
+
const nextGroup = getParsedGroup(nextModel[PSEUDO_GROUP_ITEM_ID]);
|
|
9066
|
+
if (!nextGroup) {
|
|
9067
|
+
return false;
|
|
9068
|
+
}
|
|
9069
|
+
const depth = measureEqualDepth(currentGroup, nextGroup);
|
|
9070
|
+
return currentModel[GROUP_DEPTH] < depth;
|
|
9427
9071
|
}
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9072
|
+
|
|
9073
|
+
/**
|
|
9074
|
+
* The base implementation of `_.slice` without an iteratee call guard.
|
|
9075
|
+
*
|
|
9076
|
+
* @private
|
|
9077
|
+
* @param {Array} array The array to slice.
|
|
9078
|
+
* @param {number} [start=0] The start position.
|
|
9079
|
+
* @param {number} [end=array.length] The end position.
|
|
9080
|
+
* @returns {Array} Returns the slice of `array`.
|
|
9081
|
+
*/
|
|
9082
|
+
|
|
9083
|
+
function baseSlice$1(array, start, end) {
|
|
9084
|
+
var index = -1,
|
|
9085
|
+
length = array.length;
|
|
9086
|
+
|
|
9087
|
+
if (start < 0) {
|
|
9088
|
+
start = -start > length ? 0 : (length + start);
|
|
9089
|
+
}
|
|
9090
|
+
end = end > length ? length : end;
|
|
9091
|
+
if (end < 0) {
|
|
9092
|
+
end += length;
|
|
9093
|
+
}
|
|
9094
|
+
length = start > end ? 0 : ((end - start) >>> 0);
|
|
9095
|
+
start >>>= 0;
|
|
9096
|
+
|
|
9097
|
+
var result = Array(length);
|
|
9098
|
+
while (++index < length) {
|
|
9099
|
+
result[index] = array[index + start];
|
|
9100
|
+
}
|
|
9101
|
+
return result;
|
|
9431
9102
|
}
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9103
|
+
|
|
9104
|
+
var _baseSlice = baseSlice$1;
|
|
9105
|
+
|
|
9106
|
+
var baseSlice = _baseSlice,
|
|
9107
|
+
isIterateeCall$1 = _isIterateeCall,
|
|
9108
|
+
toInteger$2 = toInteger_1;
|
|
9109
|
+
|
|
9110
|
+
/**
|
|
9111
|
+
* Creates a slice of `array` from `start` up to, but not including, `end`.
|
|
9112
|
+
*
|
|
9113
|
+
* **Note:** This method is used instead of
|
|
9114
|
+
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
|
|
9115
|
+
* returned.
|
|
9116
|
+
*
|
|
9117
|
+
* @static
|
|
9118
|
+
* @memberOf _
|
|
9119
|
+
* @since 3.0.0
|
|
9120
|
+
* @category Array
|
|
9121
|
+
* @param {Array} array The array to slice.
|
|
9122
|
+
* @param {number} [start=0] The start position.
|
|
9123
|
+
* @param {number} [end=array.length] The end position.
|
|
9124
|
+
* @returns {Array} Returns the slice of `array`.
|
|
9125
|
+
*/
|
|
9126
|
+
function slice(array, start, end) {
|
|
9127
|
+
var length = array == null ? 0 : array.length;
|
|
9128
|
+
if (!length) {
|
|
9129
|
+
return [];
|
|
9130
|
+
}
|
|
9131
|
+
if (end && typeof end != 'number' && isIterateeCall$1(array, start, end)) {
|
|
9132
|
+
start = 0;
|
|
9133
|
+
end = length;
|
|
9134
|
+
}
|
|
9135
|
+
else {
|
|
9136
|
+
start = start == null ? 0 : toInteger$2(start);
|
|
9137
|
+
end = end === undefined ? length : toInteger$2(end);
|
|
9138
|
+
}
|
|
9139
|
+
return baseSlice(array, start, end);
|
|
9435
9140
|
}
|
|
9436
9141
|
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9142
|
+
var slice_1 = slice;
|
|
9143
|
+
|
|
9144
|
+
class ColumnService {
|
|
9145
|
+
get columns() {
|
|
9146
|
+
return getVisibleSourceItem(this.source);
|
|
9147
|
+
}
|
|
9148
|
+
constructor(dataStore, source) {
|
|
9149
|
+
this.dataStore = dataStore;
|
|
9150
|
+
this.source = source;
|
|
9151
|
+
this.unsubscribe = [];
|
|
9152
|
+
this.hasGrouping = false;
|
|
9153
|
+
this.unsubscribe.push(source.onChange('source', s => this.checkGrouping(s)));
|
|
9154
|
+
this.checkGrouping(source.get('source'));
|
|
9155
|
+
this.type = source.get('type');
|
|
9156
|
+
}
|
|
9157
|
+
checkGrouping(cols) {
|
|
9158
|
+
for (let rgCol of cols) {
|
|
9159
|
+
if (isGroupingColumn(rgCol)) {
|
|
9160
|
+
this.hasGrouping = true;
|
|
9161
|
+
return;
|
|
9162
|
+
}
|
|
9163
|
+
this.hasGrouping = false;
|
|
9164
|
+
}
|
|
9165
|
+
}
|
|
9166
|
+
isReadOnly(r, c) {
|
|
9167
|
+
var _a;
|
|
9168
|
+
const readOnly = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.readonly;
|
|
9169
|
+
if (typeof readOnly === 'function') {
|
|
9170
|
+
const data = this.rowDataModel(r, c);
|
|
9171
|
+
return readOnly(data);
|
|
9172
|
+
}
|
|
9173
|
+
return !!readOnly;
|
|
9174
|
+
}
|
|
9175
|
+
mergeProperties(r, c, defaultProps, model, extraPropsFunc) {
|
|
9176
|
+
const props = Object.assign({}, defaultProps);
|
|
9177
|
+
props.class = Object.assign(Object.assign({}, (typeof props.class === 'string' ? { [props.class]: true } : props.class)), { [CELL_CLASS]: true, [DISABLED_CLASS]: this.isReadOnly(r, c) });
|
|
9178
|
+
const extra = extraPropsFunc === null || extraPropsFunc === void 0 ? void 0 : extraPropsFunc(model);
|
|
9179
|
+
if (!extra) {
|
|
9180
|
+
return props;
|
|
9181
|
+
}
|
|
9182
|
+
return doPropMerge(props, extra);
|
|
9183
|
+
}
|
|
9184
|
+
getRowClass(r, prop) {
|
|
9185
|
+
const model = getSourceItem(this.dataStore, r) || {};
|
|
9186
|
+
return model[prop] || '';
|
|
9187
|
+
}
|
|
9188
|
+
getCellData(r, c) {
|
|
9189
|
+
const data = this.rowDataModel(r, c);
|
|
9190
|
+
return getCellData(data.model[data.prop]);
|
|
9191
|
+
}
|
|
9192
|
+
getSaveData(rowIndex, colIndex, val) {
|
|
9193
|
+
const data = this.rowDataModel(rowIndex, colIndex);
|
|
9194
|
+
if (typeof val === 'undefined') {
|
|
9195
|
+
val = getCellData(data.model[data.prop]);
|
|
9196
|
+
}
|
|
9197
|
+
return {
|
|
9198
|
+
prop: data.prop,
|
|
9199
|
+
rowIndex,
|
|
9200
|
+
colIndex,
|
|
9201
|
+
val,
|
|
9202
|
+
model: data.model,
|
|
9203
|
+
colType: this.type,
|
|
9204
|
+
type: this.dataStore.get('type'),
|
|
9205
|
+
};
|
|
9206
|
+
}
|
|
9207
|
+
getCellEditor(_r, c, editors) {
|
|
9208
|
+
var _a;
|
|
9209
|
+
const editor = (_a = this.columns[c]) === null || _a === void 0 ? void 0 : _a.editor;
|
|
9210
|
+
if (!editor) {
|
|
9211
|
+
return undefined;
|
|
9212
|
+
}
|
|
9213
|
+
// reference
|
|
9214
|
+
if (typeof editor === 'string') {
|
|
9215
|
+
return editors[editor];
|
|
9216
|
+
}
|
|
9217
|
+
return editor;
|
|
9218
|
+
}
|
|
9219
|
+
/**
|
|
9220
|
+
* Get cell data model for given rowIndex and colIndex
|
|
9221
|
+
* Used to pass data to editor/renderer
|
|
9222
|
+
*/
|
|
9223
|
+
rowDataModel(rowIndex, colIndex) {
|
|
9224
|
+
const column = this.columns[colIndex];
|
|
9225
|
+
const prop = column === null || column === void 0 ? void 0 : column.prop;
|
|
9226
|
+
const model = getSourceItem(this.dataStore, rowIndex) || {};
|
|
9227
|
+
const value = model[prop];
|
|
9228
|
+
const type = this.dataStore.get('type');
|
|
9229
|
+
return {
|
|
9230
|
+
prop,
|
|
9231
|
+
model,
|
|
9232
|
+
data: this.dataStore.get('source'),
|
|
9233
|
+
column,
|
|
9234
|
+
rowIndex,
|
|
9235
|
+
colIndex,
|
|
9236
|
+
colType: this.type,
|
|
9237
|
+
type,
|
|
9238
|
+
value,
|
|
9239
|
+
};
|
|
9240
|
+
}
|
|
9241
|
+
getRangeData(d, columns) {
|
|
9242
|
+
var _a;
|
|
9243
|
+
const changed = {};
|
|
9244
|
+
// get original length sizes
|
|
9245
|
+
const copyColLength = d.oldRange.x1 - d.oldRange.x + 1;
|
|
9246
|
+
const copyRowLength = d.oldRange.y1 - d.oldRange.y + 1;
|
|
9247
|
+
const mapping = {};
|
|
9248
|
+
// rows
|
|
9249
|
+
for (let rowIndex = d.newRange.y, i = 0; rowIndex < d.newRange.y1 + 1; rowIndex++, i++) {
|
|
9250
|
+
// copy original data link
|
|
9251
|
+
const oldRowIndex = d.oldRange.y + (i % copyRowLength);
|
|
9252
|
+
const copyRow = getSourceItem(this.dataStore, oldRowIndex) || {};
|
|
9253
|
+
// columns
|
|
9254
|
+
for (let colIndex = d.newRange.x, j = 0; colIndex < d.newRange.x1 + 1; colIndex++, j++) {
|
|
9255
|
+
// check if old range area
|
|
9256
|
+
if (rowIndex >= d.oldRange.y &&
|
|
9257
|
+
rowIndex <= d.oldRange.y1 &&
|
|
9258
|
+
colIndex >= d.oldRange.x &&
|
|
9259
|
+
colIndex <= d.oldRange.x1) {
|
|
9260
|
+
continue;
|
|
9261
|
+
}
|
|
9262
|
+
// requested column beyond range
|
|
9263
|
+
if (!this.columns[colIndex]) {
|
|
9264
|
+
continue;
|
|
9265
|
+
}
|
|
9266
|
+
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
9267
|
+
const copyColIndex = d.oldRange.x + (j % copyColLength);
|
|
9268
|
+
const copyColumnProp = columns[copyColIndex].prop;
|
|
9269
|
+
/** if can write */
|
|
9270
|
+
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9271
|
+
/** to show before save */
|
|
9272
|
+
if (!changed[rowIndex]) {
|
|
9273
|
+
changed[rowIndex] = {};
|
|
9274
|
+
}
|
|
9275
|
+
changed[rowIndex][prop] = copyRow[copyColumnProp];
|
|
9276
|
+
/** Generate mapping object */
|
|
9277
|
+
if (!mapping[rowIndex]) {
|
|
9278
|
+
mapping[rowIndex] = {};
|
|
9279
|
+
}
|
|
9280
|
+
mapping[rowIndex][prop] = {
|
|
9281
|
+
colIndex: copyColIndex,
|
|
9282
|
+
colProp: copyColumnProp,
|
|
9283
|
+
rowIndex: oldRowIndex,
|
|
9284
|
+
};
|
|
9285
|
+
}
|
|
9286
|
+
}
|
|
9287
|
+
}
|
|
9288
|
+
return {
|
|
9289
|
+
changed,
|
|
9290
|
+
mapping,
|
|
9291
|
+
};
|
|
9440
9292
|
}
|
|
9441
|
-
|
|
9442
|
-
}
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9293
|
+
getTransformedDataToApply(start, data) {
|
|
9294
|
+
const changed = {};
|
|
9295
|
+
const copyRowLength = data.length;
|
|
9296
|
+
const colLength = this.columns.length;
|
|
9297
|
+
const rowLength = this.dataStore.get('items').length;
|
|
9298
|
+
// rows
|
|
9299
|
+
let rowIndex = start.y;
|
|
9300
|
+
let maxCol = 0;
|
|
9301
|
+
for (let i = 0; rowIndex < rowLength && i < copyRowLength; rowIndex++, i++) {
|
|
9302
|
+
// copy original data link
|
|
9303
|
+
const copyRow = data[i % copyRowLength];
|
|
9304
|
+
const copyColLength = (copyRow === null || copyRow === void 0 ? void 0 : copyRow.length) || 0;
|
|
9305
|
+
// columns
|
|
9306
|
+
let colIndex = start.x;
|
|
9307
|
+
for (let j = 0; colIndex < colLength && j < copyColLength; colIndex++, j++) {
|
|
9308
|
+
const p = this.columns[colIndex].prop;
|
|
9309
|
+
const currentCol = j % colLength;
|
|
9310
|
+
/** if can write */
|
|
9311
|
+
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9312
|
+
/** to show before save */
|
|
9313
|
+
if (!changed[rowIndex]) {
|
|
9314
|
+
changed[rowIndex] = {};
|
|
9315
|
+
}
|
|
9316
|
+
changed[rowIndex][p] = copyRow[currentCol];
|
|
9317
|
+
}
|
|
9318
|
+
}
|
|
9319
|
+
maxCol = Math.max(maxCol, colIndex - 1);
|
|
9448
9320
|
}
|
|
9321
|
+
const range = getRange(start, {
|
|
9322
|
+
y: rowIndex - 1,
|
|
9323
|
+
x: maxCol,
|
|
9324
|
+
});
|
|
9325
|
+
return {
|
|
9326
|
+
changed,
|
|
9327
|
+
range,
|
|
9328
|
+
};
|
|
9329
|
+
}
|
|
9330
|
+
getRangeStaticData(d, value) {
|
|
9331
|
+
const changed = {};
|
|
9332
|
+
// rows
|
|
9333
|
+
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
9334
|
+
// columns
|
|
9335
|
+
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
9336
|
+
// requested column beyond range
|
|
9337
|
+
if (!this.columns[colIndex]) {
|
|
9338
|
+
continue;
|
|
9339
|
+
}
|
|
9340
|
+
const p = this.columns[colIndex].prop;
|
|
9341
|
+
/** if can write */
|
|
9342
|
+
if (!this.isReadOnly(rowIndex, colIndex)) {
|
|
9343
|
+
/** to show before save */
|
|
9344
|
+
if (!changed[rowIndex]) {
|
|
9345
|
+
changed[rowIndex] = {};
|
|
9346
|
+
}
|
|
9347
|
+
changed[rowIndex][p] = value;
|
|
9348
|
+
}
|
|
9349
|
+
}
|
|
9350
|
+
}
|
|
9351
|
+
return changed;
|
|
9352
|
+
}
|
|
9353
|
+
getRangeTransformedToProps(d, store) {
|
|
9354
|
+
var _a;
|
|
9355
|
+
const area = [];
|
|
9356
|
+
const type = this.dataStore.get('type');
|
|
9357
|
+
// rows
|
|
9358
|
+
for (let rowIndex = d.y, i = 0; rowIndex < d.y1 + 1; rowIndex++, i++) {
|
|
9359
|
+
// columns
|
|
9360
|
+
for (let colIndex = d.x, j = 0; colIndex < d.x1 + 1; colIndex++, j++) {
|
|
9361
|
+
const prop = (_a = this.columns[colIndex]) === null || _a === void 0 ? void 0 : _a.prop;
|
|
9362
|
+
area.push({
|
|
9363
|
+
prop,
|
|
9364
|
+
rowIndex,
|
|
9365
|
+
colIndex,
|
|
9366
|
+
model: getSourceItem(store, rowIndex),
|
|
9367
|
+
type,
|
|
9368
|
+
colType: this.type,
|
|
9369
|
+
});
|
|
9370
|
+
}
|
|
9371
|
+
}
|
|
9372
|
+
return area;
|
|
9373
|
+
}
|
|
9374
|
+
copyRangeArray(range, store) {
|
|
9375
|
+
const cols = [...this.columns];
|
|
9376
|
+
const props = slice_1(cols, range.x, range.x1 + 1).map(v => v.prop);
|
|
9377
|
+
const toCopy = [];
|
|
9378
|
+
const mapping = {};
|
|
9379
|
+
// rows indexes
|
|
9380
|
+
for (let i = range.y; i <= range.y1; i++) {
|
|
9381
|
+
const rgRow = [];
|
|
9382
|
+
mapping[i] = {};
|
|
9383
|
+
// columns indexes
|
|
9384
|
+
for (let prop of props) {
|
|
9385
|
+
const item = getSourceItem(store, i);
|
|
9386
|
+
// if no item - skip
|
|
9387
|
+
if (!item) {
|
|
9388
|
+
continue;
|
|
9389
|
+
}
|
|
9390
|
+
const val = item[prop];
|
|
9391
|
+
rgRow.push(val);
|
|
9392
|
+
mapping[i][prop] = val;
|
|
9393
|
+
}
|
|
9394
|
+
toCopy.push(rgRow);
|
|
9395
|
+
}
|
|
9396
|
+
return {
|
|
9397
|
+
data: toCopy,
|
|
9398
|
+
mapping,
|
|
9399
|
+
};
|
|
9400
|
+
}
|
|
9401
|
+
destroy() {
|
|
9402
|
+
this.unsubscribe.forEach(f => f());
|
|
9449
9403
|
}
|
|
9450
|
-
return res;
|
|
9451
9404
|
}
|
|
9452
9405
|
/**
|
|
9453
|
-
*
|
|
9406
|
+
* Checks if the given rowDrag is a service for dragging rows.
|
|
9454
9407
|
*/
|
|
9455
|
-
function
|
|
9456
|
-
|
|
9408
|
+
function isRowDragService(rowDrag, model) {
|
|
9409
|
+
if (typeof rowDrag === 'function') {
|
|
9410
|
+
return rowDrag(model);
|
|
9411
|
+
}
|
|
9412
|
+
return !!rowDrag;
|
|
9457
9413
|
}
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
columns: {
|
|
9465
|
-
rgCol: [],
|
|
9466
|
-
colPinStart: [],
|
|
9467
|
-
colPinEnd: [],
|
|
9468
|
-
},
|
|
9469
|
-
// columns indexed by prop for quick access
|
|
9470
|
-
columnByProp: {},
|
|
9471
|
-
// column grouping
|
|
9472
|
-
columnGrouping: {
|
|
9473
|
-
rgCol: [],
|
|
9474
|
-
colPinStart: [],
|
|
9475
|
-
colPinEnd: [],
|
|
9476
|
-
},
|
|
9477
|
-
// max depth level for column grouping
|
|
9478
|
-
maxLevel: level,
|
|
9479
|
-
// sorting
|
|
9480
|
-
sort: {},
|
|
9481
|
-
};
|
|
9482
|
-
return reduce_1(columns, (res, colData) => {
|
|
9483
|
-
// Grouped column
|
|
9484
|
-
if (isColGrouping(colData)) {
|
|
9485
|
-
return gatherGroup(res, colData, getColumns(colData.children, level + 1, types), level);
|
|
9486
|
-
}
|
|
9487
|
-
// Regular column
|
|
9488
|
-
const regularColumn = Object.assign(Object.assign({}, (colData.columnType && types && types[colData.columnType])), colData);
|
|
9489
|
-
// Regular column, no Pin
|
|
9490
|
-
if (!regularColumn.pin) {
|
|
9491
|
-
res.columns.rgCol.push(regularColumn);
|
|
9492
|
-
// Pin
|
|
9493
|
-
}
|
|
9494
|
-
else {
|
|
9495
|
-
res.columns[regularColumn.pin].push(regularColumn);
|
|
9414
|
+
function doPropMerge(existing, extra) {
|
|
9415
|
+
let props = Object.assign(Object.assign({}, extra), existing);
|
|
9416
|
+
// extend existing props
|
|
9417
|
+
if (extra.class) {
|
|
9418
|
+
if (typeof extra.class === 'object' && typeof props.class === 'object') {
|
|
9419
|
+
props.class = Object.assign(Object.assign({}, extra.class), props.class);
|
|
9496
9420
|
}
|
|
9497
|
-
if (
|
|
9498
|
-
|
|
9421
|
+
else if (typeof extra.class === 'string' &&
|
|
9422
|
+
typeof props.class === 'object') {
|
|
9423
|
+
props.class[extra.class] = true;
|
|
9499
9424
|
}
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
res.columnByProp[regularColumn.prop] = [];
|
|
9425
|
+
else if (typeof props.class === 'string') {
|
|
9426
|
+
props.class += ' ' + extra.class;
|
|
9503
9427
|
}
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9428
|
+
}
|
|
9429
|
+
if (extra.style) {
|
|
9430
|
+
props.style = Object.assign(Object.assign({}, extra.style), props.style);
|
|
9431
|
+
}
|
|
9432
|
+
return props;
|
|
9509
9433
|
}
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
// if column data
|
|
9519
|
-
if (isArray_1(resultItem) && isArray_1(collectionItem)) {
|
|
9520
|
-
// fill columns
|
|
9521
|
-
resultItem.push(...collectionItem);
|
|
9522
|
-
// fill grouping
|
|
9523
|
-
if (collectionItem.length) {
|
|
9524
|
-
res.columnGrouping[key].push(Object.assign(Object.assign({}, group), { ids: collectionItem.map(item => item.prop) }));
|
|
9525
|
-
}
|
|
9434
|
+
|
|
9435
|
+
function isTouch(e) {
|
|
9436
|
+
return !!e.touches;
|
|
9437
|
+
}
|
|
9438
|
+
function verifyTouchTarget(touchEvent, focusClass) {
|
|
9439
|
+
if (focusClass && touchEvent) {
|
|
9440
|
+
if (!(touchEvent.target instanceof Element && touchEvent.target.classList.contains(focusClass))) {
|
|
9441
|
+
return false;
|
|
9526
9442
|
}
|
|
9527
9443
|
}
|
|
9528
|
-
|
|
9529
|
-
for (let k in collection.columnGrouping) {
|
|
9530
|
-
const key = k;
|
|
9531
|
-
const collectionItem = collection.columnGrouping[key];
|
|
9532
|
-
res.columnGrouping[key].push(...collectionItem);
|
|
9533
|
-
}
|
|
9534
|
-
res.maxLevel = Math.max(res.maxLevel, collection.maxLevel);
|
|
9535
|
-
res.sort = Object.assign(Object.assign({}, res.sort), collection.sort);
|
|
9536
|
-
return res;
|
|
9444
|
+
return true;
|
|
9537
9445
|
}
|
|
9538
|
-
|
|
9539
|
-
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9446
|
+
/**
|
|
9447
|
+
* Function to get the value of a specific property from a MouseEvent or TouchEvent object.
|
|
9448
|
+
*/
|
|
9449
|
+
function getPropertyFromEvent(e, prop, focusClass // for touch events
|
|
9450
|
+
) {
|
|
9451
|
+
// Check if the event is a touch event
|
|
9452
|
+
if (isTouch(e)) {
|
|
9453
|
+
// If the event has touches, get the first touch
|
|
9454
|
+
if (e.touches.length > 0) {
|
|
9455
|
+
const touchEvent = e.touches[0];
|
|
9456
|
+
// Check if the target of the touch event is the specified element
|
|
9457
|
+
if (!verifyTouchTarget(touchEvent, focusClass)) {
|
|
9458
|
+
// If not, return null
|
|
9459
|
+
return null;
|
|
9544
9460
|
}
|
|
9461
|
+
// Get the value of the specified property from the touch event and return it
|
|
9462
|
+
return touchEvent[prop] || 0;
|
|
9545
9463
|
}
|
|
9546
|
-
|
|
9547
|
-
|
|
9548
|
-
}
|
|
9464
|
+
// If there are no touches, return null
|
|
9465
|
+
return null;
|
|
9549
9466
|
}
|
|
9550
|
-
return
|
|
9551
|
-
|
|
9552
|
-
function getColumnByProp(columns, prop) {
|
|
9553
|
-
return findColumn(columns, prop);
|
|
9467
|
+
// If the event is not a touch event, get the value of the specified property from the event and return it
|
|
9468
|
+
return e[prop] || 0;
|
|
9554
9469
|
}
|
|
9555
9470
|
|
|
9556
|
-
|
|
9557
|
-
const
|
|
9558
|
-
|
|
9559
|
-
|
|
9560
|
-
|
|
9561
|
-
|
|
9471
|
+
function collectModelsOfRange(data, store) {
|
|
9472
|
+
const models = {};
|
|
9473
|
+
for (let i in data) {
|
|
9474
|
+
const rowIndex = parseInt(i, 10);
|
|
9475
|
+
models[rowIndex] = getSourceItem(store, rowIndex);
|
|
9476
|
+
}
|
|
9477
|
+
return models;
|
|
9478
|
+
}
|
|
9479
|
+
function getFocusCellBasedOnEvent(e, data) {
|
|
9480
|
+
// If event default is prevented, return
|
|
9481
|
+
if (e.defaultPrevented) {
|
|
9482
|
+
return null;
|
|
9483
|
+
}
|
|
9484
|
+
// Get coordinates from event object
|
|
9485
|
+
const x = getPropertyFromEvent(e, 'clientX');
|
|
9486
|
+
const y = getPropertyFromEvent(e, 'clientY');
|
|
9487
|
+
// If coordinates are not available, return
|
|
9488
|
+
if (x === null || y === null) {
|
|
9489
|
+
return null;
|
|
9490
|
+
}
|
|
9491
|
+
// Get current cell based on coordinates and data
|
|
9492
|
+
const focusCell = getCurrentCell({ x, y }, data);
|
|
9493
|
+
// If current cell is not available, return
|
|
9494
|
+
if (isAfterLast(focusCell, data.lastCell)) {
|
|
9495
|
+
return null;
|
|
9496
|
+
}
|
|
9497
|
+
return focusCell;
|
|
9498
|
+
}
|
|
9562
9499
|
/**
|
|
9563
|
-
* Calculate
|
|
9500
|
+
* Calculate cell based on x, y position
|
|
9564
9501
|
*/
|
|
9565
|
-
function
|
|
9566
|
-
//
|
|
9567
|
-
const
|
|
9568
|
-
//
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
//
|
|
9576
|
-
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
//
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9502
|
+
function getCurrentCell({ x, y }, { el, rows, cols }) {
|
|
9503
|
+
// Get the bounding rectangle of the element
|
|
9504
|
+
const { top, left, height, width } = el.getBoundingClientRect();
|
|
9505
|
+
// Calculate the cell position relative to the element
|
|
9506
|
+
let cellY = y - top;
|
|
9507
|
+
let cellX = x - left;
|
|
9508
|
+
// Limit the cell position to the element height
|
|
9509
|
+
if (cellY >= height) {
|
|
9510
|
+
cellY = height - 1;
|
|
9511
|
+
}
|
|
9512
|
+
// Limit the cell position to the element width
|
|
9513
|
+
if (cellX >= width) {
|
|
9514
|
+
cellX = width - 1;
|
|
9515
|
+
}
|
|
9516
|
+
// Get the row and column items based on the cell position
|
|
9517
|
+
const rgRow = getItemByPosition(rows, cellY);
|
|
9518
|
+
const rgCol = getItemByPosition(cols, cellX);
|
|
9519
|
+
// Set the row and column index to 0 if they are before the first item
|
|
9520
|
+
if (rgCol.itemIndex < 0) {
|
|
9521
|
+
rgCol.itemIndex = 0;
|
|
9522
|
+
}
|
|
9523
|
+
if (rgRow.itemIndex < 0) {
|
|
9524
|
+
rgRow.itemIndex = 0;
|
|
9525
|
+
}
|
|
9526
|
+
return { x: rgCol.itemIndex, y: rgRow.itemIndex };
|
|
9583
9527
|
}
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9528
|
+
function getCoordinate(range, focus, changes, isMulti = false) {
|
|
9529
|
+
const updateCoordinate = (c, pos = 0) => {
|
|
9530
|
+
const start = { x: range.x, y: range.y };
|
|
9531
|
+
const end = isMulti ? { x: range.x1, y: range.y1 } : start;
|
|
9532
|
+
const point = end[c] > focus[c] ? end : start;
|
|
9533
|
+
point[c] += pos;
|
|
9534
|
+
return { start, end };
|
|
9535
|
+
};
|
|
9536
|
+
if (changes.x) {
|
|
9537
|
+
return updateCoordinate('x', changes['x']);
|
|
9538
|
+
}
|
|
9539
|
+
if (changes.y) {
|
|
9540
|
+
return updateCoordinate('y', changes['y']);
|
|
9541
|
+
}
|
|
9542
|
+
return null;
|
|
9598
9543
|
}
|
|
9599
9544
|
/**
|
|
9600
|
-
*
|
|
9545
|
+
* Check if the x coordinate of the cell position is after or equal to the x coordinate of the last cell position
|
|
9546
|
+
* or if the y coordinate of the cell position is after or equal to the y coordinate of the last cell position
|
|
9601
9547
|
*/
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9548
|
+
function isAfterLast({ x, y }, lastCell) {
|
|
9549
|
+
return x >= lastCell.x || y >= lastCell.y;
|
|
9550
|
+
}
|
|
9551
|
+
/** check if out of range */
|
|
9552
|
+
function isBeforeFirst({ x, y }) {
|
|
9553
|
+
return x < 0 || y < 0;
|
|
9554
|
+
}
|
|
9555
|
+
/** Compare cells, only 1 coordinate difference is possible */
|
|
9556
|
+
// export function getDirectionCoordinate(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
9557
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
9558
|
+
// for (let k of c) {
|
|
9559
|
+
// if (initial[k] !== last[k]) {
|
|
9560
|
+
// return { [k]: 1 };
|
|
9561
|
+
// }
|
|
9562
|
+
// }
|
|
9563
|
+
// return null;
|
|
9564
|
+
// }
|
|
9565
|
+
// export function getLargestAxis(initial: Cell, last: Cell): Partial<Cell> | null {
|
|
9566
|
+
// const cell: Partial<Cell> = {};
|
|
9567
|
+
// const c: (keyof Cell)[] = ['x', 'y'];
|
|
9568
|
+
// for (let k of c) {
|
|
9569
|
+
// cell[k] = Math.abs(initial[k] - last[k]);
|
|
9570
|
+
// }
|
|
9571
|
+
// if (cell.x > cell.y) {
|
|
9572
|
+
// return { x: 1 };
|
|
9573
|
+
// }
|
|
9574
|
+
// if (cell.y > cell.x) {
|
|
9575
|
+
// return { y: 1 };
|
|
9576
|
+
// }
|
|
9577
|
+
// return null;
|
|
9578
|
+
// }
|
|
9579
|
+
function styleByCellProps(styles) {
|
|
9580
|
+
return {
|
|
9581
|
+
left: `${styles.left}px`,
|
|
9582
|
+
top: `${styles.top}px`,
|
|
9583
|
+
width: `${styles.width}px`,
|
|
9584
|
+
height: `${styles.height}px`,
|
|
9585
|
+
};
|
|
9586
|
+
}
|
|
9587
|
+
function getCell({ x, y, x1, y1 }, dimensionRow, dimensionCol) {
|
|
9588
|
+
const top = getItemByIndex(dimensionRow, y).start;
|
|
9589
|
+
const left = getItemByIndex(dimensionCol, x).start;
|
|
9590
|
+
const bottom = getItemByIndex(dimensionRow, y1).end;
|
|
9591
|
+
const right = getItemByIndex(dimensionCol, x1).end;
|
|
9592
|
+
return {
|
|
9593
|
+
left,
|
|
9594
|
+
right,
|
|
9595
|
+
top,
|
|
9596
|
+
bottom,
|
|
9597
|
+
width: right - left,
|
|
9598
|
+
height: bottom - top,
|
|
9599
|
+
};
|
|
9600
|
+
}
|
|
9601
|
+
function getElStyle(range, dimensionRow, dimensionCol) {
|
|
9602
|
+
const styles = getCell(range, dimensionRow, dimensionCol);
|
|
9603
|
+
return styleByCellProps(styles);
|
|
9604
|
+
}
|
|
9605
|
+
|
|
9606
|
+
// is edit input
|
|
9607
|
+
function isEditInput(el) {
|
|
9608
|
+
return !!(el === null || el === void 0 ? void 0 : el.closest(`.${EDIT_INPUT_WR}`));
|
|
9609
|
+
}
|
|
9610
|
+
// Type guard for EditorCtrConstructible
|
|
9611
|
+
function isEditorCtrConstructible(editor) {
|
|
9612
|
+
return typeof editor === 'function' && typeof editor.prototype === 'object';
|
|
9606
9613
|
}
|
|
9607
9614
|
|
|
9608
9615
|
const DIRECTION_CODES = [
|
|
@@ -11187,7 +11194,7 @@ class ThemeService {
|
|
|
11187
11194
|
this.register('default');
|
|
11188
11195
|
}
|
|
11189
11196
|
register(theme) {
|
|
11190
|
-
const parsedTheme =
|
|
11197
|
+
const parsedTheme = getTheme(theme);
|
|
11191
11198
|
switch (parsedTheme) {
|
|
11192
11199
|
case 'material':
|
|
11193
11200
|
case 'darkMaterial':
|
|
@@ -11202,12 +11209,12 @@ class ThemeService {
|
|
|
11202
11209
|
break;
|
|
11203
11210
|
}
|
|
11204
11211
|
}
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
return DEFAULT_THEME;
|
|
11212
|
+
}
|
|
11213
|
+
function getTheme(theme) {
|
|
11214
|
+
if (theme && allowedThemes.indexOf(theme) > -1) {
|
|
11215
|
+
return theme;
|
|
11210
11216
|
}
|
|
11217
|
+
return DEFAULT_THEME;
|
|
11211
11218
|
}
|
|
11212
11219
|
|
|
11213
11220
|
/**
|
|
@@ -11614,23 +11621,7 @@ const notContains = (value, extra) => {
|
|
|
11614
11621
|
notContains.extra = 'input';
|
|
11615
11622
|
contains.extra = 'input';
|
|
11616
11623
|
|
|
11617
|
-
const
|
|
11618
|
-
none: 'None',
|
|
11619
|
-
empty: 'Not set',
|
|
11620
|
-
notEmpty: 'Set',
|
|
11621
|
-
eq: 'Equal',
|
|
11622
|
-
notEq: 'Not equal',
|
|
11623
|
-
begins: 'Begins with',
|
|
11624
|
-
contains: 'Contains',
|
|
11625
|
-
notContains: 'Does not contain',
|
|
11626
|
-
eqN: '=',
|
|
11627
|
-
neqN: '!=',
|
|
11628
|
-
gt: '>',
|
|
11629
|
-
gte: '>=',
|
|
11630
|
-
lt: '<',
|
|
11631
|
-
lte: '<=',
|
|
11632
|
-
};
|
|
11633
|
-
const filterEntities = {
|
|
11624
|
+
const filterCoreFunctionsIndexedByType = {
|
|
11634
11625
|
none: () => true,
|
|
11635
11626
|
empty: notSet,
|
|
11636
11627
|
notEmpty: set,
|
|
@@ -11650,7 +11641,37 @@ const filterTypes = {
|
|
|
11650
11641
|
string: ['notEmpty', 'empty', 'eq', 'notEq', 'begins', 'contains', 'notContains'],
|
|
11651
11642
|
number: ['notEmpty', 'empty', 'eqN', 'neqN', 'gt', 'gte', 'lt', 'lte'],
|
|
11652
11643
|
};
|
|
11644
|
+
const filterNames = {
|
|
11645
|
+
none: 'None',
|
|
11646
|
+
empty: 'Not set',
|
|
11647
|
+
notEmpty: 'Set',
|
|
11648
|
+
eq: 'Equal',
|
|
11649
|
+
notEq: 'Not equal',
|
|
11650
|
+
begins: 'Begins with',
|
|
11651
|
+
contains: 'Contains',
|
|
11652
|
+
notContains: 'Does not contain',
|
|
11653
|
+
eqN: '=',
|
|
11654
|
+
neqN: '!=',
|
|
11655
|
+
gt: '>',
|
|
11656
|
+
gte: '>=',
|
|
11657
|
+
lt: '<',
|
|
11658
|
+
lte: '<=',
|
|
11659
|
+
};
|
|
11653
11660
|
|
|
11661
|
+
/**
|
|
11662
|
+
* @typedef ColumnFilterConfig
|
|
11663
|
+
* @type {object}
|
|
11664
|
+
* @property {FilterCollection|undefined} collection - preserved filter data
|
|
11665
|
+
* @property {string[]|undefined} include - filters to be included, if defined everything else out of scope will be ignored
|
|
11666
|
+
* @property {Record<string, CustomFilter>|undefined} customFilters - hash map of {FilterType:CustomFilter}.
|
|
11667
|
+
* @property {FilterLocalization|undefined} localization - translation for filter popup captions.
|
|
11668
|
+
* @property {MultiFilterItem|undefined} multiFilterItems - data for multi filtering.
|
|
11669
|
+
* @property {boolean|undefined} disableDynamicFiltering - disables dynamic filtering.
|
|
11670
|
+
* A way to define your own filter types per column
|
|
11671
|
+
*/
|
|
11672
|
+
/**
|
|
11673
|
+
* @internal
|
|
11674
|
+
*/
|
|
11654
11675
|
const FILTER_TRIMMED_TYPE = 'filter';
|
|
11655
11676
|
const FILTER_CONFIG_CHANGED_EVENT = 'filterconfigchanged';
|
|
11656
11677
|
class FilterPlugin extends BasePlugin {
|
|
@@ -11660,14 +11681,13 @@ class FilterPlugin extends BasePlugin {
|
|
|
11660
11681
|
this.revogrid = revogrid;
|
|
11661
11682
|
this.filterCollection = {};
|
|
11662
11683
|
this.multiFilterItems = {};
|
|
11663
|
-
this.
|
|
11664
|
-
this.
|
|
11665
|
-
this.
|
|
11684
|
+
this.filterByType = Object.assign({}, filterTypes);
|
|
11685
|
+
this.filterNameIndexByType = Object.assign({}, filterNames);
|
|
11686
|
+
this.filterFunctionsIndexedByType = Object.assign({}, filterCoreFunctionsIndexedByType);
|
|
11666
11687
|
this.filterProp = FILTER_PROP;
|
|
11667
11688
|
if (config) {
|
|
11668
11689
|
this.initConfig(config);
|
|
11669
11690
|
}
|
|
11670
|
-
const headerclick = (e) => this.headerclick(e);
|
|
11671
11691
|
const aftersourceset = async () => {
|
|
11672
11692
|
const filterCollectionProps = Object.keys(this.filterCollection);
|
|
11673
11693
|
if (filterCollectionProps.length > 0) {
|
|
@@ -11687,7 +11707,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11687
11707
|
}
|
|
11688
11708
|
await this.runFiltering();
|
|
11689
11709
|
};
|
|
11690
|
-
this.addEventListener('headerclick', headerclick);
|
|
11710
|
+
this.addEventListener('headerclick', (e) => this.headerclick(e));
|
|
11691
11711
|
this.addEventListener(FILTER_CONFIG_CHANGED_EVENT, ({ detail }) => {
|
|
11692
11712
|
if (!detail) {
|
|
11693
11713
|
this.clearFiltering();
|
|
@@ -11700,27 +11720,29 @@ class FilterPlugin extends BasePlugin {
|
|
|
11700
11720
|
});
|
|
11701
11721
|
this.addEventListener('aftersourceset', aftersourceset);
|
|
11702
11722
|
this.addEventListener('filter', ({ detail }) => this.onFilterChange(detail));
|
|
11703
|
-
const existingNodes = this.revogrid.registerVNode.filter(
|
|
11723
|
+
const existingNodes = this.revogrid.registerVNode.filter(n => n.$tag$ !== 'revogr-filter-panel');
|
|
11704
11724
|
this.revogrid.registerVNode = [
|
|
11705
11725
|
...existingNodes,
|
|
11706
|
-
hAsync("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.
|
|
11726
|
+
hAsync("revogr-filter-panel", { filterItems: this.multiFilterItems, filterNames: this.filterNameIndexByType, filterEntities: this.filterFunctionsIndexedByType, filterCaptions: (_a = config === null || config === void 0 ? void 0 : config.localization) === null || _a === void 0 ? void 0 : _a.captions, onFilterChange: e => this.onFilterChange(e.detail), disableDynamicFiltering: config === null || config === void 0 ? void 0 : config.disableDynamicFiltering, ref: e => (this.pop = e) }),
|
|
11707
11727
|
];
|
|
11708
11728
|
}
|
|
11709
11729
|
initConfig(config) {
|
|
11710
11730
|
if (config.multiFilterItems) {
|
|
11711
11731
|
this.multiFilterItems = Object.assign({}, config.multiFilterItems);
|
|
11712
11732
|
}
|
|
11733
|
+
// Add custom filters
|
|
11713
11734
|
if (config.customFilters) {
|
|
11714
|
-
for (let
|
|
11715
|
-
const cFilter = config.customFilters[
|
|
11716
|
-
if (!this.
|
|
11717
|
-
this.
|
|
11735
|
+
for (let customFilterType in config.customFilters) {
|
|
11736
|
+
const cFilter = config.customFilters[customFilterType];
|
|
11737
|
+
if (!this.filterByType[cFilter.columnFilterType]) {
|
|
11738
|
+
this.filterByType[cFilter.columnFilterType] = [];
|
|
11718
11739
|
}
|
|
11719
|
-
this.
|
|
11720
|
-
this.
|
|
11721
|
-
this.
|
|
11740
|
+
this.filterByType[cFilter.columnFilterType].push(customFilterType);
|
|
11741
|
+
this.filterFunctionsIndexedByType[customFilterType] = cFilter.func;
|
|
11742
|
+
this.filterNameIndexByType[customFilterType] = cFilter.name;
|
|
11722
11743
|
}
|
|
11723
11744
|
}
|
|
11745
|
+
// Add filterProp if provided in config
|
|
11724
11746
|
if (config.filterProp) {
|
|
11725
11747
|
this.filterProp = config.filterProp;
|
|
11726
11748
|
}
|
|
@@ -11731,21 +11753,21 @@ class FilterPlugin extends BasePlugin {
|
|
|
11731
11753
|
const cfgInlcude = config.include;
|
|
11732
11754
|
if (cfgInlcude) {
|
|
11733
11755
|
const filters = {};
|
|
11734
|
-
for (let t in this.
|
|
11756
|
+
for (let t in this.filterByType) {
|
|
11735
11757
|
// validate filters, if appropriate function present
|
|
11736
|
-
const newTypes = this.
|
|
11758
|
+
const newTypes = this.filterByType[t].filter(f => cfgInlcude.indexOf(f) > -1);
|
|
11737
11759
|
if (newTypes.length) {
|
|
11738
11760
|
filters[t] = newTypes;
|
|
11739
11761
|
}
|
|
11740
11762
|
}
|
|
11741
11763
|
// if any valid filters provided show them
|
|
11742
11764
|
if (Object.keys(filters).length > 0) {
|
|
11743
|
-
this.
|
|
11765
|
+
this.filterByType = filters;
|
|
11744
11766
|
}
|
|
11745
11767
|
}
|
|
11746
11768
|
if (config.collection) {
|
|
11747
11769
|
this.filterCollection = reduce_1(config.collection, (result, item, prop) => {
|
|
11748
|
-
if (this.
|
|
11770
|
+
if (this.filterFunctionsIndexedByType[item.type]) {
|
|
11749
11771
|
result[prop] = item;
|
|
11750
11772
|
}
|
|
11751
11773
|
else {
|
|
@@ -11757,8 +11779,8 @@ class FilterPlugin extends BasePlugin {
|
|
|
11757
11779
|
if (config.localization) {
|
|
11758
11780
|
if (config.localization.filterNames) {
|
|
11759
11781
|
Object.entries(config.localization.filterNames).forEach(([k, v]) => {
|
|
11760
|
-
if (this.
|
|
11761
|
-
this.
|
|
11782
|
+
if (this.filterNameIndexByType[k] != void 0) {
|
|
11783
|
+
this.filterNameIndexByType[k] = v;
|
|
11762
11784
|
}
|
|
11763
11785
|
});
|
|
11764
11786
|
}
|
|
@@ -11784,13 +11806,12 @@ class FilterPlugin extends BasePlugin {
|
|
|
11784
11806
|
const gridPos = this.revogrid.getBoundingClientRect();
|
|
11785
11807
|
const buttonPos = el.getBoundingClientRect();
|
|
11786
11808
|
const prop = e.detail.prop;
|
|
11787
|
-
this.pop.filterTypes
|
|
11788
|
-
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop }));
|
|
11809
|
+
this.pop.show(Object.assign(Object.assign({}, this.filterCollection[prop]), { x: buttonPos.x - gridPos.x, y: buttonPos.y - gridPos.y + buttonPos.height, autoCorrect: true, prop, filterTypes: this.getColumnFilter(e.detail.filter) }));
|
|
11789
11810
|
}
|
|
11790
11811
|
getColumnFilter(type) {
|
|
11791
11812
|
let filterType = 'string';
|
|
11792
11813
|
if (!type) {
|
|
11793
|
-
return { [filterType]: this.
|
|
11814
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
11794
11815
|
}
|
|
11795
11816
|
// if custom column filter
|
|
11796
11817
|
if (this.isValidType(type)) {
|
|
@@ -11800,44 +11821,59 @@ class FilterPlugin extends BasePlugin {
|
|
|
11800
11821
|
else if (typeof type === 'object' && type.length) {
|
|
11801
11822
|
return type.reduce((r, multiType) => {
|
|
11802
11823
|
if (this.isValidType(multiType)) {
|
|
11803
|
-
r[multiType] = this.
|
|
11824
|
+
r[multiType] = this.filterByType[multiType];
|
|
11804
11825
|
}
|
|
11805
11826
|
return r;
|
|
11806
11827
|
}, {});
|
|
11807
11828
|
}
|
|
11808
|
-
return { [filterType]: this.
|
|
11829
|
+
return { [filterType]: this.filterByType[filterType] };
|
|
11809
11830
|
}
|
|
11810
11831
|
isValidType(type) {
|
|
11811
|
-
return !!(typeof type === 'string' && this.
|
|
11832
|
+
return !!(typeof type === 'string' && this.filterByType[type]);
|
|
11812
11833
|
}
|
|
11813
|
-
|
|
11834
|
+
/**
|
|
11835
|
+
* Called on internal component change
|
|
11836
|
+
*/
|
|
11814
11837
|
async onFilterChange(filterItems) {
|
|
11838
|
+
// store the filter items
|
|
11815
11839
|
this.multiFilterItems = filterItems;
|
|
11840
|
+
// run the filtering when the items change
|
|
11816
11841
|
this.runFiltering();
|
|
11817
11842
|
}
|
|
11818
11843
|
/**
|
|
11819
11844
|
* Triggers grid filtering
|
|
11820
11845
|
*/
|
|
11821
|
-
async doFiltering(collection,
|
|
11846
|
+
async doFiltering(collection, source, columns, filterItems) {
|
|
11822
11847
|
const columnsToUpdate = [];
|
|
11848
|
+
/**
|
|
11849
|
+
* Loop through the columns and update the columns that need to be updated with the `hasFilter` property.
|
|
11850
|
+
*/
|
|
11851
|
+
const columnByProp = {};
|
|
11823
11852
|
columns.forEach(rgCol => {
|
|
11824
11853
|
const column = Object.assign({}, rgCol);
|
|
11825
11854
|
const hasFilter = filterItems[column.prop];
|
|
11855
|
+
columnByProp[column.prop] = column;
|
|
11856
|
+
/**
|
|
11857
|
+
* If the column has a filter and it's not already marked as filtered, update the column.
|
|
11858
|
+
*/
|
|
11826
11859
|
if (column[this.filterProp] && !hasFilter) {
|
|
11827
11860
|
delete column[this.filterProp];
|
|
11828
11861
|
columnsToUpdate.push(column);
|
|
11829
11862
|
}
|
|
11863
|
+
/**
|
|
11864
|
+
* If the column does not have a filter and it's marked as filtered, update the column.
|
|
11865
|
+
*/
|
|
11830
11866
|
if (!column[this.filterProp] && hasFilter) {
|
|
11831
11867
|
columnsToUpdate.push(column);
|
|
11832
11868
|
column[this.filterProp] = true;
|
|
11833
11869
|
}
|
|
11834
11870
|
});
|
|
11835
|
-
const
|
|
11871
|
+
const itemsToTrim = this.getRowFilter(source, filterItems, columnByProp);
|
|
11836
11872
|
// check is filter event prevented
|
|
11837
11873
|
const { defaultPrevented, detail } = this.emit('beforefiltertrimmed', {
|
|
11838
11874
|
collection,
|
|
11839
|
-
itemsToFilter,
|
|
11840
|
-
source
|
|
11875
|
+
itemsToFilter: itemsToTrim,
|
|
11876
|
+
source,
|
|
11841
11877
|
filterItems,
|
|
11842
11878
|
});
|
|
11843
11879
|
if (defaultPrevented) {
|
|
@@ -11849,7 +11885,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11849
11885
|
return;
|
|
11850
11886
|
}
|
|
11851
11887
|
// applies the hasFilter to the columns to show filter icon
|
|
11852
|
-
|
|
11888
|
+
this.providers.column.updateColumns(columnsToUpdate);
|
|
11853
11889
|
this.emit('afterfilterapply');
|
|
11854
11890
|
}
|
|
11855
11891
|
async clearFiltering() {
|
|
@@ -11865,7 +11901,7 @@ class FilterPlugin extends BasePlugin {
|
|
|
11865
11901
|
if (this.multiFilterItems[prop].length > 0) {
|
|
11866
11902
|
const firstFilterItem = this.multiFilterItems[prop][0];
|
|
11867
11903
|
collection[prop] = {
|
|
11868
|
-
filter:
|
|
11904
|
+
filter: this.filterFunctionsIndexedByType[firstFilterItem.type],
|
|
11869
11905
|
type: firstFilterItem.type,
|
|
11870
11906
|
value: firstFilterItem.value,
|
|
11871
11907
|
};
|
|
@@ -11890,52 +11926,68 @@ class FilterPlugin extends BasePlugin {
|
|
|
11890
11926
|
columns: await this.revogrid.getColumns(),
|
|
11891
11927
|
};
|
|
11892
11928
|
}
|
|
11893
|
-
|
|
11929
|
+
/**
|
|
11930
|
+
* Get trimmed rows based on filter
|
|
11931
|
+
*/
|
|
11932
|
+
getRowFilter(rows, filterItems, columnByProp) {
|
|
11894
11933
|
const propKeys = Object.keys(filterItems);
|
|
11895
11934
|
const trimmed = {};
|
|
11896
11935
|
let propFilterSatisfiedCount = 0;
|
|
11897
11936
|
let lastFilterResults = [];
|
|
11898
11937
|
// each rows
|
|
11899
11938
|
rows.forEach((model, rowIndex) => {
|
|
11900
|
-
//
|
|
11939
|
+
// check filter by column properties
|
|
11901
11940
|
for (const prop of propKeys) {
|
|
11902
11941
|
const propFilters = filterItems[prop];
|
|
11942
|
+
// reset the count of satisfied filters
|
|
11903
11943
|
propFilterSatisfiedCount = 0;
|
|
11944
|
+
// reset the array of last filter results
|
|
11904
11945
|
lastFilterResults = [];
|
|
11905
11946
|
// testing each filter for a prop
|
|
11906
11947
|
for (const [filterIndex, filterData] of propFilters.entries()) {
|
|
11907
11948
|
// the filter LogicFunction based on the type
|
|
11908
|
-
const
|
|
11949
|
+
const filterFunc = this.filterFunctionsIndexedByType[filterData.type];
|
|
11909
11950
|
// THE MAGIC OF FILTERING IS HERE
|
|
11951
|
+
const column = columnByProp[prop];
|
|
11952
|
+
// If there is no column but user wants to filter by a property
|
|
11953
|
+
const value = column ? getCellDataParsed(model, columnByProp[prop]) : model[prop];
|
|
11954
|
+
// OR relation
|
|
11910
11955
|
if (filterData.relation === 'or') {
|
|
11956
|
+
// reset the array of last filter results
|
|
11911
11957
|
lastFilterResults = [];
|
|
11912
|
-
if
|
|
11958
|
+
// if the filter is satisfied, continue to the next filter
|
|
11959
|
+
if (filterFunc(value, filterData.value)) {
|
|
11913
11960
|
continue;
|
|
11914
11961
|
}
|
|
11962
|
+
// if the filter is not satisfied, count it
|
|
11915
11963
|
propFilterSatisfiedCount++;
|
|
11964
|
+
// AND relation
|
|
11916
11965
|
}
|
|
11917
11966
|
else {
|
|
11918
11967
|
// 'and' relation will need to know the next filter
|
|
11919
11968
|
// so we save this current filter to include it in the next filter
|
|
11920
|
-
lastFilterResults.push(!
|
|
11969
|
+
lastFilterResults.push(!filterFunc(value, filterData.value));
|
|
11921
11970
|
// check first if we have a filter on the next index to pair it with this current filter
|
|
11922
11971
|
const nextFilterData = propFilters[filterIndex + 1];
|
|
11923
11972
|
// stop the sequence if there is no next filter or if the next filter is not an 'and' relation
|
|
11924
11973
|
if (!nextFilterData || nextFilterData.relation !== 'and') {
|
|
11925
11974
|
// let's just continue since for sure propFilterSatisfiedCount cannot be satisfied
|
|
11926
11975
|
if (lastFilterResults.indexOf(true) === -1) {
|
|
11976
|
+
// reset the array of last filter results
|
|
11927
11977
|
lastFilterResults = [];
|
|
11928
11978
|
continue;
|
|
11929
11979
|
}
|
|
11930
11980
|
// we need to add all of the lastFilterResults since we need to satisfy all
|
|
11931
11981
|
propFilterSatisfiedCount += lastFilterResults.length;
|
|
11982
|
+
// reset the array of last filter results
|
|
11932
11983
|
lastFilterResults = [];
|
|
11933
11984
|
}
|
|
11934
11985
|
}
|
|
11935
11986
|
} // end of propFilters forEach
|
|
11936
11987
|
// add to the list of removed/trimmed rows of filter condition is satisfied
|
|
11937
|
-
if (propFilterSatisfiedCount === propFilters.length)
|
|
11988
|
+
if (propFilterSatisfiedCount === propFilters.length) {
|
|
11938
11989
|
trimmed[rowIndex] = true;
|
|
11990
|
+
}
|
|
11939
11991
|
} // end of for-of propKeys
|
|
11940
11992
|
});
|
|
11941
11993
|
return trimmed;
|
|
@@ -13927,34 +13979,33 @@ const ResizableElement = (props, children) => {
|
|
|
13927
13979
|
const resizeEls = [];
|
|
13928
13980
|
const directive = (props.canResize &&
|
|
13929
13981
|
new ResizeDirective(props, e => {
|
|
13982
|
+
var _a;
|
|
13930
13983
|
if (e.eventName === ResizeEvents.end) {
|
|
13931
|
-
props.onResize
|
|
13984
|
+
(_a = props.onResize) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
13932
13985
|
}
|
|
13933
13986
|
})) ||
|
|
13934
13987
|
null;
|
|
13935
|
-
if (props.
|
|
13936
|
-
if (props.
|
|
13988
|
+
if (props.active) {
|
|
13989
|
+
if (props.canResize) {
|
|
13937
13990
|
for (let p in props.active) {
|
|
13938
13991
|
resizeEls.push(hAsync("div", { onClick: e => e.preventDefault(), onDblClick: e => {
|
|
13939
13992
|
var _a;
|
|
13940
13993
|
e.preventDefault();
|
|
13941
|
-
(_a = props.
|
|
13994
|
+
(_a = props.onDblClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
13942
13995
|
}, onMouseDown: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), onTouchStart: (e) => directive === null || directive === void 0 ? void 0 : directive.handleDown(e), class: `resizable resizable-${props.active[p]}` }));
|
|
13943
13996
|
}
|
|
13944
13997
|
}
|
|
13945
|
-
|
|
13946
|
-
else {
|
|
13947
|
-
if (props.active) {
|
|
13998
|
+
else {
|
|
13948
13999
|
for (let p in props.active) {
|
|
13949
14000
|
resizeEls.push(hAsync("div", { onClick: e => e.preventDefault(), onTouchStart: (e) => e.preventDefault(), onDblClick: e => {
|
|
13950
14001
|
var _a;
|
|
13951
14002
|
e.preventDefault();
|
|
13952
|
-
(_a = props.
|
|
14003
|
+
(_a = props.onDblClick) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
13953
14004
|
}, class: `no-resize resizable resizable-${props.active[p]}` }));
|
|
13954
14005
|
}
|
|
13955
14006
|
}
|
|
13956
14007
|
}
|
|
13957
|
-
return (hAsync("div", Object.assign({}, props, { ref:
|
|
14008
|
+
return (hAsync("div", Object.assign({}, props, { ref: e => e && (directive === null || directive === void 0 ? void 0 : directive.set(e)) }),
|
|
13958
14009
|
children,
|
|
13959
14010
|
resizeEls));
|
|
13960
14011
|
};
|
|
@@ -13968,16 +14019,17 @@ const HeaderCellRenderer = ({ data, props, additionalData }, children) => {
|
|
|
13968
14019
|
}
|
|
13969
14020
|
if (data === null || data === void 0 ? void 0 : data.columnProperties) {
|
|
13970
14021
|
const extra = data.columnProperties(data);
|
|
13971
|
-
if (extra
|
|
14022
|
+
if (extra) {
|
|
13972
14023
|
cellProps = doPropMerge(props, extra);
|
|
13973
14024
|
}
|
|
13974
14025
|
}
|
|
13975
|
-
|
|
14026
|
+
const resizeProps = Object.assign(Object.assign({}, cellProps), { onMouseDown(e) {
|
|
13976
14027
|
dispatch(e.currentTarget, ON_COLUMN_CLICK, {
|
|
13977
14028
|
data,
|
|
13978
14029
|
event: e,
|
|
13979
14030
|
});
|
|
13980
|
-
} })
|
|
14031
|
+
} });
|
|
14032
|
+
return (hAsync(ResizableElement, Object.assign({}, resizeProps),
|
|
13981
14033
|
hAsync("div", { class: "header-content" }, colTemplate),
|
|
13982
14034
|
children));
|
|
13983
14035
|
};
|
|
@@ -14190,8 +14242,14 @@ class WCAGPlugin extends BasePlugin {
|
|
|
14190
14242
|
return result;
|
|
14191
14243
|
};
|
|
14192
14244
|
column.cellProperties = (...args) => {
|
|
14245
|
+
const wcagProps = {
|
|
14246
|
+
['role']: 'gridcell',
|
|
14247
|
+
['aria-colindex']: index,
|
|
14248
|
+
['aria-rowindex']: args[0].rowIndex,
|
|
14249
|
+
['tabindex']: -1,
|
|
14250
|
+
};
|
|
14193
14251
|
const columnProps = (cellProperties === null || cellProperties === void 0 ? void 0 : cellProperties(...args)) || {};
|
|
14194
|
-
return Object.assign({
|
|
14252
|
+
return Object.assign(Object.assign({}, wcagProps), columnProps);
|
|
14195
14253
|
};
|
|
14196
14254
|
});
|
|
14197
14255
|
});
|
|
@@ -15877,9 +15935,9 @@ const HeaderRenderer = (p) => {
|
|
|
15877
15935
|
transform: `translateX(${p.column.start}px)`,
|
|
15878
15936
|
},
|
|
15879
15937
|
onResize: p.onResize,
|
|
15880
|
-
|
|
15938
|
+
onDblClick(originalEvent) {
|
|
15881
15939
|
var _a;
|
|
15882
|
-
(_a = p.
|
|
15940
|
+
(_a = p.onDblClick) === null || _a === void 0 ? void 0 : _a.call(p, {
|
|
15883
15941
|
column: p.data,
|
|
15884
15942
|
index: p.column.itemIndex,
|
|
15885
15943
|
originalEvent,
|
|
@@ -16007,12 +16065,12 @@ class RevogrHeaderComponent {
|
|
|
16007
16065
|
// render header columns
|
|
16008
16066
|
for (let rgCol of cols) {
|
|
16009
16067
|
const colData = this.colData[rgCol.itemIndex];
|
|
16010
|
-
cells.push(hAsync(HeaderRenderer, { range: range, column: rgCol, data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }), canFilter: !!this.columnFilter, canResize: this.canResize, active: this.resizeHandler, onResize: e => this.onResize(e, rgCol.itemIndex),
|
|
16068
|
+
cells.push(hAsync(HeaderRenderer, { range: range, column: rgCol, data: Object.assign(Object.assign({}, colData), { index: rgCol.itemIndex, providers: this.providers }), canFilter: !!this.columnFilter, canResize: this.canResize, active: this.resizeHandler, onResize: e => this.onResize(e, rgCol.itemIndex), onDblClick: e => this.headerdblClick.emit(e), onClick: e => this.initialHeaderClick.emit(e), additionalData: this.additionalData }));
|
|
16011
16069
|
visibleProps[colData === null || colData === void 0 ? void 0 : colData.prop] = rgCol.itemIndex;
|
|
16012
16070
|
}
|
|
16013
16071
|
return [
|
|
16014
|
-
hAsync("div", { key: '
|
|
16015
|
-
hAsync("div", { key: '
|
|
16072
|
+
hAsync("div", { key: 'fcfd687bcae987699e2c0c6dd2b403dc3bb36c3d', class: "group-rgRow" }, hAsync(ColumnGroupsRenderer, { key: 'e3dfe9c5cbdd3c3dbbcbd7301a1a8a97353abf4b', canResize: this.canResize, active: this.resizeHandler, visibleProps: visibleProps, providers: this.providers, groups: this.groups, dimensionCol: this.dimensionCol.state, depth: this.groupingDepth, onResize: (changedX, startIndex, endIndex) => this.onResizeGroup(changedX, startIndex, endIndex), additionalData: this.additionalData })),
|
|
16073
|
+
hAsync("div", { key: '6b373546cc50bd85c7458da556c987e1a556d81b', class: `${HEADER_ROW_CLASS} ${HEADER_ACTUAL_ROW_CLASS}` }, cells),
|
|
16016
16074
|
];
|
|
16017
16075
|
}
|
|
16018
16076
|
get providers() {
|