@toolbox-web/grid 1.1.2 → 1.3.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 +80 -22
- package/all.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +557 -365
- package/all.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +903 -769
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +102 -3
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/row-animation.d.ts +37 -0
- package/lib/core/internal/row-animation.d.ts.map +1 -0
- package/lib/core/internal/rows.d.ts.map +1 -1
- package/lib/core/internal/shell.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +65 -3
- 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 +25 -1
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/plugin/types.d.ts +62 -0
- package/lib/core/plugin/types.d.ts.map +1 -1
- package/lib/core/types.d.ts +64 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +73 -69
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/clipboard/types.d.ts +1 -0
- package/lib/plugins/clipboard/types.d.ts.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +69 -40
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
- package/lib/plugins/master-detail/index.js +14 -12
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts +155 -0
- package/lib/plugins/row-reorder/RowReorderPlugin.d.ts.map +1 -0
- package/lib/plugins/row-reorder/index.d.ts +9 -0
- package/lib/plugins/row-reorder/index.d.ts.map +1 -0
- package/lib/plugins/row-reorder/index.js +597 -0
- package/lib/plugins/row-reorder/index.js.map +1 -0
- package/lib/plugins/row-reorder/types.d.ts +80 -0
- package/lib/plugins/row-reorder/types.d.ts.map +1 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts +13 -0
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.d.ts +1 -1
- package/lib/plugins/selection/index.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +95 -64
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/selection/types.d.ts +50 -6
- package/lib/plugins/selection/types.d.ts.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +21 -4
- package/public.d.ts +15 -2
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +23 -23
- 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/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/master-detail.umd.js +1 -1
- package/umd/plugins/master-detail.umd.js.map +1 -1
- package/umd/plugins/row-reorder.umd.js +2 -0
- package/umd/plugins/row-reorder.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const ae = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{:root{color-scheme:light dark}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-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--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-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--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}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6}&: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}}@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}}@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)}}}', V = {
|
|
1
|
+
const he = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{:root{color-scheme:light dark}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-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--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-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}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6}&: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}}', B = {
|
|
2
2
|
STRETCH: "stretch",
|
|
3
3
|
FIXED: "fixed"
|
|
4
|
-
},
|
|
4
|
+
}, Be = {
|
|
5
5
|
mode: "reduced-motion",
|
|
6
6
|
duration: 200,
|
|
7
7
|
easing: "ease-out"
|
|
8
|
-
},
|
|
8
|
+
}, z = {
|
|
9
9
|
expand: "▶",
|
|
10
10
|
collapse: "▼",
|
|
11
11
|
sortAsc: "▲",
|
|
@@ -15,44 +15,44 @@ const ae = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{:root{color-sc
|
|
|
15
15
|
dragHandle: "⋮⋮",
|
|
16
16
|
toolPanel: "☰"
|
|
17
17
|
};
|
|
18
|
-
function
|
|
18
|
+
function Ge(t) {
|
|
19
19
|
return Array.from(t.querySelectorAll("tbw-grid-column")).map((o) => {
|
|
20
20
|
const n = o.getAttribute("field") || "";
|
|
21
21
|
if (!n) return null;
|
|
22
|
-
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, c = o.hasAttribute("sortable"), a = o.hasAttribute("editable"), h = { field: n, type: s, header: l, sortable: c, editable: a },
|
|
23
|
-
if (
|
|
24
|
-
const _ = parseFloat(
|
|
25
|
-
!isNaN(_) && /^\d+(\.\d+)?$/.test(
|
|
22
|
+
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, c = o.hasAttribute("sortable"), a = o.hasAttribute("editable"), h = { field: n, type: s, header: l, sortable: c, editable: a }, u = o.getAttribute("width");
|
|
23
|
+
if (u) {
|
|
24
|
+
const _ = parseFloat(u);
|
|
25
|
+
!isNaN(_) && /^\d+(\.\d+)?$/.test(u.trim()) ? h.width = _ : h.width = u;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const _ = parseFloat(
|
|
27
|
+
const p = o.getAttribute("minWidth") || o.getAttribute("min-width");
|
|
28
|
+
if (p) {
|
|
29
|
+
const _ = parseFloat(p);
|
|
30
30
|
isNaN(_) || (h.minWidth = _);
|
|
31
31
|
}
|
|
32
32
|
o.hasAttribute("resizable") && (h.resizable = !0), o.hasAttribute("sizable") && (h.resizable = !0);
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const [
|
|
38
|
-
return { value:
|
|
33
|
+
const f = o.getAttribute("editor"), g = o.getAttribute("renderer");
|
|
34
|
+
f && (h.__editorName = f), g && (h.__rendererName = g);
|
|
35
|
+
const d = o.getAttribute("options");
|
|
36
|
+
d && (h.options = d.split(",").map((_) => {
|
|
37
|
+
const [N, S] = _.includes(":") ? _.split(":") : [_.trim(), _.trim()];
|
|
38
|
+
return { value: N.trim(), label: S?.trim() || N.trim() };
|
|
39
39
|
}));
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
const _ =
|
|
40
|
+
const w = o.querySelector("tbw-grid-column-view"), m = o.querySelector("tbw-grid-column-editor"), R = o.querySelector("tbw-grid-column-header");
|
|
41
|
+
w && (h.__viewTemplate = w), m && (h.__editorTemplate = m), R && (h.__headerTemplate = R);
|
|
42
|
+
const T = globalThis.DataGridElement?.getAdapters?.() ?? [], b = w ?? o, y = T.find((_) => _.canHandle(b));
|
|
43
|
+
if (y) {
|
|
44
|
+
const _ = y.createRenderer(b);
|
|
45
45
|
_ && (h.viewRenderer = _);
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const _ =
|
|
47
|
+
const E = m ?? o, C = T.find((_) => _.canHandle(E));
|
|
48
|
+
if (C) {
|
|
49
|
+
const _ = C.createEditor(E);
|
|
50
50
|
_ && (h.editor = _);
|
|
51
51
|
}
|
|
52
52
|
return h;
|
|
53
53
|
}).filter((o) => !!o);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function ue(t, e) {
|
|
56
56
|
if ((!t || !t.length) && (!e || !e.length)) return [];
|
|
57
57
|
if (!t || !t.length) return e || [];
|
|
58
58
|
if (!e || !e.length) return t;
|
|
@@ -76,7 +76,7 @@ function ce(t, e) {
|
|
|
76
76
|
});
|
|
77
77
|
return Object.keys(o).forEach((i) => n.push(o[i])), n;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function fe(t, e) {
|
|
80
80
|
try {
|
|
81
81
|
t.part?.add?.(e);
|
|
82
82
|
} catch {
|
|
@@ -84,9 +84,9 @@ function de(t, e) {
|
|
|
84
84
|
const o = t.getAttribute("part");
|
|
85
85
|
o ? o.split(/\s+/).includes(e) || t.setAttribute("part", o + " " + e) : t.setAttribute("part", e);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const e = t.effectiveConfig?.fitMode || t.fitMode ||
|
|
89
|
-
if (e !==
|
|
87
|
+
function pe(t) {
|
|
88
|
+
const e = t.effectiveConfig?.fitMode || t.fitMode || B.STRETCH;
|
|
89
|
+
if (e !== B.STRETCH && e !== B.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
|
|
90
90
|
const o = Array.from(t._headerRowEl?.children || []);
|
|
91
91
|
if (!o.length) return;
|
|
92
92
|
let n = !1;
|
|
@@ -102,32 +102,32 @@ function he(t) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
l > 0 && (i.width = l + 2, i.__autoSized = !0, n = !0);
|
|
105
|
-
}), n &&
|
|
105
|
+
}), n && U(t), t.__didInitialAutoSize = !0;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
(t.effectiveConfig?.fitMode || t.fitMode ||
|
|
107
|
+
function U(t) {
|
|
108
|
+
(t.effectiveConfig?.fitMode || t.fitMode || B.STRETCH) === B.STRETCH ? t._gridTemplate = t._visibleColumns.map((o) => {
|
|
109
109
|
if (o.width) return `${o.width}px`;
|
|
110
110
|
const n = o.minWidth;
|
|
111
111
|
return n != null ? `minmax(${n}px, 1fr)` : "1fr";
|
|
112
112
|
}).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((o) => o.width ? `${o.width}px` : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Xe(t) {
|
|
115
115
|
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";
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Ye(t, e) {
|
|
118
118
|
const o = t[0] || {}, n = Object.keys(o).map((r) => {
|
|
119
|
-
const s = o[r], l =
|
|
119
|
+
const s = o[r], l = Xe(s);
|
|
120
120
|
return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: l };
|
|
121
121
|
}), i = {};
|
|
122
122
|
return n.forEach((r) => {
|
|
123
123
|
i[r.field] = r.type || "string";
|
|
124
124
|
}), { columns: n, typeMap: i };
|
|
125
125
|
}
|
|
126
|
-
const
|
|
127
|
-
function
|
|
126
|
+
const je = /{{\s*([^}]+)\s*}}/g, O = "__DG_EMPTY__", Ke = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, Ze = /__(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/;
|
|
127
|
+
function Je(t) {
|
|
128
128
|
return !t || typeof t != "string" ? "" : t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
129
129
|
}
|
|
130
|
-
const
|
|
130
|
+
const Qe = /* @__PURE__ */ new Set([
|
|
131
131
|
"script",
|
|
132
132
|
"iframe",
|
|
133
133
|
"object",
|
|
@@ -152,23 +152,23 @@ const Ke = /* @__PURE__ */ new Set([
|
|
|
152
152
|
"plaintext",
|
|
153
153
|
"xmp",
|
|
154
154
|
"listing"
|
|
155
|
-
]),
|
|
156
|
-
function
|
|
155
|
+
]), ge = /^on\w+$/i, et = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), tt = /^\s*(javascript|vbscript|data|blob):/i;
|
|
156
|
+
function K(t) {
|
|
157
157
|
if (!t || typeof t != "string") return "";
|
|
158
158
|
if (t.indexOf("<") === -1) return t;
|
|
159
159
|
const e = document.createElement("template");
|
|
160
|
-
return e.innerHTML = t,
|
|
160
|
+
return e.innerHTML = t, ot(e.content), e.innerHTML;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function ot(t) {
|
|
163
163
|
const e = [], o = t.querySelectorAll("*");
|
|
164
164
|
for (const n of o) {
|
|
165
165
|
const i = n.tagName.toLowerCase();
|
|
166
|
-
if (
|
|
166
|
+
if (Qe.has(i)) {
|
|
167
167
|
e.push(n);
|
|
168
168
|
continue;
|
|
169
169
|
}
|
|
170
170
|
if ((i === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
|
|
171
|
-
(l) =>
|
|
171
|
+
(l) => ge.test(l.name) || l.name === "href" || l.name === "xlink:href"
|
|
172
172
|
)) {
|
|
173
173
|
e.push(n);
|
|
174
174
|
continue;
|
|
@@ -176,11 +176,11 @@ function Qe(t) {
|
|
|
176
176
|
const r = [];
|
|
177
177
|
for (const s of n.attributes) {
|
|
178
178
|
const l = s.name.toLowerCase();
|
|
179
|
-
if (
|
|
179
|
+
if (ge.test(l)) {
|
|
180
180
|
r.push(s.name);
|
|
181
181
|
continue;
|
|
182
182
|
}
|
|
183
|
-
if (
|
|
183
|
+
if (et.has(l) && tt.test(s.value)) {
|
|
184
184
|
r.push(s.name);
|
|
185
185
|
continue;
|
|
186
186
|
}
|
|
@@ -193,35 +193,35 @@ function Qe(t) {
|
|
|
193
193
|
}
|
|
194
194
|
e.forEach((n) => n.remove());
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function Le(t, e) {
|
|
197
197
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
198
|
-
const o = [], n = t.replace(
|
|
199
|
-
const a =
|
|
198
|
+
const o = [], n = t.replace(je, (l, c) => {
|
|
199
|
+
const a = nt(c, e);
|
|
200
200
|
return o.push({ expr: c.trim(), result: a }), a;
|
|
201
|
-
}), i =
|
|
201
|
+
}), i = it(n), r = o.length && o.every((l) => l.result === "" || l.result === O);
|
|
202
202
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : i;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
205
|
-
if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return
|
|
206
|
-
if (t === "value") return e.value == null ?
|
|
204
|
+
function nt(t, e) {
|
|
205
|
+
if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return O;
|
|
206
|
+
if (t === "value") return e.value == null ? O : String(e.value);
|
|
207
207
|
if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
|
|
208
208
|
const n = t.slice(4), i = e.row ? e.row[n] : void 0;
|
|
209
|
-
return i == null ?
|
|
209
|
+
return i == null ? O : String(i);
|
|
210
210
|
}
|
|
211
|
-
if (t.length > 80 || !
|
|
211
|
+
if (t.length > 80 || !Ke.test(t) || Ze.test(t)) return O;
|
|
212
212
|
const o = t.match(/\./g);
|
|
213
|
-
if (o && o.length > 1) return
|
|
213
|
+
if (o && o.length > 1) return O;
|
|
214
214
|
try {
|
|
215
215
|
const i = new Function("value", "row", `return (${t});`)(e.value, e.row), r = i == null ? "" : String(i);
|
|
216
|
-
return /Reflect|Proxy|ownKeys/.test(r) ?
|
|
216
|
+
return /Reflect|Proxy|ownKeys/.test(r) ? O : r || O;
|
|
217
217
|
} catch {
|
|
218
|
-
return
|
|
218
|
+
return O;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return t && t.replace(new RegExp(
|
|
221
|
+
function it(t) {
|
|
222
|
+
return t && t.replace(new RegExp(O, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function rt(t) {
|
|
225
225
|
if (/Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
|
|
226
226
|
if (Array.from(t.childNodes).forEach((e) => {
|
|
227
227
|
e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
|
|
@@ -233,18 +233,18 @@ function ot(t) {
|
|
|
233
233
|
(t.textContent || "").trim().length === 0 && (t.textContent = "");
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" :
|
|
236
|
+
function we(t) {
|
|
237
|
+
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" : Le(t, n));
|
|
238
238
|
return o.__blocked = e, o;
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
class
|
|
242
|
-
#
|
|
240
|
+
const st = 100;
|
|
241
|
+
class lt {
|
|
242
|
+
#n;
|
|
243
243
|
#c;
|
|
244
244
|
#f;
|
|
245
245
|
#d;
|
|
246
246
|
#s;
|
|
247
|
-
#
|
|
247
|
+
#i = {};
|
|
248
248
|
#h = {};
|
|
249
249
|
#u = !0;
|
|
250
250
|
#m = [];
|
|
@@ -257,7 +257,7 @@ class it {
|
|
|
257
257
|
this.#r = e;
|
|
258
258
|
}
|
|
259
259
|
get original() {
|
|
260
|
-
return this.#
|
|
260
|
+
return this.#i;
|
|
261
261
|
}
|
|
262
262
|
get effective() {
|
|
263
263
|
return this.#h;
|
|
@@ -299,10 +299,10 @@ class it {
|
|
|
299
299
|
this.#u = !0;
|
|
300
300
|
}
|
|
301
301
|
setGridConfig(e) {
|
|
302
|
-
this.#
|
|
302
|
+
this.#n = e, this.#u = !0, this.#d = void 0;
|
|
303
303
|
}
|
|
304
304
|
getGridConfig() {
|
|
305
|
-
return this.#
|
|
305
|
+
return this.#n;
|
|
306
306
|
}
|
|
307
307
|
setColumns(e) {
|
|
308
308
|
this.#c = e, this.#u = !0;
|
|
@@ -320,8 +320,8 @@ class it {
|
|
|
320
320
|
const e = (this.#h.columns?.length ?? 0) > 0;
|
|
321
321
|
if (!this.#u && e)
|
|
322
322
|
return;
|
|
323
|
-
const o = this.#
|
|
324
|
-
this.#u = !1, this.#
|
|
323
|
+
const o = this.#C();
|
|
324
|
+
this.#u = !1, this.#i = o, Object.freeze(this.#i), this.#i.columns && Object.freeze(this.#i.columns), this.#h = this.#A(this.#i), this.#p();
|
|
325
325
|
}
|
|
326
326
|
#A(e) {
|
|
327
327
|
const o = { ...e };
|
|
@@ -339,23 +339,23 @@ class it {
|
|
|
339
339
|
n.width == null && (n.width = 80);
|
|
340
340
|
}), this.#r.applyAnimationConfig(e);
|
|
341
341
|
}
|
|
342
|
-
#
|
|
343
|
-
const e = this.#
|
|
342
|
+
#C() {
|
|
343
|
+
const e = this.#n ? { ...this.#n } : {}, o = Array.isArray(e.columns) ? [...e.columns] : [], n = (this.#d ?? []).map((s) => ({
|
|
344
344
|
...s
|
|
345
345
|
}));
|
|
346
|
-
let i =
|
|
346
|
+
let i = ue(
|
|
347
347
|
o,
|
|
348
348
|
n
|
|
349
349
|
);
|
|
350
|
-
this.#c && this.#c.length && (i =
|
|
350
|
+
this.#c && this.#c.length && (i = ue(
|
|
351
351
|
this.#c,
|
|
352
352
|
n
|
|
353
353
|
));
|
|
354
354
|
const r = this.#r.getRows();
|
|
355
|
-
return i.length === 0 && r.length && (i =
|
|
355
|
+
return i.length === 0 && r.length && (i = Ye(r).columns), i.length && (i.forEach((s) => {
|
|
356
356
|
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);
|
|
357
357
|
}), i.forEach((s) => {
|
|
358
|
-
s.__viewTemplate && !s.__compiledView && (s.__compiledView =
|
|
358
|
+
s.__viewTemplate && !s.__compiledView && (s.__compiledView = we(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = we(s.__editorTemplate.innerHTML));
|
|
359
359
|
}), e.columns = i), this.#f && (e.fitMode = this.#f), e.fitMode || (e.fitMode = "stretch"), this.#y(e), e.columnState && !this.#w && (this.#w = e.columnState), e;
|
|
360
360
|
}
|
|
361
361
|
#y(e) {
|
|
@@ -366,21 +366,21 @@ class it {
|
|
|
366
366
|
n?.length > 0 && (e.shell.header.lightDomContent = n), this.#r.getShellHasToolButtonsContainer() && (e.shell.header.hasToolButtonsContainer = !0);
|
|
367
367
|
const i = this.#r.getShellToolPanels();
|
|
368
368
|
if (i.size > 0) {
|
|
369
|
-
const
|
|
370
|
-
|
|
369
|
+
const u = Array.from(i.values());
|
|
370
|
+
u.sort((p, f) => (p.order ?? 100) - (f.order ?? 100)), e.shell.toolPanels = u;
|
|
371
371
|
}
|
|
372
372
|
const r = this.#r.getShellHeaderContents();
|
|
373
373
|
if (r.size > 0) {
|
|
374
|
-
const
|
|
375
|
-
|
|
374
|
+
const u = Array.from(r.values());
|
|
375
|
+
u.sort((p, f) => (p.order ?? 100) - (f.order ?? 100)), e.shell.headerContents = u;
|
|
376
376
|
}
|
|
377
|
-
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), c = this.#
|
|
378
|
-
for (const
|
|
379
|
-
a.has(
|
|
380
|
-
h.sort((
|
|
377
|
+
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), c = this.#n?.shell?.header?.toolbarContents ?? [], a = new Set(c.map((u) => u.id)), h = [...c];
|
|
378
|
+
for (const u of l)
|
|
379
|
+
a.has(u.id) || h.push(u);
|
|
380
|
+
h.sort((u, p) => (u.order ?? 0) - (p.order ?? 0)), e.shell.header.toolbarContents = h;
|
|
381
381
|
}
|
|
382
382
|
collectState(e) {
|
|
383
|
-
const o = this.columns, n = this.#
|
|
383
|
+
const o = this.columns, n = this.#v();
|
|
384
384
|
return {
|
|
385
385
|
columns: o.map((i, r) => {
|
|
386
386
|
const s = {
|
|
@@ -427,7 +427,7 @@ class it {
|
|
|
427
427
|
l.applyColumnState(c.field, c);
|
|
428
428
|
}
|
|
429
429
|
resetState(e) {
|
|
430
|
-
this.#w = void 0, this.#r.setSortState(null), this.#h = this.#A(this.#
|
|
430
|
+
this.#w = void 0, this.#r.setSortState(null), this.#h = this.#A(this.#i), this.#p();
|
|
431
431
|
for (const o of e)
|
|
432
432
|
if (o.applyColumnState)
|
|
433
433
|
for (const n of this.columns)
|
|
@@ -438,7 +438,7 @@ class it {
|
|
|
438
438
|
});
|
|
439
439
|
this.requestStateChange(e);
|
|
440
440
|
}
|
|
441
|
-
#
|
|
441
|
+
#v() {
|
|
442
442
|
const e = /* @__PURE__ */ new Map(), o = this.#r.getSortState();
|
|
443
443
|
return o && e.set(o.field, {
|
|
444
444
|
direction: o.direction === 1 ? "asc" : "desc",
|
|
@@ -450,7 +450,7 @@ class it {
|
|
|
450
450
|
this.#g = void 0;
|
|
451
451
|
const o = this.collectState(e);
|
|
452
452
|
this.#r.emit("column-state-change", o);
|
|
453
|
-
},
|
|
453
|
+
}, st);
|
|
454
454
|
}
|
|
455
455
|
setColumnVisible(e, o) {
|
|
456
456
|
const n = this.columns, i = n.find((s) => s.field === e);
|
|
@@ -498,7 +498,7 @@ class it {
|
|
|
498
498
|
this.columns = n, this.#r.renderHeader(), this.#r.updateTemplate(), this.#r.refreshVirtualWindow();
|
|
499
499
|
}
|
|
500
500
|
parseLightDomColumns(e) {
|
|
501
|
-
this.#d || (this.#s = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#s.length ?
|
|
501
|
+
this.#d || (this.#s = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#s.length ? Ge(e) : []);
|
|
502
502
|
}
|
|
503
503
|
clearLightDomCache() {
|
|
504
504
|
this.#d = void 0;
|
|
@@ -551,10 +551,10 @@ class it {
|
|
|
551
551
|
this.#l?.disconnect(), this.#m = [], this.#g && clearTimeout(this.#g);
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function He(t) {
|
|
555
555
|
return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "🗹" : "☐"}</span>`;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Oe(t) {
|
|
558
558
|
if (t == null || t === "") return "";
|
|
559
559
|
if (t instanceof Date)
|
|
560
560
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
|
|
@@ -564,7 +564,7 @@ function Pe(t) {
|
|
|
564
564
|
}
|
|
565
565
|
return "";
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function De(t) {
|
|
568
568
|
if (!t) return -1;
|
|
569
569
|
const e = t.getAttribute("data-row");
|
|
570
570
|
if (e) return parseInt(e, 10);
|
|
@@ -577,15 +577,15 @@ function Le(t) {
|
|
|
577
577
|
if (i[r] === o) return r;
|
|
578
578
|
return -1;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function at(t) {
|
|
581
581
|
if (!t) return -1;
|
|
582
582
|
const e = t.getAttribute("data-col");
|
|
583
583
|
return e ? parseInt(e, 10) : -1;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function ae(t) {
|
|
586
586
|
t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function Me(t, e) {
|
|
589
589
|
const o = e.renderer || e.viewRenderer;
|
|
590
590
|
if (o) return o;
|
|
591
591
|
if (!e.type) return;
|
|
@@ -599,194 +599,229 @@ function He(t, e) {
|
|
|
599
599
|
return r.renderer;
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
const
|
|
603
|
-
function
|
|
602
|
+
const ze = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
603
|
+
function ee(t) {
|
|
604
604
|
return (t.__editingCellCount ?? 0) > 0;
|
|
605
605
|
}
|
|
606
|
-
function
|
|
606
|
+
function te(t) {
|
|
607
607
|
t.__editingCellCount = 0, t.removeAttribute("data-has-editing"), t.querySelectorAll(".cell.editing").forEach((o) => o.classList.remove("editing"));
|
|
608
608
|
}
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
function
|
|
614
|
-
return
|
|
609
|
+
const Ne = document.createElement("template");
|
|
610
|
+
Ne.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
611
|
+
const ke = document.createElement("template");
|
|
612
|
+
ke.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
613
|
+
function ct() {
|
|
614
|
+
return Ne.content.firstElementChild.cloneNode(!0);
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
616
|
+
function dt() {
|
|
617
|
+
return ke.content.firstElementChild.cloneNode(!0);
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function X(t) {
|
|
620
620
|
t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function ht(t, e, o, n, i) {
|
|
623
623
|
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns, c = l.length;
|
|
624
624
|
let a = t.__cachedHeaderRowCount;
|
|
625
625
|
for (a === void 0 && (a = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = a); t._rowPool.length < r; ) {
|
|
626
|
-
const
|
|
627
|
-
t._rowPool.push(
|
|
626
|
+
const p = dt();
|
|
627
|
+
t._rowPool.push(p);
|
|
628
628
|
}
|
|
629
629
|
if (t._rowPool.length > r) {
|
|
630
|
-
for (let
|
|
631
|
-
const f = t._rowPool[
|
|
630
|
+
for (let p = r; p < t._rowPool.length; p++) {
|
|
631
|
+
const f = t._rowPool[p];
|
|
632
632
|
f.parentNode === s && f.remove();
|
|
633
633
|
}
|
|
634
634
|
t._rowPool.length = r;
|
|
635
635
|
}
|
|
636
|
-
const h = i && t.__hasRenderRowPlugins !== !1;
|
|
637
|
-
for (let
|
|
638
|
-
const f = e +
|
|
639
|
-
if (
|
|
640
|
-
|
|
636
|
+
const h = i && t.__hasRenderRowPlugins !== !1, u = t._hasAfterRowRenderHook?.() ?? !1;
|
|
637
|
+
for (let p = 0; p < r; p++) {
|
|
638
|
+
const f = e + p, g = t._rows[f], d = t._rowPool[p];
|
|
639
|
+
if (d.setAttribute("aria-rowindex", String(f + a + 1)), h && i(g, d, f)) {
|
|
640
|
+
d.__epoch = n, d.__rowDataRef = g, d.parentNode !== s && s.appendChild(d);
|
|
641
641
|
continue;
|
|
642
642
|
}
|
|
643
|
-
const
|
|
644
|
-
let
|
|
645
|
-
if (
|
|
646
|
-
for (let
|
|
647
|
-
if (l[
|
|
648
|
-
|
|
643
|
+
const w = d.__epoch, m = d.__rowDataRef, R = d.children.length, T = w === n && R === c, b = m !== g;
|
|
644
|
+
let y = !1;
|
|
645
|
+
if (T && b) {
|
|
646
|
+
for (let S = 0; S < c; S++)
|
|
647
|
+
if (l[S].externalView && !d.querySelector(`.cell[data-col="${S}"] [data-external-view]`)) {
|
|
648
|
+
y = !0;
|
|
649
649
|
break;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
if (!
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
} else if (
|
|
656
|
-
const
|
|
657
|
-
|
|
652
|
+
if (!T || y) {
|
|
653
|
+
const S = ee(d), P = t._activeEditRows === f;
|
|
654
|
+
S && !P ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), te(d), V(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : S && P ? (oe(t, d, g, f), d.__rowDataRef = g) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), V(t, d, g, f), d.__epoch = n, d.__rowDataRef = g);
|
|
655
|
+
} else if (b) {
|
|
656
|
+
const S = ee(d), P = t._activeEditRows === f;
|
|
657
|
+
S && !P ? (te(d), V(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : (oe(t, d, g, f), d.__rowDataRef = g);
|
|
658
658
|
} else {
|
|
659
|
-
const
|
|
660
|
-
|
|
659
|
+
const S = ee(d), P = t._activeEditRows === f;
|
|
660
|
+
S && !P ? (te(d), V(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : oe(t, d, g, f);
|
|
661
661
|
}
|
|
662
|
-
let
|
|
663
|
-
const
|
|
664
|
-
if (
|
|
662
|
+
let E = !1;
|
|
663
|
+
const C = t.changedRowIds;
|
|
664
|
+
if (C && C.length > 0)
|
|
665
665
|
try {
|
|
666
|
-
const
|
|
667
|
-
|
|
666
|
+
const S = t.getRowId?.(g);
|
|
667
|
+
S && (E = C.includes(S));
|
|
668
668
|
} catch {
|
|
669
669
|
}
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
const
|
|
673
|
-
if (
|
|
674
|
-
const
|
|
675
|
-
|
|
670
|
+
const _ = d.classList.contains("changed");
|
|
671
|
+
E !== _ && d.classList.toggle("changed", E);
|
|
672
|
+
const N = t.effectiveConfig?.rowClass;
|
|
673
|
+
if (N) {
|
|
674
|
+
const S = d.getAttribute("data-dynamic-classes");
|
|
675
|
+
S && S.split(" ").forEach((P) => P && d.classList.remove(P));
|
|
676
676
|
try {
|
|
677
|
-
const
|
|
678
|
-
if (
|
|
679
|
-
const
|
|
680
|
-
|
|
677
|
+
const P = N(g);
|
|
678
|
+
if (P && P.length > 0) {
|
|
679
|
+
const Q = P.filter((G) => G && typeof G == "string");
|
|
680
|
+
Q.forEach((G) => d.classList.add(G)), d.setAttribute("data-dynamic-classes", Q.join(" "));
|
|
681
681
|
} else
|
|
682
|
-
|
|
683
|
-
} catch (
|
|
684
|
-
console.warn("[tbw-grid] rowClass callback error:",
|
|
682
|
+
d.removeAttribute("data-dynamic-classes");
|
|
683
|
+
} catch (P) {
|
|
684
|
+
console.warn("[tbw-grid] rowClass callback error:", P), d.removeAttribute("data-dynamic-classes");
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
-
u
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
687
|
+
u && t._afterRowRender?.({
|
|
688
|
+
row: g,
|
|
689
|
+
rowIndex: f,
|
|
690
|
+
rowElement: d
|
|
691
|
+
}), d.parentNode !== s && s.appendChild(d);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
function oe(t, e, o, n) {
|
|
695
|
+
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length, c = s < l ? s : l, a = t._focusRow, h = t._focusCol, u = t._hasAfterCellRenderHook?.() ?? !1;
|
|
696
|
+
let p = t.__hasSpecialColumns;
|
|
697
|
+
if (p === void 0) {
|
|
698
|
+
p = !1;
|
|
699
|
+
const g = t.effectiveConfig?.typeDefaults, d = t.__frameworkAdapter;
|
|
700
|
+
for (let w = 0; w < s; w++) {
|
|
701
|
+
const m = r[w];
|
|
702
|
+
if (m.__viewTemplate || m.__compiledView || m.renderer || m.viewRenderer || m.externalView || m.format || m.type === "date" || m.type === "boolean" || m.type && g?.[m.type]?.renderer || m.type && d?.getTypeDefault?.(m.type)?.renderer) {
|
|
703
|
+
p = !0;
|
|
700
704
|
break;
|
|
701
705
|
}
|
|
702
706
|
}
|
|
703
|
-
t.__hasSpecialColumns =
|
|
707
|
+
t.__hasSpecialColumns = p;
|
|
704
708
|
}
|
|
705
709
|
const f = String(n);
|
|
706
|
-
if (!
|
|
707
|
-
for (let
|
|
708
|
-
const
|
|
709
|
-
if (
|
|
710
|
-
const g = o[
|
|
711
|
-
|
|
712
|
-
const
|
|
713
|
-
|
|
710
|
+
if (!p) {
|
|
711
|
+
for (let g = 0; g < c; g++) {
|
|
712
|
+
const d = i[g];
|
|
713
|
+
if (d.classList.contains("editing")) continue;
|
|
714
|
+
const w = r[g], m = o[w.field];
|
|
715
|
+
d.textContent = m == null ? "" : String(m), d.getAttribute("data-row") !== f && d.setAttribute("data-row", f);
|
|
716
|
+
const R = a === n && h === g, v = d.classList.contains("cell-focus");
|
|
717
|
+
R !== v && (d.classList.toggle("cell-focus", R), d.setAttribute("aria-selected", String(R))), u && t._afterCellRender?.({
|
|
718
|
+
row: o,
|
|
719
|
+
rowIndex: n,
|
|
720
|
+
column: w,
|
|
721
|
+
colIndex: g,
|
|
722
|
+
value: m,
|
|
723
|
+
cellElement: d,
|
|
724
|
+
rowElement: e
|
|
725
|
+
});
|
|
714
726
|
}
|
|
715
727
|
return;
|
|
716
728
|
}
|
|
717
|
-
for (let
|
|
718
|
-
if (r[
|
|
719
|
-
|
|
729
|
+
for (let g = 0; g < c; g++)
|
|
730
|
+
if (r[g].externalView && !i[g].querySelector("[data-external-view]")) {
|
|
731
|
+
V(t, e, o, n);
|
|
720
732
|
return;
|
|
721
733
|
}
|
|
722
|
-
for (let
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
const m = a === n && h ===
|
|
726
|
-
m !==
|
|
727
|
-
const
|
|
728
|
-
if (
|
|
729
|
-
const
|
|
730
|
-
|
|
734
|
+
for (let g = 0; g < c; g++) {
|
|
735
|
+
const d = r[g], w = i[g];
|
|
736
|
+
w.getAttribute("data-row") !== f && w.setAttribute("data-row", f);
|
|
737
|
+
const m = a === n && h === g, R = w.classList.contains("cell-focus");
|
|
738
|
+
m !== R && (w.classList.toggle("cell-focus", m), w.setAttribute("aria-selected", String(m)));
|
|
739
|
+
const v = d.cellClass;
|
|
740
|
+
if (v) {
|
|
741
|
+
const E = w.getAttribute("data-dynamic-classes");
|
|
742
|
+
E && E.split(" ").forEach((C) => C && w.classList.remove(C));
|
|
731
743
|
try {
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
const
|
|
735
|
-
|
|
744
|
+
const C = o[d.field], _ = v(C, o, d);
|
|
745
|
+
if (_ && _.length > 0) {
|
|
746
|
+
const N = _.filter((S) => S && typeof S == "string");
|
|
747
|
+
N.forEach((S) => w.classList.add(S)), w.setAttribute("data-dynamic-classes", N.join(" "));
|
|
736
748
|
} else
|
|
737
|
-
|
|
738
|
-
} catch (
|
|
739
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${
|
|
749
|
+
w.removeAttribute("data-dynamic-classes");
|
|
750
|
+
} catch (C) {
|
|
751
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`, C), w.removeAttribute("data-dynamic-classes");
|
|
740
752
|
}
|
|
741
753
|
}
|
|
742
|
-
if (
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
const
|
|
746
|
-
|
|
754
|
+
if (w.classList.contains("editing")) continue;
|
|
755
|
+
const T = Me(t, d);
|
|
756
|
+
if (T) {
|
|
757
|
+
const E = o[d.field], C = T({
|
|
758
|
+
row: o,
|
|
759
|
+
value: E,
|
|
760
|
+
field: d.field,
|
|
761
|
+
column: d,
|
|
762
|
+
cellEl: w
|
|
763
|
+
});
|
|
764
|
+
typeof C == "string" ? w.innerHTML = K(C) : C instanceof Node ? C.parentElement !== w && (w.innerHTML = "", w.appendChild(C)) : C == null && (w.textContent = E == null ? "" : String(E)), u && t._afterCellRender?.({
|
|
765
|
+
row: o,
|
|
766
|
+
rowIndex: n,
|
|
767
|
+
column: d,
|
|
768
|
+
colIndex: g,
|
|
769
|
+
value: E,
|
|
770
|
+
cellElement: w,
|
|
771
|
+
rowElement: e
|
|
772
|
+
});
|
|
747
773
|
continue;
|
|
748
774
|
}
|
|
749
|
-
if (
|
|
775
|
+
if (d.__viewTemplate || d.__compiledView || d.externalView)
|
|
750
776
|
continue;
|
|
751
|
-
const
|
|
752
|
-
let
|
|
753
|
-
if (
|
|
777
|
+
const b = o[d.field];
|
|
778
|
+
let y;
|
|
779
|
+
if (d.format)
|
|
754
780
|
try {
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
} catch (
|
|
758
|
-
console.warn(`[tbw-grid] Format error in column '${
|
|
781
|
+
const E = d.format(b, o);
|
|
782
|
+
y = E == null ? "" : String(E);
|
|
783
|
+
} catch (E) {
|
|
784
|
+
console.warn(`[tbw-grid] Format error in column '${d.field}':`, E), y = b == null ? "" : String(b);
|
|
759
785
|
}
|
|
760
|
-
else
|
|
786
|
+
else d.type === "date" ? (y = Oe(b), w.textContent = y) : d.type === "boolean" ? w.innerHTML = He(!!b) : (y = b == null ? "" : String(b), w.textContent = y);
|
|
787
|
+
u && t._afterCellRender?.({
|
|
788
|
+
row: o,
|
|
789
|
+
rowIndex: n,
|
|
790
|
+
column: d,
|
|
791
|
+
colIndex: g,
|
|
792
|
+
value: b,
|
|
793
|
+
cellElement: w,
|
|
794
|
+
rowElement: e
|
|
795
|
+
});
|
|
761
796
|
}
|
|
762
797
|
}
|
|
763
|
-
function
|
|
798
|
+
function V(t, e, o, n) {
|
|
764
799
|
e.innerHTML = "";
|
|
765
|
-
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol, c = t, a = document.createDocumentFragment();
|
|
766
|
-
for (let
|
|
767
|
-
const
|
|
768
|
-
f.setAttribute("aria-colindex", String(
|
|
769
|
-
let
|
|
770
|
-
if (
|
|
800
|
+
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol, c = t, a = t._hasAfterCellRenderHook?.() ?? !1, h = document.createDocumentFragment();
|
|
801
|
+
for (let u = 0; u < r; u++) {
|
|
802
|
+
const p = i[u], f = ct();
|
|
803
|
+
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);
|
|
804
|
+
let g = o[p.field];
|
|
805
|
+
if (p.format)
|
|
771
806
|
try {
|
|
772
|
-
|
|
773
|
-
} catch (
|
|
774
|
-
console.warn(`[tbw-grid] Format error in column '${
|
|
807
|
+
g = p.format(g, o);
|
|
808
|
+
} catch (b) {
|
|
809
|
+
console.warn(`[tbw-grid] Format error in column '${p.field}':`, b);
|
|
775
810
|
}
|
|
776
|
-
const
|
|
777
|
-
let
|
|
811
|
+
const d = p.__compiledView, w = p.__viewTemplate, m = Me(t, p), R = p.externalView;
|
|
812
|
+
let v = !1;
|
|
778
813
|
if (m) {
|
|
779
|
-
const
|
|
780
|
-
typeof
|
|
781
|
-
} else if (
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
if (
|
|
814
|
+
const b = m({ row: o, value: g, field: p.field, column: p, cellEl: f });
|
|
815
|
+
typeof b == "string" ? (f.innerHTML = K(b), v = !0) : b instanceof Node ? b.parentElement !== f && (f.textContent = "", f.appendChild(b)) : b == null && (f.textContent = g == null ? "" : String(g));
|
|
816
|
+
} else if (R) {
|
|
817
|
+
const b = R, y = document.createElement("div");
|
|
818
|
+
y.setAttribute("data-external-view", ""), y.setAttribute("data-field", p.field), f.appendChild(y);
|
|
819
|
+
const E = { row: o, value: g, field: p.field, column: p };
|
|
820
|
+
if (b.mount)
|
|
786
821
|
try {
|
|
787
|
-
|
|
788
|
-
} catch (
|
|
789
|
-
console.warn(`[tbw-grid] External view mount error for column '${
|
|
822
|
+
b.mount({ placeholder: y, context: E, spec: b });
|
|
823
|
+
} catch (C) {
|
|
824
|
+
console.warn(`[tbw-grid] External view mount error for column '${p.field}':`, C);
|
|
790
825
|
}
|
|
791
826
|
else
|
|
792
827
|
queueMicrotask(() => {
|
|
@@ -795,46 +830,54 @@ function U(t, e, o, n) {
|
|
|
795
830
|
new CustomEvent("mount-external-view", {
|
|
796
831
|
bubbles: !0,
|
|
797
832
|
composed: !0,
|
|
798
|
-
detail: { placeholder:
|
|
833
|
+
detail: { placeholder: y, spec: b, context: E }
|
|
799
834
|
})
|
|
800
835
|
);
|
|
801
|
-
} catch (
|
|
802
|
-
console.warn(`[tbw-grid] External view event dispatch error for column '${
|
|
836
|
+
} catch (C) {
|
|
837
|
+
console.warn(`[tbw-grid] External view event dispatch error for column '${p.field}':`, C);
|
|
803
838
|
}
|
|
804
839
|
});
|
|
805
|
-
|
|
806
|
-
} else if (
|
|
807
|
-
const
|
|
808
|
-
f.innerHTML =
|
|
809
|
-
} else if (
|
|
810
|
-
const
|
|
811
|
-
/Reflect\.|\bProxy\b|ownKeys\(/.test(
|
|
840
|
+
y.setAttribute("data-mounted", "");
|
|
841
|
+
} else if (d) {
|
|
842
|
+
const b = d({ row: o, value: g, field: p.field, column: p }), y = d.__blocked;
|
|
843
|
+
f.innerHTML = y ? "" : K(b), v = !0, y && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
|
|
844
|
+
} else if (w) {
|
|
845
|
+
const b = w.innerHTML;
|
|
846
|
+
/Reflect\.|\bProxy\b|ownKeys\(/.test(b) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = K(Le(b, { row: o, value: g })), v = !0);
|
|
812
847
|
} else
|
|
813
|
-
|
|
814
|
-
if (
|
|
815
|
-
|
|
816
|
-
const
|
|
817
|
-
/Proxy|Reflect\.ownKeys/.test(
|
|
818
|
-
}
|
|
819
|
-
f.hasAttribute("data-blocked-template") && (f.textContent || "").trim().length && (f.textContent = ""),
|
|
820
|
-
const
|
|
821
|
-
if (
|
|
848
|
+
p.type === "date" ? f.textContent = Oe(g) : p.type === "boolean" ? f.innerHTML = He(!!g) : f.textContent = g == null ? "" : String(g);
|
|
849
|
+
if (v) {
|
|
850
|
+
rt(f);
|
|
851
|
+
const b = f.textContent || "";
|
|
852
|
+
/Proxy|Reflect\.ownKeys/.test(b) && (f.textContent = b.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
|
|
853
|
+
}
|
|
854
|
+
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");
|
|
855
|
+
const T = p.cellClass;
|
|
856
|
+
if (T)
|
|
822
857
|
try {
|
|
823
|
-
const
|
|
824
|
-
if (
|
|
825
|
-
const
|
|
826
|
-
|
|
858
|
+
const b = o[p.field], y = T(b, o, p);
|
|
859
|
+
if (y && y.length > 0) {
|
|
860
|
+
const E = y.filter((C) => C && typeof C == "string");
|
|
861
|
+
E.forEach((C) => f.classList.add(C)), f.setAttribute("data-dynamic-classes", E.join(" "));
|
|
827
862
|
}
|
|
828
|
-
} catch (
|
|
829
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${
|
|
863
|
+
} catch (b) {
|
|
864
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${p.field}':`, b);
|
|
830
865
|
}
|
|
831
|
-
a.
|
|
832
|
-
|
|
833
|
-
|
|
866
|
+
a && t._afterCellRender?.({
|
|
867
|
+
row: o,
|
|
868
|
+
rowIndex: n,
|
|
869
|
+
column: p,
|
|
870
|
+
colIndex: u,
|
|
871
|
+
value: g,
|
|
872
|
+
cellElement: f,
|
|
873
|
+
rowElement: e
|
|
874
|
+
}), h.appendChild(f);
|
|
875
|
+
}
|
|
876
|
+
e.appendChild(h);
|
|
834
877
|
}
|
|
835
|
-
function
|
|
878
|
+
function me(t, e, o) {
|
|
836
879
|
if (e.target?.closest(".resize-handle")) return;
|
|
837
|
-
const n = o.querySelector(".cell[data-row]"), i =
|
|
880
|
+
const n = o.querySelector(".cell[data-row]"), i = De(n);
|
|
838
881
|
if (i < 0) return;
|
|
839
882
|
const r = t._rows[i];
|
|
840
883
|
if (!r || t._dispatchRowClick?.(e, i, r, o))
|
|
@@ -847,30 +890,30 @@ function pe(t, e, o) {
|
|
|
847
890
|
return;
|
|
848
891
|
const c = t._focusRow !== i || t._focusCol !== l;
|
|
849
892
|
if (t._focusRow = i, t._focusCol = l, s.classList.contains("editing")) {
|
|
850
|
-
c && (
|
|
851
|
-
const a = s.querySelector(
|
|
893
|
+
c && (ae(t._bodyEl ?? t), s.classList.add("cell-focus"));
|
|
894
|
+
const a = s.querySelector(ze);
|
|
852
895
|
try {
|
|
853
896
|
a?.focus({ preventScroll: !0 });
|
|
854
897
|
} catch {
|
|
855
898
|
}
|
|
856
899
|
return;
|
|
857
900
|
}
|
|
858
|
-
|
|
901
|
+
$(t);
|
|
859
902
|
}
|
|
860
903
|
}
|
|
861
904
|
}
|
|
862
|
-
function
|
|
905
|
+
function ut(t, e) {
|
|
863
906
|
if (t._dispatchKeyDown?.(e))
|
|
864
907
|
return;
|
|
865
908
|
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?.() ?? [], c = l.length ? l[0] : e.target, a = (h) => {
|
|
866
909
|
if (!h) return !1;
|
|
867
|
-
const
|
|
868
|
-
return !!(
|
|
910
|
+
const u = h.tagName;
|
|
911
|
+
return !!(u === "INPUT" || u === "SELECT" || u === "TEXTAREA" || h.isContentEditable);
|
|
869
912
|
};
|
|
870
913
|
if (!(a(c) && (e.key === "Home" || e.key === "End")) && !(a(c) && (e.key === "ArrowUp" || e.key === "ArrowDown") && c.tagName === "INPUT" && c.type === "number") && !(a(c) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) && !(a(c) && (e.key === "Enter" || e.key === "Escape")) && !(i && s === "select" && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
|
|
871
914
|
switch (e.key) {
|
|
872
915
|
case "Tab": {
|
|
873
|
-
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),
|
|
916
|
+
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);
|
|
874
917
|
return;
|
|
875
918
|
}
|
|
876
919
|
case "ArrowDown":
|
|
@@ -886,10 +929,10 @@ function ct(t, e) {
|
|
|
886
929
|
t._focusCol = Math.max(0, t._focusCol - 1), e.preventDefault();
|
|
887
930
|
break;
|
|
888
931
|
case "Home":
|
|
889
|
-
(e.ctrlKey || e.metaKey) && (i && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(),
|
|
932
|
+
(e.ctrlKey || e.metaKey) && (i && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(), $(t, { forceScrollLeft: !0 });
|
|
890
933
|
return;
|
|
891
934
|
case "End":
|
|
892
|
-
(e.ctrlKey || e.metaKey) && (i && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = o), t._focusCol = n, e.preventDefault(),
|
|
935
|
+
(e.ctrlKey || e.metaKey) && (i && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = o), t._focusCol = n, e.preventDefault(), $(t, { forceScrollRight: !0 });
|
|
893
936
|
return;
|
|
894
937
|
case "PageDown":
|
|
895
938
|
t._focusRow = Math.min(o, t._focusRow + 20), e.preventDefault();
|
|
@@ -898,27 +941,27 @@ function ct(t, e) {
|
|
|
898
941
|
t._focusRow = Math.max(0, t._focusRow - 20), e.preventDefault();
|
|
899
942
|
break;
|
|
900
943
|
case "Enter": {
|
|
901
|
-
const h = t._focusRow,
|
|
902
|
-
`[data-row="${h}"][data-col="${
|
|
903
|
-
),
|
|
944
|
+
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(
|
|
945
|
+
`[data-row="${h}"][data-col="${u}"]`
|
|
946
|
+
), m = {
|
|
904
947
|
rowIndex: h,
|
|
905
|
-
colIndex:
|
|
906
|
-
field:
|
|
907
|
-
value:
|
|
908
|
-
row:
|
|
909
|
-
cellEl:
|
|
948
|
+
colIndex: u,
|
|
949
|
+
field: g,
|
|
950
|
+
value: d,
|
|
951
|
+
row: f,
|
|
952
|
+
cellEl: w,
|
|
910
953
|
trigger: "keyboard",
|
|
911
954
|
originalEvent: e
|
|
912
955
|
}, R = new CustomEvent("cell-activate", {
|
|
913
956
|
cancelable: !0,
|
|
914
|
-
detail:
|
|
957
|
+
detail: m
|
|
915
958
|
});
|
|
916
959
|
t.dispatchEvent(R);
|
|
917
|
-
const
|
|
960
|
+
const v = new CustomEvent("activate-cell", {
|
|
918
961
|
cancelable: !0,
|
|
919
|
-
detail: { row: h, col:
|
|
962
|
+
detail: { row: h, col: u }
|
|
920
963
|
});
|
|
921
|
-
if (t.dispatchEvent(
|
|
964
|
+
if (t.dispatchEvent(v), R.defaultPrevented || v.defaultPrevented) {
|
|
922
965
|
e.preventDefault();
|
|
923
966
|
return;
|
|
924
967
|
}
|
|
@@ -927,19 +970,19 @@ function ct(t, e) {
|
|
|
927
970
|
default:
|
|
928
971
|
return;
|
|
929
972
|
}
|
|
930
|
-
|
|
973
|
+
$(t);
|
|
931
974
|
}
|
|
932
975
|
}
|
|
933
|
-
function
|
|
976
|
+
function $(t, e) {
|
|
934
977
|
if (t._virtualization?.enabled) {
|
|
935
978
|
const { rowHeight: s, container: l, viewportEl: c } = t._virtualization, a = l, h = c?.clientHeight ?? a?.clientHeight ?? 0;
|
|
936
979
|
if (a && h > 0) {
|
|
937
|
-
const
|
|
938
|
-
|
|
980
|
+
const u = t._focusRow * s;
|
|
981
|
+
u < a.scrollTop ? a.scrollTop = u : u + s > a.scrollTop + h && (a.scrollTop = u - h + s);
|
|
939
982
|
}
|
|
940
983
|
}
|
|
941
984
|
const o = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
942
|
-
o || t.refreshVirtualWindow(!1),
|
|
985
|
+
o || t.refreshVirtualWindow(!1), ae(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
943
986
|
s.setAttribute("aria-selected", "false");
|
|
944
987
|
});
|
|
945
988
|
const n = t._focusRow, i = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
|
|
@@ -957,12 +1000,12 @@ function W(t, e) {
|
|
|
957
1000
|
else {
|
|
958
1001
|
const a = t._getHorizontalScrollOffsets?.(s ?? void 0, l) ?? { left: 0, right: 0 };
|
|
959
1002
|
if (!a.skipScroll) {
|
|
960
|
-
const h = l.getBoundingClientRect(),
|
|
961
|
-
|
|
1003
|
+
const h = l.getBoundingClientRect(), u = c.getBoundingClientRect(), p = h.left - u.left + c.scrollLeft, f = p + h.width, g = c.scrollLeft + a.left, d = c.scrollLeft + c.clientWidth - a.right;
|
|
1004
|
+
p < g ? c.scrollLeft = p - a.left : f > d && (c.scrollLeft = f - c.clientWidth + a.right);
|
|
962
1005
|
}
|
|
963
1006
|
}
|
|
964
1007
|
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
|
|
965
|
-
const a = l.querySelector(
|
|
1008
|
+
const a = l.querySelector(ze);
|
|
966
1009
|
if (a && document.activeElement !== a)
|
|
967
1010
|
try {
|
|
968
1011
|
a.focus({ preventScroll: !0 });
|
|
@@ -978,28 +1021,28 @@ function W(t, e) {
|
|
|
978
1021
|
}
|
|
979
1022
|
}
|
|
980
1023
|
}
|
|
981
|
-
const
|
|
982
|
-
function
|
|
983
|
-
const o =
|
|
984
|
-
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n,
|
|
1024
|
+
const Z = /* @__PURE__ */ new WeakMap();
|
|
1025
|
+
function ft(t, e) {
|
|
1026
|
+
const o = De(e), n = at(e);
|
|
1027
|
+
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n, ae(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
|
|
985
1028
|
}
|
|
986
|
-
function
|
|
1029
|
+
function ce(t, e, o, n) {
|
|
987
1030
|
let i = null;
|
|
988
1031
|
const r = o.composedPath?.();
|
|
989
1032
|
if (r && r.length > 0 ? i = r[0] : i = o.target, i && !e.contains(i)) {
|
|
990
|
-
const
|
|
991
|
-
|
|
1033
|
+
const d = document.elementFromPoint(o.clientX, o.clientY);
|
|
1034
|
+
d && (i = d);
|
|
992
1035
|
}
|
|
993
1036
|
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"), c = i?.closest?.(".header-row");
|
|
994
|
-
let a, h,
|
|
995
|
-
return s && (a = parseInt(s.getAttribute("data-row") ?? "-1", 10), h = parseInt(s.getAttribute("data-col") ?? "-1", 10), a >= 0 && h >= 0 && (
|
|
1037
|
+
let a, h, u, p, f, g;
|
|
1038
|
+
return s && (a = parseInt(s.getAttribute("data-row") ?? "-1", 10), h = parseInt(s.getAttribute("data-col") ?? "-1", 10), a >= 0 && h >= 0 && (u = t._rows[a], g = t._columns[h], p = g?.field, f = u && p ? u[p] : void 0)), {
|
|
996
1039
|
type: n,
|
|
997
|
-
row:
|
|
1040
|
+
row: u,
|
|
998
1041
|
rowIndex: a !== void 0 && a >= 0 ? a : void 0,
|
|
999
1042
|
colIndex: h !== void 0 && h >= 0 ? h : void 0,
|
|
1000
|
-
field:
|
|
1001
|
-
value:
|
|
1002
|
-
column:
|
|
1043
|
+
field: p,
|
|
1044
|
+
value: f,
|
|
1045
|
+
column: g,
|
|
1003
1046
|
originalEvent: o,
|
|
1004
1047
|
cellElement: s ?? void 0,
|
|
1005
1048
|
rowElement: l ?? void 0,
|
|
@@ -1007,82 +1050,82 @@ function le(t, e, o, n) {
|
|
|
1007
1050
|
cell: a !== void 0 && h !== void 0 && a >= 0 && h >= 0 ? { row: a, col: h } : void 0
|
|
1008
1051
|
};
|
|
1009
1052
|
}
|
|
1010
|
-
function
|
|
1011
|
-
const n =
|
|
1012
|
-
(t._dispatchCellMouseDown?.(n) ?? !1) &&
|
|
1053
|
+
function pt(t, e, o) {
|
|
1054
|
+
const n = ce(t, e, o, "mousedown");
|
|
1055
|
+
(t._dispatchCellMouseDown?.(n) ?? !1) && Z.set(t, !0);
|
|
1013
1056
|
}
|
|
1014
|
-
function
|
|
1015
|
-
if (!
|
|
1016
|
-
const n =
|
|
1057
|
+
function gt(t, e, o) {
|
|
1058
|
+
if (!Z.get(t)) return;
|
|
1059
|
+
const n = ce(t, e, o, "mousemove");
|
|
1017
1060
|
t._dispatchCellMouseMove?.(n);
|
|
1018
1061
|
}
|
|
1019
|
-
function
|
|
1020
|
-
if (!
|
|
1021
|
-
const n =
|
|
1022
|
-
t._dispatchCellMouseUp?.(n),
|
|
1062
|
+
function wt(t, e, o) {
|
|
1063
|
+
if (!Z.get(t)) return;
|
|
1064
|
+
const n = ce(t, e, o, "mouseup");
|
|
1065
|
+
t._dispatchCellMouseUp?.(n), Z.set(t, !1);
|
|
1023
1066
|
}
|
|
1024
|
-
function
|
|
1067
|
+
function mt(t, e, o) {
|
|
1025
1068
|
e.addEventListener(
|
|
1026
1069
|
"mousedown",
|
|
1027
1070
|
(n) => {
|
|
1028
1071
|
const i = n.target.closest(".cell[data-col]");
|
|
1029
|
-
i && (i.classList.contains("editing") ||
|
|
1072
|
+
i && (i.classList.contains("editing") || ft(t, i));
|
|
1030
1073
|
},
|
|
1031
1074
|
{ signal: o }
|
|
1032
1075
|
), e.addEventListener(
|
|
1033
1076
|
"click",
|
|
1034
1077
|
(n) => {
|
|
1035
1078
|
const i = n.target.closest(".data-grid-row");
|
|
1036
|
-
i &&
|
|
1079
|
+
i && me(t, n, i);
|
|
1037
1080
|
},
|
|
1038
1081
|
{ signal: o }
|
|
1039
1082
|
), e.addEventListener(
|
|
1040
1083
|
"dblclick",
|
|
1041
1084
|
(n) => {
|
|
1042
1085
|
const i = n.target.closest(".data-grid-row");
|
|
1043
|
-
i &&
|
|
1086
|
+
i && me(t, n, i);
|
|
1044
1087
|
},
|
|
1045
1088
|
{ signal: o }
|
|
1046
1089
|
);
|
|
1047
1090
|
}
|
|
1048
|
-
function
|
|
1049
|
-
e.addEventListener("keydown", (i) =>
|
|
1091
|
+
function bt(t, e, o, n) {
|
|
1092
|
+
e.addEventListener("keydown", (i) => ut(t, i), { signal: n }), o.addEventListener("mousedown", (i) => pt(t, o, i), { signal: n }), document.addEventListener("mousemove", (i) => gt(t, o, i), { signal: n }), document.addEventListener("mouseup", (i) => wt(t, o, i), { signal: n });
|
|
1050
1093
|
}
|
|
1051
|
-
function
|
|
1094
|
+
function vt(t, e) {
|
|
1052
1095
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1053
1096
|
}
|
|
1054
|
-
function
|
|
1055
|
-
const i = o.find((l) => l.field === e.field)?.sortComparator ??
|
|
1097
|
+
function Ct(t, e, o) {
|
|
1098
|
+
const i = o.find((l) => l.field === e.field)?.sortComparator ?? vt, { field: r, direction: s } = e;
|
|
1056
1099
|
return [...t].sort((l, c) => i(l[r], c[r], l, c) * s);
|
|
1057
1100
|
}
|
|
1058
|
-
function
|
|
1059
|
-
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1),
|
|
1101
|
+
function be(t, e, o, n) {
|
|
1102
|
+
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1), J(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1060
1103
|
new CustomEvent("sort-change", { detail: { field: o.field, direction: n } })
|
|
1061
1104
|
), t.requestStateChange?.();
|
|
1062
1105
|
}
|
|
1063
|
-
function
|
|
1064
|
-
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()),
|
|
1106
|
+
function ve(t, e) {
|
|
1107
|
+
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), Ce(t, e, 1)) : t._sortState.direction === 1 ? Ce(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), t._rows = t.__originalOrder.slice(), J(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((n) => {
|
|
1065
1108
|
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");
|
|
1066
1109
|
}), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1067
1110
|
new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
|
|
1068
1111
|
), t.requestStateChange?.());
|
|
1069
1112
|
}
|
|
1070
|
-
function
|
|
1113
|
+
function Ce(t, e, o) {
|
|
1071
1114
|
t._sortState = { field: e.field, direction: o };
|
|
1072
|
-
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ??
|
|
1115
|
+
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ?? Ct)(t._rows, n, i);
|
|
1073
1116
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1074
|
-
|
|
1075
|
-
}) :
|
|
1117
|
+
be(t, l, e, o);
|
|
1118
|
+
}) : be(t, s, e, o);
|
|
1076
1119
|
}
|
|
1077
|
-
function
|
|
1120
|
+
function yt(t, e) {
|
|
1078
1121
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1079
1122
|
}
|
|
1080
|
-
function
|
|
1123
|
+
function J(t) {
|
|
1081
1124
|
t._headerRowEl = t.findHeaderRow();
|
|
1082
1125
|
const e = t._headerRowEl;
|
|
1083
1126
|
e && (e.innerHTML = "", t._visibleColumns.forEach((o, n) => {
|
|
1084
1127
|
const i = document.createElement("div");
|
|
1085
|
-
i.className = "cell",
|
|
1128
|
+
i.className = "cell", fe(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));
|
|
1086
1129
|
const r = o.__headerTemplate;
|
|
1087
1130
|
if (r) Array.from(r.childNodes).forEach((s) => i.appendChild(s.cloneNode(!0)));
|
|
1088
1131
|
else {
|
|
@@ -1092,14 +1135,14 @@ function Z(t) {
|
|
|
1092
1135
|
if (o.sortable) {
|
|
1093
1136
|
i.classList.add("sortable"), i.tabIndex = 0;
|
|
1094
1137
|
const s = document.createElement("span");
|
|
1095
|
-
|
|
1096
|
-
const l = t._sortState?.field === o.field ? t._sortState.direction : 0, c = { ...
|
|
1097
|
-
|
|
1098
|
-
t._resizeController?.isResizing || t._dispatchHeaderClick?.(h, n, i) ||
|
|
1138
|
+
fe(s, "sort-indicator");
|
|
1139
|
+
const l = t._sortState?.field === o.field ? t._sortState.direction : 0, c = { ...z, ...t.icons }, a = l === 1 ? c.sortAsc : l === -1 ? c.sortDesc : c.sortNone;
|
|
1140
|
+
yt(s, a), i.appendChild(s), i.setAttribute("aria-sort", l === 0 ? "none" : l === 1 ? "ascending" : "descending"), i.addEventListener("click", (h) => {
|
|
1141
|
+
t._resizeController?.isResizing || t._dispatchHeaderClick?.(h, n, i) || ve(t, o);
|
|
1099
1142
|
}), i.addEventListener("keydown", (h) => {
|
|
1100
1143
|
if (h.key === "Enter" || h.key === " ") {
|
|
1101
1144
|
if (h.preventDefault(), t._dispatchHeaderClick?.(h, n, i)) return;
|
|
1102
|
-
|
|
1145
|
+
ve(t, o);
|
|
1103
1146
|
}
|
|
1104
1147
|
});
|
|
1105
1148
|
}
|
|
@@ -1117,9 +1160,9 @@ function Z(t) {
|
|
|
1117
1160
|
o.getAttribute("aria-sort") || o.setAttribute("aria-sort", "none");
|
|
1118
1161
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
|
|
1119
1162
|
}
|
|
1120
|
-
const
|
|
1121
|
-
function
|
|
1122
|
-
return
|
|
1163
|
+
const Ie = typeof requestIdleCallback == "function";
|
|
1164
|
+
function _t(t, e) {
|
|
1165
|
+
return Ie ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1123
1166
|
const o = Date.now();
|
|
1124
1167
|
t({
|
|
1125
1168
|
didTimeout: !1,
|
|
@@ -1127,20 +1170,20 @@ function Ct(t, e) {
|
|
|
1127
1170
|
});
|
|
1128
1171
|
}, 1);
|
|
1129
1172
|
}
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1173
|
+
function ye(t) {
|
|
1174
|
+
Ie ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1132
1175
|
}
|
|
1133
1176
|
var x = ((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))(x || {});
|
|
1134
|
-
class
|
|
1135
|
-
#
|
|
1177
|
+
class Et {
|
|
1178
|
+
#n;
|
|
1136
1179
|
#c = 0;
|
|
1137
1180
|
#f = 0;
|
|
1138
1181
|
#d = null;
|
|
1139
1182
|
#s = null;
|
|
1140
|
-
#
|
|
1183
|
+
#i = null;
|
|
1141
1184
|
#h = !1;
|
|
1142
1185
|
constructor(e) {
|
|
1143
|
-
this.#
|
|
1186
|
+
this.#n = e;
|
|
1144
1187
|
}
|
|
1145
1188
|
requestPhase(e, o) {
|
|
1146
1189
|
e > this.#c && (this.#c = e), this.#f === 0 && (this.#u(), this.#f = requestAnimationFrame(() => this.#m()));
|
|
@@ -1149,7 +1192,7 @@ class vt {
|
|
|
1149
1192
|
return this.#d ? this.#d : Promise.resolve();
|
|
1150
1193
|
}
|
|
1151
1194
|
setInitialReadyResolver(e) {
|
|
1152
|
-
this.#
|
|
1195
|
+
this.#i = e;
|
|
1153
1196
|
}
|
|
1154
1197
|
cancel() {
|
|
1155
1198
|
this.#f !== 0 && (cancelAnimationFrame(this.#f), this.#f = 0), this.#c = 0, this.#s && (this.#s(), this.#s = null, this.#d = null);
|
|
@@ -1166,23 +1209,23 @@ class vt {
|
|
|
1166
1209
|
}));
|
|
1167
1210
|
}
|
|
1168
1211
|
#m() {
|
|
1169
|
-
if (this.#f = 0, !this.#
|
|
1212
|
+
if (this.#f = 0, !this.#n.isConnected()) {
|
|
1170
1213
|
this.#c = 0, this.#s && (this.#s(), this.#s = null, this.#d = null);
|
|
1171
1214
|
return;
|
|
1172
1215
|
}
|
|
1173
1216
|
const e = this.#c;
|
|
1174
|
-
this.#c = 0, e >= 5 && this.#
|
|
1217
|
+
this.#c = 0, e >= 5 && this.#n.mergeConfig(), e >= 4 && this.#n.processRows(), e >= 5 && (this.#n.processColumns(), this.#n.updateTemplate()), e >= 3 && this.#n.renderHeader(), e >= 2 && this.#n.renderVirtualWindow(), e >= 1 && this.#n.afterRender(), !this.#h && this.#i && (this.#h = !0, this.#i()), this.#s && (this.#s(), this.#s = null, this.#d = null);
|
|
1175
1218
|
}
|
|
1176
1219
|
}
|
|
1177
|
-
function
|
|
1220
|
+
function _e(t) {
|
|
1178
1221
|
let e = null, o = null, n = null, i = null;
|
|
1179
1222
|
const r = (c) => {
|
|
1180
1223
|
if (!e) return;
|
|
1181
|
-
const a = c.clientX - e.startX, h = Math.max(40, e.startWidth + a),
|
|
1182
|
-
|
|
1224
|
+
const a = c.clientX - e.startX, h = Math.max(40, e.startWidth + a), u = t._visibleColumns[e.colIndex];
|
|
1225
|
+
u.width = h, u.__userResized = !0, u.__renderedWidth = h, o == null && (o = requestAnimationFrame(() => {
|
|
1183
1226
|
o = null, t.updateTemplate?.();
|
|
1184
1227
|
})), t.dispatchEvent(
|
|
1185
|
-
new CustomEvent("column-resize", { detail: { field:
|
|
1228
|
+
new CustomEvent("column-resize", { detail: { field: u.field, width: h } })
|
|
1186
1229
|
);
|
|
1187
1230
|
};
|
|
1188
1231
|
let s = !1;
|
|
@@ -1198,8 +1241,8 @@ function Ce(t) {
|
|
|
1198
1241
|
},
|
|
1199
1242
|
start(c, a, h) {
|
|
1200
1243
|
c.preventDefault();
|
|
1201
|
-
const
|
|
1202
|
-
e = { startX: c.clientX, colIndex: a, startWidth:
|
|
1244
|
+
const u = t._visibleColumns[a], p = typeof u?.width == "number" ? u.width : void 0, f = u?.__renderedWidth ?? p ?? h.getBoundingClientRect().width;
|
|
1245
|
+
e = { startX: c.clientX, colIndex: a, 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";
|
|
1203
1246
|
},
|
|
1204
1247
|
resetColumn(c) {
|
|
1205
1248
|
const a = t._visibleColumns[c];
|
|
@@ -1212,7 +1255,55 @@ function Ce(t) {
|
|
|
1212
1255
|
}
|
|
1213
1256
|
};
|
|
1214
1257
|
}
|
|
1215
|
-
|
|
1258
|
+
const ne = "data-animating", St = {
|
|
1259
|
+
change: "--tbw-row-change-duration",
|
|
1260
|
+
insert: "--tbw-row-insert-duration",
|
|
1261
|
+
remove: "--tbw-row-remove-duration"
|
|
1262
|
+
}, Rt = {
|
|
1263
|
+
change: 500,
|
|
1264
|
+
insert: 300,
|
|
1265
|
+
remove: 200
|
|
1266
|
+
};
|
|
1267
|
+
function Tt(t) {
|
|
1268
|
+
const e = t.trim().toLowerCase();
|
|
1269
|
+
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
1270
|
+
}
|
|
1271
|
+
function xt(t, e) {
|
|
1272
|
+
const o = St[e], n = getComputedStyle(t).getPropertyValue(o);
|
|
1273
|
+
if (n) {
|
|
1274
|
+
const i = Tt(n);
|
|
1275
|
+
if (!isNaN(i) && i > 0)
|
|
1276
|
+
return i;
|
|
1277
|
+
}
|
|
1278
|
+
return Rt[e];
|
|
1279
|
+
}
|
|
1280
|
+
function At(t, e, o) {
|
|
1281
|
+
t.removeAttribute(ne), t.offsetWidth, t.setAttribute(ne, e);
|
|
1282
|
+
const n = xt(t, e);
|
|
1283
|
+
setTimeout(() => {
|
|
1284
|
+
e !== "remove" && t.removeAttribute(ne);
|
|
1285
|
+
}, n);
|
|
1286
|
+
}
|
|
1287
|
+
function de(t, e, o) {
|
|
1288
|
+
if (e < 0)
|
|
1289
|
+
return !1;
|
|
1290
|
+
const n = t.findRenderedRowElement?.(e);
|
|
1291
|
+
return n ? (At(n, o), !0) : !1;
|
|
1292
|
+
}
|
|
1293
|
+
function Pt(t, e, o) {
|
|
1294
|
+
let n = 0;
|
|
1295
|
+
for (const i of e)
|
|
1296
|
+
de(t, i, o) && n++;
|
|
1297
|
+
return n;
|
|
1298
|
+
}
|
|
1299
|
+
function Lt(t, e, o) {
|
|
1300
|
+
const n = t._rows ?? [], i = t.getRowId;
|
|
1301
|
+
if (!i)
|
|
1302
|
+
return !1;
|
|
1303
|
+
const r = n.findIndex((s) => i(s) === e);
|
|
1304
|
+
return r < 0 ? !1 : de(t, r, o);
|
|
1305
|
+
}
|
|
1306
|
+
function Y(t, e, o) {
|
|
1216
1307
|
const n = document.createElement(t);
|
|
1217
1308
|
if (e)
|
|
1218
1309
|
for (const i in e) {
|
|
@@ -1221,7 +1312,7 @@ function X(t, e, o) {
|
|
|
1221
1312
|
}
|
|
1222
1313
|
return n;
|
|
1223
1314
|
}
|
|
1224
|
-
function
|
|
1315
|
+
function L(t, e) {
|
|
1225
1316
|
const o = document.createElement("div");
|
|
1226
1317
|
if (t && (o.className = t), e)
|
|
1227
1318
|
for (const n in e) {
|
|
@@ -1230,7 +1321,7 @@ function P(t, e) {
|
|
|
1230
1321
|
}
|
|
1231
1322
|
return o;
|
|
1232
1323
|
}
|
|
1233
|
-
function
|
|
1324
|
+
function qe(t, e, o) {
|
|
1234
1325
|
const n = document.createElement("button");
|
|
1235
1326
|
if (t && (n.className = t), e)
|
|
1236
1327
|
for (const i in e) {
|
|
@@ -1239,8 +1330,8 @@ function Ne(t, e, o) {
|
|
|
1239
1330
|
}
|
|
1240
1331
|
return n;
|
|
1241
1332
|
}
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1333
|
+
const We = document.createElement("template");
|
|
1334
|
+
We.innerHTML = `
|
|
1244
1335
|
<div class="tbw-scroll-area">
|
|
1245
1336
|
<div class="rows-body-wrapper">
|
|
1246
1337
|
<div class="rows-body" role="grid">
|
|
@@ -1259,38 +1350,38 @@ Ie.innerHTML = `
|
|
|
1259
1350
|
<div class="faux-vscroll-spacer"></div>
|
|
1260
1351
|
</div>
|
|
1261
1352
|
`;
|
|
1262
|
-
function
|
|
1263
|
-
return
|
|
1353
|
+
function $e() {
|
|
1354
|
+
return We.content.cloneNode(!0);
|
|
1264
1355
|
}
|
|
1265
|
-
function
|
|
1266
|
-
const e = document.createDocumentFragment(), o =
|
|
1356
|
+
function Ee(t) {
|
|
1357
|
+
const e = document.createDocumentFragment(), o = L(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1267
1358
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1268
1359
|
o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
|
|
1269
1360
|
else {
|
|
1270
|
-
const n =
|
|
1271
|
-
n.appendChild(
|
|
1361
|
+
const n = L("tbw-grid-content");
|
|
1362
|
+
n.appendChild($e()), o.appendChild(n);
|
|
1272
1363
|
}
|
|
1273
1364
|
return e.appendChild(o), e;
|
|
1274
1365
|
}
|
|
1275
|
-
function
|
|
1276
|
-
const e =
|
|
1366
|
+
function Ht(t) {
|
|
1367
|
+
const e = L("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1277
1368
|
if (t.title) {
|
|
1278
|
-
const r =
|
|
1369
|
+
const r = L("tbw-shell-title");
|
|
1279
1370
|
r.textContent = t.title, e.appendChild(r);
|
|
1280
1371
|
}
|
|
1281
|
-
const o =
|
|
1372
|
+
const o = L("tbw-shell-content", {
|
|
1282
1373
|
part: "shell-content",
|
|
1283
1374
|
role: "presentation",
|
|
1284
1375
|
"data-light-dom-header-content": ""
|
|
1285
1376
|
});
|
|
1286
1377
|
e.appendChild(o);
|
|
1287
|
-
const n =
|
|
1378
|
+
const n = L("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
|
|
1288
1379
|
for (const r of t.configButtons)
|
|
1289
|
-
r.hasRender && n.appendChild(
|
|
1380
|
+
r.hasRender && n.appendChild(L("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1290
1381
|
for (const r of t.apiButtons)
|
|
1291
|
-
r.hasRender && n.appendChild(
|
|
1292
|
-
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && n.appendChild(
|
|
1293
|
-
const r =
|
|
1382
|
+
r.hasRender && n.appendChild(L("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1383
|
+
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && n.appendChild(L("tbw-toolbar-separator")), t.hasPanels) {
|
|
1384
|
+
const r = qe(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
|
|
1294
1385
|
"data-panel-toggle": "",
|
|
1295
1386
|
title: "Settings",
|
|
1296
1387
|
"aria-label": "Toggle settings panel",
|
|
@@ -1301,12 +1392,12 @@ function yt(t) {
|
|
|
1301
1392
|
}
|
|
1302
1393
|
return e.appendChild(n), e;
|
|
1303
1394
|
}
|
|
1304
|
-
function
|
|
1305
|
-
const e =
|
|
1306
|
-
i.appendChild(
|
|
1395
|
+
function Ot(t) {
|
|
1396
|
+
const e = L("tbw-shell-body"), o = t.panels.length > 0, n = t.panels.length === 1, i = L("tbw-grid-content");
|
|
1397
|
+
i.appendChild($e());
|
|
1307
1398
|
let r = null;
|
|
1308
1399
|
if (o) {
|
|
1309
|
-
r =
|
|
1400
|
+
r = Y("aside", {
|
|
1310
1401
|
class: t.isPanelOpen ? "tbw-tool-panel open" : "tbw-tool-panel",
|
|
1311
1402
|
part: "tool-panel",
|
|
1312
1403
|
"data-position": t.position,
|
|
@@ -1315,42 +1406,42 @@ function _t(t) {
|
|
|
1315
1406
|
});
|
|
1316
1407
|
const s = t.position === "left" ? "right" : "left";
|
|
1317
1408
|
r.appendChild(
|
|
1318
|
-
|
|
1409
|
+
L("tbw-tool-panel-resize", {
|
|
1319
1410
|
"data-resize-handle": "",
|
|
1320
1411
|
"data-handle-position": s,
|
|
1321
1412
|
"aria-hidden": "true"
|
|
1322
1413
|
})
|
|
1323
1414
|
);
|
|
1324
|
-
const l =
|
|
1415
|
+
const l = L("tbw-tool-panel-content", { role: "presentation" }), c = L("tbw-accordion");
|
|
1325
1416
|
for (const a of t.panels) {
|
|
1326
|
-
const h = `tbw-accordion-section${a.isExpanded ? " expanded" : ""}${n ? " single" : ""}`,
|
|
1417
|
+
const h = `tbw-accordion-section${a.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, u = L(h, { "data-section": a.id }), p = qe("tbw-accordion-header", {
|
|
1327
1418
|
"aria-expanded": String(a.isExpanded),
|
|
1328
1419
|
"aria-controls": `tbw-section-${a.id}`
|
|
1329
1420
|
});
|
|
1330
|
-
if (n &&
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1421
|
+
if (n && p.setAttribute("aria-disabled", "true"), a.icon) {
|
|
1422
|
+
const g = Y("span", { class: "tbw-accordion-icon" });
|
|
1423
|
+
g.innerHTML = a.icon, p.appendChild(g);
|
|
1333
1424
|
}
|
|
1334
|
-
const
|
|
1335
|
-
if (
|
|
1336
|
-
const
|
|
1337
|
-
|
|
1425
|
+
const f = Y("span", { class: "tbw-accordion-title" });
|
|
1426
|
+
if (f.textContent = a.title, p.appendChild(f), !n) {
|
|
1427
|
+
const g = Y("span", { class: "tbw-accordion-chevron" });
|
|
1428
|
+
g.innerHTML = a.isExpanded ? t.collapseIcon : t.expandIcon, p.appendChild(g);
|
|
1338
1429
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1430
|
+
u.appendChild(p), u.appendChild(
|
|
1431
|
+
L("tbw-accordion-content", {
|
|
1341
1432
|
id: `tbw-section-${a.id}`,
|
|
1342
1433
|
role: "presentation"
|
|
1343
1434
|
})
|
|
1344
|
-
), c.appendChild(
|
|
1435
|
+
), c.appendChild(u);
|
|
1345
1436
|
}
|
|
1346
1437
|
l.appendChild(c), r.appendChild(l);
|
|
1347
1438
|
}
|
|
1348
1439
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(i)) : (e.appendChild(i), r && e.appendChild(r)), e;
|
|
1349
1440
|
}
|
|
1350
|
-
function
|
|
1441
|
+
function k(t) {
|
|
1351
1442
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1352
1443
|
}
|
|
1353
|
-
function
|
|
1444
|
+
function Dt() {
|
|
1354
1445
|
return {
|
|
1355
1446
|
toolPanels: /* @__PURE__ */ new Map(),
|
|
1356
1447
|
headerContents: /* @__PURE__ */ new Map(),
|
|
@@ -1369,27 +1460,27 @@ function Et() {
|
|
|
1369
1460
|
lightDomContentMoved: !1
|
|
1370
1461
|
};
|
|
1371
1462
|
}
|
|
1372
|
-
function
|
|
1463
|
+
function Fe(t) {
|
|
1373
1464
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1374
1465
|
}
|
|
1375
|
-
function
|
|
1376
|
-
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r =
|
|
1377
|
-
for (const
|
|
1378
|
-
c.has(
|
|
1379
|
-
const h = a.length > 0,
|
|
1380
|
-
let
|
|
1381
|
-
for (const
|
|
1382
|
-
|
|
1383
|
-
if (
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1466
|
+
function Se(t, e, o = "☰") {
|
|
1467
|
+
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = k(o), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], c = new Set(s.map((d) => d.id)), a = [...s];
|
|
1468
|
+
for (const d of l)
|
|
1469
|
+
c.has(d.id) || a.push(d);
|
|
1470
|
+
const h = a.length > 0, u = e.toolPanels.size > 0, p = h && u, f = [...a].sort((d, w) => (d.order ?? 0) - (w.order ?? 0));
|
|
1471
|
+
let g = "";
|
|
1472
|
+
for (const d of f)
|
|
1473
|
+
g += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${d.id}"></div>`;
|
|
1474
|
+
if (p && (g += '<div class="tbw-toolbar-separator"></div>'), u) {
|
|
1475
|
+
const d = e.isPanelOpen;
|
|
1476
|
+
g += `<button class="${d ? "tbw-toolbar-btn active" : "tbw-toolbar-btn"}" data-panel-toggle title="Settings" aria-label="Toggle settings panel" aria-pressed="${d}" aria-controls="tbw-tool-panel">${r}</button>`;
|
|
1386
1477
|
}
|
|
1387
1478
|
return `
|
|
1388
1479
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1389
|
-
${i ? `<div class="tbw-shell-title">${
|
|
1480
|
+
${i ? `<div class="tbw-shell-title">${Je(n)}</div>` : ""}
|
|
1390
1481
|
<div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
|
|
1391
1482
|
<div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
|
|
1392
|
-
${
|
|
1483
|
+
${g}
|
|
1393
1484
|
</div>
|
|
1394
1485
|
</div>
|
|
1395
1486
|
`;
|
|
@@ -1404,7 +1495,7 @@ function I(t, e) {
|
|
|
1404
1495
|
const n = o.querySelectorAll("tbw-grid-header-content");
|
|
1405
1496
|
n.length > 0 && e.lightDomHeaderContent.length === 0 && (e.lightDomHeaderContent = Array.from(n)), o.style.display = "none";
|
|
1406
1497
|
}
|
|
1407
|
-
function
|
|
1498
|
+
function q(t, e, o) {
|
|
1408
1499
|
const n = t.querySelector(":scope > tbw-grid-tool-buttons");
|
|
1409
1500
|
if (!n) return;
|
|
1410
1501
|
e.hasToolButtonsContainer = !0;
|
|
@@ -1420,7 +1511,7 @@ function k(t, e, o) {
|
|
|
1420
1511
|
};
|
|
1421
1512
|
e.toolbarContents.set(i, r), e.lightDomToolbarContentIds.add(i), n.style.display = "none";
|
|
1422
1513
|
}
|
|
1423
|
-
function
|
|
1514
|
+
function W(t, e, o) {
|
|
1424
1515
|
t.querySelectorAll(":scope > tbw-grid-tool-panel").forEach((i) => {
|
|
1425
1516
|
const r = i, s = r.getAttribute("id"), l = r.getAttribute("title");
|
|
1426
1517
|
if (!s || !l) {
|
|
@@ -1430,38 +1521,38 @@ function q(t, e, o) {
|
|
|
1430
1521
|
return;
|
|
1431
1522
|
}
|
|
1432
1523
|
const c = r.getAttribute("icon") ?? void 0, a = r.getAttribute("tooltip") ?? void 0, h = parseInt(r.getAttribute("order") ?? "100", 10);
|
|
1433
|
-
let
|
|
1434
|
-
const
|
|
1435
|
-
if (
|
|
1436
|
-
|
|
1524
|
+
let u;
|
|
1525
|
+
const p = o?.(r);
|
|
1526
|
+
if (p)
|
|
1527
|
+
u = p;
|
|
1437
1528
|
else {
|
|
1438
|
-
const
|
|
1439
|
-
|
|
1440
|
-
const
|
|
1441
|
-
return
|
|
1529
|
+
const d = r.innerHTML.trim();
|
|
1530
|
+
u = (w) => {
|
|
1531
|
+
const m = document.createElement("div");
|
|
1532
|
+
return m.innerHTML = d, w.appendChild(m), () => m.remove();
|
|
1442
1533
|
};
|
|
1443
1534
|
}
|
|
1444
|
-
const
|
|
1445
|
-
if (
|
|
1446
|
-
if (
|
|
1447
|
-
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1535
|
+
const f = e.toolPanels.get(s);
|
|
1536
|
+
if (f) {
|
|
1537
|
+
if (p) {
|
|
1538
|
+
f.render = u, f.order = h, f.icon = c, f.tooltip = a;
|
|
1539
|
+
const d = e.panelCleanups.get(s);
|
|
1540
|
+
d && (d(), e.panelCleanups.delete(s));
|
|
1450
1541
|
}
|
|
1451
1542
|
return;
|
|
1452
1543
|
}
|
|
1453
|
-
const
|
|
1544
|
+
const g = {
|
|
1454
1545
|
id: s,
|
|
1455
1546
|
title: l,
|
|
1456
1547
|
icon: c,
|
|
1457
1548
|
tooltip: a,
|
|
1458
1549
|
order: h,
|
|
1459
|
-
render:
|
|
1550
|
+
render: u
|
|
1460
1551
|
};
|
|
1461
|
-
e.toolPanels.set(s,
|
|
1552
|
+
e.toolPanels.set(s, g), e.lightDomToolPanelIds.add(s), r.style.display = "none";
|
|
1462
1553
|
});
|
|
1463
1554
|
}
|
|
1464
|
-
function
|
|
1555
|
+
function Mt(t, e, o, n) {
|
|
1465
1556
|
const i = t.querySelector(".tbw-shell-toolbar");
|
|
1466
1557
|
i && i.addEventListener("click", (s) => {
|
|
1467
1558
|
if (s.target.closest("[data-panel-toggle]")) {
|
|
@@ -1478,31 +1569,31 @@ function St(t, e, o, n) {
|
|
|
1478
1569
|
}
|
|
1479
1570
|
});
|
|
1480
1571
|
}
|
|
1481
|
-
function
|
|
1572
|
+
function zt(t, e, o) {
|
|
1482
1573
|
const n = t.querySelector(".tbw-tool-panel"), i = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1483
1574
|
if (!n || !i || !r)
|
|
1484
1575
|
return () => {
|
|
1485
1576
|
};
|
|
1486
1577
|
const s = e?.toolPanel?.position ?? "right", l = 200;
|
|
1487
|
-
let c = 0, a = 0, h = 0,
|
|
1488
|
-
const
|
|
1489
|
-
if (!
|
|
1490
|
-
|
|
1491
|
-
const
|
|
1492
|
-
n.style.width = `${
|
|
1493
|
-
},
|
|
1494
|
-
if (!
|
|
1495
|
-
|
|
1496
|
-
const
|
|
1497
|
-
o(
|
|
1498
|
-
},
|
|
1499
|
-
|
|
1578
|
+
let c = 0, a = 0, h = 0, u = !1;
|
|
1579
|
+
const p = (d) => {
|
|
1580
|
+
if (!u) return;
|
|
1581
|
+
d.preventDefault();
|
|
1582
|
+
const w = s === "left" ? d.clientX - c : c - d.clientX, m = Math.min(h, Math.max(l, a + w));
|
|
1583
|
+
n.style.width = `${m}px`;
|
|
1584
|
+
}, f = () => {
|
|
1585
|
+
if (!u) return;
|
|
1586
|
+
u = !1, i.classList.remove("resizing"), n.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1587
|
+
const d = n.getBoundingClientRect().width;
|
|
1588
|
+
o(d), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
1589
|
+
}, g = (d) => {
|
|
1590
|
+
d.preventDefault(), u = !0, c = d.clientX, a = 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);
|
|
1500
1591
|
};
|
|
1501
|
-
return i.addEventListener("mousedown",
|
|
1502
|
-
i.removeEventListener("mousedown",
|
|
1592
|
+
return i.addEventListener("mousedown", g), () => {
|
|
1593
|
+
i.removeEventListener("mousedown", g), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
1503
1594
|
};
|
|
1504
1595
|
}
|
|
1505
|
-
function
|
|
1596
|
+
function Re(t, e, o) {
|
|
1506
1597
|
const n = e?.header?.toolbarContents ?? [], i = [...o.toolbarContents.values()], r = new Set(n.map((l) => l.id)), s = [...n];
|
|
1507
1598
|
for (const l of i)
|
|
1508
1599
|
r.has(l.id) || s.push(l);
|
|
@@ -1514,7 +1605,7 @@ function _e(t, e, o) {
|
|
|
1514
1605
|
a && o.toolbarContentCleanups.set(l.id, a);
|
|
1515
1606
|
}
|
|
1516
1607
|
}
|
|
1517
|
-
function
|
|
1608
|
+
function se(t, e) {
|
|
1518
1609
|
const o = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, n = e.headerContents.size > 0;
|
|
1519
1610
|
if (!o && !n) return;
|
|
1520
1611
|
const i = t.querySelector(".tbw-shell-content");
|
|
@@ -1534,36 +1625,36 @@ function ie(t, e) {
|
|
|
1534
1625
|
a && e.headerContentCleanups.set(s.id, a);
|
|
1535
1626
|
}
|
|
1536
1627
|
}
|
|
1537
|
-
function
|
|
1628
|
+
function Nt(t, e, o) {
|
|
1538
1629
|
if (!e.isPanelOpen) return;
|
|
1539
|
-
const n =
|
|
1630
|
+
const n = k(o?.expand ?? z.expand), i = k(o?.collapse ?? z.collapse);
|
|
1540
1631
|
for (const [r, s] of e.toolPanels) {
|
|
1541
1632
|
const l = e.expandedSections.has(r), c = t.querySelector(`[data-section="${r}"]`), a = c?.querySelector(".tbw-accordion-content");
|
|
1542
1633
|
if (!c || !a) continue;
|
|
1543
1634
|
c.classList.toggle("expanded", l);
|
|
1544
1635
|
const h = c.querySelector(".tbw-accordion-header");
|
|
1545
1636
|
h && h.setAttribute("aria-expanded", String(l));
|
|
1546
|
-
const
|
|
1547
|
-
if (
|
|
1637
|
+
const u = c.querySelector(".tbw-accordion-chevron");
|
|
1638
|
+
if (u && (u.innerHTML = l ? i : n), l) {
|
|
1548
1639
|
if (a.children.length === 0) {
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1640
|
+
const p = s.render(a);
|
|
1641
|
+
p && e.panelCleanups.set(r, p);
|
|
1551
1642
|
}
|
|
1552
1643
|
} else {
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1644
|
+
const p = e.panelCleanups.get(r);
|
|
1645
|
+
p && (p(), e.panelCleanups.delete(r)), a.innerHTML = "";
|
|
1555
1646
|
}
|
|
1556
1647
|
}
|
|
1557
1648
|
}
|
|
1558
|
-
function
|
|
1649
|
+
function Te(t, e) {
|
|
1559
1650
|
const o = t.querySelector("[data-panel-toggle]");
|
|
1560
1651
|
o && (o.classList.toggle("active", e.isPanelOpen), o.setAttribute("aria-pressed", String(e.isPanelOpen)));
|
|
1561
1652
|
}
|
|
1562
|
-
function
|
|
1653
|
+
function xe(t, e) {
|
|
1563
1654
|
const o = t.querySelector(".tbw-tool-panel");
|
|
1564
1655
|
o && (o.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (o.style.width = ""));
|
|
1565
1656
|
}
|
|
1566
|
-
function
|
|
1657
|
+
function kt(t) {
|
|
1567
1658
|
for (const e of t.headerContentCleanups.values())
|
|
1568
1659
|
e();
|
|
1569
1660
|
t.headerContentCleanups.clear();
|
|
@@ -1580,7 +1671,7 @@ function xt(t) {
|
|
|
1580
1671
|
t.toolPanels.get(e)?.onClose?.();
|
|
1581
1672
|
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;
|
|
1582
1673
|
}
|
|
1583
|
-
function
|
|
1674
|
+
function It(t, e) {
|
|
1584
1675
|
let o = !1;
|
|
1585
1676
|
const n = {
|
|
1586
1677
|
get isInitialized() {
|
|
@@ -1609,7 +1700,7 @@ function At(t, e) {
|
|
|
1609
1700
|
s && t.expandedSections.add(s.id);
|
|
1610
1701
|
}
|
|
1611
1702
|
const i = e.getShadow();
|
|
1612
|
-
|
|
1703
|
+
Te(i, t), xe(i, t), Nt(i, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: n.expandedSections });
|
|
1613
1704
|
},
|
|
1614
1705
|
closeToolPanel() {
|
|
1615
1706
|
if (!t.isPanelOpen) return;
|
|
@@ -1620,7 +1711,7 @@ function At(t, e) {
|
|
|
1620
1711
|
r.onClose?.();
|
|
1621
1712
|
t.isPanelOpen = !1;
|
|
1622
1713
|
const i = e.getShadow();
|
|
1623
|
-
|
|
1714
|
+
Te(i, t), xe(i, t), e.emit("tool-panel-close", {});
|
|
1624
1715
|
},
|
|
1625
1716
|
toggleToolPanel() {
|
|
1626
1717
|
t.isPanelOpen ? n.closeToolPanel() : n.openToolPanel();
|
|
@@ -1636,16 +1727,16 @@ function At(t, e) {
|
|
|
1636
1727
|
const s = e.getShadow(), l = t.expandedSections.has(i);
|
|
1637
1728
|
if (l) {
|
|
1638
1729
|
const c = t.panelCleanups.get(i);
|
|
1639
|
-
c && (c(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i),
|
|
1730
|
+
c && (c(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), ie(s, i, !1);
|
|
1640
1731
|
} else {
|
|
1641
1732
|
for (const [c, a] of t.toolPanels)
|
|
1642
1733
|
if (c !== i && t.expandedSections.has(c)) {
|
|
1643
1734
|
const h = t.panelCleanups.get(c);
|
|
1644
|
-
h && (h(), t.panelCleanups.delete(c)), a.onClose?.(), t.expandedSections.delete(c),
|
|
1645
|
-
const
|
|
1646
|
-
|
|
1735
|
+
h && (h(), t.panelCleanups.delete(c)), a.onClose?.(), t.expandedSections.delete(c), ie(s, c, !1);
|
|
1736
|
+
const u = s.querySelector(`[data-section="${c}"] .tbw-accordion-content`);
|
|
1737
|
+
u && (u.innerHTML = "");
|
|
1647
1738
|
}
|
|
1648
|
-
t.expandedSections.add(i),
|
|
1739
|
+
t.expandedSections.add(i), ie(s, i, !0), qt(s, t, i);
|
|
1649
1740
|
}
|
|
1650
1741
|
e.emit("tool-panel-section-toggle", { id: i, expanded: !l });
|
|
1651
1742
|
},
|
|
@@ -1674,7 +1765,7 @@ function At(t, e) {
|
|
|
1674
1765
|
console.warn(`[tbw-grid] Header content "${i.id}" already registered`);
|
|
1675
1766
|
return;
|
|
1676
1767
|
}
|
|
1677
|
-
t.headerContents.set(i.id, i), o &&
|
|
1768
|
+
t.headerContents.set(i.id, i), o && se(e.getShadow(), t);
|
|
1678
1769
|
},
|
|
1679
1770
|
unregisterHeaderContent(i) {
|
|
1680
1771
|
const r = t.headerContentCleanups.get(i);
|
|
@@ -1699,11 +1790,11 @@ function At(t, e) {
|
|
|
1699
1790
|
};
|
|
1700
1791
|
return n;
|
|
1701
1792
|
}
|
|
1702
|
-
function
|
|
1793
|
+
function ie(t, e, o) {
|
|
1703
1794
|
const n = t.querySelector(`[data-section="${e}"]`);
|
|
1704
1795
|
n && n.classList.toggle("expanded", o);
|
|
1705
1796
|
}
|
|
1706
|
-
function
|
|
1797
|
+
function qt(t, e, o) {
|
|
1707
1798
|
const n = e.toolPanels.get(o);
|
|
1708
1799
|
if (!n?.render) return;
|
|
1709
1800
|
const i = t.querySelector(`[data-section="${o}"] .tbw-accordion-content`);
|
|
@@ -1711,49 +1802,56 @@ function Pt(t, e, o) {
|
|
|
1711
1802
|
const r = n.render(i);
|
|
1712
1803
|
r && e.panelCleanups.set(o, r);
|
|
1713
1804
|
}
|
|
1714
|
-
function
|
|
1715
|
-
const i =
|
|
1805
|
+
function Wt(t, e, o, n) {
|
|
1806
|
+
const i = Fe(e), r = [], s = [
|
|
1807
|
+
"tbw-grid-header",
|
|
1808
|
+
"tbw-grid-tool-buttons",
|
|
1809
|
+
"tbw-grid-tool-panel",
|
|
1810
|
+
"tbw-grid-column",
|
|
1811
|
+
"tbw-grid-detail",
|
|
1812
|
+
"tbw-grid-responsive-card"
|
|
1813
|
+
];
|
|
1716
1814
|
for (const l of s)
|
|
1717
1815
|
t.querySelectorAll(`:scope > ${l}`).forEach((a) => r.push(a));
|
|
1718
1816
|
t.replaceChildren();
|
|
1719
1817
|
for (const l of r)
|
|
1720
1818
|
t.appendChild(l);
|
|
1721
1819
|
if (i) {
|
|
1722
|
-
const l =
|
|
1820
|
+
const l = k(n?.toolPanel ?? z.toolPanel), c = k(n?.expand ?? z.expand), a = k(n?.collapse ?? z.collapse), u = [...e?.header?.toolbarContents ?? []].sort((v, T) => (v.order ?? 0) - (T.order ?? 0)), f = [...e?.toolPanels ?? []].sort((v, T) => (v.order ?? 100) - (T.order ?? 100)), g = {
|
|
1723
1821
|
title: e?.header?.title ?? void 0,
|
|
1724
|
-
hasPanels:
|
|
1822
|
+
hasPanels: f.length > 0,
|
|
1725
1823
|
isPanelOpen: o.isPanelOpen,
|
|
1726
1824
|
toolPanelIcon: l,
|
|
1727
|
-
configButtons:
|
|
1728
|
-
id:
|
|
1825
|
+
configButtons: u.map((v) => ({
|
|
1826
|
+
id: v.id,
|
|
1729
1827
|
hasElement: !1,
|
|
1730
|
-
hasRender: !!
|
|
1828
|
+
hasRender: !!v.render
|
|
1731
1829
|
})),
|
|
1732
1830
|
apiButtons: []
|
|
1733
|
-
},
|
|
1831
|
+
}, d = {
|
|
1734
1832
|
position: e?.toolPanel?.position ?? "right",
|
|
1735
1833
|
isPanelOpen: o.isPanelOpen,
|
|
1736
1834
|
expandIcon: c,
|
|
1737
1835
|
collapseIcon: a,
|
|
1738
|
-
panels:
|
|
1739
|
-
id:
|
|
1740
|
-
title:
|
|
1741
|
-
icon:
|
|
1742
|
-
isExpanded: o.expandedSections.has(
|
|
1836
|
+
panels: f.map((v) => ({
|
|
1837
|
+
id: v.id,
|
|
1838
|
+
title: v.title,
|
|
1839
|
+
icon: k(v.icon),
|
|
1840
|
+
isExpanded: o.expandedSections.has(v.id)
|
|
1743
1841
|
}))
|
|
1744
|
-
},
|
|
1842
|
+
}, w = Ht(g), m = Ot(d), R = Ee({
|
|
1745
1843
|
hasShell: !0,
|
|
1746
|
-
shellHeader:
|
|
1747
|
-
shellBody:
|
|
1844
|
+
shellHeader: w,
|
|
1845
|
+
shellBody: m
|
|
1748
1846
|
});
|
|
1749
1847
|
t.appendChild(R);
|
|
1750
1848
|
} else {
|
|
1751
|
-
const l =
|
|
1849
|
+
const l = Ee({ hasShell: !1 });
|
|
1752
1850
|
t.appendChild(l);
|
|
1753
1851
|
}
|
|
1754
1852
|
return i;
|
|
1755
1853
|
}
|
|
1756
|
-
function
|
|
1854
|
+
function $t() {
|
|
1757
1855
|
return {
|
|
1758
1856
|
startY: null,
|
|
1759
1857
|
startX: null,
|
|
@@ -1767,39 +1865,39 @@ function Ht() {
|
|
|
1767
1865
|
momentumRaf: 0
|
|
1768
1866
|
};
|
|
1769
1867
|
}
|
|
1770
|
-
function
|
|
1868
|
+
function Ft(t) {
|
|
1771
1869
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
1772
1870
|
}
|
|
1773
|
-
function
|
|
1871
|
+
function Ue(t) {
|
|
1774
1872
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
1775
1873
|
}
|
|
1776
|
-
function
|
|
1874
|
+
function Ut(t, e, o) {
|
|
1777
1875
|
if (t.touches.length !== 1) return;
|
|
1778
|
-
|
|
1876
|
+
Ue(e);
|
|
1779
1877
|
const n = t.touches[0];
|
|
1780
1878
|
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;
|
|
1781
1879
|
}
|
|
1782
|
-
function
|
|
1880
|
+
function Vt(t, e, o) {
|
|
1783
1881
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
1784
1882
|
return !1;
|
|
1785
1883
|
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i, c = e.startX - r;
|
|
1786
1884
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
1787
|
-
const
|
|
1788
|
-
|
|
1885
|
+
const d = s - e.lastTime;
|
|
1886
|
+
d > 0 && (e.velocityY = (e.lastY - i) / d, e.velocityX = (e.lastX - r) / d);
|
|
1789
1887
|
}
|
|
1790
1888
|
e.lastY = i, e.lastX = r, e.lastTime = s;
|
|
1791
|
-
const { scrollTop: a, scrollHeight: h, clientHeight:
|
|
1792
|
-
let
|
|
1889
|
+
const { scrollTop: a, scrollHeight: h, clientHeight: u } = o.fauxScrollbar, p = h - u, f = l > 0 && a < p || l < 0 && a > 0;
|
|
1890
|
+
let g = !1;
|
|
1793
1891
|
if (o.scrollArea) {
|
|
1794
|
-
const { scrollLeft:
|
|
1795
|
-
|
|
1892
|
+
const { scrollLeft: d, scrollWidth: w, clientWidth: m } = o.scrollArea, R = w - m;
|
|
1893
|
+
g = c > 0 && d < R || c < 0 && d > 0;
|
|
1796
1894
|
}
|
|
1797
|
-
return
|
|
1895
|
+
return f && (o.fauxScrollbar.scrollTop = e.scrollTop + l), g && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + c), f || g;
|
|
1798
1896
|
}
|
|
1799
|
-
function
|
|
1800
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) &&
|
|
1897
|
+
function Bt(t, e) {
|
|
1898
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Gt(t, e), Ft(t);
|
|
1801
1899
|
}
|
|
1802
|
-
function
|
|
1900
|
+
function Gt(t, e) {
|
|
1803
1901
|
const i = () => {
|
|
1804
1902
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
1805
1903
|
const r = t.velocityY * 16, s = t.velocityX * 16;
|
|
@@ -1807,19 +1905,19 @@ function Nt(t, e) {
|
|
|
1807
1905
|
};
|
|
1808
1906
|
t.momentumRaf = requestAnimationFrame(i);
|
|
1809
1907
|
}
|
|
1810
|
-
function
|
|
1811
|
-
t.addEventListener("touchstart", (i) =>
|
|
1908
|
+
function Xt(t, e, o, n) {
|
|
1909
|
+
t.addEventListener("touchstart", (i) => Ut(i, e, o), {
|
|
1812
1910
|
passive: !0,
|
|
1813
1911
|
signal: n
|
|
1814
1912
|
}), t.addEventListener(
|
|
1815
1913
|
"touchmove",
|
|
1816
1914
|
(i) => {
|
|
1817
|
-
|
|
1915
|
+
Vt(i, e, o) && i.preventDefault();
|
|
1818
1916
|
},
|
|
1819
1917
|
{ passive: !1, signal: n }
|
|
1820
|
-
), t.addEventListener("touchend", () =>
|
|
1918
|
+
), t.addEventListener("touchend", () => Bt(e, o), { passive: !0, signal: n });
|
|
1821
1919
|
}
|
|
1822
|
-
const
|
|
1920
|
+
const Yt = [
|
|
1823
1921
|
{
|
|
1824
1922
|
property: "editable",
|
|
1825
1923
|
pluginName: "editing",
|
|
@@ -1857,7 +1955,7 @@ const kt = [
|
|
|
1857
1955
|
importHint: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
|
|
1858
1956
|
isUsed: (t) => t === "left" || t === "right"
|
|
1859
1957
|
}
|
|
1860
|
-
],
|
|
1958
|
+
], jt = [
|
|
1861
1959
|
{
|
|
1862
1960
|
property: "columnGroups",
|
|
1863
1961
|
pluginName: "groupingColumns",
|
|
@@ -1866,7 +1964,7 @@ const kt = [
|
|
|
1866
1964
|
importHint: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';",
|
|
1867
1965
|
isUsed: (t) => Array.isArray(t) && t.length > 0
|
|
1868
1966
|
}
|
|
1869
|
-
],
|
|
1967
|
+
], Kt = {
|
|
1870
1968
|
editing: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
|
|
1871
1969
|
selection: "import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';",
|
|
1872
1970
|
reorder: "import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder';",
|
|
@@ -1887,10 +1985,10 @@ const kt = [
|
|
|
1887
1985
|
serverSide: "import { ServerSidePlugin } from '@toolbox-web/grid/plugins/server-side';",
|
|
1888
1986
|
columnVirtualization: "import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';"
|
|
1889
1987
|
};
|
|
1890
|
-
function
|
|
1891
|
-
return
|
|
1988
|
+
function le(t) {
|
|
1989
|
+
return Kt[t] ?? `import { ${D(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
|
|
1892
1990
|
}
|
|
1893
|
-
function
|
|
1991
|
+
function Ve() {
|
|
1894
1992
|
if (typeof window < "u" && window.location) {
|
|
1895
1993
|
const t = window.location.hostname;
|
|
1896
1994
|
if (t === "localhost" || t === "127.0.0.1" || t === "::1")
|
|
@@ -1898,37 +1996,37 @@ function $e() {
|
|
|
1898
1996
|
}
|
|
1899
1997
|
return typeof process < "u" && process.env?.NODE_ENV !== "production";
|
|
1900
1998
|
}
|
|
1901
|
-
function
|
|
1999
|
+
function D(t) {
|
|
1902
2000
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
1903
2001
|
}
|
|
1904
|
-
function
|
|
2002
|
+
function Ae(t, e) {
|
|
1905
2003
|
return t.some((o) => o.name === e);
|
|
1906
2004
|
}
|
|
1907
|
-
function
|
|
1908
|
-
const o =
|
|
1909
|
-
function r(l, c, a, h,
|
|
1910
|
-
i.has(l) || i.set(l, { description: c, importHint: a, fields: [], isConfigProperty:
|
|
1911
|
-
const
|
|
1912
|
-
|
|
2005
|
+
function Zt(t, e) {
|
|
2006
|
+
const o = Yt, n = jt, i = /* @__PURE__ */ new Map();
|
|
2007
|
+
function r(l, c, a, h, u = !1) {
|
|
2008
|
+
i.has(l) || i.set(l, { description: c, importHint: a, fields: [], isConfigProperty: u });
|
|
2009
|
+
const p = i.get(l);
|
|
2010
|
+
p.fields.includes(h) || p.fields.push(h);
|
|
1913
2011
|
}
|
|
1914
2012
|
for (const l of n) {
|
|
1915
2013
|
const c = t[l.property];
|
|
1916
|
-
(l.isUsed ? l.isUsed(c) : c !== void 0) && !
|
|
2014
|
+
(l.isUsed ? l.isUsed(c) : c !== void 0) && !Ae(e, l.pluginName) && r(l.pluginName, l.description, l.importHint ?? le(l.pluginName), l.property, !0);
|
|
1917
2015
|
}
|
|
1918
2016
|
const s = t.columns;
|
|
1919
2017
|
if (s && s.length > 0)
|
|
1920
2018
|
for (const l of s)
|
|
1921
2019
|
for (const c of o) {
|
|
1922
2020
|
const a = l[c.property];
|
|
1923
|
-
if ((c.isUsed ? c.isUsed(a) : a !== void 0) && !
|
|
1924
|
-
const
|
|
1925
|
-
r(c.pluginName, c.description, c.importHint ??
|
|
2021
|
+
if ((c.isUsed ? c.isUsed(a) : a !== void 0) && !Ae(e, c.pluginName)) {
|
|
2022
|
+
const u = l.field || "<unknown>";
|
|
2023
|
+
r(c.pluginName, c.description, c.importHint ?? le(c.pluginName), u);
|
|
1926
2024
|
}
|
|
1927
2025
|
}
|
|
1928
2026
|
if (i.size > 0) {
|
|
1929
2027
|
const l = [];
|
|
1930
|
-
for (const [c, { description: a, importHint: h, fields:
|
|
1931
|
-
if (
|
|
2028
|
+
for (const [c, { description: a, importHint: h, fields: u, isConfigProperty: p }] of i)
|
|
2029
|
+
if (p)
|
|
1932
2030
|
l.push(
|
|
1933
2031
|
`Config uses ${a}, but the required plugin is not loaded.
|
|
1934
2032
|
→ Add the plugin to your gridConfig.plugins array:
|
|
@@ -1936,9 +2034,9 @@ function $t(t, e) {
|
|
|
1936
2034
|
plugins: [new ${c.charAt(0).toUpperCase() + c.slice(1)}Plugin(), ...]`
|
|
1937
2035
|
);
|
|
1938
2036
|
else {
|
|
1939
|
-
const
|
|
2037
|
+
const f = u.slice(0, 3).join(", ") + (u.length > 3 ? `, ... (${u.length} total)` : "");
|
|
1940
2038
|
l.push(
|
|
1941
|
-
`Column(s) [${
|
|
2039
|
+
`Column(s) [${f}] use ${a}, but the required plugin is not loaded.
|
|
1942
2040
|
→ Add the plugin to your gridConfig.plugins array:
|
|
1943
2041
|
${h}
|
|
1944
2042
|
plugins: [new ${c.charAt(0).toUpperCase() + c.slice(1)}Plugin(), ...]`
|
|
@@ -1955,7 +2053,7 @@ This validation helps catch misconfigurations early. The properties listed above
|
|
|
1955
2053
|
);
|
|
1956
2054
|
}
|
|
1957
2055
|
}
|
|
1958
|
-
function
|
|
2056
|
+
function Jt(t) {
|
|
1959
2057
|
const e = [], o = [];
|
|
1960
2058
|
for (const n of t) {
|
|
1961
2059
|
const r = n.constructor.manifest;
|
|
@@ -1963,12 +2061,12 @@ function Ft(t) {
|
|
|
1963
2061
|
for (const s of r.configRules) {
|
|
1964
2062
|
const l = n.config;
|
|
1965
2063
|
if (s.check(l)) {
|
|
1966
|
-
const a = `${`[tbw-grid:${
|
|
2064
|
+
const a = `${`[tbw-grid:${D(n.name)}Plugin]`} Configuration warning: ${s.message}`;
|
|
1967
2065
|
s.severity === "error" ? e.push(a) : o.push(a);
|
|
1968
2066
|
}
|
|
1969
2067
|
}
|
|
1970
2068
|
}
|
|
1971
|
-
if (o.length > 0 &&
|
|
2069
|
+
if (o.length > 0 && Ve())
|
|
1972
2070
|
for (const n of o)
|
|
1973
2071
|
console.warn(n);
|
|
1974
2072
|
if (e.length > 0)
|
|
@@ -1978,30 +2076,30 @@ ${e.join(`
|
|
|
1978
2076
|
|
|
1979
2077
|
`)}`);
|
|
1980
2078
|
}
|
|
1981
|
-
function
|
|
2079
|
+
function Qt(t, e) {
|
|
1982
2080
|
const o = t.name, i = t.constructor.dependencies ?? [];
|
|
1983
2081
|
for (const r of i) {
|
|
1984
2082
|
const s = r.name, l = r.required ?? !0, c = r.reason;
|
|
1985
2083
|
if (!e.some((h) => h.name === s)) {
|
|
1986
|
-
const h = c ?? `${
|
|
2084
|
+
const h = c ?? `${D(o)}Plugin requires ${D(s)}Plugin`, u = le(s);
|
|
1987
2085
|
if (l)
|
|
1988
2086
|
throw new Error(
|
|
1989
2087
|
`[tbw-grid] Plugin dependency error:
|
|
1990
2088
|
|
|
1991
2089
|
${h}.
|
|
1992
2090
|
|
|
1993
|
-
→ Add the plugin to your gridConfig.plugins array BEFORE ${
|
|
1994
|
-
${
|
|
1995
|
-
plugins: [new ${
|
|
2091
|
+
→ Add the plugin to your gridConfig.plugins array BEFORE ${D(o)}Plugin:
|
|
2092
|
+
${u}
|
|
2093
|
+
plugins: [new ${D(s)}Plugin(), new ${D(o)}Plugin()]`
|
|
1996
2094
|
);
|
|
1997
2095
|
console.info(
|
|
1998
|
-
`[tbw-grid] ${
|
|
2096
|
+
`[tbw-grid] ${D(o)}Plugin: Optional "${s}" plugin not found. Some features may be unavailable.`
|
|
1999
2097
|
);
|
|
2000
2098
|
}
|
|
2001
2099
|
}
|
|
2002
2100
|
}
|
|
2003
|
-
function
|
|
2004
|
-
if (
|
|
2101
|
+
function eo(t) {
|
|
2102
|
+
if (!Ve()) return;
|
|
2005
2103
|
const e = new Set(t.map((n) => n.name)), o = /* @__PURE__ */ new Set();
|
|
2006
2104
|
for (const n of t) {
|
|
2007
2105
|
const r = n.constructor.manifest;
|
|
@@ -2013,7 +2111,7 @@ function Vt(t) {
|
|
|
2013
2111
|
o.add(l), console.warn(
|
|
2014
2112
|
`[tbw-grid] Plugin incompatibility warning:
|
|
2015
2113
|
|
|
2016
|
-
${
|
|
2114
|
+
${D(n.name)}Plugin and ${D(s.name)}Plugin are both loaded, but they are currently incompatible.
|
|
2017
2115
|
|
|
2018
2116
|
→ ${s.reason}
|
|
2019
2117
|
|
|
@@ -2023,7 +2121,7 @@ ${O(n.name)}Plugin and ${O(s.name)}Plugin are both loaded, but they are currentl
|
|
|
2023
2121
|
}
|
|
2024
2122
|
}
|
|
2025
2123
|
}
|
|
2026
|
-
class
|
|
2124
|
+
class to {
|
|
2027
2125
|
constructor(e) {
|
|
2028
2126
|
this.grid = e;
|
|
2029
2127
|
}
|
|
@@ -2040,7 +2138,7 @@ class Bt {
|
|
|
2040
2138
|
this.attach(o);
|
|
2041
2139
|
}
|
|
2042
2140
|
attach(e) {
|
|
2043
|
-
if (
|
|
2141
|
+
if (Qt(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
|
|
2044
2142
|
for (const [o, n] of Object.entries(e.cellRenderers))
|
|
2045
2143
|
this.cellRenderers.set(o, n);
|
|
2046
2144
|
if (e.headerRenderers)
|
|
@@ -2108,6 +2206,20 @@ class Bt {
|
|
|
2108
2206
|
for (const e of this.plugins)
|
|
2109
2207
|
e.afterRender?.();
|
|
2110
2208
|
}
|
|
2209
|
+
afterCellRender(e) {
|
|
2210
|
+
for (const o of this.plugins)
|
|
2211
|
+
o.afterCellRender?.(e);
|
|
2212
|
+
}
|
|
2213
|
+
hasAfterCellRenderHook() {
|
|
2214
|
+
return this.plugins.some((e) => typeof e.afterCellRender == "function");
|
|
2215
|
+
}
|
|
2216
|
+
afterRowRender(e) {
|
|
2217
|
+
for (const o of this.plugins)
|
|
2218
|
+
o.afterRowRender?.(e);
|
|
2219
|
+
}
|
|
2220
|
+
hasAfterRowRenderHook() {
|
|
2221
|
+
return this.plugins.some((e) => typeof e.afterRowRender == "function");
|
|
2222
|
+
}
|
|
2111
2223
|
onScrollRender() {
|
|
2112
2224
|
for (const e of this.plugins)
|
|
2113
2225
|
e.onScrollRender?.();
|
|
@@ -2224,9 +2336,9 @@ class Bt {
|
|
|
2224
2336
|
return e.sort((o, n) => (o.content.order ?? 0) - (n.content.order ?? 0));
|
|
2225
2337
|
}
|
|
2226
2338
|
}
|
|
2227
|
-
class
|
|
2339
|
+
class H extends HTMLElement {
|
|
2228
2340
|
static tagName = "tbw-grid";
|
|
2229
|
-
static version = "1.
|
|
2341
|
+
static version = "1.3.0";
|
|
2230
2342
|
static adapters = [];
|
|
2231
2343
|
static registerAdapter(e) {
|
|
2232
2344
|
this.adapters.push(e);
|
|
@@ -2240,14 +2352,14 @@ class L extends HTMLElement {
|
|
|
2240
2352
|
static get observedAttributes() {
|
|
2241
2353
|
return ["rows", "columns", "grid-config", "fit-mode"];
|
|
2242
2354
|
}
|
|
2243
|
-
get #
|
|
2355
|
+
get #n() {
|
|
2244
2356
|
return this;
|
|
2245
2357
|
}
|
|
2246
2358
|
#c = !1;
|
|
2247
2359
|
#f;
|
|
2248
2360
|
#d;
|
|
2249
2361
|
#s = [];
|
|
2250
|
-
get #
|
|
2362
|
+
get #i() {
|
|
2251
2363
|
return this.#t?.effective ?? {};
|
|
2252
2364
|
}
|
|
2253
2365
|
#h = !1;
|
|
@@ -2263,11 +2375,11 @@ class L extends HTMLElement {
|
|
|
2263
2375
|
#w = null;
|
|
2264
2376
|
#r = !1;
|
|
2265
2377
|
#b;
|
|
2266
|
-
#A =
|
|
2378
|
+
#A = $t();
|
|
2267
2379
|
#p;
|
|
2268
|
-
#v;
|
|
2269
|
-
#y;
|
|
2270
2380
|
#C;
|
|
2381
|
+
#y;
|
|
2382
|
+
#v;
|
|
2271
2383
|
#E = {
|
|
2272
2384
|
scrollTop: 0,
|
|
2273
2385
|
scrollLeft: 0,
|
|
@@ -2276,23 +2388,23 @@ class L extends HTMLElement {
|
|
|
2276
2388
|
clientHeight: 0,
|
|
2277
2389
|
clientWidth: 0
|
|
2278
2390
|
};
|
|
2279
|
-
#
|
|
2391
|
+
#o;
|
|
2280
2392
|
#_;
|
|
2281
2393
|
#O = !1;
|
|
2282
2394
|
#P;
|
|
2283
2395
|
#L;
|
|
2284
2396
|
#t;
|
|
2285
|
-
#e =
|
|
2397
|
+
#e = Dt();
|
|
2286
2398
|
#a;
|
|
2287
2399
|
#D;
|
|
2288
2400
|
#H = /* @__PURE__ */ new Map();
|
|
2289
2401
|
_rows = [];
|
|
2290
|
-
#
|
|
2402
|
+
#I = [];
|
|
2291
2403
|
get _columns() {
|
|
2292
|
-
return this.#
|
|
2404
|
+
return this.#i.columns ?? [];
|
|
2293
2405
|
}
|
|
2294
2406
|
set _columns(e) {
|
|
2295
|
-
this.#
|
|
2407
|
+
this.#i.columns = e;
|
|
2296
2408
|
}
|
|
2297
2409
|
get _visibleColumns() {
|
|
2298
2410
|
return this._columns.filter((e) => !e.hidden);
|
|
@@ -2338,7 +2450,7 @@ class L extends HTMLElement {
|
|
|
2338
2450
|
}
|
|
2339
2451
|
set rows(e) {
|
|
2340
2452
|
const o = this.#s;
|
|
2341
|
-
this.#s = e, o !== e && this.#
|
|
2453
|
+
this.#s = e, o !== e && this.#k("rows");
|
|
2342
2454
|
}
|
|
2343
2455
|
get sourceRows() {
|
|
2344
2456
|
return this.#s;
|
|
@@ -2348,52 +2460,52 @@ class L extends HTMLElement {
|
|
|
2348
2460
|
}
|
|
2349
2461
|
set columns(e) {
|
|
2350
2462
|
const o = this.#t?.getColumns();
|
|
2351
|
-
this.#t?.setColumns(e), o !== e && this.#
|
|
2463
|
+
this.#t?.setColumns(e), o !== e && this.#k("columns");
|
|
2352
2464
|
}
|
|
2353
2465
|
get gridConfig() {
|
|
2354
|
-
return this.#
|
|
2466
|
+
return this.#i;
|
|
2355
2467
|
}
|
|
2356
2468
|
set gridConfig(e) {
|
|
2357
2469
|
const o = this.#t?.getGridConfig();
|
|
2358
|
-
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this.#
|
|
2470
|
+
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this.#k("gridConfig"));
|
|
2359
2471
|
}
|
|
2360
2472
|
get fitMode() {
|
|
2361
|
-
return this.#
|
|
2473
|
+
return this.#i.fitMode ?? "stretch";
|
|
2362
2474
|
}
|
|
2363
2475
|
set fitMode(e) {
|
|
2364
2476
|
const o = this.#t?.getFitMode();
|
|
2365
|
-
this.#t?.setFitMode(e), o !== e && this.#
|
|
2477
|
+
this.#t?.setFitMode(e), o !== e && this.#k("fitMode");
|
|
2366
2478
|
}
|
|
2367
2479
|
get effectiveConfig() {
|
|
2368
|
-
return this.#
|
|
2480
|
+
return this.#i;
|
|
2369
2481
|
}
|
|
2370
2482
|
get disconnectSignal() {
|
|
2371
2483
|
return this.#p || (this.#p = new AbortController()), this.#p.signal;
|
|
2372
2484
|
}
|
|
2373
2485
|
constructor() {
|
|
2374
|
-
super(), this.#le(), this.#f = new Promise((e) => this.#d = e), this.#l = new
|
|
2486
|
+
super(), this.#le(), this.#f = new Promise((e) => this.#d = e), this.#l = new Et({
|
|
2375
2487
|
mergeConfig: () => {
|
|
2376
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(),
|
|
2488
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), Zt(this.#i, this.#o?.getPlugins() ?? []), Jt(this.#o?.getPlugins() ?? []), eo(this.#o?.getPlugins() ?? []), this.#I = [...this._columns];
|
|
2377
2489
|
},
|
|
2378
2490
|
processColumns: () => this.#me(),
|
|
2379
2491
|
processRows: () => this.#be(),
|
|
2380
|
-
renderHeader: () =>
|
|
2381
|
-
updateTemplate: () =>
|
|
2492
|
+
renderHeader: () => J(this),
|
|
2493
|
+
updateTemplate: () => U(this),
|
|
2382
2494
|
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2383
2495
|
afterRender: () => {
|
|
2384
|
-
this.#
|
|
2496
|
+
this.#o?.afterRender(), this.#i.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, pe(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, $(this)), this._virtualization.enabled && !this.#N && this.#ce();
|
|
2385
2497
|
},
|
|
2386
2498
|
isConnected: () => this.isConnected && this.#h
|
|
2387
|
-
}), this.#l.setInitialReadyResolver(() => this.#d?.()), this.#a =
|
|
2388
|
-
getShadow: () => this.#
|
|
2389
|
-
getShellConfig: () => this.#
|
|
2499
|
+
}), this.#l.setInitialReadyResolver(() => this.#d?.()), this.#a = It(this.#e, {
|
|
2500
|
+
getShadow: () => this.#n,
|
|
2501
|
+
getShellConfig: () => this.#i?.shell,
|
|
2390
2502
|
getAccordionIcons: () => ({
|
|
2391
|
-
expand: this.#
|
|
2392
|
-
collapse: this.#
|
|
2503
|
+
expand: this.#i?.icons?.expand ?? z.expand,
|
|
2504
|
+
collapse: this.#i?.icons?.collapse ?? z.collapse
|
|
2393
2505
|
}),
|
|
2394
2506
|
emit: (e, o) => this.#T(e, o),
|
|
2395
2507
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2396
|
-
}), this.#t = new
|
|
2508
|
+
}), this.#t = new lt({
|
|
2397
2509
|
getRows: () => this.#s,
|
|
2398
2510
|
getSortState: () => this._sortState,
|
|
2399
2511
|
setSortState: (e) => {
|
|
@@ -2407,14 +2519,14 @@ class L extends HTMLElement {
|
|
|
2407
2519
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
2408
2520
|
},
|
|
2409
2521
|
setup: () => this.#x(),
|
|
2410
|
-
renderHeader: () =>
|
|
2411
|
-
updateTemplate: () =>
|
|
2522
|
+
renderHeader: () => J(this),
|
|
2523
|
+
updateTemplate: () => U(this),
|
|
2412
2524
|
refreshVirtualWindow: () => this.#l.requestPhase(x.VIRTUALIZATION, "configManager"),
|
|
2413
2525
|
getVirtualization: () => this._virtualization,
|
|
2414
2526
|
setRowHeight: (e) => {
|
|
2415
2527
|
this._virtualization.rowHeight = e;
|
|
2416
2528
|
},
|
|
2417
|
-
applyAnimationConfig: (e) => this.#
|
|
2529
|
+
applyAnimationConfig: (e) => this.#ve(e),
|
|
2418
2530
|
getShellLightDomTitle: () => this.#e.lightDomTitle,
|
|
2419
2531
|
getShellToolPanels: () => this.#e.toolPanels,
|
|
2420
2532
|
getShellHeaderContents: () => this.#e.headerContents,
|
|
@@ -2439,9 +2551,9 @@ class L extends HTMLElement {
|
|
|
2439
2551
|
${o}`;
|
|
2440
2552
|
}
|
|
2441
2553
|
async #le() {
|
|
2442
|
-
if (!
|
|
2443
|
-
if (
|
|
2444
|
-
|
|
2554
|
+
if (!H.#M) {
|
|
2555
|
+
if (he.length > 0) {
|
|
2556
|
+
H.#M = he, H.#W();
|
|
2445
2557
|
return;
|
|
2446
2558
|
}
|
|
2447
2559
|
await new Promise((e) => setTimeout(e, 50));
|
|
@@ -2458,7 +2570,7 @@ ${o}`;
|
|
|
2458
2570
|
} catch {
|
|
2459
2571
|
continue;
|
|
2460
2572
|
}
|
|
2461
|
-
e ? (
|
|
2573
|
+
e ? (H.#M = e, H.#W()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
|
|
2462
2574
|
"[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
|
|
2463
2575
|
"Available stylesheets:",
|
|
2464
2576
|
Array.from(document.styleSheets).map((o) => o.href || "(inline)")
|
|
@@ -2469,10 +2581,10 @@ ${o}`;
|
|
|
2469
2581
|
}
|
|
2470
2582
|
}
|
|
2471
2583
|
getPlugin(e) {
|
|
2472
|
-
return this.#
|
|
2584
|
+
return this.#o?.getPlugin(e);
|
|
2473
2585
|
}
|
|
2474
2586
|
getPluginByName(e) {
|
|
2475
|
-
return this.#
|
|
2587
|
+
return this.#o?.getPluginByName(e);
|
|
2476
2588
|
}
|
|
2477
2589
|
requestRender() {
|
|
2478
2590
|
this.#l.requestPhase(x.ROWS, "plugin:requestRender");
|
|
@@ -2481,31 +2593,31 @@ ${o}`;
|
|
|
2481
2593
|
this._restoreFocusAfterRender = !0, this.#l.requestPhase(x.ROWS, "plugin:requestRenderWithFocus");
|
|
2482
2594
|
}
|
|
2483
2595
|
updateTemplate() {
|
|
2484
|
-
|
|
2596
|
+
U(this);
|
|
2485
2597
|
}
|
|
2486
2598
|
requestAfterRender() {
|
|
2487
2599
|
this.#l.requestPhase(x.STYLE, "plugin:requestAfterRender");
|
|
2488
2600
|
}
|
|
2489
2601
|
#j() {
|
|
2490
|
-
this.#
|
|
2491
|
-
const e = this.#
|
|
2492
|
-
this.#
|
|
2602
|
+
this.#o = new to(this);
|
|
2603
|
+
const e = this.#i?.plugins, o = Array.isArray(e) ? e : [];
|
|
2604
|
+
this.#o.attachAll(o);
|
|
2493
2605
|
}
|
|
2494
2606
|
#z() {
|
|
2495
|
-
const e = this.#
|
|
2607
|
+
const e = this.#o?.getPluginStyles() ?? [];
|
|
2496
2608
|
let o = !1;
|
|
2497
2609
|
for (const { name: n, styles: i } of e)
|
|
2498
|
-
|
|
2499
|
-
o &&
|
|
2610
|
+
H.#q.has(n) || (H.#q.set(n, i), o = !0);
|
|
2611
|
+
o && H.#W();
|
|
2500
2612
|
}
|
|
2501
2613
|
#K() {
|
|
2502
|
-
const e = this.#
|
|
2614
|
+
const e = this.#i?.plugins, o = Array.isArray(e) ? e : [];
|
|
2503
2615
|
if (this.#_ !== o) {
|
|
2504
2616
|
if (this.#_ && this.#_.length === o.length && this.#_.every((n, i) => n === o[i])) {
|
|
2505
2617
|
this.#_ = o;
|
|
2506
2618
|
return;
|
|
2507
2619
|
}
|
|
2508
|
-
this.#
|
|
2620
|
+
this.#o && this.#o.detachAll();
|
|
2509
2621
|
for (const n of this.#e.toolPanels.keys()) {
|
|
2510
2622
|
const i = this.#e.lightDomToolPanelIds.has(n), r = this.#e.apiToolPanelIds.has(n);
|
|
2511
2623
|
if (!i && !r) {
|
|
@@ -2517,23 +2629,23 @@ ${o}`;
|
|
|
2517
2629
|
const i = this.#e.headerContentCleanups.get(n);
|
|
2518
2630
|
i && (i(), this.#e.headerContentCleanups.delete(n)), this.#e.headerContents.delete(n);
|
|
2519
2631
|
}
|
|
2520
|
-
this.#j(), this.#z(), this.#_ = o, this.#Z(), this.#r = this.#
|
|
2632
|
+
this.#j(), this.#z(), this.#_ = o, this.#Z(), this.#r = this.#o?.getAll().some((n) => n.onScroll) ?? !1;
|
|
2521
2633
|
}
|
|
2522
2634
|
}
|
|
2523
2635
|
#ae() {
|
|
2524
|
-
this.#
|
|
2636
|
+
this.#o?.detachAll();
|
|
2525
2637
|
}
|
|
2526
2638
|
#Z() {
|
|
2527
|
-
if (!this.#
|
|
2528
|
-
const e = this.#
|
|
2639
|
+
if (!this.#o) return;
|
|
2640
|
+
const e = this.#o.getToolPanels();
|
|
2529
2641
|
for (const { panel: n } of e)
|
|
2530
2642
|
this.#e.toolPanels.has(n.id) || this.#e.toolPanels.set(n.id, n);
|
|
2531
|
-
const o = this.#
|
|
2643
|
+
const o = this.#o.getHeaderContents();
|
|
2532
2644
|
for (const { content: n } of o)
|
|
2533
2645
|
this.#e.headerContents.has(n.id) || this.#e.headerContents.set(n.id, n);
|
|
2534
2646
|
}
|
|
2535
2647
|
#R() {
|
|
2536
|
-
const e =
|
|
2648
|
+
const e = H.getAdapters();
|
|
2537
2649
|
if (e.length === 0 && !this.__frameworkAdapter) return;
|
|
2538
2650
|
const o = this.__frameworkAdapter;
|
|
2539
2651
|
return (n) => {
|
|
@@ -2549,9 +2661,9 @@ ${o}`;
|
|
|
2549
2661
|
};
|
|
2550
2662
|
}
|
|
2551
2663
|
connectedCallback() {
|
|
2552
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version",
|
|
2553
|
-
const e = this.#
|
|
2554
|
-
this.#_ = Array.isArray(e) ? e : [], this.#Z(), this.#c || (this.#G(), this.#z(), this.#c = !0), this.#J(), this.#
|
|
2664
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", H.version), this._rows = Array.isArray(this.#s) ? [...this.#s] : [], this.#p && (this.#p.abort(), this.#O = !1), this.#p = new AbortController(), this.#v && (ye(this.#v), this.#v = void 0), I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#j();
|
|
2665
|
+
const e = this.#i?.plugins;
|
|
2666
|
+
this.#_ = Array.isArray(e) ? e : [], this.#Z(), this.#c || (this.#G(), this.#z(), this.#c = !0), this.#J(), this.#v = _t(
|
|
2555
2667
|
() => {
|
|
2556
2668
|
this.#Ee();
|
|
2557
2669
|
},
|
|
@@ -2559,7 +2671,7 @@ ${o}`;
|
|
|
2559
2671
|
);
|
|
2560
2672
|
}
|
|
2561
2673
|
disconnectedCallback() {
|
|
2562
|
-
this.#
|
|
2674
|
+
this.#v && (ye(this.#v), this.#v = void 0), this.#ae(), kt(this.#e), this.#a.setInitialized(!1), this.#D?.(), this.#D = void 0, Ue(this.#A), this.#p && (this.#p.abort(), this.#p = void 0), this.#P?.abort(), this.#P = void 0, this.#O = !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.#N = !1), X(this), this.#S.clear(), this.#_ = void 0;
|
|
2563
2675
|
for (const e of this._rowPool)
|
|
2564
2676
|
e.remove();
|
|
2565
2677
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#h = !1;
|
|
@@ -2576,22 +2688,22 @@ ${o}`;
|
|
|
2576
2688
|
else e === "fit-mode" && (this.fitMode = n);
|
|
2577
2689
|
}
|
|
2578
2690
|
#J() {
|
|
2579
|
-
const o = this.#
|
|
2691
|
+
const o = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
2580
2692
|
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.#a.isInitialized) {
|
|
2581
|
-
|
|
2582
|
-
const r = this.#
|
|
2693
|
+
se(this.#n, this.#e), Re(this.#n, this.#i?.shell, this.#e);
|
|
2694
|
+
const r = this.#i?.shell?.toolPanel?.defaultOpen;
|
|
2583
2695
|
r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
|
|
2584
2696
|
}
|
|
2585
|
-
if (this.setAttribute("data-upgraded", ""), this.#h = !0, this._resizeController =
|
|
2697
|
+
if (this.setAttribute("data-upgraded", ""), this.#h = !0, this._resizeController = _e(this), this.#x(), this.#ee(o), this.#O)
|
|
2586
2698
|
return;
|
|
2587
2699
|
this.#O = !0;
|
|
2588
2700
|
const n = this.disconnectSignal;
|
|
2589
|
-
|
|
2590
|
-
const i = this.#
|
|
2701
|
+
bt(this, this, this.#n, n);
|
|
2702
|
+
const i = this.#i.rowHeight;
|
|
2591
2703
|
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#Q()), queueMicrotask(() => this.#de()), this.#l.requestPhase(x.FULL, "afterConnect");
|
|
2592
2704
|
}
|
|
2593
2705
|
#Q() {
|
|
2594
|
-
if (this.#
|
|
2706
|
+
if (this.#o.hasExtraHeight())
|
|
2595
2707
|
return;
|
|
2596
2708
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2597
2709
|
if (!e) return;
|
|
@@ -2607,7 +2719,7 @@ ${o}`;
|
|
|
2607
2719
|
#ee(e) {
|
|
2608
2720
|
this.#P?.abort(), this.#P = new AbortController();
|
|
2609
2721
|
const o = this.#P.signal, n = e?.querySelector(".faux-vscroll"), i = e?.querySelector(".rows");
|
|
2610
|
-
if (this._virtualization.container = n ?? this, this.#r = this.#
|
|
2722
|
+
if (this._virtualization.container = n ?? this, this.#r = this.#o?.getAll().some((r) => r.onScroll) ?? !1, n && i) {
|
|
2611
2723
|
n.addEventListener(
|
|
2612
2724
|
"scroll",
|
|
2613
2725
|
() => {
|
|
@@ -2616,44 +2728,44 @@ ${o}`;
|
|
|
2616
2728
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
2617
2729
|
i.style.transform = `translateY(${-l}px)`;
|
|
2618
2730
|
else {
|
|
2619
|
-
const a = Math.floor(l / c), h = a - a % 2,
|
|
2620
|
-
i.style.transform = `translateY(${
|
|
2731
|
+
const a = Math.floor(l / c), h = a - a % 2, u = -(l - h * c);
|
|
2732
|
+
i.style.transform = `translateY(${u}px)`;
|
|
2621
2733
|
}
|
|
2622
2734
|
this.#w = l, this.#g || (this.#g = requestAnimationFrame(() => {
|
|
2623
|
-
this.#g = 0, this.#w !== null && (this.#
|
|
2735
|
+
this.#g = 0, this.#w !== null && (this.#Ce(this.#w), this.#w = null);
|
|
2624
2736
|
}));
|
|
2625
2737
|
},
|
|
2626
2738
|
{ passive: !0, signal: o }
|
|
2627
2739
|
);
|
|
2628
|
-
const r = this.#
|
|
2740
|
+
const r = this.#n.querySelector(".tbw-grid-content"), s = this.#n.querySelector(".tbw-scroll-area");
|
|
2629
2741
|
r && (r.addEventListener(
|
|
2630
2742
|
"wheel",
|
|
2631
2743
|
(l) => {
|
|
2632
2744
|
const c = l.shiftKey || Math.abs(l.deltaX) > Math.abs(l.deltaY);
|
|
2633
2745
|
if (c && s) {
|
|
2634
|
-
const a = l.shiftKey ? l.deltaY : l.deltaX, { scrollLeft: h, scrollWidth:
|
|
2635
|
-
(a > 0 && h <
|
|
2746
|
+
const a = l.shiftKey ? l.deltaY : l.deltaX, { scrollLeft: h, scrollWidth: u, clientWidth: p } = s;
|
|
2747
|
+
(a > 0 && h < u - p || a < 0 && h > 0) && (l.preventDefault(), s.scrollLeft += a);
|
|
2636
2748
|
} else if (!c) {
|
|
2637
|
-
const { scrollTop: a, scrollHeight: h, clientHeight:
|
|
2638
|
-
(l.deltaY > 0 && a < h -
|
|
2749
|
+
const { scrollTop: a, scrollHeight: h, clientHeight: u } = n;
|
|
2750
|
+
(l.deltaY > 0 && a < h - u || l.deltaY < 0 && a > 0) && (l.preventDefault(), n.scrollTop += l.deltaY);
|
|
2639
2751
|
}
|
|
2640
2752
|
},
|
|
2641
2753
|
{ passive: !1, signal: o }
|
|
2642
|
-
),
|
|
2754
|
+
), Xt(r, this.#A, { fauxScrollbar: n, scrollArea: s }, o));
|
|
2643
2755
|
}
|
|
2644
|
-
this._bodyEl &&
|
|
2756
|
+
this._bodyEl && mt(this, this._bodyEl, o), this.#C?.disconnect(), this._virtualization.viewportEl && (this.#C = new ResizeObserver(() => {
|
|
2645
2757
|
this.#l.requestPhase(x.VIRTUALIZATION, "resize-observer");
|
|
2646
|
-
}), this.#
|
|
2758
|
+
}), this.#C.observe(this._virtualization.viewportEl)), this.#n.addEventListener(
|
|
2647
2759
|
"focusin",
|
|
2648
2760
|
() => {
|
|
2649
2761
|
this.dataset.hasFocus = "";
|
|
2650
2762
|
},
|
|
2651
2763
|
{ signal: o }
|
|
2652
|
-
), this.#
|
|
2764
|
+
), this.#n.addEventListener(
|
|
2653
2765
|
"focusout",
|
|
2654
2766
|
(r) => {
|
|
2655
2767
|
const s = r.relatedTarget;
|
|
2656
|
-
(!s || !this.#
|
|
2768
|
+
(!s || !this.#n.contains(s)) && delete this.dataset.hasFocus;
|
|
2657
2769
|
},
|
|
2658
2770
|
{ signal: o }
|
|
2659
2771
|
);
|
|
@@ -2677,7 +2789,7 @@ ${o}`;
|
|
|
2677
2789
|
});
|
|
2678
2790
|
});
|
|
2679
2791
|
}
|
|
2680
|
-
#
|
|
2792
|
+
#k(e) {
|
|
2681
2793
|
this.#m[e] = !0, !this.#u && (this.#u = !0, queueMicrotask(() => this.#he()));
|
|
2682
2794
|
}
|
|
2683
2795
|
#he() {
|
|
@@ -2702,7 +2814,7 @@ ${o}`;
|
|
|
2702
2814
|
}
|
|
2703
2815
|
#$() {
|
|
2704
2816
|
this.#H.clear();
|
|
2705
|
-
const e = this.#
|
|
2817
|
+
const e = this.#i.getRowId;
|
|
2706
2818
|
this._rows.forEach((o, n) => {
|
|
2707
2819
|
const i = this.#oe(o, e);
|
|
2708
2820
|
i !== void 0 && this.#H.set(i, { row: o, index: n });
|
|
@@ -2724,18 +2836,18 @@ ${o}`;
|
|
|
2724
2836
|
return n;
|
|
2725
2837
|
}
|
|
2726
2838
|
#fe() {
|
|
2727
|
-
|
|
2839
|
+
X(this), this.#t.merge(), this.#x();
|
|
2728
2840
|
}
|
|
2729
2841
|
#pe() {
|
|
2730
|
-
this.#t.merge(), this.#
|
|
2842
|
+
this.#t.merge(), this.#i.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, pe(this)) : (this._columns.forEach((o) => {
|
|
2731
2843
|
!o.__userResized && o.__autoSized && delete o.width;
|
|
2732
|
-
}),
|
|
2844
|
+
}), U(this));
|
|
2733
2845
|
}
|
|
2734
2846
|
#ge() {
|
|
2735
|
-
I(this, this.#e),
|
|
2736
|
-
const e = !!this.#
|
|
2737
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(),
|
|
2738
|
-
const i =
|
|
2847
|
+
I(this, this.#e), q(this, this.#e);
|
|
2848
|
+
const e = !!this.#n.querySelector(".has-shell"), o = !!this.#n.querySelector(".tbw-tool-panel"), n = this.#n.querySelectorAll(".tbw-accordion-section").length;
|
|
2849
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
2850
|
+
const i = Fe(this.#i?.shell), r = (this.#i?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#i?.shell?.toolPanels?.length ?? 0) !== n;
|
|
2739
2851
|
if (e !== i || !e && i || !o && r || o && s) {
|
|
2740
2852
|
this.#G(), this.#z(), this.#J(), this.#$();
|
|
2741
2853
|
return;
|
|
@@ -2743,15 +2855,15 @@ ${o}`;
|
|
|
2743
2855
|
e && this.#we(), this.#$(), this.#l.requestPhase(x.COLUMNS, "applyGridConfigUpdate");
|
|
2744
2856
|
}
|
|
2745
2857
|
#we() {
|
|
2746
|
-
const e = this.#
|
|
2858
|
+
const e = this.#n.querySelector(".tbw-shell-header");
|
|
2747
2859
|
if (!e) return;
|
|
2748
|
-
const o = this.#
|
|
2860
|
+
const o = this.#i.shell?.header?.title ?? this.#e.lightDomTitle;
|
|
2749
2861
|
let n = e.querySelector(".tbw-shell-title");
|
|
2750
2862
|
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();
|
|
2751
2863
|
}
|
|
2752
2864
|
#me() {
|
|
2753
|
-
if (this.#
|
|
2754
|
-
const e = this.#
|
|
2865
|
+
if (this.#o) {
|
|
2866
|
+
const e = this.#I.length > 0 ? this.#I : this._columns, o = e.filter((r) => !r.hidden), n = e.filter((r) => r.hidden), i = this.#o.processColumns([...o]);
|
|
2755
2867
|
if (i !== o) {
|
|
2756
2868
|
new Set(o.map((l) => l.field));
|
|
2757
2869
|
const r = new Set(i.map((l) => l.field));
|
|
@@ -2761,20 +2873,20 @@ ${o}`;
|
|
|
2761
2873
|
}
|
|
2762
2874
|
}
|
|
2763
2875
|
#be() {
|
|
2764
|
-
|
|
2765
|
-
const e = Array.isArray(this.#s) ? [...this.#s] : [], o = this.#
|
|
2876
|
+
X(this);
|
|
2877
|
+
const e = Array.isArray(this.#s) ? [...this.#s] : [], o = this.#o?.processRows(e) ?? e;
|
|
2766
2878
|
this._rows = o;
|
|
2767
2879
|
}
|
|
2768
|
-
#
|
|
2880
|
+
#ve(e) {
|
|
2769
2881
|
const o = {
|
|
2770
|
-
...
|
|
2882
|
+
...Be,
|
|
2771
2883
|
...e.animation
|
|
2772
2884
|
}, n = o.mode ?? "reduced-motion";
|
|
2773
2885
|
let i = 1;
|
|
2774
2886
|
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;
|
|
2775
2887
|
}
|
|
2776
2888
|
#F(e, o, n = this.__rowRenderEpoch) {
|
|
2777
|
-
this.#b || (this.#b = (i, r, s) => this.#
|
|
2889
|
+
this.#b || (this.#b = (i, r, s) => this.#o?.renderRow(i, r, s) ?? !1), ht(this, e, o, n, this.#b);
|
|
2778
2890
|
}
|
|
2779
2891
|
#U = -1;
|
|
2780
2892
|
#ne = -1;
|
|
@@ -2789,20 +2901,20 @@ ${o}`;
|
|
|
2789
2901
|
if (this.#t.parseLightDomColumns(this), this.#L) {
|
|
2790
2902
|
const e = this.#L;
|
|
2791
2903
|
this.#L = void 0, this.#t.merge();
|
|
2792
|
-
const o = this.#
|
|
2904
|
+
const o = this.#o?.getAll() ?? [];
|
|
2793
2905
|
this.#t.applyState(e, o);
|
|
2794
2906
|
}
|
|
2795
2907
|
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#l.requestPhase(x.FULL, "setup");
|
|
2796
2908
|
}
|
|
2797
2909
|
}
|
|
2798
|
-
#
|
|
2799
|
-
if (this.refreshVirtualWindow(!1), this.#
|
|
2910
|
+
#Ce(e) {
|
|
2911
|
+
if (this.refreshVirtualWindow(!1), this.#o?.onScrollRender(), this.#r) {
|
|
2800
2912
|
const o = this._virtualization.container, n = this.#E;
|
|
2801
|
-
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.#
|
|
2913
|
+
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);
|
|
2802
2914
|
}
|
|
2803
2915
|
}
|
|
2804
2916
|
findHeaderRow() {
|
|
2805
|
-
return this.#
|
|
2917
|
+
return this.#n.querySelector(".header-row");
|
|
2806
2918
|
}
|
|
2807
2919
|
findRenderedRowElement(e) {
|
|
2808
2920
|
return Array.from(this._bodyEl.querySelectorAll(".data-grid-row")).find((o) => {
|
|
@@ -2838,8 +2950,8 @@ ${o}`;
|
|
|
2838
2950
|
value: c,
|
|
2839
2951
|
cellEl: i,
|
|
2840
2952
|
originalEvent: e
|
|
2841
|
-
},
|
|
2842
|
-
return this.#T("cell-click", h),
|
|
2953
|
+
}, u = this.#o?.onCellClick(h) ?? !1;
|
|
2954
|
+
return this.#T("cell-click", h), u;
|
|
2843
2955
|
}
|
|
2844
2956
|
_dispatchRowClick(e, o, n, i) {
|
|
2845
2957
|
if (!n) return !1;
|
|
@@ -2848,7 +2960,7 @@ ${o}`;
|
|
|
2848
2960
|
row: n,
|
|
2849
2961
|
rowEl: i,
|
|
2850
2962
|
originalEvent: e
|
|
2851
|
-
}, s = this.#
|
|
2963
|
+
}, s = this.#o?.onRowClick(r) ?? !1;
|
|
2852
2964
|
return this.#T("row-click", r), s;
|
|
2853
2965
|
}
|
|
2854
2966
|
_dispatchHeaderClick(e, o, n) {
|
|
@@ -2861,25 +2973,37 @@ ${o}`;
|
|
|
2861
2973
|
headerEl: n,
|
|
2862
2974
|
originalEvent: e
|
|
2863
2975
|
};
|
|
2864
|
-
return this.#
|
|
2976
|
+
return this.#o?.onHeaderClick(r) ?? !1;
|
|
2865
2977
|
}
|
|
2866
2978
|
_dispatchKeyDown(e) {
|
|
2867
|
-
return this.#
|
|
2979
|
+
return this.#o?.onKeyDown(e) ?? !1;
|
|
2868
2980
|
}
|
|
2869
2981
|
_getHorizontalScrollOffsets(e, o) {
|
|
2870
|
-
return this.#
|
|
2982
|
+
return this.#o?.getHorizontalScrollOffsets(e, o) ?? { left: 0, right: 0 };
|
|
2871
2983
|
}
|
|
2872
2984
|
queryPlugins(e) {
|
|
2873
|
-
return this.#
|
|
2985
|
+
return this.#o?.queryPlugins(e) ?? [];
|
|
2874
2986
|
}
|
|
2875
2987
|
_dispatchCellMouseDown(e) {
|
|
2876
|
-
return this.#
|
|
2988
|
+
return this.#o?.onCellMouseDown(e) ?? !1;
|
|
2877
2989
|
}
|
|
2878
2990
|
_dispatchCellMouseMove(e) {
|
|
2879
|
-
this.#
|
|
2991
|
+
this.#o?.onCellMouseMove(e);
|
|
2880
2992
|
}
|
|
2881
2993
|
_dispatchCellMouseUp(e) {
|
|
2882
|
-
this.#
|
|
2994
|
+
this.#o?.onCellMouseUp(e);
|
|
2995
|
+
}
|
|
2996
|
+
_afterCellRender(e) {
|
|
2997
|
+
this.#o?.afterCellRender(e);
|
|
2998
|
+
}
|
|
2999
|
+
_hasAfterCellRenderHook() {
|
|
3000
|
+
return this.#o?.hasAfterCellRenderHook() ?? !1;
|
|
3001
|
+
}
|
|
3002
|
+
_afterRowRender(e) {
|
|
3003
|
+
this.#o?.afterRowRender(e);
|
|
3004
|
+
}
|
|
3005
|
+
_hasAfterRowRenderHook() {
|
|
3006
|
+
return this.#o?.hasAfterRowRenderHook() ?? !1;
|
|
2883
3007
|
}
|
|
2884
3008
|
async ready() {
|
|
2885
3009
|
return this.#f;
|
|
@@ -2888,10 +3012,10 @@ ${o}`;
|
|
|
2888
3012
|
return this.#l.requestPhase(x.FULL, "forceLayout"), this.#l.whenReady();
|
|
2889
3013
|
}
|
|
2890
3014
|
async getConfig() {
|
|
2891
|
-
return Object.freeze({ ...this.#
|
|
3015
|
+
return Object.freeze({ ...this.#i || {} });
|
|
2892
3016
|
}
|
|
2893
3017
|
getRowId(e) {
|
|
2894
|
-
return this.#ue(e, this.#
|
|
3018
|
+
return this.#ue(e, this.#i.getRowId);
|
|
2895
3019
|
}
|
|
2896
3020
|
getRow(e) {
|
|
2897
3021
|
return this.#H.get(e)?.row;
|
|
@@ -2930,13 +3054,13 @@ ${o}`;
|
|
|
2930
3054
|
);
|
|
2931
3055
|
const { row: l, index: c } = s;
|
|
2932
3056
|
for (const [a, h] of Object.entries(r)) {
|
|
2933
|
-
const
|
|
2934
|
-
|
|
3057
|
+
const u = l[a];
|
|
3058
|
+
u !== h && (n = !0, l[a] = h, this.#T("cell-change", {
|
|
2935
3059
|
row: l,
|
|
2936
3060
|
rowId: i,
|
|
2937
3061
|
rowIndex: c,
|
|
2938
3062
|
field: a,
|
|
2939
|
-
oldValue:
|
|
3063
|
+
oldValue: u,
|
|
2940
3064
|
newValue: h,
|
|
2941
3065
|
changes: r,
|
|
2942
3066
|
source: o
|
|
@@ -2945,6 +3069,15 @@ ${o}`;
|
|
|
2945
3069
|
}
|
|
2946
3070
|
n && this.#l.requestPhase(x.ROWS, "updateRows");
|
|
2947
3071
|
}
|
|
3072
|
+
animateRow(e, o) {
|
|
3073
|
+
de(this, e, o);
|
|
3074
|
+
}
|
|
3075
|
+
animateRows(e, o) {
|
|
3076
|
+
Pt(this, e, o);
|
|
3077
|
+
}
|
|
3078
|
+
animateRowById(e, o) {
|
|
3079
|
+
return Lt(this, e, o);
|
|
3080
|
+
}
|
|
2948
3081
|
setColumnVisible(e, o) {
|
|
2949
3082
|
const n = this.#t.setColumnVisible(e, o);
|
|
2950
3083
|
return n && this.requestStateChange(), n;
|
|
@@ -2969,7 +3102,7 @@ ${o}`;
|
|
|
2969
3102
|
return this.#t.getColumnOrder();
|
|
2970
3103
|
}
|
|
2971
3104
|
getColumnState() {
|
|
2972
|
-
const e = this.#
|
|
3105
|
+
const e = this.#o?.getAll() ?? [];
|
|
2973
3106
|
return this.#t.collectState(e);
|
|
2974
3107
|
}
|
|
2975
3108
|
set columnState(e) {
|
|
@@ -2979,16 +3112,16 @@ ${o}`;
|
|
|
2979
3112
|
return this.getColumnState();
|
|
2980
3113
|
}
|
|
2981
3114
|
#ye(e) {
|
|
2982
|
-
const o = this.#
|
|
3115
|
+
const o = this.#o?.getAll() ?? [];
|
|
2983
3116
|
this.#t.applyState(e, o), this.#x();
|
|
2984
3117
|
}
|
|
2985
3118
|
requestStateChange() {
|
|
2986
|
-
const e = this.#
|
|
3119
|
+
const e = this.#o?.getAll() ?? [];
|
|
2987
3120
|
this.#t.requestStateChange(e);
|
|
2988
3121
|
}
|
|
2989
3122
|
resetColumnState() {
|
|
2990
3123
|
this.#L = void 0, this.__originalOrder = [];
|
|
2991
|
-
const e = this.#
|
|
3124
|
+
const e = this.#o?.getAll() ?? [];
|
|
2992
3125
|
this.#t.resetState(e), this.#t.merge(), this.#x();
|
|
2993
3126
|
}
|
|
2994
3127
|
get isToolPanelOpen() {
|
|
@@ -3039,17 +3172,17 @@ ${o}`;
|
|
|
3039
3172
|
#V = !1;
|
|
3040
3173
|
refreshShellHeader() {
|
|
3041
3174
|
this.#V || (this.#V = !0, queueMicrotask(() => {
|
|
3042
|
-
this.#V = !1, this.isConnected && (I(this, this.#e),
|
|
3175
|
+
this.#V = !1, this.isConnected && (I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge(), this.#G(), this.#z(), this.#_e());
|
|
3043
3176
|
}));
|
|
3044
3177
|
}
|
|
3045
3178
|
#_e() {
|
|
3046
|
-
const o = this.#
|
|
3179
|
+
const o = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
|
|
3047
3180
|
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.#a.isInitialized) {
|
|
3048
|
-
|
|
3049
|
-
const n = this.#
|
|
3181
|
+
se(this.#n, this.#e), Re(this.#n, this.#i?.shell, this.#e);
|
|
3182
|
+
const n = this.#i?.shell?.toolPanel?.defaultOpen;
|
|
3050
3183
|
n && this.#e.toolPanels.has(n) && (this.openToolPanel(), this.#e.expandedSections.add(n));
|
|
3051
3184
|
}
|
|
3052
|
-
this._resizeController =
|
|
3185
|
+
this._resizeController = _e(this), this.#ee(o), this.#l.requestPhase(x.COLUMNS, "shellRefresh");
|
|
3053
3186
|
}
|
|
3054
3187
|
#S = /* @__PURE__ */ new Map();
|
|
3055
3188
|
registerStyles(e, o) {
|
|
@@ -3071,16 +3204,16 @@ ${o}`;
|
|
|
3071
3204
|
#Ee() {
|
|
3072
3205
|
const e = () => {
|
|
3073
3206
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3074
|
-
I(this, this.#e),
|
|
3207
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R());
|
|
3075
3208
|
const r = this.#e.lightDomTitle, s = this.#e.hasToolButtonsContainer;
|
|
3076
3209
|
if (r && !n || s && !i) {
|
|
3077
3210
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3078
|
-
const l = this.#
|
|
3211
|
+
const l = this.#n.querySelector(".tbw-shell-header");
|
|
3079
3212
|
if (l) {
|
|
3080
|
-
const c =
|
|
3081
|
-
this.#
|
|
3213
|
+
const c = Se(
|
|
3214
|
+
this.#i.shell,
|
|
3082
3215
|
this.#e,
|
|
3083
|
-
this.#
|
|
3216
|
+
this.#i.icons?.toolPanel
|
|
3084
3217
|
), a = document.createElement("div");
|
|
3085
3218
|
a.innerHTML = c;
|
|
3086
3219
|
const h = a.firstElementChild;
|
|
@@ -3093,18 +3226,18 @@ ${o}`;
|
|
|
3093
3226
|
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);
|
|
3094
3227
|
}
|
|
3095
3228
|
refreshColumns() {
|
|
3096
|
-
this.__lightDomColumnsCache = void 0,
|
|
3229
|
+
this.__lightDomColumnsCache = void 0, X(this), this.#t.parseLightDomColumns(this);
|
|
3097
3230
|
const e = this.#e.lightDomTitle, o = this.#e.hasToolButtonsContainer;
|
|
3098
|
-
I(this, this.#e),
|
|
3231
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R());
|
|
3099
3232
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3100
3233
|
if (n && !e || i && !o) {
|
|
3101
3234
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3102
|
-
const s = this.#
|
|
3235
|
+
const s = this.#n.querySelector(".tbw-shell-header");
|
|
3103
3236
|
if (s) {
|
|
3104
|
-
const l =
|
|
3105
|
-
this.#
|
|
3237
|
+
const l = Se(
|
|
3238
|
+
this.#i.shell,
|
|
3106
3239
|
this.#e,
|
|
3107
|
-
this.#
|
|
3240
|
+
this.#i.icons?.toolPanel
|
|
3108
3241
|
), c = document.createElement("div");
|
|
3109
3242
|
c.innerHTML = l;
|
|
3110
3243
|
const a = c.firstElementChild;
|
|
@@ -3114,76 +3247,76 @@ ${o}`;
|
|
|
3114
3247
|
this.#l.requestPhase(x.COLUMNS, "refreshColumns");
|
|
3115
3248
|
}
|
|
3116
3249
|
#B(e) {
|
|
3117
|
-
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight, c = this.shadowRoot?.querySelector(".tbw-scroll-area"), a = c ? c.clientHeight : r,
|
|
3118
|
-
return e * o +
|
|
3250
|
+
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight, c = this.shadowRoot?.querySelector(".tbw-scroll-area"), a = c ? c.clientHeight : r, u = a - s, p = this.#o?.getExtraHeight() ?? 0, f = Math.max(0, r - a);
|
|
3251
|
+
return e * o + u + p + f;
|
|
3119
3252
|
}
|
|
3120
3253
|
refreshVirtualWindow(e = !1, o = !1) {
|
|
3121
3254
|
if (!this._bodyEl) return;
|
|
3122
3255
|
const n = this._rows.length;
|
|
3123
3256
|
if (!this._virtualization.enabled) {
|
|
3124
|
-
this.#F(0, n), o || this.#
|
|
3257
|
+
this.#F(0, n), o || this.#o?.afterRender();
|
|
3125
3258
|
return;
|
|
3126
3259
|
}
|
|
3127
3260
|
if (this._rows.length <= this._virtualization.bypassThreshold) {
|
|
3128
|
-
this._virtualization.start = 0, this._virtualization.end = n, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#F(0, n, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#B(n)}px`), this.#ie(n, this._visibleColumns.length), o || this.#
|
|
3261
|
+
this._virtualization.start = 0, this._virtualization.end = n, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#F(0, n, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#B(n)}px`), this.#ie(n, this._visibleColumns.length), o || this.#o?.afterRender();
|
|
3129
3262
|
return;
|
|
3130
3263
|
}
|
|
3131
3264
|
const i = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? i, s = r.clientHeight, l = this._virtualization.rowHeight, c = i.scrollTop;
|
|
3132
3265
|
let a = Math.floor(c / l), h = 0;
|
|
3133
|
-
const
|
|
3134
|
-
for (; h <
|
|
3135
|
-
const
|
|
3136
|
-
if (
|
|
3137
|
-
a =
|
|
3266
|
+
const u = 10;
|
|
3267
|
+
for (; h < u; ) {
|
|
3268
|
+
const v = this.#o?.getExtraHeightBefore?.(a) ?? 0, T = Math.floor((c - v) / l);
|
|
3269
|
+
if (T >= a || T < 0) break;
|
|
3270
|
+
a = T, h++;
|
|
3138
3271
|
}
|
|
3139
3272
|
a = a - a % 2, a < 0 && (a = 0);
|
|
3140
|
-
const
|
|
3141
|
-
|
|
3142
|
-
const
|
|
3143
|
-
let
|
|
3144
|
-
if (
|
|
3273
|
+
const p = this.#o?.adjustVirtualStart(a, c, l);
|
|
3274
|
+
p !== void 0 && p < a && (a = p, a = a - a % 2, a < 0 && (a = 0));
|
|
3275
|
+
const f = Math.ceil(s / l) + 3;
|
|
3276
|
+
let g = a + f;
|
|
3277
|
+
if (g > n && (g = n), this._virtualization.start = a, this._virtualization.end = g, i.clientHeight === 0 && s > 0) {
|
|
3145
3278
|
this.#l.requestPhase(x.VIRTUALIZATION, "stale-refs-retry");
|
|
3146
3279
|
return;
|
|
3147
3280
|
}
|
|
3148
|
-
const
|
|
3149
|
-
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${
|
|
3150
|
-
const
|
|
3151
|
-
this._bodyEl.style.transform = `translateY(${R}px)`, this.#F(a,
|
|
3152
|
-
const
|
|
3153
|
-
if (
|
|
3154
|
-
const
|
|
3155
|
-
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${
|
|
3281
|
+
const w = this.#B(n);
|
|
3282
|
+
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${w}px`);
|
|
3283
|
+
const m = this.#o?.getExtraHeightBefore?.(a) ?? 0, R = -(c - a * l - m);
|
|
3284
|
+
this._bodyEl.style.transform = `translateY(${R}px)`, this.#F(a, g, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#ie(n, this._visibleColumns.length), e && !o && (this.#o?.afterRender(), queueMicrotask(() => {
|
|
3285
|
+
const v = i.clientHeight, T = r.clientHeight;
|
|
3286
|
+
if (v === 0 && T > 0) return;
|
|
3287
|
+
const b = this.#B(n);
|
|
3288
|
+
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${b}px`);
|
|
3156
3289
|
}));
|
|
3157
3290
|
}
|
|
3158
3291
|
#G() {
|
|
3159
|
-
I(this, this.#e),
|
|
3160
|
-
const e = this.#
|
|
3161
|
-
|
|
3162
|
-
this.#
|
|
3292
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3293
|
+
const e = this.#i?.shell;
|
|
3294
|
+
Wt(
|
|
3295
|
+
this.#n,
|
|
3163
3296
|
e,
|
|
3164
3297
|
{ isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
|
|
3165
|
-
this.#
|
|
3298
|
+
this.#i?.icons
|
|
3166
3299
|
) && (this.#X(), this.#a.setInitialized(!0));
|
|
3167
3300
|
}
|
|
3168
3301
|
#X() {
|
|
3169
|
-
|
|
3302
|
+
Mt(this.#n, this.#i?.shell, this.#e, {
|
|
3170
3303
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3171
3304
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3172
|
-
}), this.#D?.(), this.#D =
|
|
3305
|
+
}), this.#D?.(), this.#D = zt(this.#n, this.#i?.shell, (e) => {
|
|
3173
3306
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3174
3307
|
});
|
|
3175
3308
|
}
|
|
3176
3309
|
}
|
|
3177
|
-
customElements.get(
|
|
3178
|
-
globalThis.DataGridElement =
|
|
3179
|
-
const
|
|
3310
|
+
customElements.get(H.tagName) || customElements.define(H.tagName, H);
|
|
3311
|
+
globalThis.DataGridElement = H;
|
|
3312
|
+
const no = {
|
|
3180
3313
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3181
3314
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3182
3315
|
};
|
|
3183
|
-
class
|
|
3316
|
+
class io {
|
|
3184
3317
|
static dependencies;
|
|
3185
3318
|
static manifest;
|
|
3186
|
-
version = "1.
|
|
3319
|
+
version = "1.3.0";
|
|
3187
3320
|
styles;
|
|
3188
3321
|
cellRenderers;
|
|
3189
3322
|
headerRenderers;
|
|
@@ -3191,7 +3324,7 @@ class Yt {
|
|
|
3191
3324
|
grid;
|
|
3192
3325
|
config;
|
|
3193
3326
|
userConfig;
|
|
3194
|
-
#
|
|
3327
|
+
#n;
|
|
3195
3328
|
get defaultConfig() {
|
|
3196
3329
|
return {};
|
|
3197
3330
|
}
|
|
@@ -3199,10 +3332,10 @@ class Yt {
|
|
|
3199
3332
|
this.userConfig = e;
|
|
3200
3333
|
}
|
|
3201
3334
|
attach(e) {
|
|
3202
|
-
this.#
|
|
3335
|
+
this.#n?.abort(), this.#n = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
3203
3336
|
}
|
|
3204
3337
|
detach() {
|
|
3205
|
-
this.#
|
|
3338
|
+
this.#n?.abort(), this.#n = void 0;
|
|
3206
3339
|
}
|
|
3207
3340
|
getPlugin(e) {
|
|
3208
3341
|
return this.grid?.getPlugin(e);
|
|
@@ -3239,11 +3372,11 @@ class Yt {
|
|
|
3239
3372
|
return this.grid;
|
|
3240
3373
|
}
|
|
3241
3374
|
get disconnectSignal() {
|
|
3242
|
-
return this.#
|
|
3375
|
+
return this.#n?.signal ?? this.grid?.disconnectSignal;
|
|
3243
3376
|
}
|
|
3244
3377
|
get gridIcons() {
|
|
3245
3378
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
3246
|
-
return { ...
|
|
3379
|
+
return { ...z, ...e };
|
|
3247
3380
|
}
|
|
3248
3381
|
get isAnimationEnabled() {
|
|
3249
3382
|
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
@@ -3303,14 +3436,14 @@ const A = {
|
|
|
3303
3436
|
GROUP_COUNT: "group-count",
|
|
3304
3437
|
RANGE_SELECTION: "range-selection",
|
|
3305
3438
|
SELECTION_OVERLAY: "selection-overlay"
|
|
3306
|
-
},
|
|
3439
|
+
}, j = {
|
|
3307
3440
|
ROW_INDEX: "data-row-index",
|
|
3308
3441
|
COL_INDEX: "data-col-index",
|
|
3309
3442
|
FIELD: "data-field",
|
|
3310
3443
|
GROUP_KEY: "data-group-key",
|
|
3311
3444
|
TREE_LEVEL: "data-tree-level",
|
|
3312
3445
|
STICKY: "data-sticky"
|
|
3313
|
-
},
|
|
3446
|
+
}, ro = {
|
|
3314
3447
|
ROOT: `.${A.ROOT}`,
|
|
3315
3448
|
HEADER: `.${A.HEADER}`,
|
|
3316
3449
|
HEADER_ROW: `.${A.HEADER_ROW}`,
|
|
@@ -3320,12 +3453,12 @@ const A = {
|
|
|
3320
3453
|
DATA_ROW: `.${A.DATA_ROW}`,
|
|
3321
3454
|
DATA_CELL: `.${A.DATA_CELL}`,
|
|
3322
3455
|
GROUP_ROW: `.${A.GROUP_ROW}`,
|
|
3323
|
-
ROW_BY_INDEX: (t) => `.${A.DATA_ROW}[${
|
|
3324
|
-
CELL_BY_FIELD: (t) => `.${A.DATA_CELL}[${
|
|
3325
|
-
CELL_AT: (t, e) => `.${A.DATA_ROW}[${
|
|
3456
|
+
ROW_BY_INDEX: (t) => `.${A.DATA_ROW}[${j.ROW_INDEX}="${t}"]`,
|
|
3457
|
+
CELL_BY_FIELD: (t) => `.${A.DATA_CELL}[${j.FIELD}="${t}"]`,
|
|
3458
|
+
CELL_AT: (t, e) => `.${A.DATA_ROW}[${j.ROW_INDEX}="${t}"] .${A.DATA_CELL}[${j.COL_INDEX}="${e}"]`,
|
|
3326
3459
|
SELECTED_ROWS: `.${A.DATA_ROW}.${A.SELECTED}`,
|
|
3327
3460
|
EDITING_CELL: `.${A.DATA_CELL}.${A.EDITING}`
|
|
3328
|
-
},
|
|
3461
|
+
}, so = {
|
|
3329
3462
|
COLOR_BG: "--tbw-color-bg",
|
|
3330
3463
|
COLOR_FG: "--tbw-color-fg",
|
|
3331
3464
|
COLOR_FG_MUTED: "--tbw-color-fg-muted",
|
|
@@ -3344,14 +3477,14 @@ const A = {
|
|
|
3344
3477
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
3345
3478
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
3346
3479
|
};
|
|
3347
|
-
function
|
|
3480
|
+
function lo(t) {
|
|
3348
3481
|
const e = document.createElement("tbw-grid");
|
|
3349
3482
|
return t && (e.gridConfig = t), e;
|
|
3350
3483
|
}
|
|
3351
|
-
function
|
|
3484
|
+
function ao(t, e = document) {
|
|
3352
3485
|
return e.querySelector(t);
|
|
3353
3486
|
}
|
|
3354
|
-
const
|
|
3487
|
+
const co = {
|
|
3355
3488
|
CELL_CHANGE: "cell-change",
|
|
3356
3489
|
CELL_COMMIT: "cell-commit",
|
|
3357
3490
|
ROW_COMMIT: "row-commit",
|
|
@@ -3364,7 +3497,7 @@ const Qt = {
|
|
|
3364
3497
|
CELL_ACTIVATE: "cell-activate",
|
|
3365
3498
|
GROUP_TOGGLE: "group-toggle",
|
|
3366
3499
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
3367
|
-
},
|
|
3500
|
+
}, ho = {
|
|
3368
3501
|
SELECTION_CHANGE: "selection-change",
|
|
3369
3502
|
TREE_EXPAND: "tree-expand",
|
|
3370
3503
|
FILTER_CHANGE: "filter-change",
|
|
@@ -3382,7 +3515,7 @@ const Qt = {
|
|
|
3382
3515
|
COLUMN_REORDER: "column-reorder",
|
|
3383
3516
|
DETAIL_EXPAND: "detail-expand",
|
|
3384
3517
|
GROUP_EXPAND: "group-expand"
|
|
3385
|
-
},
|
|
3518
|
+
}, re = {
|
|
3386
3519
|
sum: (t, e) => t.reduce((o, n) => o + (Number(n[e]) || 0), 0),
|
|
3387
3520
|
avg: (t, e) => {
|
|
3388
3521
|
const o = t.reduce((n, i) => n + (Number(i[e]) || 0), 0);
|
|
@@ -3393,28 +3526,28 @@ const Qt = {
|
|
|
3393
3526
|
max: (t, e) => Math.max(...t.map((o) => Number(o[e]) || -1 / 0)),
|
|
3394
3527
|
first: (t, e) => t[0]?.[e],
|
|
3395
3528
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
3396
|
-
},
|
|
3529
|
+
}, F = /* @__PURE__ */ new Map(), M = {
|
|
3397
3530
|
register(t, e) {
|
|
3398
|
-
|
|
3531
|
+
F.set(t, e);
|
|
3399
3532
|
},
|
|
3400
3533
|
unregister(t) {
|
|
3401
|
-
|
|
3534
|
+
F.delete(t);
|
|
3402
3535
|
},
|
|
3403
3536
|
get(t) {
|
|
3404
3537
|
if (t !== void 0)
|
|
3405
|
-
return typeof t == "function" ? t :
|
|
3538
|
+
return typeof t == "function" ? t : F.get(t) ?? re[t];
|
|
3406
3539
|
},
|
|
3407
3540
|
run(t, e, o, n) {
|
|
3408
3541
|
const i = this.get(t);
|
|
3409
3542
|
return i ? i(e, o, n) : void 0;
|
|
3410
3543
|
},
|
|
3411
3544
|
has(t) {
|
|
3412
|
-
return
|
|
3545
|
+
return F.has(t) || t in re;
|
|
3413
3546
|
},
|
|
3414
3547
|
list() {
|
|
3415
|
-
return [...Object.keys(
|
|
3548
|
+
return [...Object.keys(re), ...F.keys()];
|
|
3416
3549
|
}
|
|
3417
|
-
},
|
|
3550
|
+
}, Pe = {
|
|
3418
3551
|
sum: (t) => t.reduce((e, o) => e + o, 0),
|
|
3419
3552
|
avg: (t) => t.length ? t.reduce((e, o) => e + o, 0) / t.length : 0,
|
|
3420
3553
|
count: (t) => t.length,
|
|
@@ -3423,45 +3556,46 @@ const Qt = {
|
|
|
3423
3556
|
first: (t) => t[0] ?? 0,
|
|
3424
3557
|
last: (t) => t[t.length - 1] ?? 0
|
|
3425
3558
|
};
|
|
3426
|
-
function
|
|
3427
|
-
return
|
|
3559
|
+
function oo(t) {
|
|
3560
|
+
return Pe[t] ?? Pe.sum;
|
|
3428
3561
|
}
|
|
3429
|
-
function
|
|
3430
|
-
return
|
|
3562
|
+
function uo(t, e) {
|
|
3563
|
+
return oo(t)(e);
|
|
3431
3564
|
}
|
|
3432
|
-
const
|
|
3565
|
+
const fo = M.register.bind(M), po = M.unregister.bind(M), go = M.get.bind(M), wo = M.run.bind(M), mo = M.list.bind(M);
|
|
3433
3566
|
export {
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3567
|
+
io as BaseGridPlugin,
|
|
3568
|
+
Be as DEFAULT_ANIMATION_CONFIG,
|
|
3569
|
+
z as DEFAULT_GRID_ICONS,
|
|
3570
|
+
co as DGEvents,
|
|
3571
|
+
H as DataGridElement,
|
|
3572
|
+
B as FitModeEnum,
|
|
3573
|
+
so as GridCSSVars,
|
|
3441
3574
|
A as GridClasses,
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3575
|
+
j as GridDataAttrs,
|
|
3576
|
+
H as GridElement,
|
|
3577
|
+
ro as GridSelectors,
|
|
3578
|
+
no as PLUGIN_QUERIES,
|
|
3579
|
+
ho as PluginEvents,
|
|
3580
|
+
to as PluginManager,
|
|
3448
3581
|
x as RenderPhase,
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
Le as
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3582
|
+
At as a,
|
|
3583
|
+
M as aggregatorRegistry,
|
|
3584
|
+
$ as b,
|
|
3585
|
+
Ct as builtInSort,
|
|
3586
|
+
ae as c,
|
|
3587
|
+
lo as createGrid,
|
|
3588
|
+
vt as defaultComparator,
|
|
3589
|
+
Le as e,
|
|
3590
|
+
De as g,
|
|
3591
|
+
go as getAggregator,
|
|
3592
|
+
oo as getValueAggregator,
|
|
3593
|
+
mo as listAggregators,
|
|
3594
|
+
ao as queryGrid,
|
|
3595
|
+
fo as registerAggregator,
|
|
3596
|
+
wo as runAggregator,
|
|
3597
|
+
uo as runValueAggregator,
|
|
3598
|
+
K as s,
|
|
3599
|
+
po as unregisterAggregator
|
|
3466
3600
|
};
|
|
3467
3601
|
//# sourceMappingURL=index.js.map
|