@deephaven/code-studio 0.70.0 → 0.70.1-alpha-picker-table.35
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/build/assets/AppRoot-8fbba59a.js +5 -0
- package/build/assets/AppRoot-8fbba59a.js.map +1 -0
- package/build/assets/{Chart-0e56189b.js → Chart-49593479.js} +2 -2
- package/build/assets/{Chart-0e56189b.js.map → Chart-49593479.js.map} +1 -1
- package/build/assets/ControlType-43d413ba.js +22 -0
- package/build/assets/ControlType-43d413ba.js.map +1 -0
- package/build/assets/FontBootstrap-2f91f6bb.js +4 -0
- package/build/assets/FontBootstrap-2f91f6bb.js.map +1 -0
- package/build/assets/{FormatterUtils-fffc2387.js → FormatterUtils-dbab8b84.js} +2 -2
- package/build/assets/{FormatterUtils-fffc2387.js.map → FormatterUtils-dbab8b84.js.map} +1 -1
- package/build/assets/{Grid-f3209873.js → Grid-cb3653e5.js} +2 -2
- package/build/assets/{Grid-f3209873.js.map → Grid-cb3653e5.js.map} +1 -1
- package/build/assets/GridRenderer-7b447c86.js +2 -0
- package/build/assets/GridRenderer-7b447c86.js.map +1 -0
- package/build/assets/IrisGrid-7c65a74c.js +3 -0
- package/build/assets/IrisGrid-7c65a74c.js.map +1 -0
- package/build/assets/{IrisGridModel-0998ffa6.js → IrisGridModel-3cc97aec.js} +2 -2
- package/build/assets/{IrisGridModel-0998ffa6.js.map → IrisGridModel-3cc97aec.js.map} +1 -1
- package/build/assets/IrisGridShortcuts-929f2007.js +2 -0
- package/build/assets/IrisGridShortcuts-929f2007.js.map +1 -0
- package/build/assets/IrisGridThemeProvider-bc978029.js +11 -0
- package/build/assets/IrisGridThemeProvider-bc978029.js.map +1 -0
- package/build/assets/{MarkdownEditor-73f2a5e2.js → MarkdownEditor-7db3103d.js} +2 -2
- package/build/assets/{MarkdownEditor-73f2a5e2.js.map → MarkdownEditor-7db3103d.js.map} +1 -1
- package/build/assets/{MarkdownNotebook-349f5bfd.js → MarkdownNotebook-e640b4b8.js} +2 -2
- package/build/assets/{MarkdownNotebook-349f5bfd.js.map → MarkdownNotebook-e640b4b8.js.map} +1 -1
- package/build/assets/{MissingPartitionError-4a077854.js → MissingPartitionError-b63f09c6.js} +2 -2
- package/build/assets/{MissingPartitionError-4a077854.js.map → MissingPartitionError-b63f09c6.js.map} +1 -1
- package/build/assets/{StyleGuideRoot-da28e6c2.js → StyleGuideRoot-3dcdb14f.js} +6 -6
- package/build/assets/{StyleGuideRoot-da28e6c2.js.map → StyleGuideRoot-3dcdb14f.js.map} +1 -1
- package/build/assets/{index-429abb41.js → index-04bee0e3.js} +2 -2
- package/build/assets/{index-429abb41.js.map → index-04bee0e3.js.map} +1 -1
- package/build/assets/index-6cba7ffb.js +2 -0
- package/build/assets/index-6cba7ffb.js.map +1 -0
- package/build/assets/index-de8060f3.js +9 -0
- package/build/assets/index-de8060f3.js.map +1 -0
- package/build/assets/{useUser-93a51119.js → useUser-46c889c3.js} +2 -2
- package/build/assets/{useUser-93a51119.js.map → useUser-46c889c3.js.map} +1 -1
- package/build/index.html +1 -1
- package/package.json +30 -30
- package/build/assets/AppRoot-92ccf013.js +0 -5
- package/build/assets/AppRoot-92ccf013.js.map +0 -1
- package/build/assets/ControlType-7c0baaa0.js +0 -22
- package/build/assets/ControlType-7c0baaa0.js.map +0 -1
- package/build/assets/FontBootstrap-198bc02a.js +0 -4
- package/build/assets/FontBootstrap-198bc02a.js.map +0 -1
- package/build/assets/GridRenderer-ecdfd753.js +0 -2
- package/build/assets/GridRenderer-ecdfd753.js.map +0 -1
- package/build/assets/IrisGrid-3f213496.js +0 -3
- package/build/assets/IrisGrid-3f213496.js.map +0 -1
- package/build/assets/IrisGridShortcuts-71bf0b60.js +0 -2
- package/build/assets/IrisGridShortcuts-71bf0b60.js.map +0 -1
- package/build/assets/IrisGridThemeProvider-74374677.js +0 -11
- package/build/assets/IrisGridThemeProvider-74374677.js.map +0 -1
- package/build/assets/index-6c176a84.js +0 -9
- package/build/assets/index-6c176a84.js.map +0 -1
- package/build/assets/index-97e41698.js +0 -2
- package/build/assets/index-97e41698.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{bJ as O,I as R,J as L,K as h}from"./vendor-323142a4.js";import{T as A,L as I}from"./index-04bee0e3.js";import{r as l,aZ as o,K as c}from"./ControlType-43d413ba.js";class v{static reorder(r,t,n,i){var a=r===n?v.adjustDestinationIndex(i,t):i,s=v.removeItems(r,t);return n.splice(a,0,...s),s}static removeItems(r,t){for(var n=[],i=t.map((T,p)=>({range:T,index:p})).sort((T,p)=>p.range[0]-T.range[0]),a=0;a<i.length;a+=1){var{range:s,index:d}=i[a],[u,g]=s;n[d]=r.splice(u,g-u+1)}return O(n)}static adjustDestinationIndex(r,t){for(var n=r,i=0;i<t.length;i+=1){var[a,s]=t[i];if(a>r)break;n-=Math.min(s,r-1)-a+1}return n}static startDragging(){document.documentElement.classList.add("drag-pointer-events-none")}static stopDragging(){document.documentElement.classList.remove("drag-pointer-events-none")}}const K=v;var b=["direction","className","timeout"];function S(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),t.push.apply(t,n)}return t}function y(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{};r%2?S(Object(t),!0).forEach(function(n){C(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):S(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function C(e,r,t){return r=P(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function P(e){var r=w(e,"string");return typeof r=="symbol"?r:String(r)}function w(e,r){if(typeof e!="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function _(e,r){if(e==null)return{};var t=D(e,r),n,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)n=a[i],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function D(e,r){if(e==null)return{};var t={},n=Object.keys(e),i,a;for(a=0;a<n.length;a++)i=n[a],!(r.indexOf(i)>=0)&&(t[i]=e[i]);return t}function $(e){var{direction:r="left",className:t,timeout:n=A.transitionMidMs}=e,i=_(e,b);return R.jsx(L,y({timeout:n,classNames:h("slide-".concat(r),t)},i))}function E(e,r,t,n,i,a,s){try{var d=e[a](s),u=d.value}catch(g){t(g);return}d.done?r(u):Promise.resolve(u).then(n,i)}function j(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function s(u){E(a,n,i,s,d,"next",u)}function d(u){E(a,n,i,s,d,"throw",u)}s(void 0)})}}function F(e,r,t){return r=G(r),r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function G(e){var r=M(e,"string");return typeof r=="symbol"?r:String(r)}function M(e,r){if(typeof e!="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}var m=I.module("DownloadServiceWorkerUtils");class f{static register(r){f.serviceWorkerRegistration&&f.unregisterSW(),"serviceWorker"in navigator?navigator.serviceWorker.register(r).then(t=>{t.update(),f.serviceWorkerRegistration=t,m.info("Registering service worker on ",r,t)}).catch(t=>{m.error("Failed to register service worker",t)}):m.info("Service worker is not supported.")}static getServiceWorker(){return j(function*(){if("serviceWorker"in navigator){var r=f.serviceWorkerRegistration;if(r&&r.active)return m.info("Download service worker is active."),r.active;throw new Error("Can not find download service worker.")}throw new Error("Download service worker is not available.")})()}static unregisterSW(){var r;(r=f.serviceWorkerRegistration)===null||r===void 0||r.unregister()}}F(f,"serviceWorkerRegistration",null);const U=f;var W={TOGGLE_QUICK_FILTER:l.createAndAdd({id:"TABLE.TOGGLE_QUICK_FILTER",name:"Toggle Quick Filter",shortcut:[o.CTRL,c.F],macShortcut:[o.CMD,c.F]}),CLEAR_ALL_FILTERS:l.createAndAdd({id:"TABLE.CLEAR_ALL_FILTERS",name:"Clear All Table Filters",shortcut:[o.CTRL,c.E],macShortcut:[o.CMD,c.E]}),CLEAR_FILTERS:l.createAndAdd({id:"TABLE.CLEAR_FILTERS",name:"Clear Active Table Filters",shortcut:[o.CTRL,o.SHIFT,c.E],macShortcut:[o.CMD,o.SHIFT,c.E]}),REVERSE:l.createAndAdd({id:"TABLE.REVERSE",name:"Reverse",shortcut:[o.CTRL,c.I],macShortcut:[o.CMD,c.I]}),TOGGLE_SEARCH:l.createAndAdd({id:"TABLE.TOGGLE_SEARCH",name:"Toggle Search",shortcut:[o.CTRL,o.SHIFT,c.F],macShortcut:[o.CMD,o.SHIFT,c.F]}),GOTO_ROW:l.createAndAdd({id:"TABLE.GOTO_ROW",name:"Go to Row",shortcut:[o.CTRL,c.G],macShortcut:[o.CMD,c.G]})},k={COMMIT:l.createAndAdd({id:"INPUT_TABLE.COMMIT",name:"Commit",shortcut:[o.CTRL,c.S],macShortcut:[o.CMD,c.S]}),DISCARD:l.createAndAdd({id:"INPUT_TABLE.DISCARD",name:"Discard",shortcut:[o.CTRL,o.ALT,c.S],macShortcut:[o.CMD,o.OPTION,c.S]})},x={TABLE:W,INPUT_TABLE:k};const Q=x;export{U as D,Q as I,$ as S,K as a};
|
|
2
|
+
//# sourceMappingURL=IrisGridShortcuts-929f2007.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IrisGridShortcuts-929f2007.js","sources":["../../../components/dist/DragUtils.js","../../../components/dist/transitions/SlideTransition.js","../../../iris-grid/dist/sidebar/DownloadServiceWorkerUtils.js","../../../iris-grid/dist/IrisGridShortcuts.js"],"sourcesContent":["import flatten from 'lodash.flatten';\nclass DragUtils {\n /**\n * Re-orders the provided item lists in place based on the selectedRanges and destinationIndex provided\n * @param sourceList Array of the source items\n * @param selectedRanges Array of the selected ranges in the source list\n * @param destinationList Destination items. If dragging within the same list, set it to sourceItems\n * @param destinationIndex The index items are being dropped in the destinationList, adjusted for the removed items\n * @returns The items that were dragged\n */\n static reorder(sourceList, selectedRanges, destinationList, destinationIndex) {\n var insertIndex = sourceList === destinationList ? DragUtils.adjustDestinationIndex(destinationIndex, selectedRanges) : destinationIndex;\n var draggedItems = DragUtils.removeItems(sourceList, selectedRanges);\n destinationList.splice(insertIndex, 0, ...draggedItems);\n return draggedItems;\n }\n\n /**\n * Removes the provided ranges from the list in place\n * @param list Array of items to remove the ranges.\n * @param ranges Array of the ranges to remove.\n * @returns The removed items, in the order of the ranges removed.\n */\n static removeItems(list, ranges) {\n var items = [];\n\n // Sort them in reverse, so we don't screw up the range indexes\n var sortedRanges = ranges.map((range, index) => ({\n range,\n index\n })).sort((a, b) => b.range[0] - a.range[0]);\n for (var i = 0; i < sortedRanges.length; i += 1) {\n var {\n range,\n index\n } = sortedRanges[i];\n var [start, end] = range;\n items[index] = list.splice(start, end - start + 1);\n }\n return flatten(items);\n }\n\n /**\n * Adjusts the destination index for when dropping into the same list you're dragging from.\n * @param destinationIndex The original destination index\n * @param ranges The ranges that are moving\n * @returns Index where item should be inserted after all ranges are removed\n */\n static adjustDestinationIndex(destinationIndex, ranges) {\n var adjustedIndex = destinationIndex;\n for (var i = 0; i < ranges.length; i += 1) {\n var [start, end] = ranges[i];\n if (start > destinationIndex) {\n break;\n }\n adjustedIndex -= Math.min(end, destinationIndex - 1) - start + 1;\n }\n return adjustedIndex;\n }\n static startDragging() {\n document.documentElement.classList.add('drag-pointer-events-none');\n }\n static stopDragging() {\n document.documentElement.classList.remove('drag-pointer-events-none');\n }\n}\nexport default DragUtils;\n//# sourceMappingURL=DragUtils.js.map","var _excluded = [\"direction\", \"className\", \"timeout\"];\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n// SlideTransition class uses CSSTransition with slide-left and slide-right classNames, depending on the prop direction. The transition is 250ms long.\n//\nimport CSSTransition from 'react-transition-group/CSSTransition';\nimport classNames from 'classnames';\nimport ThemeExport from \"../ThemeExport.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n/**\n * Slides one component overtop of another component.\n * Defaults to sliding left, unless `direction='right'` is provided.\n * Timeout defaults to 200ms.\n */\nfunction SlideTransition(_ref) {\n var {\n direction = 'left',\n className,\n /** Defaults to mid */\n timeout = ThemeExport.transitionMidMs\n } = _ref,\n props = _objectWithoutProperties(_ref, _excluded);\n return /*#__PURE__*/_jsx(CSSTransition, _objectSpread({\n timeout: timeout,\n classNames: classNames(\"slide-\".concat(direction), className)\n // eslint-disable-next-line react/jsx-props-no-spreading\n }, props));\n}\nexport default SlideTransition;\n//# sourceMappingURL=SlideTransition.js.map","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport Log from '@deephaven/log';\nvar log = Log.module('DownloadServiceWorkerUtils');\nclass DownloadServiceWorkerUtils {\n /**\n * Register the download service worker at the specified URL\n * Will unregister any existing service worker if register is called multiple times\n * @param url The URL of the service worker file\n */\n static register(url) {\n if (DownloadServiceWorkerUtils.serviceWorkerRegistration) {\n DownloadServiceWorkerUtils.unregisterSW();\n }\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.register(url).then(reg => {\n reg.update();\n DownloadServiceWorkerUtils.serviceWorkerRegistration = reg;\n log.info('Registering service worker on ', url, reg);\n }).catch(err => {\n log.error('Failed to register service worker', err);\n });\n } else {\n log.info('Service worker is not supported.');\n }\n }\n static getServiceWorker() {\n return _asyncToGenerator(function* () {\n if ('serviceWorker' in navigator) {\n var swReg = DownloadServiceWorkerUtils.serviceWorkerRegistration;\n if (swReg && swReg.active) {\n log.info('Download service worker is active.');\n return swReg.active;\n }\n throw new Error('Can not find download service worker.');\n }\n throw new Error('Download service worker is not available.');\n })();\n }\n static unregisterSW() {\n var _DownloadServiceWorke;\n (_DownloadServiceWorke = DownloadServiceWorkerUtils.serviceWorkerRegistration) === null || _DownloadServiceWorke === void 0 ? void 0 : _DownloadServiceWorke.unregister();\n }\n}\n_defineProperty(DownloadServiceWorkerUtils, \"serviceWorkerRegistration\", null);\nexport default DownloadServiceWorkerUtils;\n//# sourceMappingURL=DownloadServiceWorkerUtils.js.map","import { ShortcutRegistry, MODIFIER, KEY } from '@deephaven/components';\nvar TABLE = {\n TOGGLE_QUICK_FILTER: ShortcutRegistry.createAndAdd({\n id: 'TABLE.TOGGLE_QUICK_FILTER',\n name: 'Toggle Quick Filter',\n shortcut: [MODIFIER.CTRL, KEY.F],\n macShortcut: [MODIFIER.CMD, KEY.F]\n }),\n CLEAR_ALL_FILTERS: ShortcutRegistry.createAndAdd({\n id: 'TABLE.CLEAR_ALL_FILTERS',\n name: 'Clear All Table Filters',\n shortcut: [MODIFIER.CTRL, KEY.E],\n macShortcut: [MODIFIER.CMD, KEY.E]\n }),\n CLEAR_FILTERS: ShortcutRegistry.createAndAdd({\n id: 'TABLE.CLEAR_FILTERS',\n name: 'Clear Active Table Filters',\n shortcut: [MODIFIER.CTRL, MODIFIER.SHIFT, KEY.E],\n macShortcut: [MODIFIER.CMD, MODIFIER.SHIFT, KEY.E]\n }),\n REVERSE: ShortcutRegistry.createAndAdd({\n id: 'TABLE.REVERSE',\n name: 'Reverse',\n shortcut: [MODIFIER.CTRL, KEY.I],\n macShortcut: [MODIFIER.CMD, KEY.I]\n }),\n TOGGLE_SEARCH: ShortcutRegistry.createAndAdd({\n id: 'TABLE.TOGGLE_SEARCH',\n name: 'Toggle Search',\n shortcut: [MODIFIER.CTRL, MODIFIER.SHIFT, KEY.F],\n macShortcut: [MODIFIER.CMD, MODIFIER.SHIFT, KEY.F]\n }),\n GOTO_ROW: ShortcutRegistry.createAndAdd({\n id: 'TABLE.GOTO_ROW',\n name: 'Go to Row',\n shortcut: [MODIFIER.CTRL, KEY.G],\n macShortcut: [MODIFIER.CMD, KEY.G]\n })\n};\nvar INPUT_TABLE = {\n COMMIT: ShortcutRegistry.createAndAdd({\n id: 'INPUT_TABLE.COMMIT',\n name: 'Commit',\n shortcut: [MODIFIER.CTRL, KEY.S],\n macShortcut: [MODIFIER.CMD, KEY.S]\n }),\n DISCARD: ShortcutRegistry.createAndAdd({\n id: 'INPUT_TABLE.DISCARD',\n name: 'Discard',\n shortcut: [MODIFIER.CTRL, MODIFIER.ALT, KEY.S],\n macShortcut: [MODIFIER.CMD, MODIFIER.OPTION, KEY.S]\n })\n};\nvar IRIS_GRID_SHORTCUTS = {\n TABLE,\n INPUT_TABLE\n};\nexport default IRIS_GRID_SHORTCUTS;\n//# sourceMappingURL=IrisGridShortcuts.js.map"],"names":["DragUtils","sourceList","selectedRanges","destinationList","destinationIndex","insertIndex","draggedItems","list","ranges","items","sortedRanges","range","index","a","b","i","start","end","flatten","adjustedIndex","DragUtils$1","_excluded","ownKeys","object","enumerableOnly","keys","symbols","sym","_objectSpread","target","source","key","_defineProperty","obj","value","_toPropertyKey","arg","_toPrimitive","input","hint","prim","res","_objectWithoutProperties","excluded","_objectWithoutPropertiesLoose","sourceSymbolKeys","sourceKeys","SlideTransition","_ref","direction","className","timeout","ThemeExport","props","_jsx","CSSTransition","classNames","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","_asyncToGenerator","fn","self","args","err","log","Log","DownloadServiceWorkerUtils","url","reg","swReg","_DownloadServiceWorke","DownloadServiceWorkerUtils$1","TABLE","ShortcutRegistry","MODIFIER","KEY","INPUT_TABLE","IRIS_GRID_SHORTCUTS","IRIS_GRID_SHORTCUTS$1"],"mappings":"2KACA,MAAMA,CAAU,CASd,OAAO,QAAQC,EAAYC,EAAgBC,EAAiBC,EAAkB,CAC5E,IAAIC,EAAcJ,IAAeE,EAAkBH,EAAU,uBAAuBI,EAAkBF,CAAc,EAAIE,EACpHE,EAAeN,EAAU,YAAYC,EAAYC,CAAc,EACnE,OAAAC,EAAgB,OAAOE,EAAa,EAAG,GAAGC,CAAY,EAC/CA,CACR,CAQD,OAAO,YAAYC,EAAMC,EAAQ,CAQ/B,QAPIC,EAAQ,CAAA,EAGRC,EAAeF,EAAO,IAAI,CAACG,EAAOC,KAAW,CAC/C,MAAAD,EACA,MAAAC,CACD,EAAC,EAAE,KAAK,CAACC,EAAGC,IAAMA,EAAE,MAAM,CAAC,EAAID,EAAE,MAAM,CAAC,CAAC,EACjCE,EAAI,EAAGA,EAAIL,EAAa,OAAQK,GAAK,EAAG,CAC/C,GAAI,CACF,MAAAJ,EACA,MAAAC,CACR,EAAUF,EAAaK,CAAC,EACd,CAACC,EAAOC,CAAG,EAAIN,EACnBF,EAAMG,CAAK,EAAIL,EAAK,OAAOS,EAAOC,EAAMD,EAAQ,CAAC,CAClD,CACD,OAAOE,EAAQT,CAAK,CACrB,CAQD,OAAO,uBAAuBL,EAAkBI,EAAQ,CAEtD,QADIW,EAAgBf,EACX,EAAI,EAAG,EAAII,EAAO,OAAQ,GAAK,EAAG,CACzC,GAAI,CAACQ,EAAOC,CAAG,EAAIT,EAAO,CAAC,EAC3B,GAAIQ,EAAQZ,EACV,MAEFe,GAAiB,KAAK,IAAIF,EAAKb,EAAmB,CAAC,EAAIY,EAAQ,CAChE,CACD,OAAOG,CACR,CACD,OAAO,eAAgB,CACrB,SAAS,gBAAgB,UAAU,IAAI,0BAA0B,CAClE,CACD,OAAO,cAAe,CACpB,SAAS,gBAAgB,UAAU,OAAO,0BAA0B,CACrE,CACH,CACA,MAAAC,EAAepB,EClEf,IAAIqB,EAAY,CAAC,YAAa,YAAa,SAAS,EACpD,SAASC,EAAQC,EAAQC,EAAgB,CAAE,IAAIC,EAAO,OAAO,KAAKF,CAAM,EAAG,GAAI,OAAO,sBAAuB,CAAE,IAAIG,EAAU,OAAO,sBAAsBH,CAAM,EAAGC,IAAmBE,EAAUA,EAAQ,OAAO,SAAUC,EAAK,CAAE,OAAO,OAAO,yBAAyBJ,EAAQI,CAAG,EAAE,UAAW,CAAE,GAAIF,EAAK,KAAK,MAAMA,EAAMC,CAAO,CAAE,CAAG,OAAOD,CAAO,CACrV,SAASG,EAAcC,EAAQ,CAAE,QAASd,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CAAE,IAAIe,EAAiB,UAAUf,CAAC,GAAnB,KAAuB,UAAUA,CAAC,EAAI,CAAE,EAAEA,EAAI,EAAIO,EAAQ,OAAOQ,CAAM,EAAG,EAAE,EAAE,QAAQ,SAAUC,EAAK,CAAEC,EAAgBH,EAAQE,EAAKD,EAAOC,CAAG,CAAC,CAAI,CAAA,EAAI,OAAO,0BAA4B,OAAO,iBAAiBF,EAAQ,OAAO,0BAA0BC,CAAM,CAAC,EAAIR,EAAQ,OAAOQ,CAAM,CAAC,EAAE,QAAQ,SAAUC,EAAK,CAAE,OAAO,eAAeF,EAAQE,EAAK,OAAO,yBAAyBD,EAAQC,CAAG,CAAC,CAAE,CAAE,CAAI,CAAC,OAAOF,CAAS,CAC1f,SAASG,EAAgBC,EAAKF,EAAKG,EAAO,CAAE,OAAAH,EAAMI,EAAeJ,CAAG,EAAOA,KAAOE,EAAO,OAAO,eAAeA,EAAKF,EAAK,CAAE,MAAOG,EAAO,WAAY,GAAM,aAAc,GAAM,SAAU,EAAM,CAAA,EAAYD,EAAIF,CAAG,EAAIG,EAAgBD,CAAM,CAC5O,SAASE,EAAeC,EAAK,CAAE,IAAIL,EAAMM,EAAaD,EAAK,QAAQ,EAAG,OAAO,OAAOL,GAAQ,SAAWA,EAAM,OAAOA,CAAG,CAAI,CAC3H,SAASM,EAAaC,EAAOC,EAAM,CAAE,GAAI,OAAOD,GAAU,UAAYA,IAAU,KAAM,OAAOA,EAAO,IAAIE,EAAOF,EAAM,OAAO,WAAW,EAAG,GAAIE,IAAS,OAAW,CAAE,IAAIC,EAAMD,EAAK,KAAKF,EAAOC,GAAQ,SAAS,EAAG,GAAI,OAAOE,GAAQ,SAAU,OAAOA,EAAK,MAAM,IAAI,UAAU,8CAA8C,CAAI,CAAC,OAAQF,IAAS,SAAW,OAAS,QAAQD,CAAK,CAAI,CACzX,SAASI,EAAyBZ,EAAQa,EAAU,CAAE,GAAIb,GAAU,KAAM,MAAO,GAAI,IAAID,EAASe,EAA8Bd,EAAQa,CAAQ,EAAOZ,EAAK,EAAG,GAAI,OAAO,sBAAuB,CAAE,IAAIc,EAAmB,OAAO,sBAAsBf,CAAM,EAAG,IAAK,EAAI,EAAG,EAAIe,EAAiB,OAAQ,IAAOd,EAAMc,EAAiB,CAAC,EAAO,EAAAF,EAAS,QAAQZ,CAAG,GAAK,IAAkB,OAAO,UAAU,qBAAqB,KAAKD,EAAQC,CAAG,IAAaF,EAAOE,CAAG,EAAID,EAAOC,CAAG,EAAI,CAAG,OAAOF,CAAS,CAC5e,SAASe,EAA8Bd,EAAQa,EAAU,CAAE,GAAIb,GAAU,KAAM,MAAO,CAAE,EAAE,IAAID,EAAS,CAAE,EAAMiB,EAAa,OAAO,KAAKhB,CAAM,EAAOC,EAAKhB,EAAG,IAAKA,EAAI,EAAGA,EAAI+B,EAAW,OAAQ/B,IAAOgB,EAAMe,EAAW/B,CAAC,EAAO,EAAA4B,EAAS,QAAQZ,CAAG,GAAK,KAAaF,EAAOE,CAAG,EAAID,EAAOC,CAAG,GAAK,OAAOF,CAAS,CAYnT,SAASkB,EAAgBC,EAAM,CAC7B,GAAI,CACA,UAAAC,EAAY,OACZ,UAAAC,EAEA,QAAAC,EAAUC,EAAY,eAC5B,EAAQJ,EACJK,EAAQX,EAAyBM,EAAM3B,CAAS,EAClD,OAAoBiC,EAAI,IAACC,EAAe3B,EAAc,CACpD,QAASuB,EACT,WAAYK,EAAW,SAAS,OAAOP,CAAS,EAAGC,CAAS,CAEhE,EAAKG,CAAK,CAAC,CACX,CChCA,SAASI,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ/B,EAAKK,EAAK,CAAE,GAAI,CAAE,IAAI2B,EAAOL,EAAI3B,CAAG,EAAEK,CAAG,EAAOF,EAAQ6B,EAAK,YAAgBC,EAAO,CAAEJ,EAAOI,CAAK,EAAG,MAAS,CAAKD,EAAK,KAAQJ,EAAQzB,CAAK,EAAY,QAAQ,QAAQA,CAAK,EAAE,KAAK2B,EAAOC,CAAM,CAAM,CACzQ,SAASG,EAAkBC,EAAI,CAAE,OAAO,UAAY,CAAE,IAAIC,EAAO,KAAMC,EAAO,UAAW,OAAO,IAAI,QAAQ,SAAUT,EAASC,EAAQ,CAAE,IAAIF,EAAMQ,EAAG,MAAMC,EAAMC,CAAI,EAAG,SAASP,EAAM3B,EAAO,CAAEuB,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ,OAAQ5B,CAAK,CAAI,CAAC,SAAS4B,EAAOO,EAAK,CAAEZ,EAAmBC,EAAKC,EAASC,EAAQC,EAAOC,EAAQ,QAASO,CAAG,EAAKR,EAAM,MAAS,EAAI,CAAI,CAAG,CACrY,SAAS7B,EAAgBC,EAAKF,EAAKG,EAAO,CAAE,OAAAH,EAAMI,EAAeJ,CAAG,EAAOA,KAAOE,EAAO,OAAO,eAAeA,EAAKF,EAAK,CAAE,MAAOG,EAAO,WAAY,GAAM,aAAc,GAAM,SAAU,EAAM,CAAA,EAAYD,EAAIF,CAAG,EAAIG,EAAgBD,CAAM,CAC5O,SAASE,EAAeC,EAAK,CAAE,IAAIL,EAAMM,EAAaD,EAAK,QAAQ,EAAG,OAAO,OAAOL,GAAQ,SAAWA,EAAM,OAAOA,CAAG,CAAI,CAC3H,SAASM,EAAaC,EAAOC,EAAM,CAAE,GAAI,OAAOD,GAAU,UAAYA,IAAU,KAAM,OAAOA,EAAO,IAAIE,EAAOF,EAAM,OAAO,WAAW,EAAG,GAAIE,IAAS,OAAW,CAAE,IAAIC,EAAMD,EAAK,KAAKF,EAAOC,GAAQ,SAAS,EAAG,GAAI,OAAOE,GAAQ,SAAU,OAAOA,EAAK,MAAM,IAAI,UAAU,8CAA8C,CAAI,CAAC,OAAQF,IAAS,SAAW,OAAS,QAAQD,CAAK,CAAI,CAEzX,IAAIgC,EAAMC,EAAI,OAAO,4BAA4B,EACjD,MAAMC,CAA2B,CAM/B,OAAO,SAASC,EAAK,CACfD,EAA2B,2BAC7BA,EAA2B,aAAY,EAErC,kBAAmB,UACrB,UAAU,cAAc,SAASC,CAAG,EAAE,KAAKC,GAAO,CAChDA,EAAI,OAAM,EACVF,EAA2B,0BAA4BE,EACvDJ,EAAI,KAAK,iCAAkCG,EAAKC,CAAG,CAC3D,CAAO,EAAE,MAAML,GAAO,CACdC,EAAI,MAAM,oCAAqCD,CAAG,CAC1D,CAAO,EAEDC,EAAI,KAAK,kCAAkC,CAE9C,CACD,OAAO,kBAAmB,CACxB,OAAOL,EAAkB,WAAa,CACpC,GAAI,kBAAmB,UAAW,CAChC,IAAIU,EAAQH,EAA2B,0BACvC,GAAIG,GAASA,EAAM,OACjB,OAAAL,EAAI,KAAK,oCAAoC,EACtCK,EAAM,OAEf,MAAM,IAAI,MAAM,uCAAuC,CACxD,CACD,MAAM,IAAI,MAAM,2CAA2C,CAC5D,CAAA,GACF,CACD,OAAO,cAAe,CACpB,IAAIC,GACHA,EAAwBJ,EAA2B,6BAA+B,MAAQI,IAA0B,QAAkBA,EAAsB,WAAU,CACxK,CACH,CACA5C,EAAgBwC,EAA4B,4BAA6B,IAAI,EAC7E,MAAAK,EAAeL,EC/Cf,IAAIM,EAAQ,CACV,oBAAqBC,EAAiB,aAAa,CACjD,GAAI,4BACJ,KAAM,sBACN,SAAU,CAACC,EAAS,KAAMC,EAAI,CAAC,EAC/B,YAAa,CAACD,EAAS,IAAKC,EAAI,CAAC,CACrC,CAAG,EACD,kBAAmBF,EAAiB,aAAa,CAC/C,GAAI,0BACJ,KAAM,0BACN,SAAU,CAACC,EAAS,KAAMC,EAAI,CAAC,EAC/B,YAAa,CAACD,EAAS,IAAKC,EAAI,CAAC,CACrC,CAAG,EACD,cAAeF,EAAiB,aAAa,CAC3C,GAAI,sBACJ,KAAM,6BACN,SAAU,CAACC,EAAS,KAAMA,EAAS,MAAOC,EAAI,CAAC,EAC/C,YAAa,CAACD,EAAS,IAAKA,EAAS,MAAOC,EAAI,CAAC,CACrD,CAAG,EACD,QAASF,EAAiB,aAAa,CACrC,GAAI,gBACJ,KAAM,UACN,SAAU,CAACC,EAAS,KAAMC,EAAI,CAAC,EAC/B,YAAa,CAACD,EAAS,IAAKC,EAAI,CAAC,CACrC,CAAG,EACD,cAAeF,EAAiB,aAAa,CAC3C,GAAI,sBACJ,KAAM,gBACN,SAAU,CAACC,EAAS,KAAMA,EAAS,MAAOC,EAAI,CAAC,EAC/C,YAAa,CAACD,EAAS,IAAKA,EAAS,MAAOC,EAAI,CAAC,CACrD,CAAG,EACD,SAAUF,EAAiB,aAAa,CACtC,GAAI,iBACJ,KAAM,YACN,SAAU,CAACC,EAAS,KAAMC,EAAI,CAAC,EAC/B,YAAa,CAACD,EAAS,IAAKC,EAAI,CAAC,CACrC,CAAG,CACH,EACIC,EAAc,CAChB,OAAQH,EAAiB,aAAa,CACpC,GAAI,qBACJ,KAAM,SACN,SAAU,CAACC,EAAS,KAAMC,EAAI,CAAC,EAC/B,YAAa,CAACD,EAAS,IAAKC,EAAI,CAAC,CACrC,CAAG,EACD,QAASF,EAAiB,aAAa,CACrC,GAAI,sBACJ,KAAM,UACN,SAAU,CAACC,EAAS,KAAMA,EAAS,IAAKC,EAAI,CAAC,EAC7C,YAAa,CAACD,EAAS,IAAKA,EAAS,OAAQC,EAAI,CAAC,CACtD,CAAG,CACH,EACIE,EAAsB,CACxB,MAAAL,EACA,YAAAI,CACF,EACA,MAAAE,EAAeD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{r as C,I as o,K as $,L as W,bb as We,Z as we,ba as Ct,bc as Zr,_ as Qe,T as Qr,U as oe,M as Je,bK as St,bL as re,bM as wt,bN as Ot,bO as yt,bP as xt,bQ as _e,bR as It,bS as jt,bT as Dt,bU as er,bV as Pt,bW as rr,bX as Nt,bY as Tt,bZ as Et,b_ as Rt,b$ as At,c0 as Mt,ah as Le,$ as kt}from"./vendor-323142a4.js";import{L as be,b8 as Ft,an as Jr,f as ye,g as ze,T as K,b9 as Ve,ba as Ke,ar as _t,ap as et,u as Lt,bb as Ht,as as rt,aj as Ee,ak as Gt,I as tt,e as k,aG as Ut,bc as $t,G as tr,n as Bt,bd as nt,be as at,v as Wt,bf as zt,K as Vt,b5 as Kt,bg as qt,bh as Xt,bi as Yt,bj as Zt,bk as Qt,d as Jt,az as en,bl as rn,aW as Z,a9 as tn,a3 as nn,aN as an}from"./index-04bee0e3.js";import{S as on,b as nr,m as ln,I as it,C as ue}from"./MissingPartitionError-b63f09c6.js";import{a as ne}from"./IrisGridShortcuts-929f2007.js";import{b as ee,O as ot,h as sn,T as dn,i as lt,j as un,k as cn,G as hn}from"./GridRenderer-7b447c86.js";import{B as N,S as Oe,c as V,C as ce,x as vn,aU as mn,ac as gn,D as qe,Q as st,s as He,d as fn,P as pn,cj as bn,u as Cn,ak as Sn,b2 as wn}from"./ControlType-43d413ba.js";import{R as Xe,a as he,c as me,d as ge,G as M,m as dt}from"./IrisGridModel-3cc97aec.js";import{e as On}from"./monaco-b5248072.js";import{F as yn}from"./FormatterUtils-dbab8b84.js";function ar(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ir(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ar(Object(r),!0).forEach(function(n){xn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ar(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function xn(t,e,r){return e=In(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function In(t){var e=jn(t,"string");return typeof e=="symbol"?e:String(e)}function jn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var or=be.module("Aggregations");function Qi(t){var{isRollup:e,settings:r,onChange:n,onEdit:a}=t,{aggregations:i,showOnTop:l}=r,s=C.useMemo(()=>on.filter(w=>!i.some(I=>I.operation===w)),[i]),[u,d]=C.useState(s[0]),[c,h]=C.useState([]),m=C.useCallback(w=>{n(ir(ir({},r),w))},[n,r]),v=C.useCallback(w=>{m({aggregations:w})},[m]),g=C.useCallback(w=>{m({showOnTop:w})},[m]),f=C.useCallback(()=>{or.debug("handleDragStart"),ne.startDragging()},[]),b=C.useCallback(w=>{var{destination:I,source:E}=w;if(or.debug("handleDragEnd",I,E),ne.stopDragging(),I!==null){var L=I.index;E.index<I.index&&(L+=1);var _=[...i],F=ne.reorder(_,c,_,L),U=ne.adjustDestinationIndex(L,c),G=[[U,U+F.length-1]];v(_),h(G)}},[v,i,c,h]),p=C.useCallback(w=>{d(w)},[d]),O=C.useCallback(()=>{v([...i,{operation:u,selected:[],invert:!0}])},[i,u,v]),S=C.useCallback(w=>{v(i.filter((I,E)=>E!==w))},[i,v]),D=C.useCallback(w=>{h(w)},[h]),y=C.useCallback(w=>{var I=i[w];nr.isRollupOperation(I.operation)||a(I)},[i,a]),j=C.useCallback(w=>{g(w.target.value==="true")},[g]);C.useEffect(function(){s.length>0&&!s.includes(u)&&d(s[0])},[s,u]);var T=C.useCallback(w=>{var{item:I,itemIndex:E,isClone:L=!1,selectedCount:_}=w,F=I.operation,U=L?"".concat(_):void 0,G=L?"item-list-item-clone":void 0,B=nr.isRollupOperation(I.operation),ae=!L&&!B;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:$("item-list-item-content","draggable-item-list-item-content",G),children:[o.jsxs("span",{className:"title",children:[F,!e&&B&&o.jsxs("span",{className:"small text-warning",children:[o.jsx(W,{icon:Ft})," Requires rollup"]})]}),ee.renderBadge({text:U}),ee.renderHandle()]}),!L&&o.jsxs(o.Fragment,{children:[o.jsx(N,{kind:"ghost",className:"btn-edit",icon:Jr,tooltip:"Edit Columns",onClick:()=>a(I),disabled:!ae}),o.jsx(N,{kind:"ghost",className:"btn-delete",icon:ye,tooltip:"Delete Aggregation",onClick:()=>S(E)})]})]})},[S,a,e]),A=s.length>0,x=i.length>0;return o.jsxs("div",{className:"aggregations",children:[A&&o.jsxs("div",{className:"form-inline",children:[o.jsx(Oe,{onChange:p,value:u,children:s.map(w=>o.jsx(ot,{value:w,children:w},w))}),o.jsxs("button",{type:"button",className:"btn btn-link btn-add",onClick:O,children:[o.jsx(W,{icon:ze}),"Add Aggregation"]})]}),A&&x&&o.jsx("hr",{}),x&&o.jsxs(o.Fragment,{children:[!e&&o.jsxs("div",{className:"form-inline",children:[o.jsx("label",{children:"Placement: "}),o.jsxs(Xe,{onChange:j,value:"".concat(l),children:[o.jsx(he,{value:"true",children:"Top"}),o.jsx(he,{value:"false",children:"Bottom"})]})]}),o.jsx(We,{onDragStart:f,onDragEnd:b,children:o.jsx(ee,{className:"selected-aggregations",itemCount:i.length,items:i,renderItem:T,offset:0,onSelectionChange:D,onSelect:y,selectedRanges:c,isMultiSelect:!0})})]})]})}function lr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ie(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?lr(Object(r),!0).forEach(function(n){Dn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):lr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Dn(t,e,r){return e=Pn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Pn(t){var e=Nn(t,"string");return typeof e=="symbol"?e:String(e)}function Nn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Q;(function(t){t[t.NONE=0]="NONE",t[t.ASCENDING=1]="ASCENDING",t[t.DESCENDING=2]="DESCENDING"})(Q||(Q={}));var Tn=30;function Ji(t){var{aggregation:e,columns:r,onChange:n}=t,[a,i]=C.useState(-1),[l,s]=C.useState(-1),[u,d]=C.useState(Q.NONE),{invert:c,selected:h}=e,m=C.useRef(null),v=C.useCallback(j=>h.includes(j)?!c:c,[c,h]),g=C.useMemo(()=>{var j=ln(r,e.operation);return u!==Q.NONE&&(j=V.sortColumns(j,u===Q.ASCENDING)),j},[r,e.operation,u]),f=C.useMemo(()=>a>=0?g.slice(a,l+1).map(j=>({value:j.name,displayValue:j.name,isSelected:v(j.name)})):[],[g,v,l,a]),b=C.useCallback(j=>{var{name:T}=g[j],A=h.indexOf(T),x=[...h],w=c;A>=0?x.splice(A,1):(x.push(T),x.length===g.length&&(x=[],w=!c)),n(ie(ie({},e),{},{selected:x,invert:w}))},[e,c,g,h,n]),p=C.useCallback(()=>{d(Q.NONE),n(ie(ie({},e),{},{selected:[],invert:!0}))},[e,n]),O=C.useCallback((j,T)=>{i(j),s(T)},[i,s]),S=C.useCallback(()=>{h.length===0?n(ie(ie({},e),{},{invert:!c})):n(ie(ie({},e),{},{selected:[],invert:!0}))},[e,c,n,h]),D=h.length===0?c:null,y=h.length!==0||!c||u!==Q.NONE;return o.jsxs("div",{role:"menu",className:"aggregation-edit",children:[o.jsx("div",{className:"top-menu",children:o.jsxs("div",{className:"form-inline",children:[o.jsx(ce,{checked:D,onChange:S,children:"Toggle All"}),o.jsx("div",{className:"spacer"}),o.jsx(vn,{in:y,timeout:K.transitionSlowMs,mountOnEnter:!0,unmountOnExit:!0,children:o.jsx(N,{kind:"ghost",className:"btn-reset",onClick:p,children:"Reset"})}),o.jsx(N,{kind:"ghost",className:$({active:u===Q.ASCENDING}),icon:Ve,tooltip:"Sort ascending",onClick:()=>d(Q.ASCENDING)}),o.jsx(N,{kind:"ghost",className:$({active:u===Q.DESCENDING}),icon:Ke,tooltip:"Sort descending",onClick:()=>d(Q.DESCENDING)})]})}),o.jsx("div",{className:"aggregation-edit-item-list",children:o.jsx(mn,{itemCount:g.length,items:f,offset:a,renderItem:j=>{var{item:T}=j;return o.jsx(ce,{checked:v(T.value),children:T.displayValue})},onSelect:b,onViewportChange:O,rowHeight:Tn,focusSelector:"input",ref:m})})]})}function sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function dr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sr(Object(r),!0).forEach(function(n){En(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function En(t,e,r){return e=Rn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Rn(t){var e=An(t,"string");return typeof e=="symbol"?e:String(e)}function An(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mn(t){return o.jsx("svg",dr(dr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:o.jsxs("g",{fill:"none",fillRule:"evenodd",children:[o.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),o.jsx("path",{fill:"#7DA4FF",d:"M8 26h4v15H8zM15 17h4v24h-4zM22 21h4v20h-4zM29 17h4v24h-4zM36 11h4v30h-4z"})]})}))}function ur(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function cr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ur(Object(r),!0).forEach(function(n){kn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ur(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function kn(t,e,r){return e=Fn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Fn(t){var e=_n(t,"string");return typeof e=="symbol"?e:String(e)}function _n(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ln(t){return o.jsx("svg",cr(cr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:o.jsxs("g",{fill:"none",fillRule:"evenodd",children:[o.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),o.jsx("path",{fill:"#7DA4FF",d:"M7 34h4v8H7zM12 31h4v11h-4zM17 27h4v15h-4zM22 22h4v20h-4zM27 27h4v15h-4zM32 29h4v13h-4zM37 31h4v11h-4z"})]})}))}function hr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function vr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?hr(Object(r),!0).forEach(function(n){Hn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Hn(t,e,r){return e=Gn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Gn(t){var e=Un(t,"string");return typeof e=="symbol"?e:String(e)}function Un(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function $n(t){return o.jsx("svg",vr(vr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:o.jsxs("g",{fill:"none",fillRule:"evenodd",children:[o.jsx("path",{fill:"#C1C0C0",d:"M4 4h1v40H4zM44 43v1H5v-1z"}),o.jsx("path",{stroke:"#7DA4FF",d:"M7.984 32.44l7.982-11.378 5.273 3.739 9.952-10.838 2.826 1.894 7.45-5.802"}),o.jsx("path",{stroke:"#BECDEF",d:"M8.244 37.926L17 33.496l5 .87 10.637-10.35 10.615-1.381"})]})}))}function mr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function gr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?mr(Object(r),!0).forEach(function(n){Bn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):mr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Bn(t,e,r){return e=Wn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wn(t){var e=zn(t,"string");return typeof e=="symbol"?e:String(e)}function zn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Vn(t){return o.jsx("svg",gr(gr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:o.jsxs("g",{fill:"none",fillRule:"evenodd",children:[o.jsx("path",{d:"M24 10c7.732 0 14 6.268 14 14s-6.268 14-14 14-14-6.268-14-14h14V10z",fill:"#80A6FF"}),o.jsx("path",{d:"M10 24c0-7.732 6.268-14 14-14v14H10z",fill:"#C1C0C0"})]})}))}function fr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function pr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?fr(Object(r),!0).forEach(function(n){Kn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):fr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Kn(t,e,r){return e=qn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qn(t){var e=Xn(t,"string");return typeof e=="symbol"?e:String(e)}function Xn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Yn(t){return o.jsx("svg",pr(pr({width:48,height:48,xmlns:"http://www.w3.org/2000/svg"},t),{},{children:o.jsxs("g",{fill:"none",fillRule:"evenodd",children:[o.jsx("path",{fill:"#C1C0C0",d:"M44 43v1H4v-1z"}),o.jsx("path",{fill:"#939293",d:"M44 34v1H4v-1zM44 25v1H4v-1zM44 16v1H4v-1z"}),o.jsx("circle",{fill:"#7DA4FF",cx:9.5,cy:37.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:16.5,cy:30.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:22.5,cy:36.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:28.5,cy:30.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:15.5,cy:38.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:23.5,cy:25.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:19.5,cy:19.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:29.5,cy:19.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:32.5,cy:26.5,r:1.5}),o.jsx("circle",{fill:"#7DA4FF",cx:36.5,cy:13.5,r:1.5})]})}))}function br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Cr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?br(Object(r),!0).forEach(function(n){Zn(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):br(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Zn(t,e,r){return e=Qn(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qn(t){var e=Jn(t,"string");return typeof e=="symbol"?e:String(e)}function Jn(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function eo(t){return o.jsxs("svg",Cr(Cr({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[o.jsx("rect",{width:"48",height:"48",fill:"none"}),o.jsx("rect",{x:"26",y:"10",width:"15",height:"4",fill:"#9FDE70"}),o.jsx("rect",{x:"26",y:"22",width:"15",height:"4",fill:"#9FDE70"}),o.jsx("rect",{x:"26",y:"28",width:"15",height:"4",fill:"#FFD95C"}),o.jsx("rect",{x:"26",y:"34",width:"15",height:"4",fill:"#9FDE70"})]}))}function Sr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function wr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Sr(Object(r),!0).forEach(function(n){ea(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Sr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ea(t,e,r){return e=ra(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ra(t){var e=ta(t,"string");return typeof e=="symbol"?e:String(e)}function ta(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ro(t){return o.jsxs("svg",wr(wr({width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{},{children:[o.jsx("rect",{width:"48",height:"48",fill:"none"}),o.jsx("rect",{x:"4",y:"16",width:"40",height:"4",fill:"#FFD95C"}),o.jsx("rect",{x:"4",y:"10",width:"40",height:"4",fill:"#78DCE8"}),o.jsx("rect",{x:"4",y:"34",width:"40",height:"4",fill:"#78DCE8"})]}))}var Or=be.module("ChartBuilder");class J extends C.PureComponent{static getMaxSeriesCount(e,r){switch(r){case e.plot.SeriesPlotStyle.PIE:return 1;case e.plot.SeriesPlotStyle.HISTOGRAM:return 0;default:return 100}}static makeSeriesItem(e){return{id:we.generate(),value:e}}static makeDefaultSeriesItems(e,r,n){var a=J.getMaxSeriesCount(e,r);if(a===0||n==null||n.length===0)return[];var i=n.length>1?n[1].name:n[0].name;return[J.makeSeriesItem(i)]}static getDefaultXAxis(e,r){return r!=null&&r.length>0?r[0].name:null}constructor(e){super(e),gn(this);var{model:r}=e,{columns:n,dh:a}=r,i=this.getTypes()[0],l=J.getDefaultXAxis(i,n),s=J.makeDefaultSeriesItems(a,i,n);this.state={type:i,seriesItems:s,xAxis:l,isLinked:!0}}getTypes(){var{model:e}=this.props,{dh:r}=e;return[r.plot.SeriesPlotStyle.LINE,r.plot.SeriesPlotStyle.BAR,r.plot.SeriesPlotStyle.SCATTER,r.plot.SeriesPlotStyle.PIE]}getTypeName(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.LINE:return"Line";case n.plot.SeriesPlotStyle.BAR:return"Bar";case n.plot.SeriesPlotStyle.SCATTER:return"Scatter";case n.plot.SeriesPlotStyle.PIE:return"Pie";case n.plot.SeriesPlotStyle.HISTOGRAM:return"Histogram";default:return e}}getTypeIcon(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.LINE:return o.jsx($n,{});case n.plot.SeriesPlotStyle.BAR:return o.jsx(Mn,{});case n.plot.SeriesPlotStyle.SCATTER:return o.jsx(Yn,{});case n.plot.SeriesPlotStyle.PIE:return o.jsx(Vn,{});case n.plot.SeriesPlotStyle.HISTOGRAM:return o.jsx(Ln,{});default:return null}}getXAxisLabel(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.PIE:return"Labels";case n.plot.SeriesPlotStyle.HISTOGRAM:return"Data";default:return"X-Axis"}}getSeriesLabel(e){var{model:r}=this.props,{dh:n}=r;switch(e){case n.plot.SeriesPlotStyle.PIE:return"Values";default:return"Series"}}handleAddSeries(){this.setState(e=>{var{seriesItems:r}=e,n=[...r],{model:a}=this.props,{columns:i}=a;return n.push({id:we.generate(),value:i[0].name}),{seriesItems:n}},this.sendChange)}handleLinkStateChange(e){this.setState({isLinked:e.target.value==="true"},this.sendChange)}handleReset(){var{model:e}=this.props,{columns:r,dh:n}=e,a=this.getTypes()[0],i=J.getDefaultXAxis(a,r),l=J.makeDefaultSeriesItems(n,a,r),s=!0;this.setState({type:a,seriesItems:l,xAxis:i,isLinked:s},this.sendChange)}handleSeriesChange(e,r){var n=e;this.setState(a=>{var{seriesItems:i}=a;return i=[...i],i[r].value=n,{seriesItems:i}},this.sendChange)}handleSeriesDeleteClick(e){this.setState(r=>{var{seriesItems:n}=r,a=[...n];return a.splice(e,1),{seriesItems:a}},this.sendChange)}handleSubmit(e){e.preventDefault();var{onSubmit:r}=this.props,{type:n,seriesItems:a,xAxis:i,isLinked:l}=this.state,s=a.map(u=>u.value);r({type:n,series:s,xAxis:i,isLinked:l})}handleTypeClick(e){var r=this.getTypes()[e];Or.debug2("handleTypeSelect",r),this.setState(n=>{var{model:a}=this.props,{dh:i}=a,l=J.getMaxSeriesCount(i,r),{seriesItems:s}=n;if(s=s.slice(0,l),s.length===0&&l>0){var{columns:u}=a;s=J.makeDefaultSeriesItems(i,r,u)}return{type:r,seriesItems:s}},this.sendChange)}handleXAxisChange(e){var r=e;Or.debug2("x-axis change",r),this.setState({xAxis:r},this.sendChange)}sendChange(){var{onChange:e}=this.props,{isLinked:r,type:n,seriesItems:a,xAxis:i}=this.state,l=a.map(s=>s.value);e({type:n,series:l,xAxis:i,isLinked:r})}render(){var{model:e}=this.props,{columns:r,dh:n}=e,{seriesItems:a,type:i,xAxis:l,isLinked:s}=this.state,u=J.getMaxSeriesCount(n,i),d=this.getXAxisLabel(i),c=this.getSeriesLabel(i),h=a.length>0,m=a.length<u;return o.jsx("div",{className:"chart-builder",children:o.jsxs("form",{onSubmit:this.handleSubmit,children:[o.jsxs("div",{className:"form-row",children:[o.jsx("label",{children:"Select Chart Type"}),o.jsx("div",{className:"form-row",children:this.getTypes().map((v,g)=>{var f=v;return o.jsx("div",{className:"col col-chart-type",children:o.jsxs("button",{type:"button",className:$("btn","btn-icon","btn-chart-type",{active:v===i}),onClick:()=>this.handleTypeClick(g),children:[this.getTypeIcon(v),this.getTypeName(v)]})},f)})})]}),o.jsx("hr",{}),o.jsxs("div",{className:"form-row form-inline",children:[o.jsx("label",{className:"col-2 label-left",children:d}),o.jsx(Oe,{className:"form-control select-x-axis col",value:l,onChange:this.handleXAxisChange,children:r.map(v=>o.jsx("option",{value:v.name,children:v.name},v.name))})]}),h&&o.jsx("hr",{}),a.map((v,g)=>o.jsxs("div",{className:"form-row form-inline form-series-item","data-testid":"form-series-item-".concat(g),children:[o.jsx("label",{className:"col-2 label-left",children:g===0?c:""}),o.jsx(Oe,{className:"form-control select-series col",value:v.value,onChange:f=>this.handleSeriesChange(f,g),"data-testid":"select-series-item-".concat(g),children:r.map(f=>o.jsx("option",{value:f.name,children:f.name},f.name))}),a.length>1&&o.jsx(N,{kind:"ghost",className:"btn-delete-series ml-2 px-2","data-testid":"delete-series-".concat(g),onClick:()=>{this.handleSeriesDeleteClick(g)},icon:ye,tooltip:"Delete"})]},v.id)),m&&o.jsxs("div",{className:"form-row",children:[o.jsx("div",{className:"col-2"}),o.jsx(N,{kind:"ghost",className:"btn-add-series mt-1",onClick:this.handleAddSeries,icon:ze,children:"Add Series"})]}),o.jsxs("div",{className:"form-row chart-builder-link",children:[o.jsx("label",{className:"col-2 label-right",children:o.jsxs("div",{className:"fa-md fa-layers",children:[o.jsx(W,{mask:_t,icon:et,transform:"right-5 down-5"}),o.jsx(W,{icon:s?Lt:Ht,transform:"grow-2 right-8 down-6"})]})}),o.jsxs(Xe,{onChange:this.handleLinkStateChange,value:"".concat(s),children:[o.jsx(he,{value:"true",children:"Sync State"}),o.jsx(he,{value:"false",children:"Freeze State"})]})]}),o.jsxs("div",{className:"form-row",children:[o.jsx("div",{className:"col-2 label-right"}),o.jsx("div",{className:"col chart-builder-link-info",children:s?"Charts with synced state will update to match any filters or user modifications applied to the parent table.":"Freeze State disconnects the chart state from the parent table. New filters or user modifications on the parent table will not be applied."})]}),o.jsxs("div",{className:$("form-row","justify-content-end","my-3"),children:[o.jsx(N,{kind:"secondary",className:"btn-reset",onClick:this.handleReset,children:"Reset"}),o.jsx(N,{kind:"primary",type:"submit",className:"btn-submit",children:"Create"})]})]})})}}const to=J;function yr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function na(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yr(Object(r),!0).forEach(function(n){Re(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Re(t,e,r){return e=aa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function aa(t){var e=ia(t,"string");return typeof e=="symbol"?e:String(e)}function ia(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class ut extends C.Component{constructor(e){super(e),Re(this,"editorContainer",void 0),Re(this,"editor",void 0),this.handleContentChanged=this.handleContentChanged.bind(this),this.handleEditorFocus=this.handleEditorFocus.bind(this),this.handleEditorBlur=this.handleEditorBlur.bind(this),this.handleContainerClick=this.handleContainerClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.state={isEditorFocused:!1,isEditorEmpty:!0},this.editorContainer=null}componentDidMount(){this.initEditor()}componentWillUnmount(){this.destroyEditor()}initEditor(){var e,{value:r,editorSettings:n}=this.props,a=na({copyWithSyntaxHighlighting:"false",fixedOverflowWidgets:!0,folding:!1,fontFamily:"Fira Mono",glyphMargin:!1,language:"groovyDB",lineDecorationsWidth:8,lineNumbers:"off",minimap:{enabled:!1},renderLineHighlight:"none",scrollbar:{arrowSize:0,horizontal:"hidden",horizontalScrollbarSize:0},scrollBeyondLastLine:!1,padding:{top:6,bottom:6},tabCompletion:"off",useTabStops:!0,value:r,wordWrap:"on",automaticLayout:!0},n);if(!this.editorContainer)throw new Error("editorContainer is null");this.editor=On.create(this.editorContainer,a),this.editor.layout(),(e=this.editor.getModel())===null||e===void 0||e.updateOptions({tabSize:0}),this.editor.onKeyDown(this.handleKeyDown),this.editor.onDidChangeModelContent(this.handleContentChanged),this.editor.onDidFocusEditorText(this.handleEditorFocus),this.editor.onDidBlurEditorText(this.handleEditorBlur)}destroyEditor(){var e;(e=this.editor)===null||e===void 0||e.dispose(),this.editor=void 0}handleContentChanged(){var e,r,{onContentChanged:n}=this.props,a=(e=this.editor)===null||e===void 0||(r=e.getModel())===null||r===void 0?void 0:r.getValue();a!==void 0&&this.setState({isEditorEmpty:a.length===0}),n(a)}handleEditorFocus(){this.setState({isEditorFocused:!0})}handleEditorBlur(){var e,r,n,a=(e=(r=this.editor)===null||r===void 0||(n=r.getModel())===null||n===void 0?void 0:n.getValue())!==null&&e!==void 0?e:"";this.setState({isEditorEmpty:a.length===0,isEditorFocused:!1})}handleContainerClick(){var e,{isEditorFocused:r}=this.state;r||(e=this.editor)===null||e===void 0||e.focus()}handleKeyDown(e){var{onTab:r,editorIndex:n}=this.props;e.code==="Tab"&&(e.stopPropagation(),e.preventDefault(),r(n,e.shiftKey))}render(){var{className:e,invalid:r,placeholder:n="",value:a}=this.props,{isEditorFocused:i,isEditorEmpty:l}=this.state;return o.jsxs("div",{className:$("input-editor-wrapper",{focused:i,invalid:r},e),role:"presentation",onClick:this.handleContainerClick,children:[o.jsx("div",{className:"editor-container",ref:s=>{this.editorContainer=s},"data-testid":"custom-column-formula"}),l&&!a&&n.length>0&&o.jsx("div",{className:"editor-placeholder text-muted",children:n})]})}}Re(ut,"defaultProps",{value:"",onContentChanged:()=>{},editorSettings:{},editorIndex:0,onTab:()=>{},invalid:!1});function xr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function xe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?xr(Object(r),!0).forEach(function(n){oa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):xr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function oa(t,e,r){return e=la(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function la(t){var e=sa(t,"string");return typeof e=="symbol"?e:String(e)}function sa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ir=Object.freeze({NAME:"name",FORMULA:"formula"}),da=()=>{};function ua(t){var{eventKey:e,name:r,inputIndex:n,formula:a,onChange:i,onDeleteColumn:l,onTabInEditor:s,invalid:u,isDuplicate:d}=t,c=r===""||qe.isValidColumnName(r),h=C.useCallback(m=>{m!==void 0&&(m.replace(/(\r\n|\n|\r)/gm,""),i(e,Ir.FORMULA,m))},[i,e]);return o.jsx(Ct,{draggableId:e,index:n,disableInteractiveElementBlocking:!0,children:(m,v)=>o.jsxs("div",xe(xe({className:$("draggable-container",{dragging:v.isDragging}),ref:m.innerRef},m.draggableProps),{},{children:[o.jsxs("div",{className:"custom-column-input-container",children:[o.jsxs("div",{className:"pb-3",children:[o.jsxs("div",{className:"d-flex flex-row custom-column-name",children:[o.jsx("input",{className:$("form-control custom-column-input",{"is-invalid":u||!c||d}),placeholder:"Column Name",value:r,onChange:g=>{i(e,Ir.NAME,g.target.value)}}),o.jsx(N,{kind:"ghost",className:"ml-1 px-2",onClick:()=>{l(e)},icon:ye,tooltip:"Delete custom column"}),o.jsx(N,xe(xe({kind:"ghost",className:"btn-drag-handle",onClick:da},m.dragHandleProps),{},{icon:rt,tooltip:"Drag column to re-order"}))]}),(!c||d)&&o.jsx("p",{className:"validate-label-error text-danger mb-0 mt-2 pl-1",children:c?"Duplicate name":"Invalid name"})]}),o.jsx(ut,{editorSettings:{language:"deephavenDb"},editorIndex:n,placeholder:"Column Formula",value:a,onContentChanged:h,onTab:s,invalid:u})]}),o.jsx("hr",{})]}))})}function jr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ke(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?jr(Object(r),!0).forEach(function(n){pe(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):jr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function pe(t,e,r){return e=ca(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ca(t){var e=ha(t,"string");return typeof e=="symbol"?e:String(e)}function ha(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class se extends C.Component{static makeCustomColumnInputEventKey(){return we.generate()}static createCustomColumnInput(){return{eventKey:we.generate(),name:"",formula:""}}constructor(e){super(e),pe(this,"container",void 0),pe(this,"successButtonTimer",void 0),pe(this,"getInput",Qe((r,n)=>r.find(a=>a.eventKey===n))),pe(this,"getInputIndex",Qe((r,n)=>r.findIndex(a=>a.eventKey===n))),this.handleAddColumnClick=this.handleAddColumnClick.bind(this),this.handleSaveClick=this.handleSaveClick.bind(this),this.handleInputChange=this.handleInputChange.bind(this),this.handleDeleteColumn=this.handleDeleteColumn.bind(this),this.handleCustomColumnUpdated=this.handleCustomColumnUpdated.bind(this),this.handleRequestFailed=this.handleRequestFailed.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.resetRequestFailed=this.resetRequestFailed.bind(this),this.handleEditorTabNavigation=this.handleEditorTabNavigation.bind(this),this.state={inputs:[],isCustomColumnApplying:!1,errorMessage:null,hasRequestFailed:!1,isSuccessShowing:!1},this.container=null,this.successButtonTimer=null}componentDidMount(){var{customColumns:e}=this.props;this.parseCustomColumns(e),this.startListening()}componentWillUnmount(){this.stopListening(),this.successButtonTimer&&clearTimeout(this.successButtonTimer)}resetErrorMessage(){this.setState({errorMessage:null})}startListening(){var{model:e}=this.props;e.addEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.addEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}stopListening(){var{model:e}=this.props;e.removeEventListener(me.EVENT.COLUMNS_CHANGED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.UPDATED,this.handleCustomColumnUpdated),e.removeEventListener(me.EVENT.REQUEST_FAILED,this.handleRequestFailed)}parseCustomColumns(e){if(e.length>0){var r=e.map(n=>{var a=n.split(/=(.+)/,2);return{eventKey:se.makeCustomColumnInputEventKey(),name:a[0],formula:a[1]}});this.setState({inputs:r})}else this.setState({inputs:[se.createCustomColumnInput()]})}handleAddColumnClick(){var{inputs:e}=this.state,r=[...e];r.push(se.createCustomColumnInput()),this.setState({inputs:r})}handleDeleteColumn(e){var{inputs:r}=this.state,n=this.getInputIndex(r,e),a=[...r];a.splice(n,1),a.length===0&&a.push(se.createCustomColumnInput()),this.setState({inputs:a})}handleInputChange(e,r,n){var{inputs:a}=this.state,i=this.getInputIndex(a,e),l=this.getInput(a,e),s=ke({},l);s[r]=n;var u=[...a];u.splice(i,1,s),this.setState({inputs:u})}handleCustomColumnUpdated(){var{isCustomColumnApplying:e}=this.state;e&&this.setState({isCustomColumnApplying:!1,isSuccessShowing:!0},()=>{this.successButtonTimer=setTimeout(()=>this.setState({isSuccessShowing:!1}),se.SUCCESS_SHOW_DURATION)})}handleRequestFailed(e){var r=e,{isCustomColumnApplying:n}=this.state;n&&this.setState({isCustomColumnApplying:!1,errorMessage:o.jsxs(o.Fragment,{children:[o.jsxs("p",{children:[o.jsx(W,{icon:Ee})," Failed to apply custom columns."]}),o.jsxs("div",{className:"error-box",children:[r.detail.errorMessage,o.jsx("br",{}),"Table configuration:"," ",JSON.stringify(r.detail.configuration)]})]}),hasRequestFailed:!0})}handleDragEnd(e){if(ne.stopDragging(),!!e.destination){var{inputs:r}=this.state,n=e.source.index,a=e.destination.index,i=[...r],l=r[n];i.splice(n,1),i.splice(a,0,l),this.setState({inputs:i})}}handleEditorTabNavigation(e,r){var{inputs:n}=this.state;if(r){var a;((a=this.container)===null||a===void 0?void 0:a.querySelectorAll(".btn-drag-handle")[e]).focus();return}if(e===n.length-1){var i,l;(i=this.container)===null||i===void 0||(l=i.querySelector(".btn-add-column"))===null||l===void 0||l.focus()}else{var s,u=e+1;((s=this.container)===null||s===void 0?void 0:s.querySelectorAll(".custom-column-input")[u]).focus()}}handleSaveClick(){var{onSave:e,customColumns:r}=this.props,{inputs:n,isCustomColumnApplying:a}=this.state;if(!a){var i=[];n.forEach(l=>{var{name:s,formula:u}=l;s&&u&&i.push("".concat(s,"=").concat(u))}),this.resetErrorMessage(),this.setState({isCustomColumnApplying:i.length>0||r.length>0}),e(i)}}resetRequestFailed(){this.setState(e=>{var{hasRequestFailed:r}=e;return r?{hasRequestFailed:!1}:null})}renderInputs(){var{inputs:e,hasRequestFailed:r}=this.state,n=new Map;return e.forEach(a=>{var i,{name:l}=a;return n.set(l,((i=n.get(l))!==null&&i!==void 0?i:0)+1)}),e.map((a,i)=>{var l,{eventKey:s,name:u,formula:d}=a,c=((l=n.get(u))!==null&&l!==void 0?l:0)>1;return o.jsx(ua,{inputIndex:i,eventKey:s,name:u,formula:d,onChange:this.handleInputChange,onDeleteColumn:this.handleDeleteColumn,onTabInEditor:this.handleEditorTabNavigation,invalid:r,isDuplicate:c},s)})}renderSaveButton(){var{inputs:e,isCustomColumnApplying:r,isSuccessShowing:n}=this.state,a=e.length>1?"Save Columns":"Save Column",i=e.every(u=>{var{name:d}=u;return d===""||qe.isValidColumnName(d)}),l=e.filter(u=>{var{name:d}=u;return d!==""}).map(u=>{var{name:d}=u;return d}),s=new Set(l).size===l.length;return o.jsxs(N,{kind:n?"success":"primary",className:$("btn-apply",{"btn-spinner":r}),disabled:n||r||!i||!s,onClick:this.handleSaveClick,icon:n?Gt:void 0,children:[r&&o.jsxs("span",{children:[o.jsx(tt,{className:"mr-2 loading-spinner-vertical-align"}),o.jsx("span",{className:"btn-normal-content",children:"Applying"})]}),!n&&!r&&a,n&&"Success"]})}render(){var{onCancel:e}=this.props,{errorMessage:r}=this.state;return o.jsxs("div",{role:"presentation",className:"custom-column-builder-container",ref:n=>{this.container=n},onClick:this.resetRequestFailed,onFocus:this.resetRequestFailed,children:[o.jsx("hr",{}),o.jsx(We,{onDragStart:ne.startDragging,onDragEnd:this.handleDragEnd,children:o.jsx(Zr,{droppableId:"droppable-custom-columns",children:(n,a)=>o.jsxs("div",ke(ke({ref:n.innerRef},n.droppableProps),{},{className:$("droppable-container",{dragging:a.draggingFromThisWith}),children:[this.renderInputs(),n.placeholder]}))})}),o.jsx("div",{className:"pt-1 px-3",children:o.jsx(N,{kind:"ghost",className:"btn-add-column",onClick:this.handleAddColumnClick,icon:ze,children:"Add Another Column"})}),o.jsxs("div",{className:"custom-column-builder-footer",children:[r&&o.jsx("div",{className:"error-message",children:r}),o.jsxs("div",{className:"d-flex justify-content-end",children:[o.jsx(N,{kind:"secondary",className:"mr-2",onClick:e,children:"Cancel"}),this.renderSaveButton()]})]})]})}}pe(se,"SUCCESS_SHOW_DURATION",750);const no=se;var Ge;(function(t){t.ADVANCED_SETTINGS="ADVANCED_SETTINGS",t.AGGREGATIONS="AGGREGATIONS",t.AGGREGATION_EDIT="AGGREGATIONS_EDIT",t.CHART_BUILDER="CHART_BUILDER",t.CUSTOM_COLUMN_BUILDER="CUSTOM_COLUMN_BUILDER",t.QUICK_FILTERS="QUICK_FILTERS",t.ROLLUP_ROWS="ROLLUP_ROWS",t.SEARCH_BAR="SEARCH_BAR",t.SELECT_DISTINCT="SELECT_DISTINCT",t.TABLE_EXPORTER="TABLE_EXPORTER",t.VISIBILITY_ORDERING_BUILDER="VISIBILITY_ORDERING_BUILDER",t.CONDITIONAL_FORMATTING="CONDITIONAL_FORMATTING",t.CONDITIONAL_FORMATTING_EDIT="CONDITIONAL_FORMATTING_EDIT",t.GOTO="GOTO"})(Ge||(Ge={}));const ao=Ge;function Dr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Pr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Dr(Object(r),!0).forEach(function(n){de(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Dr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function de(t,e,r){return e=va(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function va(t){var e=ma(t,"string");return typeof e=="symbol"?e:String(e)}function ma(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ce=be.module("RollupRows"),ga=150,Ie="grouped-rollup-rows",je="ungrouped-rollup-rows";class z extends C.Component{static renderColumn(e){var{item:r,isClone:n,selectedCount:a}=e,i=r?.name,l=n!==void 0&&n?"".concat(a):void 0,s=n!==void 0&&n?"item-list-item-clone":"";return ee.renderTextItem({text:i,badgeText:l,className:s})}static addGroupings(e,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length;if(r==null||r.length===0)return e;var a=n,i=e.filter((l,s)=>r.includes(l)?(s<a&&(a-=1),!1):!0);return i.splice(a,0,...r),i}static isGroupable(e){return!V.isDecimalType(e.type)}constructor(e){super(e),de(this,"ungroupedList",void 0),de(this,"groupedList",void 0),de(this,"search",Qr(l=>{for(var s=this.getSortedUngroupedColumns(),u=[],d=null,c=0;c<s.length;c+=1){var h=s[c];h.name.toLowerCase().includes(l.toLowerCase())&&(d==null&&(d=c),u.push([c,c]))}k(d),this.setState({ungroupedSelectedRanges:u}),u.length>0&&this.ungroupedList.current&&this.ungroupedList.current.scrollToItem(d)},ga)),de(this,"getCachedUngroupedColumns",oe((l,s)=>l.filter(u=>z.isGroupable(u)&&s.find(d=>d===u.name)==null))),de(this,"getCachedSortedColumns",oe((l,s)=>s==null?[...l]:V.sortColumns(l,s===z.SORT.ASCENDING))),this.handleDeleteClicked=this.handleDeleteClicked.bind(this),this.handleSearchChange=this.handleSearchChange.bind(this),this.handleUngroupedSelect=this.handleUngroupedSelect.bind(this),this.handleUngroupedSelectionChange=this.handleUngroupedSelectionChange.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupedSelectionChange=this.handleGroupedSelectionChange.bind(this),this.handleShowConstituentsChange=this.handleShowConstituentsChange.bind(this),this.handleShowNonAggregatedColumnsChange=this.handleShowNonAggregatedColumnsChange.bind(this),this.handleSortAscending=this.handleSortAscending.bind(this),this.handleSortDescending=this.handleSortDescending.bind(this),this.renderGroupedItem=this.renderGroupedItem.bind(this),this.ungroupedList=Je.createRef(),this.groupedList=Je.createRef();var{config:r}=e,{columns:n=[],showConstituents:a=!0,showNonAggregatedColumns:i=!0}=r??{};this.state={ungroupedSelectedRanges:[],columns:n,groupedSelectedRanges:[],searchFilter:"",showConstituents:a,showNonAggregatedColumns:i,dragSource:null,sort:null}}componentDidUpdate(e,r){var{config:n}=this.props,{columns:a,showConstituents:i,showNonAggregatedColumns:l}=this.state;n!==e.config?this.updateFromConfig():(a!==r.columns||i!==r.showConstituents||l!==r.showNonAggregatedColumns)&&(n==null||a!==n.columns||i!==n.showConstituents||l!==n.showNonAggregatedColumns)&&this.sendChange()}componentWillUnmount(){this.search.cancel()}handleSearchChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.search.cancel(),this.resetSelection();return}this.search(r)}handleSortAscending(){this.setState(e=>{var{sort:r}=e;return{sort:r===z.SORT.ASCENDING?null:z.SORT.ASCENDING}})}handleSortDescending(){this.setState(e=>{var{sort:r}=e;return{sort:r===z.SORT.DESCENDING?null:z.SORT.DESCENDING}})}resetSelection(){this.setState({ungroupedSelectedRanges:[],groupedSelectedRanges:[]})}handleDragStart(e){Ce.debug("handleDragStart",e),document.documentElement.classList.add("drag-pointer-events-none"),this.setState({dragSource:e.source})}handleDragEnd(e){Ce.debug("handleDragEnd",e),document.documentElement.classList.remove("drag-pointer-events-none"),this.setState({dragSource:null});var{destination:r,source:n}=e;if(!(r==null||n==null)){if(r.droppableId===je){this.setState(l=>{var{groupedSelectedRanges:s,columns:u}=l,d=[...u];return ne.reorder(d,s,[],0),{columns:d,ungroupedSelectedRanges:[],groupedSelectedRanges:[]}});return}var a=n.droppableId===Ie,i=r.index;a&&n.index<r.index&&(i+=1),this.setState(l=>{var{columns:s,ungroupedSelectedRanges:u,groupedSelectedRanges:d}=l,c=[...s],h=a?c:this.getSortedUngroupedColumns().map(b=>b.name),m=a?d:u,v=ne.reorder(h,m,c,i),g=a?ne.adjustDestinationIndex(i,d):i,f=[[g,g+v.length-1]];return{columns:c,ungroupedSelectedRanges:[],groupedSelectedRanges:f}}),this.resetSelection()}}handleUngroupedSelect(e){Ce.debug("handleUngroupedSelect"),this.setState(r=>{var{columns:n}=r;return{columns:z.addGroupings(n,[this.getSortedUngroupedColumns()[e].name]),ungroupedSelectedRanges:[],groupedSelectedRanges:[]}})}handleUngroupedSelectionChange(e){Ce.debug2("handleUngroupedSelectionChange",e),this.setState(r=>{var{ungroupedSelectedRanges:n}=r;return e===n?null:{ungroupedSelectedRanges:e,groupedSelectedRanges:[]}})}handleGroupedSelectionChange(e){Ce.debug2("handleGroupedSelectedRanges",e),this.setState(r=>{var{groupedSelectedRanges:n}=r;return e===n?null:{groupedSelectedRanges:e,ungroupedSelectedRanges:[]}})}handleDeleteClicked(e){this.setState(r=>{var{columns:n}=r,a=n.slice();return a.splice(e,1),{columns:a}})}handleShowConstituentsChange(){this.setState(e=>{var{showConstituents:r}=e;return{showConstituents:!r}})}handleShowNonAggregatedColumnsChange(){this.setState(e=>{var{showNonAggregatedColumns:r}=e;return{showNonAggregatedColumns:!r}})}updateFromConfig(){var{config:e}=this.props,{columns:r=[],showConstituents:n=!0,showNonAggregatedColumns:a=!0}=e??{};this.setState({columns:r,showConstituents:n,showNonAggregatedColumns:a})}sendChange(){var{onChange:e}=this.props,{columns:r,showConstituents:n,showNonAggregatedColumns:a}=this.state;e({columns:r,showConstituents:n,showNonAggregatedColumns:a})}getUngroupedColumns(){var{model:e}=this.props,{columns:r}=this.state,{originalColumns:n}=e;return this.getCachedUngroupedColumns(n,r)}getSortedUngroupedColumns(){var{sort:e}=this.state,r=this.getUngroupedColumns();return this.getCachedSortedColumns(r,e)}renderGroupedItem(e){var{item:r,itemIndex:n,isClone:a,selectedCount:i}=e,l=a!==void 0&&a?"":" ".repeat(n),s="".concat(l).concat(r),u=a!==void 0&&a?"".concat(i):void 0,d=a!==void 0&&a?"item-list-item-clone":"";return o.jsxs(o.Fragment,{children:[ee.renderTextItem({text:s,badgeText:u,className:d}),(a===void 0||!a)&&o.jsx(N,{kind:"ghost",className:"btn btn-link btn-link-icon btn-delete-grouping float-right",onClick:()=>this.handleDeleteClicked(n),children:o.jsx(W,{icon:ye})})]})}render(){var{columns:e,dragSource:r,searchFilter:n,groupedSelectedRanges:a,ungroupedSelectedRanges:i,showConstituents:l,showNonAggregatedColumns:s,sort:u}=this.state,d=this.getSortedUngroupedColumns(),c=e.length*ee.DEFAULT_ROW_HEIGHT;r?.droppableId===je&&(c+=ee.DEFAULT_ROW_HEIGHT);var h=d.length*ee.DEFAULT_ROW_HEIGHT+10,m=Math.min(3*ee.DEFAULT_ROW_HEIGHT,h);return o.jsx("div",{role:"menu",className:$("rollup-rows",{"is-dragging":r!=null}),tabIndex:0,children:o.jsxs(We,{onDragEnd:this.handleDragEnd,onDragStart:this.handleDragStart,children:[o.jsxs("div",{className:"rollup-rows-group-by",children:[o.jsx("div",{className:"section-title",children:"Group By"}),e.length===0&&o.jsx(Zr,{droppableId:"placeholder",children:(v,g)=>o.jsx("div",Pr(Pr({className:$("placeholder","text-muted",{"is-dragging-from-this":g.draggingFromThisWith,"is-dragging-over":g.isDraggingOver,"is-dropping":g.draggingOverWith}),ref:v.innerRef},v.droppableProps),{},{children:"To create a rollup, drag columns from the list below and drop them into this area."}))}),e.length>0&&o.jsx(ee,{draggingItemClassName:"rollup-rows-dragging-grouped-item",draggablePrefix:Ie,droppableId:Ie,itemCount:e.length,items:e,offset:0,onSelectionChange:this.handleGroupedSelectionChange,ref:this.groupedList,renderItem:this.renderGroupedItem,selectedRanges:a,style:{height:c},isMultiSelect:!0})]}),o.jsxs("div",{className:"rollup-rows-available-columns",children:[o.jsx("div",{className:"section-title",children:"Available Grouping Columns"}),o.jsxs("div",{className:"top-menu",children:[o.jsx(st,{className:"w-100",value:n,matchCount:n?i.length:void 0,placeholder:"Find column...",onChange:this.handleSearchChange}),o.jsxs(N,{kind:"ghost",className:$("btn-link btn-link-icon",{active:u===z.SORT.ASCENDING}),onClick:this.handleSortAscending,children:[o.jsx(W,{icon:Ve}),o.jsx(He,{children:"Sort ascending"})]}),o.jsxs(N,{kind:"ghost",className:$("btn-link btn-link-icon",{active:u===z.SORT.DESCENDING}),onClick:this.handleSortDescending,children:[o.jsx(W,{icon:Ke}),o.jsx(He,{children:"Sort descending"})]})]}),o.jsx(ee,{className:"rollup-available-grouping-columns",draggablePrefix:je,droppableId:je,itemCount:d.length,items:d,renderItem:z.renderColumn,offset:0,onSelect:this.handleUngroupedSelect,onSelectionChange:this.handleUngroupedSelectionChange,ref:this.ungroupedList,selectedRanges:i,style:{maxHeight:h,minHeight:m},isDropDisabled:r?.droppableId!==Ie,isMultiSelect:!0}),o.jsxs("div",{className:"bottom-menu",children:[o.jsx("div",{className:"label",children:"Show:"}),o.jsx(ce,{checked:l,onChange:this.handleShowConstituentsChange,children:"Constituents"}),o.jsx(ce,{checked:s,onChange:this.handleShowNonAggregatedColumnsChange,children:"Non-Aggregated Columns"})]})]})]})})}}de(z,"SORT",Object.freeze({ASCENDING:"ASC",DESCENDING:"DESC"}));de(z,"defaultProps",{config:null,onChange:()=>{}});const io=z;function Nr(t,e,r,n,a,i,l){try{var s=t[i](l),u=s.value}catch(d){r(d);return}s.done?e(u):Promise.resolve(u).then(n,a)}function fa(t){return function(){var e=this,r=arguments;return new Promise(function(n,a){var i=t.apply(e,r);function l(u){Nr(i,n,a,l,s,"next",u)}function s(u){Nr(i,n,a,l,s,"throw",u)}l(void 0)})}}function Tr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Er(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Tr(Object(r),!0).forEach(function(n){ve(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ve(t,e,r){return e=pa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pa(t){var e=ba(t,"string");return typeof e=="symbol"?e:String(e)}function ba(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Ca=be.module("TableCsvExporter");class P extends C.Component{static getDateString(e){return e.i18n.DateTimeFormat.format(P.FILENAME_DATE_FORMAT,new Date)}constructor(e){super(e),this.handleDownloadClick=this.handleDownloadClick.bind(this),this.handleDownloadRowOptionChanged=this.handleDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowOptionChanged=this.handleCustomizedDownloadRowOptionChanged.bind(this),this.handleCustomizedDownloadRowsChanged=this.handleCustomizedDownloadRowsChanged.bind(this),this.handleIncludeColumnHeadersChanged=this.handleIncludeColumnHeadersChanged.bind(this),this.handleIncludeHiddenColumnsChanged=this.handleIncludeHiddenColumnsChanged.bind(this),this.handleUseUnformattedValuesChanged=this.handleUseUnformattedValuesChanged.bind(this);var{model:r,name:n}=e;this.state={fileName:"".concat(n,"-").concat(P.getDateString(r.dh),".csv"),downloadRowOption:P.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,customizedDownloadRowOption:P.CUSTOMIZED_ROWS_OPTIONS.FIRST,customizedDownloadRows:P.DEFAULT_DOWNLOAD_ROWS,includeColumnHeaders:!0,includeHiddenColumns:!1,useUnformattedValues:!1,errorMessage:null,id:we.generate()}}getSnapshotRanges(){var{model:e,selectedRanges:r}=this.props,{downloadRowOption:n,customizedDownloadRowOption:a,customizedDownloadRows:i}=this.state,{rowCount:l,columnCount:s}=e,u=[];switch(n){case P.DOWNLOAD_ROW_OPTIONS.ALL_ROWS:u.push(new ge(0,0,s-1,l-1));break;case P.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS:u=r.map(d=>Er(Er({},d),{},{startColumn:0,endColumn:s-1})).sort((d,c)=>d.startRow!=null&&c.startRow!=null?d.startRow-c.startRow:0);break;case P.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS:switch(a){case P.CUSTOMIZED_ROWS_OPTIONS.FIRST:u.push(new ge(0,0,s-1,Math.min(i-1,l-1)));break;case P.CUSTOMIZED_ROWS_OPTIONS.LAST:u.push(new ge(0,Math.max(0,l-i),s-1,l-1));break}break}return u}getModelRanges(e){var{userColumnWidths:r,movedColumns:n}=this.props,{includeHiddenColumns:a}=this.state,i=it.getHiddenColumns(r),l=M.getModelRanges(e,n);if(!a&&i.length>0){var s=i.map(ge.makeColumn);l=ge.subtractRangesFromRanges(l,s)}return l}resetDownloadState(){this.setState({errorMessage:null})}handleDownloadClick(){var e=this;return fa(function*(){var{model:r,isDownloading:n,onDownloadStart:a,onDownload:i,onCancel:l}=e.props,{fileName:s,includeColumnHeaders:u,useUnformattedValues:d}=e.state;if(n){l();return}e.resetDownloadState();var c=e.getSnapshotRanges(),h=e.getModelRanges(c);if(e.validateOptionInput()){a();try{var m=yield r.export(),v=m.setViewport(0,0);yield v.getViewportData(),i(s,m,v,c,h,u,d)}catch(g){Ca.error("CSV download failed",g),e.setState({errorMessage:o.jsxs("p",{children:[o.jsx(W,{icon:Ee})," ","".concat(g)]})}),l()}}})()}handleDownloadRowOptionChanged(e){this.setState({downloadRowOption:e.target.value})}handleCustomizedDownloadRowOptionChanged(e){this.setState({customizedDownloadRowOption:e})}handleCustomizedDownloadRowsChanged(e){this.setState({customizedDownloadRows:parseInt(e.target.value,10)})}handleIncludeColumnHeadersChanged(){this.setState(e=>{var{includeColumnHeaders:r}=e;return{includeColumnHeaders:!r}})}handleIncludeHiddenColumnsChanged(){this.setState(e=>{var{includeHiddenColumns:r}=e;return{includeHiddenColumns:!r}})}handleUseUnformattedValuesChanged(){this.setState(e=>{var{useUnformattedValues:r}=e;return{useUnformattedValues:!r}})}validateOptionInput(){var{selectedRanges:e}=this.props,{downloadRowOption:r,customizedDownloadRows:n}=this.state;return r===P.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS&&e.length===0?(this.setState({errorMessage:o.jsxs("p",{children:[o.jsx(W,{icon:Ee})," No rows selected. Please select some rows in the table."]})}),!1):r===P.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS&&n<=0?(this.setState({errorMessage:o.jsxs("p",{children:[o.jsx(W,{icon:Ee})," Number of rows to output must be greater than 0"]})}),!1):!0}render(){var{model:e,isDownloading:r,tableDownloadProgress:n,tableDownloadEstimatedTime:a,selectedRanges:i,tableDownloadStatus:l}=this.props,{fileName:s,downloadRowOption:u,customizedDownloadRowOption:d,customizedDownloadRows:c,includeColumnHeaders:h,includeHiddenColumns:m,useUnformattedValues:v,errorMessage:g,id:f}=this.state,{rowCount:b}=e;return o.jsxs("div",{className:"table-csv-exporter",children:[o.jsx("div",{className:"section-title",children:"Download Rows"}),o.jsx("div",{className:"form-group",children:o.jsxs(Xe,{onChange:this.handleDownloadRowOptionChanged,value:u,disabled:r,children:[o.jsxs(he,{value:P.DOWNLOAD_ROW_OPTIONS.ALL_ROWS,"data-testid":"radio-csv-exporter-download-all",children:["All Rows",o.jsx("span",{className:"text-muted ml-2",children:"(".concat(b.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)")})]}),o.jsxs(he,{value:P.DOWNLOAD_ROW_OPTIONS.SELECTED_ROWS,"data-testid":"radio-csv-exporter-only-selected",children:["Only Selected Rows",o.jsx("span",{className:"text-muted ml-2",children:i.length>0?"(".concat(ge.rowCount(i).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")," rows)"):null})]}),o.jsx(he,{value:P.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS,"data-testid":"radio-csv-exporter-customized-rows",children:o.jsxs("div",{className:"radio-input-row",role:"presentation",onClick:()=>{this.setState({downloadRowOption:P.DOWNLOAD_ROW_OPTIONS.CUSTOMIZED_ROWS})},children:[o.jsxs(Oe,{value:d,"data-testid":"select-csv-exporter-customized-rows",className:"custom-select",disabled:r,onChange:this.handleCustomizedDownloadRowOptionChanged,children:[o.jsx("option",{value:"FIRST",children:"First"}),o.jsx("option",{value:"LAST",children:"Last"})]}),o.jsx("input",{type:"number",className:"form-control",id:"customizedRows-".concat(f),"data-testid":"input-csv-exporter-customized-rows",name:"customizedRows-".concat(f),placeholder:"100",value:c,disabled:r,onChange:this.handleCustomizedDownloadRowsChanged}),o.jsx("div",{children:"Rows"})]})})]})}),o.jsxs("div",{className:"form-group",children:[o.jsx("label",{htmlFor:"customizedRows-".concat(f),children:"File Name"}),o.jsx("input",{type:"text",className:"form-control",id:"filename-".concat(f),"data-testid":"input-csv-exporter-file-name",name:"filename-".concat(f),value:s,onChange:p=>{this.setState({fileName:p.target.value})},disabled:r})]}),o.jsxs("div",{className:"checkbox-options",children:[o.jsx(ce,{checked:h,onChange:this.handleIncludeColumnHeadersChanged,children:"Include column headers"}),o.jsx(ce,{checked:m,onChange:this.handleIncludeHiddenColumnsChanged,children:"Include hidden columns"}),o.jsx(ce,{checked:v,onChange:this.handleUseUnformattedValuesChanged,children:"Use unformatted values"})]}),o.jsxs("div",{className:"section-footer flex-column",children:[g!=null&&o.jsx("div",{className:"error-message",children:g}),l&&o.jsxs("div",{className:"download-status",children:[(l===P.DOWNLOAD_STATUS.DOWNLOADING||l===P.DOWNLOAD_STATUS.INITIATING)&&o.jsxs(o.Fragment,{children:[l===P.DOWNLOAD_STATUS.INITIATING&&o.jsx("div",{className:"text-muted",children:"Starting Download..."}),l===P.DOWNLOAD_STATUS.DOWNLOADING&&o.jsxs("div",{className:"text-muted d-flex justify-content-between",children:[o.jsx("span",{children:a||a===0?"Estimated time: ".concat(fn.formatElapsedTime(a)):null}),o.jsx("span",{children:"".concat(n,"%")})]})]}),l===P.DOWNLOAD_STATUS.FINISHED&&o.jsx("div",{className:"text-muted text-right",children:"Download Completed"}),l===P.DOWNLOAD_STATUS.CANCELED&&o.jsx("div",{className:"text-muted",children:"Download Canceled"}),(l===P.DOWNLOAD_STATUS.DOWNLOADING||l===P.DOWNLOAD_STATUS.INITIATING)&&o.jsx("div",{className:"progress",children:o.jsx("div",{className:"progress-bar progress-bar-striped progress-bar-animated",style:{width:"".concat(n,"%")}})}),l===P.DOWNLOAD_STATUS.FINISHED&&o.jsx("div",{className:"progress",children:o.jsx("div",{className:"progress-bar bg-success",style:{width:"".concat(n,"%")}})})]}),o.jsxs(N,{kind:"primary","data-testid":"btn-csv-exporter-download",className:$("btn-downloading",{"btn-spinner btn-cancelable":r}),onClick:this.handleDownloadClick,children:[r&&o.jsxs("span",{children:[o.jsx(tt,{className:"mr-2 loading-spinner-vertical-align"}),o.jsx("span",{className:"btn-normal-content",children:"Downloading"}),o.jsx("span",{className:"btn-hover-content",children:"Cancel"})]}),!r&&"Download"]})]})]})}}ve(P,"FILENAME_DATE_FORMAT","yyyy-MM-dd-HHmmss");ve(P,"DOWNLOAD_STATUS",{INITIATING:"INITIATING",DOWNLOADING:"DOWNLOADING",FINISHED:"FINISHED",CANCELED:"CANCELED"});ve(P,"DOWNLOAD_ROW_OPTIONS",{ALL_ROWS:"ALL_ROWS",SELECTED_ROWS:"SELECTED_ROWS",CUSTOMIZED_ROWS:"CUSTOMIZED_ROWS"});ve(P,"CUSTOMIZED_ROWS_OPTIONS",{FIRST:"FIRST",LAST:"LAST"});ve(P,"DEFAULT_DOWNLOAD_ROWS",100);ve(P,"defaultProps",{onDownloadStart:()=>{},isDownloading:!1,tableDownloadStatus:"",tableDownloadProgress:0,tableDownloadEstimatedTime:null,selectedRanges:[]});const oo=P;function R(t,e,r){return e=Sa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sa(t){var e=wa(t,"string");return typeof e=="symbol"?e:String(e)}function wa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var te=be.module("TableSaver"),Oa="yyyy-MM-dd'T'HH:mm:ss.SSSSSSSSS z";function ya(t){return t.added!==void 0}function xa(t){if(!ya(t))throw new Error("event is not UpdateEventData")}class X extends C.PureComponent{static csvEscapeString(e){return'"'.concat(e.replace(/"/g,'""'),'"')}constructor(e){super(e),R(this,"sw",void 0),R(this,"port",void 0),R(this,"fileWriter",void 0),R(this,"table",void 0),R(this,"tableSubscription",void 0),R(this,"columns",void 0),R(this,"fileName",void 0),R(this,"includeColumnHeaders",void 0),R(this,"useUnformattedValues",void 0),R(this,"chunkRows",void 0),R(this,"gridRanges",void 0),R(this,"gridRangeCounter",void 0),R(this,"rangedSnapshotsTotal",void 0),R(this,"rangedSnapshotCounter",void 0),R(this,"snapshotsTotal",void 0),R(this,"snapshotCounter",void 0),R(this,"snapshotsBuffer",void 0),R(this,"currentSnapshotIndex",void 0),R(this,"snapshotPending",void 0),R(this,"cancelableSnapshots",void 0),R(this,"streamTimeout",void 0),R(this,"snapshotHandlerTimeout",void 0),R(this,"downloadStartTime",void 0),R(this,"iframe",void 0),R(this,"useBlobFallback",void 0),R(this,"getCachedCustomColumnFormatFlag",dt(yn.isCustomColumnFormatDefined,{max:1e4})),this.handlePortMessage=this.handlePortMessage.bind(this),this.handleSnapshotResolved=this.handleSnapshotResolved.bind(this),this.handleDownloadTimeout=this.handleDownloadTimeout.bind(this),this.state={},this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.useBlobFallback=!1}componentDidMount(){var{getDownloadWorker:e}=this.props;e().then(r=>{te.info("found active service worker"),this.sw=r,this.sw.postMessage("ping")}).catch(r=>{te.warn("Download csv is not optimized.",r),this.useBlobFallback=!0})}componentWillUnmount(){this.removeIframe(),this.streamTimeout&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout&&clearTimeout(this.snapshotHandlerTimeout)}createWriterStream(e){var r=this.useBlobFallback,n=[],a=null;r&&(a=TextEncoder.prototype.encode.bind(new TextEncoder));var{fileName:i}=this,l={};return r?(l.write=s=>{k(a),s.header!==void 0&&n.push(a(s.header)),s.rows!==void 0&&n.push(a(s.rows))},l.close=()=>{k(i);var s=new Blob(n,{type:"application/octet-stream; charset=utf-8"}),u=document.createElement("a");u.href=URL.createObjectURL(s),u.download=i,u.click()},l.abort=()=>{e.postMessage({cancel:!0}),e.close()}):(l.write=s=>{e.postMessage(s)},l.close=()=>{e.postMessage({end:!0}),e.close()},l.abort=()=>{e.postMessage({cancel:!0}),e.close()}),new WritableStream(l)}startDownload(e,r,n,a,i,l,s){var{isDownloading:u}=this.props;if(!u){this.downloadStartTime=Date.now(),te.info("start downloading ".concat(e)),this.table=r,this.columns=it.columnsFromRanges(i,r.columns),this.tableSubscription=n,this.gridRanges=a,this.includeColumnHeaders=l,this.useUnformattedValues=s;var d=encodeURIComponent(e.replace(/\//g,":")).replace(/['()]/g,escape).replace(/\*/g,"%2A"),c=new MessageChannel;if(this.port=c.port1,this.fileName=e,this.fileWriter=this.createWriterStream(this.port).getWriter(),this.useBlobFallback){this.writeCsvTable(l);return}this.sw&&this.sw.postMessage({encodedFileName:d},[c.port2]),this.port.onmessage=this.handlePortMessage}}finishDownload(){this.table&&this.table.close(),this.tableSubscription&&this.tableSubscription.close(),this.fileWriter&&this.fileWriter.close();var{onDownloadCompleted:e}=this.props;e(),this.resetTableSaver(),this.downloadStartTime!==void 0&&te.info("download finished, total elapsed time ".concat((Date.now()-this.downloadStartTime)/1e3," seconds"))}cancelDownload(){var e,r,n;(e=this.table)===null||e===void 0||e.close(),(r=this.tableSubscription)===null||r===void 0||r.close(),(n=this.fileWriter)===null||n===void 0||n.abort(),this.cancelableSnapshots.forEach(i=>{i&&(i.catch(()=>null),i.cancel())});var{onDownloadCanceled:a}=this.props;a(),this.resetTableSaver()}resetTableSaver(){this.table=void 0,this.tableSubscription=void 0,this.columns=void 0,this.chunkRows=void 0,this.removeIframe(),this.gridRanges=[],this.gridRangeCounter=0,this.rangedSnapshotsTotal=[],this.rangedSnapshotCounter=0,this.includeColumnHeaders=!0,this.useUnformattedValues=!1,this.snapshotsTotal=0,this.snapshotCounter=0,this.snapshotsBuffer=new Map,this.currentSnapshotIndex=0,this.snapshotPending=0,this.cancelableSnapshots=[],this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.snapshotHandlerTimeout!=null&&clearTimeout(this.snapshotHandlerTimeout),this.streamTimeout=void 0,this.snapshotHandlerTimeout=void 0}handleDownloadTimeout(){te.info("download canceled"),this.cancelDownload()}writeTableHeader(){var e,r="";if(this.columns)for(var n=0;n<this.columns.length;n+=1)r+=this.columns[n].name,r+=n===this.columns.length-1?`
|
|
2
|
+
`:",";(e=this.fileWriter)===null||e===void 0||e.write({header:r}).then(()=>null)}startWriteTableBody(){this.columns&&this.gridRanges!=null&&(this.chunkRows=Math.floor(X.DOWNLOAD_CELL_CHUNK/this.columns.length),this.rangedSnapshotsTotal=this.gridRanges.map(e=>(k(e.endRow),k(e.startRow),k(this.chunkRows),Math.ceil((e.endRow-e.startRow+1)/this.chunkRows))),this.snapshotsTotal=this.rangedSnapshotsTotal.reduce((e,r)=>e+r),te.info("start writing table, total snapshots: ",this.snapshotsTotal),this.makeSnapshot(Math.min(X.SNAPSHOT_BUFFER_SIZE,this.snapshotsTotal)))}writeCsvTable(e){e&&this.writeTableHeader(),this.startWriteTableBody()}writeSnapshot(e,r,n){if(this.currentSnapshotIndex===e&&this.fileWriter){for(;this.snapshotsBuffer.has(this.currentSnapshotIndex);){var a=this.snapshotsBuffer.get(this.currentSnapshotIndex);k(a),this.fileWriter.write({rows:this.convertSnapshotIntoCsv(a)}),this.snapshotsBuffer.delete(this.currentSnapshotIndex),this.currentSnapshotIndex+=1,this.updateDownloadProgress(e)}if(this.snapshotsTotal&&this.currentSnapshotIndex>=this.snapshotsTotal){this.finishDownload();return}}this.snapshotCounter&&this.snapshotsTotal&&this.snapshotCounter<this.snapshotsTotal&&(te.debug2(`
|
|
3
|
+
current range index: `.concat(this.gridRangeCounter,`,
|
|
4
|
+
snapshotIndexCounter: `).concat(this.snapshotCounter,`,
|
|
5
|
+
currentRangedSnapshotIndex : `).concat(this.rangedSnapshotCounter,`,
|
|
6
|
+
snapshotpending: `).concat(this.snapshotPending,`,
|
|
7
|
+
buffered `).concat(this.snapshotsBuffer.size,`
|
|
8
|
+
making `).concat(Math.min(X.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter),` more snapshots
|
|
9
|
+
`)),this.makeSnapshot(Math.min(X.SNAPSHOT_BUFFER_SIZE-this.snapshotsBuffer.size-this.snapshotPending,this.snapshotsTotal-this.snapshotCounter)))}updateDownloadProgress(e){if(e!=null&&this.snapshotsTotal!=null&&this.downloadStartTime!=null){var{onDownloadProgressUpdate:r}=this.props,n=Math.floor(e*100/this.snapshotsTotal),a=e>1?Math.floor((Date.now()-this.downloadStartTime)*(this.snapshotsTotal-e)/e/1e3):null;r(n,a)}}convertSnapshotIntoCsv(e){for(var r="",n=e.added.iterator(),{dh:a,formatter:i}=this.props,l=[];n.hasNext();)l.push(n.next().value);k(this.columns);for(var{useUnformattedValues:s}=this,u=0;u<l.length;u+=1)for(var d=l[u],c=0;c<this.columns.length;c+=1){var{type:h,name:m}=this.columns[c],v=null;if(s){var g,f=(g=e.getData(d,this.columns[c]))!==null&&g!==void 0?g:"";f!==""&&V.isDateType(h)&&(f=a.i18n.DateTimeFormat.format(Oa,f,a.i18n.TimeZone.getTimeZone(i.timeZone))),v=f.toString()}else{var b=this.getCachedCustomColumnFormatFlag(i,m,h),p=null;if(!b){var O=e.getFormat(d,this.columns[c]);p=O?.formatString!=null?O:null}p?v=i.getFormattedString(e.getData(d,this.columns[c]),h,m,p):v=i.getFormattedString(e.getData(d,this.columns[c]),h,m)}r+=X.csvEscapeString(v),r+=c===this.columns.length-1?`
|
|
10
|
+
`:","}return r}makeSnapshot(e){var r=this;if(!(e<=0)){var{dh:n}=this.props;k(this.gridRangeCounter);var a=0,i=this.gridRanges[this.gridRangeCounter];k(this.tableSubscription),k(this.columns);for(var l=function(){k(i),k(i.startRow),k(i.endRow),k(r.rangedSnapshotCounter),k(r.chunkRows);var u=i.startRow+r.rangedSnapshotCounter*r.chunkRows,d=Math.min(u+r.chunkRows-1,i.endRow),c=r.snapshotCounter;r.cancelableSnapshots.push(pn.makeCancelable(r.tableSubscription.snapshot(n.RangeSet.ofRange(u,d),r.columns).then(h=>(xa(h),r.handleSnapshotResolved(h,c,u,d),c)).catch(h=>{te.error(h)}),h=>{te.info("snapshot ".concat(h," has been canceled"))})),r.rangedSnapshotCounter+=1,r.snapshotCounter+=1,r.snapshotPending+=1,r.rangedSnapshotCounter>=r.rangedSnapshotsTotal[r.gridRangeCounter]&&(r.gridRangeCounter+=1,r.rangedSnapshotCounter=0,i=r.gridRanges[r.gridRangeCounter]),a+=1};a<e;)l()}}handlePortMessage(e){var{data:r}=e,{download:n,readableStreamPulling:a}=r;if(!this.useBlobFallback){if(n!=null){var{includeColumnHeaders:i}=this;this.makeIframe("".concat(n)),this.writeCsvTable(i)}a!=null&&(this.useBlobFallback||(this.streamTimeout!=null&&clearTimeout(this.streamTimeout),this.streamTimeout=setTimeout(this.handleDownloadTimeout,X.STREAM_TIMEOUT)))}}handleSnapshotResolved(e,r,n,a){this.snapshotHandlerTimeout=setTimeout(()=>{this.snapshotsBuffer.set(r,e),this.snapshotPending-=1,this.writeSnapshot(r,n,a),this.cancelableSnapshots[r]=null},X.SNAPSHOT_HANDLER_TIMEOUT)}makeIframe(e){var r=document.createElement("iframe");r.hidden=!0,r.src=e,r.name="iframe",document.body.appendChild(r),this.iframe=r}removeIframe(){var e;(e=this.iframe)===null||e===void 0||e.remove(),this.iframe=void 0}render(){return null}}R(X,"DOWNLOAD_CELL_CHUNK",6e3);R(X,"SNAPSHOT_BUFFER_SIZE",5);R(X,"STREAM_TIMEOUT",8e3);R(X,"SNAPSHOT_HANDLER_TIMEOUT",5);R(X,"defaultProps",{isDownloading:!1,onDownloadCompleted:()=>{},onDownloadCanceled:()=>{},onDownloadProgressUpdate:()=>{}});function Ia(t){var e,{group:r,onDelete:n,onColorChange:a,onNameChange:i,validateName:l}=t,{isNew:s}=r,u=C.useRef(r),d=C.useRef(null),c=C.useRef(null),[h,m]=C.useState(!1),[v,g]=C.useState(s?"":r.name),[f,b]=C.useState(s),[p,O]=C.useState(!1),S=v!==r.name?l(v):"",D=s&&!p||S==="",y=C.useCallback(()=>{m(!1)},[]);C.useEffect(function(){f&&d.current&&(d.current.focus(),d.current.select())},[f]),C.useEffect(function(){return()=>{u.current.isNew&&n(u.current)}},[n]),C.useEffect(function(){if(h){var w,I;(w=c.current)===null||w===void 0||w.click(),(I=c.current)===null||I===void 0||I.focus(),window.addEventListener("click",y,!0)}return()=>window.removeEventListener("click",y,!0)},[h,y]);var j=()=>{D&&(i(r,v),b(!1))},T=()=>{if(s){n(r);return}g(r.name),b(!1)},A=x=>{O(!0),x.key==="Enter"&&(x.stopPropagation(),j()),x.key===" "&&x.stopPropagation(),x.key==="Escape"&&T()};return f?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"editing-container",children:[o.jsx("input",{ref:d,className:$("form-control",{"is-invalid":!D}),value:v,placeholder:"Group Name",onChange:x=>g(x.target.value),onKeyDown:A,onBlur:()=>O(!0)}),o.jsx(N,{kind:"ghost",icon:Ut,tooltip:"Confirm",onClick:j}),o.jsx(N,{kind:"ghost",icon:$t,tooltip:"Cancel",onClick:T})]}),!D&&o.jsx("p",{className:"mb-0 validate-label-error text-danger",children:S})]}):o.jsxs("div",{className:"group-name-wrapper",children:[o.jsx("span",{className:"column-name",children:v}),o.jsx(N,{className:"p-1 mx-1",kind:"ghost",icon:Jr,tooltip:"Edit",onClick:()=>{b(!0)}}),o.jsxs("span",{className:"right-buttons",children:[o.jsx(N,{kind:"ghost",icon:ye,tooltip:"Delete group",onClick:()=>n(r)}),o.jsx(N,{kind:"ghost",className:"color-swatch mr-1",icon:r.color!==void 0?o.jsxs("span",{className:"fa-layers",children:[o.jsx(W,{className:"color-swatch",icon:tr,color:K.white,transform:"down-1"}),o.jsx(W,{className:"color-swatch",icon:tr,color:r.color,transform:"shrink-2 down-1"})]}):Bt,tooltip:"Set color",onClick:()=>m(x=>!x)}),h&&o.jsxs(o.Fragment,{children:[o.jsx("input",{"aria-label":"Color input",ref:c,type:"color",list:"presetColors",value:(e=r.color)!==null&&e!==void 0?e:K["content-bg"],style:{visibility:"hidden",width:0,height:0,padding:0,border:0},onChange:x=>{r.color=x.target.value,a(r,x.target.value)}}),o.jsxs("datalist",{id:"presetColors",children:[o.jsx("option",{children:K["content-bg"]}),o.jsx("option",{children:K.primary}),o.jsx("option",{children:K.foreground}),o.jsx("option",{children:K.green}),o.jsx("option",{children:K.yellow}),o.jsx("option",{children:K.orange}),o.jsx("option",{children:K.red}),o.jsx("option",{children:K.purple}),o.jsx("option",{children:K.blue}),o.jsx("option",{children:K["gray-400"]})]})]})]})]})}function Rr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Ar(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Rr(Object(r),!0).forEach(function(n){ja(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Rr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ja(t,e,r){return e=Da(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Da(t){var e=Pa(t,"string");return typeof e=="symbol"?e:String(e)}function Pa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Na(){}var Ta=C.forwardRef(function(e,r){var{value:n,clone:a,childCount:i,item:l,onVisibilityChange:s,onClick:u,onGroupDelete:d,onGroupColorChange:c,onGroupNameChange:h,validateGroupName:m,handleProps:v}=e,{group:g,modelIndex:f,isVisible:b}=l.data,p=C.useRef(null),O=C.useCallback(D=>{if(D.buttons===1){var y;s([f].flat(),!b),(y=p.current)===null||y===void 0||y.focus()}},[s,f,b]),S=C.useCallback(D=>{u(n,D)},[u,n]);return o.jsxs("div",Ar(Ar({ref:r,className:$("tree-item",{isSelected:l.selected,"two-dragged":i===2,"multiple-dragged":i>2}),onClick:S},v),{},{children:[o.jsx(N,{ref:p,kind:"ghost",className:"px-1",onClick:Na,onMouseDown:O,onMouseEnter:O,icon:b?nt:at,tooltip:"Toggle visibility"}),o.jsx("span",{className:$("column-name",g&&"column-group"),children:g&&!a?o.jsx(Ia,{group:g,onDelete:d,onColorChange:c,onNameChange:h,validateName:m}):n}),o.jsxs("div",{children:[a&&i>1&&o.jsx("span",{className:"item-count",children:i}),o.jsx(He,{children:"Drag to re-order"}),o.jsx(W,{icon:rt})]})]}))});const Ea=Ta;function Ra(t){return t.parentId!==void 0}function Mr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function kr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Mr(Object(r),!0).forEach(function(n){Aa(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Aa(t,e,r){return e=Ma(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ma(t){var e=ka(t,"string");return typeof e=="symbol"?e:String(e)}function ka(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Fa(t,e){return Math.round(t/e)}function ct(t,e,r,n,a,i){var l=t.findIndex(d=>d.name===n);if(l===-1){var s=r.get(n);if(s==null)throw new Error("Column or header group not found: ".concat(n));var u=s.childIndexes.flat();return{id:n,selected:i.has(n),children:s.children.map(d=>ct(t,e,r,d,a,i)).sort((d,c)=>{var h=Array.isArray(d.data.visibleIndex)?d.data.visibleIndex[0]:d.data.visibleIndex,m=Array.isArray(c.data.visibleIndex)?c.data.visibleIndex[0]:c.data.visibleIndex;return h-m}),data:{modelIndex:u,visibleIndex:s.getVisibleRange(e),group:s,isVisible:u.some(d=>!a.has(d))}}}return{id:n,children:[],selected:i.has(n),data:{modelIndex:l,visibleIndex:M.getVisibleIndex(l,e),isVisible:!a.has(l)}}}function _a(t,e,r,n,a){for(var i=[],l=new Set(a),s=new Map(r.map(h=>[h.name,h])),u=new Set(n),d=0,c=function(){for(var m=M.getModelIndex(d,e),v=t[m].name,g=r.find(b=>{var{children:p}=b;return p.includes(v)});g!==void 0&&g.parent!==void 0;)g=s.get(g.parent);var f=ct(t,e,s,g?g.name:v,u,l);i.push(f),Array.isArray(f.data.visibleIndex)?d+=f.data.visibleIndex[1]-f.data.visibleIndex[0]+1:d+=1};d<t.length;)c();return i}function Ae(t,e,r,n,a){var i=t.findIndex(p=>{var{id:O}=p;return O===r}),l=t.findIndex(p=>{var{id:O}=p;return O===e}),s=t[l],u=St(t,l,i),d=u[i-1],c=u[i+1],h=Fa(n,a),m=s.depth+h,v=La({previousItem:d,nextItem:c}),g=Ha({nextItem:c}),f=m;return m>=v?f=v:m<g&&(f=g),{depth:f,maxDepth:v,minDepth:g,parentId:b()};function b(){var p;if(f===0||!d)return null;if(f===d.depth)return d.parentId;if(f>d.depth)return d.id;var O=(p=u.slice(0,i).reverse().find(S=>S.depth===f))===null||p===void 0?void 0:p.parentId;return O??null}}function La(t){var e,r,{previousItem:n,nextItem:a}=t;return Math.max((e=n?.depth)!==null&&e!==void 0?e:0,(r=a?.depth)!==null&&r!==void 0?r:0)}function Ha(t){var{nextItem:e}=t;return e?e.depth:0}function ht(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return t.reduce((n,a,i)=>[...n,kr(kr({},a),{},{parentId:e,depth:r,index:i}),...ht(a.children,a.id,r+1)],[])}function q(t){return t.every(Ra)?[...t]:ht(t)}function vt(t,e){for(var r=0;r<t.length;r+=1){var n=t[r],{id:a,children:i}=n;if(a===e)return n;if(i.length){var l=vt(i,e);if(l)return l}}}function mt(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.reduce((r,n)=>{var{children:a}=n;return a.length?mt(a,r+1):r+1},e)}function Ga(t,e){var r=vt(t,e);return r?mt(r.children):0}function Fr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function De(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Fr(Object(r),!0).forEach(function(n){Ua(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Fr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ua(t,e,r){return e=$a(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $a(t){var e=Ba(t,"string");return typeof e=="symbol"?e:String(e)}function Ba(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Wa=[re.Down,re.Right,re.Up,re.Left],za=[re.Left,re.Right];function Va(t,e,r){return(n,a)=>{var{currentCoordinates:i,context:{active:l,over:s,collisionRect:u,droppableRects:d,droppableContainers:c}}=a;if(Wa.includes(n.code)){if(!l||!u)return;n.preventDefault();var{current:{items:h,offset:m}}=t;if(za.includes(n.code)&&s?.id!=null){var{depth:v,maxDepth:g,minDepth:f}=Ae(h,l.id,s.id,m,r);switch(n.code){case re.Left:if(v>f)return De(De({},i),{},{x:i.x-r});break;case re.Right:if(v<g)return De(De({},i),{},{x:i.x+r});break}return}var b=[];c.forEach(F=>{if(!(F!=null&&F.disabled||F.id===s?.id)){var U=d.get(F.id);if(U)switch(n.code){case re.Down:u.top<U.top&&b.push(F);break;case re.Up:u.top>U.top&&b.push(F);break}}});var p=wt({active:l,collisionRect:u,pointerCoordinates:null,droppableRects:d,droppableContainers:b}),O=Ot(p,"id");if(O===s?.id&&p.length>1&&(O=p[1].id),O!=null&&s?.id!=null){var S=d.get(l.id),D=d.get(O),y=c.get(O);if(S&&D&&y){var j=h.findIndex(F=>{var{id:U}=F;return U===O}),T=h[j],A=h.findIndex(F=>{var{id:U}=F;return U===l.id}),x=h[A];if(T!=null&&x!=null){var{depth:w}=Ae(h,l.id,O,(T.depth-x.depth)*r,r),I=j>A,E=I?1:-1,L=e?(u.height-S.height)/2:0,_={x:D.left+w*r,y:D.top+E*L};return _}}}}}}function Ka(t,e,r){return e=qa(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function qa(t){var e=Xa(t,"string");return typeof e=="symbol"?e:String(e)}function Xa(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class gt extends yt{}Ka(gt,"activators",[{eventName:"onPointerDown",handler:t=>{var{nativeEvent:e}=t;return!(!e.isPrimary||e.button!==0||Za(e.target))}}]);var Ya=["button","input","textarea","select","option"];function Za(t){return!!(t?.tagName!=null&&Ya.includes(t.tagName.toLowerCase()))}function ft(t){var{clone:e=!1,depth:r,disableInteraction:n=!1,ghost:a=!1,handleProps:i,value:l,dragRef:s=null,wrapperRef:u=null,renderItem:d,item:c,childCount:h}=t,m=C.useMemo(()=>Array(r).fill(0).map((g,f)=>o.jsx("span",{className:"depth-line"},"depth-line-".concat(f))),[r]),v=C.useMemo(()=>({ref:s,clone:e,value:l,item:c,childCount:h,handleProps:i}),[s,e,l,c,h,i]);return o.jsxs("li",{className:$("item-wrapper",{clone:e,ghost:a,disableInteraction:n}),ref:u,children:[!e&&m,d(v)]},l)}ft.displayName="TreeItem";var Qa=["id","depth"];function _r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Pe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?_r(Object(r),!0).forEach(function(n){Ja(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):_r(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ja(t,e,r){return e=ei(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ei(t){var e=ri(t,"string");return typeof e=="symbol"?e:String(e)}function ri(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ti(t,e){if(t==null)return{};var r=ni(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function ni(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}var ai=t=>{var{isSorting:e,wasDragging:r}=t;return!(e||r)};function Lr(t){var{id:e,depth:r}=t,n=ti(t,Qa),{attributes:a,isDragging:i,isSorting:l,listeners:s,setDraggableNodeRef:u,setDroppableNodeRef:d,transform:c,transition:h}=xt({id:e,animateLayoutChanges:ai}),m=_e.Translate.toString(c),v=C.useMemo(()=>({transform:m,transition:h}),[m,h]),g=C.useMemo(()=>Pe(Pe(Pe({},a),s),{},{style:v}),[a,s,v]);return o.jsx(ft,Pe({dragRef:u,wrapperRef:d,depth:r,ghost:i,disableInteraction:l,handleProps:g},n))}function Hr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Me(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Hr(Object(r),!0).forEach(function(n){ii(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Hr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ii(t,e,r){return e=oi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function oi(t){var e=li(t,"string");return typeof e=="symbol"?e:String(e)}function li(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var si={keyframes(t){var{transform:e}=t;return[{opacity:1,transform:_e.Transform.toString(e.initial)},{opacity:0,transform:_e.Transform.toString(Me(Me({},e.final),{},{x:e.final.x+5,y:e.final.y+5}))}]},easing:"ease-out",sideEffects(t){var{active:e}=t;e.node.animate([{opacity:0},{opacity:1}],{duration:er.duration,easing:er.easing})}},Ne=null;function di(t){var e;return Ne==null&&t.activeNodeRect&&t.activatorEvent instanceof PointerEvent&&(Ne=Math.floor((t.activatorEvent.clientY-t.activeNodeRect.top)/t.activeNodeRect.height)*t.activeNodeRect.height),t.activeNodeRect||(Ne=null),Me(Me({},t.transform),{},{y:t.transform.y+((e=Ne)!==null&&e!==void 0?e:0)})}function ui(t){var{items:e,renderItem:r,indentationWidth:n=30,indicator:a=!1,activeId:i,overId:l,offsetLeft:s}=t,u=It(),d=C.useRef(u);C.useEffect(function(){d.current=u},[u]),C.useEffect(function(){d.current.measureDroppableContainers(e.map(g=>{var{id:f}=g;return f}))},[e]);var c=i!=null&&l!=null?Ae(e,i,l,s,n):null,h=C.useRef({items:e,offset:s}),m=i!=null?e.find(v=>{var{id:g}=v;return g===i}):null;return C.useEffect(()=>{h.current={items:e,offset:s}},[e,s]),o.jsxs(o.Fragment,{children:[o.jsx("div",{className:$("tree-container",i!=null&&"marching-ants"),children:e.map(v=>{var{id:g,depth:f}=v;return o.jsx(Lr,{id:g,value:g,depth:g===i&&c?c.depth:f,item:v,renderItem:r},g)})}),jt.createPortal(o.jsx(Dt,{dropAnimation:si,modifiers:[di],className:"visibility-ordering-list",children:i!=null&&m?o.jsx(Lr,{id:i,depth:m.depth,clone:!0,childCount:Ga(e,i)+1,value:i.toString(),renderItem:r,item:m}):null}),document.body)]})}function Gr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Te(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Gr(Object(r),!0).forEach(function(n){ci(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Gr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ci(t,e,r){return e=hi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hi(t){var e=vi(t,"string");return typeof e=="symbol"?e:String(e)}function vi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var mi={droppable:{strategy:At.Always}},gi={activationConstraint:{distance:5}};function fi(t){var{items:e,indicator:r=!1,indentationWidth:n=30,onDragStart:a,onDragEnd:i,renderItem:l}=t,[s,u]=C.useState(null),[d,c]=C.useState(null),[h,m]=C.useState(0),v=C.useMemo(()=>{var x=q(e);return s!=null?x.filter(w=>{var{id:I,selected:E}=w;return I===s||!E}):x},[s,e]),g=s!=null&&d!=null?Ae(v,s,d,h,n):null,f=C.useRef({items:v,offset:h}),b=C.useMemo(()=>({coordinateGetter:Va(f,r,n)}),[n,r]),p=Pt(rr(gt,gi),rr(Mt,b)),O=C.useMemo(()=>v.map(x=>{var{id:w}=x;return w}),[v]);C.useEffect(()=>{f.current={items:v,offset:h}},[v,h]);var S=C.useCallback(x=>{var{active:{id:w}}=x;u(w),c(w),a?.(w),document.body.style.setProperty("cursor","grabbing")},[a]),D=C.useCallback(x=>{var{delta:w}=x;m(w.x)},[]),y=C.useCallback(x=>{var w,{over:I}=x;c((w=I?.id)!==null&&w!==void 0?w:null)},[]),j=C.useCallback(()=>{c(null),u(null),m(0),document.body.style.setProperty("cursor","")},[]),T=C.useCallback(x=>{var{active:w,over:I}=x;if(j(),g&&I){var{depth:E,parentId:L}=g,_=JSON.parse(JSON.stringify(q(e))),F=_.findIndex(B=>{var{id:ae}=B;return ae===I.id}),U=_.findIndex(B=>{var{id:ae}=B;return ae===w.id}),G=_[U];_[U]=Te(Te({},G),{},{depth:E,parentId:L}),i?.(G,Te(Te({},_[F]),{},{parentId:g.parentId}))}},[e,i,g,j]),A=C.useCallback(()=>{j()},[j]);return o.jsx(Nt,{sensors:p,collisionDetection:Tt,measuring:mi,onDragStart:S,onDragMove:D,onDragOver:y,onDragEnd:T,onDragCancel:A,children:o.jsx(Et,{items:O,strategy:Rt,children:o.jsx(ui,{items:v,renderItem:l,indicator:r,indentationWidth:n,activeId:s,overId:d,offsetLeft:h})})})}function Ur(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function $r(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ur(Object(r),!0).forEach(function(n){pi(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ur(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function pi(t,e,r){return e=bi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bi(t){var e=Ci(t,"string");return typeof e=="symbol"?e:String(e)}function Ci(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Si(t,e,r,n,a,i,l,s){var u=a.map((D,y)=>$r($r({},D),{},{index:y})),d=[],c=n,h=i[0].data.visibleIndex,m=u.findIndex(D=>{var{id:y}=D;return y===t.id}),v=u.findIndex(D=>{var{id:y}=D;return y===e.id}),g=Array.isArray(h)?h[1]+1:h+1;c=le(i[0],e.parentId,c);for(var f=1;f<i.length;f+=1){var{data:{visibleIndex:b}}=i[f];d=M.moveItemOrRange(b,g,d,!0),g+=Array.isArray(b)?b[1]-b[0]+1:1,c=le(i[f],e.parentId,c)}var p=[Array.isArray(h)?h[0]:h,g-1],O=Array.isArray(e.data.visibleIndex)?e.data.visibleIndex[0]:e.data.visibleIndex,S=M.getVisibleIndex(O,d);return m>v&&S>O&&(S-=1),e.children.length>0&&(Array.isArray(h)?h[0]:h)<S&&(S-=1),p[0]<S&&(S-=p[1]-p[0]),d=M.moveItemOrRange(p,Le(S,l,s),d),{groups:c,movedColumns:r.concat(d)}}function le(t,e,r){if(t.parentId===e)return[...r];var n=r.map(b=>new ue(b)),a=new Map(n.map(b=>[b.name,b])),i=n.find(b=>b.name===t.parentId),l=n.find(b=>b.name===e),s=n.find(b=>b.name===t.id);if(i!=null&&(i.children=i.children.filter(b=>b!==t.id),i.children.length===0)){var u,d=new Set([i.name]),{parent:c=""}=i,h=a.get(c);for((u=h)===null||u===void 0||u.removeChildren([i.name]);h&&h.children.length===0;){var m,v;d.add(h.name);var g=(m=(v=h)===null||v===void 0?void 0:v.parent)!==null&&m!==void 0?m:"",f=a.get(g);f?.removeChildren([h.name]),h=f}n=n.filter(b=>{var{name:p}=b;return!d.has(p)})}return l?.addChildren([t.id]),s?.setParent(e??void 0),n}function Br(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function fe(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Br(Object(r),!0).forEach(function(n){Y(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Br(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Y(t,e,r){return e=wi(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wi(t){var e=Oi(t,"string");return typeof e=="symbol"?e:String(e)}function Oi(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var yi=150;class H extends C.PureComponent{static shouldRenderColumn(e){return e.isProxy!==!0}constructor(e){super(e),Y(this,"list",void 0),Y(this,"debouncedSearchColumns",Qr(this.searchColumns,yi)),Y(this,"handleGroupColorChange",kt((r,n)=>{var{columnHeaderGroups:a,onColumnHeaderGroupChanged:i}=this.props,l=[...a],s=new ue(fe(fe({},r),{},{color:n}));l.splice(l.findIndex(u=>{var{name:d}=u;return d===r.name}),1,s),i(l)},250)),Y(this,"renderItem",oe(r=>{var{value:n,clone:a,item:i,ref:l,handleProps:s}=r,{onColumnVisibilityChanged:u}=this.props,{selectedColumns:d}=this.state,c=n;if(a){var h=this.getSelectedParentItems().map(m=>{var{id:v}=m;return v});c=h.join(", ")}return o.jsx(Ea,{ref:l,value:c,clone:a,item:i,childCount:d.size,onVisibilityChange:u,onClick:this.handleItemClick,onGroupDelete:this.handleGroupDelete,onGroupColorChange:this.handleGroupColorChange,onGroupNameChange:this.handleGroupNameChange,validateGroupName:this.validateGroupName,handleProps:s})})),Y(this,"getMemoizedFirstMovableIndex",oe((r,n,a)=>{for(var i=0;i<n.length;i+=1){var l=M.getModelIndex(i,a);if(r.isColumnMovable(l))return i}return null})),Y(this,"getMemoizedLastMovableIndex",oe((r,n,a)=>{for(var i=n.length-1;i>=0;i-=1){var l=M.getModelIndex(i,a);if(r.isColumnMovable(l))return i}return null})),Y(this,"memoizedGetTreeItems",oe((r,n,a,i,l)=>_a(r,n,a,i,[...l.values()]))),Y(this,"makeVisibilityOrderingList",oe((r,n)=>{var{movedColumns:a}=this.props,i=[],l=this.getFirstMovableIndex(),s=this.getLastMovableIndex(),u=n.findIndex(D=>{var{data:y}=D;return Array.isArray(y.visibleIndex)?y.visibleIndex[0]===l:y.visibleIndex===l}),d=n.findIndex(D=>{var{data:y}=D;return Array.isArray(y.visibleIndex)?y.visibleIndex[1]===s:y.visibleIndex===s}),c=n.slice(u,d+1);if(l==null||s===null){for(var h=0;h<r.length;h+=1){var m=M.getModelIndex(h,a),v=r[m];H.shouldRenderColumn(v)&&i.push(this.renderImmovableItem(v.name))}return i}for(var g=0;g<l;g+=1){var f=M.getModelIndex(g,a),b=r[f];H.shouldRenderColumn(b)&&i.push(this.renderImmovableItem(b.name))}l!==null&&l>0&&i.push(o.jsx("hr",{},"top-horizontal-divider")),i.push(o.jsx(fi,{items:c,renderItem:this.renderItem,onDragStart:this.handleDragStart,onDragEnd:this.handleDragEnd},"movable-items")),s!=null&&s<r.length-1&&i.push(o.jsx("hr",{},"bottom-horizontal-divider"));for(var p=s+1;p<r.length;p+=1){var O=M.getModelIndex(p,a),S=r[O];H.shouldRenderColumn(S)&&i.push(this.renderImmovableItem(S.name))}return i})),Y(this,"renderImmovableItem",oe(r=>o.jsx("div",{className:"visibility-ordering-list-item immovable",children:o.jsx("div",{className:"column-item",children:o.jsx("span",{className:"column-name",children:r})})},r))),this.handleSearchInputChange=this.handleSearchInputChange.bind(this),this.searchColumns=this.searchColumns.bind(this),this.handleItemClick=this.handleItemClick.bind(this),this.handleDragEnd=this.handleDragEnd.bind(this),this.handleGroupDelete=this.handleGroupDelete.bind(this),this.handleGroupNameChange=this.handleGroupNameChange.bind(this),this.handleGroupCreate=this.handleGroupCreate.bind(this),this.validateGroupName=this.validateGroupName.bind(this),this.addColumnToSelected=this.addColumnToSelected.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.state={selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""},this.list=null}componentDidUpdate(e){var{movedColumns:r}=this.props;if(r!==e.movedColumns){var{searchFilter:n}=this.state;this.searchColumns(n,!1)}}componentWillUnmount(){this.debouncedSearchColumns.cancel()}resetVisibilityOrdering(){var{model:e,onReset:r,onMovedColumnsChanged:n,onColumnHeaderGroupChanged:a}=this.props;this.setState({selectedColumns:new Set,queriedColumnIndex:void 0,queriedColumnRange:void 0,prevQueriedColumns:void 0,lastSelectedColumn:"",searchFilter:""}),r(),a(e.initialColumnHeaderGroups),n(e.initialMovedColumns)}resetSelection(){this.setState({selectedColumns:new Set,lastSelectedColumn:""})}handleSearchInputChange(e){var r=e.target.value;if(this.setState({searchFilter:r}),!r){this.debouncedSearchColumns.cancel(),this.resetSelection();return}this.debouncedSearchColumns(r)}searchColumns(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=q(this.getTreeItems()),a=n.filter(c=>{var h,m,{id:v,data:g}=c;return!((h=(m=g.group)===null||m===void 0?void 0:m.isNew)!==null&&h!==void 0&&h)&&v.toLowerCase().includes(e.toLowerCase())}),i=a.reduce((c,h)=>{var{id:m}=h,v=n.findIndex(g=>g.id===m);return fe(fe({},c),{},{[v]:m})},{});if(!r){this.setState({prevQueriedColumns:i});return}var l=a.map(c=>{var{id:h}=c;return h});if(this.addColumnToSelected(l,!1),l.length>0){var s,u=n.findIndex(c=>{var{id:h}=c;return h.toLowerCase().includes(e.toLowerCase())}),d=(s=this.list)===null||s===void 0?void 0:s.querySelectorAll(".item-wrapper")[u];d?.scrollIntoView({block:"center"})}this.setState({prevQueriedColumns:i,queriedColumnIndex:void 0})}changeSelectedColumn(e){var r,{queriedColumnIndex:n,queriedColumnRange:a,prevQueriedColumns:i}=this.state,l=n;if(i!==void 0){var s=Object.keys(i).length;e==="forward"?a!==void 0?l=a.nextIndex:l===void 0||l>=s-1?l=0:l+=1:e==="back"&&(a!==void 0?l=a.prevIndex:l===void 0||l<=0?l=s-1:l-=1),this.addColumnToSelected([Object.values(i)[l]],!1);var u=parseInt(Object.keys(i)[l],10),d=(r=this.list)===null||r===void 0?void 0:r.querySelectorAll(".item-wrapper")[u];d?.scrollIntoView({block:"center"}),this.setState({queriedColumnIndex:l,queriedColumnRange:void 0})}}adjustQueriedIndex(e){var{prevQueriedColumns:r}=this.state;if(r!==void 0){if(e in Object.values(r)){var n=Object.values(r).indexOf(e);this.setState({queriedColumnIndex:n,queriedColumnRange:void 0});return}for(var a=q(this.getTreeItems()),i=a.findIndex(h=>h.id===e),l=Object.keys(r).map(h=>parseInt(h,10)),s=l.length-1,u=0,d=0;d<l.length;d+=1){var c=l[d];if(c<i)s=d;else if(c>i){u=d;break}}this.setState({queriedColumnRange:{prevIndex:s,nextIndex:u}})}}moveSelectedColumns(e){var{columnHeaderGroups:r}=this.props,{selectedColumns:n}=this.state,a=q(this.getTreeItems()),i=this.getFirstMovableIndex(),l=this.getLastMovableIndex();k(i),k(l);var s=this.getSelectedParentItems(),u=e===H.MOVE_OPTIONS.UP||e===H.MOVE_OPTIONS.TOP;u||s.reverse();for(var d=[],c=r,h=function(){var{id:g,parentId:f,depth:b,data:{visibleIndex:p}}=s[m];switch(e){case H.MOVE_OPTIONS.TOP:{d=M.moveItemOrRange(p,i,d,!0);var O=Array.isArray(p)?p[1]-p[0]+1:1;i+=O,c=le(s[m],null,c);break}case H.MOVE_OPTIONS.BOTTOM:{d=M.moveItemOrRange(p,l,d,!0);var S=Array.isArray(p)?p[1]-p[0]+1:1;l-=S,c=le(s[m],null,c);break}case H.MOVE_OPTIONS.UP:{var D=a.findIndex(G=>G.id===g),y=a.map((G,B)=>B<D&&!n.has(G.id)).lastIndexOf(!0),j=a[y];if(j!=null&&j.parentId!==f)if(Math.abs(j.depth-b)>1){var T=a.map((G,B)=>B<y&&G.depth===b).lastIndexOf(!0),A=a[T];c=le(s[m],A.id,c)}else c=le(s[m],j.parentId,c);else{var x=Le(Array.isArray(p)?p[0]-1:p-1,i,l);d=M.moveItemOrRange(p,x,d,!1);var w=Array.isArray(p)?p[1]-p[0]+1:1;i+=w}break}case H.MOVE_OPTIONS.DOWN:{var I=a.findIndex(G=>G.id===g),E=a.find((G,B)=>B>I&&!n.has(G.id));if(E?.parentId!==f){var L,_=a.find(G=>G.id===f);c=le(s[m],(L=_?.parentId)!==null&&L!==void 0?L:null,c);break}else if(E?.children.length>0){c=le(s[m],E.id,c);break}var F=Le(Array.isArray(p)?p[0]+1:p+1,i,l);d=M.moveItemOrRange(p,F,d,!1);var U=Array.isArray(p)?p[1]-p[0]+1:1;l-=U;break}}},m=0;m<s.length;m+=1)h();return{newMoves:d,groups:c}}handleMoveColumns(e){var{onMovedColumnsChanged:r,movedColumns:n,onColumnHeaderGroupChanged:a}=this.props,{newMoves:i,groups:l}=this.moveSelectedColumns(e),s;e===H.MOVE_OPTIONS.TOP&&(s=()=>{var u,d;(u=this.list)===null||u===void 0||(d=u.parentElement)===null||d===void 0||d.scroll({top:0})}),e===H.MOVE_OPTIONS.BOTTOM&&(s=()=>{var u,d;(u=this.list)===null||u===void 0||(d=u.parentElement)===null||d===void 0||d.scroll({top:this.list.parentElement.scrollHeight})}),a(l),i.length>0&&r(n.concat(i),s)}getSortMoves(e,r,n){var a=[...e],i=r===H.SORTING_OPTIONS.ASC;a.sort((m,v)=>{var g=m.id.toUpperCase(),f=v.id.toUpperCase();return bn.sort(g,f,i)});for(var l=[...n],s=Math.min(...a.flatMap(m=>{var{modelIndex:v}=m.data;return Array.isArray(v)?M.getVisibleIndexes(v,l):M.getVisibleIndex(v,l)})),u=0;u<a.length;u+=1){var d=a[u],{modelIndex:c}=d.data,h=Array.isArray(c)?M.getVisibleIndexes(c,l):M.getVisibleIndex(c,l);l=Array.isArray(h)?M.moveRange([Math.min(...h),Math.max(...h)],s,l,!0):M.moveItem(h,s,l),Array.isArray(h)&&(l=this.getSortMoves(d.children,r,l)),s+=Array.isArray(c)?c.length:1}return l}handleSortColumns(e){for(var r,n,{model:a,onMovedColumnsChanged:i}=this.props,l=this.getTreeItems(),s=(r=this.getFirstMovableIndex())!==null&&r!==void 0?r:0,u=(n=this.getLastMovableIndex())!==null&&n!==void 0?n:l.length-1,d=l.slice(s,u+1),c=[...a.initialMovedColumns],h=0;h<a.frozenColumns.length;h+=1){var m,v=a.frozenColumns[h],g=M.getVisibleIndex((m=a.getColumnIndexByName(v))!==null&&m!==void 0?m:0,c);g!==h&&c.push({from:g,to:h})}var f=this.getSortMoves(d,e,c);i(f)}handleItemClick(e,r){if(r.stopPropagation(),!(r.target instanceof HTMLElement&&(r.target.tagName==="BUTTON"||r.target.tagName==="INPUT"))){r.currentTarget.focus();var{selectedColumns:n,lastSelectedColumn:a}=this.state,i=M.isModifierKeyDown(r),l=r.shiftKey,s=n.has(e),u=[e];if(s&&i){this.removeColumnFromSelected(e);return}var d=q(this.getTreeItems());if(s&&!l&&a===e){var c=d.find(g=>{var{id:f}=g;return f===e});k(c);var h=q(c.children).length;if(h+1===n.size){this.resetSelection();return}}if(l){var m=d.findIndex(g=>g.id===e),v=d.findIndex(g=>g.id===a);u.push(...d.slice(Math.min(v,m),Math.max(v,m)+1).map(g=>g.id))}this.addColumnToSelected(u,i||l),this.adjustQueriedIndex(e),this.setState({lastSelectedColumn:e})}}addColumnToSelected(e,r){var{selectedColumns:n}=this.state,a=new Set(r?[...n.values()].concat(e):e),i=q(this.getTreeItems());i.forEach(l=>{var{id:s,children:u}=l;a.has(s)&&u.forEach(d=>a.add(d.id))}),this.setState({selectedColumns:a})}removeColumnFromSelected(e){var{selectedColumns:r}=this.state,n=q(this.getTreeItems()),a=n.find(s=>{var{id:u}=s;return u===e});k(a);var i=n.find(s=>{var{id:u}=s;return u===a.parentId});q(a?.children).forEach(s=>r.delete(s.id));for(var l=function(){r.delete(i.id);var u=i.parentId;i=n.find(d=>{var{id:c}=d;return c===u})};i!=null;)l();r.delete(e),this.setState({selectedColumns:new Set(r)})}handleDragStart(e){var{selectedColumns:r}=this.state;r.has(e)||this.addColumnToSelected([e],!1)}handleDragEnd(e,r){var{movedColumns:n,onMovedColumnsChanged:a,columnHeaderGroups:i,onColumnHeaderGroupChanged:l}=this.props,s=this.getSelectedParentItems(),u=q(this.getTreeItems()).map((v,g)=>fe(fe({},v),{},{index:g})),d=this.getFirstMovableIndex(),c=this.getLastMovableIndex();k(d),k(c);var{groups:h,movedColumns:m}=Si(e,r,n,i,u,s,d,c);l(h),a(m)}handleGroupNameChange(e,r){var{columnHeaderGroups:n,onColumnHeaderGroupChanged:a}=this.props,i=[...n],l=e.name,s=i.findIndex(m=>{var{name:v}=m;return v===l}),u=i[s];k(u);var d=new ue(u);d.name=r,i.splice(s,1,d);var c=i.findIndex(m=>{var{name:v}=m;return v===d.parent});if(c>=0){var h=new ue(i[c]);h.removeChildren([l]),h.addChildren([r]),i.splice(c,1,h)}a(i)}handleGroupDelete(e){var{columnHeaderGroups:r,onColumnHeaderGroupChanged:n}=this.props,a=r.filter(s=>s.name!==e.name),i=a.findIndex(s=>s.name===e.parent);if(i>=0){var l=new ue(a[i]);l.addChildren(e.children),l.removeChildren([e.name]),a.splice(i,1,l)}n(a)}handleGroupCreate(){var{movedColumns:e,onMovedColumnsChanged:r,onColumnHeaderGroupChanged:n}=this.props,{newMoves:a,groups:i}=this.moveSelectedColumns(H.MOVE_OPTIONS.TOP),l=i.filter(h=>!h.isNew),s=this.getSelectedParentItems(),u=s.map(h=>h.data.modelIndex).flat().filter(h=>h>=0),d="".concat(ue.NEW_GROUP_PREFIX,"-").concat(Date.now()),c=new ue({name:d,children:s.map(h=>{var{id:m}=h;return m}),depth:0,childIndexes:[...new Set(u)]});r(e.concat(a),()=>{var h,m;(h=this.list)===null||h===void 0||(m=h.parentElement)===null||m===void 0||m.scroll({top:0})}),n(l.concat([c])),this.resetSelection()}validateGroupName(e){var{model:r,columnHeaderGroups:n}=this.props,{columns:a}=r;return qe.isValidColumnName(e)?a.some(i=>{var{name:l}=i;return l===e})||n.some(i=>{var{name:l}=i;return l===e})?"Duplicate name":"":"Invalid name"}getFirstMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedFirstMovableIndex(e,e.columns,r)}getLastMovableIndex(){var{model:e,movedColumns:r}=this.props;return this.getMemoizedLastMovableIndex(e,e.columns,r)}getTreeItems(){var{model:e,movedColumns:r,hiddenColumns:n,columnHeaderGroups:a}=this.props,{selectedColumns:i}=this.state;return this.memoizedGetTreeItems(e.columns,r,a,n,i)}getSelectedParentItems(){var{selectedColumns:e}=this.state,r=q(this.getTreeItems());return r.filter(n=>{var{id:a,parentId:i}=n;return e.has(a)&&!e.has(i??"")})}render(){var{model:e,hiddenColumns:r,onColumnVisibilityChanged:n}=this.props,{selectedColumns:a,searchFilter:i,prevQueriedColumns:l,queriedColumnIndex:s}=this.state,u=a.size>0,d=this.getTreeItems(),c=new Map(q(d).map(S=>[S.id,S.data.modelIndex])),h=new Set(r),m=[...new Set(u?[...a.values()].map(S=>c.get(S)).filter(S=>S!=null).flat():d.map(S=>S.data.modelIndex).flat())],v=m.some(S=>!h.has(S)),g=v?"Hide All":"Show All",f=v?"Hide Selected":"Show Selected",b=this.makeVisibilityOrderingList(e.columns,d),p={index:s,next:S=>this.changeSelectedColumn(S)},O=Object.keys(l??{}).length;return o.jsxs("div",{role:"menu",className:"visibility-ordering-builder",tabIndex:0,children:[o.jsxs("div",{className:"top-menu",children:[o.jsx(N,{kind:"ghost",className:"toggle-visibility-btn",onClick:()=>{n(m,!v)},icon:v?nt:at,tooltip:"Toggle column visibility",children:u?f:g}),o.jsx(st,{className:"visibility-search",value:i,matchCount:i?O:void 0,onChange:this.handleSearchInputChange,cursor:p})]}),o.jsxs("div",{className:"top-menu",children:[o.jsx(N,{kind:"ghost",icon:Wt,tooltip:"Reset to default",onClick:()=>{this.resetVisibilityOrdering()},children:"Reset"}),o.jsx("span",{className:"vertical-divider"}),o.jsx(N,{kind:"ghost",icon:Ve,tooltip:"Sort ascending",onClick:()=>{this.handleSortColumns(H.SORTING_OPTIONS.ASC)}}),o.jsx(N,{kind:"ghost",icon:Ke,tooltip:"Sort descending",onClick:()=>{this.handleSortColumns(H.SORTING_OPTIONS.DSC)}}),o.jsx("span",{className:"vertical-divider"}),o.jsxs(N,{kind:"ghost",tooltip:"Create group from selection",disabled:!u,onClick:this.handleGroupCreate,children:[o.jsxs("span",{className:"fa-layers",style:{marginRight:"0.75rem"},children:[o.jsx(W,{mask:zt,icon:et,transform:"right-7 down-5 shrink-6"}),o.jsx(W,{icon:Vt,transform:"right-8 down-6 shrink-8"})]}),"Group"]}),o.jsx("span",{className:"vertical-divider"}),o.jsx(N,{kind:"ghost",icon:Kt,tooltip:"Move selection up",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.UP)},disabled:!u}),o.jsx(N,{kind:"ghost",icon:qt,tooltip:"Move selection down",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.DOWN)},disabled:!u}),o.jsx(N,{kind:"ghost",icon:Xt,tooltip:"Move selection to top",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.TOP)},disabled:!u}),o.jsx(N,{kind:"ghost",icon:Yt,tooltip:"Move selection to bottom",onClick:()=>{this.handleMoveColumns(H.MOVE_OPTIONS.BOTTOM)},disabled:!u})]}),o.jsx("div",{role:"menu",className:$("visibility-ordering-list"),children:o.jsx("div",{className:"column-list",ref:S=>{this.list=S},children:b})})]})}}Y(H,"SORTING_OPTIONS",{DSC:"DSC",ASC:"ASC"});Y(H,"MOVE_OPTIONS",{TOP:"TOP",BOTTOM:"BOTTOM",UP:"UP",DOWN:"DOWN"});const lo=H;class so extends sn{getGridY(e){var r=super.getGridY(e),{isFilterBarShown:n,theme:a,advancedFilters:i,quickFilters:l,sorts:s,reverseType:u}=e;return n?r+=a.filterBarHeight:(l!=null&&l.size>0||i!=null&&i.size>0)&&(r+=a.filterBarCollapsedHeight),u!==V.REVERSE_TYPE.NONE&&s!=null&&s.length>0&&(r+=a.reverseHeaderBarHeight),r}getUserColumnWidths(){return this.userColumnWidths}}var Ue=16,xi=new Map([["sortUp",Zt],["sortDown",Qt],["caretDown",Jt],["caretRight",en],["cellOverflow",rn]]),Ii=dt(t=>{var e=xi.get(t);if(e===void 0)throw new Error("Icon is undefined");var r=Array.isArray(e.icon[4])?e.icon[4][0]:e.icon[4],n=new Path2D(r),a=new Path2D,i={a:Ue/e.icon[0],d:Ue/e.icon[1]};return a.addPath(n,i),a},{max:1e3});function Se(t){return Ii(t)}class ji{static drawTreeMarker(e,r,n,a,i,l,s){e.save();var{x1:u,y1:d}=i,c=Se(s?"caretDown":"caretRight"),h=n+u-2,m=a+d+2.5;e.fillStyle=l,e.textAlign="center",e.translate(h,m),e.fill(c),e.restore()}}const pt=ji;class Di extends dn{drawCellContent(e,r,n,a){var i,{metrics:l,model:s}=r,{modelColumns:u,modelRows:d}=l,c=Z(d,a),h=u.get(n);if(h!==void 0){var m=s.valueForCell(h,c);if(V.isTextType((i=s.columns[h])===null||i===void 0?void 0:i.type)&&(m===null||m==="")){var v=e.font;e.font="italic ".concat(v),super.drawCellContent(e,r,n,a),e.font=v;return}super.drawCellContent(e,r,n,a)}}getTextRenderMetrics(e,r,n){var a=M.getTextRenderMetrics(e,r,n),{mouseX:i,mouseY:l,metrics:s,theme:u}=e;if(i==null||l==null)return a;var{column:d,row:c}=M.getGridPointFromXY(i,l,s);if(r===d&&n===c){var{left:h}=this.getCellOverflowButtonPosition(i,l,s,u);this.shouldRenderOverflowButton(e)&&h!=null&&(a.width=h-s.gridX-a.x)}return a}getCellOverflowButtonPosition(e,r,n,a){var i={left:null,top:null,width:null,height:null};if(e==null||r==null||n==null)return i;var{rowHeight:l,columnWidth:s,left:u,top:d}=M.getCellInfoFromXY(e,r,n);if(u==null||s==null||d==null)return i;var{width:c,verticalBarWidth:h}=n,{cellHorizontalPadding:m}=a,v=Ue+2*m,g=l,f=Math.min(n.gridX+u+s,c-h),b=f-v,p=n.gridY+d;return{left:b,top:p,width:v,height:g}}shouldRenderOverflowButton(e){var r,n,{context:a,mouseX:i,mouseY:l,metrics:s,model:u,theme:d}=e;if(i==null||l==null)return!1;var{row:c,column:h,modelRow:m,modelColumn:v}=M.getCellInfoFromXY(i,l,s);if(c==null||h==null||m==null||v==null||!V.isStringType(u.columns[v].type))return!1;var g=(r=u.textForCell(v,m))!==null&&r!==void 0?r:"",{width:f}=M.getTextRenderMetrics(e,h,c),b=(n=s.fontWidths.get(d.font))!==null&&n!==void 0?n:lt;a.save(),a.font=d.font;var p=this.getCachedTruncatedString(a,g,f,b,u.truncationCharForCell(v,m));return a.restore(),g!==""&&p!==g}drawTreeMarker(e,r,n,a,i,l,s){pt.drawTreeMarker(e,r,n,a,i,l,s)}}const Pi=Di;class Ni extends un{drawTreeMarker(e,r,n,a,i,l,s){pt.drawTreeMarker(e,r,n,a,i,l,s)}}const Ti=Ni;function Wr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function zr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wr(Object(r),!0).forEach(function(n){$e(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function $e(t,e,r){return e=Ei(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ei(t){var e=Ri(t,"string");return typeof e=="symbol"?e:String(e)}function Ri(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fe=Object.freeze({SORT_UP:"sortUp",SORT_DOWN:"sortDown",CARET_DOWN:"caretDown",CARET_RIGHT:"caretRight",CELL_OVERFLOW:"cellOverflow"}),Vr=10;class Be extends cn{constructor(){super(...arguments),$e(this,"textCellRenderer",new Pi),$e(this,"dataBarCellRenderer",new Ti)}static isFilterValid(e,r){var n=e==null||e.filter!=null,a=r==null||r.filter!=null;return n&&a}getSortIcon(e){return e?e.direction===V.sortDirection.ascending?Se(Fe.SORT_UP):e.direction===V.sortDirection.descending?Se(Fe.SORT_DOWN):null:null}drawCanvas(e){super.drawCanvas(e),this.drawScrim(e)}drawGrid(e,r){super.drawGrid(e,r),this.drawCellOverflowButton(r)}drawGridLines(e,r){super.drawGridLines(e,r),this.drawGroupedColumnLine(e,r),this.drawPendingRowLine(e,r)}drawCellContent(e,r,n,a){var{metrics:i,model:l}=r,{modelColumns:s,modelRows:u}=i,d=s.get(n),c=Z(u,a);if(d!==void 0){var h=l.renderTypeForCell(d,c),m=this.getCellRenderer(h);m.drawCellContent(e,r,n,a)}}getCellOverflowButtonPosition(e){var{mouseX:r,mouseY:n,metrics:a,theme:i}=e;return this.textCellRenderer.getCellOverflowButtonPosition(r,n,a,i)}shouldRenderOverflowButton(e){return this.textCellRenderer.shouldRenderOverflowButton(e)}drawCellOverflowButton(e){var{context:r,mouseX:n,mouseY:a,theme:i}=e;if(!(n==null||a==null)&&this.shouldRenderOverflowButton(e)){var{left:l,top:s,width:u,height:d}=this.getCellOverflowButtonPosition(e),{cellHorizontalPadding:c,overflowButtonColor:h,overflowButtonHoverColor:m}=i;r.save(),m!=null&&l!=null&&u!=null&&s!=null&&d!=null&&n>=l&&n<=l+u&&a>=s&&a<=s+d?r.fillStyle=m:h!=null&&(r.fillStyle=h);var v=Se(Fe.CELL_OVERFLOW);l!=null&&s!=null&&r.translate(l+c,s+2),r.fill(v),r.restore()}}drawGroupedColumnLine(e,r){var{metrics:n,model:a,theme:i}=r,{groupedColumns:l}=a,{maxY:s,allColumnWidths:u,allColumnXs:d}=n;if(!(l.length===0||i.groupedColumnDividerColor==null)){var c=l.length-1,h=d.get(c),m=u.get(c);if(!(h==null||m==null)){var v=h+m+.5;e.strokeStyle=i.groupedColumnDividerColor,e.lineWidth=1,e.beginPath(),e.moveTo(v,0),e.lineTo(v,s),e.stroke()}}}drawPendingRowLine(e,r){var{metrics:n,model:a,theme:i}=r,{allRowYs:l,maxX:s}=n,{pendingRowCount:u}=a;if(!(u<=0)){var d=a.rowCount-a.pendingRowCount-a.floatingBottomRowCount,c=l.get(d);c!=null&&(c-=.5,e.save(),e.setLineDash([4,2]),e.strokeStyle=i.pendingTextColor,e.lineWidth=1,e.beginPath(),e.moveTo(0,c),e.lineTo(s,c),e.stroke(),e.restore())}}drawMouseColumnHover(e,r){var{theme:n,metrics:a,hoverSelectColumn:i}=r;if(!(i==null||n.linkerColumnHoverBackgroundColor==null)){var{allColumnWidths:l,allColumnXs:s,maxY:u}=a,d=Z(s,i),c=Z(l,i);e.fillStyle=n.linkerColumnHoverBackgroundColor,e.fillRect(d,0,c,u)}}drawMouseRowHover(e,r){var{isSelectingColumn:n}=r;n||super.drawMouseRowHover(e,r)}drawScrim(e){var{context:r,loadingScrimProgress:n,metrics:a,theme:i}=e;if(n!=null){var{width:l,height:s,gridY:u}=a,{scrimBlurSize:d,scrimColor:c}=i;r.save(),r.globalCompositeOperation="color",r.filter="blur(".concat(d,"px)"),c!=null&&(r.fillStyle=c),r.beginPath(),r.rect(0,u,l,s-u),r.clip(),r.fillRect(-d,-d+u,d*2+l,(d*2+(s-u))*n),r.globalCompositeOperation="source-over",r.filter="blur(".concat(d,"px) opacity(15%)"),r.fillRect(-d,-d+u,d*2+l,(d*2+(s-u))*n),r.restore()}}drawColumnHeaders(e,r){super.drawColumnHeaders(e,r);var{theme:n,metrics:a,model:i,reverseType:l}=r,{columnHeaderHeight:s}=a;if(this.drawFilterHeaders(e,r),!(s<=0)){var{sort:u}=i;if(u.length===1){var d=l!==V.REVERSE_TYPE.NONE,c;d?c=n.headerReverseBarColor:c=n.headerSortBarColor,this.drawHeaderBar(e,r,c,d?n.reverseHeaderBarHeight:n.sortHeaderBarHeight)}else u.length>1&&(l!==V.REVERSE_TYPE.NONE&&this.drawHeaderBar(e,r,n.headerReverseBarColor,n.reverseHeaderBarHeight,!1),this.drawHeaderBar(e,r,n.headerSortBarColor,n.sortHeaderBarHeight))}}drawHeaderBar(e,r,n,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,{theme:l,metrics:s,model:u}=r,{columnHeaderHeight:d,width:c}=s,h=0;i||(h=a),e.fillStyle=l.headerBarCasingColor,e.fillRect(0,u.columnHeaderMaxDepth*d-a-2+h,c,a+2),e.fillStyle=n,e.fillRect(0,u.columnHeaderMaxDepth*d-a-1+h,c,a)}drawColumnHeadersAtDepth(e,r,n,a,i){var{metrics:l,model:s,isMenuShown:u}=r,{columnHeaderMaxDepth:d}=s,{width:c}=l,h=zr(zr({},a),{},{maxX:i===d-1&&a.maxX===c?c-(u?0:30):a.maxX});super.drawColumnHeadersAtDepth(e,r,n,h,i)}drawColumnHeaderAtIndex(e,r,n,a){var i,l;super.drawColumnHeaderAtIndex(e,r,n,a);var{metrics:s,model:u,theme:d}=r,{modelColumns:c,allColumnWidths:h,allColumnXs:m,gridX:v,columnHeaderHeight:g,fontWidths:f}=s,{headerHorizontalPadding:b}=d,p=Z(h,n,0),O=Z(m,n)+v,S=c.get(n);if(S!=null){var D=(i=u.columns[S])===null||i===void 0?void 0:i.name;if(D!=null){var y=V.getSortForColumn(u.sort,D);if(y){var j=this.getSortIcon(y);if(j){var T=u.textForColumnHeader(S);if(T!==void 0){var A=(l=f.get(e.font))!==null&&l!==void 0?l:lt;k(A);var x=T.length*A,w=v+O+x+b,{maxX:I}=a;I-=b;var E=v+O+p-b-1,L=w>I?w+1:Math.min(I,E),_=y.direction===V.sortDirection.ascending?-6:-12,F=g*.5+_;e.save(),e.beginPath(),e.rect(O,0,p,g),e.clip(),e.fillStyle=d.headerSortBarColor,e.translate(L,F),e.fill(j),e.restore()}}}}}}drawFilterHeaders(e,r){var{isFilterBarShown:n,quickFilters:a,advancedFilters:i}=r;n?this.drawExpandedFilterHeaders(e,r):(a!=null&&a.size>0||i!=null&&i.size>0)&&this.drawCollapsedFilterHeaders(e,r)}drawExpandedFilterHeaders(e,r){var{metrics:n,model:a,theme:i,quickFilters:l,advancedFilters:s}=r,{filterBarHeight:u}=i;if(!(u<=0)){var{gridX:d,gridY:c,maxX:h,modelColumns:m,visibleColumns:v,allColumnWidths:g,allColumnXs:f}=n,b=c-u;e.save(),e.font=i.font,e.textAlign="left",l!=null&&l.size>0||s!=null&&s.size>0?e.fillStyle=i.filterBarExpandedActiveBackgroundColor:e.fillStyle=i.filterBarExpandedBackgroundColor,e.fillRect(d,b,h,u-1),e.fillStyle=i.headerBarCasingColor,e.fillRect(d,b+u-1,h,1);var p=b;e.strokeStyle=i.filterBarSeparatorColor,e.beginPath();for(var O=0;O<v.length;O+=1){var S=v[O],D=Z(m,S),y=Z(f,S),j=Z(g,S);if(a.isFilterable(D)&&j>0){var T=d+(y??0);e.rect(T+.5,p+.5,j,u-2)}}e.stroke();for(var A=0;A<v.length;A+=1){var x=v[A],w=Z(g,x),I=Z(f,x),E=I+d;this.drawExpandedFilterHeader(e,r,x,E,w)}e.restore()}}drawExpandedFilterHeader(e,r,n,a,i){if(!(i<=0)){var{metrics:l,theme:s,quickFilters:u,advancedFilters:d}=r,{modelColumns:c,gridY:h}=l,{filterBarHeight:m,filterBarExpandedActiveCellBackgroundColor:v,filterBarErrorColor:g,filterBarHorizontalPadding:f,headerColor:b}=s,p=h-m,O=c.get(n);if(O!==void 0){var S=u.get(O),D=d.get(O);if(!(S==null&&D==null)){var y=null;if(S!=null){var{text:j}=S;if(y=j,y||(y=V.getFilterText(S.filter)),y!=null){var{fontWidths:T}=l,A=T.get(e.font);(A==null||A===0)&&(A=e.measureText("8").width,A||(A=10));var x=(i-f*2)/A;x<=0?y="":y.length>x&&(y="".concat(y.substring(0,x-1),"…"))}}e.save();var w=Be.isFilterValid(D,S);if(w&&v!=null)e.fillStyle=v,e.fillRect(a+1,p+1,i-1,m-3);else if(g!=null){e.fillStyle=g,e.lineWidth=2,e.strokeStyle=g;var I=a+2,E=p+2,L=i-3,_=m-5;e.strokeRect(I,E,L,_)}if(y!=null&&y!==""){var F=a+f,U=p+m*.5+1;e.fillStyle=b,e.fillText(y,F,U)}e.restore()}}}}drawCollapsedFilterHeaders(e,r){var{metrics:n,theme:a}=r,{headerSeparatorColor:i,filterBarCollapsedHeight:l}=a;if(!(l<=0)){var{gridX:s,gridY:u,maxX:d,visibleColumns:c,allColumnWidths:h,allColumnXs:m}=n,v=u-l;e.save(),e.fillStyle=i,e.fillRect(s,v,d,l);for(var g=0;g<c.length;g+=1){var f=c[g],b=h.get(f),p=m.get(f);if(p!=null&&b!=null){var O=p+s;this.drawCollapsedFilterHeader(e,r,f,O,b)}}e.restore()}}drawCollapsedFilterHeader(e,r,n,a,i){if(!(i<=0)){var{metrics:l,theme:s,quickFilters:u,advancedFilters:d}=r,{modelColumns:c,gridY:h}=l,m=c.get(n);if(m!==void 0){var v=u.get(m),g=d.get(m),{filterBarCollapsedHeight:f,filterBarActiveColor:b,filterBarActiveBackgroundColor:p,filterBarErrorColor:O}=s;e.save();var S=Be.isFilterValid(g,v);p!=null&&v==null&&g==null?e.fillStyle=p:b!=null&&S?e.fillStyle=b:O!=null&&(e.fillStyle=O);var D=a+1,y=h-f,j=i-1,T=f-1;e.fillRect(D,y,j,T),e.restore()}}}drawRowFooters(e,r){var{metrics:n,model:a,mouseX:i,mouseY:l,theme:s}=r,{gridY:u,gridX:d,maxX:c,modelRows:h,floatingTopHeight:m,floatingBottomHeight:v,floatingRows:g,rowFooterWidth:f,height:b,horizontalBarHeight:p,verticalBarWidth:O,allRowHeights:S,allRowYs:D,width:y}=n;if(!(f<=0||g.length===0)){var{cellHorizontalPadding:j,floatingGridRowColor:T,floatingRowBackgroundColors:A,headerColor:x,rowHoverBackgroundColor:w}=s;e.translate(d,u),e.beginPath();var I=Math.min(c,y-f-O-d);e.fillStyle=A,m>0&&e.rect(I,0,f,m),v>0&&e.rect(I,b-u-p-v,f,v),e.fill();var E=i!=null&&l!=null&&i>=d&&i<=c+f?M.getRowAtY(l,n):null;if(w!=null&&E!==null&&g.includes(E)){e.fillStyle=w;var L=D.get(E),_=S.get(E);k(L),k(_),e.fillRect(I,L,f,_)}if(e.beginPath(),T!=null&&(e.strokeStyle=T),m>0&&(e.moveTo(I+.5,.5),e.lineTo(I+.5,m-.5)),v>0){var F=b-u-p-v;e.moveTo(I-.5,F+.5),e.lineTo(I-.5,F+v-.5)}e.stroke(),e.fillStyle=x,e.textAlign="left";for(var U=I+j,G=0;G<g.length;G+=1){var B=g[G],ae=S.get(B),Ye=D.get(B),Ze=h.get(B);if(Ye!=null&&ae!=null&&Ze!=null){var bt=Ye+ae*.5;e.fillText(a.textForRowFooter(Ze),U,bt)}}e.translate(-d,-u)}}getExpandButtonPosition(e,r){var{mouseX:n,mouseY:a,metrics:i,theme:l}=e,s={left:null,top:null,width:null,height:null};if(n==null||a==null||r==null||!i)return s;var{rowHeight:u,left:d,top:c}=M.getCellInfoFromXY(n,a,i);k(d),k(u),k(c);var{cellHorizontalPadding:h}=l,m=Vr+2*h,v=Math.max(d+Vr*r,i.gridX),g=i.gridY+c;return{left:v,top:g,width:m,height:u}}}const Ai="12px Fira Sans, sans-serif",Mi="var(--dh-color-white)",ki="var(--dh-color-black)",Kr={"grid-bg":"var(--dh-color-grid-bg)",font:Ai,white:Mi,black:ki,"header-bg":"var(--dh-color-grid-header-bg)","header-color":"var(--dh-color-grid-header-text)","header-height":"30px","header-separator-color":"var(--dh-color-grid-header-separator)","header-separator-hover-color":"var(--dh-color-grid-header-separator-hover)","header-hidden-separator-hover-color":"var(--dh-color-grid-header-separator-hidden-hover)","header-sort-bar-color":"var(--dh-color-grid-header-sort-bar)","header-reverse-bar-color":"var(--dh-color-grid-header-reverse-bar)","header-bar-casing-color":"var(--dh-color-grid-header-bar-casing)","header-font":"600 12px Fira Sans, sans-serif","row-height":"19px","row-background-colors":"var(--dh-color-grid-row-0-bg) var(--dh-color-grid-row-1-bg)","active-cell-selection-border-width":"2px","selection-color":"var(--dh-color-grid-selection)","selection-outline-color":"var(--dh-color-grid-selection-outline)","selection-outline-casing-color":"var(--dh-color-grid-selection-outline-casing)","row-hover-bg":"var(--dh-color-grid-row-hover-bg)","row-shadow-alpha":"var(--dh-color-grid-row-shadow-alpha)","selected-row-hover-bg":"var(--dh-color-grid-row-hover-bg-selected)","scroll-bar-active-selection-tick-color":"var(--dh-color-grid-scroll-bar-active-selection-tick)","scroll-bar-bg":"var(--dh-color-grid-scroll-bar-bg)","scroll-bar-hover-bg":"var(--dh-color-grid-scroll-bar-hover-bg)","scroll-bar-casing-color":"var(--dh-color-grid-scroll-bar-casing)","scroll-bar-corner-color":"var(--dh-color-grid-scroll-bar-corner)","scroll-bar-color":"var(--dh-color-grid-scroll-bar)","scroll-bar-hover-color":"var(--dh-color-grid-scroll-bar-hover)","scroll-bar-active-color":"var(--dh-color-grid-scroll-bar-active)","text-color":"var(--dh-color-grid-text)","hyperlink-color":"var(--dh-color-grid-text-hyperlink)","positive-number-color":"var(--dh-color-grid-number-positive)","negative-number-color":"var(--dh-color-grid-number-negative)","zero-number-color":"var(--dh-color-grid-number-zero)","date-color":"var(--dh-color-grid-date)","pending-text-color":"var(--dh-color-grid-text-pending)","error-text-color":"var(--dh-color-grid-text-error)","null-string-color":"var(--dh-color-grid-string-null)","filter-bar-active-bg":"var(--dh-color-grid-filter-bar-active-bg)","filter-bar-active-color":"var(--dh-color-grid-filter-bar-active)","filter-bar-expanded-bg":"var(--dh-color-grid-filter-bar-expanded-bg)","filter-bar-expanded-active-bg":"var(--dh-color-grid-filter-bar-expanded-active-bg)","filter-bar-expanded-active-cell-bg":"var(--dh-color-grid-filter-bar-expanded-active-cell-bg)","filter-bar-separator-color":"var(--dh-color-grid-filter-bar-separator)","filter-bar-error-color":"var(--dh-color-grid-filter-bar-error)","filter-icon-color":"var(--dh-color-grid-filter-icon)","scrim-color":"var(--dh-color-grid-scrim)","context-menu-sort-icon-color":"var(--dh-color-grid-context-menu-sort-icon)","context-menu-reverse-icon-color":"var(--dh-color-grid-context-menu-reverse-icon)","linker-column-hover-bg":"var(--dh-color-grid-column-linker-hover-bg)","tree-line-color":"var(--dh-color-grid-tree-line)","tree-marker-color":"var(--dh-color-grid-tree-marker)","tree-marker-hover-color":"var(--dh-color-grid-tree-marker-hover)","grouped-column-divider-color":"var(--dh-color-grid-column-grouped-divider)","floating-grid-row-color":"var(--dh-color-grid-floating-row)","floating-row-background-colors":"var(--dh-color-grid-floating-row-bg)","floating-divider-inner-color":"var(--dh-color-grid-floating-divider-inner)","floating-divider-outer-color":"var(--dh-color-grid-floating-divider-outer)","overflow-button-color":"var(--dh-color-grid-overflow-button)","overflow-button-hover-color":"var(--dh-color-grid-overflow-button-hover)","zero-line-color":"var(--dh-color-grid-data-bar-zero-line)","positive-bar-color":"var(--dh-color-grid-data-bar-positive)","negative-bar-color":"var(--dh-color-grid-data-bar-negative)","marker-bar-color":"var(--dh-color-grid-data-bar-marker)"};function qr(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Xr(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?qr(Object(r),!0).forEach(function(n){Fi(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):qr(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Fi(t,e,r){return e=_i(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function _i(t){var e=Li(t,"string");return typeof e=="symbol"?e:String(e)}function Li(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yr=be.module("IrisGridTheme");function Hi(){var t,e=tn(Kr);return e["row-background-colors"]=nn((t=e["row-background-colors"])!==null&&t!==void 0?t:"").map(r=>{var[n,a]=r;return an.normalizeCssColor(e["row-background-colors"].substring(n,a+1))}).join(" "),Yr.debug2("Iris grid theme:",Kr),Yr.debug2("Iris grid theme derived:",e),Object.freeze(Xr(Xr({},hn),{},{backgroundColor:e["grid-bg"],white:e.white,black:e.black,font:e.font,headerBackgroundColor:e["header-bg"],headerColor:e["header-color"],headerSeparatorColor:e["header-separator-color"],headerSeparatorHoverColor:e["header-separator-hover-color"],headerHiddenSeparatorHoverColor:e["header-hidden-separator-hover-color"],headerSortBarColor:e["header-sort-bar-color"],headerReverseBarColor:e["header-reverse-bar-color"],headerBarCasingColor:e["header-bar-casing-color"],headerFont:e["header-font"],rowBackgroundColors:e["row-background-colors"],rowHoverBackgroundColor:e["row-hover-bg"],selectionColor:e["selection-color"],selectionOutlineColor:e["selection-outline-color"],selectionOutlineCasingColor:e["selection-outline-casing-color"],selectedRowHoverBackgroundColor:e["selected-row-hover-bg"],scrollBarBackgroundColor:e["scroll-bar-bg"],scrollBarHoverBackgroundColor:e["scroll-bar-hover-bg"],scrollBarCasingColor:e["scroll-bar-casing-color"],scrollBarCornerColor:e["scroll-bar-corner-color"],scrollBarColor:e["scroll-bar-color"],scrollBarHoverColor:e["scroll-bar-hover-color"],scrollBarActiveColor:e["scroll-bar-active-color"],scrollBarSelectionTickColor:e["selected-row-hover-bg"],scrollBarActiveSelectionTickColor:e["scroll-bar-active-selection-tick-color"],textColor:e["text-color"],hyperlinkColor:e["hyperlink-color"],positiveNumberColor:e["positive-number-color"],negativeNumberColor:e["negative-number-color"],zeroNumberColor:e["zero-number-color"],dateColor:e["date-color"],pendingTextColor:e["pending-text-color"],errorTextColor:e["error-text-color"],nullStringColor:e["null-string-color"],filterBarActiveBackgroundColor:e["filter-bar-active-bg"],filterBarExpandedBackgroundColor:e["filter-bar-expanded-bg"],filterBarExpandedActiveBackgroundColor:e["filter-bar-expanded-active-bg"],filterBarExpandedActiveCellBackgroundColor:e["filter-bar-expanded-active-cell-bg"],filterBarSeparatorColor:e["filter-bar-separator-color"],filterBarActiveColor:e["filter-bar-active-color"],filterBarErrorColor:e["filter-bar-error-color"],filterIconColor:e["filter-icon-color"],scrimColor:e["scrim-color"],contextMenuSortIconColor:e["context-menu-sort-icon-color"],contextMenuReverseIconColor:e["context-menu-reverse-icon-color"],allowRowResize:!1,autoSelectRow:!0,gridColumnColor:null,gridRowColor:null,groupedColumnDividerColor:e["grouped-column-divider-color"],columnHoverBackgroundColor:null,headerHorizontalPadding:12,scrollBarSize:13,scrollBarHoverSize:16,minScrollHandleSize:24,rowHeight:parseInt(e["row-height"],10)||19,columnWidth:100,rowHeaderWidth:0,rowFooterWidth:60,columnHeaderHeight:parseInt(e["header-height"],10)||30,filterBarHeight:30,filterBarCollapsedHeight:5,sortHeaderBarHeight:2,reverseHeaderBarHeight:4,filterBarHorizontalPadding:4,activeCellSelectionBorderWidth:parseInt(e["active-cell-selection-border-width"],10)||2,shadowAlpha:parseFloat(e["row-shadow-alpha"])||.15,scrimBlurSize:25,minScrimTransitionTime:150,maxScrimTransitionTime:350,scrollSnapToRow:!0,linkerColumnHoverBackgroundColor:e["linker-column-hover-bg"],treeLineColor:e["tree-line-color"],treeMarkerColor:e["tree-marker-color"],treeMarkerHoverColor:e["tree-marker-hover-color"],floatingGridColumnColor:null,floatingGridRowColor:e["floating-grid-row-color"],floatingRowBackgroundColors:e["floating-row-background-colors"],floatingDividerInnerColor:e["floating-divider-inner-color"],floatingDividerOuterColor:e["floating-divider-outer-color"],overflowButtonColor:e["overflow-button-color"],overflowButtonHoverColor:e["overflow-button-hover-color"],zeroLineColor:e["zero-line-color"],positiveBarColor:e["positive-bar-color"],negativeBarColor:e["negative-bar-color"],markerBarColor:e["marker-bar-color"]}))}function Gi(t){return typeof t=="object"&&t!=null&&"equals"in t&&typeof t.equals=="function"}function Ui(t){return"".concat(t)}function uo(t){var{column:e,table:r,filter:n=Sn,onChange:a,selectedValue:i,disabled:l,className:s,formatValue:u=Ui,maxSize:d=1e3}=t,c=Cn(),[h,m]=C.useState([]);C.useEffect(()=>{if(r==null){m([]);return}var b=e??r.columns[0];r.applyFilter(n);var p=r.setViewport(0,d,[b]);return p.addEventListener(c.Table.EVENT_UPDATED,O=>{var{detail:S}=O,D=S.rows.map(y=>y.get(b));m(D)}),()=>{p.close()}},[e,c,n,d,r]);var v=C.useMemo(()=>i===void 0?[void 0,...h]:h,[i,h]),g=C.useMemo(()=>v.findIndex(b=>b===i||Gi(b)&&b.equals(i)),[i,v]),f=C.useCallback(b=>{a(v[b])},[a,v]);return o.jsx(Oe,{className:s,value:g,onChange:f,disabled:l,children:v.map((b,p)=>o.jsx(ot,{value:p,children:u(b)},"".concat(p)))})}var $i=C.createContext(null);function co(t){var{children:e}=t,{activeThemes:r}=wn(),n=C.useMemo(Hi,[r]);return o.jsx($i.Provider,{value:n,children:e})}export{Ji as A,to as C,eo as F,ut as I,ao as O,io as R,Mn as S,uo as T,lo as V,Qi as a,no as b,ro as c,Ln as d,so as e,Be as f,$i as g,co as h,$n as i,Vn as j,Yn as k,oo as l,X as m,Hi as n};
|
|
11
|
+
//# sourceMappingURL=IrisGridThemeProvider-bc978029.js.map
|