@toolbox-web/grid 1.1.0 → 1.1.2
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/all.js +189 -113
- package/all.js.map +1 -1
- package/index.js +757 -716
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +7 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/validate-config.d.ts +10 -0
- package/lib/core/internal/validate-config.d.ts.map +1 -1
- package/lib/core/plugin/base-plugin.d.ts +30 -0
- 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 +6 -0
- package/lib/core/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/core/types.d.ts +1 -1
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.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/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/GroupingRowsPlugin.d.ts.map +1 -1
- package/lib/plugins/grouping-rows/index.js +5 -5
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- 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/ResponsivePlugin.d.ts +24 -1
- package/lib/plugins/responsive/ResponsivePlugin.d.ts.map +1 -1
- package/lib/plugins/responsive/index.js +225 -88
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/selection/index.js.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 +1 -1
- package/umd/grid.all.umd.js +25 -19
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +18 -12
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/grouping-rows.umd.js +1 -1
- package/umd/plugins/grouping-rows.umd.js.map +1 -1
- package/umd/plugins/responsive.umd.js +1 -1
- package/umd/plugins/responsive.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const le = '@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 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 = {
|
|
2
2
|
STRETCH: "stretch",
|
|
3
3
|
FIXED: "fixed"
|
|
4
|
-
},
|
|
4
|
+
}, Fe = {
|
|
5
5
|
mode: "reduced-motion",
|
|
6
6
|
duration: 200,
|
|
7
7
|
easing: "ease-out"
|
|
8
|
-
},
|
|
8
|
+
}, M = {
|
|
9
9
|
expand: "▶",
|
|
10
10
|
collapse: "▼",
|
|
11
11
|
sortAsc: "▲",
|
|
@@ -15,44 +15,44 @@ const le = '@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 Ue(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,
|
|
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 }, d = o.getAttribute("width");
|
|
23
23
|
if (d) {
|
|
24
24
|
const _ = parseFloat(d);
|
|
25
25
|
!isNaN(_) && /^\d+(\.\d+)?$/.test(d.trim()) ? h.width = _ : h.width = d;
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
-
const _ = parseFloat(
|
|
27
|
+
const f = o.getAttribute("minWidth") || o.getAttribute("min-width");
|
|
28
|
+
if (f) {
|
|
29
|
+
const _ = parseFloat(f);
|
|
30
30
|
isNaN(_) || (h.minWidth = _);
|
|
31
31
|
}
|
|
32
32
|
o.hasAttribute("resizable") && (h.resizable = !0), o.hasAttribute("sizable") && (h.resizable = !0);
|
|
33
|
-
const p = o.getAttribute("editor"),
|
|
34
|
-
p && (h.__editorName = p),
|
|
33
|
+
const p = o.getAttribute("editor"), u = o.getAttribute("renderer");
|
|
34
|
+
p && (h.__editorName = p), u && (h.__rendererName = u);
|
|
35
35
|
const g = o.getAttribute("options");
|
|
36
36
|
g && (h.options = g.split(",").map((_) => {
|
|
37
37
|
const [E, T] = _.includes(":") ? _.split(":") : [_.trim(), _.trim()];
|
|
38
38
|
return { value: E.trim(), label: T?.trim() || E.trim() };
|
|
39
39
|
}));
|
|
40
|
-
const m = o.querySelector("tbw-grid-column-view"),
|
|
41
|
-
m && (h.__viewTemplate = m),
|
|
42
|
-
const w = globalThis.DataGridElement?.getAdapters?.() ?? [],
|
|
40
|
+
const m = o.querySelector("tbw-grid-column-view"), y = o.querySelector("tbw-grid-column-editor"), R = o.querySelector("tbw-grid-column-header");
|
|
41
|
+
m && (h.__viewTemplate = m), y && (h.__editorTemplate = y), R && (h.__headerTemplate = R);
|
|
42
|
+
const w = globalThis.DataGridElement?.getAdapters?.() ?? [], v = m ?? o, S = w.find((_) => _.canHandle(v));
|
|
43
43
|
if (S) {
|
|
44
|
-
const _ = S.createRenderer(
|
|
44
|
+
const _ = S.createRenderer(v);
|
|
45
45
|
_ && (h.viewRenderer = _);
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const _ =
|
|
47
|
+
const b = y ?? o, z = w.find((_) => _.canHandle(b));
|
|
48
|
+
if (z) {
|
|
49
|
+
const _ = z.createEditor(b);
|
|
50
50
|
_ && (h.editor = _);
|
|
51
51
|
}
|
|
52
52
|
return h;
|
|
53
53
|
}).filter((o) => !!o);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function ce(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;
|
|
@@ -71,12 +71,12 @@ function ae(t, e) {
|
|
|
71
71
|
if (!r) return i;
|
|
72
72
|
const s = { ...i };
|
|
73
73
|
r.header && !s.header && (s.header = r.header), r.type && !s.type && (s.type = r.type), s.sortable = i.sortable || r.sortable, (i.resizable === !0 || r.resizable === !0) && (s.resizable = !0), s.editable = i.editable || r.editable, r.width != null && s.width == null && (s.width = r.width), r.minWidth != null && s.minWidth == null && (s.minWidth = r.minWidth), r.__viewTemplate && (s.__viewTemplate = r.__viewTemplate), r.__editorTemplate && (s.__editorTemplate = r.__editorTemplate), r.__headerTemplate && (s.__headerTemplate = r.__headerTemplate);
|
|
74
|
-
const l = r.renderer || r.viewRenderer,
|
|
75
|
-
return l && !
|
|
74
|
+
const l = r.renderer || r.viewRenderer, c = s.renderer || s.viewRenderer;
|
|
75
|
+
return l && !c && (s.viewRenderer = l, r.renderer && (s.renderer = l)), r.editor && !s.editor && (s.editor = r.editor), delete o[i.field], s;
|
|
76
76
|
});
|
|
77
77
|
return Object.keys(o).forEach((i) => n.push(o[i])), n;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function de(t, e) {
|
|
80
80
|
try {
|
|
81
81
|
t.part?.add?.(e);
|
|
82
82
|
} catch {
|
|
@@ -84,7 +84,7 @@ function ce(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
|
|
87
|
+
function he(t) {
|
|
88
88
|
const e = t.effectiveConfig?.fitMode || t.fitMode || V.STRETCH;
|
|
89
89
|
if (e !== V.STRETCH && e !== V.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
|
|
90
90
|
const o = Array.from(t._headerRowEl?.children || []);
|
|
@@ -94,10 +94,10 @@ function de(t) {
|
|
|
94
94
|
if (i.width) return;
|
|
95
95
|
const s = o[r];
|
|
96
96
|
let l = s ? s.scrollWidth : 0;
|
|
97
|
-
for (const
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const h =
|
|
97
|
+
for (const c of t._rowPool) {
|
|
98
|
+
const a = c.children[r];
|
|
99
|
+
if (a) {
|
|
100
|
+
const h = a.scrollWidth;
|
|
101
101
|
h > l && (l = h);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -111,23 +111,23 @@ function F(t) {
|
|
|
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 Ve(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 Be(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 = Ve(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 Ge = /{{\s*([^}]+)\s*}}/g, H = "__DG_EMPTY__", Xe = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, Ye = /__(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 Ke = /* @__PURE__ */ new Set([
|
|
131
131
|
"script",
|
|
132
132
|
"iframe",
|
|
133
133
|
"object",
|
|
@@ -152,23 +152,23 @@ const Xe = /* @__PURE__ */ new Set([
|
|
|
152
152
|
"plaintext",
|
|
153
153
|
"xmp",
|
|
154
154
|
"listing"
|
|
155
|
-
]),
|
|
155
|
+
]), ue = /^on\w+$/i, Ze = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), Je = /^\s*(javascript|vbscript|data|blob):/i;
|
|
156
156
|
function j(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, Qe(e.content), e.innerHTML;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
162
|
+
function Qe(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 (Ke.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) => ue.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 Ke(t) {
|
|
|
176
176
|
const r = [];
|
|
177
177
|
for (const s of n.attributes) {
|
|
178
178
|
const l = s.name.toLowerCase();
|
|
179
|
-
if (
|
|
179
|
+
if (ue.test(l)) {
|
|
180
180
|
r.push(s.name);
|
|
181
181
|
continue;
|
|
182
182
|
}
|
|
183
|
-
if (
|
|
183
|
+
if (Ze.has(l) && Je.test(s.value)) {
|
|
184
184
|
r.push(s.name);
|
|
185
185
|
continue;
|
|
186
186
|
}
|
|
@@ -193,22 +193,22 @@ function Ke(t) {
|
|
|
193
193
|
}
|
|
194
194
|
e.forEach((n) => n.remove());
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function xe(t, e) {
|
|
197
197
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
198
|
-
const o = [], n = t.replace(
|
|
199
|
-
const
|
|
200
|
-
return o.push({ expr:
|
|
201
|
-
}), i =
|
|
198
|
+
const o = [], n = t.replace(Ge, (l, c) => {
|
|
199
|
+
const a = et(c, e);
|
|
200
|
+
return o.push({ expr: c.trim(), result: a }), a;
|
|
201
|
+
}), i = tt(n), r = o.length && o.every((l) => l.result === "" || l.result === H);
|
|
202
202
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : i;
|
|
203
203
|
}
|
|
204
|
-
function
|
|
204
|
+
function et(t, e) {
|
|
205
205
|
if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return H;
|
|
206
206
|
if (t === "value") return e.value == null ? H : 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
209
|
return i == null ? H : String(i);
|
|
210
210
|
}
|
|
211
|
-
if (t.length > 80 || !
|
|
211
|
+
if (t.length > 80 || !Xe.test(t) || Ye.test(t)) return H;
|
|
212
212
|
const o = t.match(/\./g);
|
|
213
213
|
if (o && o.length > 1) return H;
|
|
214
214
|
try {
|
|
@@ -218,10 +218,10 @@ function Ze(t, e) {
|
|
|
218
218
|
return H;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function tt(t) {
|
|
222
222
|
return t && t.replace(new RegExp(H, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function ot(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 Qe(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 fe(t) {
|
|
237
|
+
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" : xe(t, n));
|
|
238
238
|
return o.__blocked = e, o;
|
|
239
239
|
}
|
|
240
|
-
const
|
|
241
|
-
class
|
|
242
|
-
#
|
|
240
|
+
const nt = 100;
|
|
241
|
+
class it {
|
|
242
|
+
#o;
|
|
243
243
|
#c;
|
|
244
244
|
#f;
|
|
245
245
|
#d;
|
|
246
246
|
#s;
|
|
247
|
-
#
|
|
247
|
+
#n = {};
|
|
248
248
|
#h = {};
|
|
249
249
|
#u = !0;
|
|
250
250
|
#m = [];
|
|
@@ -257,7 +257,7 @@ class tt {
|
|
|
257
257
|
this.#r = e;
|
|
258
258
|
}
|
|
259
259
|
get original() {
|
|
260
|
-
return this.#
|
|
260
|
+
return this.#n;
|
|
261
261
|
}
|
|
262
262
|
get effective() {
|
|
263
263
|
return this.#h;
|
|
@@ -299,10 +299,10 @@ class tt {
|
|
|
299
299
|
this.#u = !0;
|
|
300
300
|
}
|
|
301
301
|
setGridConfig(e) {
|
|
302
|
-
this.#
|
|
302
|
+
this.#o = e, this.#u = !0, this.#d = void 0;
|
|
303
303
|
}
|
|
304
304
|
getGridConfig() {
|
|
305
|
-
return this.#
|
|
305
|
+
return this.#o;
|
|
306
306
|
}
|
|
307
307
|
setColumns(e) {
|
|
308
308
|
this.#c = e, this.#u = !0;
|
|
@@ -321,7 +321,7 @@ class tt {
|
|
|
321
321
|
if (!this.#u && e)
|
|
322
322
|
return;
|
|
323
323
|
const o = this.#v();
|
|
324
|
-
this.#u = !1, this.#
|
|
324
|
+
this.#u = !1, this.#n = o, Object.freeze(this.#n), this.#n.columns && Object.freeze(this.#n.columns), this.#h = this.#A(this.#n), this.#p();
|
|
325
325
|
}
|
|
326
326
|
#A(e) {
|
|
327
327
|
const o = { ...e };
|
|
@@ -340,22 +340,22 @@ class tt {
|
|
|
340
340
|
}), this.#r.applyAnimationConfig(e);
|
|
341
341
|
}
|
|
342
342
|
#v() {
|
|
343
|
-
const e = this.#
|
|
343
|
+
const e = this.#o ? { ...this.#o } : {}, o = Array.isArray(e.columns) ? [...e.columns] : [], n = (this.#d ?? []).map((s) => ({
|
|
344
344
|
...s
|
|
345
345
|
}));
|
|
346
|
-
let i =
|
|
346
|
+
let i = ce(
|
|
347
347
|
o,
|
|
348
348
|
n
|
|
349
349
|
);
|
|
350
|
-
this.#c && this.#c.length && (i =
|
|
350
|
+
this.#c && this.#c.length && (i = ce(
|
|
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 = Be(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 = fe(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = fe(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) {
|
|
@@ -367,17 +367,17 @@ class tt {
|
|
|
367
367
|
const i = this.#r.getShellToolPanels();
|
|
368
368
|
if (i.size > 0) {
|
|
369
369
|
const d = Array.from(i.values());
|
|
370
|
-
d.sort((
|
|
370
|
+
d.sort((f, p) => (f.order ?? 100) - (p.order ?? 100)), e.shell.toolPanels = d;
|
|
371
371
|
}
|
|
372
372
|
const r = this.#r.getShellHeaderContents();
|
|
373
373
|
if (r.size > 0) {
|
|
374
374
|
const d = Array.from(r.values());
|
|
375
|
-
d.sort((
|
|
375
|
+
d.sort((f, p) => (f.order ?? 100) - (p.order ?? 100)), e.shell.headerContents = d;
|
|
376
376
|
}
|
|
377
|
-
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()),
|
|
377
|
+
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), c = this.#o?.shell?.header?.toolbarContents ?? [], a = new Set(c.map((d) => d.id)), h = [...c];
|
|
378
378
|
for (const d of l)
|
|
379
|
-
|
|
380
|
-
h.sort((d,
|
|
379
|
+
a.has(d.id) || h.push(d);
|
|
380
|
+
h.sort((d, f) => (d.order ?? 0) - (f.order ?? 0)), e.shell.header.toolbarContents = h;
|
|
381
381
|
}
|
|
382
382
|
collectState(e) {
|
|
383
383
|
const o = this.columns, n = this.#C();
|
|
@@ -389,11 +389,11 @@ class tt {
|
|
|
389
389
|
visible: !i.hidden
|
|
390
390
|
}, l = i;
|
|
391
391
|
l.__renderedWidth !== void 0 ? s.width = l.__renderedWidth : i.width !== void 0 && (s.width = typeof i.width == "string" ? parseFloat(i.width) : i.width);
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
for (const
|
|
395
|
-
if (
|
|
396
|
-
const h =
|
|
392
|
+
const c = n.get(i.field);
|
|
393
|
+
c && (s.sort = c);
|
|
394
|
+
for (const a of e)
|
|
395
|
+
if (a.getColumnState) {
|
|
396
|
+
const h = a.getColumnState(i.field);
|
|
397
397
|
h && Object.assign(s, h);
|
|
398
398
|
}
|
|
399
399
|
return s;
|
|
@@ -403,16 +403,16 @@ class tt {
|
|
|
403
403
|
applyState(e, o) {
|
|
404
404
|
if (!e.columns || e.columns.length === 0) return;
|
|
405
405
|
const n = this.columns, i = new Map(e.columns.map((l) => [l.field, l])), r = n.map((l) => {
|
|
406
|
-
const
|
|
407
|
-
if (!
|
|
408
|
-
const
|
|
409
|
-
return
|
|
406
|
+
const c = i.get(l.field);
|
|
407
|
+
if (!c) return l;
|
|
408
|
+
const a = { ...l };
|
|
409
|
+
return c.width !== void 0 && (a.width = c.width, a.__renderedWidth = c.width), c.visible !== void 0 && (a.hidden = !c.visible), a;
|
|
410
410
|
});
|
|
411
|
-
r.sort((l,
|
|
412
|
-
const
|
|
413
|
-
return
|
|
411
|
+
r.sort((l, c) => {
|
|
412
|
+
const a = i.get(l.field)?.order ?? 1 / 0, h = i.get(c.field)?.order ?? 1 / 0;
|
|
413
|
+
return a - h;
|
|
414
414
|
}), this.columns = r;
|
|
415
|
-
const s = e.columns.filter((l) => l.sort !== void 0).sort((l,
|
|
415
|
+
const s = e.columns.filter((l) => l.sort !== void 0).sort((l, c) => (l.sort?.priority ?? 0) - (c.sort?.priority ?? 0));
|
|
416
416
|
if (s.length > 0) {
|
|
417
417
|
const l = s[0];
|
|
418
418
|
l.sort && this.#r.setSortState({
|
|
@@ -423,11 +423,11 @@ class tt {
|
|
|
423
423
|
this.#r.setSortState(null);
|
|
424
424
|
for (const l of o)
|
|
425
425
|
if (l.applyColumnState)
|
|
426
|
-
for (const
|
|
427
|
-
l.applyColumnState(
|
|
426
|
+
for (const c of e.columns)
|
|
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.#n), this.#p();
|
|
431
431
|
for (const o of e)
|
|
432
432
|
if (o.applyColumnState)
|
|
433
433
|
for (const n of this.columns)
|
|
@@ -450,7 +450,7 @@ class tt {
|
|
|
450
450
|
this.#g = void 0;
|
|
451
451
|
const o = this.collectState(e);
|
|
452
452
|
this.#r.emit("column-state-change", o);
|
|
453
|
-
},
|
|
453
|
+
}, nt);
|
|
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 tt {
|
|
|
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 ? Ue(e) : []);
|
|
502
502
|
}
|
|
503
503
|
clearLightDomCache() {
|
|
504
504
|
this.#d = void 0;
|
|
@@ -524,12 +524,12 @@ class tt {
|
|
|
524
524
|
for (const s of r) {
|
|
525
525
|
for (const l of s.addedNodes) {
|
|
526
526
|
if (l.nodeType !== Node.ELEMENT_NODE) continue;
|
|
527
|
-
const
|
|
528
|
-
this.#E.has(
|
|
527
|
+
const a = l.tagName.toLowerCase();
|
|
528
|
+
this.#E.has(a) && o.add(a);
|
|
529
529
|
}
|
|
530
530
|
if (s.type === "attributes" && s.target.nodeType === Node.ELEMENT_NODE) {
|
|
531
|
-
const
|
|
532
|
-
this.#E.has(
|
|
531
|
+
const c = s.target.tagName.toLowerCase();
|
|
532
|
+
this.#E.has(c) && o.add(c);
|
|
533
533
|
}
|
|
534
534
|
}
|
|
535
535
|
o.size > 0 && !n && (n = setTimeout(i, 0));
|
|
@@ -551,10 +551,10 @@ class tt {
|
|
|
551
551
|
this.#l?.disconnect(), this.#m = [], this.#g && clearTimeout(this.#g);
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Ae(t) {
|
|
555
555
|
return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "🗹" : "☐"}</span>`;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function Pe(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 Te(t) {
|
|
|
564
564
|
}
|
|
565
565
|
return "";
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function Le(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 xe(t) {
|
|
|
577
577
|
if (i[r] === o) return r;
|
|
578
578
|
return -1;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
580
|
+
function rt(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 se(t) {
|
|
586
586
|
t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
587
587
|
}
|
|
588
|
-
function
|
|
588
|
+
function He(t, e) {
|
|
589
589
|
const o = e.renderer || e.viewRenderer;
|
|
590
590
|
if (o) return o;
|
|
591
591
|
if (!e.type) return;
|
|
@@ -599,173 +599,173 @@ function Ae(t, e) {
|
|
|
599
599
|
return r.renderer;
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
|
-
const
|
|
602
|
+
const Oe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
603
603
|
function Q(t) {
|
|
604
604
|
return (t.__editingCellCount ?? 0) > 0;
|
|
605
605
|
}
|
|
606
606
|
function ee(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 De = document.createElement("template");
|
|
610
|
+
De.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
611
|
+
const Me = document.createElement("template");
|
|
612
|
+
Me.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
613
|
+
function st() {
|
|
614
|
+
return De.content.firstElementChild.cloneNode(!0);
|
|
615
615
|
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
616
|
+
function lt() {
|
|
617
|
+
return Me.content.firstElementChild.cloneNode(!0);
|
|
618
618
|
}
|
|
619
619
|
function G(t) {
|
|
620
620
|
t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns,
|
|
624
|
-
let
|
|
625
|
-
for (
|
|
626
|
-
const d =
|
|
622
|
+
function at(t, e, o, n, i) {
|
|
623
|
+
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns, c = l.length;
|
|
624
|
+
let a = t.__cachedHeaderRowCount;
|
|
625
|
+
for (a === void 0 && (a = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = a); t._rowPool.length < r; ) {
|
|
626
|
+
const d = lt();
|
|
627
627
|
t._rowPool.push(d);
|
|
628
628
|
}
|
|
629
629
|
if (t._rowPool.length > r) {
|
|
630
630
|
for (let d = r; d < t._rowPool.length; d++) {
|
|
631
|
-
const
|
|
632
|
-
|
|
631
|
+
const f = t._rowPool[d];
|
|
632
|
+
f.parentNode === s && f.remove();
|
|
633
633
|
}
|
|
634
634
|
t._rowPool.length = r;
|
|
635
635
|
}
|
|
636
636
|
const h = i && t.__hasRenderRowPlugins !== !1;
|
|
637
637
|
for (let d = 0; d < r; d++) {
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
640
|
-
|
|
638
|
+
const f = e + d, p = t._rows[f], u = t._rowPool[d];
|
|
639
|
+
if (u.setAttribute("aria-rowindex", String(f + a + 1)), h && i(p, u, f)) {
|
|
640
|
+
u.__epoch = n, u.__rowDataRef = p, u.parentNode !== s && s.appendChild(u);
|
|
641
641
|
continue;
|
|
642
642
|
}
|
|
643
|
-
const g =
|
|
644
|
-
let
|
|
645
|
-
if (
|
|
646
|
-
for (let E = 0; E <
|
|
647
|
-
if (l[E].externalView && !
|
|
648
|
-
|
|
643
|
+
const g = u.__epoch, m = u.__rowDataRef, y = u.children.length, C = g === n && y === c, w = m !== p;
|
|
644
|
+
let v = !1;
|
|
645
|
+
if (C && w) {
|
|
646
|
+
for (let E = 0; E < c; E++)
|
|
647
|
+
if (l[E].externalView && !u.querySelector(`.cell[data-col="${E}"] [data-external-view]`)) {
|
|
648
|
+
v = !0;
|
|
649
649
|
break;
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
if (!
|
|
653
|
-
const E = Q(
|
|
654
|
-
E && !T ? (
|
|
652
|
+
if (!C || v) {
|
|
653
|
+
const E = Q(u), T = t._activeEditRows === f;
|
|
654
|
+
E && !T ? (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), ee(u), U(t, u, p, f), u.__epoch = n, u.__rowDataRef = p) : E && T ? (te(t, u, p, f), u.__rowDataRef = p) : (u.__isCustomRow && (u.className = "data-grid-row", u.setAttribute("role", "row"), u.__isCustomRow = !1), U(t, u, p, f), u.__epoch = n, u.__rowDataRef = p);
|
|
655
655
|
} else if (w) {
|
|
656
|
-
const E = Q(
|
|
657
|
-
E && !T ? (ee(
|
|
656
|
+
const E = Q(u), T = t._activeEditRows === f;
|
|
657
|
+
E && !T ? (ee(u), U(t, u, p, f), u.__epoch = n, u.__rowDataRef = p) : (te(t, u, p, f), u.__rowDataRef = p);
|
|
658
658
|
} else {
|
|
659
|
-
const E = Q(
|
|
660
|
-
E && !T ? (ee(
|
|
659
|
+
const E = Q(u), T = t._activeEditRows === f;
|
|
660
|
+
E && !T ? (ee(u), U(t, u, p, f), u.__epoch = n, u.__rowDataRef = p) : te(t, u, p, f);
|
|
661
661
|
}
|
|
662
662
|
let S = !1;
|
|
663
|
-
const
|
|
664
|
-
if (
|
|
663
|
+
const b = t.changedRowIds;
|
|
664
|
+
if (b && b.length > 0)
|
|
665
665
|
try {
|
|
666
666
|
const E = t.getRowId?.(p);
|
|
667
|
-
E && (S =
|
|
667
|
+
E && (S = b.includes(E));
|
|
668
668
|
} catch {
|
|
669
669
|
}
|
|
670
|
-
const
|
|
671
|
-
S !==
|
|
670
|
+
const z = u.classList.contains("changed");
|
|
671
|
+
S !== z && u.classList.toggle("changed", S);
|
|
672
672
|
const _ = t.effectiveConfig?.rowClass;
|
|
673
673
|
if (_) {
|
|
674
|
-
const E =
|
|
675
|
-
E && E.split(" ").forEach((T) => T &&
|
|
674
|
+
const E = u.getAttribute("data-dynamic-classes");
|
|
675
|
+
E && E.split(" ").forEach((T) => T && u.classList.remove(T));
|
|
676
676
|
try {
|
|
677
677
|
const T = _(p);
|
|
678
678
|
if (T && T.length > 0) {
|
|
679
679
|
const J = T.filter((B) => B && typeof B == "string");
|
|
680
|
-
J.forEach((B) =>
|
|
680
|
+
J.forEach((B) => u.classList.add(B)), u.setAttribute("data-dynamic-classes", J.join(" "));
|
|
681
681
|
} else
|
|
682
|
-
|
|
682
|
+
u.removeAttribute("data-dynamic-classes");
|
|
683
683
|
} catch (T) {
|
|
684
|
-
console.warn("[tbw-grid] rowClass callback error:", T),
|
|
684
|
+
console.warn("[tbw-grid] rowClass callback error:", T), u.removeAttribute("data-dynamic-classes");
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
-
|
|
687
|
+
u.parentNode !== s && s.appendChild(u);
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
690
|
function te(t, e, o, n) {
|
|
691
|
-
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length,
|
|
691
|
+
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length, c = s < l ? s : l, a = t._focusRow, h = t._focusCol;
|
|
692
692
|
let d = t.__hasSpecialColumns;
|
|
693
693
|
if (d === void 0) {
|
|
694
694
|
d = !1;
|
|
695
|
-
const p = t.effectiveConfig?.typeDefaults,
|
|
695
|
+
const p = t.effectiveConfig?.typeDefaults, u = t.__frameworkAdapter;
|
|
696
696
|
for (let g = 0; g < s; g++) {
|
|
697
697
|
const m = r[g];
|
|
698
|
-
if (m.__viewTemplate || m.__compiledView || m.renderer || m.viewRenderer || m.externalView || m.format || m.type === "date" || m.type === "boolean" || m.type && p?.[m.type]?.renderer || m.type &&
|
|
698
|
+
if (m.__viewTemplate || m.__compiledView || m.renderer || m.viewRenderer || m.externalView || m.format || m.type === "date" || m.type === "boolean" || m.type && p?.[m.type]?.renderer || m.type && u?.getTypeDefault?.(m.type)?.renderer) {
|
|
699
699
|
d = !0;
|
|
700
700
|
break;
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
t.__hasSpecialColumns = d;
|
|
704
704
|
}
|
|
705
|
-
const
|
|
705
|
+
const f = String(n);
|
|
706
706
|
if (!d) {
|
|
707
|
-
for (let p = 0; p <
|
|
708
|
-
const
|
|
709
|
-
if (
|
|
707
|
+
for (let p = 0; p < c; p++) {
|
|
708
|
+
const u = i[p];
|
|
709
|
+
if (u.classList.contains("editing")) continue;
|
|
710
710
|
const g = o[r[p].field];
|
|
711
|
-
|
|
712
|
-
const m =
|
|
713
|
-
m !==
|
|
711
|
+
u.textContent = g == null ? "" : String(g), u.getAttribute("data-row") !== f && u.setAttribute("data-row", f);
|
|
712
|
+
const m = a === n && h === p, y = u.classList.contains("cell-focus");
|
|
713
|
+
m !== y && (u.classList.toggle("cell-focus", m), u.setAttribute("aria-selected", String(m)));
|
|
714
714
|
}
|
|
715
715
|
return;
|
|
716
716
|
}
|
|
717
|
-
for (let p = 0; p <
|
|
717
|
+
for (let p = 0; p < c; p++)
|
|
718
718
|
if (r[p].externalView && !i[p].querySelector("[data-external-view]")) {
|
|
719
719
|
U(t, e, o, n);
|
|
720
720
|
return;
|
|
721
721
|
}
|
|
722
|
-
for (let p = 0; p <
|
|
723
|
-
const
|
|
724
|
-
g.getAttribute("data-row") !==
|
|
725
|
-
const m =
|
|
726
|
-
m !==
|
|
727
|
-
const R =
|
|
722
|
+
for (let p = 0; p < c; p++) {
|
|
723
|
+
const u = r[p], g = i[p];
|
|
724
|
+
g.getAttribute("data-row") !== f && g.setAttribute("data-row", f);
|
|
725
|
+
const m = a === n && h === p, y = g.classList.contains("cell-focus");
|
|
726
|
+
m !== y && (g.classList.toggle("cell-focus", m), g.setAttribute("aria-selected", String(m)));
|
|
727
|
+
const R = u.cellClass;
|
|
728
728
|
if (R) {
|
|
729
729
|
const S = g.getAttribute("data-dynamic-classes");
|
|
730
|
-
S && S.split(" ").forEach((
|
|
730
|
+
S && S.split(" ").forEach((b) => b && g.classList.remove(b));
|
|
731
731
|
try {
|
|
732
|
-
const
|
|
733
|
-
if (
|
|
734
|
-
const _ =
|
|
732
|
+
const b = o[u.field], z = R(b, o, u);
|
|
733
|
+
if (z && z.length > 0) {
|
|
734
|
+
const _ = z.filter((E) => E && typeof E == "string");
|
|
735
735
|
_.forEach((E) => g.classList.add(E)), g.setAttribute("data-dynamic-classes", _.join(" "));
|
|
736
736
|
} else
|
|
737
737
|
g.removeAttribute("data-dynamic-classes");
|
|
738
|
-
} catch (
|
|
739
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${
|
|
738
|
+
} catch (b) {
|
|
739
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${u.field}':`, b), g.removeAttribute("data-dynamic-classes");
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
742
|
if (g.classList.contains("editing")) continue;
|
|
743
|
-
const
|
|
744
|
-
if (
|
|
745
|
-
const S = o[
|
|
746
|
-
typeof
|
|
743
|
+
const C = He(t, u);
|
|
744
|
+
if (C) {
|
|
745
|
+
const S = o[u.field], b = C({ row: o, value: S, field: u.field, column: u, cellEl: g });
|
|
746
|
+
typeof b == "string" ? g.innerHTML = j(b) : b instanceof Node ? b.parentElement !== g && (g.innerHTML = "", g.appendChild(b)) : b == null && (g.textContent = S == null ? "" : String(S));
|
|
747
747
|
continue;
|
|
748
748
|
}
|
|
749
|
-
if (
|
|
749
|
+
if (u.__viewTemplate || u.__compiledView || u.externalView)
|
|
750
750
|
continue;
|
|
751
|
-
const w = o[
|
|
752
|
-
let
|
|
753
|
-
if (
|
|
751
|
+
const w = o[u.field];
|
|
752
|
+
let v;
|
|
753
|
+
if (u.format)
|
|
754
754
|
try {
|
|
755
|
-
const S =
|
|
756
|
-
|
|
755
|
+
const S = u.format(w, o);
|
|
756
|
+
v = S == null ? "" : String(S);
|
|
757
757
|
} catch (S) {
|
|
758
|
-
console.warn(`[tbw-grid] Format error in column '${
|
|
758
|
+
console.warn(`[tbw-grid] Format error in column '${u.field}':`, S), v = w == null ? "" : String(w);
|
|
759
759
|
}
|
|
760
|
-
else
|
|
760
|
+
else u.type === "date" ? (v = Pe(w), g.textContent = v) : u.type === "boolean" ? g.innerHTML = Ae(!!w) : (v = w == null ? "" : String(w), g.textContent = v);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
function U(t, e, o, n) {
|
|
764
764
|
e.innerHTML = "";
|
|
765
|
-
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol,
|
|
765
|
+
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol, c = t, a = document.createDocumentFragment();
|
|
766
766
|
for (let h = 0; h < r; h++) {
|
|
767
|
-
const d = i[h],
|
|
768
|
-
|
|
767
|
+
const d = i[h], f = st();
|
|
768
|
+
f.setAttribute("aria-colindex", String(h + 1)), f.setAttribute("data-col", String(h)), f.setAttribute("data-row", String(n)), f.setAttribute("data-field", d.field), f.setAttribute("data-header", d.header ?? d.field), d.type && f.setAttribute("data-type", d.type);
|
|
769
769
|
let p = o[d.field];
|
|
770
770
|
if (d.format)
|
|
771
771
|
try {
|
|
@@ -773,68 +773,68 @@ function U(t, e, o, n) {
|
|
|
773
773
|
} catch (w) {
|
|
774
774
|
console.warn(`[tbw-grid] Format error in column '${d.field}':`, w);
|
|
775
775
|
}
|
|
776
|
-
const
|
|
776
|
+
const u = d.__compiledView, g = d.__viewTemplate, m = He(t, d), y = d.externalView;
|
|
777
777
|
let R = !1;
|
|
778
778
|
if (m) {
|
|
779
|
-
const w = m({ row: o, value: p, field: d.field, column: d, cellEl:
|
|
780
|
-
typeof w == "string" ? (
|
|
781
|
-
} else if (
|
|
782
|
-
const w =
|
|
783
|
-
|
|
779
|
+
const w = m({ row: o, value: p, field: d.field, column: d, cellEl: f });
|
|
780
|
+
typeof w == "string" ? (f.innerHTML = j(w), R = !0) : w instanceof Node ? w.parentElement !== f && (f.textContent = "", f.appendChild(w)) : w == null && (f.textContent = p == null ? "" : String(p));
|
|
781
|
+
} else if (y) {
|
|
782
|
+
const w = y, v = document.createElement("div");
|
|
783
|
+
v.setAttribute("data-external-view", ""), v.setAttribute("data-field", d.field), f.appendChild(v);
|
|
784
784
|
const S = { row: o, value: p, field: d.field, column: d };
|
|
785
785
|
if (w.mount)
|
|
786
786
|
try {
|
|
787
|
-
w.mount({ placeholder:
|
|
788
|
-
} catch (
|
|
789
|
-
console.warn(`[tbw-grid] External view mount error for column '${d.field}':`,
|
|
787
|
+
w.mount({ placeholder: v, context: S, spec: w });
|
|
788
|
+
} catch (b) {
|
|
789
|
+
console.warn(`[tbw-grid] External view mount error for column '${d.field}':`, b);
|
|
790
790
|
}
|
|
791
791
|
else
|
|
792
792
|
queueMicrotask(() => {
|
|
793
793
|
try {
|
|
794
|
-
|
|
794
|
+
c.dispatchEvent(
|
|
795
795
|
new CustomEvent("mount-external-view", {
|
|
796
796
|
bubbles: !0,
|
|
797
797
|
composed: !0,
|
|
798
|
-
detail: { placeholder:
|
|
798
|
+
detail: { placeholder: v, spec: w, context: S }
|
|
799
799
|
})
|
|
800
800
|
);
|
|
801
|
-
} catch (
|
|
802
|
-
console.warn(`[tbw-grid] External view event dispatch error for column '${d.field}':`,
|
|
801
|
+
} catch (b) {
|
|
802
|
+
console.warn(`[tbw-grid] External view event dispatch error for column '${d.field}':`, b);
|
|
803
803
|
}
|
|
804
804
|
});
|
|
805
|
-
|
|
806
|
-
} else if (
|
|
807
|
-
const w =
|
|
808
|
-
|
|
805
|
+
v.setAttribute("data-mounted", "");
|
|
806
|
+
} else if (u) {
|
|
807
|
+
const w = u({ row: o, value: p, field: d.field, column: d }), v = u.__blocked;
|
|
808
|
+
f.innerHTML = v ? "" : j(w), R = !0, v && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
|
|
809
809
|
} else if (g) {
|
|
810
810
|
const w = g.innerHTML;
|
|
811
|
-
/Reflect\.|\bProxy\b|ownKeys\(/.test(w) ? (
|
|
811
|
+
/Reflect\.|\bProxy\b|ownKeys\(/.test(w) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = j(xe(w, { row: o, value: p })), R = !0);
|
|
812
812
|
} else
|
|
813
|
-
d.type === "date" ?
|
|
813
|
+
d.type === "date" ? f.textContent = Pe(p) : d.type === "boolean" ? f.innerHTML = Ae(!!p) : f.textContent = p == null ? "" : String(p);
|
|
814
814
|
if (R) {
|
|
815
|
-
|
|
816
|
-
const w =
|
|
817
|
-
/Proxy|Reflect\.ownKeys/.test(w) && (
|
|
815
|
+
ot(f);
|
|
816
|
+
const w = f.textContent || "";
|
|
817
|
+
/Proxy|Reflect\.ownKeys/.test(w) && (f.textContent = w.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
|
|
818
818
|
}
|
|
819
|
-
|
|
820
|
-
const
|
|
821
|
-
if (
|
|
819
|
+
f.hasAttribute("data-blocked-template") && (f.textContent || "").trim().length && (f.textContent = ""), d.editable ? f.tabIndex = 0 : d.type === "boolean" && (f.hasAttribute("tabindex") || (f.tabIndex = 0)), s === n && l === h ? (f.classList.add("cell-focus"), f.setAttribute("aria-selected", "true")) : f.setAttribute("aria-selected", "false");
|
|
820
|
+
const C = d.cellClass;
|
|
821
|
+
if (C)
|
|
822
822
|
try {
|
|
823
|
-
const w = o[d.field],
|
|
824
|
-
if (
|
|
825
|
-
const S =
|
|
826
|
-
S.forEach((
|
|
823
|
+
const w = o[d.field], v = C(w, o, d);
|
|
824
|
+
if (v && v.length > 0) {
|
|
825
|
+
const S = v.filter((b) => b && typeof b == "string");
|
|
826
|
+
S.forEach((b) => f.classList.add(b)), f.setAttribute("data-dynamic-classes", S.join(" "));
|
|
827
827
|
}
|
|
828
828
|
} catch (w) {
|
|
829
829
|
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`, w);
|
|
830
830
|
}
|
|
831
|
-
|
|
831
|
+
a.appendChild(f);
|
|
832
832
|
}
|
|
833
|
-
e.appendChild(
|
|
833
|
+
e.appendChild(a);
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function pe(t, e, o) {
|
|
836
836
|
if (e.target?.closest(".resize-handle")) return;
|
|
837
|
-
const n = o.querySelector(".cell[data-row]"), i =
|
|
837
|
+
const n = o.querySelector(".cell[data-row]"), i = Le(n);
|
|
838
838
|
if (i < 0) return;
|
|
839
839
|
const r = t._rows[i];
|
|
840
840
|
if (!r || t._dispatchRowClick?.(e, i, r, o))
|
|
@@ -845,12 +845,12 @@ function fe(t, e, o) {
|
|
|
845
845
|
if (!isNaN(l)) {
|
|
846
846
|
if (t._dispatchCellClick?.(e, i, l, s))
|
|
847
847
|
return;
|
|
848
|
-
const
|
|
848
|
+
const c = t._focusRow !== i || t._focusCol !== l;
|
|
849
849
|
if (t._focusRow = i, t._focusCol = l, s.classList.contains("editing")) {
|
|
850
|
-
|
|
851
|
-
const
|
|
850
|
+
c && (se(t._bodyEl ?? t), s.classList.add("cell-focus"));
|
|
851
|
+
const a = s.querySelector(Oe);
|
|
852
852
|
try {
|
|
853
|
-
|
|
853
|
+
a?.focus({ preventScroll: !0 });
|
|
854
854
|
} catch {
|
|
855
855
|
}
|
|
856
856
|
return;
|
|
@@ -859,15 +859,15 @@ function fe(t, e, o) {
|
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function ct(t, e) {
|
|
863
863
|
if (t._dispatchKeyDown?.(e))
|
|
864
864
|
return;
|
|
865
|
-
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?.() ?? [],
|
|
865
|
+
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
866
|
if (!h) return !1;
|
|
867
867
|
const d = h.tagName;
|
|
868
868
|
return !!(d === "INPUT" || d === "SELECT" || d === "TEXTAREA" || h.isContentEditable);
|
|
869
869
|
};
|
|
870
|
-
if (!(c
|
|
870
|
+
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
871
|
switch (e.key) {
|
|
872
872
|
case "Tab": {
|
|
873
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), W(t);
|
|
@@ -898,12 +898,12 @@ function st(t, e) {
|
|
|
898
898
|
t._focusRow = Math.max(0, t._focusRow - 20), e.preventDefault();
|
|
899
899
|
break;
|
|
900
900
|
case "Enter": {
|
|
901
|
-
const h = t._focusRow, d = t._focusCol,
|
|
901
|
+
const h = t._focusRow, d = t._focusCol, f = t._visibleColumns[d], p = t._rows[h], u = f?.field ?? "", g = u && p ? p[u] : void 0, m = t.querySelector(
|
|
902
902
|
`[data-row="${h}"][data-col="${d}"]`
|
|
903
|
-
),
|
|
903
|
+
), y = {
|
|
904
904
|
rowIndex: h,
|
|
905
905
|
colIndex: d,
|
|
906
|
-
field:
|
|
906
|
+
field: u,
|
|
907
907
|
value: g,
|
|
908
908
|
row: p,
|
|
909
909
|
cellEl: m,
|
|
@@ -911,14 +911,14 @@ function st(t, e) {
|
|
|
911
911
|
originalEvent: e
|
|
912
912
|
}, R = new CustomEvent("cell-activate", {
|
|
913
913
|
cancelable: !0,
|
|
914
|
-
detail:
|
|
914
|
+
detail: y
|
|
915
915
|
});
|
|
916
916
|
t.dispatchEvent(R);
|
|
917
|
-
const
|
|
917
|
+
const C = new CustomEvent("activate-cell", {
|
|
918
918
|
cancelable: !0,
|
|
919
919
|
detail: { row: h, col: d }
|
|
920
920
|
});
|
|
921
|
-
if (t.dispatchEvent(
|
|
921
|
+
if (t.dispatchEvent(C), R.defaultPrevented || C.defaultPrevented) {
|
|
922
922
|
e.preventDefault();
|
|
923
923
|
return;
|
|
924
924
|
}
|
|
@@ -932,14 +932,14 @@ function st(t, e) {
|
|
|
932
932
|
}
|
|
933
933
|
function W(t, e) {
|
|
934
934
|
if (t._virtualization?.enabled) {
|
|
935
|
-
const { rowHeight: s, container: l, viewportEl:
|
|
936
|
-
if (
|
|
935
|
+
const { rowHeight: s, container: l, viewportEl: c } = t._virtualization, a = l, h = c?.clientHeight ?? a?.clientHeight ?? 0;
|
|
936
|
+
if (a && h > 0) {
|
|
937
937
|
const d = t._focusRow * s;
|
|
938
|
-
d <
|
|
938
|
+
d < a.scrollTop ? a.scrollTop = d : d + s > a.scrollTop + h && (a.scrollTop = d - h + s);
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
const o = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
942
|
-
o || t.refreshVirtualWindow(!1),
|
|
942
|
+
o || t.refreshVirtualWindow(!1), se(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
943
943
|
s.setAttribute("aria-selected", "false");
|
|
944
944
|
});
|
|
945
945
|
const n = t._focusRow, i = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
|
|
@@ -948,24 +948,24 @@ function W(t, e) {
|
|
|
948
948
|
let l = s?.children[t._focusCol];
|
|
949
949
|
if ((!l || !l.classList?.contains("cell")) && (l = s?.querySelector(`.cell[data-col="${t._focusCol}"]`) ?? s?.querySelector(".cell[data-col]")), l) {
|
|
950
950
|
l.classList.add("cell-focus"), l.setAttribute("aria-selected", "true");
|
|
951
|
-
const
|
|
952
|
-
if (
|
|
951
|
+
const c = t.querySelector(".tbw-scroll-area");
|
|
952
|
+
if (c && l && !o)
|
|
953
953
|
if (e?.forceScrollLeft)
|
|
954
|
-
|
|
954
|
+
c.scrollLeft = 0;
|
|
955
955
|
else if (e?.forceScrollRight)
|
|
956
|
-
|
|
956
|
+
c.scrollLeft = c.scrollWidth - c.clientWidth;
|
|
957
957
|
else {
|
|
958
|
-
const
|
|
959
|
-
if (!
|
|
960
|
-
const h = l.getBoundingClientRect(), d =
|
|
961
|
-
|
|
958
|
+
const a = t._getHorizontalScrollOffsets?.(s ?? void 0, l) ?? { left: 0, right: 0 };
|
|
959
|
+
if (!a.skipScroll) {
|
|
960
|
+
const h = l.getBoundingClientRect(), d = c.getBoundingClientRect(), f = h.left - d.left + c.scrollLeft, p = f + h.width, u = c.scrollLeft + a.left, g = c.scrollLeft + c.clientWidth - a.right;
|
|
961
|
+
f < u ? c.scrollLeft = f - a.left : p > g && (c.scrollLeft = p - c.clientWidth + a.right);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
965
|
+
const a = l.querySelector(Oe);
|
|
966
|
+
if (a && document.activeElement !== a)
|
|
967
967
|
try {
|
|
968
|
-
|
|
968
|
+
a.focus({ preventScroll: !0 });
|
|
969
969
|
} catch {
|
|
970
970
|
}
|
|
971
971
|
} else if (!l.contains(document.activeElement)) {
|
|
@@ -979,102 +979,102 @@ function W(t, e) {
|
|
|
979
979
|
}
|
|
980
980
|
}
|
|
981
981
|
const K = /* @__PURE__ */ new WeakMap();
|
|
982
|
-
function
|
|
983
|
-
const o =
|
|
984
|
-
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n,
|
|
982
|
+
function dt(t, e) {
|
|
983
|
+
const o = Le(e), n = rt(e);
|
|
984
|
+
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n, se(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
|
|
985
985
|
}
|
|
986
|
-
function
|
|
986
|
+
function le(t, e, o, n) {
|
|
987
987
|
let i = null;
|
|
988
988
|
const r = o.composedPath?.();
|
|
989
989
|
if (r && r.length > 0 ? i = r[0] : i = o.target, i && !e.contains(i)) {
|
|
990
990
|
const g = document.elementFromPoint(o.clientX, o.clientY);
|
|
991
991
|
g && (i = g);
|
|
992
992
|
}
|
|
993
|
-
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"),
|
|
994
|
-
let
|
|
995
|
-
return s && (
|
|
993
|
+
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"), c = i?.closest?.(".header-row");
|
|
994
|
+
let a, h, d, f, p, u;
|
|
995
|
+
return s && (a = parseInt(s.getAttribute("data-row") ?? "-1", 10), h = parseInt(s.getAttribute("data-col") ?? "-1", 10), a >= 0 && h >= 0 && (d = t._rows[a], u = t._columns[h], f = u?.field, p = d && f ? d[f] : void 0)), {
|
|
996
996
|
type: n,
|
|
997
997
|
row: d,
|
|
998
|
-
rowIndex:
|
|
998
|
+
rowIndex: a !== void 0 && a >= 0 ? a : void 0,
|
|
999
999
|
colIndex: h !== void 0 && h >= 0 ? h : void 0,
|
|
1000
|
-
field:
|
|
1000
|
+
field: f,
|
|
1001
1001
|
value: p,
|
|
1002
|
-
column:
|
|
1002
|
+
column: u,
|
|
1003
1003
|
originalEvent: o,
|
|
1004
1004
|
cellElement: s ?? void 0,
|
|
1005
1005
|
rowElement: l ?? void 0,
|
|
1006
|
-
isHeader: !!
|
|
1007
|
-
cell:
|
|
1006
|
+
isHeader: !!c,
|
|
1007
|
+
cell: a !== void 0 && h !== void 0 && a >= 0 && h >= 0 ? { row: a, col: h } : void 0
|
|
1008
1008
|
};
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1011
|
-
const n =
|
|
1010
|
+
function ht(t, e, o) {
|
|
1011
|
+
const n = le(t, e, o, "mousedown");
|
|
1012
1012
|
(t._dispatchCellMouseDown?.(n) ?? !1) && K.set(t, !0);
|
|
1013
1013
|
}
|
|
1014
|
-
function
|
|
1014
|
+
function ut(t, e, o) {
|
|
1015
1015
|
if (!K.get(t)) return;
|
|
1016
|
-
const n =
|
|
1016
|
+
const n = le(t, e, o, "mousemove");
|
|
1017
1017
|
t._dispatchCellMouseMove?.(n);
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function ft(t, e, o) {
|
|
1020
1020
|
if (!K.get(t)) return;
|
|
1021
|
-
const n =
|
|
1021
|
+
const n = le(t, e, o, "mouseup");
|
|
1022
1022
|
t._dispatchCellMouseUp?.(n), K.set(t, !1);
|
|
1023
1023
|
}
|
|
1024
|
-
function
|
|
1024
|
+
function pt(t, e, o) {
|
|
1025
1025
|
e.addEventListener(
|
|
1026
1026
|
"mousedown",
|
|
1027
1027
|
(n) => {
|
|
1028
1028
|
const i = n.target.closest(".cell[data-col]");
|
|
1029
|
-
i && (i.classList.contains("editing") ||
|
|
1029
|
+
i && (i.classList.contains("editing") || dt(t, i));
|
|
1030
1030
|
},
|
|
1031
1031
|
{ signal: o }
|
|
1032
1032
|
), e.addEventListener(
|
|
1033
1033
|
"click",
|
|
1034
1034
|
(n) => {
|
|
1035
1035
|
const i = n.target.closest(".data-grid-row");
|
|
1036
|
-
i &&
|
|
1036
|
+
i && pe(t, n, i);
|
|
1037
1037
|
},
|
|
1038
1038
|
{ signal: o }
|
|
1039
1039
|
), e.addEventListener(
|
|
1040
1040
|
"dblclick",
|
|
1041
1041
|
(n) => {
|
|
1042
1042
|
const i = n.target.closest(".data-grid-row");
|
|
1043
|
-
i &&
|
|
1043
|
+
i && pe(t, n, i);
|
|
1044
1044
|
},
|
|
1045
1045
|
{ signal: o }
|
|
1046
1046
|
);
|
|
1047
1047
|
}
|
|
1048
|
-
function
|
|
1049
|
-
e.addEventListener("keydown", (i) =>
|
|
1048
|
+
function gt(t, e, o, n) {
|
|
1049
|
+
e.addEventListener("keydown", (i) => ct(t, i), { signal: n }), o.addEventListener("mousedown", (i) => ht(t, o, i), { signal: n }), document.addEventListener("mousemove", (i) => ut(t, o, i), { signal: n }), document.addEventListener("mouseup", (i) => ft(t, o, i), { signal: n });
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function wt(t, e) {
|
|
1052
1052
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1055
|
-
const i = o.find((l) => l.field === e.field)?.sortComparator ??
|
|
1056
|
-
return [...t].sort((l,
|
|
1054
|
+
function mt(t, e, o) {
|
|
1055
|
+
const i = o.find((l) => l.field === e.field)?.sortComparator ?? wt, { field: r, direction: s } = e;
|
|
1056
|
+
return [...t].sort((l, c) => i(l[r], c[r], l, c) * s);
|
|
1057
1057
|
}
|
|
1058
|
-
function
|
|
1058
|
+
function ge(t, e, o, n) {
|
|
1059
1059
|
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1), Z(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1060
1060
|
new CustomEvent("sort-change", { detail: { field: o.field, direction: n } })
|
|
1061
1061
|
), t.requestStateChange?.();
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1064
|
-
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()),
|
|
1063
|
+
function we(t, e) {
|
|
1064
|
+
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), me(t, e, 1)) : t._sortState.direction === 1 ? me(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), t._rows = t.__originalOrder.slice(), Z(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((n) => {
|
|
1065
1065
|
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
1066
|
}), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1067
1067
|
new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
|
|
1068
1068
|
), t.requestStateChange?.());
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function me(t, e, o) {
|
|
1071
1071
|
t._sortState = { field: e.field, direction: o };
|
|
1072
|
-
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ??
|
|
1072
|
+
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ?? mt)(t._rows, n, i);
|
|
1073
1073
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1074
|
-
|
|
1075
|
-
}) :
|
|
1074
|
+
ge(t, l, e, o);
|
|
1075
|
+
}) : ge(t, s, e, o);
|
|
1076
1076
|
}
|
|
1077
|
-
function
|
|
1077
|
+
function bt(t, e) {
|
|
1078
1078
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1079
1079
|
}
|
|
1080
1080
|
function Z(t) {
|
|
@@ -1082,7 +1082,7 @@ function Z(t) {
|
|
|
1082
1082
|
const e = t._headerRowEl;
|
|
1083
1083
|
e && (e.innerHTML = "", t._visibleColumns.forEach((o, n) => {
|
|
1084
1084
|
const i = document.createElement("div");
|
|
1085
|
-
i.className = "cell",
|
|
1085
|
+
i.className = "cell", de(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
1086
|
const r = o.__headerTemplate;
|
|
1087
1087
|
if (r) Array.from(r.childNodes).forEach((s) => i.appendChild(s.cloneNode(!0)));
|
|
1088
1088
|
else {
|
|
@@ -1092,14 +1092,14 @@ function Z(t) {
|
|
|
1092
1092
|
if (o.sortable) {
|
|
1093
1093
|
i.classList.add("sortable"), i.tabIndex = 0;
|
|
1094
1094
|
const s = document.createElement("span");
|
|
1095
|
-
|
|
1096
|
-
const l = t._sortState?.field === o.field ? t._sortState.direction : 0,
|
|
1097
|
-
|
|
1098
|
-
t._resizeController?.isResizing || t._dispatchHeaderClick?.(h, n, i) ||
|
|
1095
|
+
de(s, "sort-indicator");
|
|
1096
|
+
const l = t._sortState?.field === o.field ? t._sortState.direction : 0, c = { ...M, ...t.icons }, a = l === 1 ? c.sortAsc : l === -1 ? c.sortDesc : c.sortNone;
|
|
1097
|
+
bt(s, a), i.appendChild(s), i.setAttribute("aria-sort", l === 0 ? "none" : l === 1 ? "ascending" : "descending"), i.addEventListener("click", (h) => {
|
|
1098
|
+
t._resizeController?.isResizing || t._dispatchHeaderClick?.(h, n, i) || we(t, o);
|
|
1099
1099
|
}), i.addEventListener("keydown", (h) => {
|
|
1100
1100
|
if (h.key === "Enter" || h.key === " ") {
|
|
1101
1101
|
if (h.preventDefault(), t._dispatchHeaderClick?.(h, n, i)) return;
|
|
1102
|
-
|
|
1102
|
+
we(t, o);
|
|
1103
1103
|
}
|
|
1104
1104
|
});
|
|
1105
1105
|
}
|
|
@@ -1117,9 +1117,9 @@ function Z(t) {
|
|
|
1117
1117
|
o.getAttribute("aria-sort") || o.setAttribute("aria-sort", "none");
|
|
1118
1118
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
|
|
1119
1119
|
}
|
|
1120
|
-
const
|
|
1121
|
-
function
|
|
1122
|
-
return
|
|
1120
|
+
const ze = typeof requestIdleCallback == "function";
|
|
1121
|
+
function Ct(t, e) {
|
|
1122
|
+
return ze ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1123
1123
|
const o = Date.now();
|
|
1124
1124
|
t({
|
|
1125
1125
|
didTimeout: !1,
|
|
@@ -1127,20 +1127,20 @@ function wt(t, e) {
|
|
|
1127
1127
|
});
|
|
1128
1128
|
}, 1);
|
|
1129
1129
|
}
|
|
1130
|
-
function
|
|
1131
|
-
|
|
1130
|
+
function be(t) {
|
|
1131
|
+
ze ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1132
1132
|
}
|
|
1133
1133
|
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
|
-
#
|
|
1134
|
+
class vt {
|
|
1135
|
+
#o;
|
|
1136
1136
|
#c = 0;
|
|
1137
1137
|
#f = 0;
|
|
1138
1138
|
#d = null;
|
|
1139
1139
|
#s = null;
|
|
1140
|
-
#
|
|
1140
|
+
#n = null;
|
|
1141
1141
|
#h = !1;
|
|
1142
1142
|
constructor(e) {
|
|
1143
|
-
this.#
|
|
1143
|
+
this.#o = e;
|
|
1144
1144
|
}
|
|
1145
1145
|
requestPhase(e, o) {
|
|
1146
1146
|
e > this.#c && (this.#c = e), this.#f === 0 && (this.#u(), this.#f = requestAnimationFrame(() => this.#m()));
|
|
@@ -1149,7 +1149,7 @@ class mt {
|
|
|
1149
1149
|
return this.#d ? this.#d : Promise.resolve();
|
|
1150
1150
|
}
|
|
1151
1151
|
setInitialReadyResolver(e) {
|
|
1152
|
-
this.#
|
|
1152
|
+
this.#n = e;
|
|
1153
1153
|
}
|
|
1154
1154
|
cancel() {
|
|
1155
1155
|
this.#f !== 0 && (cancelAnimationFrame(this.#f), this.#f = 0), this.#c = 0, this.#s && (this.#s(), this.#s = null, this.#d = null);
|
|
@@ -1166,19 +1166,19 @@ class mt {
|
|
|
1166
1166
|
}));
|
|
1167
1167
|
}
|
|
1168
1168
|
#m() {
|
|
1169
|
-
if (this.#f = 0, !this.#
|
|
1169
|
+
if (this.#f = 0, !this.#o.isConnected()) {
|
|
1170
1170
|
this.#c = 0, this.#s && (this.#s(), this.#s = null, this.#d = null);
|
|
1171
1171
|
return;
|
|
1172
1172
|
}
|
|
1173
1173
|
const e = this.#c;
|
|
1174
|
-
this.#c = 0, e >= 5 && this.#
|
|
1174
|
+
this.#c = 0, e >= 5 && this.#o.mergeConfig(), e >= 4 && this.#o.processRows(), e >= 5 && (this.#o.processColumns(), this.#o.updateTemplate()), e >= 3 && this.#o.renderHeader(), e >= 2 && this.#o.renderVirtualWindow(), e >= 1 && this.#o.afterRender(), !this.#h && this.#n && (this.#h = !0, this.#n()), this.#s && (this.#s(), this.#s = null, this.#d = null);
|
|
1175
1175
|
}
|
|
1176
1176
|
}
|
|
1177
|
-
function
|
|
1177
|
+
function Ce(t) {
|
|
1178
1178
|
let e = null, o = null, n = null, i = null;
|
|
1179
|
-
const r = (
|
|
1179
|
+
const r = (c) => {
|
|
1180
1180
|
if (!e) return;
|
|
1181
|
-
const
|
|
1181
|
+
const a = c.clientX - e.startX, h = Math.max(40, e.startWidth + a), d = t._visibleColumns[e.colIndex];
|
|
1182
1182
|
d.width = h, d.__userResized = !0, d.__renderedWidth = h, o == null && (o = requestAnimationFrame(() => {
|
|
1183
1183
|
o = null, t.updateTemplate?.();
|
|
1184
1184
|
})), t.dispatchEvent(
|
|
@@ -1187,24 +1187,24 @@ function bt(t) {
|
|
|
1187
1187
|
};
|
|
1188
1188
|
let s = !1;
|
|
1189
1189
|
const l = () => {
|
|
1190
|
-
const
|
|
1191
|
-
|
|
1190
|
+
const c = e !== null;
|
|
1191
|
+
c && (s = !0, requestAnimationFrame(() => {
|
|
1192
1192
|
s = !1;
|
|
1193
|
-
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null,
|
|
1193
|
+
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null, c && t.requestStateChange && t.requestStateChange();
|
|
1194
1194
|
};
|
|
1195
1195
|
return {
|
|
1196
1196
|
get isResizing() {
|
|
1197
1197
|
return e !== null || s;
|
|
1198
1198
|
},
|
|
1199
|
-
start(
|
|
1200
|
-
|
|
1201
|
-
const d = t._visibleColumns[
|
|
1202
|
-
e = { startX:
|
|
1199
|
+
start(c, a, h) {
|
|
1200
|
+
c.preventDefault();
|
|
1201
|
+
const d = t._visibleColumns[a], f = typeof d?.width == "number" ? d.width : void 0, p = d?.__renderedWidth ?? f ?? h.getBoundingClientRect().width;
|
|
1202
|
+
e = { startX: c.clientX, colIndex: a, startWidth: p }, 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
1203
|
},
|
|
1204
|
-
resetColumn(
|
|
1205
|
-
const
|
|
1206
|
-
|
|
1207
|
-
new CustomEvent("column-resize-reset", { detail: { field:
|
|
1204
|
+
resetColumn(c) {
|
|
1205
|
+
const a = t._visibleColumns[c];
|
|
1206
|
+
a && (a.__userResized = !1, a.__renderedWidth = void 0, a.width = a.__originalWidth, t.updateTemplate?.(), t.requestStateChange?.(), t.dispatchEvent(
|
|
1207
|
+
new CustomEvent("column-resize-reset", { detail: { field: a.field, width: a.width } })
|
|
1208
1208
|
));
|
|
1209
1209
|
},
|
|
1210
1210
|
dispose() {
|
|
@@ -1230,7 +1230,7 @@ function P(t, e) {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
return o;
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1233
|
+
function Ne(t, e, o) {
|
|
1234
1234
|
const n = document.createElement("button");
|
|
1235
1235
|
if (t && (n.className = t), e)
|
|
1236
1236
|
for (const i in e) {
|
|
@@ -1239,8 +1239,8 @@ function De(t, e, o) {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
return n;
|
|
1241
1241
|
}
|
|
1242
|
-
const
|
|
1243
|
-
|
|
1242
|
+
const Ie = document.createElement("template");
|
|
1243
|
+
Ie.innerHTML = `
|
|
1244
1244
|
<div class="tbw-scroll-area">
|
|
1245
1245
|
<div class="rows-body-wrapper">
|
|
1246
1246
|
<div class="rows-body" role="grid">
|
|
@@ -1259,20 +1259,20 @@ Me.innerHTML = `
|
|
|
1259
1259
|
<div class="faux-vscroll-spacer"></div>
|
|
1260
1260
|
</div>
|
|
1261
1261
|
`;
|
|
1262
|
-
function
|
|
1263
|
-
return
|
|
1262
|
+
function ke() {
|
|
1263
|
+
return Ie.content.cloneNode(!0);
|
|
1264
1264
|
}
|
|
1265
|
-
function
|
|
1265
|
+
function ve(t) {
|
|
1266
1266
|
const e = document.createDocumentFragment(), o = P(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1267
1267
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1268
1268
|
o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
|
|
1269
1269
|
else {
|
|
1270
1270
|
const n = P("tbw-grid-content");
|
|
1271
|
-
n.appendChild(
|
|
1271
|
+
n.appendChild(ke()), o.appendChild(n);
|
|
1272
1272
|
}
|
|
1273
1273
|
return e.appendChild(o), e;
|
|
1274
1274
|
}
|
|
1275
|
-
function
|
|
1275
|
+
function yt(t) {
|
|
1276
1276
|
const e = P("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1277
1277
|
if (t.title) {
|
|
1278
1278
|
const r = P("tbw-shell-title");
|
|
@@ -1290,7 +1290,7 @@ function Ct(t) {
|
|
|
1290
1290
|
for (const r of t.apiButtons)
|
|
1291
1291
|
r.hasRender && n.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1292
1292
|
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && n.appendChild(P("tbw-toolbar-separator")), t.hasPanels) {
|
|
1293
|
-
const r =
|
|
1293
|
+
const r = Ne(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
|
|
1294
1294
|
"data-panel-toggle": "",
|
|
1295
1295
|
title: "Settings",
|
|
1296
1296
|
"aria-label": "Toggle settings panel",
|
|
@@ -1301,9 +1301,9 @@ function Ct(t) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
return e.appendChild(n), e;
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1304
|
+
function _t(t) {
|
|
1305
1305
|
const e = P("tbw-shell-body"), o = t.panels.length > 0, n = t.panels.length === 1, i = P("tbw-grid-content");
|
|
1306
|
-
i.appendChild(
|
|
1306
|
+
i.appendChild(ke());
|
|
1307
1307
|
let r = null;
|
|
1308
1308
|
if (o) {
|
|
1309
1309
|
r = X("aside", {
|
|
@@ -1321,36 +1321,36 @@ function vt(t) {
|
|
|
1321
1321
|
"aria-hidden": "true"
|
|
1322
1322
|
})
|
|
1323
1323
|
);
|
|
1324
|
-
const l = P("tbw-tool-panel-content", { role: "presentation" }),
|
|
1325
|
-
for (const
|
|
1326
|
-
const h = `tbw-accordion-section${
|
|
1327
|
-
"aria-expanded": String(
|
|
1328
|
-
"aria-controls": `tbw-section-${
|
|
1324
|
+
const l = P("tbw-tool-panel-content", { role: "presentation" }), c = P("tbw-accordion");
|
|
1325
|
+
for (const a of t.panels) {
|
|
1326
|
+
const h = `tbw-accordion-section${a.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, d = P(h, { "data-section": a.id }), f = Ne("tbw-accordion-header", {
|
|
1327
|
+
"aria-expanded": String(a.isExpanded),
|
|
1328
|
+
"aria-controls": `tbw-section-${a.id}`
|
|
1329
1329
|
});
|
|
1330
|
-
if (n &&
|
|
1331
|
-
const
|
|
1332
|
-
|
|
1330
|
+
if (n && f.setAttribute("aria-disabled", "true"), a.icon) {
|
|
1331
|
+
const u = X("span", { class: "tbw-accordion-icon" });
|
|
1332
|
+
u.innerHTML = a.icon, f.appendChild(u);
|
|
1333
1333
|
}
|
|
1334
1334
|
const p = X("span", { class: "tbw-accordion-title" });
|
|
1335
|
-
if (p.textContent =
|
|
1336
|
-
const
|
|
1337
|
-
|
|
1335
|
+
if (p.textContent = a.title, f.appendChild(p), !n) {
|
|
1336
|
+
const u = X("span", { class: "tbw-accordion-chevron" });
|
|
1337
|
+
u.innerHTML = a.isExpanded ? t.collapseIcon : t.expandIcon, f.appendChild(u);
|
|
1338
1338
|
}
|
|
1339
|
-
d.appendChild(
|
|
1339
|
+
d.appendChild(f), d.appendChild(
|
|
1340
1340
|
P("tbw-accordion-content", {
|
|
1341
|
-
id: `tbw-section-${
|
|
1341
|
+
id: `tbw-section-${a.id}`,
|
|
1342
1342
|
role: "presentation"
|
|
1343
1343
|
})
|
|
1344
|
-
),
|
|
1344
|
+
), c.appendChild(d);
|
|
1345
1345
|
}
|
|
1346
|
-
l.appendChild(
|
|
1346
|
+
l.appendChild(c), r.appendChild(l);
|
|
1347
1347
|
}
|
|
1348
1348
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(i)) : (e.appendChild(i), r && e.appendChild(r)), e;
|
|
1349
1349
|
}
|
|
1350
1350
|
function N(t) {
|
|
1351
1351
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function Et() {
|
|
1354
1354
|
return {
|
|
1355
1355
|
toolPanels: /* @__PURE__ */ new Map(),
|
|
1356
1356
|
headerContents: /* @__PURE__ */ new Map(),
|
|
@@ -1369,27 +1369,27 @@ function yt() {
|
|
|
1369
1369
|
lightDomContentMoved: !1
|
|
1370
1370
|
};
|
|
1371
1371
|
}
|
|
1372
|
-
function
|
|
1372
|
+
function qe(t) {
|
|
1373
1373
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1374
1374
|
}
|
|
1375
|
-
function
|
|
1376
|
-
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = N(o), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()],
|
|
1375
|
+
function ye(t, e, o = "☰") {
|
|
1376
|
+
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = N(o), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], c = new Set(s.map((g) => g.id)), a = [...s];
|
|
1377
1377
|
for (const g of l)
|
|
1378
|
-
|
|
1379
|
-
const h =
|
|
1380
|
-
let
|
|
1378
|
+
c.has(g.id) || a.push(g);
|
|
1379
|
+
const h = a.length > 0, d = e.toolPanels.size > 0, f = h && d, p = [...a].sort((g, m) => (g.order ?? 0) - (m.order ?? 0));
|
|
1380
|
+
let u = "";
|
|
1381
1381
|
for (const g of p)
|
|
1382
|
-
|
|
1383
|
-
if (
|
|
1382
|
+
u += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${g.id}"></div>`;
|
|
1383
|
+
if (f && (u += '<div class="tbw-toolbar-separator"></div>'), d) {
|
|
1384
1384
|
const g = e.isPanelOpen;
|
|
1385
|
-
|
|
1385
|
+
u += `<button class="${g ? "tbw-toolbar-btn active" : "tbw-toolbar-btn"}" data-panel-toggle title="Settings" aria-label="Toggle settings panel" aria-pressed="${g}" aria-controls="tbw-tool-panel">${r}</button>`;
|
|
1386
1386
|
}
|
|
1387
1387
|
return `
|
|
1388
1388
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1389
|
-
${i ? `<div class="tbw-shell-title">${
|
|
1389
|
+
${i ? `<div class="tbw-shell-title">${je(n)}</div>` : ""}
|
|
1390
1390
|
<div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
|
|
1391
1391
|
<div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
|
|
1392
|
-
${
|
|
1392
|
+
${u}
|
|
1393
1393
|
</div>
|
|
1394
1394
|
</div>
|
|
1395
1395
|
`;
|
|
@@ -1429,39 +1429,39 @@ function q(t, e, o) {
|
|
|
1429
1429
|
);
|
|
1430
1430
|
return;
|
|
1431
1431
|
}
|
|
1432
|
-
const
|
|
1432
|
+
const c = r.getAttribute("icon") ?? void 0, a = r.getAttribute("tooltip") ?? void 0, h = parseInt(r.getAttribute("order") ?? "100", 10);
|
|
1433
1433
|
let d;
|
|
1434
|
-
const
|
|
1435
|
-
if (
|
|
1436
|
-
d =
|
|
1434
|
+
const f = o?.(r);
|
|
1435
|
+
if (f)
|
|
1436
|
+
d = f;
|
|
1437
1437
|
else {
|
|
1438
1438
|
const g = r.innerHTML.trim();
|
|
1439
1439
|
d = (m) => {
|
|
1440
|
-
const
|
|
1441
|
-
return
|
|
1440
|
+
const y = document.createElement("div");
|
|
1441
|
+
return y.innerHTML = g, m.appendChild(y), () => y.remove();
|
|
1442
1442
|
};
|
|
1443
1443
|
}
|
|
1444
1444
|
const p = e.toolPanels.get(s);
|
|
1445
1445
|
if (p) {
|
|
1446
|
-
if (
|
|
1447
|
-
p.render = d, p.order = h, p.icon =
|
|
1446
|
+
if (f) {
|
|
1447
|
+
p.render = d, p.order = h, p.icon = c, p.tooltip = a;
|
|
1448
1448
|
const g = e.panelCleanups.get(s);
|
|
1449
1449
|
g && (g(), e.panelCleanups.delete(s));
|
|
1450
1450
|
}
|
|
1451
1451
|
return;
|
|
1452
1452
|
}
|
|
1453
|
-
const
|
|
1453
|
+
const u = {
|
|
1454
1454
|
id: s,
|
|
1455
1455
|
title: l,
|
|
1456
|
-
icon:
|
|
1457
|
-
tooltip:
|
|
1456
|
+
icon: c,
|
|
1457
|
+
tooltip: a,
|
|
1458
1458
|
order: h,
|
|
1459
1459
|
render: d
|
|
1460
1460
|
};
|
|
1461
|
-
e.toolPanels.set(s,
|
|
1461
|
+
e.toolPanels.set(s, u), e.lightDomToolPanelIds.add(s), r.style.display = "none";
|
|
1462
1462
|
});
|
|
1463
1463
|
}
|
|
1464
|
-
function
|
|
1464
|
+
function St(t, e, o, n) {
|
|
1465
1465
|
const i = t.querySelector(".tbw-shell-toolbar");
|
|
1466
1466
|
i && i.addEventListener("click", (s) => {
|
|
1467
1467
|
if (s.target.closest("[data-panel-toggle]")) {
|
|
@@ -1471,50 +1471,50 @@ function _t(t, e, o, n) {
|
|
|
1471
1471
|
});
|
|
1472
1472
|
const r = t.querySelector(".tbw-accordion");
|
|
1473
1473
|
r && r.addEventListener("click", (s) => {
|
|
1474
|
-
const
|
|
1475
|
-
if (
|
|
1476
|
-
const h =
|
|
1474
|
+
const c = s.target.closest(".tbw-accordion-header");
|
|
1475
|
+
if (c) {
|
|
1476
|
+
const h = c.closest("[data-section]")?.getAttribute("data-section");
|
|
1477
1477
|
h && n.onSectionToggle(h);
|
|
1478
1478
|
}
|
|
1479
1479
|
});
|
|
1480
1480
|
}
|
|
1481
|
-
function
|
|
1481
|
+
function Rt(t, e, o) {
|
|
1482
1482
|
const n = t.querySelector(".tbw-tool-panel"), i = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1483
1483
|
if (!n || !i || !r)
|
|
1484
1484
|
return () => {
|
|
1485
1485
|
};
|
|
1486
1486
|
const s = e?.toolPanel?.position ?? "right", l = 200;
|
|
1487
|
-
let
|
|
1488
|
-
const
|
|
1487
|
+
let c = 0, a = 0, h = 0, d = !1;
|
|
1488
|
+
const f = (g) => {
|
|
1489
1489
|
if (!d) return;
|
|
1490
1490
|
g.preventDefault();
|
|
1491
|
-
const m = s === "left" ? g.clientX -
|
|
1492
|
-
n.style.width = `${
|
|
1491
|
+
const m = s === "left" ? g.clientX - c : c - g.clientX, y = Math.min(h, Math.max(l, a + m));
|
|
1492
|
+
n.style.width = `${y}px`;
|
|
1493
1493
|
}, p = () => {
|
|
1494
1494
|
if (!d) return;
|
|
1495
1495
|
d = !1, i.classList.remove("resizing"), n.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1496
1496
|
const g = n.getBoundingClientRect().width;
|
|
1497
|
-
o(g), document.removeEventListener("mousemove",
|
|
1498
|
-
},
|
|
1499
|
-
g.preventDefault(), d = !0,
|
|
1497
|
+
o(g), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", p);
|
|
1498
|
+
}, u = (g) => {
|
|
1499
|
+
g.preventDefault(), d = !0, c = g.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", f), document.addEventListener("mouseup", p);
|
|
1500
1500
|
};
|
|
1501
|
-
return i.addEventListener("mousedown",
|
|
1502
|
-
i.removeEventListener("mousedown",
|
|
1501
|
+
return i.addEventListener("mousedown", u), () => {
|
|
1502
|
+
i.removeEventListener("mousedown", u), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", p);
|
|
1503
1503
|
};
|
|
1504
1504
|
}
|
|
1505
|
-
function
|
|
1505
|
+
function _e(t, e, o) {
|
|
1506
1506
|
const n = e?.header?.toolbarContents ?? [], i = [...o.toolbarContents.values()], r = new Set(n.map((l) => l.id)), s = [...n];
|
|
1507
1507
|
for (const l of i)
|
|
1508
1508
|
r.has(l.id) || s.push(l);
|
|
1509
1509
|
for (const l of s) {
|
|
1510
1510
|
if (o.toolbarContentCleanups.has(l.id) || !l.render) continue;
|
|
1511
|
-
const
|
|
1512
|
-
if (!
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1511
|
+
const c = t.querySelector(`[data-toolbar-content="${l.id}"]`);
|
|
1512
|
+
if (!c) continue;
|
|
1513
|
+
const a = l.render(c);
|
|
1514
|
+
a && o.toolbarContentCleanups.set(l.id, a);
|
|
1515
1515
|
}
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function ie(t, e) {
|
|
1518
1518
|
const o = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, n = e.headerContents.size > 0;
|
|
1519
1519
|
if (!o && !n) return;
|
|
1520
1520
|
const i = t.querySelector(".tbw-shell-content");
|
|
@@ -1528,42 +1528,42 @@ function Ie(t, e) {
|
|
|
1528
1528
|
for (const s of r) {
|
|
1529
1529
|
const l = e.headerContentCleanups.get(s.id);
|
|
1530
1530
|
l && (l(), e.headerContentCleanups.delete(s.id));
|
|
1531
|
-
let
|
|
1532
|
-
|
|
1533
|
-
const
|
|
1534
|
-
|
|
1531
|
+
let c = i.querySelector(`[data-header-content="${s.id}"]`);
|
|
1532
|
+
c || (c = document.createElement("div"), c.setAttribute("data-header-content", s.id), i.appendChild(c));
|
|
1533
|
+
const a = s.render(c);
|
|
1534
|
+
a && e.headerContentCleanups.set(s.id, a);
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
|
-
function
|
|
1537
|
+
function Tt(t, e, o) {
|
|
1538
1538
|
if (!e.isPanelOpen) return;
|
|
1539
|
-
const n = N(o?.expand ??
|
|
1539
|
+
const n = N(o?.expand ?? M.expand), i = N(o?.collapse ?? M.collapse);
|
|
1540
1540
|
for (const [r, s] of e.toolPanels) {
|
|
1541
|
-
const l = e.expandedSections.has(r),
|
|
1542
|
-
if (!
|
|
1543
|
-
|
|
1544
|
-
const h =
|
|
1541
|
+
const l = e.expandedSections.has(r), c = t.querySelector(`[data-section="${r}"]`), a = c?.querySelector(".tbw-accordion-content");
|
|
1542
|
+
if (!c || !a) continue;
|
|
1543
|
+
c.classList.toggle("expanded", l);
|
|
1544
|
+
const h = c.querySelector(".tbw-accordion-header");
|
|
1545
1545
|
h && h.setAttribute("aria-expanded", String(l));
|
|
1546
|
-
const d =
|
|
1546
|
+
const d = c.querySelector(".tbw-accordion-chevron");
|
|
1547
1547
|
if (d && (d.innerHTML = l ? i : n), l) {
|
|
1548
|
-
if (
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1548
|
+
if (a.children.length === 0) {
|
|
1549
|
+
const f = s.render(a);
|
|
1550
|
+
f && e.panelCleanups.set(r, f);
|
|
1551
1551
|
}
|
|
1552
1552
|
} else {
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1553
|
+
const f = e.panelCleanups.get(r);
|
|
1554
|
+
f && (f(), e.panelCleanups.delete(r)), a.innerHTML = "";
|
|
1555
1555
|
}
|
|
1556
1556
|
}
|
|
1557
1557
|
}
|
|
1558
|
-
function
|
|
1558
|
+
function Ee(t, e) {
|
|
1559
1559
|
const o = t.querySelector("[data-panel-toggle]");
|
|
1560
1560
|
o && (o.classList.toggle("active", e.isPanelOpen), o.setAttribute("aria-pressed", String(e.isPanelOpen)));
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function Se(t, e) {
|
|
1563
1563
|
const o = t.querySelector(".tbw-tool-panel");
|
|
1564
1564
|
o && (o.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (o.style.width = ""));
|
|
1565
1565
|
}
|
|
1566
|
-
function
|
|
1566
|
+
function xt(t) {
|
|
1567
1567
|
for (const e of t.headerContentCleanups.values())
|
|
1568
1568
|
e();
|
|
1569
1569
|
t.headerContentCleanups.clear();
|
|
@@ -1580,7 +1580,7 @@ function Tt(t) {
|
|
|
1580
1580
|
t.toolPanels.get(e)?.onClose?.();
|
|
1581
1581
|
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
1582
|
}
|
|
1583
|
-
function
|
|
1583
|
+
function At(t, e) {
|
|
1584
1584
|
let o = !1;
|
|
1585
1585
|
const n = {
|
|
1586
1586
|
get isInitialized() {
|
|
@@ -1605,11 +1605,11 @@ function xt(t, e) {
|
|
|
1605
1605
|
return;
|
|
1606
1606
|
}
|
|
1607
1607
|
if (t.isPanelOpen = !0, t.expandedSections.size === 0 && t.toolPanels.size > 0) {
|
|
1608
|
-
const s = [...t.toolPanels.values()].sort((l,
|
|
1608
|
+
const s = [...t.toolPanels.values()].sort((l, c) => (l.order ?? 100) - (c.order ?? 100))[0];
|
|
1609
1609
|
s && t.expandedSections.add(s.id);
|
|
1610
1610
|
}
|
|
1611
1611
|
const i = e.getShadow();
|
|
1612
|
-
|
|
1612
|
+
Ee(i, t), Se(i, t), Tt(i, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: n.expandedSections });
|
|
1613
1613
|
},
|
|
1614
1614
|
closeToolPanel() {
|
|
1615
1615
|
if (!t.isPanelOpen) return;
|
|
@@ -1620,7 +1620,7 @@ function xt(t, e) {
|
|
|
1620
1620
|
r.onClose?.();
|
|
1621
1621
|
t.isPanelOpen = !1;
|
|
1622
1622
|
const i = e.getShadow();
|
|
1623
|
-
|
|
1623
|
+
Ee(i, t), Se(i, t), e.emit("tool-panel-close", {});
|
|
1624
1624
|
},
|
|
1625
1625
|
toggleToolPanel() {
|
|
1626
1626
|
t.isPanelOpen ? n.closeToolPanel() : n.openToolPanel();
|
|
@@ -1635,17 +1635,17 @@ function xt(t, e) {
|
|
|
1635
1635
|
return;
|
|
1636
1636
|
const s = e.getShadow(), l = t.expandedSections.has(i);
|
|
1637
1637
|
if (l) {
|
|
1638
|
-
const
|
|
1639
|
-
|
|
1638
|
+
const c = t.panelCleanups.get(i);
|
|
1639
|
+
c && (c(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), oe(s, i, !1);
|
|
1640
1640
|
} else {
|
|
1641
|
-
for (const [
|
|
1642
|
-
if (
|
|
1643
|
-
const h = t.panelCleanups.get(
|
|
1644
|
-
h && (h(), t.panelCleanups.delete(
|
|
1645
|
-
const d = s.querySelector(`[data-section="${
|
|
1641
|
+
for (const [c, a] of t.toolPanels)
|
|
1642
|
+
if (c !== i && t.expandedSections.has(c)) {
|
|
1643
|
+
const h = t.panelCleanups.get(c);
|
|
1644
|
+
h && (h(), t.panelCleanups.delete(c)), a.onClose?.(), t.expandedSections.delete(c), oe(s, c, !1);
|
|
1645
|
+
const d = s.querySelector(`[data-section="${c}"] .tbw-accordion-content`);
|
|
1646
1646
|
d && (d.innerHTML = "");
|
|
1647
1647
|
}
|
|
1648
|
-
t.expandedSections.add(i), oe(s, i, !0),
|
|
1648
|
+
t.expandedSections.add(i), oe(s, i, !0), Pt(s, t, i);
|
|
1649
1649
|
}
|
|
1650
1650
|
e.emit("tool-panel-section-toggle", { id: i, expanded: !l });
|
|
1651
1651
|
},
|
|
@@ -1674,7 +1674,7 @@ function xt(t, e) {
|
|
|
1674
1674
|
console.warn(`[tbw-grid] Header content "${i.id}" already registered`);
|
|
1675
1675
|
return;
|
|
1676
1676
|
}
|
|
1677
|
-
t.headerContents.set(i.id, i), o &&
|
|
1677
|
+
t.headerContents.set(i.id, i), o && ie(e.getShadow(), t);
|
|
1678
1678
|
},
|
|
1679
1679
|
unregisterHeaderContent(i) {
|
|
1680
1680
|
const r = t.headerContentCleanups.get(i);
|
|
@@ -1703,7 +1703,7 @@ function oe(t, e, o) {
|
|
|
1703
1703
|
const n = t.querySelector(`[data-section="${e}"]`);
|
|
1704
1704
|
n && n.classList.toggle("expanded", o);
|
|
1705
1705
|
}
|
|
1706
|
-
function
|
|
1706
|
+
function Pt(t, e, o) {
|
|
1707
1707
|
const n = e.toolPanels.get(o);
|
|
1708
1708
|
if (!n?.render) return;
|
|
1709
1709
|
const i = t.querySelector(`[data-section="${o}"] .tbw-accordion-content`);
|
|
@@ -1711,49 +1711,49 @@ function At(t, e, o) {
|
|
|
1711
1711
|
const r = n.render(i);
|
|
1712
1712
|
r && e.panelCleanups.set(o, r);
|
|
1713
1713
|
}
|
|
1714
|
-
function
|
|
1715
|
-
const i =
|
|
1714
|
+
function Lt(t, e, o, n) {
|
|
1715
|
+
const i = qe(e), r = [], s = ["tbw-grid-header", "tbw-grid-tool-buttons", "tbw-grid-tool-panel", "tbw-grid-column"];
|
|
1716
1716
|
for (const l of s)
|
|
1717
|
-
t.querySelectorAll(`:scope > ${l}`).forEach((
|
|
1717
|
+
t.querySelectorAll(`:scope > ${l}`).forEach((a) => r.push(a));
|
|
1718
1718
|
t.replaceChildren();
|
|
1719
1719
|
for (const l of r)
|
|
1720
1720
|
t.appendChild(l);
|
|
1721
1721
|
if (i) {
|
|
1722
|
-
const l = N(n?.toolPanel ??
|
|
1722
|
+
const l = N(n?.toolPanel ?? M.toolPanel), c = N(n?.expand ?? M.expand), a = N(n?.collapse ?? M.collapse), d = [...e?.header?.toolbarContents ?? []].sort((C, w) => (C.order ?? 0) - (w.order ?? 0)), p = [...e?.toolPanels ?? []].sort((C, w) => (C.order ?? 100) - (w.order ?? 100)), u = {
|
|
1723
1723
|
title: e?.header?.title ?? void 0,
|
|
1724
1724
|
hasPanels: p.length > 0,
|
|
1725
1725
|
isPanelOpen: o.isPanelOpen,
|
|
1726
1726
|
toolPanelIcon: l,
|
|
1727
|
-
configButtons: d.map((
|
|
1728
|
-
id:
|
|
1727
|
+
configButtons: d.map((C) => ({
|
|
1728
|
+
id: C.id,
|
|
1729
1729
|
hasElement: !1,
|
|
1730
|
-
hasRender: !!
|
|
1730
|
+
hasRender: !!C.render
|
|
1731
1731
|
})),
|
|
1732
1732
|
apiButtons: []
|
|
1733
1733
|
}, g = {
|
|
1734
1734
|
position: e?.toolPanel?.position ?? "right",
|
|
1735
1735
|
isPanelOpen: o.isPanelOpen,
|
|
1736
|
-
expandIcon:
|
|
1737
|
-
collapseIcon:
|
|
1738
|
-
panels: p.map((
|
|
1739
|
-
id:
|
|
1740
|
-
title:
|
|
1741
|
-
icon: N(
|
|
1742
|
-
isExpanded: o.expandedSections.has(
|
|
1736
|
+
expandIcon: c,
|
|
1737
|
+
collapseIcon: a,
|
|
1738
|
+
panels: p.map((C) => ({
|
|
1739
|
+
id: C.id,
|
|
1740
|
+
title: C.title,
|
|
1741
|
+
icon: N(C.icon),
|
|
1742
|
+
isExpanded: o.expandedSections.has(C.id)
|
|
1743
1743
|
}))
|
|
1744
|
-
}, m =
|
|
1744
|
+
}, m = yt(u), y = _t(g), R = ve({
|
|
1745
1745
|
hasShell: !0,
|
|
1746
1746
|
shellHeader: m,
|
|
1747
|
-
shellBody:
|
|
1747
|
+
shellBody: y
|
|
1748
1748
|
});
|
|
1749
1749
|
t.appendChild(R);
|
|
1750
1750
|
} else {
|
|
1751
|
-
const l =
|
|
1751
|
+
const l = ve({ hasShell: !1 });
|
|
1752
1752
|
t.appendChild(l);
|
|
1753
1753
|
}
|
|
1754
1754
|
return i;
|
|
1755
1755
|
}
|
|
1756
|
-
function
|
|
1756
|
+
function Ht() {
|
|
1757
1757
|
return {
|
|
1758
1758
|
startY: null,
|
|
1759
1759
|
startX: null,
|
|
@@ -1767,39 +1767,39 @@ function Lt() {
|
|
|
1767
1767
|
momentumRaf: 0
|
|
1768
1768
|
};
|
|
1769
1769
|
}
|
|
1770
|
-
function
|
|
1770
|
+
function Ot(t) {
|
|
1771
1771
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
1772
1772
|
}
|
|
1773
|
-
function
|
|
1773
|
+
function We(t) {
|
|
1774
1774
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
1775
1775
|
}
|
|
1776
|
-
function
|
|
1776
|
+
function Dt(t, e, o) {
|
|
1777
1777
|
if (t.touches.length !== 1) return;
|
|
1778
|
-
|
|
1778
|
+
We(e);
|
|
1779
1779
|
const n = t.touches[0];
|
|
1780
1780
|
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
1781
|
}
|
|
1782
|
-
function
|
|
1782
|
+
function Mt(t, e, o) {
|
|
1783
1783
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
1784
1784
|
return !1;
|
|
1785
|
-
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i,
|
|
1785
|
+
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i, c = e.startX - r;
|
|
1786
1786
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
1787
1787
|
const g = s - e.lastTime;
|
|
1788
1788
|
g > 0 && (e.velocityY = (e.lastY - i) / g, e.velocityX = (e.lastX - r) / g);
|
|
1789
1789
|
}
|
|
1790
1790
|
e.lastY = i, e.lastX = r, e.lastTime = s;
|
|
1791
|
-
const { scrollTop:
|
|
1792
|
-
let
|
|
1791
|
+
const { scrollTop: a, scrollHeight: h, clientHeight: d } = o.fauxScrollbar, f = h - d, p = l > 0 && a < f || l < 0 && a > 0;
|
|
1792
|
+
let u = !1;
|
|
1793
1793
|
if (o.scrollArea) {
|
|
1794
|
-
const { scrollLeft: g, scrollWidth: m, clientWidth:
|
|
1795
|
-
|
|
1794
|
+
const { scrollLeft: g, scrollWidth: m, clientWidth: y } = o.scrollArea, R = m - y;
|
|
1795
|
+
u = c > 0 && g < R || c < 0 && g > 0;
|
|
1796
1796
|
}
|
|
1797
|
-
return p && (o.fauxScrollbar.scrollTop = e.scrollTop + l),
|
|
1798
|
-
}
|
|
1799
|
-
function Mt(t, e) {
|
|
1800
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && zt(t, e), Ht(t);
|
|
1797
|
+
return p && (o.fauxScrollbar.scrollTop = e.scrollTop + l), u && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + c), p || u;
|
|
1801
1798
|
}
|
|
1802
1799
|
function zt(t, e) {
|
|
1800
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Nt(t, e), Ot(t);
|
|
1801
|
+
}
|
|
1802
|
+
function Nt(t, e) {
|
|
1803
1803
|
const i = () => {
|
|
1804
1804
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
1805
1805
|
const r = t.velocityY * 16, s = t.velocityX * 16;
|
|
@@ -1807,19 +1807,19 @@ function zt(t, e) {
|
|
|
1807
1807
|
};
|
|
1808
1808
|
t.momentumRaf = requestAnimationFrame(i);
|
|
1809
1809
|
}
|
|
1810
|
-
function
|
|
1811
|
-
t.addEventListener("touchstart", (i) =>
|
|
1810
|
+
function It(t, e, o, n) {
|
|
1811
|
+
t.addEventListener("touchstart", (i) => Dt(i, e, o), {
|
|
1812
1812
|
passive: !0,
|
|
1813
1813
|
signal: n
|
|
1814
1814
|
}), t.addEventListener(
|
|
1815
1815
|
"touchmove",
|
|
1816
1816
|
(i) => {
|
|
1817
|
-
|
|
1817
|
+
Mt(i, e, o) && i.preventDefault();
|
|
1818
1818
|
},
|
|
1819
1819
|
{ passive: !1, signal: n }
|
|
1820
|
-
), t.addEventListener("touchend", () =>
|
|
1820
|
+
), t.addEventListener("touchend", () => zt(e, o), { passive: !0, signal: n });
|
|
1821
1821
|
}
|
|
1822
|
-
const
|
|
1822
|
+
const kt = [
|
|
1823
1823
|
{
|
|
1824
1824
|
property: "editable",
|
|
1825
1825
|
pluginName: "editing",
|
|
@@ -1857,7 +1857,7 @@ const It = [
|
|
|
1857
1857
|
importHint: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
|
|
1858
1858
|
isUsed: (t) => t === "left" || t === "right"
|
|
1859
1859
|
}
|
|
1860
|
-
],
|
|
1860
|
+
], qt = [
|
|
1861
1861
|
{
|
|
1862
1862
|
property: "columnGroups",
|
|
1863
1863
|
pluginName: "groupingColumns",
|
|
@@ -1866,7 +1866,7 @@ const It = [
|
|
|
1866
1866
|
importHint: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';",
|
|
1867
1867
|
isUsed: (t) => Array.isArray(t) && t.length > 0
|
|
1868
1868
|
}
|
|
1869
|
-
],
|
|
1869
|
+
], Wt = {
|
|
1870
1870
|
editing: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
|
|
1871
1871
|
selection: "import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';",
|
|
1872
1872
|
reorder: "import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder';",
|
|
@@ -1887,10 +1887,10 @@ const It = [
|
|
|
1887
1887
|
serverSide: "import { ServerSidePlugin } from '@toolbox-web/grid/plugins/server-side';",
|
|
1888
1888
|
columnVirtualization: "import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';"
|
|
1889
1889
|
};
|
|
1890
|
-
function
|
|
1891
|
-
return
|
|
1890
|
+
function re(t) {
|
|
1891
|
+
return Wt[t] ?? `import { ${O(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
|
|
1892
1892
|
}
|
|
1893
|
-
function
|
|
1893
|
+
function $e() {
|
|
1894
1894
|
if (typeof window < "u" && window.location) {
|
|
1895
1895
|
const t = window.location.hostname;
|
|
1896
1896
|
if (t === "localhost" || t === "127.0.0.1" || t === "::1")
|
|
@@ -1898,50 +1898,50 @@ function Wt() {
|
|
|
1898
1898
|
}
|
|
1899
1899
|
return typeof process < "u" && process.env?.NODE_ENV !== "production";
|
|
1900
1900
|
}
|
|
1901
|
-
function
|
|
1901
|
+
function O(t) {
|
|
1902
1902
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
1903
1903
|
}
|
|
1904
|
-
function
|
|
1904
|
+
function Re(t, e) {
|
|
1905
1905
|
return t.some((o) => o.name === e);
|
|
1906
1906
|
}
|
|
1907
1907
|
function $t(t, e) {
|
|
1908
|
-
const o =
|
|
1909
|
-
function r(l,
|
|
1910
|
-
i.has(l) || i.set(l, { description:
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1908
|
+
const o = kt, n = qt, i = /* @__PURE__ */ new Map();
|
|
1909
|
+
function r(l, c, a, h, d = !1) {
|
|
1910
|
+
i.has(l) || i.set(l, { description: c, importHint: a, fields: [], isConfigProperty: d });
|
|
1911
|
+
const f = i.get(l);
|
|
1912
|
+
f.fields.includes(h) || f.fields.push(h);
|
|
1913
1913
|
}
|
|
1914
1914
|
for (const l of n) {
|
|
1915
|
-
const
|
|
1916
|
-
(l.isUsed ? l.isUsed(
|
|
1915
|
+
const c = t[l.property];
|
|
1916
|
+
(l.isUsed ? l.isUsed(c) : c !== void 0) && !Re(e, l.pluginName) && r(l.pluginName, l.description, l.importHint ?? re(l.pluginName), l.property, !0);
|
|
1917
1917
|
}
|
|
1918
1918
|
const s = t.columns;
|
|
1919
1919
|
if (s && s.length > 0)
|
|
1920
1920
|
for (const l of s)
|
|
1921
|
-
for (const
|
|
1922
|
-
const
|
|
1923
|
-
if ((
|
|
1921
|
+
for (const c of o) {
|
|
1922
|
+
const a = l[c.property];
|
|
1923
|
+
if ((c.isUsed ? c.isUsed(a) : a !== void 0) && !Re(e, c.pluginName)) {
|
|
1924
1924
|
const d = l.field || "<unknown>";
|
|
1925
|
-
r(
|
|
1925
|
+
r(c.pluginName, c.description, c.importHint ?? re(c.pluginName), d);
|
|
1926
1926
|
}
|
|
1927
1927
|
}
|
|
1928
1928
|
if (i.size > 0) {
|
|
1929
1929
|
const l = [];
|
|
1930
|
-
for (const [
|
|
1931
|
-
if (
|
|
1930
|
+
for (const [c, { description: a, importHint: h, fields: d, isConfigProperty: f }] of i)
|
|
1931
|
+
if (f)
|
|
1932
1932
|
l.push(
|
|
1933
|
-
`Config uses ${
|
|
1933
|
+
`Config uses ${a}, but the required plugin is not loaded.
|
|
1934
1934
|
→ Add the plugin to your gridConfig.plugins array:
|
|
1935
1935
|
${h}
|
|
1936
|
-
plugins: [new ${
|
|
1936
|
+
plugins: [new ${c.charAt(0).toUpperCase() + c.slice(1)}Plugin(), ...]`
|
|
1937
1937
|
);
|
|
1938
1938
|
else {
|
|
1939
1939
|
const p = d.slice(0, 3).join(", ") + (d.length > 3 ? `, ... (${d.length} total)` : "");
|
|
1940
1940
|
l.push(
|
|
1941
|
-
`Column(s) [${p}] use ${
|
|
1941
|
+
`Column(s) [${p}] use ${a}, but the required plugin is not loaded.
|
|
1942
1942
|
→ Add the plugin to your gridConfig.plugins array:
|
|
1943
1943
|
${h}
|
|
1944
|
-
plugins: [new ${
|
|
1944
|
+
plugins: [new ${c.charAt(0).toUpperCase() + c.slice(1)}Plugin(), ...]`
|
|
1945
1945
|
);
|
|
1946
1946
|
}
|
|
1947
1947
|
throw new Error(
|
|
@@ -1963,12 +1963,12 @@ function Ft(t) {
|
|
|
1963
1963
|
for (const s of r.configRules) {
|
|
1964
1964
|
const l = n.config;
|
|
1965
1965
|
if (s.check(l)) {
|
|
1966
|
-
const
|
|
1967
|
-
s.severity === "error" ? e.push(
|
|
1966
|
+
const a = `${`[tbw-grid:${O(n.name)}Plugin]`} Configuration warning: ${s.message}`;
|
|
1967
|
+
s.severity === "error" ? e.push(a) : o.push(a);
|
|
1968
1968
|
}
|
|
1969
1969
|
}
|
|
1970
1970
|
}
|
|
1971
|
-
if (o.length > 0 &&
|
|
1971
|
+
if (o.length > 0 && $e())
|
|
1972
1972
|
for (const n of o)
|
|
1973
1973
|
console.warn(n);
|
|
1974
1974
|
if (e.length > 0)
|
|
@@ -1981,26 +1981,49 @@ ${e.join(`
|
|
|
1981
1981
|
function Ut(t, e) {
|
|
1982
1982
|
const o = t.name, i = t.constructor.dependencies ?? [];
|
|
1983
1983
|
for (const r of i) {
|
|
1984
|
-
const s = r.name, l = r.required ?? !0,
|
|
1984
|
+
const s = r.name, l = r.required ?? !0, c = r.reason;
|
|
1985
1985
|
if (!e.some((h) => h.name === s)) {
|
|
1986
|
-
const h =
|
|
1986
|
+
const h = c ?? `${O(o)}Plugin requires ${O(s)}Plugin`, d = re(s);
|
|
1987
1987
|
if (l)
|
|
1988
1988
|
throw new Error(
|
|
1989
1989
|
`[tbw-grid] Plugin dependency error:
|
|
1990
1990
|
|
|
1991
1991
|
${h}.
|
|
1992
1992
|
|
|
1993
|
-
→ Add the plugin to your gridConfig.plugins array BEFORE ${
|
|
1993
|
+
→ Add the plugin to your gridConfig.plugins array BEFORE ${O(o)}Plugin:
|
|
1994
1994
|
${d}
|
|
1995
|
-
plugins: [new ${
|
|
1995
|
+
plugins: [new ${O(s)}Plugin(), new ${O(o)}Plugin()]`
|
|
1996
1996
|
);
|
|
1997
1997
|
console.info(
|
|
1998
|
-
`[tbw-grid] ${
|
|
1998
|
+
`[tbw-grid] ${O(o)}Plugin: Optional "${s}" plugin not found. Some features may be unavailable.`
|
|
1999
1999
|
);
|
|
2000
2000
|
}
|
|
2001
2001
|
}
|
|
2002
2002
|
}
|
|
2003
|
-
|
|
2003
|
+
function Vt(t) {
|
|
2004
|
+
if (!$e()) return;
|
|
2005
|
+
const e = new Set(t.map((n) => n.name)), o = /* @__PURE__ */ new Set();
|
|
2006
|
+
for (const n of t) {
|
|
2007
|
+
const r = n.constructor.manifest;
|
|
2008
|
+
if (r?.incompatibleWith) {
|
|
2009
|
+
for (const s of r.incompatibleWith)
|
|
2010
|
+
if (e.has(s.name)) {
|
|
2011
|
+
const l = [n.name, s.name].sort().join("↔");
|
|
2012
|
+
if (o.has(l)) continue;
|
|
2013
|
+
o.add(l), console.warn(
|
|
2014
|
+
`[tbw-grid] Plugin incompatibility warning:
|
|
2015
|
+
|
|
2016
|
+
${O(n.name)}Plugin and ${O(s.name)}Plugin are both loaded, but they are currently incompatible.
|
|
2017
|
+
|
|
2018
|
+
→ ${s.reason}
|
|
2019
|
+
|
|
2020
|
+
Consider removing one of these plugins to avoid unexpected behavior.`
|
|
2021
|
+
);
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
class Bt {
|
|
2004
2027
|
constructor(e) {
|
|
2005
2028
|
this.grid = e;
|
|
2006
2029
|
}
|
|
@@ -2095,6 +2118,12 @@ class Vt {
|
|
|
2095
2118
|
typeof o.getExtraHeight == "function" && (e += o.getExtraHeight());
|
|
2096
2119
|
return e;
|
|
2097
2120
|
}
|
|
2121
|
+
hasExtraHeight() {
|
|
2122
|
+
for (const e of this.plugins)
|
|
2123
|
+
if (typeof e.getExtraHeight == "function" && e.getExtraHeight() > 0)
|
|
2124
|
+
return !0;
|
|
2125
|
+
return !1;
|
|
2126
|
+
}
|
|
2098
2127
|
getExtraHeightBefore(e) {
|
|
2099
2128
|
let o = 0;
|
|
2100
2129
|
for (const n of this.plugins)
|
|
@@ -2197,7 +2226,7 @@ class Vt {
|
|
|
2197
2226
|
}
|
|
2198
2227
|
class L extends HTMLElement {
|
|
2199
2228
|
static tagName = "tbw-grid";
|
|
2200
|
-
static version = "1.1.
|
|
2229
|
+
static version = "1.1.2";
|
|
2201
2230
|
static adapters = [];
|
|
2202
2231
|
static registerAdapter(e) {
|
|
2203
2232
|
this.adapters.push(e);
|
|
@@ -2211,14 +2240,14 @@ class L extends HTMLElement {
|
|
|
2211
2240
|
static get observedAttributes() {
|
|
2212
2241
|
return ["rows", "columns", "grid-config", "fit-mode"];
|
|
2213
2242
|
}
|
|
2214
|
-
get #
|
|
2243
|
+
get #o() {
|
|
2215
2244
|
return this;
|
|
2216
2245
|
}
|
|
2217
2246
|
#c = !1;
|
|
2218
2247
|
#f;
|
|
2219
2248
|
#d;
|
|
2220
2249
|
#s = [];
|
|
2221
|
-
get #
|
|
2250
|
+
get #n() {
|
|
2222
2251
|
return this.#t?.effective ?? {};
|
|
2223
2252
|
}
|
|
2224
2253
|
#h = !1;
|
|
@@ -2234,7 +2263,7 @@ class L extends HTMLElement {
|
|
|
2234
2263
|
#w = null;
|
|
2235
2264
|
#r = !1;
|
|
2236
2265
|
#b;
|
|
2237
|
-
#A =
|
|
2266
|
+
#A = Ht();
|
|
2238
2267
|
#p;
|
|
2239
2268
|
#v;
|
|
2240
2269
|
#y;
|
|
@@ -2253,17 +2282,17 @@ class L extends HTMLElement {
|
|
|
2253
2282
|
#P;
|
|
2254
2283
|
#L;
|
|
2255
2284
|
#t;
|
|
2256
|
-
#e =
|
|
2285
|
+
#e = Et();
|
|
2257
2286
|
#a;
|
|
2258
2287
|
#D;
|
|
2259
2288
|
#H = /* @__PURE__ */ new Map();
|
|
2260
2289
|
_rows = [];
|
|
2261
2290
|
#k = [];
|
|
2262
2291
|
get _columns() {
|
|
2263
|
-
return this.#
|
|
2292
|
+
return this.#n.columns ?? [];
|
|
2264
2293
|
}
|
|
2265
2294
|
set _columns(e) {
|
|
2266
|
-
this.#
|
|
2295
|
+
this.#n.columns = e;
|
|
2267
2296
|
}
|
|
2268
2297
|
get _visibleColumns() {
|
|
2269
2298
|
return this._columns.filter((e) => !e.hidden);
|
|
@@ -2322,49 +2351,49 @@ class L extends HTMLElement {
|
|
|
2322
2351
|
this.#t?.setColumns(e), o !== e && this.#I("columns");
|
|
2323
2352
|
}
|
|
2324
2353
|
get gridConfig() {
|
|
2325
|
-
return this.#
|
|
2354
|
+
return this.#n;
|
|
2326
2355
|
}
|
|
2327
2356
|
set gridConfig(e) {
|
|
2328
2357
|
const o = this.#t?.getGridConfig();
|
|
2329
2358
|
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this.#I("gridConfig"));
|
|
2330
2359
|
}
|
|
2331
2360
|
get fitMode() {
|
|
2332
|
-
return this.#
|
|
2361
|
+
return this.#n.fitMode ?? "stretch";
|
|
2333
2362
|
}
|
|
2334
2363
|
set fitMode(e) {
|
|
2335
2364
|
const o = this.#t?.getFitMode();
|
|
2336
2365
|
this.#t?.setFitMode(e), o !== e && this.#I("fitMode");
|
|
2337
2366
|
}
|
|
2338
2367
|
get effectiveConfig() {
|
|
2339
|
-
return this.#
|
|
2368
|
+
return this.#n;
|
|
2340
2369
|
}
|
|
2341
2370
|
get disconnectSignal() {
|
|
2342
2371
|
return this.#p || (this.#p = new AbortController()), this.#p.signal;
|
|
2343
2372
|
}
|
|
2344
2373
|
constructor() {
|
|
2345
|
-
super(), this.#
|
|
2374
|
+
super(), this.#le(), this.#f = new Promise((e) => this.#d = e), this.#l = new vt({
|
|
2346
2375
|
mergeConfig: () => {
|
|
2347
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#
|
|
2376
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), $t(this.#n, this.#i?.getPlugins() ?? []), Ft(this.#i?.getPlugins() ?? []), Vt(this.#i?.getPlugins() ?? []), this.#k = [...this._columns];
|
|
2348
2377
|
},
|
|
2349
|
-
processColumns: () => this.#
|
|
2350
|
-
processRows: () => this.#
|
|
2378
|
+
processColumns: () => this.#me(),
|
|
2379
|
+
processRows: () => this.#be(),
|
|
2351
2380
|
renderHeader: () => Z(this),
|
|
2352
2381
|
updateTemplate: () => F(this),
|
|
2353
|
-
renderVirtualWindow: () => this.refreshVirtualWindow(!0),
|
|
2382
|
+
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2354
2383
|
afterRender: () => {
|
|
2355
|
-
this.#i?.afterRender(), this.#
|
|
2384
|
+
this.#i?.afterRender(), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, he(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, W(this)), this._virtualization.enabled && !this.#N && this.#ce();
|
|
2356
2385
|
},
|
|
2357
2386
|
isConnected: () => this.isConnected && this.#h
|
|
2358
|
-
}), this.#l.setInitialReadyResolver(() => this.#d?.()), this.#a =
|
|
2359
|
-
getShadow: () => this.#
|
|
2360
|
-
getShellConfig: () => this.#
|
|
2387
|
+
}), this.#l.setInitialReadyResolver(() => this.#d?.()), this.#a = At(this.#e, {
|
|
2388
|
+
getShadow: () => this.#o,
|
|
2389
|
+
getShellConfig: () => this.#n?.shell,
|
|
2361
2390
|
getAccordionIcons: () => ({
|
|
2362
|
-
expand: this.#
|
|
2363
|
-
collapse: this.#
|
|
2391
|
+
expand: this.#n?.icons?.expand ?? M.expand,
|
|
2392
|
+
collapse: this.#n?.icons?.collapse ?? M.collapse
|
|
2364
2393
|
}),
|
|
2365
2394
|
emit: (e, o) => this.#T(e, o),
|
|
2366
2395
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2367
|
-
}), this.#t = new
|
|
2396
|
+
}), this.#t = new it({
|
|
2368
2397
|
getRows: () => this.#s,
|
|
2369
2398
|
getSortState: () => this._sortState,
|
|
2370
2399
|
setSortState: (e) => {
|
|
@@ -2385,7 +2414,7 @@ class L extends HTMLElement {
|
|
|
2385
2414
|
setRowHeight: (e) => {
|
|
2386
2415
|
this._virtualization.rowHeight = e;
|
|
2387
2416
|
},
|
|
2388
|
-
applyAnimationConfig: (e) => this.#
|
|
2417
|
+
applyAnimationConfig: (e) => this.#Ce(e),
|
|
2389
2418
|
getShellLightDomTitle: () => this.#e.lightDomTitle,
|
|
2390
2419
|
getShellToolPanels: () => this.#e.toolPanels,
|
|
2391
2420
|
getShellHeaderContents: () => this.#e.headerContents,
|
|
@@ -2394,25 +2423,25 @@ class L extends HTMLElement {
|
|
|
2394
2423
|
getShellHasToolButtonsContainer: () => this.#e.hasToolButtonsContainer
|
|
2395
2424
|
});
|
|
2396
2425
|
}
|
|
2397
|
-
static #
|
|
2426
|
+
static #Y = "tbw-grid-styles";
|
|
2398
2427
|
static #M = "";
|
|
2399
2428
|
static #q = /* @__PURE__ */ new Map();
|
|
2400
|
-
static #
|
|
2401
|
-
let e = document.getElementById(this.#
|
|
2402
|
-
return e || (e = document.createElement("style"), e.id = this.#
|
|
2429
|
+
static #se() {
|
|
2430
|
+
let e = document.getElementById(this.#Y);
|
|
2431
|
+
return e || (e = document.createElement("style"), e.id = this.#Y, e.setAttribute("data-tbw-grid", "true"), document.head.appendChild(e)), e;
|
|
2403
2432
|
}
|
|
2404
2433
|
static #W() {
|
|
2405
|
-
const e = this.#
|
|
2434
|
+
const e = this.#se(), o = Array.from(this.#q.values()).join(`
|
|
2406
2435
|
`);
|
|
2407
2436
|
e.textContent = `${this.#M}
|
|
2408
2437
|
|
|
2409
2438
|
/* Plugin Styles */
|
|
2410
2439
|
${o}`;
|
|
2411
2440
|
}
|
|
2412
|
-
async #
|
|
2441
|
+
async #le() {
|
|
2413
2442
|
if (!L.#M) {
|
|
2414
|
-
if (
|
|
2415
|
-
L.#M =
|
|
2443
|
+
if (ae.length > 0) {
|
|
2444
|
+
L.#M = ae, L.#W();
|
|
2416
2445
|
return;
|
|
2417
2446
|
}
|
|
2418
2447
|
await new Promise((e) => setTimeout(e, 50));
|
|
@@ -2457,9 +2486,9 @@ ${o}`;
|
|
|
2457
2486
|
requestAfterRender() {
|
|
2458
2487
|
this.#l.requestPhase(x.STYLE, "plugin:requestAfterRender");
|
|
2459
2488
|
}
|
|
2460
|
-
#
|
|
2461
|
-
this.#i = new
|
|
2462
|
-
const e = this.#
|
|
2489
|
+
#j() {
|
|
2490
|
+
this.#i = new Bt(this);
|
|
2491
|
+
const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
|
|
2463
2492
|
this.#i.attachAll(o);
|
|
2464
2493
|
}
|
|
2465
2494
|
#z() {
|
|
@@ -2469,8 +2498,8 @@ ${o}`;
|
|
|
2469
2498
|
L.#q.has(n) || (L.#q.set(n, i), o = !0);
|
|
2470
2499
|
o && L.#W();
|
|
2471
2500
|
}
|
|
2472
|
-
#
|
|
2473
|
-
const e = this.#
|
|
2501
|
+
#K() {
|
|
2502
|
+
const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
|
|
2474
2503
|
if (this.#_ !== o) {
|
|
2475
2504
|
if (this.#_ && this.#_.length === o.length && this.#_.every((n, i) => n === o[i])) {
|
|
2476
2505
|
this.#_ = o;
|
|
@@ -2488,13 +2517,13 @@ ${o}`;
|
|
|
2488
2517
|
const i = this.#e.headerContentCleanups.get(n);
|
|
2489
2518
|
i && (i(), this.#e.headerContentCleanups.delete(n)), this.#e.headerContents.delete(n);
|
|
2490
2519
|
}
|
|
2491
|
-
this.#
|
|
2520
|
+
this.#j(), this.#z(), this.#_ = o, this.#Z(), this.#r = this.#i?.getAll().some((n) => n.onScroll) ?? !1;
|
|
2492
2521
|
}
|
|
2493
2522
|
}
|
|
2494
|
-
#
|
|
2523
|
+
#ae() {
|
|
2495
2524
|
this.#i?.detachAll();
|
|
2496
2525
|
}
|
|
2497
|
-
#
|
|
2526
|
+
#Z() {
|
|
2498
2527
|
if (!this.#i) return;
|
|
2499
2528
|
const e = this.#i.getToolPanels();
|
|
2500
2529
|
for (const { panel: n } of e)
|
|
@@ -2520,17 +2549,17 @@ ${o}`;
|
|
|
2520
2549
|
};
|
|
2521
2550
|
}
|
|
2522
2551
|
connectedCallback() {
|
|
2523
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this._rows = Array.isArray(this.#s) ? [...this.#s] : [], this.#p && (this.#p.abort(), this.#O = !1), this.#p = new AbortController(), this.#C && (
|
|
2524
|
-
const e = this.#
|
|
2525
|
-
this.#_ = Array.isArray(e) ? e : [], this.#
|
|
2552
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this._rows = Array.isArray(this.#s) ? [...this.#s] : [], this.#p && (this.#p.abort(), this.#O = !1), this.#p = new AbortController(), this.#C && (be(this.#C), this.#C = void 0), I(this, this.#e), k(this, this.#e), q(this, this.#e, this.#R()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#j();
|
|
2553
|
+
const e = this.#n?.plugins;
|
|
2554
|
+
this.#_ = Array.isArray(e) ? e : [], this.#Z(), this.#c || (this.#G(), this.#z(), this.#c = !0), this.#J(), this.#C = Ct(
|
|
2526
2555
|
() => {
|
|
2527
|
-
this.#
|
|
2556
|
+
this.#Ee();
|
|
2528
2557
|
},
|
|
2529
2558
|
{ timeout: 100 }
|
|
2530
2559
|
);
|
|
2531
2560
|
}
|
|
2532
2561
|
disconnectedCallback() {
|
|
2533
|
-
this.#C && (
|
|
2562
|
+
this.#C && (be(this.#C), this.#C = void 0), this.#ae(), xt(this.#e), this.#a.setInitialized(!1), this.#D?.(), this.#D = void 0, We(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.#v && (this.#v.disconnect(), this.#v = void 0), this.#y && (this.#y.disconnect(), this.#y = void 0, this.#N = !1), G(this), this.#S.clear(), this.#_ = void 0;
|
|
2534
2563
|
for (const e of this._rowPool)
|
|
2535
2564
|
e.remove();
|
|
2536
2565
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#h = !1;
|
|
@@ -2546,22 +2575,24 @@ ${o}`;
|
|
|
2546
2575
|
}
|
|
2547
2576
|
else e === "fit-mode" && (this.fitMode = n);
|
|
2548
2577
|
}
|
|
2549
|
-
|
|
2550
|
-
const o = this.#
|
|
2578
|
+
#J() {
|
|
2579
|
+
const o = this.#o.querySelector(".tbw-grid-content") ?? this.#o.querySelector(".tbw-grid-root");
|
|
2551
2580
|
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) {
|
|
2552
|
-
|
|
2553
|
-
const r = this.#
|
|
2581
|
+
ie(this.#o, this.#e), _e(this.#o, this.#n?.shell, this.#e);
|
|
2582
|
+
const r = this.#n?.shell?.toolPanel?.defaultOpen;
|
|
2554
2583
|
r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
|
|
2555
2584
|
}
|
|
2556
|
-
if (this.setAttribute("data-upgraded", ""), this.#h = !0, this._resizeController =
|
|
2585
|
+
if (this.setAttribute("data-upgraded", ""), this.#h = !0, this._resizeController = Ce(this), this.#x(), this.#ee(o), this.#O)
|
|
2557
2586
|
return;
|
|
2558
2587
|
this.#O = !0;
|
|
2559
2588
|
const n = this.disconnectSignal;
|
|
2560
|
-
|
|
2561
|
-
const i = this.#
|
|
2562
|
-
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#
|
|
2589
|
+
gt(this, this, this.#o, n);
|
|
2590
|
+
const i = this.#n.rowHeight;
|
|
2591
|
+
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#Q()), queueMicrotask(() => this.#de()), this.#l.requestPhase(x.FULL, "afterConnect");
|
|
2563
2592
|
}
|
|
2564
|
-
#
|
|
2593
|
+
#Q() {
|
|
2594
|
+
if (this.#i.hasExtraHeight())
|
|
2595
|
+
return;
|
|
2565
2596
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2566
2597
|
if (!e) return;
|
|
2567
2598
|
const o = e.querySelectorAll(".cell");
|
|
@@ -2571,9 +2602,9 @@ ${o}`;
|
|
|
2571
2602
|
l > n && (n = l);
|
|
2572
2603
|
});
|
|
2573
2604
|
const i = e.getBoundingClientRect(), r = Math.max(i.height, n);
|
|
2574
|
-
r > 0 && r
|
|
2605
|
+
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#l.requestPhase(x.VIRTUALIZATION, "measureRowHeight"));
|
|
2575
2606
|
}
|
|
2576
|
-
#
|
|
2607
|
+
#ee(e) {
|
|
2577
2608
|
this.#P?.abort(), this.#P = new AbortController();
|
|
2578
2609
|
const o = this.#P.signal, n = e?.querySelector(".faux-vscroll"), i = e?.querySelector(".rows");
|
|
2579
2610
|
if (this._virtualization.container = n ?? this, this.#r = this.#i?.getAll().some((r) => r.onScroll) ?? !1, n && i) {
|
|
@@ -2581,66 +2612,64 @@ ${o}`;
|
|
|
2581
2612
|
"scroll",
|
|
2582
2613
|
() => {
|
|
2583
2614
|
if (!this._virtualization.enabled && !this.#r) return;
|
|
2584
|
-
const l = n.scrollTop,
|
|
2615
|
+
const l = n.scrollTop, c = this._virtualization.rowHeight;
|
|
2585
2616
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
2586
2617
|
i.style.transform = `translateY(${-l}px)`;
|
|
2587
2618
|
else {
|
|
2588
|
-
const
|
|
2619
|
+
const a = Math.floor(l / c), h = a - a % 2, d = -(l - h * c);
|
|
2589
2620
|
i.style.transform = `translateY(${d}px)`;
|
|
2590
2621
|
}
|
|
2591
2622
|
this.#w = l, this.#g || (this.#g = requestAnimationFrame(() => {
|
|
2592
|
-
this.#g = 0, this.#w !== null && (this.#
|
|
2623
|
+
this.#g = 0, this.#w !== null && (this.#ve(this.#w), this.#w = null);
|
|
2593
2624
|
}));
|
|
2594
2625
|
},
|
|
2595
2626
|
{ passive: !0, signal: o }
|
|
2596
2627
|
);
|
|
2597
|
-
const r = this.#
|
|
2628
|
+
const r = this.#o.querySelector(".tbw-grid-content"), s = this.#o.querySelector(".tbw-scroll-area");
|
|
2598
2629
|
r && (r.addEventListener(
|
|
2599
2630
|
"wheel",
|
|
2600
2631
|
(l) => {
|
|
2601
|
-
const
|
|
2602
|
-
if (
|
|
2603
|
-
const
|
|
2604
|
-
(
|
|
2605
|
-
} else if (!
|
|
2606
|
-
const { scrollTop:
|
|
2607
|
-
(l.deltaY > 0 &&
|
|
2632
|
+
const c = l.shiftKey || Math.abs(l.deltaX) > Math.abs(l.deltaY);
|
|
2633
|
+
if (c && s) {
|
|
2634
|
+
const a = l.shiftKey ? l.deltaY : l.deltaX, { scrollLeft: h, scrollWidth: d, clientWidth: f } = s;
|
|
2635
|
+
(a > 0 && h < d - f || a < 0 && h > 0) && (l.preventDefault(), s.scrollLeft += a);
|
|
2636
|
+
} else if (!c) {
|
|
2637
|
+
const { scrollTop: a, scrollHeight: h, clientHeight: d } = n;
|
|
2638
|
+
(l.deltaY > 0 && a < h - d || l.deltaY < 0 && a > 0) && (l.preventDefault(), n.scrollTop += l.deltaY);
|
|
2608
2639
|
}
|
|
2609
2640
|
},
|
|
2610
2641
|
{ passive: !1, signal: o }
|
|
2611
|
-
),
|
|
2642
|
+
), It(r, this.#A, { fauxScrollbar: n, scrollArea: s }, o));
|
|
2612
2643
|
}
|
|
2613
|
-
this._bodyEl &&
|
|
2644
|
+
this._bodyEl && pt(this, this._bodyEl, o), this.#v?.disconnect(), this._virtualization.viewportEl && (this.#v = new ResizeObserver(() => {
|
|
2614
2645
|
this.#l.requestPhase(x.VIRTUALIZATION, "resize-observer");
|
|
2615
|
-
}), this.#v.observe(this._virtualization.viewportEl)), this
|
|
2646
|
+
}), this.#v.observe(this._virtualization.viewportEl)), this.#o.addEventListener(
|
|
2616
2647
|
"focusin",
|
|
2617
2648
|
() => {
|
|
2618
2649
|
this.dataset.hasFocus = "";
|
|
2619
2650
|
},
|
|
2620
2651
|
{ signal: o }
|
|
2621
|
-
), this.#
|
|
2652
|
+
), this.#o.addEventListener(
|
|
2622
2653
|
"focusout",
|
|
2623
2654
|
(r) => {
|
|
2624
2655
|
const s = r.relatedTarget;
|
|
2625
|
-
(!s || !this.#
|
|
2656
|
+
(!s || !this.#o.contains(s)) && delete this.dataset.hasFocus;
|
|
2626
2657
|
},
|
|
2627
2658
|
{ signal: o }
|
|
2628
2659
|
);
|
|
2629
2660
|
}
|
|
2630
2661
|
#N = !1;
|
|
2631
|
-
#
|
|
2662
|
+
#ce() {
|
|
2632
2663
|
if (this.#N) return;
|
|
2633
2664
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2634
2665
|
e && (this.#N = !0, this.#y?.disconnect(), this.#y = new ResizeObserver(() => {
|
|
2635
|
-
this.#
|
|
2636
|
-
}), this.#y.observe(e)
|
|
2637
|
-
this.#F();
|
|
2638
|
-
}));
|
|
2666
|
+
this.#Q();
|
|
2667
|
+
}), this.#y.observe(e));
|
|
2639
2668
|
}
|
|
2640
2669
|
#T(e, o) {
|
|
2641
2670
|
this.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0, composed: !0 }));
|
|
2642
2671
|
}
|
|
2643
|
-
#
|
|
2672
|
+
#de() {
|
|
2644
2673
|
this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((o, n) => {
|
|
2645
2674
|
const i = n === this._focusRow;
|
|
2646
2675
|
o.setAttribute("aria-selected", String(i)), o.querySelectorAll(".cell").forEach((r, s) => {
|
|
@@ -2649,9 +2678,9 @@ ${o}`;
|
|
|
2649
2678
|
});
|
|
2650
2679
|
}
|
|
2651
2680
|
#I(e) {
|
|
2652
|
-
this.#m[e] = !0, !this.#u && (this.#u = !0, queueMicrotask(() => this.#
|
|
2681
|
+
this.#m[e] = !0, !this.#u && (this.#u = !0, queueMicrotask(() => this.#he()));
|
|
2653
2682
|
}
|
|
2654
|
-
#
|
|
2683
|
+
#he() {
|
|
2655
2684
|
if (!this.#u || !this.#h) {
|
|
2656
2685
|
this.#u = !1;
|
|
2657
2686
|
return;
|
|
@@ -2663,64 +2692,64 @@ ${o}`;
|
|
|
2663
2692
|
gridConfig: !1,
|
|
2664
2693
|
fitMode: !1
|
|
2665
2694
|
}, e.gridConfig) {
|
|
2666
|
-
this.#
|
|
2695
|
+
this.#ge(), e.rows && this.#te();
|
|
2667
2696
|
return;
|
|
2668
2697
|
}
|
|
2669
|
-
e.columns && this.#
|
|
2698
|
+
e.columns && this.#fe(), e.rows && this.#te(), e.fitMode && this.#pe();
|
|
2670
2699
|
}
|
|
2671
|
-
#
|
|
2672
|
-
this._rows = Array.isArray(this.#s) ? [...this.#s] : [], this
|
|
2700
|
+
#te() {
|
|
2701
|
+
this._rows = Array.isArray(this.#s) ? [...this.#s] : [], this.#$(), this.#l.requestPhase(x.ROWS, "applyRowsUpdate");
|
|
2673
2702
|
}
|
|
2674
|
-
|
|
2703
|
+
#$() {
|
|
2675
2704
|
this.#H.clear();
|
|
2676
|
-
const e = this.#
|
|
2705
|
+
const e = this.#n.getRowId;
|
|
2677
2706
|
this._rows.forEach((o, n) => {
|
|
2678
|
-
const i = this.#
|
|
2707
|
+
const i = this.#oe(o, e);
|
|
2679
2708
|
i !== void 0 && this.#H.set(i, { row: o, index: n });
|
|
2680
2709
|
});
|
|
2681
2710
|
}
|
|
2682
|
-
#
|
|
2711
|
+
#oe(e, o) {
|
|
2683
2712
|
if (o)
|
|
2684
2713
|
return o(e);
|
|
2685
2714
|
const n = e;
|
|
2686
2715
|
if ("id" in n && n.id != null) return String(n.id);
|
|
2687
2716
|
if ("_id" in n && n._id != null) return String(n._id);
|
|
2688
2717
|
}
|
|
2689
|
-
#
|
|
2690
|
-
const n = this.#
|
|
2718
|
+
#ue(e, o) {
|
|
2719
|
+
const n = this.#oe(e, o);
|
|
2691
2720
|
if (n === void 0)
|
|
2692
2721
|
throw new Error(
|
|
2693
2722
|
'[tbw-grid] Cannot determine row ID. Configure getRowId in gridConfig or ensure rows have an "id" property.'
|
|
2694
2723
|
);
|
|
2695
2724
|
return n;
|
|
2696
2725
|
}
|
|
2697
|
-
#
|
|
2726
|
+
#fe() {
|
|
2698
2727
|
G(this), this.#t.merge(), this.#x();
|
|
2699
2728
|
}
|
|
2700
|
-
#
|
|
2701
|
-
this.#t.merge(), this.#
|
|
2729
|
+
#pe() {
|
|
2730
|
+
this.#t.merge(), this.#n.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, he(this)) : (this._columns.forEach((o) => {
|
|
2702
2731
|
!o.__userResized && o.__autoSized && delete o.width;
|
|
2703
2732
|
}), F(this));
|
|
2704
2733
|
}
|
|
2705
|
-
#
|
|
2734
|
+
#ge() {
|
|
2706
2735
|
I(this, this.#e), k(this, this.#e);
|
|
2707
|
-
const e = !!this.#
|
|
2708
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#
|
|
2709
|
-
const i =
|
|
2736
|
+
const e = !!this.#o.querySelector(".has-shell"), o = !!this.#o.querySelector(".tbw-tool-panel"), n = this.#o.querySelectorAll(".tbw-accordion-section").length;
|
|
2737
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), q(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
2738
|
+
const i = qe(this.#n?.shell), r = (this.#n?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#n?.shell?.toolPanels?.length ?? 0) !== n;
|
|
2710
2739
|
if (e !== i || !e && i || !o && r || o && s) {
|
|
2711
|
-
this.#
|
|
2740
|
+
this.#G(), this.#z(), this.#J(), this.#$();
|
|
2712
2741
|
return;
|
|
2713
2742
|
}
|
|
2714
|
-
e && this.#
|
|
2743
|
+
e && this.#we(), this.#$(), this.#l.requestPhase(x.COLUMNS, "applyGridConfigUpdate");
|
|
2715
2744
|
}
|
|
2716
|
-
#
|
|
2717
|
-
const e = this.#
|
|
2745
|
+
#we() {
|
|
2746
|
+
const e = this.#o.querySelector(".tbw-shell-header");
|
|
2718
2747
|
if (!e) return;
|
|
2719
|
-
const o = this.#
|
|
2748
|
+
const o = this.#n.shell?.header?.title ?? this.#e.lightDomTitle;
|
|
2720
2749
|
let n = e.querySelector(".tbw-shell-title");
|
|
2721
2750
|
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();
|
|
2722
2751
|
}
|
|
2723
|
-
#
|
|
2752
|
+
#me() {
|
|
2724
2753
|
if (this.#i) {
|
|
2725
2754
|
const e = this.#k.length > 0 ? this.#k : this._columns, o = e.filter((r) => !r.hidden), n = e.filter((r) => r.hidden), i = this.#i.processColumns([...o]);
|
|
2726
2755
|
if (i !== o) {
|
|
@@ -2731,29 +2760,29 @@ ${o}`;
|
|
|
2731
2760
|
this._columns = [...e];
|
|
2732
2761
|
}
|
|
2733
2762
|
}
|
|
2734
|
-
#
|
|
2763
|
+
#be() {
|
|
2735
2764
|
G(this);
|
|
2736
2765
|
const e = Array.isArray(this.#s) ? [...this.#s] : [], o = this.#i?.processRows(e) ?? e;
|
|
2737
2766
|
this._rows = o;
|
|
2738
2767
|
}
|
|
2739
|
-
#
|
|
2768
|
+
#Ce(e) {
|
|
2740
2769
|
const o = {
|
|
2741
|
-
...
|
|
2770
|
+
...Fe,
|
|
2742
2771
|
...e.animation
|
|
2743
2772
|
}, n = o.mode ?? "reduced-motion";
|
|
2744
2773
|
let i = 1;
|
|
2745
2774
|
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;
|
|
2746
2775
|
}
|
|
2747
|
-
#
|
|
2748
|
-
this.#b || (this.#b = (i, r, s) => this.#i?.renderRow(i, r, s) ?? !1),
|
|
2776
|
+
#F(e, o, n = this.__rowRenderEpoch) {
|
|
2777
|
+
this.#b || (this.#b = (i, r, s) => this.#i?.renderRow(i, r, s) ?? !1), at(this, e, o, n, this.#b);
|
|
2749
2778
|
}
|
|
2750
|
-
#
|
|
2751
|
-
#
|
|
2752
|
-
#
|
|
2753
|
-
if (e === this.#
|
|
2779
|
+
#U = -1;
|
|
2780
|
+
#ne = -1;
|
|
2781
|
+
#ie(e, o) {
|
|
2782
|
+
if (e === this.#U && o === this.#ne)
|
|
2754
2783
|
return;
|
|
2755
|
-
const n = this.#
|
|
2756
|
-
this.#
|
|
2784
|
+
const n = this.#U;
|
|
2785
|
+
this.#U = e, this.#ne = o, this.__rowsBodyEl && (this.__rowsBodyEl.setAttribute("aria-rowcount", String(e)), this.__rowsBodyEl.setAttribute("aria-colcount", String(o))), e !== n && this._bodyEl && (e > 0 ? this._bodyEl.setAttribute("role", "rowgroup") : this._bodyEl.removeAttribute("role"));
|
|
2757
2786
|
}
|
|
2758
2787
|
#x() {
|
|
2759
2788
|
if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
|
|
@@ -2766,14 +2795,14 @@ ${o}`;
|
|
|
2766
2795
|
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#l.requestPhase(x.FULL, "setup");
|
|
2767
2796
|
}
|
|
2768
2797
|
}
|
|
2769
|
-
#
|
|
2798
|
+
#ve(e) {
|
|
2770
2799
|
if (this.refreshVirtualWindow(!1), this.#i?.onScrollRender(), this.#r) {
|
|
2771
2800
|
const o = this._virtualization.container, n = this.#E;
|
|
2772
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.#i?.onScroll(n);
|
|
2773
2802
|
}
|
|
2774
2803
|
}
|
|
2775
2804
|
findHeaderRow() {
|
|
2776
|
-
return this.#
|
|
2805
|
+
return this.#o.querySelector(".header-row");
|
|
2777
2806
|
}
|
|
2778
2807
|
findRenderedRowElement(e) {
|
|
2779
2808
|
return Array.from(this._bodyEl.querySelectorAll(".data-grid-row")).find((o) => {
|
|
@@ -2784,7 +2813,7 @@ ${o}`;
|
|
|
2784
2813
|
_dispatchCellClick(e, o, n, i) {
|
|
2785
2814
|
const r = this._rows[o], s = this._columns[n];
|
|
2786
2815
|
if (!r || !s) return !1;
|
|
2787
|
-
const l = s.field,
|
|
2816
|
+
const l = s.field, c = r[l], a = new CustomEvent("cell-activate", {
|
|
2788
2817
|
cancelable: !0,
|
|
2789
2818
|
bubbles: !0,
|
|
2790
2819
|
composed: !0,
|
|
@@ -2792,21 +2821,21 @@ ${o}`;
|
|
|
2792
2821
|
rowIndex: o,
|
|
2793
2822
|
colIndex: n,
|
|
2794
2823
|
field: l,
|
|
2795
|
-
value:
|
|
2824
|
+
value: c,
|
|
2796
2825
|
row: r,
|
|
2797
2826
|
cellEl: i,
|
|
2798
2827
|
trigger: "pointer",
|
|
2799
2828
|
originalEvent: e
|
|
2800
2829
|
}
|
|
2801
2830
|
});
|
|
2802
|
-
if (this.dispatchEvent(
|
|
2831
|
+
if (this.dispatchEvent(a), a.defaultPrevented)
|
|
2803
2832
|
return !0;
|
|
2804
2833
|
const h = {
|
|
2805
2834
|
row: r,
|
|
2806
2835
|
rowIndex: o,
|
|
2807
2836
|
colIndex: n,
|
|
2808
2837
|
field: l,
|
|
2809
|
-
value:
|
|
2838
|
+
value: c,
|
|
2810
2839
|
cellEl: i,
|
|
2811
2840
|
originalEvent: e
|
|
2812
2841
|
}, d = this.#i?.onCellClick(h) ?? !1;
|
|
@@ -2859,10 +2888,10 @@ ${o}`;
|
|
|
2859
2888
|
return this.#l.requestPhase(x.FULL, "forceLayout"), this.#l.whenReady();
|
|
2860
2889
|
}
|
|
2861
2890
|
async getConfig() {
|
|
2862
|
-
return Object.freeze({ ...this.#
|
|
2891
|
+
return Object.freeze({ ...this.#n || {} });
|
|
2863
2892
|
}
|
|
2864
2893
|
getRowId(e) {
|
|
2865
|
-
return this.#
|
|
2894
|
+
return this.#ue(e, this.#n.getRowId);
|
|
2866
2895
|
}
|
|
2867
2896
|
getRow(e) {
|
|
2868
2897
|
return this.#H.get(e)?.row;
|
|
@@ -2874,17 +2903,17 @@ ${o}`;
|
|
|
2874
2903
|
`[tbw-grid] Row with ID "${e}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
2875
2904
|
);
|
|
2876
2905
|
const { row: r, index: s } = i, l = [];
|
|
2877
|
-
for (const [
|
|
2878
|
-
const h = r[
|
|
2879
|
-
h !==
|
|
2906
|
+
for (const [c, a] of Object.entries(o)) {
|
|
2907
|
+
const h = r[c];
|
|
2908
|
+
h !== a && (l.push({ field: c, oldValue: h, newValue: a }), r[c] = a);
|
|
2880
2909
|
}
|
|
2881
|
-
for (const { field:
|
|
2910
|
+
for (const { field: c, oldValue: a, newValue: h } of l)
|
|
2882
2911
|
this.#T("cell-change", {
|
|
2883
2912
|
row: r,
|
|
2884
2913
|
rowId: e,
|
|
2885
2914
|
rowIndex: s,
|
|
2886
|
-
field:
|
|
2887
|
-
oldValue:
|
|
2915
|
+
field: c,
|
|
2916
|
+
oldValue: a,
|
|
2888
2917
|
newValue: h,
|
|
2889
2918
|
changes: o,
|
|
2890
2919
|
source: n
|
|
@@ -2899,14 +2928,14 @@ ${o}`;
|
|
|
2899
2928
|
throw new Error(
|
|
2900
2929
|
`[tbw-grid] Row with ID "${i}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
2901
2930
|
);
|
|
2902
|
-
const { row: l, index:
|
|
2903
|
-
for (const [
|
|
2904
|
-
const d = l[
|
|
2905
|
-
d !== h && (n = !0, l[
|
|
2931
|
+
const { row: l, index: c } = s;
|
|
2932
|
+
for (const [a, h] of Object.entries(r)) {
|
|
2933
|
+
const d = l[a];
|
|
2934
|
+
d !== h && (n = !0, l[a] = h, this.#T("cell-change", {
|
|
2906
2935
|
row: l,
|
|
2907
2936
|
rowId: i,
|
|
2908
|
-
rowIndex:
|
|
2909
|
-
field:
|
|
2937
|
+
rowIndex: c,
|
|
2938
|
+
field: a,
|
|
2910
2939
|
oldValue: d,
|
|
2911
2940
|
newValue: h,
|
|
2912
2941
|
changes: r,
|
|
@@ -2944,12 +2973,12 @@ ${o}`;
|
|
|
2944
2973
|
return this.#t.collectState(e);
|
|
2945
2974
|
}
|
|
2946
2975
|
set columnState(e) {
|
|
2947
|
-
e && (this.#L = e, this.#t.initialColumnState = e, this.#c && this.#
|
|
2976
|
+
e && (this.#L = e, this.#t.initialColumnState = e, this.#c && this.#ye(e));
|
|
2948
2977
|
}
|
|
2949
2978
|
get columnState() {
|
|
2950
2979
|
return this.getColumnState();
|
|
2951
2980
|
}
|
|
2952
|
-
#
|
|
2981
|
+
#ye(e) {
|
|
2953
2982
|
const o = this.#i?.getAll() ?? [];
|
|
2954
2983
|
this.#t.applyState(e, o), this.#x();
|
|
2955
2984
|
}
|
|
@@ -3007,43 +3036,55 @@ ${o}`;
|
|
|
3007
3036
|
unregisterToolbarContent(e) {
|
|
3008
3037
|
this.#a.unregisterToolbarContent(e);
|
|
3009
3038
|
}
|
|
3039
|
+
#V = !1;
|
|
3010
3040
|
refreshShellHeader() {
|
|
3011
|
-
|
|
3041
|
+
this.#V || (this.#V = !0, queueMicrotask(() => {
|
|
3042
|
+
this.#V = !1, this.isConnected && (I(this, this.#e), k(this, this.#e), q(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge(), this.#G(), this.#z(), this.#_e());
|
|
3043
|
+
}));
|
|
3044
|
+
}
|
|
3045
|
+
#_e() {
|
|
3046
|
+
const o = this.#o.querySelector(".tbw-grid-content") ?? this.#o.querySelector(".tbw-grid-root");
|
|
3047
|
+
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
|
+
ie(this.#o, this.#e), _e(this.#o, this.#n?.shell, this.#e);
|
|
3049
|
+
const n = this.#n?.shell?.toolPanel?.defaultOpen;
|
|
3050
|
+
n && this.#e.toolPanels.has(n) && (this.openToolPanel(), this.#e.expandedSections.add(n));
|
|
3051
|
+
}
|
|
3052
|
+
this._resizeController = Ce(this), this.#ee(o), this.#l.requestPhase(x.VIRTUALIZATION, "shellRefresh");
|
|
3012
3053
|
}
|
|
3013
3054
|
#S = /* @__PURE__ */ new Map();
|
|
3014
3055
|
registerStyles(e, o) {
|
|
3015
3056
|
let n = this.#S.get(e);
|
|
3016
|
-
n || (n = new CSSStyleSheet(), this.#S.set(e, n)), n.replaceSync(o), this.#
|
|
3057
|
+
n || (n = new CSSStyleSheet(), this.#S.set(e, n)), n.replaceSync(o), this.#re();
|
|
3017
3058
|
}
|
|
3018
3059
|
unregisterStyles(e) {
|
|
3019
|
-
this.#S.delete(e) && this.#
|
|
3060
|
+
this.#S.delete(e) && this.#re();
|
|
3020
3061
|
}
|
|
3021
3062
|
getRegisteredStyles() {
|
|
3022
3063
|
return Array.from(this.#S.keys());
|
|
3023
3064
|
}
|
|
3024
|
-
#
|
|
3065
|
+
#re() {
|
|
3025
3066
|
const e = Array.from(this.#S.values()), o = document.adoptedStyleSheets.filter(
|
|
3026
3067
|
(n) => !Array.from(this.#S.values()).includes(n)
|
|
3027
3068
|
);
|
|
3028
3069
|
document.adoptedStyleSheets = [...o, ...e];
|
|
3029
3070
|
}
|
|
3030
|
-
#
|
|
3071
|
+
#Ee() {
|
|
3031
3072
|
const e = () => {
|
|
3032
3073
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3033
3074
|
I(this, this.#e), k(this, this.#e), q(this, this.#e, this.#R());
|
|
3034
3075
|
const r = this.#e.lightDomTitle, s = this.#e.hasToolButtonsContainer;
|
|
3035
3076
|
if (r && !n || s && !i) {
|
|
3036
3077
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3037
|
-
const l = this.#
|
|
3078
|
+
const l = this.#o.querySelector(".tbw-shell-header");
|
|
3038
3079
|
if (l) {
|
|
3039
|
-
const
|
|
3040
|
-
this.#
|
|
3080
|
+
const c = ye(
|
|
3081
|
+
this.#n.shell,
|
|
3041
3082
|
this.#e,
|
|
3042
|
-
this.#
|
|
3043
|
-
),
|
|
3044
|
-
|
|
3045
|
-
const h =
|
|
3046
|
-
h && (l.replaceWith(h), this.#
|
|
3083
|
+
this.#n.icons?.toolPanel
|
|
3084
|
+
), a = document.createElement("div");
|
|
3085
|
+
a.innerHTML = c;
|
|
3086
|
+
const h = a.firstElementChild;
|
|
3087
|
+
h && (l.replaceWith(h), this.#X());
|
|
3047
3088
|
}
|
|
3048
3089
|
}
|
|
3049
3090
|
}, o = () => {
|
|
@@ -3058,91 +3099,91 @@ ${o}`;
|
|
|
3058
3099
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3059
3100
|
if (n && !e || i && !o) {
|
|
3060
3101
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3061
|
-
const s = this.#
|
|
3102
|
+
const s = this.#o.querySelector(".tbw-shell-header");
|
|
3062
3103
|
if (s) {
|
|
3063
|
-
const l =
|
|
3064
|
-
this.#
|
|
3104
|
+
const l = ye(
|
|
3105
|
+
this.#n.shell,
|
|
3065
3106
|
this.#e,
|
|
3066
|
-
this.#
|
|
3067
|
-
),
|
|
3068
|
-
|
|
3069
|
-
const
|
|
3070
|
-
|
|
3107
|
+
this.#n.icons?.toolPanel
|
|
3108
|
+
), c = document.createElement("div");
|
|
3109
|
+
c.innerHTML = l;
|
|
3110
|
+
const a = c.firstElementChild;
|
|
3111
|
+
a && (s.replaceWith(a), this.#X());
|
|
3071
3112
|
}
|
|
3072
3113
|
}
|
|
3073
3114
|
this.#l.requestPhase(x.COLUMNS, "refreshColumns");
|
|
3074
3115
|
}
|
|
3075
|
-
#
|
|
3076
|
-
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight,
|
|
3077
|
-
return e * o + d +
|
|
3116
|
+
#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, d = a - s, f = this.#i?.getExtraHeight() ?? 0, p = Math.max(0, r - a);
|
|
3118
|
+
return e * o + d + f + p;
|
|
3078
3119
|
}
|
|
3079
|
-
refreshVirtualWindow(e = !1) {
|
|
3120
|
+
refreshVirtualWindow(e = !1, o = !1) {
|
|
3080
3121
|
if (!this._bodyEl) return;
|
|
3081
|
-
const
|
|
3122
|
+
const n = this._rows.length;
|
|
3082
3123
|
if (!this._virtualization.enabled) {
|
|
3083
|
-
this.#
|
|
3124
|
+
this.#F(0, n), o || this.#i?.afterRender();
|
|
3084
3125
|
return;
|
|
3085
3126
|
}
|
|
3086
3127
|
if (this._rows.length <= this._virtualization.bypassThreshold) {
|
|
3087
|
-
this._virtualization.start = 0, this._virtualization.end =
|
|
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.#i?.afterRender();
|
|
3088
3129
|
return;
|
|
3089
3130
|
}
|
|
3090
|
-
const
|
|
3091
|
-
let a = Math.floor(
|
|
3092
|
-
const
|
|
3093
|
-
for (;
|
|
3094
|
-
const
|
|
3095
|
-
if (
|
|
3096
|
-
a =
|
|
3131
|
+
const i = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? i, s = r.clientHeight, l = this._virtualization.rowHeight, c = i.scrollTop;
|
|
3132
|
+
let a = Math.floor(c / l), h = 0;
|
|
3133
|
+
const d = 10;
|
|
3134
|
+
for (; h < d; ) {
|
|
3135
|
+
const C = this.#i?.getExtraHeightBefore?.(a) ?? 0, w = Math.floor((c - C) / l);
|
|
3136
|
+
if (w >= a || w < 0) break;
|
|
3137
|
+
a = w, h++;
|
|
3097
3138
|
}
|
|
3098
3139
|
a = a - a % 2, a < 0 && (a = 0);
|
|
3099
|
-
const
|
|
3100
|
-
|
|
3101
|
-
const
|
|
3102
|
-
let
|
|
3103
|
-
if (
|
|
3140
|
+
const f = this.#i?.adjustVirtualStart(a, c, l);
|
|
3141
|
+
f !== void 0 && f < a && (a = f, a = a - a % 2, a < 0 && (a = 0));
|
|
3142
|
+
const p = Math.ceil(s / l) + 3;
|
|
3143
|
+
let u = a + p;
|
|
3144
|
+
if (u > n && (u = n), this._virtualization.start = a, this._virtualization.end = u, i.clientHeight === 0 && s > 0) {
|
|
3104
3145
|
this.#l.requestPhase(x.VIRTUALIZATION, "stale-refs-retry");
|
|
3105
3146
|
return;
|
|
3106
3147
|
}
|
|
3107
|
-
const
|
|
3108
|
-
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${
|
|
3109
|
-
const
|
|
3110
|
-
this._bodyEl.style.transform = `translateY(${
|
|
3111
|
-
const
|
|
3112
|
-
if (
|
|
3113
|
-
const
|
|
3114
|
-
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${
|
|
3148
|
+
const m = this.#B(n);
|
|
3149
|
+
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${m}px`);
|
|
3150
|
+
const y = this.#i?.getExtraHeightBefore?.(a) ?? 0, R = -(c - a * l - y);
|
|
3151
|
+
this._bodyEl.style.transform = `translateY(${R}px)`, this.#F(a, u, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#ie(n, this._visibleColumns.length), e && !o && (this.#i?.afterRender(), queueMicrotask(() => {
|
|
3152
|
+
const C = i.clientHeight, w = r.clientHeight;
|
|
3153
|
+
if (C === 0 && w > 0) return;
|
|
3154
|
+
const v = this.#B(n);
|
|
3155
|
+
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${v}px`);
|
|
3115
3156
|
}));
|
|
3116
3157
|
}
|
|
3117
|
-
#
|
|
3158
|
+
#G() {
|
|
3118
3159
|
I(this, this.#e), k(this, this.#e), q(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3119
|
-
const e = this.#
|
|
3120
|
-
|
|
3121
|
-
this.#
|
|
3160
|
+
const e = this.#n?.shell;
|
|
3161
|
+
Lt(
|
|
3162
|
+
this.#o,
|
|
3122
3163
|
e,
|
|
3123
3164
|
{ isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
|
|
3124
|
-
this.#
|
|
3125
|
-
) && (this.#
|
|
3165
|
+
this.#n?.icons
|
|
3166
|
+
) && (this.#X(), this.#a.setInitialized(!0));
|
|
3126
3167
|
}
|
|
3127
|
-
#
|
|
3128
|
-
|
|
3168
|
+
#X() {
|
|
3169
|
+
St(this.#o, this.#n?.shell, this.#e, {
|
|
3129
3170
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3130
3171
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3131
|
-
}), this.#D?.(), this.#D =
|
|
3172
|
+
}), this.#D?.(), this.#D = Rt(this.#o, this.#n?.shell, (e) => {
|
|
3132
3173
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3133
3174
|
});
|
|
3134
3175
|
}
|
|
3135
3176
|
}
|
|
3136
3177
|
customElements.get(L.tagName) || customElements.define(L.tagName, L);
|
|
3137
3178
|
globalThis.DataGridElement = L;
|
|
3138
|
-
const
|
|
3179
|
+
const Xt = {
|
|
3139
3180
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3140
3181
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3141
3182
|
};
|
|
3142
|
-
class
|
|
3183
|
+
class Yt {
|
|
3143
3184
|
static dependencies;
|
|
3144
3185
|
static manifest;
|
|
3145
|
-
version = "1.1.
|
|
3186
|
+
version = "1.1.2";
|
|
3146
3187
|
styles;
|
|
3147
3188
|
cellRenderers;
|
|
3148
3189
|
headerRenderers;
|
|
@@ -3150,7 +3191,7 @@ class Xt {
|
|
|
3150
3191
|
grid;
|
|
3151
3192
|
config;
|
|
3152
3193
|
userConfig;
|
|
3153
|
-
#
|
|
3194
|
+
#o;
|
|
3154
3195
|
get defaultConfig() {
|
|
3155
3196
|
return {};
|
|
3156
3197
|
}
|
|
@@ -3158,10 +3199,10 @@ class Xt {
|
|
|
3158
3199
|
this.userConfig = e;
|
|
3159
3200
|
}
|
|
3160
3201
|
attach(e) {
|
|
3161
|
-
this.#
|
|
3202
|
+
this.#o?.abort(), this.#o = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
3162
3203
|
}
|
|
3163
3204
|
detach() {
|
|
3164
|
-
this.#
|
|
3205
|
+
this.#o?.abort(), this.#o = void 0;
|
|
3165
3206
|
}
|
|
3166
3207
|
getPlugin(e) {
|
|
3167
3208
|
return this.grid?.getPlugin(e);
|
|
@@ -3198,11 +3239,11 @@ class Xt {
|
|
|
3198
3239
|
return this.grid;
|
|
3199
3240
|
}
|
|
3200
3241
|
get disconnectSignal() {
|
|
3201
|
-
return this.#
|
|
3242
|
+
return this.#o?.signal ?? this.grid?.disconnectSignal;
|
|
3202
3243
|
}
|
|
3203
3244
|
get gridIcons() {
|
|
3204
3245
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
3205
|
-
return { ...
|
|
3246
|
+
return { ...M, ...e };
|
|
3206
3247
|
}
|
|
3207
3248
|
get isAnimationEnabled() {
|
|
3208
3249
|
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
@@ -3269,7 +3310,7 @@ const A = {
|
|
|
3269
3310
|
GROUP_KEY: "data-group-key",
|
|
3270
3311
|
TREE_LEVEL: "data-tree-level",
|
|
3271
3312
|
STICKY: "data-sticky"
|
|
3272
|
-
},
|
|
3313
|
+
}, jt = {
|
|
3273
3314
|
ROOT: `.${A.ROOT}`,
|
|
3274
3315
|
HEADER: `.${A.HEADER}`,
|
|
3275
3316
|
HEADER_ROW: `.${A.HEADER_ROW}`,
|
|
@@ -3284,7 +3325,7 @@ const A = {
|
|
|
3284
3325
|
CELL_AT: (t, e) => `.${A.DATA_ROW}[${Y.ROW_INDEX}="${t}"] .${A.DATA_CELL}[${Y.COL_INDEX}="${e}"]`,
|
|
3285
3326
|
SELECTED_ROWS: `.${A.DATA_ROW}.${A.SELECTED}`,
|
|
3286
3327
|
EDITING_CELL: `.${A.DATA_CELL}.${A.EDITING}`
|
|
3287
|
-
},
|
|
3328
|
+
}, Kt = {
|
|
3288
3329
|
COLOR_BG: "--tbw-color-bg",
|
|
3289
3330
|
COLOR_FG: "--tbw-color-fg",
|
|
3290
3331
|
COLOR_FG_MUTED: "--tbw-color-fg-muted",
|
|
@@ -3303,14 +3344,14 @@ const A = {
|
|
|
3303
3344
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
3304
3345
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
3305
3346
|
};
|
|
3306
|
-
function
|
|
3347
|
+
function Zt(t) {
|
|
3307
3348
|
const e = document.createElement("tbw-grid");
|
|
3308
3349
|
return t && (e.gridConfig = t), e;
|
|
3309
3350
|
}
|
|
3310
|
-
function
|
|
3351
|
+
function Jt(t, e = document) {
|
|
3311
3352
|
return e.querySelector(t);
|
|
3312
3353
|
}
|
|
3313
|
-
const
|
|
3354
|
+
const Qt = {
|
|
3314
3355
|
CELL_CHANGE: "cell-change",
|
|
3315
3356
|
CELL_COMMIT: "cell-commit",
|
|
3316
3357
|
ROW_COMMIT: "row-commit",
|
|
@@ -3323,7 +3364,7 @@ const Jt = {
|
|
|
3323
3364
|
CELL_ACTIVATE: "cell-activate",
|
|
3324
3365
|
GROUP_TOGGLE: "group-toggle",
|
|
3325
3366
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
3326
|
-
},
|
|
3367
|
+
}, eo = {
|
|
3327
3368
|
SELECTION_CHANGE: "selection-change",
|
|
3328
3369
|
TREE_EXPAND: "tree-expand",
|
|
3329
3370
|
FILTER_CHANGE: "filter-change",
|
|
@@ -3352,7 +3393,7 @@ const Jt = {
|
|
|
3352
3393
|
max: (t, e) => Math.max(...t.map((o) => Number(o[e]) || -1 / 0)),
|
|
3353
3394
|
first: (t, e) => t[0]?.[e],
|
|
3354
3395
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
3355
|
-
}, $ = /* @__PURE__ */ new Map(),
|
|
3396
|
+
}, $ = /* @__PURE__ */ new Map(), D = {
|
|
3356
3397
|
register(t, e) {
|
|
3357
3398
|
$.set(t, e);
|
|
3358
3399
|
},
|
|
@@ -3373,7 +3414,7 @@ const Jt = {
|
|
|
3373
3414
|
list() {
|
|
3374
3415
|
return [...Object.keys(ne), ...$.keys()];
|
|
3375
3416
|
}
|
|
3376
|
-
},
|
|
3417
|
+
}, Te = {
|
|
3377
3418
|
sum: (t) => t.reduce((e, o) => e + o, 0),
|
|
3378
3419
|
avg: (t) => t.length ? t.reduce((e, o) => e + o, 0) / t.length : 0,
|
|
3379
3420
|
count: (t) => t.length,
|
|
@@ -3382,45 +3423,45 @@ const Jt = {
|
|
|
3382
3423
|
first: (t) => t[0] ?? 0,
|
|
3383
3424
|
last: (t) => t[t.length - 1] ?? 0
|
|
3384
3425
|
};
|
|
3385
|
-
function
|
|
3386
|
-
return
|
|
3426
|
+
function Gt(t) {
|
|
3427
|
+
return Te[t] ?? Te.sum;
|
|
3387
3428
|
}
|
|
3388
|
-
function
|
|
3389
|
-
return
|
|
3429
|
+
function to(t, e) {
|
|
3430
|
+
return Gt(t)(e);
|
|
3390
3431
|
}
|
|
3391
|
-
const
|
|
3432
|
+
const oo = D.register.bind(D), no = D.unregister.bind(D), io = D.get.bind(D), ro = D.run.bind(D), so = D.list.bind(D);
|
|
3392
3433
|
export {
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3434
|
+
Yt as BaseGridPlugin,
|
|
3435
|
+
Fe as DEFAULT_ANIMATION_CONFIG,
|
|
3436
|
+
M as DEFAULT_GRID_ICONS,
|
|
3437
|
+
Qt as DGEvents,
|
|
3397
3438
|
L as DataGridElement,
|
|
3398
3439
|
V as FitModeEnum,
|
|
3399
|
-
|
|
3440
|
+
Kt as GridCSSVars,
|
|
3400
3441
|
A as GridClasses,
|
|
3401
3442
|
Y as GridDataAttrs,
|
|
3402
3443
|
L as GridElement,
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3444
|
+
jt as GridSelectors,
|
|
3445
|
+
Xt as PLUGIN_QUERIES,
|
|
3446
|
+
eo as PluginEvents,
|
|
3447
|
+
Bt as PluginManager,
|
|
3407
3448
|
x as RenderPhase,
|
|
3408
3449
|
W as a,
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3450
|
+
D as aggregatorRegistry,
|
|
3451
|
+
mt as builtInSort,
|
|
3452
|
+
se as c,
|
|
3453
|
+
Zt as createGrid,
|
|
3454
|
+
wt as defaultComparator,
|
|
3455
|
+
xe as e,
|
|
3456
|
+
Le as g,
|
|
3457
|
+
io as getAggregator,
|
|
3458
|
+
Gt as getValueAggregator,
|
|
3459
|
+
so as listAggregators,
|
|
3460
|
+
Jt as queryGrid,
|
|
3461
|
+
oo as registerAggregator,
|
|
3462
|
+
ro as runAggregator,
|
|
3463
|
+
to as runValueAggregator,
|
|
3423
3464
|
j as s,
|
|
3424
|
-
|
|
3465
|
+
no as unregisterAggregator
|
|
3425
3466
|
};
|
|
3426
3467
|
//# sourceMappingURL=index.js.map
|