@toolbox-web/grid 1.6.2 → 1.8.0
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/README.md +51 -15
- package/all.js +267 -158
- package/all.js.map +1 -1
- package/index.js +866 -722
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +68 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +182 -1
- package/lib/core/plugin/base-plugin.d.ts.map +1 -1
- package/lib/core/plugin/index.d.ts +1 -1
- package/lib/core/plugin/index.d.ts.map +1 -1
- package/lib/core/plugin/plugin-manager.d.ts +56 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +36 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +1349 -31
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +140 -87
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +64 -7
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +123 -65
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts +6 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +95 -13
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +91 -34
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +6 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +192 -123
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +57 -0
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts +7 -2
- package/lib/plugins/grouping-rows/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +142 -60
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +69 -12
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +70 -13
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts +3 -3
- package/lib/plugins/pinned-columns/PinnedColumnsPlugin.d.ts.map +1 -1
- package/lib/plugins/pinned-columns/index.js +106 -36
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +57 -0
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +57 -0
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/lib/plugins/print/index.js +58 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/ReorderPlugin.d.ts.map +1 -1
- package/lib/plugins/reorder/column-drag.d.ts +2 -2
- package/lib/plugins/reorder/index.js +68 -17
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts +6 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +125 -54
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +169 -112
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts +14 -2
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +84 -7
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +79 -22
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/TreePlugin.d.ts +7 -1
- package/lib/plugins/tree/TreePlugin.d.ts.map +1 -1
- package/lib/plugins/tree/index.js +140 -58
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts +6 -1
- package/lib/plugins/undo-redo/UndoRedoPlugin.d.ts.map +1 -1
- package/lib/plugins/undo-redo/index.js +79 -10
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +57 -0
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +80 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +25 -25
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +15 -15
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/clipboard.umd.js +5 -5
- package/umd/plugins/clipboard.umd.js.map +1 -1
- package/umd/plugins/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +2 -2
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/pinned-columns.umd.js +1 -1
- package/umd/plugins/pinned-columns.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
- package/umd/plugins/reorder.umd.js +1 -1
- package/umd/plugins/reorder.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
- package/umd/plugins/tree.umd.js +1 -1
- package/umd/plugins/tree.umd.js.map +1 -1
- package/umd/plugins/undo-redo.umd.js +1 -1
- package/umd/plugins/undo-redo.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const ge = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-scrollbar-thumb: var(--tbw-color-border-strong);--tbw-scrollbar-track: var(--tbw-color-bg);--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator],&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}', X = {
|
|
1
|
+
const we = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);color-scheme:light dark;position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);text-transform:var(--tbw-header-text-transform);letter-spacing:var(--tbw-header-letter-spacing);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;color:var(--tbw-sort-indicator-color);display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible;opacity:1;color:var(--tbw-sort-indicator-active-color)}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{position:relative;display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}@keyframes tbw-spin{to{transform:rotate(360deg)}}.tbw-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:1000;pointer-events:all;animation:tbw-fade-in .15s ease-out}@keyframes tbw-fade-in{0%{opacity:0}to{opacity:1}}.tbw-spinner{--tbw-spinner-size: 48px;--tbw-spinner-border-width: 3px;--tbw-spinner-color: var(--tbw-color-accent);--tbw-spinner-track-color: var(--tbw-color-border);width:var(--tbw-spinner-size);height:var(--tbw-spinner-size);border:var(--tbw-spinner-border-width) solid var(--tbw-spinner-track-color);border-top-color:var(--tbw-spinner-color);border-radius:50%;animation:tbw-spin .8s linear infinite}.tbw-spinner--large{--tbw-spinner-size: min(48px, calc(100% - 16px) )}.tbw-spinner--small{--tbw-spinner-size: calc(var(--tbw-row-height, 28px) * .6);--tbw-spinner-border-width: 2px}.data-grid-row.tbw-row-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .6);content:"";position:absolute;left:var(--tbw-spacing-md);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}.cell.tbw-cell-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .5);content:"";position:absolute;left:var(--tbw-spacing-sm);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}}', X = {
|
|
2
2
|
STRETCH: "stretch",
|
|
3
3
|
FIXED: "fixed"
|
|
4
4
|
}, Ze = {
|
|
5
5
|
mode: "reduced-motion",
|
|
6
6
|
duration: 200,
|
|
7
7
|
easing: "ease-out"
|
|
8
|
-
},
|
|
8
|
+
}, be = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', k = {
|
|
9
9
|
expand: "▶",
|
|
10
10
|
collapse: "▼",
|
|
11
11
|
sortAsc: "▲",
|
|
@@ -14,43 +14,43 @@ const ge = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{tbw-grid{--tbw
|
|
|
14
14
|
submenuArrow: "▶",
|
|
15
15
|
dragHandle: "⋮⋮",
|
|
16
16
|
toolPanel: "☰",
|
|
17
|
-
filter:
|
|
18
|
-
filterActive:
|
|
17
|
+
filter: be,
|
|
18
|
+
filterActive: be,
|
|
19
19
|
print: "🖨️"
|
|
20
20
|
};
|
|
21
21
|
function Je(t) {
|
|
22
22
|
return Array.from(t.querySelectorAll("tbw-grid-column")).map((o) => {
|
|
23
23
|
const n = o.getAttribute("field") || "";
|
|
24
24
|
if (!n) return null;
|
|
25
|
-
const i = o.getAttribute("type") || void 0, s = i && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(i) ? i : void 0, l = o.getAttribute("header") || void 0,
|
|
25
|
+
const i = o.getAttribute("type") || void 0, s = i && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(i) ? i : void 0, l = o.getAttribute("header") || void 0, a = o.hasAttribute("sortable"), c = o.hasAttribute("editable"), h = { field: n, type: s, header: l, sortable: a, editable: c }, u = o.getAttribute("width");
|
|
26
26
|
if (u) {
|
|
27
|
-
const
|
|
28
|
-
!isNaN(
|
|
27
|
+
const m = parseFloat(u);
|
|
28
|
+
!isNaN(m) && /^\d+(\.\d+)?$/.test(u.trim()) ? h.width = m : h.width = u;
|
|
29
29
|
}
|
|
30
30
|
const p = o.getAttribute("minWidth") || o.getAttribute("min-width");
|
|
31
31
|
if (p) {
|
|
32
|
-
const
|
|
33
|
-
isNaN(
|
|
32
|
+
const m = parseFloat(p);
|
|
33
|
+
isNaN(m) || (h.minWidth = m);
|
|
34
34
|
}
|
|
35
35
|
o.hasAttribute("resizable") && (h.resizable = !0), o.hasAttribute("sizable") && (h.resizable = !0);
|
|
36
36
|
const f = o.getAttribute("editor"), g = o.getAttribute("renderer");
|
|
37
37
|
f && (h.__editorName = f), g && (h.__rendererName = g);
|
|
38
38
|
const d = o.getAttribute("options");
|
|
39
|
-
d && (h.options = d.split(",").map((
|
|
40
|
-
const [
|
|
41
|
-
return { value:
|
|
39
|
+
d && (h.options = d.split(",").map((m) => {
|
|
40
|
+
const [M, R] = m.includes(":") ? m.split(":") : [m.trim(), m.trim()];
|
|
41
|
+
return { value: M.trim(), label: R?.trim() || M.trim() };
|
|
42
42
|
}));
|
|
43
|
-
const w = o.querySelector("tbw-grid-column-view"),
|
|
44
|
-
w && (h.__viewTemplate = w),
|
|
45
|
-
const _ = globalThis.DataGridElement?.getAdapters?.() ?? [],
|
|
43
|
+
const w = o.querySelector("tbw-grid-column-view"), b = o.querySelector("tbw-grid-column-editor"), S = o.querySelector("tbw-grid-column-header");
|
|
44
|
+
w && (h.__viewTemplate = w), b && (h.__editorTemplate = b), S && (h.__headerTemplate = S);
|
|
45
|
+
const _ = globalThis.DataGridElement?.getAdapters?.() ?? [], T = w ?? o, v = _.find((m) => m.canHandle(T));
|
|
46
46
|
if (v) {
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const m = v.createRenderer(T);
|
|
48
|
+
m && (h.viewRenderer = m);
|
|
49
49
|
}
|
|
50
|
-
const E =
|
|
50
|
+
const E = b ?? o, y = _.find((m) => m.canHandle(E));
|
|
51
51
|
if (y) {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const m = y.createEditor(E);
|
|
53
|
+
m && (h.editor = m);
|
|
54
54
|
}
|
|
55
55
|
return h;
|
|
56
56
|
}).filter((o) => !!o);
|
|
@@ -74,8 +74,8 @@ function me(t, e) {
|
|
|
74
74
|
if (!r) return i;
|
|
75
75
|
const s = { ...i };
|
|
76
76
|
r.header && !s.header && (s.header = r.header), r.type && !s.type && (s.type = r.type), s.sortable = i.sortable || r.sortable, (i.resizable === !0 || r.resizable === !0) && (s.resizable = !0), s.editable = i.editable || r.editable, r.width != null && s.width == null && (s.width = r.width), r.minWidth != null && s.minWidth == null && (s.minWidth = r.minWidth), r.__viewTemplate && (s.__viewTemplate = r.__viewTemplate), r.__editorTemplate && (s.__editorTemplate = r.__editorTemplate), r.__headerTemplate && (s.__headerTemplate = r.__headerTemplate);
|
|
77
|
-
const l = r.renderer || r.viewRenderer,
|
|
78
|
-
return l && !
|
|
77
|
+
const l = r.renderer || r.viewRenderer, a = s.renderer || s.viewRenderer;
|
|
78
|
+
return l && !a && (s.viewRenderer = l, r.renderer && (s.renderer = l)), r.editor && !s.editor && (s.editor = r.editor), delete o[i.field], s;
|
|
79
79
|
});
|
|
80
80
|
return Object.keys(o).forEach((i) => n.push(o[i])), n;
|
|
81
81
|
}
|
|
@@ -87,7 +87,7 @@ function Me(t, e) {
|
|
|
87
87
|
const o = t.getAttribute("part");
|
|
88
88
|
o ? o.split(/\s+/).includes(e) || t.setAttribute("part", o + " " + e) : t.setAttribute("part", e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function ve(t) {
|
|
91
91
|
const e = t.effectiveConfig?.fitMode || t.fitMode || X.STRETCH;
|
|
92
92
|
if (e !== X.STRETCH && e !== X.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
|
|
93
93
|
const o = Array.from(t._headerRowEl?.children || []);
|
|
@@ -97,10 +97,10 @@ function be(t) {
|
|
|
97
97
|
if (i.width) return;
|
|
98
98
|
const s = o[r];
|
|
99
99
|
let l = s ? s.scrollWidth : 0;
|
|
100
|
-
for (const
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
const h =
|
|
100
|
+
for (const a of t._rowPool) {
|
|
101
|
+
const c = a.children[r];
|
|
102
|
+
if (c) {
|
|
103
|
+
const h = c.scrollWidth;
|
|
104
104
|
h > l && (l = h);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -114,23 +114,23 @@ function B(t) {
|
|
|
114
114
|
return n != null ? `minmax(${n}px, 1fr)` : "1fr";
|
|
115
115
|
}).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((o) => o.width ? `${o.width}px` : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function et(t) {
|
|
118
118
|
return t == null ? "string" : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t instanceof Date || typeof t == "string" && /\d{4}-\d{2}-\d{2}/.test(t) && !isNaN(Date.parse(t)) ? "date" : "string";
|
|
119
119
|
}
|
|
120
|
-
function
|
|
120
|
+
function tt(t, e) {
|
|
121
121
|
const o = t[0] || {}, n = Object.keys(o).map((r) => {
|
|
122
|
-
const s = o[r], l =
|
|
122
|
+
const s = o[r], l = et(s);
|
|
123
123
|
return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: l };
|
|
124
124
|
}), i = {};
|
|
125
125
|
return n.forEach((r) => {
|
|
126
126
|
i[r.field] = r.type || "string";
|
|
127
127
|
}), { columns: n, typeMap: i };
|
|
128
128
|
}
|
|
129
|
-
const
|
|
130
|
-
function
|
|
129
|
+
const ot = /{{\s*([^}]+)\s*}}/g, O = "__DG_EMPTY__", nt = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, it = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/;
|
|
130
|
+
function rt(t) {
|
|
131
131
|
return !t || typeof t != "string" ? "" : t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const st = /* @__PURE__ */ new Set([
|
|
134
134
|
"script",
|
|
135
135
|
"iframe",
|
|
136
136
|
"object",
|
|
@@ -155,23 +155,23 @@ const rt = /* @__PURE__ */ new Set([
|
|
|
155
155
|
"plaintext",
|
|
156
156
|
"xmp",
|
|
157
157
|
"listing"
|
|
158
|
-
]),
|
|
158
|
+
]), Ce = /^on\w+$/i, lt = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), at = /^\s*(javascript|vbscript|data|blob):/i;
|
|
159
159
|
function F(t) {
|
|
160
160
|
if (!t || typeof t != "string") return "";
|
|
161
161
|
if (t.indexOf("<") === -1) return t;
|
|
162
162
|
const e = document.createElement("template");
|
|
163
|
-
return e.innerHTML = t,
|
|
163
|
+
return e.innerHTML = t, ct(e.content), e.innerHTML;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function ct(t) {
|
|
166
166
|
const e = [], o = t.querySelectorAll("*");
|
|
167
167
|
for (const n of o) {
|
|
168
168
|
const i = n.tagName.toLowerCase();
|
|
169
|
-
if (
|
|
169
|
+
if (st.has(i)) {
|
|
170
170
|
e.push(n);
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
173
|
if ((i === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
|
|
174
|
-
(l) =>
|
|
174
|
+
(l) => Ce.test(l.name) || l.name === "href" || l.name === "xlink:href"
|
|
175
175
|
)) {
|
|
176
176
|
e.push(n);
|
|
177
177
|
continue;
|
|
@@ -179,11 +179,11 @@ function at(t) {
|
|
|
179
179
|
const r = [];
|
|
180
180
|
for (const s of n.attributes) {
|
|
181
181
|
const l = s.name.toLowerCase();
|
|
182
|
-
if (
|
|
182
|
+
if (Ce.test(l)) {
|
|
183
183
|
r.push(s.name);
|
|
184
184
|
continue;
|
|
185
185
|
}
|
|
186
|
-
if (
|
|
186
|
+
if (lt.has(l) && at.test(s.value)) {
|
|
187
187
|
r.push(s.name);
|
|
188
188
|
continue;
|
|
189
189
|
}
|
|
@@ -196,22 +196,22 @@ function at(t) {
|
|
|
196
196
|
}
|
|
197
197
|
e.forEach((n) => n.remove());
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function ke(t, e) {
|
|
200
200
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
201
|
-
const o = [], n = t.replace(
|
|
202
|
-
const
|
|
203
|
-
return o.push({ expr:
|
|
204
|
-
}), i =
|
|
201
|
+
const o = [], n = t.replace(ot, (l, a) => {
|
|
202
|
+
const c = dt(a, e);
|
|
203
|
+
return o.push({ expr: a.trim(), result: c }), c;
|
|
204
|
+
}), i = ht(n), r = o.length && o.every((l) => l.result === "" || l.result === O);
|
|
205
205
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : i;
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function dt(t, e) {
|
|
208
208
|
if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return O;
|
|
209
209
|
if (t === "value") return e.value == null ? O : String(e.value);
|
|
210
210
|
if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
|
|
211
211
|
const n = t.slice(4), i = e.row ? e.row[n] : void 0;
|
|
212
212
|
return i == null ? O : String(i);
|
|
213
213
|
}
|
|
214
|
-
if (t.length > 80 || !
|
|
214
|
+
if (t.length > 80 || !nt.test(t) || it.test(t)) return O;
|
|
215
215
|
const o = t.match(/\./g);
|
|
216
216
|
if (o && o.length > 1) return O;
|
|
217
217
|
try {
|
|
@@ -221,10 +221,10 @@ function ct(t, e) {
|
|
|
221
221
|
return O;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function ht(t) {
|
|
225
225
|
return t && t.replace(new RegExp(O, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function ut(t) {
|
|
228
228
|
if (/Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
|
|
229
229
|
if (Array.from(t.childNodes).forEach((e) => {
|
|
230
230
|
e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
|
|
@@ -236,12 +236,12 @@ function ht(t) {
|
|
|
236
236
|
(t.textContent || "").trim().length === 0 && (t.textContent = "");
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" :
|
|
239
|
+
function ye(t) {
|
|
240
|
+
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" : ke(t, n));
|
|
241
241
|
return o.__blocked = e, o;
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
class
|
|
243
|
+
const ft = 100;
|
|
244
|
+
class pt {
|
|
245
245
|
#l;
|
|
246
246
|
#i;
|
|
247
247
|
#u;
|
|
@@ -251,11 +251,11 @@ class ft {
|
|
|
251
251
|
#n = {};
|
|
252
252
|
#f = !0;
|
|
253
253
|
#g = [];
|
|
254
|
-
#
|
|
254
|
+
#m;
|
|
255
255
|
#s;
|
|
256
256
|
#v;
|
|
257
257
|
#r;
|
|
258
|
-
#
|
|
258
|
+
#b;
|
|
259
259
|
constructor(e) {
|
|
260
260
|
this.#r = e;
|
|
261
261
|
}
|
|
@@ -284,10 +284,10 @@ class ft {
|
|
|
284
284
|
this.#h = e;
|
|
285
285
|
}
|
|
286
286
|
get lightDomTitle() {
|
|
287
|
-
return this.#
|
|
287
|
+
return this.#b;
|
|
288
288
|
}
|
|
289
289
|
set lightDomTitle(e) {
|
|
290
|
-
this.#
|
|
290
|
+
this.#b = e;
|
|
291
291
|
}
|
|
292
292
|
get initialColumnState() {
|
|
293
293
|
return this.#v;
|
|
@@ -324,9 +324,9 @@ class ft {
|
|
|
324
324
|
if (!this.#f && e)
|
|
325
325
|
return;
|
|
326
326
|
const o = this.#w();
|
|
327
|
-
this.#f = !1, this.#a = o, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#n = this.#
|
|
327
|
+
this.#f = !1, this.#a = o, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#n = this.#R(this.#a), this.#H();
|
|
328
328
|
}
|
|
329
|
-
#
|
|
329
|
+
#R(e) {
|
|
330
330
|
const o = { ...e };
|
|
331
331
|
return e.columns && (o.columns = e.columns.map((n) => ({ ...n }))), e.shell && (o.shell = {
|
|
332
332
|
...e.shell,
|
|
@@ -336,7 +336,7 @@ class ft {
|
|
|
336
336
|
headerContents: e.shell.headerContents?.map((n) => ({ ...n }))
|
|
337
337
|
}), o;
|
|
338
338
|
}
|
|
339
|
-
#
|
|
339
|
+
#H() {
|
|
340
340
|
const e = this.#n;
|
|
341
341
|
e.rowHeight && e.rowHeight > 0 && this.#r.setRowHeight(e.rowHeight), e.fitMode === "fixed" && this.columns.forEach((n) => {
|
|
342
342
|
n.width == null && (n.width = 80);
|
|
@@ -355,16 +355,16 @@ class ft {
|
|
|
355
355
|
n
|
|
356
356
|
));
|
|
357
357
|
const r = this.#r.getRows();
|
|
358
|
-
return i.length === 0 && r.length && (i =
|
|
358
|
+
return i.length === 0 && r.length && (i = tt(r).columns), i.length && (i.forEach((s) => {
|
|
359
359
|
s.sortable === void 0 && (s.sortable = !0), s.resizable === void 0 && (s.resizable = !0), s.__originalWidth === void 0 && typeof s.width == "number" && (s.__originalWidth = s.width);
|
|
360
360
|
}), i.forEach((s) => {
|
|
361
|
-
s.__viewTemplate && !s.__compiledView && (s.__compiledView =
|
|
361
|
+
s.__viewTemplate && !s.__compiledView && (s.__compiledView = ye(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = ye(s.__editorTemplate.innerHTML));
|
|
362
362
|
}), e.columns = i), this.#u && (e.fitMode = this.#u), e.fitMode || (e.fitMode = "stretch"), this.#C(e), e.columnState && !this.#v && (this.#v = e.columnState), e;
|
|
363
363
|
}
|
|
364
364
|
#C(e) {
|
|
365
365
|
e.shell = e.shell ? { ...e.shell } : {}, e.shell.header = e.shell.header ? { ...e.shell.header } : {};
|
|
366
366
|
const o = this.#r.getShellLightDomTitle();
|
|
367
|
-
o && (this.#
|
|
367
|
+
o && (this.#b = o), this.#b && !e.shell.header.title && (e.shell.header.title = this.#b);
|
|
368
368
|
const n = this.#r.getShellLightDomHeaderContent();
|
|
369
369
|
n?.length > 0 && (e.shell.header.lightDomContent = n), this.#r.getShellHasToolButtonsContainer() && (e.shell.header.hasToolButtonsContainer = !0);
|
|
370
370
|
const i = this.#r.getShellToolPanels();
|
|
@@ -377,9 +377,9 @@ class ft {
|
|
|
377
377
|
const u = Array.from(r.values());
|
|
378
378
|
u.sort((p, f) => (p.order ?? 100) - (f.order ?? 100)), e.shell.headerContents = u;
|
|
379
379
|
}
|
|
380
|
-
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()),
|
|
380
|
+
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((u) => u.id)), h = [...a];
|
|
381
381
|
for (const u of l)
|
|
382
|
-
|
|
382
|
+
c.has(u.id) || h.push(u);
|
|
383
383
|
h.sort((u, p) => (u.order ?? 0) - (p.order ?? 0)), e.shell.header.toolbarContents = h;
|
|
384
384
|
}
|
|
385
385
|
collectState(e) {
|
|
@@ -392,11 +392,11 @@ class ft {
|
|
|
392
392
|
visible: !i.hidden
|
|
393
393
|
}, l = i;
|
|
394
394
|
l.__renderedWidth !== void 0 ? s.width = l.__renderedWidth : i.width !== void 0 && (s.width = typeof i.width == "string" ? parseFloat(i.width) : i.width);
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
for (const
|
|
398
|
-
if (
|
|
399
|
-
const h =
|
|
395
|
+
const a = n.get(i.field);
|
|
396
|
+
a && (s.sort = a);
|
|
397
|
+
for (const c of e)
|
|
398
|
+
if (c.getColumnState) {
|
|
399
|
+
const h = c.getColumnState(i.field);
|
|
400
400
|
h && Object.assign(s, h);
|
|
401
401
|
}
|
|
402
402
|
return s;
|
|
@@ -406,16 +406,16 @@ class ft {
|
|
|
406
406
|
applyState(e, o) {
|
|
407
407
|
if (!e.columns || e.columns.length === 0) return;
|
|
408
408
|
const n = this.columns, i = new Map(e.columns.map((l) => [l.field, l])), r = n.map((l) => {
|
|
409
|
-
const
|
|
410
|
-
if (!
|
|
411
|
-
const
|
|
412
|
-
return
|
|
409
|
+
const a = i.get(l.field);
|
|
410
|
+
if (!a) return l;
|
|
411
|
+
const c = { ...l };
|
|
412
|
+
return a.width !== void 0 && (c.width = a.width, c.__renderedWidth = a.width), a.visible !== void 0 && (c.hidden = !a.visible), c;
|
|
413
413
|
});
|
|
414
|
-
r.sort((l,
|
|
415
|
-
const
|
|
416
|
-
return
|
|
414
|
+
r.sort((l, a) => {
|
|
415
|
+
const c = i.get(l.field)?.order ?? 1 / 0, h = i.get(a.field)?.order ?? 1 / 0;
|
|
416
|
+
return c - h;
|
|
417
417
|
}), this.columns = r;
|
|
418
|
-
const s = e.columns.filter((l) => l.sort !== void 0).sort((l,
|
|
418
|
+
const s = e.columns.filter((l) => l.sort !== void 0).sort((l, a) => (l.sort?.priority ?? 0) - (a.sort?.priority ?? 0));
|
|
419
419
|
if (s.length > 0) {
|
|
420
420
|
const l = s[0];
|
|
421
421
|
l.sort && this.#r.setSortState({
|
|
@@ -426,11 +426,11 @@ class ft {
|
|
|
426
426
|
this.#r.setSortState(null);
|
|
427
427
|
for (const l of o)
|
|
428
428
|
if (l.applyColumnState)
|
|
429
|
-
for (const
|
|
430
|
-
l.applyColumnState(
|
|
429
|
+
for (const a of e.columns)
|
|
430
|
+
l.applyColumnState(a.field, a);
|
|
431
431
|
}
|
|
432
432
|
resetState(e) {
|
|
433
|
-
this.#v = void 0, this.#r.setSortState(null), this.#n = this.#
|
|
433
|
+
this.#v = void 0, this.#r.setSortState(null), this.#n = this.#R(this.#a), this.#H();
|
|
434
434
|
for (const o of e)
|
|
435
435
|
if (o.applyColumnState)
|
|
436
436
|
for (const n of this.columns)
|
|
@@ -453,7 +453,7 @@ class ft {
|
|
|
453
453
|
this.#s = void 0;
|
|
454
454
|
const o = this.collectState(e);
|
|
455
455
|
this.#r.emit("column-state-change", o);
|
|
456
|
-
},
|
|
456
|
+
}, ft);
|
|
457
457
|
}
|
|
458
458
|
setColumnVisible(e, o) {
|
|
459
459
|
const n = this.columns, i = n.find((s) => s.field === e);
|
|
@@ -514,7 +514,7 @@ class ft {
|
|
|
514
514
|
this.#p.delete(e.toLowerCase());
|
|
515
515
|
}
|
|
516
516
|
observeLightDOM(e) {
|
|
517
|
-
this.#
|
|
517
|
+
this.#m && this.#m.disconnect();
|
|
518
518
|
const o = /* @__PURE__ */ new Set();
|
|
519
519
|
let n = null;
|
|
520
520
|
const i = () => {
|
|
@@ -523,20 +523,20 @@ class ft {
|
|
|
523
523
|
this.#p.get(r)?.();
|
|
524
524
|
o.clear();
|
|
525
525
|
};
|
|
526
|
-
this.#
|
|
526
|
+
this.#m = new MutationObserver((r) => {
|
|
527
527
|
for (const s of r) {
|
|
528
528
|
for (const l of s.addedNodes) {
|
|
529
529
|
if (l.nodeType !== Node.ELEMENT_NODE) continue;
|
|
530
|
-
const
|
|
531
|
-
this.#p.has(
|
|
530
|
+
const c = l.tagName.toLowerCase();
|
|
531
|
+
this.#p.has(c) && o.add(c);
|
|
532
532
|
}
|
|
533
533
|
if (s.type === "attributes" && s.target.nodeType === Node.ELEMENT_NODE) {
|
|
534
|
-
const
|
|
535
|
-
this.#p.has(
|
|
534
|
+
const a = s.target.tagName.toLowerCase();
|
|
535
|
+
this.#p.has(a) && o.add(a);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
o.size > 0 && !n && (n = setTimeout(i, 0));
|
|
539
|
-
}), this.#
|
|
539
|
+
}), this.#m.observe(e, {
|
|
540
540
|
childList: !0,
|
|
541
541
|
subtree: !0,
|
|
542
542
|
attributes: !0,
|
|
@@ -551,13 +551,13 @@ class ft {
|
|
|
551
551
|
e();
|
|
552
552
|
}
|
|
553
553
|
dispose() {
|
|
554
|
-
this.#
|
|
554
|
+
this.#m?.disconnect(), this.#g = [], this.#s && clearTimeout(this.#s);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
557
|
function Ne(t) {
|
|
558
558
|
return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "🗹" : "☐"}</span>`;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Ie(t) {
|
|
561
561
|
if (t == null || t === "") return "";
|
|
562
562
|
if (t instanceof Date)
|
|
563
563
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
|
|
@@ -567,7 +567,7 @@ function ke(t) {
|
|
|
567
567
|
}
|
|
568
568
|
return "";
|
|
569
569
|
}
|
|
570
|
-
function
|
|
570
|
+
function qe(t) {
|
|
571
571
|
if (!t) return -1;
|
|
572
572
|
const e = t.getAttribute("data-row");
|
|
573
573
|
if (e) return parseInt(e, 10);
|
|
@@ -580,15 +580,15 @@ function Ie(t) {
|
|
|
580
580
|
if (i[r] === o) return r;
|
|
581
581
|
return -1;
|
|
582
582
|
}
|
|
583
|
-
function
|
|
583
|
+
function gt(t) {
|
|
584
584
|
if (!t) return -1;
|
|
585
585
|
const e = t.getAttribute("data-col");
|
|
586
586
|
return e ? parseInt(e, 10) : -1;
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function fe(t) {
|
|
589
589
|
t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
590
590
|
}
|
|
591
|
-
function
|
|
591
|
+
function We(t, e) {
|
|
592
592
|
const o = e.renderer || e.viewRenderer;
|
|
593
593
|
if (o) return o;
|
|
594
594
|
if (!e.type) return;
|
|
@@ -602,7 +602,7 @@ function qe(t, e) {
|
|
|
602
602
|
return r.renderer;
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
function
|
|
605
|
+
function $e(t, e) {
|
|
606
606
|
if (e.format) return e.format;
|
|
607
607
|
if (!e.type) return;
|
|
608
608
|
const o = t.effectiveConfig?.typeDefaults;
|
|
@@ -615,31 +615,31 @@ function We(t, e) {
|
|
|
615
615
|
return i.format;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
|
-
const
|
|
619
|
-
function
|
|
618
|
+
const Fe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
619
|
+
function re(t) {
|
|
620
620
|
return (t.__editingCellCount ?? 0) > 0;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function se(t) {
|
|
623
623
|
t.__editingCellCount = 0, t.removeAttribute("data-has-editing"), t.querySelectorAll(".cell.editing").forEach((o) => o.classList.remove("editing"));
|
|
624
624
|
}
|
|
625
|
-
const Fe = document.createElement("template");
|
|
626
|
-
Fe.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
627
625
|
const Ue = document.createElement("template");
|
|
628
|
-
Ue.innerHTML = '<div class="
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
}
|
|
626
|
+
Ue.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
627
|
+
const Ve = document.createElement("template");
|
|
628
|
+
Ve.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
632
629
|
function wt() {
|
|
633
630
|
return Ue.content.firstElementChild.cloneNode(!0);
|
|
634
631
|
}
|
|
632
|
+
function bt() {
|
|
633
|
+
return Ve.content.firstElementChild.cloneNode(!0);
|
|
634
|
+
}
|
|
635
635
|
function j(t) {
|
|
636
636
|
t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
|
|
637
637
|
}
|
|
638
638
|
function mt(t, e, o, n, i) {
|
|
639
|
-
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns,
|
|
640
|
-
let
|
|
641
|
-
for (
|
|
642
|
-
const p =
|
|
639
|
+
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns, a = l.length;
|
|
640
|
+
let c = t.__cachedHeaderRowCount;
|
|
641
|
+
for (c === void 0 && (c = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
|
|
642
|
+
const p = bt();
|
|
643
643
|
t._rowPool.push(p);
|
|
644
644
|
}
|
|
645
645
|
if (t._rowPool.length > r) {
|
|
@@ -652,28 +652,28 @@ function mt(t, e, o, n, i) {
|
|
|
652
652
|
const h = i && t.__hasRenderRowPlugins !== !1, u = t._hasAfterRowRenderHook?.() ?? !1;
|
|
653
653
|
for (let p = 0; p < r; p++) {
|
|
654
654
|
const f = e + p, g = t._rows[f], d = t._rowPool[p];
|
|
655
|
-
if (d.setAttribute("aria-rowindex", String(f +
|
|
655
|
+
if (d.setAttribute("aria-rowindex", String(f + c + 1)), h && i(g, d, f)) {
|
|
656
656
|
d.__epoch = n, d.__rowDataRef = g, d.parentNode !== s && s.appendChild(d);
|
|
657
657
|
continue;
|
|
658
658
|
}
|
|
659
|
-
const w = d.__epoch,
|
|
659
|
+
const w = d.__epoch, b = d.__rowDataRef, S = d.children.length, _ = w === n && S === a, T = b !== g;
|
|
660
660
|
let v = !1;
|
|
661
|
-
if (_ &&
|
|
662
|
-
for (let R = 0; R <
|
|
661
|
+
if (_ && T) {
|
|
662
|
+
for (let R = 0; R < a; R++)
|
|
663
663
|
if (l[R].externalView && !d.querySelector(`.cell[data-col="${R}"] [data-external-view]`)) {
|
|
664
664
|
v = !0;
|
|
665
665
|
break;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
if (!_ || v) {
|
|
669
|
-
const R =
|
|
670
|
-
R && !
|
|
671
|
-
} else if (
|
|
672
|
-
const R =
|
|
673
|
-
R && !
|
|
669
|
+
const R = re(d), x = t._activeEditRows === f;
|
|
670
|
+
R && !x ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), se(d), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : R && x ? (le(t, d, g, f), d.__rowDataRef = g) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g);
|
|
671
|
+
} else if (T) {
|
|
672
|
+
const R = re(d), x = t._activeEditRows === f;
|
|
673
|
+
R && !x ? (se(d), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : (le(t, d, g, f), d.__rowDataRef = g);
|
|
674
674
|
} else {
|
|
675
|
-
const R =
|
|
676
|
-
R && !
|
|
675
|
+
const R = re(d), x = t._activeEditRows === f;
|
|
676
|
+
R && !x ? (se(d), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : le(t, d, g, f);
|
|
677
677
|
}
|
|
678
678
|
let E = !1;
|
|
679
679
|
const y = t.changedRowIds;
|
|
@@ -683,21 +683,21 @@ function mt(t, e, o, n, i) {
|
|
|
683
683
|
R && (E = y.includes(R));
|
|
684
684
|
} catch {
|
|
685
685
|
}
|
|
686
|
-
const
|
|
687
|
-
E !==
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
686
|
+
const m = d.classList.contains("changed");
|
|
687
|
+
E !== m && d.classList.toggle("changed", E);
|
|
688
|
+
const M = t.effectiveConfig?.rowClass;
|
|
689
|
+
if (M) {
|
|
690
690
|
const R = d.getAttribute("data-dynamic-classes");
|
|
691
|
-
R && R.split(" ").forEach((
|
|
691
|
+
R && R.split(" ").forEach((x) => x && d.classList.remove(x));
|
|
692
692
|
try {
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
696
|
-
|
|
693
|
+
const x = M(g);
|
|
694
|
+
if (x && x.length > 0) {
|
|
695
|
+
const ie = x.filter((Y) => Y && typeof Y == "string");
|
|
696
|
+
ie.forEach((Y) => d.classList.add(Y)), d.setAttribute("data-dynamic-classes", ie.join(" "));
|
|
697
697
|
} else
|
|
698
698
|
d.removeAttribute("data-dynamic-classes");
|
|
699
|
-
} catch (
|
|
700
|
-
console.warn("[tbw-grid] rowClass callback error:",
|
|
699
|
+
} catch (x) {
|
|
700
|
+
console.warn("[tbw-grid] rowClass callback error:", x), d.removeAttribute("data-dynamic-classes");
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
u && t._afterRowRender?.({
|
|
@@ -707,15 +707,15 @@ function mt(t, e, o, n, i) {
|
|
|
707
707
|
}), d.parentNode !== s && s.appendChild(d);
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
|
-
function
|
|
711
|
-
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length,
|
|
710
|
+
function le(t, e, o, n) {
|
|
711
|
+
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length, a = s < l ? s : l, c = t._focusRow, h = t._focusCol, u = t._hasAfterCellRenderHook?.() ?? !1;
|
|
712
712
|
let p = t.__hasSpecialColumns;
|
|
713
713
|
if (p === void 0) {
|
|
714
714
|
p = !1;
|
|
715
715
|
const g = t.effectiveConfig?.typeDefaults, d = t.__frameworkAdapter;
|
|
716
716
|
for (let w = 0; w < s; w++) {
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
717
|
+
const b = r[w];
|
|
718
|
+
if (b.__viewTemplate || b.__compiledView || b.renderer || b.viewRenderer || b.externalView || b.format || b.type === "date" || b.type === "boolean" || b.type && g?.[b.type]?.renderer || b.type && g?.[b.type]?.format || b.type && d?.getTypeDefault?.(b.type)?.renderer || b.type && d?.getTypeDefault?.(b.type)?.format) {
|
|
719
719
|
p = !0;
|
|
720
720
|
break;
|
|
721
721
|
}
|
|
@@ -724,60 +724,60 @@ function se(t, e, o, n) {
|
|
|
724
724
|
}
|
|
725
725
|
const f = String(n);
|
|
726
726
|
if (!p) {
|
|
727
|
-
for (let g = 0; g <
|
|
727
|
+
for (let g = 0; g < a; g++) {
|
|
728
728
|
const d = i[g];
|
|
729
729
|
if (d.classList.contains("editing")) continue;
|
|
730
|
-
const w = r[g],
|
|
731
|
-
d.textContent =
|
|
732
|
-
const S =
|
|
730
|
+
const w = r[g], b = o[w.field];
|
|
731
|
+
d.textContent = b == null ? "" : String(b), d.getAttribute("data-row") !== f && d.setAttribute("data-row", f);
|
|
732
|
+
const S = c === n && h === g, C = d.classList.contains("cell-focus");
|
|
733
733
|
S !== C && (d.classList.toggle("cell-focus", S), d.setAttribute("aria-selected", String(S))), u && t._afterCellRender?.({
|
|
734
734
|
row: o,
|
|
735
735
|
rowIndex: n,
|
|
736
736
|
column: w,
|
|
737
737
|
colIndex: g,
|
|
738
|
-
value:
|
|
738
|
+
value: b,
|
|
739
739
|
cellElement: d,
|
|
740
740
|
rowElement: e
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
|
-
for (let g = 0; g <
|
|
745
|
+
for (let g = 0; g < a; g++)
|
|
746
746
|
if (r[g].externalView && !i[g].querySelector("[data-external-view]")) {
|
|
747
747
|
G(t, e, o, n);
|
|
748
748
|
return;
|
|
749
749
|
}
|
|
750
|
-
for (let g = 0; g <
|
|
750
|
+
for (let g = 0; g < a; g++) {
|
|
751
751
|
const d = r[g], w = i[g];
|
|
752
752
|
w.getAttribute("data-row") !== f && w.setAttribute("data-row", f);
|
|
753
|
-
const
|
|
754
|
-
|
|
753
|
+
const b = c === n && h === g, S = w.classList.contains("cell-focus");
|
|
754
|
+
b !== S && (w.classList.toggle("cell-focus", b), w.setAttribute("aria-selected", String(b)));
|
|
755
755
|
const C = d.cellClass;
|
|
756
756
|
if (C) {
|
|
757
757
|
const y = w.getAttribute("data-dynamic-classes");
|
|
758
|
-
y && y.split(" ").forEach((
|
|
758
|
+
y && y.split(" ").forEach((m) => m && w.classList.remove(m));
|
|
759
759
|
try {
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
762
|
-
const R =
|
|
763
|
-
R.forEach((
|
|
760
|
+
const m = o[d.field], M = C(m, o, d);
|
|
761
|
+
if (M && M.length > 0) {
|
|
762
|
+
const R = M.filter((x) => x && typeof x == "string");
|
|
763
|
+
R.forEach((x) => w.classList.add(x)), w.setAttribute("data-dynamic-classes", R.join(" "));
|
|
764
764
|
} else
|
|
765
765
|
w.removeAttribute("data-dynamic-classes");
|
|
766
|
-
} catch (
|
|
767
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`,
|
|
766
|
+
} catch (m) {
|
|
767
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`, m), w.removeAttribute("data-dynamic-classes");
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
if (w.classList.contains("editing")) continue;
|
|
771
|
-
const _ =
|
|
771
|
+
const _ = We(t, d);
|
|
772
772
|
if (_) {
|
|
773
|
-
const y = o[d.field],
|
|
773
|
+
const y = o[d.field], m = _({
|
|
774
774
|
row: o,
|
|
775
775
|
value: y,
|
|
776
776
|
field: d.field,
|
|
777
777
|
column: d,
|
|
778
778
|
cellEl: w
|
|
779
779
|
});
|
|
780
|
-
typeof
|
|
780
|
+
typeof m == "string" ? w.innerHTML = F(m) : m instanceof Node ? m.parentElement !== w && (w.innerHTML = "", w.appendChild(m)) : m == null && (w.textContent = y == null ? "" : String(y)), u && t._afterCellRender?.({
|
|
781
781
|
row: o,
|
|
782
782
|
rowIndex: n,
|
|
783
783
|
column: d,
|
|
@@ -790,23 +790,23 @@ function se(t, e, o, n) {
|
|
|
790
790
|
}
|
|
791
791
|
if (d.__viewTemplate || d.__compiledView || d.externalView)
|
|
792
792
|
continue;
|
|
793
|
-
const
|
|
793
|
+
const T = o[d.field];
|
|
794
794
|
let v;
|
|
795
|
-
const E =
|
|
795
|
+
const E = $e(t, d);
|
|
796
796
|
if (E)
|
|
797
797
|
try {
|
|
798
|
-
const y = E(
|
|
798
|
+
const y = E(T, o);
|
|
799
799
|
v = y == null ? "" : String(y);
|
|
800
800
|
} catch (y) {
|
|
801
|
-
console.warn(`[tbw-grid] Format error in column '${d.field}':`, y), v =
|
|
801
|
+
console.warn(`[tbw-grid] Format error in column '${d.field}':`, y), v = T == null ? "" : String(T);
|
|
802
802
|
}
|
|
803
|
-
else d.type === "date" ? (v =
|
|
803
|
+
else d.type === "date" ? (v = Ie(T), w.textContent = v) : d.type === "boolean" ? w.innerHTML = Ne(!!T) : (v = T == null ? "" : String(T), w.textContent = v);
|
|
804
804
|
u && t._afterCellRender?.({
|
|
805
805
|
row: o,
|
|
806
806
|
rowIndex: n,
|
|
807
807
|
column: d,
|
|
808
808
|
colIndex: g,
|
|
809
|
-
value:
|
|
809
|
+
value: T,
|
|
810
810
|
cellElement: w,
|
|
811
811
|
rowElement: e
|
|
812
812
|
});
|
|
@@ -814,19 +814,19 @@ function se(t, e, o, n) {
|
|
|
814
814
|
}
|
|
815
815
|
function G(t, e, o, n) {
|
|
816
816
|
e.innerHTML = "";
|
|
817
|
-
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol,
|
|
817
|
+
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol, a = t, c = t._hasAfterCellRenderHook?.() ?? !1, h = document.createDocumentFragment();
|
|
818
818
|
for (let u = 0; u < r; u++) {
|
|
819
|
-
const p = i[u], f =
|
|
819
|
+
const p = i[u], f = wt();
|
|
820
820
|
f.setAttribute("aria-colindex", String(u + 1)), f.setAttribute("data-col", String(u)), f.setAttribute("data-row", String(n)), f.setAttribute("data-field", p.field), f.setAttribute("data-header", p.header ?? p.field), p.type && f.setAttribute("data-type", p.type);
|
|
821
821
|
let g = o[p.field];
|
|
822
|
-
const d =
|
|
822
|
+
const d = $e(t, p);
|
|
823
823
|
if (d)
|
|
824
824
|
try {
|
|
825
825
|
g = d(g, o);
|
|
826
826
|
} catch (v) {
|
|
827
827
|
console.warn(`[tbw-grid] Format error in column '${p.field}':`, v);
|
|
828
828
|
}
|
|
829
|
-
const w = p.__compiledView,
|
|
829
|
+
const w = p.__compiledView, b = p.__viewTemplate, S = We(t, p), C = p.externalView;
|
|
830
830
|
let _ = !1;
|
|
831
831
|
if (S) {
|
|
832
832
|
const v = S({ row: o, value: g, field: p.field, column: p, cellEl: f });
|
|
@@ -838,50 +838,50 @@ function G(t, e, o, n) {
|
|
|
838
838
|
if (v.mount)
|
|
839
839
|
try {
|
|
840
840
|
v.mount({ placeholder: E, context: y, spec: v });
|
|
841
|
-
} catch (
|
|
842
|
-
console.warn(`[tbw-grid] External view mount error for column '${p.field}':`,
|
|
841
|
+
} catch (m) {
|
|
842
|
+
console.warn(`[tbw-grid] External view mount error for column '${p.field}':`, m);
|
|
843
843
|
}
|
|
844
844
|
else
|
|
845
845
|
queueMicrotask(() => {
|
|
846
846
|
try {
|
|
847
|
-
|
|
847
|
+
a.dispatchEvent(
|
|
848
848
|
new CustomEvent("mount-external-view", {
|
|
849
849
|
bubbles: !0,
|
|
850
850
|
composed: !0,
|
|
851
851
|
detail: { placeholder: E, spec: v, context: y }
|
|
852
852
|
})
|
|
853
853
|
);
|
|
854
|
-
} catch (
|
|
855
|
-
console.warn(`[tbw-grid] External view event dispatch error for column '${p.field}':`,
|
|
854
|
+
} catch (m) {
|
|
855
|
+
console.warn(`[tbw-grid] External view event dispatch error for column '${p.field}':`, m);
|
|
856
856
|
}
|
|
857
857
|
});
|
|
858
858
|
E.setAttribute("data-mounted", "");
|
|
859
859
|
} else if (w) {
|
|
860
860
|
const v = w({ row: o, value: g, field: p.field, column: p }), E = w.__blocked;
|
|
861
861
|
f.innerHTML = E ? "" : F(v), _ = !0, E && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
|
|
862
|
-
} else if (
|
|
863
|
-
const v =
|
|
864
|
-
/Reflect\.|\bProxy\b|ownKeys\(/.test(v) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = F(
|
|
862
|
+
} else if (b) {
|
|
863
|
+
const v = b.innerHTML;
|
|
864
|
+
/Reflect\.|\bProxy\b|ownKeys\(/.test(v) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = F(ke(v, { row: o, value: g })), _ = !0);
|
|
865
865
|
} else
|
|
866
|
-
p.type === "date" ? f.textContent =
|
|
866
|
+
p.type === "date" ? f.textContent = Ie(g) : p.type === "boolean" ? f.innerHTML = Ne(!!g) : f.textContent = g == null ? "" : String(g);
|
|
867
867
|
if (_) {
|
|
868
|
-
|
|
868
|
+
ut(f);
|
|
869
869
|
const v = f.textContent || "";
|
|
870
870
|
/Proxy|Reflect\.ownKeys/.test(v) && (f.textContent = v.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
|
|
871
871
|
}
|
|
872
872
|
f.hasAttribute("data-blocked-template") && (f.textContent || "").trim().length && (f.textContent = ""), p.editable ? f.tabIndex = 0 : p.type === "boolean" && (f.hasAttribute("tabindex") || (f.tabIndex = 0)), s === n && l === u ? (f.classList.add("cell-focus"), f.setAttribute("aria-selected", "true")) : f.setAttribute("aria-selected", "false");
|
|
873
|
-
const
|
|
874
|
-
if (
|
|
873
|
+
const T = p.cellClass;
|
|
874
|
+
if (T)
|
|
875
875
|
try {
|
|
876
|
-
const v = o[p.field], E =
|
|
876
|
+
const v = o[p.field], E = T(v, o, p);
|
|
877
877
|
if (E && E.length > 0) {
|
|
878
|
-
const y = E.filter((
|
|
879
|
-
y.forEach((
|
|
878
|
+
const y = E.filter((m) => m && typeof m == "string");
|
|
879
|
+
y.forEach((m) => f.classList.add(m)), f.setAttribute("data-dynamic-classes", y.join(" "));
|
|
880
880
|
}
|
|
881
881
|
} catch (v) {
|
|
882
882
|
console.warn(`[tbw-grid] cellClass callback error for column '${p.field}':`, v);
|
|
883
883
|
}
|
|
884
|
-
|
|
884
|
+
c && t._afterCellRender?.({
|
|
885
885
|
row: o,
|
|
886
886
|
rowIndex: n,
|
|
887
887
|
column: p,
|
|
@@ -893,9 +893,9 @@ function G(t, e, o, n) {
|
|
|
893
893
|
}
|
|
894
894
|
e.appendChild(h);
|
|
895
895
|
}
|
|
896
|
-
function
|
|
896
|
+
function _e(t, e, o) {
|
|
897
897
|
if (e.target?.closest(".resize-handle")) return;
|
|
898
|
-
const n = o.querySelector(".cell[data-row]"), i =
|
|
898
|
+
const n = o.querySelector(".cell[data-row]"), i = qe(n);
|
|
899
899
|
if (i < 0) return;
|
|
900
900
|
const r = t._rows[i];
|
|
901
901
|
if (!r || t._dispatchRowClick?.(e, i, r, o))
|
|
@@ -906,12 +906,12 @@ function ye(t, e, o) {
|
|
|
906
906
|
if (!isNaN(l)) {
|
|
907
907
|
if (t._dispatchCellClick?.(e, i, l, s))
|
|
908
908
|
return;
|
|
909
|
-
const
|
|
909
|
+
const a = t._focusRow !== i || t._focusCol !== l;
|
|
910
910
|
if (t._focusRow = i, t._focusCol = l, s.classList.contains("editing")) {
|
|
911
|
-
|
|
912
|
-
const
|
|
911
|
+
a && (fe(t._bodyEl ?? t), s.classList.add("cell-focus"));
|
|
912
|
+
const c = s.querySelector(Fe);
|
|
913
913
|
try {
|
|
914
|
-
|
|
914
|
+
c?.focus({ preventScroll: !0 });
|
|
915
915
|
} catch {
|
|
916
916
|
}
|
|
917
917
|
return;
|
|
@@ -920,15 +920,15 @@ function ye(t, e, o) {
|
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function
|
|
923
|
+
function vt(t, e) {
|
|
924
924
|
if (t._dispatchKeyDown?.(e))
|
|
925
925
|
return;
|
|
926
|
-
const o = t._rows.length - 1, n = t._visibleColumns.length - 1, i = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [],
|
|
926
|
+
const o = t._rows.length - 1, n = t._visibleColumns.length - 1, i = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [], a = l.length ? l[0] : e.target, c = (h) => {
|
|
927
927
|
if (!h) return !1;
|
|
928
928
|
const u = h.tagName;
|
|
929
929
|
return !!(u === "INPUT" || u === "SELECT" || u === "TEXTAREA" || h.isContentEditable);
|
|
930
930
|
};
|
|
931
|
-
if (!(a
|
|
931
|
+
if (!(c(a) && (e.key === "Home" || e.key === "End")) && !(c(a) && (e.key === "ArrowUp" || e.key === "ArrowDown") && a.tagName === "INPUT" && a.type === "number") && !(c(a) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) && !(c(a) && (e.key === "Enter" || e.key === "Escape")) && !(i && s === "select" && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
|
|
932
932
|
switch (e.key) {
|
|
933
933
|
case "Tab": {
|
|
934
934
|
e.preventDefault(), !e.shiftKey ? t._focusCol < n ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < o && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = n), $(t);
|
|
@@ -961,7 +961,7 @@ function bt(t, e) {
|
|
|
961
961
|
case "Enter": {
|
|
962
962
|
const h = t._focusRow, u = t._focusCol, p = t._visibleColumns[u], f = t._rows[h], g = p?.field ?? "", d = g && f ? f[g] : void 0, w = t.querySelector(
|
|
963
963
|
`[data-row="${h}"][data-col="${u}"]`
|
|
964
|
-
),
|
|
964
|
+
), b = {
|
|
965
965
|
rowIndex: h,
|
|
966
966
|
colIndex: u,
|
|
967
967
|
field: g,
|
|
@@ -972,7 +972,7 @@ function bt(t, e) {
|
|
|
972
972
|
originalEvent: e
|
|
973
973
|
}, S = new CustomEvent("cell-activate", {
|
|
974
974
|
cancelable: !0,
|
|
975
|
-
detail:
|
|
975
|
+
detail: b
|
|
976
976
|
});
|
|
977
977
|
t.dispatchEvent(S);
|
|
978
978
|
const C = new CustomEvent("activate-cell", {
|
|
@@ -993,14 +993,14 @@ function bt(t, e) {
|
|
|
993
993
|
}
|
|
994
994
|
function $(t, e) {
|
|
995
995
|
if (t._virtualization?.enabled) {
|
|
996
|
-
const { rowHeight: s, container: l, viewportEl:
|
|
997
|
-
if (
|
|
996
|
+
const { rowHeight: s, container: l, viewportEl: a } = t._virtualization, c = l, h = a?.clientHeight ?? c?.clientHeight ?? 0;
|
|
997
|
+
if (c && h > 0) {
|
|
998
998
|
const u = t._focusRow * s;
|
|
999
|
-
u <
|
|
999
|
+
u < c.scrollTop ? c.scrollTop = u : u + s > c.scrollTop + h && (c.scrollTop = u - h + s);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
const o = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
1003
|
-
o || t.refreshVirtualWindow(!1),
|
|
1003
|
+
o || t.refreshVirtualWindow(!1), fe(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
1004
1004
|
s.setAttribute("aria-selected", "false");
|
|
1005
1005
|
});
|
|
1006
1006
|
const n = t._focusRow, i = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
|
|
@@ -1009,24 +1009,24 @@ function $(t, e) {
|
|
|
1009
1009
|
let l = s?.children[t._focusCol];
|
|
1010
1010
|
if ((!l || !l.classList?.contains("cell")) && (l = s?.querySelector(`.cell[data-col="${t._focusCol}"]`) ?? s?.querySelector(".cell[data-col]")), l) {
|
|
1011
1011
|
l.classList.add("cell-focus"), l.setAttribute("aria-selected", "true");
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
1012
|
+
const a = t.querySelector(".tbw-scroll-area");
|
|
1013
|
+
if (a && l && !o)
|
|
1014
1014
|
if (e?.forceScrollLeft)
|
|
1015
|
-
|
|
1015
|
+
a.scrollLeft = 0;
|
|
1016
1016
|
else if (e?.forceScrollRight)
|
|
1017
|
-
|
|
1017
|
+
a.scrollLeft = a.scrollWidth - a.clientWidth;
|
|
1018
1018
|
else {
|
|
1019
|
-
const
|
|
1020
|
-
if (!
|
|
1021
|
-
const h = l.getBoundingClientRect(), u =
|
|
1022
|
-
p < g ?
|
|
1019
|
+
const c = t._getHorizontalScrollOffsets?.(s ?? void 0, l) ?? { left: 0, right: 0 };
|
|
1020
|
+
if (!c.skipScroll) {
|
|
1021
|
+
const h = l.getBoundingClientRect(), u = a.getBoundingClientRect(), p = h.left - u.left + a.scrollLeft, f = p + h.width, g = a.scrollLeft + c.left, d = a.scrollLeft + a.clientWidth - c.right;
|
|
1022
|
+
p < g ? a.scrollLeft = p - c.left : f > d && (a.scrollLeft = f - a.clientWidth + c.right);
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
|
|
1026
|
-
const
|
|
1027
|
-
if (
|
|
1026
|
+
const c = l.querySelector(Fe);
|
|
1027
|
+
if (c && document.activeElement !== c)
|
|
1028
1028
|
try {
|
|
1029
|
-
|
|
1029
|
+
c.focus({ preventScroll: !0 });
|
|
1030
1030
|
} catch {
|
|
1031
1031
|
}
|
|
1032
1032
|
} else if (!l.contains(document.activeElement)) {
|
|
@@ -1039,24 +1039,24 @@ function $(t, e) {
|
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
}
|
|
1042
|
-
const
|
|
1043
|
-
function
|
|
1044
|
-
const o =
|
|
1045
|
-
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n,
|
|
1042
|
+
const oe = /* @__PURE__ */ new WeakMap();
|
|
1043
|
+
function Ct(t, e) {
|
|
1044
|
+
const o = qe(e), n = gt(e);
|
|
1045
|
+
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n, fe(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function pe(t, e, o, n) {
|
|
1048
1048
|
let i = null;
|
|
1049
1049
|
const r = o.composedPath?.();
|
|
1050
1050
|
if (r && r.length > 0 ? i = r[0] : i = o.target, i && !e.contains(i)) {
|
|
1051
1051
|
const d = document.elementFromPoint(o.clientX, o.clientY);
|
|
1052
1052
|
d && (i = d);
|
|
1053
1053
|
}
|
|
1054
|
-
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"),
|
|
1055
|
-
let
|
|
1056
|
-
return s && (
|
|
1054
|
+
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"), a = i?.closest?.(".header-row");
|
|
1055
|
+
let c, h, u, p, f, g;
|
|
1056
|
+
return s && (c = parseInt(s.getAttribute("data-row") ?? "-1", 10), h = parseInt(s.getAttribute("data-col") ?? "-1", 10), c >= 0 && h >= 0 && (u = t._rows[c], g = t._columns[h], p = g?.field, f = u && p ? u[p] : void 0)), {
|
|
1057
1057
|
type: n,
|
|
1058
1058
|
row: u,
|
|
1059
|
-
rowIndex:
|
|
1059
|
+
rowIndex: c !== void 0 && c >= 0 ? c : void 0,
|
|
1060
1060
|
colIndex: h !== void 0 && h >= 0 ? h : void 0,
|
|
1061
1061
|
field: p,
|
|
1062
1062
|
value: f,
|
|
@@ -1064,88 +1064,91 @@ function fe(t, e, o, n) {
|
|
|
1064
1064
|
originalEvent: o,
|
|
1065
1065
|
cellElement: s ?? void 0,
|
|
1066
1066
|
rowElement: l ?? void 0,
|
|
1067
|
-
isHeader: !!
|
|
1068
|
-
cell:
|
|
1067
|
+
isHeader: !!a,
|
|
1068
|
+
cell: c !== void 0 && h !== void 0 && c >= 0 && h >= 0 ? { row: c, col: h } : void 0
|
|
1069
1069
|
};
|
|
1070
1070
|
}
|
|
1071
|
-
function Ct(t, e, o) {
|
|
1072
|
-
const n = fe(t, e, o, "mousedown");
|
|
1073
|
-
(t._dispatchCellMouseDown?.(n) ?? !1) && te.set(t, !0);
|
|
1074
|
-
}
|
|
1075
1071
|
function yt(t, e, o) {
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
t._dispatchCellMouseMove?.(n);
|
|
1072
|
+
const n = pe(t, e, o, "mousedown");
|
|
1073
|
+
(t._dispatchCellMouseDown?.(n) ?? !1) && oe.set(t, !0);
|
|
1079
1074
|
}
|
|
1080
1075
|
function _t(t, e, o) {
|
|
1081
|
-
if (!
|
|
1082
|
-
const n =
|
|
1083
|
-
t.
|
|
1076
|
+
if (!oe.get(t)) return;
|
|
1077
|
+
const n = pe(t, e, o, "mousemove");
|
|
1078
|
+
t._dispatchCellMouseMove?.(n);
|
|
1084
1079
|
}
|
|
1085
1080
|
function Et(t, e, o) {
|
|
1081
|
+
if (!oe.get(t)) return;
|
|
1082
|
+
const n = pe(t, e, o, "mouseup");
|
|
1083
|
+
t._dispatchCellMouseUp?.(n), oe.set(t, !1);
|
|
1084
|
+
}
|
|
1085
|
+
function St(t, e, o) {
|
|
1086
1086
|
e.addEventListener(
|
|
1087
1087
|
"mousedown",
|
|
1088
1088
|
(n) => {
|
|
1089
1089
|
const i = n.target.closest(".cell[data-col]");
|
|
1090
|
-
i && (i.classList.contains("editing") ||
|
|
1090
|
+
i && (i.classList.contains("editing") || Ct(t, i));
|
|
1091
1091
|
},
|
|
1092
1092
|
{ signal: o }
|
|
1093
1093
|
), e.addEventListener(
|
|
1094
1094
|
"click",
|
|
1095
1095
|
(n) => {
|
|
1096
1096
|
const i = n.target.closest(".data-grid-row");
|
|
1097
|
-
i &&
|
|
1097
|
+
i && _e(t, n, i);
|
|
1098
1098
|
},
|
|
1099
1099
|
{ signal: o }
|
|
1100
1100
|
), e.addEventListener(
|
|
1101
1101
|
"dblclick",
|
|
1102
1102
|
(n) => {
|
|
1103
1103
|
const i = n.target.closest(".data-grid-row");
|
|
1104
|
-
i &&
|
|
1104
|
+
i && _e(t, n, i);
|
|
1105
1105
|
},
|
|
1106
1106
|
{ signal: o }
|
|
1107
1107
|
);
|
|
1108
1108
|
}
|
|
1109
|
-
function
|
|
1110
|
-
e.addEventListener("keydown", (i) =>
|
|
1109
|
+
function Rt(t, e, o, n) {
|
|
1110
|
+
e.addEventListener("keydown", (i) => vt(t, i), { signal: n }), o.addEventListener("mousedown", (i) => yt(t, o, i), { signal: n }), document.addEventListener("mousemove", (i) => _t(t, o, i), { signal: n }), document.addEventListener("mouseup", (i) => Et(t, o, i), { signal: n });
|
|
1111
1111
|
}
|
|
1112
|
-
function
|
|
1112
|
+
function xt(t, e) {
|
|
1113
1113
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1114
1114
|
}
|
|
1115
1115
|
function Tt(t, e, o) {
|
|
1116
|
-
const i = o.find((l) => l.field === e.field)?.sortComparator ??
|
|
1117
|
-
return [...t].sort((l,
|
|
1116
|
+
const i = o.find((l) => l.field === e.field)?.sortComparator ?? xt, { field: r, direction: s } = e;
|
|
1117
|
+
return [...t].sort((l, a) => i(l[r], a[r], l, a) * s);
|
|
1118
1118
|
}
|
|
1119
|
-
function
|
|
1120
|
-
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1),
|
|
1119
|
+
function Ee(t, e, o, n) {
|
|
1120
|
+
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1), ne(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1121
1121
|
new CustomEvent("sort-change", { detail: { field: o.field, direction: n } })
|
|
1122
1122
|
), t.requestStateChange?.();
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1125
|
-
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()),
|
|
1124
|
+
function Se(t, e) {
|
|
1125
|
+
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), Re(t, e, 1)) : t._sortState.direction === 1 ? Re(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), t._rows = t.__originalOrder.slice(), ne(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((n) => {
|
|
1126
1126
|
n.getAttribute("aria-sort") ? (n.getAttribute("aria-sort") === "ascending" || n.getAttribute("aria-sort") === "descending") && (t._sortState || n.setAttribute("aria-sort", "none")) : n.setAttribute("aria-sort", "none");
|
|
1127
1127
|
}), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1128
1128
|
new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
|
|
1129
1129
|
), t.requestStateChange?.());
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function Re(t, e, o) {
|
|
1132
1132
|
t._sortState = { field: e.field, direction: o };
|
|
1133
1133
|
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ?? Tt)(t._rows, n, i);
|
|
1134
1134
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1135
|
-
|
|
1136
|
-
}) :
|
|
1135
|
+
Ee(t, l, e, o);
|
|
1136
|
+
}) : Ee(t, s, e, o);
|
|
1137
1137
|
}
|
|
1138
1138
|
function U(t, e) {
|
|
1139
1139
|
return t.effectiveConfig?.sortable !== !1 && e.sortable === !0;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function K(t, e) {
|
|
1142
|
+
return t.effectiveConfig?.resizable !== !1 && e.resizable !== !1;
|
|
1143
|
+
}
|
|
1144
|
+
function At(t, e) {
|
|
1142
1145
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1143
1146
|
}
|
|
1144
|
-
function
|
|
1147
|
+
function Q(t, e) {
|
|
1145
1148
|
const o = document.createElement("span");
|
|
1146
1149
|
Me(o, "sort-indicator");
|
|
1147
|
-
const n = t._sortState?.field === e.field ? t._sortState.direction : 0, i = { ...
|
|
1148
|
-
return
|
|
1150
|
+
const n = t._sortState?.field === e.field ? t._sortState.direction : 0, i = { ...k, ...t.icons }, r = n === 1 ? i.sortAsc : n === -1 ? i.sortDesc : i.sortNone;
|
|
1151
|
+
return At(o, r), o;
|
|
1149
1152
|
}
|
|
1150
1153
|
function Z(t, e, o) {
|
|
1151
1154
|
const n = document.createElement("div");
|
|
@@ -1159,15 +1162,15 @@ function J(t, e, o, n) {
|
|
|
1159
1162
|
n.classList.add("sortable"), n.tabIndex = 0;
|
|
1160
1163
|
const i = t._sortState?.field === e.field ? t._sortState.direction : 0;
|
|
1161
1164
|
n.setAttribute("aria-sort", i === 0 ? "none" : i === 1 ? "ascending" : "descending"), n.addEventListener("click", (r) => {
|
|
1162
|
-
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, o, n) ||
|
|
1165
|
+
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, o, n) || Se(t, e);
|
|
1163
1166
|
}), n.addEventListener("keydown", (r) => {
|
|
1164
1167
|
if (r.key === "Enter" || r.key === " ") {
|
|
1165
1168
|
if (r.preventDefault(), t._dispatchHeaderClick?.(r, o, n)) return;
|
|
1166
|
-
|
|
1169
|
+
Se(t, e);
|
|
1167
1170
|
}
|
|
1168
1171
|
});
|
|
1169
1172
|
}
|
|
1170
|
-
function
|
|
1173
|
+
function Pt(t, e) {
|
|
1171
1174
|
if (e != null)
|
|
1172
1175
|
if (typeof e == "string") {
|
|
1173
1176
|
const o = document.createElement("span");
|
|
@@ -1175,7 +1178,7 @@ function At(t, e) {
|
|
|
1175
1178
|
t.appendChild(o.firstChild);
|
|
1176
1179
|
} else e instanceof Node && t.appendChild(e);
|
|
1177
1180
|
}
|
|
1178
|
-
function
|
|
1181
|
+
function ne(t) {
|
|
1179
1182
|
t._headerRowEl = t.findHeaderRow();
|
|
1180
1183
|
const e = t._headerRowEl;
|
|
1181
1184
|
e && (e.innerHTML = "", t._visibleColumns.forEach((o, n) => {
|
|
@@ -1183,37 +1186,36 @@ function oe(t) {
|
|
|
1183
1186
|
i.className = "cell", Me(i, "header-cell"), i.setAttribute("role", "columnheader"), i.setAttribute("aria-colindex", String(n + 1)), i.setAttribute("data-field", o.field), i.setAttribute("data-col", String(n));
|
|
1184
1187
|
const r = o.header ?? o.field, s = t._sortState?.field === o.field ? t._sortState.direction : 0, l = s === 1 ? "asc" : s === -1 ? "desc" : null;
|
|
1185
1188
|
if (o.headerRenderer) {
|
|
1186
|
-
const
|
|
1189
|
+
const a = {
|
|
1187
1190
|
column: o,
|
|
1188
1191
|
value: r,
|
|
1189
1192
|
sortState: l,
|
|
1190
1193
|
filterActive: !1,
|
|
1191
1194
|
cellEl: i,
|
|
1192
|
-
renderSortIcon: () => U(t, o) ?
|
|
1193
|
-
renderFilterButton: () => null
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
At(i, a), U(t, o) && J(t, o, n, i), o.resizable && i.classList.add("resizable");
|
|
1195
|
+
renderSortIcon: () => U(t, o) ? Q(t, o) : null,
|
|
1196
|
+
renderFilterButton: () => null
|
|
1197
|
+
}, c = o.headerRenderer(a);
|
|
1198
|
+
Pt(i, c), U(t, o) && J(t, o, n, i), K(t, o) && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1197
1199
|
} else if (o.headerLabelRenderer) {
|
|
1198
|
-
const
|
|
1200
|
+
const a = {
|
|
1199
1201
|
column: o,
|
|
1200
1202
|
value: r
|
|
1201
|
-
},
|
|
1202
|
-
|
|
1203
|
+
}, c = o.headerLabelRenderer(a), h = document.createElement("span");
|
|
1204
|
+
c == null ? h.textContent = r : typeof c == "string" ? h.innerHTML = F(c) : c instanceof Node && h.appendChild(c), i.appendChild(h), U(t, o) && (J(t, o, n, i), i.appendChild(Q(t, o))), K(t, o) && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1203
1205
|
} else if (o.__headerTemplate)
|
|
1204
|
-
Array.from(o.__headerTemplate.childNodes).forEach((
|
|
1206
|
+
Array.from(o.__headerTemplate.childNodes).forEach((a) => i.appendChild(a.cloneNode(!0))), U(t, o) && (J(t, o, n, i), i.appendChild(Q(t, o))), K(t, o) && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1205
1207
|
else {
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1208
|
+
const a = document.createElement("span");
|
|
1209
|
+
a.textContent = r, i.appendChild(a), U(t, o) && (J(t, o, n, i), i.appendChild(Q(t, o))), K(t, o) && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1208
1210
|
}
|
|
1209
1211
|
e.appendChild(i);
|
|
1210
1212
|
}), e.querySelectorAll(".cell.sortable").forEach((o) => {
|
|
1211
1213
|
o.getAttribute("aria-sort") || o.setAttribute("aria-sort", "none");
|
|
1212
1214
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
|
|
1213
1215
|
}
|
|
1214
|
-
const
|
|
1215
|
-
function
|
|
1216
|
-
return
|
|
1216
|
+
const Be = typeof requestIdleCallback == "function";
|
|
1217
|
+
function Lt(t, e) {
|
|
1218
|
+
return Be ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1217
1219
|
const o = Date.now();
|
|
1218
1220
|
t({
|
|
1219
1221
|
didTimeout: !1,
|
|
@@ -1221,11 +1223,11 @@ function Pt(t, e) {
|
|
|
1221
1223
|
});
|
|
1222
1224
|
}, 1);
|
|
1223
1225
|
}
|
|
1224
|
-
function
|
|
1225
|
-
|
|
1226
|
+
function xe(t) {
|
|
1227
|
+
Be ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1226
1228
|
}
|
|
1227
1229
|
var A = ((t) => (t[t.STYLE = 1] = "STYLE", t[t.VIRTUALIZATION = 2] = "VIRTUALIZATION", t[t.HEADER = 3] = "HEADER", t[t.ROWS = 4] = "ROWS", t[t.COLUMNS = 5] = "COLUMNS", t[t.FULL = 6] = "FULL", t))(A || {});
|
|
1228
|
-
class
|
|
1230
|
+
class Ht {
|
|
1229
1231
|
#l;
|
|
1230
1232
|
#i = 0;
|
|
1231
1233
|
#u = 0;
|
|
@@ -1270,9 +1272,9 @@ class Lt {
|
|
|
1270
1272
|
}
|
|
1271
1273
|
function Te(t) {
|
|
1272
1274
|
let e = null, o = null, n = null, i = null;
|
|
1273
|
-
const r = (
|
|
1275
|
+
const r = (a) => {
|
|
1274
1276
|
if (!e) return;
|
|
1275
|
-
const
|
|
1277
|
+
const c = a.clientX - e.startX, h = Math.max(40, e.startWidth + c), u = t._visibleColumns[e.colIndex];
|
|
1276
1278
|
u.width = h, u.__userResized = !0, u.__renderedWidth = h, o == null && (o = requestAnimationFrame(() => {
|
|
1277
1279
|
o = null, t.updateTemplate?.();
|
|
1278
1280
|
})), t.dispatchEvent(
|
|
@@ -1281,24 +1283,24 @@ function Te(t) {
|
|
|
1281
1283
|
};
|
|
1282
1284
|
let s = !1;
|
|
1283
1285
|
const l = () => {
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
+
const a = e !== null;
|
|
1287
|
+
a && (s = !0, requestAnimationFrame(() => {
|
|
1286
1288
|
s = !1;
|
|
1287
|
-
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null,
|
|
1289
|
+
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null, a && t.requestStateChange && t.requestStateChange();
|
|
1288
1290
|
};
|
|
1289
1291
|
return {
|
|
1290
1292
|
get isResizing() {
|
|
1291
1293
|
return e !== null || s;
|
|
1292
1294
|
},
|
|
1293
|
-
start(
|
|
1294
|
-
|
|
1295
|
-
const u = t._visibleColumns[
|
|
1296
|
-
e = { startX:
|
|
1295
|
+
start(a, c, h) {
|
|
1296
|
+
a.preventDefault();
|
|
1297
|
+
const u = t._visibleColumns[c], p = typeof u?.width == "number" ? u.width : void 0, f = u?.__renderedWidth ?? p ?? h.getBoundingClientRect().width;
|
|
1298
|
+
e = { startX: a.clientX, colIndex: c, startWidth: f }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l), n === null && (n = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", i === null && (i = document.body.style.userSelect), document.body.style.userSelect = "none";
|
|
1297
1299
|
},
|
|
1298
|
-
resetColumn(
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
new CustomEvent("column-resize-reset", { detail: { field:
|
|
1300
|
+
resetColumn(a) {
|
|
1301
|
+
const c = t._visibleColumns[a];
|
|
1302
|
+
c && (c.__userResized = !1, c.__renderedWidth = void 0, c.width = c.__originalWidth, t.updateTemplate?.(), t.requestStateChange?.(), t.dispatchEvent(
|
|
1303
|
+
new CustomEvent("column-resize-reset", { detail: { field: c.field, width: c.width } })
|
|
1302
1304
|
));
|
|
1303
1305
|
},
|
|
1304
1306
|
dispose() {
|
|
@@ -1306,55 +1308,55 @@ function Te(t) {
|
|
|
1306
1308
|
}
|
|
1307
1309
|
};
|
|
1308
1310
|
}
|
|
1309
|
-
const
|
|
1311
|
+
const ae = "data-animating", Ot = {
|
|
1310
1312
|
change: "--tbw-row-change-duration",
|
|
1311
1313
|
insert: "--tbw-row-insert-duration",
|
|
1312
1314
|
remove: "--tbw-row-remove-duration"
|
|
1313
|
-
},
|
|
1315
|
+
}, Dt = {
|
|
1314
1316
|
change: 500,
|
|
1315
1317
|
insert: 300,
|
|
1316
1318
|
remove: 200
|
|
1317
1319
|
};
|
|
1318
|
-
function
|
|
1320
|
+
function zt(t) {
|
|
1319
1321
|
const e = t.trim().toLowerCase();
|
|
1320
1322
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
1321
1323
|
}
|
|
1322
1324
|
function Mt(t, e) {
|
|
1323
|
-
const o =
|
|
1325
|
+
const o = Ot[e], n = getComputedStyle(t).getPropertyValue(o);
|
|
1324
1326
|
if (n) {
|
|
1325
|
-
const i =
|
|
1327
|
+
const i = zt(n);
|
|
1326
1328
|
if (!isNaN(i) && i > 0)
|
|
1327
1329
|
return i;
|
|
1328
1330
|
}
|
|
1329
|
-
return
|
|
1331
|
+
return Dt[e];
|
|
1330
1332
|
}
|
|
1331
|
-
function
|
|
1332
|
-
t.removeAttribute(
|
|
1333
|
+
function kt(t, e, o) {
|
|
1334
|
+
t.removeAttribute(ae), t.offsetWidth, t.setAttribute(ae, e);
|
|
1333
1335
|
const n = Mt(t, e);
|
|
1334
1336
|
setTimeout(() => {
|
|
1335
|
-
e !== "remove" && t.removeAttribute(
|
|
1337
|
+
e !== "remove" && t.removeAttribute(ae);
|
|
1336
1338
|
}, n);
|
|
1337
1339
|
}
|
|
1338
|
-
function
|
|
1340
|
+
function ge(t, e, o) {
|
|
1339
1341
|
if (e < 0)
|
|
1340
1342
|
return !1;
|
|
1341
1343
|
const n = t.findRenderedRowElement?.(e);
|
|
1342
|
-
return n ? (
|
|
1344
|
+
return n ? (kt(n, o), !0) : !1;
|
|
1343
1345
|
}
|
|
1344
1346
|
function Nt(t, e, o) {
|
|
1345
1347
|
let n = 0;
|
|
1346
1348
|
for (const i of e)
|
|
1347
|
-
|
|
1349
|
+
ge(t, i, o) && n++;
|
|
1348
1350
|
return n;
|
|
1349
1351
|
}
|
|
1350
|
-
function
|
|
1352
|
+
function It(t, e, o) {
|
|
1351
1353
|
const n = t._rows ?? [], i = t.getRowId;
|
|
1352
1354
|
if (!i)
|
|
1353
1355
|
return !1;
|
|
1354
1356
|
const r = n.findIndex((s) => i(s) === e);
|
|
1355
|
-
return r < 0 ? !1 :
|
|
1357
|
+
return r < 0 ? !1 : ge(t, r, o);
|
|
1356
1358
|
}
|
|
1357
|
-
function
|
|
1359
|
+
function ee(t, e, o) {
|
|
1358
1360
|
const n = document.createElement(t);
|
|
1359
1361
|
if (e)
|
|
1360
1362
|
for (const i in e) {
|
|
@@ -1372,7 +1374,7 @@ function H(t, e) {
|
|
|
1372
1374
|
}
|
|
1373
1375
|
return o;
|
|
1374
1376
|
}
|
|
1375
|
-
function
|
|
1377
|
+
function Ge(t, e, o) {
|
|
1376
1378
|
const n = document.createElement("button");
|
|
1377
1379
|
if (t && (n.className = t), e)
|
|
1378
1380
|
for (const i in e) {
|
|
@@ -1381,8 +1383,8 @@ function Be(t, e, o) {
|
|
|
1381
1383
|
}
|
|
1382
1384
|
return n;
|
|
1383
1385
|
}
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
+
const Xe = document.createElement("template");
|
|
1387
|
+
Xe.innerHTML = `
|
|
1386
1388
|
<div class="tbw-scroll-area">
|
|
1387
1389
|
<div class="rows-body-wrapper">
|
|
1388
1390
|
<div class="rows-body" role="grid">
|
|
@@ -1401,20 +1403,20 @@ Ge.innerHTML = `
|
|
|
1401
1403
|
<div class="faux-vscroll-spacer"></div>
|
|
1402
1404
|
</div>
|
|
1403
1405
|
`;
|
|
1404
|
-
function
|
|
1405
|
-
return
|
|
1406
|
+
function Ye() {
|
|
1407
|
+
return Xe.content.cloneNode(!0);
|
|
1406
1408
|
}
|
|
1407
|
-
function
|
|
1409
|
+
function Ae(t) {
|
|
1408
1410
|
const e = document.createDocumentFragment(), o = H(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1409
1411
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1410
1412
|
o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
|
|
1411
1413
|
else {
|
|
1412
1414
|
const n = H("tbw-grid-content");
|
|
1413
|
-
n.appendChild(
|
|
1415
|
+
n.appendChild(Ye()), o.appendChild(n);
|
|
1414
1416
|
}
|
|
1415
1417
|
return e.appendChild(o), e;
|
|
1416
1418
|
}
|
|
1417
|
-
function
|
|
1419
|
+
function qt(t) {
|
|
1418
1420
|
const e = H("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1419
1421
|
if (t.title) {
|
|
1420
1422
|
const r = H("tbw-shell-title");
|
|
@@ -1432,7 +1434,7 @@ function It(t) {
|
|
|
1432
1434
|
for (const r of t.apiButtons)
|
|
1433
1435
|
r.hasRender && n.appendChild(H("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1434
1436
|
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && n.appendChild(H("tbw-toolbar-separator")), t.hasPanels) {
|
|
1435
|
-
const r =
|
|
1437
|
+
const r = Ge(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
|
|
1436
1438
|
"data-panel-toggle": "",
|
|
1437
1439
|
title: "Settings",
|
|
1438
1440
|
"aria-label": "Toggle settings panel",
|
|
@@ -1443,12 +1445,12 @@ function It(t) {
|
|
|
1443
1445
|
}
|
|
1444
1446
|
return e.appendChild(n), e;
|
|
1445
1447
|
}
|
|
1446
|
-
function
|
|
1448
|
+
function Wt(t) {
|
|
1447
1449
|
const e = H("tbw-shell-body"), o = t.panels.length > 0, n = t.panels.length === 1, i = H("tbw-grid-content");
|
|
1448
|
-
i.appendChild(
|
|
1450
|
+
i.appendChild(Ye());
|
|
1449
1451
|
let r = null;
|
|
1450
1452
|
if (o) {
|
|
1451
|
-
r =
|
|
1453
|
+
r = ee("aside", {
|
|
1452
1454
|
class: t.isPanelOpen ? "tbw-tool-panel open" : "tbw-tool-panel",
|
|
1453
1455
|
part: "tool-panel",
|
|
1454
1456
|
"data-position": t.position,
|
|
@@ -1463,36 +1465,36 @@ function qt(t) {
|
|
|
1463
1465
|
"aria-hidden": "true"
|
|
1464
1466
|
})
|
|
1465
1467
|
);
|
|
1466
|
-
const l = H("tbw-tool-panel-content", { role: "presentation" }),
|
|
1467
|
-
for (const
|
|
1468
|
-
const h = `tbw-accordion-section${
|
|
1469
|
-
"aria-expanded": String(
|
|
1470
|
-
"aria-controls": `tbw-section-${
|
|
1468
|
+
const l = H("tbw-tool-panel-content", { role: "presentation" }), a = H("tbw-accordion");
|
|
1469
|
+
for (const c of t.panels) {
|
|
1470
|
+
const h = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, u = H(h, { "data-section": c.id }), p = Ge("tbw-accordion-header", {
|
|
1471
|
+
"aria-expanded": String(c.isExpanded),
|
|
1472
|
+
"aria-controls": `tbw-section-${c.id}`
|
|
1471
1473
|
});
|
|
1472
|
-
if (n && p.setAttribute("aria-disabled", "true"),
|
|
1473
|
-
const g =
|
|
1474
|
-
g.innerHTML =
|
|
1474
|
+
if (n && p.setAttribute("aria-disabled", "true"), c.icon) {
|
|
1475
|
+
const g = ee("span", { class: "tbw-accordion-icon" });
|
|
1476
|
+
g.innerHTML = c.icon, p.appendChild(g);
|
|
1475
1477
|
}
|
|
1476
|
-
const f =
|
|
1477
|
-
if (f.textContent =
|
|
1478
|
-
const g =
|
|
1479
|
-
g.innerHTML =
|
|
1478
|
+
const f = ee("span", { class: "tbw-accordion-title" });
|
|
1479
|
+
if (f.textContent = c.title, p.appendChild(f), !n) {
|
|
1480
|
+
const g = ee("span", { class: "tbw-accordion-chevron" });
|
|
1481
|
+
g.innerHTML = c.isExpanded ? t.collapseIcon : t.expandIcon, p.appendChild(g);
|
|
1480
1482
|
}
|
|
1481
1483
|
u.appendChild(p), u.appendChild(
|
|
1482
1484
|
H("tbw-accordion-content", {
|
|
1483
|
-
id: `tbw-section-${
|
|
1485
|
+
id: `tbw-section-${c.id}`,
|
|
1484
1486
|
role: "presentation"
|
|
1485
1487
|
})
|
|
1486
|
-
),
|
|
1488
|
+
), a.appendChild(u);
|
|
1487
1489
|
}
|
|
1488
|
-
l.appendChild(
|
|
1490
|
+
l.appendChild(a), r.appendChild(l);
|
|
1489
1491
|
}
|
|
1490
1492
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(i)) : (e.appendChild(i), r && e.appendChild(r)), e;
|
|
1491
1493
|
}
|
|
1492
|
-
function
|
|
1494
|
+
function N(t) {
|
|
1493
1495
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1494
1496
|
}
|
|
1495
|
-
function
|
|
1497
|
+
function $t() {
|
|
1496
1498
|
return {
|
|
1497
1499
|
toolPanels: /* @__PURE__ */ new Map(),
|
|
1498
1500
|
headerContents: /* @__PURE__ */ new Map(),
|
|
@@ -1511,14 +1513,14 @@ function Wt() {
|
|
|
1511
1513
|
lightDomContentMoved: !1
|
|
1512
1514
|
};
|
|
1513
1515
|
}
|
|
1514
|
-
function
|
|
1516
|
+
function je(t) {
|
|
1515
1517
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1516
1518
|
}
|
|
1517
|
-
function
|
|
1518
|
-
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r =
|
|
1519
|
+
function Pe(t, e, o = "☰") {
|
|
1520
|
+
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = N(o), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], a = new Set(s.map((d) => d.id)), c = [...s];
|
|
1519
1521
|
for (const d of l)
|
|
1520
|
-
|
|
1521
|
-
const h =
|
|
1522
|
+
a.has(d.id) || c.push(d);
|
|
1523
|
+
const h = c.length > 0, u = e.toolPanels.size > 0, p = h && u, f = [...c].sort((d, w) => (d.order ?? 0) - (w.order ?? 0));
|
|
1522
1524
|
let g = "";
|
|
1523
1525
|
for (const d of f)
|
|
1524
1526
|
g += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${d.id}"></div>`;
|
|
@@ -1528,7 +1530,7 @@ function Ae(t, e, o = "☰") {
|
|
|
1528
1530
|
}
|
|
1529
1531
|
return `
|
|
1530
1532
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1531
|
-
${i ? `<div class="tbw-shell-title">${
|
|
1533
|
+
${i ? `<div class="tbw-shell-title">${rt(n)}</div>` : ""}
|
|
1532
1534
|
<div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
|
|
1533
1535
|
<div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
|
|
1534
1536
|
${g}
|
|
@@ -1571,7 +1573,7 @@ function W(t, e, o) {
|
|
|
1571
1573
|
);
|
|
1572
1574
|
return;
|
|
1573
1575
|
}
|
|
1574
|
-
const
|
|
1576
|
+
const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0, h = parseInt(r.getAttribute("order") ?? "100", 10);
|
|
1575
1577
|
let u;
|
|
1576
1578
|
const p = o?.(r);
|
|
1577
1579
|
if (p)
|
|
@@ -1579,14 +1581,14 @@ function W(t, e, o) {
|
|
|
1579
1581
|
else {
|
|
1580
1582
|
const d = r.innerHTML.trim();
|
|
1581
1583
|
u = (w) => {
|
|
1582
|
-
const
|
|
1583
|
-
return
|
|
1584
|
+
const b = document.createElement("div");
|
|
1585
|
+
return b.innerHTML = d, w.appendChild(b), () => b.remove();
|
|
1584
1586
|
};
|
|
1585
1587
|
}
|
|
1586
1588
|
const f = e.toolPanels.get(s);
|
|
1587
1589
|
if (f) {
|
|
1588
1590
|
if (p) {
|
|
1589
|
-
f.render = u, f.order = h, f.icon =
|
|
1591
|
+
f.render = u, f.order = h, f.icon = a, f.tooltip = c;
|
|
1590
1592
|
const d = e.panelCleanups.get(s);
|
|
1591
1593
|
d && (d(), e.panelCleanups.delete(s));
|
|
1592
1594
|
}
|
|
@@ -1595,15 +1597,15 @@ function W(t, e, o) {
|
|
|
1595
1597
|
const g = {
|
|
1596
1598
|
id: s,
|
|
1597
1599
|
title: l,
|
|
1598
|
-
icon:
|
|
1599
|
-
tooltip:
|
|
1600
|
+
icon: a,
|
|
1601
|
+
tooltip: c,
|
|
1600
1602
|
order: h,
|
|
1601
1603
|
render: u
|
|
1602
1604
|
};
|
|
1603
1605
|
e.toolPanels.set(s, g), e.lightDomToolPanelIds.add(s), r.style.display = "none";
|
|
1604
1606
|
});
|
|
1605
1607
|
}
|
|
1606
|
-
function
|
|
1608
|
+
function Ft(t, e, o, n) {
|
|
1607
1609
|
const i = t.querySelector(".tbw-shell-toolbar");
|
|
1608
1610
|
i && i.addEventListener("click", (s) => {
|
|
1609
1611
|
if (s.target.closest("[data-panel-toggle]")) {
|
|
@@ -1613,50 +1615,50 @@ function $t(t, e, o, n) {
|
|
|
1613
1615
|
});
|
|
1614
1616
|
const r = t.querySelector(".tbw-accordion");
|
|
1615
1617
|
r && r.addEventListener("click", (s) => {
|
|
1616
|
-
const
|
|
1617
|
-
if (
|
|
1618
|
-
const h =
|
|
1618
|
+
const a = s.target.closest(".tbw-accordion-header");
|
|
1619
|
+
if (a) {
|
|
1620
|
+
const h = a.closest("[data-section]")?.getAttribute("data-section");
|
|
1619
1621
|
h && n.onSectionToggle(h);
|
|
1620
1622
|
}
|
|
1621
1623
|
});
|
|
1622
1624
|
}
|
|
1623
|
-
function
|
|
1625
|
+
function Ut(t, e, o) {
|
|
1624
1626
|
const n = t.querySelector(".tbw-tool-panel"), i = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1625
1627
|
if (!n || !i || !r)
|
|
1626
1628
|
return () => {
|
|
1627
1629
|
};
|
|
1628
1630
|
const s = e?.toolPanel?.position ?? "right", l = 200;
|
|
1629
|
-
let
|
|
1631
|
+
let a = 0, c = 0, h = 0, u = !1;
|
|
1630
1632
|
const p = (d) => {
|
|
1631
1633
|
if (!u) return;
|
|
1632
1634
|
d.preventDefault();
|
|
1633
|
-
const w = s === "left" ? d.clientX -
|
|
1634
|
-
n.style.width = `${
|
|
1635
|
+
const w = s === "left" ? d.clientX - a : a - d.clientX, b = Math.min(h, Math.max(l, c + w));
|
|
1636
|
+
n.style.width = `${b}px`;
|
|
1635
1637
|
}, f = () => {
|
|
1636
1638
|
if (!u) return;
|
|
1637
1639
|
u = !1, i.classList.remove("resizing"), n.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1638
1640
|
const d = n.getBoundingClientRect().width;
|
|
1639
1641
|
o(d), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
1640
1642
|
}, g = (d) => {
|
|
1641
|
-
d.preventDefault(), u = !0,
|
|
1643
|
+
d.preventDefault(), u = !0, a = d.clientX, c = n.getBoundingClientRect().width, h = r.getBoundingClientRect().width - 20, i.classList.add("resizing"), n.style.transition = "none", document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", p), document.addEventListener("mouseup", f);
|
|
1642
1644
|
};
|
|
1643
1645
|
return i.addEventListener("mousedown", g), () => {
|
|
1644
1646
|
i.removeEventListener("mousedown", g), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
1645
1647
|
};
|
|
1646
1648
|
}
|
|
1647
|
-
function
|
|
1649
|
+
function Le(t, e, o) {
|
|
1648
1650
|
const n = e?.header?.toolbarContents ?? [], i = [...o.toolbarContents.values()], r = new Set(n.map((l) => l.id)), s = [...n];
|
|
1649
1651
|
for (const l of i)
|
|
1650
1652
|
r.has(l.id) || s.push(l);
|
|
1651
1653
|
for (const l of s) {
|
|
1652
1654
|
if (o.toolbarContentCleanups.has(l.id) || !l.render) continue;
|
|
1653
|
-
const
|
|
1654
|
-
if (!
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1655
|
+
const a = t.querySelector(`[data-toolbar-content="${l.id}"]`);
|
|
1656
|
+
if (!a) continue;
|
|
1657
|
+
const c = l.render(a);
|
|
1658
|
+
c && o.toolbarContentCleanups.set(l.id, c);
|
|
1657
1659
|
}
|
|
1658
1660
|
}
|
|
1659
|
-
function
|
|
1661
|
+
function he(t, e) {
|
|
1660
1662
|
const o = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, n = e.headerContents.size > 0;
|
|
1661
1663
|
if (!o && !n) return;
|
|
1662
1664
|
const i = t.querySelector(".tbw-shell-content");
|
|
@@ -1670,42 +1672,42 @@ function de(t, e) {
|
|
|
1670
1672
|
for (const s of r) {
|
|
1671
1673
|
const l = e.headerContentCleanups.get(s.id);
|
|
1672
1674
|
l && (l(), e.headerContentCleanups.delete(s.id));
|
|
1673
|
-
let
|
|
1674
|
-
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1675
|
+
let a = i.querySelector(`[data-header-content="${s.id}"]`);
|
|
1676
|
+
a || (a = document.createElement("div"), a.setAttribute("data-header-content", s.id), i.appendChild(a));
|
|
1677
|
+
const c = s.render(a);
|
|
1678
|
+
c && e.headerContentCleanups.set(s.id, c);
|
|
1677
1679
|
}
|
|
1678
1680
|
}
|
|
1679
|
-
function
|
|
1681
|
+
function Vt(t, e, o) {
|
|
1680
1682
|
if (!e.isPanelOpen) return;
|
|
1681
|
-
const n =
|
|
1683
|
+
const n = N(o?.expand ?? k.expand), i = N(o?.collapse ?? k.collapse);
|
|
1682
1684
|
for (const [r, s] of e.toolPanels) {
|
|
1683
|
-
const l = e.expandedSections.has(r),
|
|
1684
|
-
if (!
|
|
1685
|
-
|
|
1686
|
-
const h =
|
|
1685
|
+
const l = e.expandedSections.has(r), a = t.querySelector(`[data-section="${r}"]`), c = a?.querySelector(".tbw-accordion-content");
|
|
1686
|
+
if (!a || !c) continue;
|
|
1687
|
+
a.classList.toggle("expanded", l);
|
|
1688
|
+
const h = a.querySelector(".tbw-accordion-header");
|
|
1687
1689
|
h && h.setAttribute("aria-expanded", String(l));
|
|
1688
|
-
const u =
|
|
1690
|
+
const u = a.querySelector(".tbw-accordion-chevron");
|
|
1689
1691
|
if (u && (u.innerHTML = l ? i : n), l) {
|
|
1690
|
-
if (
|
|
1691
|
-
const p = s.render(
|
|
1692
|
+
if (c.children.length === 0) {
|
|
1693
|
+
const p = s.render(c);
|
|
1692
1694
|
p && e.panelCleanups.set(r, p);
|
|
1693
1695
|
}
|
|
1694
1696
|
} else {
|
|
1695
1697
|
const p = e.panelCleanups.get(r);
|
|
1696
|
-
p && (p(), e.panelCleanups.delete(r)),
|
|
1698
|
+
p && (p(), e.panelCleanups.delete(r)), c.innerHTML = "";
|
|
1697
1699
|
}
|
|
1698
1700
|
}
|
|
1699
1701
|
}
|
|
1700
|
-
function
|
|
1702
|
+
function He(t, e) {
|
|
1701
1703
|
const o = t.querySelector("[data-panel-toggle]");
|
|
1702
1704
|
o && (o.classList.toggle("active", e.isPanelOpen), o.setAttribute("aria-pressed", String(e.isPanelOpen)));
|
|
1703
1705
|
}
|
|
1704
|
-
function
|
|
1706
|
+
function Oe(t, e) {
|
|
1705
1707
|
const o = t.querySelector(".tbw-tool-panel");
|
|
1706
1708
|
o && (o.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (o.style.width = ""));
|
|
1707
1709
|
}
|
|
1708
|
-
function
|
|
1710
|
+
function Bt(t) {
|
|
1709
1711
|
for (const e of t.headerContentCleanups.values())
|
|
1710
1712
|
e();
|
|
1711
1713
|
t.headerContentCleanups.clear();
|
|
@@ -1722,7 +1724,7 @@ function Vt(t) {
|
|
|
1722
1724
|
t.toolPanels.get(e)?.onClose?.();
|
|
1723
1725
|
t.isPanelOpen = !1, t.expandedSections.clear(), t.toolPanels.clear(), t.headerContents.clear(), t.toolbarContents.clear(), t.lightDomHeaderContent = [], t.lightDomToolPanelIds.clear(), t.lightDomToolbarContentIds.clear(), t.lightDomContentMoved = !1;
|
|
1724
1726
|
}
|
|
1725
|
-
function
|
|
1727
|
+
function Gt(t, e) {
|
|
1726
1728
|
let o = !1;
|
|
1727
1729
|
const n = {
|
|
1728
1730
|
get isInitialized() {
|
|
@@ -1747,11 +1749,11 @@ function Bt(t, e) {
|
|
|
1747
1749
|
return;
|
|
1748
1750
|
}
|
|
1749
1751
|
if (t.isPanelOpen = !0, t.expandedSections.size === 0 && t.toolPanels.size > 0) {
|
|
1750
|
-
const s = [...t.toolPanels.values()].sort((l,
|
|
1752
|
+
const s = [...t.toolPanels.values()].sort((l, a) => (l.order ?? 100) - (a.order ?? 100))[0];
|
|
1751
1753
|
s && t.expandedSections.add(s.id);
|
|
1752
1754
|
}
|
|
1753
1755
|
const i = e.getShadow();
|
|
1754
|
-
|
|
1756
|
+
He(i, t), Oe(i, t), Vt(i, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: n.expandedSections });
|
|
1755
1757
|
},
|
|
1756
1758
|
closeToolPanel() {
|
|
1757
1759
|
if (!t.isPanelOpen) return;
|
|
@@ -1762,7 +1764,7 @@ function Bt(t, e) {
|
|
|
1762
1764
|
r.onClose?.();
|
|
1763
1765
|
t.isPanelOpen = !1;
|
|
1764
1766
|
const i = e.getShadow();
|
|
1765
|
-
|
|
1767
|
+
He(i, t), Oe(i, t), e.emit("tool-panel-close", {});
|
|
1766
1768
|
},
|
|
1767
1769
|
toggleToolPanel() {
|
|
1768
1770
|
t.isPanelOpen ? n.closeToolPanel() : n.openToolPanel();
|
|
@@ -1777,17 +1779,17 @@ function Bt(t, e) {
|
|
|
1777
1779
|
return;
|
|
1778
1780
|
const s = e.getShadow(), l = t.expandedSections.has(i);
|
|
1779
1781
|
if (l) {
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1782
|
+
const a = t.panelCleanups.get(i);
|
|
1783
|
+
a && (a(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), ce(s, i, !1);
|
|
1782
1784
|
} else {
|
|
1783
|
-
for (const [
|
|
1784
|
-
if (
|
|
1785
|
-
const h = t.panelCleanups.get(
|
|
1786
|
-
h && (h(), t.panelCleanups.delete(
|
|
1787
|
-
const u = s.querySelector(`[data-section="${
|
|
1785
|
+
for (const [a, c] of t.toolPanels)
|
|
1786
|
+
if (a !== i && t.expandedSections.has(a)) {
|
|
1787
|
+
const h = t.panelCleanups.get(a);
|
|
1788
|
+
h && (h(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), ce(s, a, !1);
|
|
1789
|
+
const u = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
|
|
1788
1790
|
u && (u.innerHTML = "");
|
|
1789
1791
|
}
|
|
1790
|
-
t.expandedSections.add(i),
|
|
1792
|
+
t.expandedSections.add(i), ce(s, i, !0), Xt(s, t, i);
|
|
1791
1793
|
}
|
|
1792
1794
|
e.emit("tool-panel-section-toggle", { id: i, expanded: !l });
|
|
1793
1795
|
},
|
|
@@ -1816,7 +1818,7 @@ function Bt(t, e) {
|
|
|
1816
1818
|
console.warn(`[tbw-grid] Header content "${i.id}" already registered`);
|
|
1817
1819
|
return;
|
|
1818
1820
|
}
|
|
1819
|
-
t.headerContents.set(i.id, i), o &&
|
|
1821
|
+
t.headerContents.set(i.id, i), o && he(e.getShadow(), t);
|
|
1820
1822
|
},
|
|
1821
1823
|
unregisterHeaderContent(i) {
|
|
1822
1824
|
const r = t.headerContentCleanups.get(i);
|
|
@@ -1841,11 +1843,11 @@ function Bt(t, e) {
|
|
|
1841
1843
|
};
|
|
1842
1844
|
return n;
|
|
1843
1845
|
}
|
|
1844
|
-
function
|
|
1846
|
+
function ce(t, e, o) {
|
|
1845
1847
|
const n = t.querySelector(`[data-section="${e}"]`);
|
|
1846
1848
|
n && n.classList.toggle("expanded", o);
|
|
1847
1849
|
}
|
|
1848
|
-
function
|
|
1850
|
+
function Xt(t, e, o) {
|
|
1849
1851
|
const n = e.toolPanels.get(o);
|
|
1850
1852
|
if (!n?.render) return;
|
|
1851
1853
|
const i = t.querySelector(`[data-section="${o}"] .tbw-accordion-content`);
|
|
@@ -1853,8 +1855,8 @@ function Gt(t, e, o) {
|
|
|
1853
1855
|
const r = n.render(i);
|
|
1854
1856
|
r && e.panelCleanups.set(o, r);
|
|
1855
1857
|
}
|
|
1856
|
-
function
|
|
1857
|
-
const i =
|
|
1858
|
+
function Yt(t, e, o, n) {
|
|
1859
|
+
const i = je(e), r = [], s = [
|
|
1858
1860
|
"tbw-grid-header",
|
|
1859
1861
|
"tbw-grid-tool-buttons",
|
|
1860
1862
|
"tbw-grid-tool-panel",
|
|
@@ -1863,12 +1865,12 @@ function Xt(t, e, o, n) {
|
|
|
1863
1865
|
"tbw-grid-responsive-card"
|
|
1864
1866
|
];
|
|
1865
1867
|
for (const l of s)
|
|
1866
|
-
t.querySelectorAll(`:scope > ${l}`).forEach((
|
|
1868
|
+
t.querySelectorAll(`:scope > ${l}`).forEach((c) => r.push(c));
|
|
1867
1869
|
t.replaceChildren();
|
|
1868
1870
|
for (const l of r)
|
|
1869
1871
|
t.appendChild(l);
|
|
1870
1872
|
if (i) {
|
|
1871
|
-
const l =
|
|
1873
|
+
const l = N(n?.toolPanel ?? k.toolPanel), a = N(n?.expand ?? k.expand), c = N(n?.collapse ?? k.collapse), u = [...e?.header?.toolbarContents ?? []].sort((C, _) => (C.order ?? 0) - (_.order ?? 0)), f = [...e?.toolPanels ?? []].sort((C, _) => (C.order ?? 100) - (_.order ?? 100)), g = {
|
|
1872
1874
|
title: e?.header?.title ?? void 0,
|
|
1873
1875
|
hasPanels: f.length > 0,
|
|
1874
1876
|
isPanelOpen: o.isPanelOpen,
|
|
@@ -1882,27 +1884,27 @@ function Xt(t, e, o, n) {
|
|
|
1882
1884
|
}, d = {
|
|
1883
1885
|
position: e?.toolPanel?.position ?? "right",
|
|
1884
1886
|
isPanelOpen: o.isPanelOpen,
|
|
1885
|
-
expandIcon:
|
|
1886
|
-
collapseIcon:
|
|
1887
|
+
expandIcon: a,
|
|
1888
|
+
collapseIcon: c,
|
|
1887
1889
|
panels: f.map((C) => ({
|
|
1888
1890
|
id: C.id,
|
|
1889
1891
|
title: C.title,
|
|
1890
|
-
icon:
|
|
1892
|
+
icon: N(C.icon),
|
|
1891
1893
|
isExpanded: o.expandedSections.has(C.id)
|
|
1892
1894
|
}))
|
|
1893
|
-
}, w =
|
|
1895
|
+
}, w = qt(g), b = Wt(d), S = Ae({
|
|
1894
1896
|
hasShell: !0,
|
|
1895
1897
|
shellHeader: w,
|
|
1896
|
-
shellBody:
|
|
1898
|
+
shellBody: b
|
|
1897
1899
|
});
|
|
1898
1900
|
t.appendChild(S);
|
|
1899
1901
|
} else {
|
|
1900
|
-
const l =
|
|
1902
|
+
const l = Ae({ hasShell: !1 });
|
|
1901
1903
|
t.appendChild(l);
|
|
1902
1904
|
}
|
|
1903
1905
|
return i;
|
|
1904
1906
|
}
|
|
1905
|
-
function
|
|
1907
|
+
function jt() {
|
|
1906
1908
|
return {
|
|
1907
1909
|
startY: null,
|
|
1908
1910
|
startX: null,
|
|
@@ -1916,39 +1918,39 @@ function Yt() {
|
|
|
1916
1918
|
momentumRaf: 0
|
|
1917
1919
|
};
|
|
1918
1920
|
}
|
|
1919
|
-
function
|
|
1921
|
+
function Kt(t) {
|
|
1920
1922
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
1921
1923
|
}
|
|
1922
|
-
function
|
|
1924
|
+
function Ke(t) {
|
|
1923
1925
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
1924
1926
|
}
|
|
1925
|
-
function
|
|
1927
|
+
function Qt(t, e, o) {
|
|
1926
1928
|
if (t.touches.length !== 1) return;
|
|
1927
|
-
|
|
1929
|
+
Ke(e);
|
|
1928
1930
|
const n = t.touches[0];
|
|
1929
1931
|
e.startY = n.clientY, e.startX = n.clientX, e.lastY = n.clientY, e.lastX = n.clientX, e.lastTime = performance.now(), e.scrollTop = o.fauxScrollbar.scrollTop, e.scrollLeft = o.scrollArea?.scrollLeft ?? 0, e.velocityY = 0, e.velocityX = 0;
|
|
1930
1932
|
}
|
|
1931
1933
|
function Zt(t, e, o) {
|
|
1932
1934
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
1933
1935
|
return !1;
|
|
1934
|
-
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i,
|
|
1936
|
+
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i, a = e.startX - r;
|
|
1935
1937
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
1936
1938
|
const d = s - e.lastTime;
|
|
1937
1939
|
d > 0 && (e.velocityY = (e.lastY - i) / d, e.velocityX = (e.lastX - r) / d);
|
|
1938
1940
|
}
|
|
1939
1941
|
e.lastY = i, e.lastX = r, e.lastTime = s;
|
|
1940
|
-
const { scrollTop:
|
|
1942
|
+
const { scrollTop: c, scrollHeight: h, clientHeight: u } = o.fauxScrollbar, p = h - u, f = l > 0 && c < p || l < 0 && c > 0;
|
|
1941
1943
|
let g = !1;
|
|
1942
1944
|
if (o.scrollArea) {
|
|
1943
|
-
const { scrollLeft: d, scrollWidth: w, clientWidth:
|
|
1944
|
-
g =
|
|
1945
|
+
const { scrollLeft: d, scrollWidth: w, clientWidth: b } = o.scrollArea, S = w - b;
|
|
1946
|
+
g = a > 0 && d < S || a < 0 && d > 0;
|
|
1945
1947
|
}
|
|
1946
|
-
return f && (o.fauxScrollbar.scrollTop = e.scrollTop + l), g && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft +
|
|
1948
|
+
return f && (o.fauxScrollbar.scrollTop = e.scrollTop + l), g && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + a), f || g;
|
|
1947
1949
|
}
|
|
1948
1950
|
function Jt(t, e) {
|
|
1949
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) &&
|
|
1951
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && eo(t, e), Kt(t);
|
|
1950
1952
|
}
|
|
1951
|
-
function
|
|
1953
|
+
function eo(t, e) {
|
|
1952
1954
|
const i = () => {
|
|
1953
1955
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
1954
1956
|
const r = t.velocityY * 16, s = t.velocityX * 16;
|
|
@@ -1956,8 +1958,8 @@ function Qt(t, e) {
|
|
|
1956
1958
|
};
|
|
1957
1959
|
t.momentumRaf = requestAnimationFrame(i);
|
|
1958
1960
|
}
|
|
1959
|
-
function
|
|
1960
|
-
t.addEventListener("touchstart", (i) =>
|
|
1961
|
+
function to(t, e, o, n) {
|
|
1962
|
+
t.addEventListener("touchstart", (i) => Qt(i, e, o), {
|
|
1961
1963
|
passive: !0,
|
|
1962
1964
|
signal: n
|
|
1963
1965
|
}), t.addEventListener(
|
|
@@ -1968,7 +1970,7 @@ function eo(t, e, o, n) {
|
|
|
1968
1970
|
{ passive: !1, signal: n }
|
|
1969
1971
|
), t.addEventListener("touchend", () => Jt(e, o), { passive: !0, signal: n });
|
|
1970
1972
|
}
|
|
1971
|
-
const
|
|
1973
|
+
const oo = [
|
|
1972
1974
|
{
|
|
1973
1975
|
property: "editable",
|
|
1974
1976
|
pluginName: "editing",
|
|
@@ -2006,7 +2008,7 @@ const to = [
|
|
|
2006
2008
|
importHint: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
|
|
2007
2009
|
isUsed: (t) => t === "left" || t === "right"
|
|
2008
2010
|
}
|
|
2009
|
-
],
|
|
2011
|
+
], no = [
|
|
2010
2012
|
{
|
|
2011
2013
|
property: "columnGroups",
|
|
2012
2014
|
pluginName: "groupingColumns",
|
|
@@ -2015,7 +2017,7 @@ const to = [
|
|
|
2015
2017
|
importHint: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';",
|
|
2016
2018
|
isUsed: (t) => Array.isArray(t) && t.length > 0
|
|
2017
2019
|
}
|
|
2018
|
-
],
|
|
2020
|
+
], io = {
|
|
2019
2021
|
editing: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
|
|
2020
2022
|
selection: "import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';",
|
|
2021
2023
|
reorder: "import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder';",
|
|
@@ -2036,10 +2038,10 @@ const to = [
|
|
|
2036
2038
|
serverSide: "import { ServerSidePlugin } from '@toolbox-web/grid/plugins/server-side';",
|
|
2037
2039
|
columnVirtualization: "import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';"
|
|
2038
2040
|
};
|
|
2039
|
-
function
|
|
2040
|
-
return
|
|
2041
|
+
function ue(t) {
|
|
2042
|
+
return io[t] ?? `import { ${D(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
|
|
2041
2043
|
}
|
|
2042
|
-
function
|
|
2044
|
+
function Qe() {
|
|
2043
2045
|
if (typeof window < "u" && window.location) {
|
|
2044
2046
|
const t = window.location.hostname;
|
|
2045
2047
|
if (t === "localhost" || t === "127.0.0.1" || t === "::1")
|
|
@@ -2050,47 +2052,47 @@ function Ke() {
|
|
|
2050
2052
|
function D(t) {
|
|
2051
2053
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2052
2054
|
}
|
|
2053
|
-
function
|
|
2055
|
+
function De(t, e) {
|
|
2054
2056
|
return t.some((o) => o.name === e);
|
|
2055
2057
|
}
|
|
2056
|
-
function
|
|
2057
|
-
const o =
|
|
2058
|
-
function r(l,
|
|
2059
|
-
i.has(l) || i.set(l, { description:
|
|
2058
|
+
function ro(t, e) {
|
|
2059
|
+
const o = oo, n = no, i = /* @__PURE__ */ new Map();
|
|
2060
|
+
function r(l, a, c, h, u = !1) {
|
|
2061
|
+
i.has(l) || i.set(l, { description: a, importHint: c, fields: [], isConfigProperty: u });
|
|
2060
2062
|
const p = i.get(l);
|
|
2061
2063
|
p.fields.includes(h) || p.fields.push(h);
|
|
2062
2064
|
}
|
|
2063
2065
|
for (const l of n) {
|
|
2064
|
-
const
|
|
2065
|
-
(l.isUsed ? l.isUsed(
|
|
2066
|
+
const a = t[l.property];
|
|
2067
|
+
(l.isUsed ? l.isUsed(a) : a !== void 0) && !De(e, l.pluginName) && r(l.pluginName, l.description, l.importHint ?? ue(l.pluginName), l.property, !0);
|
|
2066
2068
|
}
|
|
2067
2069
|
const s = t.columns;
|
|
2068
2070
|
if (s && s.length > 0)
|
|
2069
2071
|
for (const l of s)
|
|
2070
|
-
for (const
|
|
2071
|
-
const
|
|
2072
|
-
if ((
|
|
2072
|
+
for (const a of o) {
|
|
2073
|
+
const c = l[a.property];
|
|
2074
|
+
if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !De(e, a.pluginName)) {
|
|
2073
2075
|
const u = l.field || "<unknown>";
|
|
2074
|
-
r(
|
|
2076
|
+
r(a.pluginName, a.description, a.importHint ?? ue(a.pluginName), u);
|
|
2075
2077
|
}
|
|
2076
2078
|
}
|
|
2077
2079
|
if (i.size > 0) {
|
|
2078
2080
|
const l = [];
|
|
2079
|
-
for (const [
|
|
2081
|
+
for (const [a, { description: c, importHint: h, fields: u, isConfigProperty: p }] of i)
|
|
2080
2082
|
if (p)
|
|
2081
2083
|
l.push(
|
|
2082
|
-
`Config uses ${
|
|
2084
|
+
`Config uses ${c}, but the required plugin is not loaded.
|
|
2083
2085
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2084
2086
|
${h}
|
|
2085
|
-
plugins: [new ${
|
|
2087
|
+
plugins: [new ${a.charAt(0).toUpperCase() + a.slice(1)}Plugin(), ...]`
|
|
2086
2088
|
);
|
|
2087
2089
|
else {
|
|
2088
2090
|
const f = u.slice(0, 3).join(", ") + (u.length > 3 ? `, ... (${u.length} total)` : "");
|
|
2089
2091
|
l.push(
|
|
2090
|
-
`Column(s) [${f}] use ${
|
|
2092
|
+
`Column(s) [${f}] use ${c}, but the required plugin is not loaded.
|
|
2091
2093
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2092
2094
|
${h}
|
|
2093
|
-
plugins: [new ${
|
|
2095
|
+
plugins: [new ${a.charAt(0).toUpperCase() + a.slice(1)}Plugin(), ...]`
|
|
2094
2096
|
);
|
|
2095
2097
|
}
|
|
2096
2098
|
throw new Error(
|
|
@@ -2104,7 +2106,7 @@ This validation helps catch misconfigurations early. The properties listed above
|
|
|
2104
2106
|
);
|
|
2105
2107
|
}
|
|
2106
2108
|
}
|
|
2107
|
-
function
|
|
2109
|
+
function so(t) {
|
|
2108
2110
|
const e = [], o = [];
|
|
2109
2111
|
for (const n of t) {
|
|
2110
2112
|
const r = n.constructor.manifest;
|
|
@@ -2112,12 +2114,12 @@ function ro(t) {
|
|
|
2112
2114
|
for (const s of r.configRules) {
|
|
2113
2115
|
const l = n.config;
|
|
2114
2116
|
if (s.check(l)) {
|
|
2115
|
-
const
|
|
2116
|
-
s.severity === "error" ? e.push(
|
|
2117
|
+
const c = `${`[tbw-grid:${D(n.name)}Plugin]`} Configuration warning: ${s.message}`;
|
|
2118
|
+
s.severity === "error" ? e.push(c) : o.push(c);
|
|
2117
2119
|
}
|
|
2118
2120
|
}
|
|
2119
2121
|
}
|
|
2120
|
-
if (o.length > 0 &&
|
|
2122
|
+
if (o.length > 0 && Qe())
|
|
2121
2123
|
for (const n of o)
|
|
2122
2124
|
console.warn(n);
|
|
2123
2125
|
if (e.length > 0)
|
|
@@ -2127,12 +2129,12 @@ ${e.join(`
|
|
|
2127
2129
|
|
|
2128
2130
|
`)}`);
|
|
2129
2131
|
}
|
|
2130
|
-
function
|
|
2132
|
+
function lo(t, e) {
|
|
2131
2133
|
const o = t.name, i = t.constructor.dependencies ?? [];
|
|
2132
2134
|
for (const r of i) {
|
|
2133
|
-
const s = r.name, l = r.required ?? !0,
|
|
2135
|
+
const s = r.name, l = r.required ?? !0, a = r.reason;
|
|
2134
2136
|
if (!e.some((h) => h.name === s)) {
|
|
2135
|
-
const h =
|
|
2137
|
+
const h = a ?? `${D(o)}Plugin requires ${D(s)}Plugin`, u = ue(s);
|
|
2136
2138
|
if (l)
|
|
2137
2139
|
throw new Error(
|
|
2138
2140
|
`[tbw-grid] Plugin dependency error:
|
|
@@ -2149,8 +2151,8 @@ ${h}.
|
|
|
2149
2151
|
}
|
|
2150
2152
|
}
|
|
2151
2153
|
}
|
|
2152
|
-
function
|
|
2153
|
-
if (!
|
|
2154
|
+
function ao(t) {
|
|
2155
|
+
if (!Qe()) return;
|
|
2154
2156
|
const e = new Set(t.map((n) => n.name)), o = /* @__PURE__ */ new Set();
|
|
2155
2157
|
for (const n of t) {
|
|
2156
2158
|
const r = n.constructor.manifest;
|
|
@@ -2172,7 +2174,7 @@ ${D(n.name)}Plugin and ${D(s.name)}Plugin are both loaded, but they are currentl
|
|
|
2172
2174
|
}
|
|
2173
2175
|
}
|
|
2174
2176
|
}
|
|
2175
|
-
class
|
|
2177
|
+
class co {
|
|
2176
2178
|
constructor(e) {
|
|
2177
2179
|
this.grid = e;
|
|
2178
2180
|
}
|
|
@@ -2184,12 +2186,14 @@ class ao {
|
|
|
2184
2186
|
cellRenderers = /* @__PURE__ */ new Map();
|
|
2185
2187
|
headerRenderers = /* @__PURE__ */ new Map();
|
|
2186
2188
|
cellEditors = /* @__PURE__ */ new Map();
|
|
2189
|
+
eventListeners = /* @__PURE__ */ new Map();
|
|
2190
|
+
queryHandlers = /* @__PURE__ */ new Map();
|
|
2187
2191
|
attachAll(e) {
|
|
2188
2192
|
for (const o of e)
|
|
2189
2193
|
this.attach(o);
|
|
2190
2194
|
}
|
|
2191
2195
|
attach(e) {
|
|
2192
|
-
if (
|
|
2196
|
+
if (lo(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
|
|
2193
2197
|
for (const [o, n] of Object.entries(e.cellRenderers))
|
|
2194
2198
|
this.cellRenderers.set(o, n);
|
|
2195
2199
|
if (e.headerRenderers)
|
|
@@ -2198,17 +2202,31 @@ class ao {
|
|
|
2198
2202
|
if (e.cellEditors)
|
|
2199
2203
|
for (const [o, n] of Object.entries(e.cellEditors))
|
|
2200
2204
|
this.cellEditors.set(o, n);
|
|
2201
|
-
e.attach(this.grid);
|
|
2205
|
+
this.registerQueryHandlers(e), e.attach(this.grid);
|
|
2202
2206
|
for (const o of this.plugins)
|
|
2203
2207
|
o !== e && o.onPluginAttached && o.onPluginAttached(e.name, e);
|
|
2204
2208
|
}
|
|
2209
|
+
registerQueryHandlers(e) {
|
|
2210
|
+
const n = e.constructor.manifest;
|
|
2211
|
+
if (n?.queries)
|
|
2212
|
+
for (const i of n.queries) {
|
|
2213
|
+
let r = this.queryHandlers.get(i.type);
|
|
2214
|
+
r || (r = /* @__PURE__ */ new Set(), this.queryHandlers.set(i.type, r)), r.add(e);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
unregisterQueryHandlers(e) {
|
|
2218
|
+
for (const [o, n] of this.queryHandlers)
|
|
2219
|
+
n.delete(e), n.size === 0 && this.queryHandlers.delete(o);
|
|
2220
|
+
}
|
|
2205
2221
|
detachAll() {
|
|
2206
2222
|
for (const e of this.plugins)
|
|
2207
2223
|
for (const o of this.plugins)
|
|
2208
2224
|
o !== e && o.onPluginDetached && o.onPluginDetached(e.name);
|
|
2209
|
-
for (let e = this.plugins.length - 1; e >= 0; e--)
|
|
2210
|
-
this.plugins[e]
|
|
2211
|
-
|
|
2225
|
+
for (let e = this.plugins.length - 1; e >= 0; e--) {
|
|
2226
|
+
const o = this.plugins[e];
|
|
2227
|
+
this.unsubscribeAll(o), this.unregisterQueryHandlers(o), o.detach();
|
|
2228
|
+
}
|
|
2229
|
+
this.plugins = [], this.pluginMap.clear(), this.cellRenderers.clear(), this.headerRenderers.clear(), this.cellEditors.clear(), this.eventListeners.clear(), this.queryHandlers.clear();
|
|
2212
2230
|
}
|
|
2213
2231
|
getPlugin(e) {
|
|
2214
2232
|
return this.pluginMap.get(e);
|
|
@@ -2309,13 +2327,42 @@ class ao {
|
|
|
2309
2327
|
return !1;
|
|
2310
2328
|
}
|
|
2311
2329
|
queryPlugins(e) {
|
|
2312
|
-
const o = [];
|
|
2313
|
-
|
|
2314
|
-
const i
|
|
2315
|
-
|
|
2330
|
+
const o = [], n = this.queryHandlers.get(e.type);
|
|
2331
|
+
if (n && n.size > 0) {
|
|
2332
|
+
for (const i of n) {
|
|
2333
|
+
const r = i.handleQuery?.(e) ?? i.onPluginQuery?.(e);
|
|
2334
|
+
r !== void 0 && o.push(r);
|
|
2335
|
+
}
|
|
2336
|
+
return o;
|
|
2337
|
+
}
|
|
2338
|
+
for (const i of this.plugins) {
|
|
2339
|
+
const r = i.handleQuery?.(e) ?? i.onPluginQuery?.(e);
|
|
2340
|
+
r !== void 0 && o.push(r);
|
|
2316
2341
|
}
|
|
2317
2342
|
return o;
|
|
2318
2343
|
}
|
|
2344
|
+
subscribe(e, o, n) {
|
|
2345
|
+
let i = this.eventListeners.get(o);
|
|
2346
|
+
i || (i = /* @__PURE__ */ new Map(), this.eventListeners.set(o, i)), i.set(e, n);
|
|
2347
|
+
}
|
|
2348
|
+
unsubscribe(e, o) {
|
|
2349
|
+
const n = this.eventListeners.get(o);
|
|
2350
|
+
n && (n.delete(e), n.size === 0 && this.eventListeners.delete(o));
|
|
2351
|
+
}
|
|
2352
|
+
unsubscribeAll(e) {
|
|
2353
|
+
for (const [o, n] of this.eventListeners)
|
|
2354
|
+
n.delete(e), n.size === 0 && this.eventListeners.delete(o);
|
|
2355
|
+
}
|
|
2356
|
+
emitPluginEvent(e, o) {
|
|
2357
|
+
const n = this.eventListeners.get(e);
|
|
2358
|
+
if (n)
|
|
2359
|
+
for (const i of n.values())
|
|
2360
|
+
try {
|
|
2361
|
+
i(o);
|
|
2362
|
+
} catch (r) {
|
|
2363
|
+
console.error(`[tbw-grid] Error in plugin event handler for "${e}":`, r);
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2319
2366
|
onKeyDown(e) {
|
|
2320
2367
|
for (const o of this.plugins)
|
|
2321
2368
|
if (o.onKeyDown?.(e))
|
|
@@ -2389,7 +2436,7 @@ class ao {
|
|
|
2389
2436
|
}
|
|
2390
2437
|
class L extends HTMLElement {
|
|
2391
2438
|
static tagName = "tbw-grid";
|
|
2392
|
-
static version = "1.
|
|
2439
|
+
static version = "1.8.0";
|
|
2393
2440
|
static #l = 0;
|
|
2394
2441
|
static adapters = [];
|
|
2395
2442
|
static registerAdapter(e) {
|
|
@@ -2402,7 +2449,7 @@ class L extends HTMLElement {
|
|
|
2402
2449
|
this.adapters = [];
|
|
2403
2450
|
}
|
|
2404
2451
|
static get observedAttributes() {
|
|
2405
|
-
return ["rows", "columns", "grid-config", "fit-mode"];
|
|
2452
|
+
return ["rows", "columns", "grid-config", "fit-mode", "loading"];
|
|
2406
2453
|
}
|
|
2407
2454
|
get #i() {
|
|
2408
2455
|
return this;
|
|
@@ -2416,7 +2463,7 @@ class L extends HTMLElement {
|
|
|
2416
2463
|
}
|
|
2417
2464
|
#f = !1;
|
|
2418
2465
|
#g = !1;
|
|
2419
|
-
#
|
|
2466
|
+
#m = {
|
|
2420
2467
|
rows: !1,
|
|
2421
2468
|
columns: !1,
|
|
2422
2469
|
gridConfig: !1,
|
|
@@ -2425,14 +2472,14 @@ class L extends HTMLElement {
|
|
|
2425
2472
|
#s;
|
|
2426
2473
|
#v = 0;
|
|
2427
2474
|
#r = null;
|
|
2428
|
-
#
|
|
2429
|
-
#
|
|
2430
|
-
#
|
|
2475
|
+
#b = !1;
|
|
2476
|
+
#R;
|
|
2477
|
+
#H = jt();
|
|
2431
2478
|
#w;
|
|
2432
2479
|
#C;
|
|
2433
2480
|
#y;
|
|
2434
2481
|
#p;
|
|
2435
|
-
#
|
|
2482
|
+
#pe = {
|
|
2436
2483
|
scrollTop: 0,
|
|
2437
2484
|
scrollLeft: 0,
|
|
2438
2485
|
scrollHeight: 0,
|
|
@@ -2442,16 +2489,20 @@ class L extends HTMLElement {
|
|
|
2442
2489
|
};
|
|
2443
2490
|
#o;
|
|
2444
2491
|
#_;
|
|
2445
|
-
#
|
|
2446
|
-
#
|
|
2447
|
-
#
|
|
2492
|
+
#z = !1;
|
|
2493
|
+
#O;
|
|
2494
|
+
#D;
|
|
2448
2495
|
#t;
|
|
2449
|
-
#e =
|
|
2496
|
+
#e = $t();
|
|
2450
2497
|
#c;
|
|
2451
|
-
#
|
|
2452
|
-
#
|
|
2498
|
+
#M;
|
|
2499
|
+
#k = !1;
|
|
2500
|
+
#x = /* @__PURE__ */ new Set();
|
|
2501
|
+
#T = /* @__PURE__ */ new Map();
|
|
2502
|
+
#N;
|
|
2503
|
+
#E = /* @__PURE__ */ new Map();
|
|
2453
2504
|
_rows = [];
|
|
2454
|
-
#
|
|
2505
|
+
#F = [];
|
|
2455
2506
|
get _columns() {
|
|
2456
2507
|
return this.#n.columns ?? [];
|
|
2457
2508
|
}
|
|
@@ -2502,7 +2553,7 @@ class L extends HTMLElement {
|
|
|
2502
2553
|
}
|
|
2503
2554
|
set rows(e) {
|
|
2504
2555
|
const o = this.#a;
|
|
2505
|
-
this.#a = e, o !== e && this
|
|
2556
|
+
this.#a = e, o !== e && this.#$("rows");
|
|
2506
2557
|
}
|
|
2507
2558
|
get sourceRows() {
|
|
2508
2559
|
return this.#a;
|
|
@@ -2512,21 +2563,53 @@ class L extends HTMLElement {
|
|
|
2512
2563
|
}
|
|
2513
2564
|
set columns(e) {
|
|
2514
2565
|
const o = this.#t?.getColumns();
|
|
2515
|
-
this.#t?.setColumns(e), o !== e && this
|
|
2566
|
+
this.#t?.setColumns(e), o !== e && this.#$("columns");
|
|
2516
2567
|
}
|
|
2517
2568
|
get gridConfig() {
|
|
2518
2569
|
return this.#n;
|
|
2519
2570
|
}
|
|
2520
2571
|
set gridConfig(e) {
|
|
2521
2572
|
const o = this.#t?.getGridConfig();
|
|
2522
|
-
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this
|
|
2573
|
+
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this.#$("gridConfig"));
|
|
2523
2574
|
}
|
|
2524
2575
|
get fitMode() {
|
|
2525
2576
|
return this.#n.fitMode ?? "stretch";
|
|
2526
2577
|
}
|
|
2527
2578
|
set fitMode(e) {
|
|
2528
2579
|
const o = this.#t?.getFitMode();
|
|
2529
|
-
this.#t?.setFitMode(e), o !== e && this
|
|
2580
|
+
this.#t?.setFitMode(e), o !== e && this.#$("fitMode");
|
|
2581
|
+
}
|
|
2582
|
+
get loading() {
|
|
2583
|
+
return this.#k;
|
|
2584
|
+
}
|
|
2585
|
+
set loading(e) {
|
|
2586
|
+
const o = this.#k;
|
|
2587
|
+
this.#k = e, e ? this.setAttribute("loading", "") : this.removeAttribute("loading"), o !== e && this.#Oe();
|
|
2588
|
+
}
|
|
2589
|
+
setRowLoading(e, o) {
|
|
2590
|
+
const n = this.#x.has(e);
|
|
2591
|
+
o ? this.#x.add(e) : this.#x.delete(e), n !== o && this.#he(e, o);
|
|
2592
|
+
}
|
|
2593
|
+
setCellLoading(e, o, n) {
|
|
2594
|
+
let i = this.#T.get(e);
|
|
2595
|
+
const r = i?.has(o) ?? !1;
|
|
2596
|
+
n ? (i || (i = /* @__PURE__ */ new Set(), this.#T.set(e, i)), i.add(o)) : (i?.delete(o), i?.size === 0 && this.#T.delete(e)), r !== n && this.#ue(e, o, n);
|
|
2597
|
+
}
|
|
2598
|
+
isRowLoading(e) {
|
|
2599
|
+
return this.#x.has(e);
|
|
2600
|
+
}
|
|
2601
|
+
isCellLoading(e, o) {
|
|
2602
|
+
return this.#T.get(e)?.has(o) ?? !1;
|
|
2603
|
+
}
|
|
2604
|
+
clearAllLoading() {
|
|
2605
|
+
this.loading = !1;
|
|
2606
|
+
for (const e of this.#x)
|
|
2607
|
+
this.#he(e, !1);
|
|
2608
|
+
this.#x.clear();
|
|
2609
|
+
for (const [e, o] of this.#T)
|
|
2610
|
+
for (const n of o)
|
|
2611
|
+
this.#ue(e, n, !1);
|
|
2612
|
+
this.#T.clear();
|
|
2530
2613
|
}
|
|
2531
2614
|
get effectiveConfig() {
|
|
2532
2615
|
return this.#n;
|
|
@@ -2535,29 +2618,29 @@ class L extends HTMLElement {
|
|
|
2535
2618
|
return this.#w || (this.#w = new AbortController()), this.#w.signal;
|
|
2536
2619
|
}
|
|
2537
2620
|
constructor() {
|
|
2538
|
-
super(), this.#
|
|
2621
|
+
super(), this.#we(), this.#d = new Promise((e) => this.#h = e), this.#s = new Ht({
|
|
2539
2622
|
mergeConfig: () => {
|
|
2540
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#
|
|
2623
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), ro(this.#n, this.#o?.getPlugins() ?? []), so(this.#o?.getPlugins() ?? []), ao(this.#o?.getPlugins() ?? []), this.#Pe(), this.#F = [...this._columns];
|
|
2541
2624
|
},
|
|
2542
|
-
processColumns: () => this.#
|
|
2543
|
-
processRows: () => this.#
|
|
2544
|
-
renderHeader: () =>
|
|
2625
|
+
processColumns: () => this.#xe(),
|
|
2626
|
+
processRows: () => this.#Te(),
|
|
2627
|
+
renderHeader: () => ne(this),
|
|
2545
2628
|
updateTemplate: () => B(this),
|
|
2546
2629
|
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2547
2630
|
afterRender: () => {
|
|
2548
|
-
this.#o?.afterRender(), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0,
|
|
2631
|
+
this.#o?.afterRender(), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, ve(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, $(this)), this._virtualization.enabled && !this.#W && this.#me();
|
|
2549
2632
|
},
|
|
2550
2633
|
isConnected: () => this.isConnected && this.#f
|
|
2551
|
-
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c =
|
|
2634
|
+
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = Gt(this.#e, {
|
|
2552
2635
|
getShadow: () => this.#i,
|
|
2553
2636
|
getShellConfig: () => this.#n?.shell,
|
|
2554
2637
|
getAccordionIcons: () => ({
|
|
2555
|
-
expand: this.#n?.icons?.expand ??
|
|
2556
|
-
collapse: this.#n?.icons?.collapse ??
|
|
2638
|
+
expand: this.#n?.icons?.expand ?? k.expand,
|
|
2639
|
+
collapse: this.#n?.icons?.collapse ?? k.collapse
|
|
2557
2640
|
}),
|
|
2558
|
-
emit: (e, o) => this.#
|
|
2641
|
+
emit: (e, o) => this.#P(e, o),
|
|
2559
2642
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2560
|
-
}), this.#t = new
|
|
2643
|
+
}), this.#t = new pt({
|
|
2561
2644
|
getRows: () => this.#a,
|
|
2562
2645
|
getSortState: () => this._sortState,
|
|
2563
2646
|
setSortState: (e) => {
|
|
@@ -2566,19 +2649,19 @@ class L extends HTMLElement {
|
|
|
2566
2649
|
onConfigChange: () => {
|
|
2567
2650
|
this.#s.requestPhase(A.FULL, "configChange");
|
|
2568
2651
|
},
|
|
2569
|
-
emit: (e, o) => this.#
|
|
2652
|
+
emit: (e, o) => this.#P(e, o),
|
|
2570
2653
|
clearRowPool: () => {
|
|
2571
2654
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
2572
2655
|
},
|
|
2573
|
-
setup: () => this.#
|
|
2574
|
-
renderHeader: () =>
|
|
2656
|
+
setup: () => this.#L(),
|
|
2657
|
+
renderHeader: () => ne(this),
|
|
2575
2658
|
updateTemplate: () => B(this),
|
|
2576
2659
|
refreshVirtualWindow: () => this.#s.requestPhase(A.VIRTUALIZATION, "configManager"),
|
|
2577
2660
|
getVirtualization: () => this._virtualization,
|
|
2578
2661
|
setRowHeight: (e) => {
|
|
2579
2662
|
this._virtualization.rowHeight = e;
|
|
2580
2663
|
},
|
|
2581
|
-
applyAnimationConfig: (e) => this.#
|
|
2664
|
+
applyAnimationConfig: (e) => this.#Ae(e),
|
|
2582
2665
|
getShellLightDomTitle: () => this.#e.lightDomTitle,
|
|
2583
2666
|
getShellToolPanels: () => this.#e.toolPanels,
|
|
2584
2667
|
getShellHeaderContents: () => this.#e.headerContents,
|
|
@@ -2587,25 +2670,25 @@ class L extends HTMLElement {
|
|
|
2587
2670
|
getShellHasToolButtonsContainer: () => this.#e.hasToolButtonsContainer
|
|
2588
2671
|
});
|
|
2589
2672
|
}
|
|
2590
|
-
static #
|
|
2591
|
-
static #
|
|
2592
|
-
static #
|
|
2593
|
-
static #
|
|
2594
|
-
let e = document.getElementById(this.#
|
|
2595
|
-
return e || (e = document.createElement("style"), e.id = this.#
|
|
2673
|
+
static #Z = "tbw-grid-styles";
|
|
2674
|
+
static #I = "";
|
|
2675
|
+
static #U = /* @__PURE__ */ new Map();
|
|
2676
|
+
static #ge() {
|
|
2677
|
+
let e = document.getElementById(this.#Z);
|
|
2678
|
+
return e || (e = document.createElement("style"), e.id = this.#Z, e.setAttribute("data-tbw-grid", "true"), document.head.appendChild(e)), e;
|
|
2596
2679
|
}
|
|
2597
|
-
static #
|
|
2598
|
-
const e = this.#
|
|
2680
|
+
static #V() {
|
|
2681
|
+
const e = this.#ge(), o = Array.from(this.#U.values()).join(`
|
|
2599
2682
|
`);
|
|
2600
|
-
e.textContent = `${this.#
|
|
2683
|
+
e.textContent = `${this.#I}
|
|
2601
2684
|
|
|
2602
2685
|
/* Plugin Styles */
|
|
2603
2686
|
${o}`;
|
|
2604
2687
|
}
|
|
2605
|
-
async #
|
|
2606
|
-
if (!L.#
|
|
2607
|
-
if (
|
|
2608
|
-
L.#
|
|
2688
|
+
async #we() {
|
|
2689
|
+
if (!L.#I) {
|
|
2690
|
+
if (we.length > 0) {
|
|
2691
|
+
L.#I = we, L.#V();
|
|
2609
2692
|
return;
|
|
2610
2693
|
}
|
|
2611
2694
|
await new Promise((e) => setTimeout(e, 50));
|
|
@@ -2622,7 +2705,7 @@ ${o}`;
|
|
|
2622
2705
|
} catch {
|
|
2623
2706
|
continue;
|
|
2624
2707
|
}
|
|
2625
|
-
e ? (L.#
|
|
2708
|
+
e ? (L.#I = e, L.#V()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
|
|
2626
2709
|
"[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
|
|
2627
2710
|
"Available stylesheets:",
|
|
2628
2711
|
Array.from(document.styleSheets).map((o) => o.href || "(inline)")
|
|
@@ -2650,19 +2733,19 @@ ${o}`;
|
|
|
2650
2733
|
requestAfterRender() {
|
|
2651
2734
|
this.#s.requestPhase(A.STYLE, "plugin:requestAfterRender");
|
|
2652
2735
|
}
|
|
2653
|
-
#
|
|
2654
|
-
this.#o = new
|
|
2736
|
+
#J() {
|
|
2737
|
+
this.#o = new co(this);
|
|
2655
2738
|
const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
|
|
2656
2739
|
this.#o.attachAll(o);
|
|
2657
2740
|
}
|
|
2658
|
-
#
|
|
2741
|
+
#q() {
|
|
2659
2742
|
const e = this.#o?.getPluginStyles() ?? [];
|
|
2660
2743
|
let o = !1;
|
|
2661
2744
|
for (const { name: n, styles: i } of e)
|
|
2662
|
-
L.#
|
|
2663
|
-
o && L.#
|
|
2745
|
+
L.#U.has(n) || (L.#U.set(n, i), o = !0);
|
|
2746
|
+
o && L.#V();
|
|
2664
2747
|
}
|
|
2665
|
-
#
|
|
2748
|
+
#ee() {
|
|
2666
2749
|
const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
|
|
2667
2750
|
if (this.#_ !== o) {
|
|
2668
2751
|
if (this.#_ && this.#_.length === o.length && this.#_.every((n, i) => n === o[i])) {
|
|
@@ -2681,13 +2764,13 @@ ${o}`;
|
|
|
2681
2764
|
const i = this.#e.headerContentCleanups.get(n);
|
|
2682
2765
|
i && (i(), this.#e.headerContentCleanups.delete(n)), this.#e.headerContents.delete(n);
|
|
2683
2766
|
}
|
|
2684
|
-
this.#
|
|
2767
|
+
this.#J(), this.#q(), this.#_ = o, this.#te(), this.#b = this.#o?.getAll().some((n) => n.onScroll) ?? !1;
|
|
2685
2768
|
}
|
|
2686
2769
|
}
|
|
2687
|
-
#
|
|
2770
|
+
#be() {
|
|
2688
2771
|
this.#o?.detachAll();
|
|
2689
2772
|
}
|
|
2690
|
-
#
|
|
2773
|
+
#te() {
|
|
2691
2774
|
if (!this.#o) return;
|
|
2692
2775
|
const e = this.#o.getToolPanels();
|
|
2693
2776
|
for (const { panel: n } of e)
|
|
@@ -2696,7 +2779,7 @@ ${o}`;
|
|
|
2696
2779
|
for (const { content: n } of o)
|
|
2697
2780
|
this.#e.headerContents.has(n.id) || this.#e.headerContents.set(n.id, n);
|
|
2698
2781
|
}
|
|
2699
|
-
#
|
|
2782
|
+
#A() {
|
|
2700
2783
|
const e = L.getAdapters();
|
|
2701
2784
|
if (e.length === 0 && !this.__frameworkAdapter) return;
|
|
2702
2785
|
const o = this.__frameworkAdapter;
|
|
@@ -2713,22 +2796,27 @@ ${o}`;
|
|
|
2713
2796
|
};
|
|
2714
2797
|
}
|
|
2715
2798
|
connectedCallback() {
|
|
2716
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this.id || (this.id = `tbw-grid-${++L.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#w && (this.#w.abort(), this.#
|
|
2799
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this.id || (this.id = `tbw-grid-${++L.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#w && (this.#w.abort(), this.#z = !1), this.#w = new AbortController(), this.#p && (xe(this.#p), this.#p = void 0), I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#J();
|
|
2717
2800
|
const e = this.#n?.plugins;
|
|
2718
|
-
this.#_ = Array.isArray(e) ? e : [], this.#
|
|
2801
|
+
this.#_ = Array.isArray(e) ? e : [], this.#te(), this.#u || (this.#K(), this.#q(), this.#u = !0), this.#oe(), this.#p = Lt(
|
|
2719
2802
|
() => {
|
|
2720
|
-
this.#
|
|
2803
|
+
this.#ke();
|
|
2721
2804
|
},
|
|
2722
2805
|
{ timeout: 100 }
|
|
2723
2806
|
);
|
|
2724
2807
|
}
|
|
2725
2808
|
disconnectedCallback() {
|
|
2726
|
-
this.#p && (
|
|
2809
|
+
this.#p && (xe(this.#p), this.#p = void 0), this.#be(), Bt(this.#e), this.#c.setInitialized(!1), this.#M?.(), this.#M = void 0, Ke(this.#H), this.#w && (this.#w.abort(), this.#w = void 0), this.#O?.abort(), this.#O = void 0, this.#z = !1, this._resizeController && this._resizeController.dispose(), this.#C && (this.#C.disconnect(), this.#C = void 0), this.#y && (this.#y.disconnect(), this.#y = void 0, this.#W = !1), j(this), this.#S.clear(), this.#_ = void 0;
|
|
2727
2810
|
for (const e of this._rowPool)
|
|
2728
2811
|
e.remove();
|
|
2729
2812
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
|
|
2730
2813
|
}
|
|
2731
2814
|
attributeChangedCallback(e, o, n) {
|
|
2815
|
+
if (e === "loading") {
|
|
2816
|
+
const i = n !== null && n !== "false";
|
|
2817
|
+
this.loading !== i && (this.loading = i);
|
|
2818
|
+
return;
|
|
2819
|
+
}
|
|
2732
2820
|
if (!(o === n || !n || n === "null" || n === "undefined"))
|
|
2733
2821
|
if (e === "rows" || e === "columns" || e === "grid-config")
|
|
2734
2822
|
try {
|
|
@@ -2739,22 +2827,22 @@ ${o}`;
|
|
|
2739
2827
|
}
|
|
2740
2828
|
else e === "fit-mode" && (this.fitMode = n);
|
|
2741
2829
|
}
|
|
2742
|
-
#
|
|
2830
|
+
#oe() {
|
|
2743
2831
|
const o = this.#i.querySelector(".tbw-grid-content") ?? this.#i.querySelector(".tbw-grid-root");
|
|
2744
2832
|
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
2745
|
-
|
|
2833
|
+
he(this.#i, this.#e), Le(this.#i, this.#n?.shell, this.#e);
|
|
2746
2834
|
const r = this.#n?.shell?.toolPanel?.defaultOpen;
|
|
2747
2835
|
r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
|
|
2748
2836
|
}
|
|
2749
|
-
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Te(this), this.#
|
|
2837
|
+
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Te(this), this.#L(), this.#ie(o), this.#z)
|
|
2750
2838
|
return;
|
|
2751
|
-
this.#
|
|
2839
|
+
this.#z = !0;
|
|
2752
2840
|
const n = this.disconnectSignal;
|
|
2753
|
-
|
|
2841
|
+
Rt(this, this, this.#i, n);
|
|
2754
2842
|
const i = this.#n.rowHeight;
|
|
2755
|
-
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#
|
|
2843
|
+
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#ne()), queueMicrotask(() => this.#ve()), this.#s.requestPhase(A.FULL, "afterConnect");
|
|
2756
2844
|
}
|
|
2757
|
-
#
|
|
2845
|
+
#ne() {
|
|
2758
2846
|
if (this.#o.hasExtraHeight())
|
|
2759
2847
|
return;
|
|
2760
2848
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
@@ -2768,23 +2856,23 @@ ${o}`;
|
|
|
2768
2856
|
const i = e.getBoundingClientRect(), r = Math.max(i.height, n);
|
|
2769
2857
|
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(A.VIRTUALIZATION, "measureRowHeight"));
|
|
2770
2858
|
}
|
|
2771
|
-
#
|
|
2772
|
-
this.#
|
|
2773
|
-
const o = this.#
|
|
2774
|
-
if (this._virtualization.container = n ?? this, this.#
|
|
2859
|
+
#ie(e) {
|
|
2860
|
+
this.#O?.abort(), this.#O = new AbortController();
|
|
2861
|
+
const o = this.#O.signal, n = e?.querySelector(".faux-vscroll"), i = e?.querySelector(".rows");
|
|
2862
|
+
if (this._virtualization.container = n ?? this, this.#b = this.#o?.getAll().some((r) => r.onScroll) ?? !1, n && i) {
|
|
2775
2863
|
n.addEventListener(
|
|
2776
2864
|
"scroll",
|
|
2777
2865
|
() => {
|
|
2778
|
-
if (!this._virtualization.enabled && !this.#
|
|
2779
|
-
const l = n.scrollTop,
|
|
2866
|
+
if (!this._virtualization.enabled && !this.#b) return;
|
|
2867
|
+
const l = n.scrollTop, a = this._virtualization.rowHeight;
|
|
2780
2868
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
2781
2869
|
i.style.transform = `translateY(${-l}px)`;
|
|
2782
2870
|
else {
|
|
2783
|
-
const
|
|
2871
|
+
const c = Math.floor(l / a), h = c - c % 2, u = -(l - h * a);
|
|
2784
2872
|
i.style.transform = `translateY(${u}px)`;
|
|
2785
2873
|
}
|
|
2786
2874
|
this.#r = l, this.#v || (this.#v = requestAnimationFrame(() => {
|
|
2787
|
-
this.#v = 0, this.#r !== null && (this.#
|
|
2875
|
+
this.#v = 0, this.#r !== null && (this.#De(this.#r), this.#r = null);
|
|
2788
2876
|
}));
|
|
2789
2877
|
},
|
|
2790
2878
|
{ passive: !0, signal: o }
|
|
@@ -2793,19 +2881,19 @@ ${o}`;
|
|
|
2793
2881
|
r && (r.addEventListener(
|
|
2794
2882
|
"wheel",
|
|
2795
2883
|
(l) => {
|
|
2796
|
-
const
|
|
2797
|
-
if (
|
|
2798
|
-
const
|
|
2799
|
-
(
|
|
2800
|
-
} else if (!
|
|
2801
|
-
const { scrollTop:
|
|
2802
|
-
(l.deltaY > 0 &&
|
|
2884
|
+
const a = l.shiftKey || Math.abs(l.deltaX) > Math.abs(l.deltaY);
|
|
2885
|
+
if (a && s) {
|
|
2886
|
+
const c = l.shiftKey ? l.deltaY : l.deltaX, { scrollLeft: h, scrollWidth: u, clientWidth: p } = s;
|
|
2887
|
+
(c > 0 && h < u - p || c < 0 && h > 0) && (l.preventDefault(), s.scrollLeft += c);
|
|
2888
|
+
} else if (!a) {
|
|
2889
|
+
const { scrollTop: c, scrollHeight: h, clientHeight: u } = n;
|
|
2890
|
+
(l.deltaY > 0 && c < h - u || l.deltaY < 0 && c > 0) && (l.preventDefault(), n.scrollTop += l.deltaY);
|
|
2803
2891
|
}
|
|
2804
2892
|
},
|
|
2805
2893
|
{ passive: !1, signal: o }
|
|
2806
|
-
),
|
|
2894
|
+
), to(r, this.#H, { fauxScrollbar: n, scrollArea: s }, o));
|
|
2807
2895
|
}
|
|
2808
|
-
this._bodyEl &&
|
|
2896
|
+
this._bodyEl && St(this, this._bodyEl, o), this.#C?.disconnect(), this._virtualization.viewportEl && (this.#C = new ResizeObserver(() => {
|
|
2809
2897
|
this.#s.requestPhase(A.VIRTUALIZATION, "resize-observer");
|
|
2810
2898
|
}), this.#C.observe(this._virtualization.viewportEl)), this.#i.addEventListener(
|
|
2811
2899
|
"focusin",
|
|
@@ -2822,18 +2910,18 @@ ${o}`;
|
|
|
2822
2910
|
{ signal: o }
|
|
2823
2911
|
);
|
|
2824
2912
|
}
|
|
2825
|
-
#
|
|
2826
|
-
#
|
|
2827
|
-
if (this.#
|
|
2913
|
+
#W = !1;
|
|
2914
|
+
#me() {
|
|
2915
|
+
if (this.#W) return;
|
|
2828
2916
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2829
|
-
e && (this.#
|
|
2830
|
-
this.#
|
|
2917
|
+
e && (this.#W = !0, this.#y?.disconnect(), this.#y = new ResizeObserver(() => {
|
|
2918
|
+
this.#ne();
|
|
2831
2919
|
}), this.#y.observe(e));
|
|
2832
2920
|
}
|
|
2833
|
-
#
|
|
2921
|
+
#P(e, o) {
|
|
2834
2922
|
this.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0, composed: !0 }));
|
|
2835
2923
|
}
|
|
2836
|
-
#
|
|
2924
|
+
#ve() {
|
|
2837
2925
|
this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((o, n) => {
|
|
2838
2926
|
const i = n === this._focusRow;
|
|
2839
2927
|
o.setAttribute("aria-selected", String(i)), o.querySelectorAll(".cell").forEach((r, s) => {
|
|
@@ -2841,81 +2929,81 @@ ${o}`;
|
|
|
2841
2929
|
});
|
|
2842
2930
|
});
|
|
2843
2931
|
}
|
|
2844
|
-
|
|
2845
|
-
this.#
|
|
2932
|
+
#$(e) {
|
|
2933
|
+
this.#m[e] = !0, !this.#g && (this.#g = !0, queueMicrotask(() => this.#Ce()));
|
|
2846
2934
|
}
|
|
2847
|
-
#
|
|
2935
|
+
#Ce() {
|
|
2848
2936
|
if (!this.#g || !this.#f) {
|
|
2849
2937
|
this.#g = !1;
|
|
2850
2938
|
return;
|
|
2851
2939
|
}
|
|
2852
|
-
const e = this.#
|
|
2853
|
-
if (this.#g = !1, this.#
|
|
2940
|
+
const e = this.#m;
|
|
2941
|
+
if (this.#g = !1, this.#m = {
|
|
2854
2942
|
rows: !1,
|
|
2855
2943
|
columns: !1,
|
|
2856
2944
|
gridConfig: !1,
|
|
2857
2945
|
fitMode: !1
|
|
2858
2946
|
}, e.gridConfig) {
|
|
2859
|
-
this.#
|
|
2947
|
+
this.#Se(), e.rows && this.#re();
|
|
2860
2948
|
return;
|
|
2861
2949
|
}
|
|
2862
|
-
e.columns && this.#
|
|
2950
|
+
e.columns && this.#_e(), e.rows && this.#re(), e.fitMode && this.#Ee();
|
|
2863
2951
|
}
|
|
2864
|
-
#
|
|
2865
|
-
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this
|
|
2952
|
+
#re() {
|
|
2953
|
+
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#B(), this.#s.requestPhase(A.ROWS, "applyRowsUpdate");
|
|
2866
2954
|
}
|
|
2867
|
-
|
|
2868
|
-
this.#
|
|
2955
|
+
#B() {
|
|
2956
|
+
this.#E.clear();
|
|
2869
2957
|
const e = this.#n.getRowId;
|
|
2870
2958
|
this._rows.forEach((o, n) => {
|
|
2871
|
-
const i = this.#
|
|
2872
|
-
i !== void 0 && this.#
|
|
2959
|
+
const i = this.#se(o, e);
|
|
2960
|
+
i !== void 0 && this.#E.set(i, { row: o, index: n });
|
|
2873
2961
|
});
|
|
2874
2962
|
}
|
|
2875
|
-
#
|
|
2963
|
+
#se(e, o) {
|
|
2876
2964
|
if (o)
|
|
2877
2965
|
return o(e);
|
|
2878
2966
|
const n = e;
|
|
2879
2967
|
if ("id" in n && n.id != null) return String(n.id);
|
|
2880
2968
|
if ("_id" in n && n._id != null) return String(n._id);
|
|
2881
2969
|
}
|
|
2882
|
-
#
|
|
2883
|
-
const n = this.#
|
|
2970
|
+
#ye(e, o) {
|
|
2971
|
+
const n = this.#se(e, o);
|
|
2884
2972
|
if (n === void 0)
|
|
2885
2973
|
throw new Error(
|
|
2886
2974
|
'[tbw-grid] Cannot determine row ID. Configure getRowId in gridConfig or ensure rows have an "id" property.'
|
|
2887
2975
|
);
|
|
2888
2976
|
return n;
|
|
2889
2977
|
}
|
|
2890
|
-
#
|
|
2891
|
-
j(this), this.#t.merge(), this.#
|
|
2978
|
+
#_e() {
|
|
2979
|
+
j(this), this.#t.merge(), this.#L();
|
|
2892
2980
|
}
|
|
2893
|
-
#
|
|
2894
|
-
this.#t.merge(), this.#n.fitMode === "fixed" ? (this.__didInitialAutoSize = !1,
|
|
2981
|
+
#Ee() {
|
|
2982
|
+
this.#t.merge(), this.#n.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, ve(this)) : (this._columns.forEach((o) => {
|
|
2895
2983
|
!o.__userResized && o.__autoSized && delete o.width;
|
|
2896
2984
|
}), B(this));
|
|
2897
2985
|
}
|
|
2898
|
-
#
|
|
2986
|
+
#Se() {
|
|
2899
2987
|
I(this, this.#e), q(this, this.#e);
|
|
2900
2988
|
const e = !!this.#i.querySelector(".has-shell"), o = !!this.#i.querySelector(".tbw-tool-panel"), n = this.#i.querySelectorAll(".tbw-accordion-section").length;
|
|
2901
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#
|
|
2902
|
-
const i =
|
|
2989
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), W(this, this.#e, this.#A()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
2990
|
+
const i = je(this.#n?.shell), r = (this.#n?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#n?.shell?.toolPanels?.length ?? 0) !== n;
|
|
2903
2991
|
if (e !== i || !e && i || !o && r || o && s) {
|
|
2904
|
-
this.#
|
|
2992
|
+
this.#K(), this.#q(), this.#oe(), this.#B();
|
|
2905
2993
|
return;
|
|
2906
2994
|
}
|
|
2907
|
-
e && this.#
|
|
2995
|
+
e && this.#Re(), this.#B(), this.#s.requestPhase(A.COLUMNS, "applyGridConfigUpdate");
|
|
2908
2996
|
}
|
|
2909
|
-
#
|
|
2997
|
+
#Re() {
|
|
2910
2998
|
const e = this.#i.querySelector(".tbw-shell-header");
|
|
2911
2999
|
if (!e) return;
|
|
2912
3000
|
const o = this.#n.shell?.header?.title ?? this.#e.lightDomTitle;
|
|
2913
3001
|
let n = e.querySelector(".tbw-shell-title");
|
|
2914
3002
|
o ? (n || (n = document.createElement("h2"), n.className = "tbw-shell-title", n.setAttribute("part", "shell-title"), e.insertBefore(n, e.firstChild)), n.textContent = o) : n && n.remove();
|
|
2915
3003
|
}
|
|
2916
|
-
#
|
|
3004
|
+
#xe() {
|
|
2917
3005
|
if (this.#o) {
|
|
2918
|
-
const e = this.#
|
|
3006
|
+
const e = this.#F.length > 0 ? this.#F : this._columns, o = e.filter((r) => !r.hidden), n = e.filter((r) => r.hidden), i = this.#o.processColumns([...o]);
|
|
2919
3007
|
if (i !== o) {
|
|
2920
3008
|
new Set(o.map((l) => l.field));
|
|
2921
3009
|
const r = new Set(i.map((l) => l.field));
|
|
@@ -2924,12 +3012,12 @@ ${o}`;
|
|
|
2924
3012
|
this._columns = [...e];
|
|
2925
3013
|
}
|
|
2926
3014
|
}
|
|
2927
|
-
#
|
|
3015
|
+
#Te() {
|
|
2928
3016
|
j(this);
|
|
2929
3017
|
const e = Array.isArray(this.#a) ? [...this.#a] : [], o = this.#o?.processRows(e) ?? e;
|
|
2930
3018
|
this._rows = o;
|
|
2931
3019
|
}
|
|
2932
|
-
#
|
|
3020
|
+
#Ae(e) {
|
|
2933
3021
|
const o = {
|
|
2934
3022
|
...Ze,
|
|
2935
3023
|
...e.animation
|
|
@@ -2937,40 +3025,84 @@ ${o}`;
|
|
|
2937
3025
|
let i = 1;
|
|
2938
3026
|
n === !1 || n === "off" ? i = 0 : (n === !0 || n === "on") && (i = 1), this.style.setProperty("--tbw-animation-duration", `${o.duration}ms`), this.style.setProperty("--tbw-animation-easing", o.easing ?? "ease-out"), this.style.setProperty("--tbw-animation-enabled", String(i)), this.dataset.animationMode = typeof n == "boolean" ? n ? "on" : "off" : n;
|
|
2939
3027
|
}
|
|
2940
|
-
#
|
|
2941
|
-
this.#
|
|
3028
|
+
#G(e, o, n = this.__rowRenderEpoch) {
|
|
3029
|
+
this.#R || (this.#R = (i, r, s) => this.#o?.renderRow(i, r, s) ?? !1), mt(this, e, o, n, this.#R);
|
|
2942
3030
|
}
|
|
2943
|
-
#
|
|
2944
|
-
#
|
|
2945
|
-
#
|
|
2946
|
-
if (e === this.#
|
|
3031
|
+
#X = -1;
|
|
3032
|
+
#le = -1;
|
|
3033
|
+
#ae(e, o) {
|
|
3034
|
+
if (e === this.#X && o === this.#le)
|
|
2947
3035
|
return;
|
|
2948
|
-
const n = this.#
|
|
2949
|
-
this.#
|
|
3036
|
+
const n = this.#X;
|
|
3037
|
+
this.#X = e, this.#le = o, this.__rowsBodyEl && (this.__rowsBodyEl.setAttribute("aria-rowcount", String(e)), this.__rowsBodyEl.setAttribute("aria-colcount", String(o))), e !== n && this._bodyEl && (e > 0 ? this._bodyEl.setAttribute("role", "rowgroup") : this._bodyEl.removeAttribute("role"));
|
|
2950
3038
|
}
|
|
2951
|
-
#
|
|
2952
|
-
#
|
|
2953
|
-
#
|
|
3039
|
+
#ce;
|
|
3040
|
+
#de;
|
|
3041
|
+
#Pe() {
|
|
2954
3042
|
if (!this.__rowsBodyEl) return;
|
|
2955
3043
|
const e = this.#n.gridAriaLabel, o = this.#n.shell?.header?.title ?? this.#e?.lightDomTitle ?? void 0, n = e ?? o;
|
|
2956
|
-
n !== this.#
|
|
3044
|
+
n !== this.#ce && (this.#ce = n, n ? this.__rowsBodyEl.setAttribute("aria-label", n) : this.__rowsBodyEl.removeAttribute("aria-label"));
|
|
2957
3045
|
const i = this.#n.gridAriaDescribedBy;
|
|
2958
|
-
i !== this.#
|
|
3046
|
+
i !== this.#de && (this.#de = i, i ? this.__rowsBodyEl.setAttribute("aria-describedby", i) : this.__rowsBodyEl.removeAttribute("aria-describedby"));
|
|
3047
|
+
}
|
|
3048
|
+
#Le(e) {
|
|
3049
|
+
const o = document.createElement("div");
|
|
3050
|
+
return o.className = `tbw-spinner tbw-spinner--${e}`, o.setAttribute("role", "progressbar"), o.setAttribute("aria-label", "Loading"), o;
|
|
3051
|
+
}
|
|
3052
|
+
#He(e) {
|
|
3053
|
+
const o = this.#n?.loadingRenderer;
|
|
3054
|
+
if (o) {
|
|
3055
|
+
const n = o({ size: e });
|
|
3056
|
+
if (typeof n == "string") {
|
|
3057
|
+
const i = document.createElement("div");
|
|
3058
|
+
return i.innerHTML = n, i;
|
|
3059
|
+
}
|
|
3060
|
+
return n;
|
|
3061
|
+
}
|
|
3062
|
+
return this.#Le(e);
|
|
2959
3063
|
}
|
|
2960
|
-
#
|
|
3064
|
+
#Oe() {
|
|
3065
|
+
const e = this.querySelector(".tbw-grid-root");
|
|
3066
|
+
if (e)
|
|
3067
|
+
if (this.#k) {
|
|
3068
|
+
if (!this.#N) {
|
|
3069
|
+
const o = document.createElement("div");
|
|
3070
|
+
o.className = "tbw-loading-overlay", o.setAttribute("role", "status"), o.setAttribute("aria-live", "polite"), o.appendChild(this.#He("large")), this.#N = o;
|
|
3071
|
+
}
|
|
3072
|
+
e.appendChild(this.#N);
|
|
3073
|
+
} else
|
|
3074
|
+
this.#N?.remove();
|
|
3075
|
+
}
|
|
3076
|
+
#he(e, o) {
|
|
3077
|
+
const n = this.#E.get(e);
|
|
3078
|
+
if (!n) return;
|
|
3079
|
+
const i = this.findRenderedRowElement?.(n.index);
|
|
3080
|
+
i && (o ? (i.classList.add("tbw-row-loading"), i.setAttribute("aria-busy", "true")) : (i.classList.remove("tbw-row-loading"), i.removeAttribute("aria-busy")));
|
|
3081
|
+
}
|
|
3082
|
+
#ue(e, o, n) {
|
|
3083
|
+
const i = this.#E.get(e);
|
|
3084
|
+
if (!i) return;
|
|
3085
|
+
const r = this.findRenderedRowElement?.(i.index);
|
|
3086
|
+
if (!r) return;
|
|
3087
|
+
const s = this._visibleColumns.findIndex((a) => a.field === o);
|
|
3088
|
+
if (s < 0) return;
|
|
3089
|
+
const l = r.children[s];
|
|
3090
|
+
l && (n ? (l.classList.add("tbw-cell-loading"), l.setAttribute("aria-busy", "true")) : (l.classList.remove("tbw-cell-loading"), l.removeAttribute("aria-busy")));
|
|
3091
|
+
}
|
|
3092
|
+
#L() {
|
|
2961
3093
|
if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
|
|
2962
|
-
if (this.#t.parseLightDomColumns(this), this.#
|
|
2963
|
-
const e = this.#
|
|
2964
|
-
this.#
|
|
3094
|
+
if (this.#t.parseLightDomColumns(this), this.#D) {
|
|
3095
|
+
const e = this.#D;
|
|
3096
|
+
this.#D = void 0, this.#t.merge();
|
|
2965
3097
|
const o = this.#o?.getAll() ?? [];
|
|
2966
3098
|
this.#t.applyState(e, o);
|
|
2967
3099
|
}
|
|
2968
3100
|
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(A.FULL, "setup");
|
|
2969
3101
|
}
|
|
2970
3102
|
}
|
|
2971
|
-
#
|
|
2972
|
-
if (this.refreshVirtualWindow(!1), this.#o?.onScrollRender(), this.#
|
|
2973
|
-
const o = this._virtualization.container, n = this.#
|
|
3103
|
+
#De(e) {
|
|
3104
|
+
if (this.refreshVirtualWindow(!1), this.#o?.onScrollRender(), this.#b) {
|
|
3105
|
+
const o = this._virtualization.container, n = this.#pe;
|
|
2974
3106
|
n.scrollTop = e, n.scrollLeft = o?.scrollLeft ?? 0, n.scrollHeight = o?.scrollHeight ?? 0, n.scrollWidth = o?.scrollWidth ?? 0, n.clientHeight = o?.clientHeight ?? 0, n.clientWidth = o?.clientWidth ?? 0, this.#o?.onScroll(n);
|
|
2975
3107
|
}
|
|
2976
3108
|
}
|
|
@@ -2986,7 +3118,7 @@ ${o}`;
|
|
|
2986
3118
|
_dispatchCellClick(e, o, n, i) {
|
|
2987
3119
|
const r = this._rows[o], s = this._columns[n];
|
|
2988
3120
|
if (!r || !s) return !1;
|
|
2989
|
-
const l = s.field,
|
|
3121
|
+
const l = s.field, a = r[l], c = new CustomEvent("cell-activate", {
|
|
2990
3122
|
cancelable: !0,
|
|
2991
3123
|
bubbles: !0,
|
|
2992
3124
|
composed: !0,
|
|
@@ -2994,25 +3126,25 @@ ${o}`;
|
|
|
2994
3126
|
rowIndex: o,
|
|
2995
3127
|
colIndex: n,
|
|
2996
3128
|
field: l,
|
|
2997
|
-
value:
|
|
3129
|
+
value: a,
|
|
2998
3130
|
row: r,
|
|
2999
3131
|
cellEl: i,
|
|
3000
3132
|
trigger: "pointer",
|
|
3001
3133
|
originalEvent: e
|
|
3002
3134
|
}
|
|
3003
3135
|
});
|
|
3004
|
-
if (this.dispatchEvent(
|
|
3136
|
+
if (this.dispatchEvent(c), c.defaultPrevented)
|
|
3005
3137
|
return !0;
|
|
3006
3138
|
const h = {
|
|
3007
3139
|
row: r,
|
|
3008
3140
|
rowIndex: o,
|
|
3009
3141
|
colIndex: n,
|
|
3010
3142
|
field: l,
|
|
3011
|
-
value:
|
|
3143
|
+
value: a,
|
|
3012
3144
|
cellEl: i,
|
|
3013
3145
|
originalEvent: e
|
|
3014
3146
|
}, u = this.#o?.onCellClick(h) ?? !1;
|
|
3015
|
-
return this.#
|
|
3147
|
+
return this.#P("cell-click", h), u;
|
|
3016
3148
|
}
|
|
3017
3149
|
_dispatchRowClick(e, o, n, i) {
|
|
3018
3150
|
if (!n) return !1;
|
|
@@ -3022,7 +3154,7 @@ ${o}`;
|
|
|
3022
3154
|
rowEl: i,
|
|
3023
3155
|
originalEvent: e
|
|
3024
3156
|
}, s = this.#o?.onRowClick(r) ?? !1;
|
|
3025
|
-
return this.#
|
|
3157
|
+
return this.#P("row-click", r), s;
|
|
3026
3158
|
}
|
|
3027
3159
|
_dispatchHeaderClick(e, o, n) {
|
|
3028
3160
|
const i = this._columns[o];
|
|
@@ -3045,6 +3177,9 @@ ${o}`;
|
|
|
3045
3177
|
queryPlugins(e) {
|
|
3046
3178
|
return this.#o?.queryPlugins(e) ?? [];
|
|
3047
3179
|
}
|
|
3180
|
+
query(e, o) {
|
|
3181
|
+
return this.#o?.queryPlugins({ type: e, context: o }) ?? [];
|
|
3182
|
+
}
|
|
3048
3183
|
_dispatchCellMouseDown(e) {
|
|
3049
3184
|
return this.#o?.onCellMouseDown(e) ?? !1;
|
|
3050
3185
|
}
|
|
@@ -3076,29 +3211,29 @@ ${o}`;
|
|
|
3076
3211
|
return Object.freeze({ ...this.#n || {} });
|
|
3077
3212
|
}
|
|
3078
3213
|
getRowId(e) {
|
|
3079
|
-
return this.#
|
|
3214
|
+
return this.#ye(e, this.#n.getRowId);
|
|
3080
3215
|
}
|
|
3081
3216
|
getRow(e) {
|
|
3082
|
-
return this.#
|
|
3217
|
+
return this.#E.get(e)?.row;
|
|
3083
3218
|
}
|
|
3084
3219
|
updateRow(e, o, n = "api") {
|
|
3085
|
-
const i = this.#
|
|
3220
|
+
const i = this.#E.get(e);
|
|
3086
3221
|
if (!i)
|
|
3087
3222
|
throw new Error(
|
|
3088
3223
|
`[tbw-grid] Row with ID "${e}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
3089
3224
|
);
|
|
3090
3225
|
const { row: r, index: s } = i, l = [];
|
|
3091
|
-
for (const [
|
|
3092
|
-
const h = r[
|
|
3093
|
-
h !==
|
|
3226
|
+
for (const [a, c] of Object.entries(o)) {
|
|
3227
|
+
const h = r[a];
|
|
3228
|
+
h !== c && (l.push({ field: a, oldValue: h, newValue: c }), r[a] = c);
|
|
3094
3229
|
}
|
|
3095
|
-
for (const { field:
|
|
3096
|
-
this.#
|
|
3230
|
+
for (const { field: a, oldValue: c, newValue: h } of l)
|
|
3231
|
+
this.#P("cell-change", {
|
|
3097
3232
|
row: r,
|
|
3098
3233
|
rowId: e,
|
|
3099
3234
|
rowIndex: s,
|
|
3100
|
-
field:
|
|
3101
|
-
oldValue:
|
|
3235
|
+
field: a,
|
|
3236
|
+
oldValue: c,
|
|
3102
3237
|
newValue: h,
|
|
3103
3238
|
changes: o,
|
|
3104
3239
|
source: n
|
|
@@ -3108,19 +3243,19 @@ ${o}`;
|
|
|
3108
3243
|
updateRows(e, o = "api") {
|
|
3109
3244
|
let n = !1;
|
|
3110
3245
|
for (const { id: i, changes: r } of e) {
|
|
3111
|
-
const s = this.#
|
|
3246
|
+
const s = this.#E.get(i);
|
|
3112
3247
|
if (!s)
|
|
3113
3248
|
throw new Error(
|
|
3114
3249
|
`[tbw-grid] Row with ID "${i}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
3115
3250
|
);
|
|
3116
|
-
const { row: l, index:
|
|
3117
|
-
for (const [
|
|
3118
|
-
const u = l[
|
|
3119
|
-
u !== h && (n = !0, l[
|
|
3251
|
+
const { row: l, index: a } = s;
|
|
3252
|
+
for (const [c, h] of Object.entries(r)) {
|
|
3253
|
+
const u = l[c];
|
|
3254
|
+
u !== h && (n = !0, l[c] = h, this.#P("cell-change", {
|
|
3120
3255
|
row: l,
|
|
3121
3256
|
rowId: i,
|
|
3122
|
-
rowIndex:
|
|
3123
|
-
field:
|
|
3257
|
+
rowIndex: a,
|
|
3258
|
+
field: c,
|
|
3124
3259
|
oldValue: u,
|
|
3125
3260
|
newValue: h,
|
|
3126
3261
|
changes: r,
|
|
@@ -3131,13 +3266,13 @@ ${o}`;
|
|
|
3131
3266
|
n && this.#s.requestPhase(A.ROWS, "updateRows");
|
|
3132
3267
|
}
|
|
3133
3268
|
animateRow(e, o) {
|
|
3134
|
-
|
|
3269
|
+
ge(this, e, o);
|
|
3135
3270
|
}
|
|
3136
3271
|
animateRows(e, o) {
|
|
3137
3272
|
Nt(this, e, o);
|
|
3138
3273
|
}
|
|
3139
3274
|
animateRowById(e, o) {
|
|
3140
|
-
return
|
|
3275
|
+
return It(this, e, o);
|
|
3141
3276
|
}
|
|
3142
3277
|
setColumnVisible(e, o) {
|
|
3143
3278
|
const n = this.#t.setColumnVisible(e, o);
|
|
@@ -3167,23 +3302,23 @@ ${o}`;
|
|
|
3167
3302
|
return this.#t.collectState(e);
|
|
3168
3303
|
}
|
|
3169
3304
|
set columnState(e) {
|
|
3170
|
-
e && (this.#
|
|
3305
|
+
e && (this.#D = e, this.#t.initialColumnState = e, this.#u && this.#ze(e));
|
|
3171
3306
|
}
|
|
3172
3307
|
get columnState() {
|
|
3173
3308
|
return this.getColumnState();
|
|
3174
3309
|
}
|
|
3175
|
-
#
|
|
3310
|
+
#ze(e) {
|
|
3176
3311
|
const o = this.#o?.getAll() ?? [];
|
|
3177
|
-
this.#t.applyState(e, o), this.#
|
|
3312
|
+
this.#t.applyState(e, o), this.#L();
|
|
3178
3313
|
}
|
|
3179
3314
|
requestStateChange() {
|
|
3180
3315
|
const e = this.#o?.getAll() ?? [];
|
|
3181
3316
|
this.#t.requestStateChange(e);
|
|
3182
3317
|
}
|
|
3183
3318
|
resetColumnState() {
|
|
3184
|
-
this.#
|
|
3319
|
+
this.#D = void 0, this.__originalOrder = [];
|
|
3185
3320
|
const e = this.#o?.getAll() ?? [];
|
|
3186
|
-
this.#t.resetState(e), this.#t.merge(), this.#
|
|
3321
|
+
this.#t.resetState(e), this.#t.merge(), this.#L();
|
|
3187
3322
|
}
|
|
3188
3323
|
get isToolPanelOpen() {
|
|
3189
3324
|
return this.#c.isPanelOpen;
|
|
@@ -3230,154 +3365,154 @@ ${o}`;
|
|
|
3230
3365
|
unregisterToolbarContent(e) {
|
|
3231
3366
|
this.#c.unregisterToolbarContent(e);
|
|
3232
3367
|
}
|
|
3233
|
-
#
|
|
3368
|
+
#Y = !1;
|
|
3234
3369
|
refreshShellHeader() {
|
|
3235
|
-
this.#
|
|
3236
|
-
this.#
|
|
3370
|
+
this.#Y || (this.#Y = !0, queueMicrotask(() => {
|
|
3371
|
+
this.#Y = !1, this.isConnected && (I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A()), this.#t.markSourcesChanged(), this.#t.merge(), this.#K(), this.#q(), this.#Me());
|
|
3237
3372
|
}));
|
|
3238
3373
|
}
|
|
3239
|
-
#
|
|
3374
|
+
#Me() {
|
|
3240
3375
|
const o = this.#i.querySelector(".tbw-grid-content") ?? this.#i.querySelector(".tbw-grid-root");
|
|
3241
3376
|
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
3242
|
-
|
|
3377
|
+
he(this.#i, this.#e), Le(this.#i, this.#n?.shell, this.#e);
|
|
3243
3378
|
const n = this.#n?.shell?.toolPanel?.defaultOpen;
|
|
3244
3379
|
n && this.#e.toolPanels.has(n) && (this.openToolPanel(), this.#e.expandedSections.add(n));
|
|
3245
3380
|
}
|
|
3246
|
-
this._resizeController = Te(this), this.#
|
|
3381
|
+
this._resizeController = Te(this), this.#ie(o), this.#s.requestPhase(A.COLUMNS, "shellRefresh");
|
|
3247
3382
|
}
|
|
3248
|
-
#
|
|
3383
|
+
#S = /* @__PURE__ */ new Map();
|
|
3249
3384
|
registerStyles(e, o) {
|
|
3250
|
-
let n = this.#
|
|
3251
|
-
n || (n = new CSSStyleSheet(), this.#
|
|
3385
|
+
let n = this.#S.get(e);
|
|
3386
|
+
n || (n = new CSSStyleSheet(), this.#S.set(e, n)), n.replaceSync(o), this.#fe();
|
|
3252
3387
|
}
|
|
3253
3388
|
unregisterStyles(e) {
|
|
3254
|
-
this.#
|
|
3389
|
+
this.#S.delete(e) && this.#fe();
|
|
3255
3390
|
}
|
|
3256
3391
|
getRegisteredStyles() {
|
|
3257
|
-
return Array.from(this.#
|
|
3392
|
+
return Array.from(this.#S.keys());
|
|
3258
3393
|
}
|
|
3259
|
-
#
|
|
3260
|
-
const e = Array.from(this.#
|
|
3261
|
-
(n) => !Array.from(this.#
|
|
3394
|
+
#fe() {
|
|
3395
|
+
const e = Array.from(this.#S.values()), o = document.adoptedStyleSheets.filter(
|
|
3396
|
+
(n) => !Array.from(this.#S.values()).includes(n)
|
|
3262
3397
|
);
|
|
3263
3398
|
document.adoptedStyleSheets = [...o, ...e];
|
|
3264
3399
|
}
|
|
3265
|
-
#
|
|
3400
|
+
#ke() {
|
|
3266
3401
|
const e = () => {
|
|
3267
3402
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3268
|
-
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#
|
|
3403
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A());
|
|
3269
3404
|
const r = this.#e.lightDomTitle, s = this.#e.hasToolButtonsContainer;
|
|
3270
3405
|
if (r && !n || s && !i) {
|
|
3271
3406
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3272
3407
|
const l = this.#i.querySelector(".tbw-shell-header");
|
|
3273
3408
|
if (l) {
|
|
3274
|
-
const
|
|
3409
|
+
const a = Pe(
|
|
3275
3410
|
this.#n.shell,
|
|
3276
3411
|
this.#e,
|
|
3277
3412
|
this.#n.icons?.toolPanel
|
|
3278
|
-
),
|
|
3279
|
-
|
|
3280
|
-
const h =
|
|
3281
|
-
h && (l.replaceWith(h), this.#
|
|
3413
|
+
), c = document.createElement("div");
|
|
3414
|
+
c.innerHTML = a;
|
|
3415
|
+
const h = c.firstElementChild;
|
|
3416
|
+
h && (l.replaceWith(h), this.#Q());
|
|
3282
3417
|
}
|
|
3283
3418
|
}
|
|
3284
3419
|
}, o = () => {
|
|
3285
|
-
this.__lightDomColumnsCache = void 0, this.#
|
|
3420
|
+
this.__lightDomColumnsCache = void 0, this.#L();
|
|
3286
3421
|
};
|
|
3287
3422
|
this.#t.registerLightDomHandler("tbw-grid-header", e), this.#t.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#t.registerLightDomHandler("tbw-grid-tool-panel", e), this.#t.registerLightDomHandler("tbw-grid-column", o), this.#t.registerLightDomHandler("tbw-grid-detail", o), this.#t.observeLightDOM(this);
|
|
3288
3423
|
}
|
|
3289
3424
|
refreshColumns() {
|
|
3290
3425
|
this.__lightDomColumnsCache = void 0, j(this), this.#t.parseLightDomColumns(this);
|
|
3291
3426
|
const e = this.#e.lightDomTitle, o = this.#e.hasToolButtonsContainer;
|
|
3292
|
-
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#
|
|
3427
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A());
|
|
3293
3428
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3294
3429
|
if (n && !e || i && !o) {
|
|
3295
3430
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3296
3431
|
const s = this.#i.querySelector(".tbw-shell-header");
|
|
3297
3432
|
if (s) {
|
|
3298
|
-
const l =
|
|
3433
|
+
const l = Pe(
|
|
3299
3434
|
this.#n.shell,
|
|
3300
3435
|
this.#e,
|
|
3301
3436
|
this.#n.icons?.toolPanel
|
|
3302
|
-
),
|
|
3303
|
-
|
|
3304
|
-
const
|
|
3305
|
-
|
|
3437
|
+
), a = document.createElement("div");
|
|
3438
|
+
a.innerHTML = l;
|
|
3439
|
+
const c = a.firstElementChild;
|
|
3440
|
+
c && (s.replaceWith(c), this.#Q());
|
|
3306
3441
|
}
|
|
3307
3442
|
}
|
|
3308
3443
|
this.#s.requestPhase(A.COLUMNS, "refreshColumns");
|
|
3309
3444
|
}
|
|
3310
|
-
#
|
|
3311
|
-
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight,
|
|
3445
|
+
#j(e) {
|
|
3446
|
+
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight, a = this.shadowRoot?.querySelector(".tbw-scroll-area"), c = a ? a.clientHeight : r, u = c - s, p = this.#o?.getExtraHeight() ?? 0, f = Math.max(0, r - c);
|
|
3312
3447
|
return e * o + u + p + f;
|
|
3313
3448
|
}
|
|
3314
3449
|
refreshVirtualWindow(e = !1, o = !1) {
|
|
3315
3450
|
if (!this._bodyEl) return;
|
|
3316
3451
|
const n = this._rows.length;
|
|
3317
3452
|
if (!this._virtualization.enabled) {
|
|
3318
|
-
this.#
|
|
3453
|
+
this.#G(0, n), o || this.#o?.afterRender();
|
|
3319
3454
|
return;
|
|
3320
3455
|
}
|
|
3321
3456
|
if (this._rows.length <= this._virtualization.bypassThreshold) {
|
|
3322
|
-
this._virtualization.start = 0, this._virtualization.end = n, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#
|
|
3457
|
+
this._virtualization.start = 0, this._virtualization.end = n, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#G(0, n, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#j(n)}px`), this.#ae(n, this._visibleColumns.length), o || this.#o?.afterRender();
|
|
3323
3458
|
return;
|
|
3324
3459
|
}
|
|
3325
|
-
const i = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? i, s = r.clientHeight, l = this._virtualization.rowHeight,
|
|
3326
|
-
let
|
|
3460
|
+
const i = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? i, s = r.clientHeight, l = this._virtualization.rowHeight, a = i.scrollTop;
|
|
3461
|
+
let c = Math.floor(a / l), h = 0;
|
|
3327
3462
|
const u = 10;
|
|
3328
3463
|
for (; h < u; ) {
|
|
3329
|
-
const C = this.#o?.getExtraHeightBefore?.(
|
|
3330
|
-
if (_ >=
|
|
3331
|
-
|
|
3464
|
+
const C = this.#o?.getExtraHeightBefore?.(c) ?? 0, _ = Math.floor((a - C) / l);
|
|
3465
|
+
if (_ >= c || _ < 0) break;
|
|
3466
|
+
c = _, h++;
|
|
3332
3467
|
}
|
|
3333
|
-
|
|
3334
|
-
const p = this.#o?.adjustVirtualStart(
|
|
3335
|
-
p !== void 0 && p <
|
|
3468
|
+
c = c - c % 2, c < 0 && (c = 0);
|
|
3469
|
+
const p = this.#o?.adjustVirtualStart(c, a, l);
|
|
3470
|
+
p !== void 0 && p < c && (c = p, c = c - c % 2, c < 0 && (c = 0));
|
|
3336
3471
|
const f = Math.ceil(s / l) + 3;
|
|
3337
|
-
let g =
|
|
3338
|
-
if (g > n && (g = n), this._virtualization.start =
|
|
3472
|
+
let g = c + f;
|
|
3473
|
+
if (g > n && (g = n), this._virtualization.start = c, this._virtualization.end = g, i.clientHeight === 0 && s > 0) {
|
|
3339
3474
|
this.#s.requestPhase(A.VIRTUALIZATION, "stale-refs-retry");
|
|
3340
3475
|
return;
|
|
3341
3476
|
}
|
|
3342
|
-
const w = this.#
|
|
3477
|
+
const w = this.#j(n);
|
|
3343
3478
|
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${w}px`);
|
|
3344
|
-
const
|
|
3345
|
-
this._bodyEl.style.transform = `translateY(${S}px)`, this.#
|
|
3479
|
+
const b = this.#o?.getExtraHeightBefore?.(c) ?? 0, S = -(a - c * l - b);
|
|
3480
|
+
this._bodyEl.style.transform = `translateY(${S}px)`, this.#G(c, g, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#ae(n, this._visibleColumns.length), e && !o && (this.#o?.afterRender(), queueMicrotask(() => {
|
|
3346
3481
|
const C = i.clientHeight, _ = r.clientHeight;
|
|
3347
3482
|
if (C === 0 && _ > 0) return;
|
|
3348
|
-
const
|
|
3349
|
-
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${
|
|
3483
|
+
const T = this.#j(n);
|
|
3484
|
+
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${T}px`);
|
|
3350
3485
|
}));
|
|
3351
3486
|
}
|
|
3352
|
-
#
|
|
3353
|
-
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#
|
|
3487
|
+
#K() {
|
|
3488
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3354
3489
|
const e = this.#n?.shell;
|
|
3355
|
-
|
|
3490
|
+
Yt(
|
|
3356
3491
|
this.#i,
|
|
3357
3492
|
e,
|
|
3358
3493
|
{ isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
|
|
3359
3494
|
this.#n?.icons
|
|
3360
|
-
) && (this.#
|
|
3495
|
+
) && (this.#Q(), this.#c.setInitialized(!0));
|
|
3361
3496
|
}
|
|
3362
|
-
#
|
|
3363
|
-
|
|
3497
|
+
#Q() {
|
|
3498
|
+
Ft(this.#i, this.#n?.shell, this.#e, {
|
|
3364
3499
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3365
3500
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3366
|
-
}), this.#
|
|
3501
|
+
}), this.#M?.(), this.#M = Ut(this.#i, this.#n?.shell, (e) => {
|
|
3367
3502
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3368
3503
|
});
|
|
3369
3504
|
}
|
|
3370
3505
|
}
|
|
3371
3506
|
customElements.get(L.tagName) || customElements.define(L.tagName, L);
|
|
3372
3507
|
globalThis.DataGridElement = L;
|
|
3373
|
-
const
|
|
3508
|
+
const uo = {
|
|
3374
3509
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3375
3510
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3376
3511
|
};
|
|
3377
|
-
class
|
|
3512
|
+
class fo {
|
|
3378
3513
|
static dependencies;
|
|
3379
3514
|
static manifest;
|
|
3380
|
-
version = "1.
|
|
3515
|
+
version = "1.8.0";
|
|
3381
3516
|
styles;
|
|
3382
3517
|
cellRenderers;
|
|
3383
3518
|
headerRenderers;
|
|
@@ -3408,6 +3543,15 @@ class uo {
|
|
|
3408
3543
|
const n = new CustomEvent(e, { detail: o, bubbles: !0, cancelable: !0 });
|
|
3409
3544
|
return this.grid?.dispatchEvent?.(n), n.defaultPrevented;
|
|
3410
3545
|
}
|
|
3546
|
+
on(e, o) {
|
|
3547
|
+
this.grid?._pluginManager?.subscribe(this, e, o);
|
|
3548
|
+
}
|
|
3549
|
+
off(e) {
|
|
3550
|
+
this.grid?._pluginManager?.unsubscribe(this, e);
|
|
3551
|
+
}
|
|
3552
|
+
emitPluginEvent(e, o) {
|
|
3553
|
+
this.grid?._pluginManager?.emitPluginEvent(e, o);
|
|
3554
|
+
}
|
|
3411
3555
|
requestRender() {
|
|
3412
3556
|
this.grid?.requestRender?.();
|
|
3413
3557
|
}
|
|
@@ -3437,7 +3581,7 @@ class uo {
|
|
|
3437
3581
|
}
|
|
3438
3582
|
get gridIcons() {
|
|
3439
3583
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
3440
|
-
return { ...
|
|
3584
|
+
return { ...k, ...e };
|
|
3441
3585
|
}
|
|
3442
3586
|
get isAnimationEnabled() {
|
|
3443
3587
|
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
@@ -3497,14 +3641,14 @@ const P = {
|
|
|
3497
3641
|
GROUP_COUNT: "group-count",
|
|
3498
3642
|
RANGE_SELECTION: "range-selection",
|
|
3499
3643
|
SELECTION_OVERLAY: "selection-overlay"
|
|
3500
|
-
},
|
|
3644
|
+
}, te = {
|
|
3501
3645
|
ROW_INDEX: "data-row-index",
|
|
3502
3646
|
COL_INDEX: "data-col-index",
|
|
3503
3647
|
FIELD: "data-field",
|
|
3504
3648
|
GROUP_KEY: "data-group-key",
|
|
3505
3649
|
TREE_LEVEL: "data-tree-level",
|
|
3506
3650
|
STICKY: "data-sticky"
|
|
3507
|
-
},
|
|
3651
|
+
}, po = {
|
|
3508
3652
|
ROOT: `.${P.ROOT}`,
|
|
3509
3653
|
HEADER: `.${P.HEADER}`,
|
|
3510
3654
|
HEADER_ROW: `.${P.HEADER_ROW}`,
|
|
@@ -3514,12 +3658,12 @@ const P = {
|
|
|
3514
3658
|
DATA_ROW: `.${P.DATA_ROW}`,
|
|
3515
3659
|
DATA_CELL: `.${P.DATA_CELL}`,
|
|
3516
3660
|
GROUP_ROW: `.${P.GROUP_ROW}`,
|
|
3517
|
-
ROW_BY_INDEX: (t) => `.${P.DATA_ROW}[${
|
|
3518
|
-
CELL_BY_FIELD: (t) => `.${P.DATA_CELL}[${
|
|
3519
|
-
CELL_AT: (t, e) => `.${P.DATA_ROW}[${
|
|
3661
|
+
ROW_BY_INDEX: (t) => `.${P.DATA_ROW}[${te.ROW_INDEX}="${t}"]`,
|
|
3662
|
+
CELL_BY_FIELD: (t) => `.${P.DATA_CELL}[${te.FIELD}="${t}"]`,
|
|
3663
|
+
CELL_AT: (t, e) => `.${P.DATA_ROW}[${te.ROW_INDEX}="${t}"] .${P.DATA_CELL}[${te.COL_INDEX}="${e}"]`,
|
|
3520
3664
|
SELECTED_ROWS: `.${P.DATA_ROW}.${P.SELECTED}`,
|
|
3521
3665
|
EDITING_CELL: `.${P.DATA_CELL}.${P.EDITING}`
|
|
3522
|
-
},
|
|
3666
|
+
}, go = {
|
|
3523
3667
|
COLOR_BG: "--tbw-color-bg",
|
|
3524
3668
|
COLOR_FG: "--tbw-color-fg",
|
|
3525
3669
|
COLOR_FG_MUTED: "--tbw-color-fg-muted",
|
|
@@ -3538,11 +3682,11 @@ const P = {
|
|
|
3538
3682
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
3539
3683
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
3540
3684
|
};
|
|
3541
|
-
function
|
|
3685
|
+
function wo(t) {
|
|
3542
3686
|
const e = document.createElement("tbw-grid");
|
|
3543
3687
|
return t && (e.gridConfig = t), e;
|
|
3544
3688
|
}
|
|
3545
|
-
function
|
|
3689
|
+
function bo(t, e = document) {
|
|
3546
3690
|
return e.querySelector(t);
|
|
3547
3691
|
}
|
|
3548
3692
|
const mo = {
|
|
@@ -3558,7 +3702,7 @@ const mo = {
|
|
|
3558
3702
|
CELL_ACTIVATE: "cell-activate",
|
|
3559
3703
|
GROUP_TOGGLE: "group-toggle",
|
|
3560
3704
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
3561
|
-
},
|
|
3705
|
+
}, vo = {
|
|
3562
3706
|
SELECTION_CHANGE: "selection-change",
|
|
3563
3707
|
TREE_EXPAND: "tree-expand",
|
|
3564
3708
|
FILTER_CHANGE: "filter-change",
|
|
@@ -3576,7 +3720,7 @@ const mo = {
|
|
|
3576
3720
|
COLUMN_REORDER: "column-reorder",
|
|
3577
3721
|
DETAIL_EXPAND: "detail-expand",
|
|
3578
3722
|
GROUP_EXPAND: "group-expand"
|
|
3579
|
-
},
|
|
3723
|
+
}, de = {
|
|
3580
3724
|
sum: (t, e) => t.reduce((o, n) => o + (Number(n[e]) || 0), 0),
|
|
3581
3725
|
avg: (t, e) => {
|
|
3582
3726
|
const o = t.reduce((n, i) => n + (Number(i[e]) || 0), 0);
|
|
@@ -3587,7 +3731,7 @@ const mo = {
|
|
|
3587
3731
|
max: (t, e) => Math.max(...t.map((o) => Number(o[e]) || -1 / 0)),
|
|
3588
3732
|
first: (t, e) => t[0]?.[e],
|
|
3589
3733
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
3590
|
-
}, V = /* @__PURE__ */ new Map(),
|
|
3734
|
+
}, V = /* @__PURE__ */ new Map(), z = {
|
|
3591
3735
|
register(t, e) {
|
|
3592
3736
|
V.set(t, e);
|
|
3593
3737
|
},
|
|
@@ -3596,19 +3740,19 @@ const mo = {
|
|
|
3596
3740
|
},
|
|
3597
3741
|
get(t) {
|
|
3598
3742
|
if (t !== void 0)
|
|
3599
|
-
return typeof t == "function" ? t : V.get(t) ??
|
|
3743
|
+
return typeof t == "function" ? t : V.get(t) ?? de[t];
|
|
3600
3744
|
},
|
|
3601
3745
|
run(t, e, o, n) {
|
|
3602
3746
|
const i = this.get(t);
|
|
3603
3747
|
return i ? i(e, o, n) : void 0;
|
|
3604
3748
|
},
|
|
3605
3749
|
has(t) {
|
|
3606
|
-
return V.has(t) || t in
|
|
3750
|
+
return V.has(t) || t in de;
|
|
3607
3751
|
},
|
|
3608
3752
|
list() {
|
|
3609
|
-
return [...Object.keys(
|
|
3753
|
+
return [...Object.keys(de), ...V.keys()];
|
|
3610
3754
|
}
|
|
3611
|
-
},
|
|
3755
|
+
}, ze = {
|
|
3612
3756
|
sum: (t) => t.reduce((e, o) => e + o, 0),
|
|
3613
3757
|
avg: (t) => t.length ? t.reduce((e, o) => e + o, 0) / t.length : 0,
|
|
3614
3758
|
count: (t) => t.length,
|
|
@@ -3617,46 +3761,46 @@ const mo = {
|
|
|
3617
3761
|
first: (t) => t[0] ?? 0,
|
|
3618
3762
|
last: (t) => t[t.length - 1] ?? 0
|
|
3619
3763
|
};
|
|
3620
|
-
function
|
|
3621
|
-
return
|
|
3764
|
+
function ho(t) {
|
|
3765
|
+
return ze[t] ?? ze.sum;
|
|
3622
3766
|
}
|
|
3623
|
-
function
|
|
3624
|
-
return
|
|
3767
|
+
function Co(t, e) {
|
|
3768
|
+
return ho(t)(e);
|
|
3625
3769
|
}
|
|
3626
|
-
const
|
|
3770
|
+
const yo = z.register.bind(z), _o = z.unregister.bind(z), Eo = z.get.bind(z), So = z.run.bind(z), Ro = z.list.bind(z);
|
|
3627
3771
|
export {
|
|
3628
|
-
|
|
3772
|
+
fo as BaseGridPlugin,
|
|
3629
3773
|
Ze as DEFAULT_ANIMATION_CONFIG,
|
|
3630
|
-
|
|
3774
|
+
k as DEFAULT_GRID_ICONS,
|
|
3631
3775
|
mo as DGEvents,
|
|
3632
3776
|
L as DataGridElement,
|
|
3633
3777
|
X as FitModeEnum,
|
|
3634
|
-
|
|
3778
|
+
go as GridCSSVars,
|
|
3635
3779
|
P as GridClasses,
|
|
3636
|
-
|
|
3780
|
+
te as GridDataAttrs,
|
|
3637
3781
|
L as GridElement,
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3782
|
+
po as GridSelectors,
|
|
3783
|
+
uo as PLUGIN_QUERIES,
|
|
3784
|
+
vo as PluginEvents,
|
|
3785
|
+
co as PluginManager,
|
|
3642
3786
|
A as RenderPhase,
|
|
3643
|
-
|
|
3644
|
-
|
|
3787
|
+
kt as a,
|
|
3788
|
+
z as aggregatorRegistry,
|
|
3645
3789
|
$ as b,
|
|
3646
3790
|
Tt as builtInSort,
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3791
|
+
fe as c,
|
|
3792
|
+
wo as createGrid,
|
|
3793
|
+
xt as defaultComparator,
|
|
3794
|
+
ke as e,
|
|
3795
|
+
qe as g,
|
|
3796
|
+
Eo as getAggregator,
|
|
3797
|
+
ho as getValueAggregator,
|
|
3798
|
+
Ro as listAggregators,
|
|
3799
|
+
bo as queryGrid,
|
|
3800
|
+
yo as registerAggregator,
|
|
3801
|
+
So as runAggregator,
|
|
3802
|
+
Co as runValueAggregator,
|
|
3659
3803
|
F as s,
|
|
3660
|
-
|
|
3804
|
+
_o as unregisterAggregator
|
|
3661
3805
|
};
|
|
3662
3806
|
//# sourceMappingURL=index.js.map
|