@toolbox-web/grid 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all.d.ts +1 -0
- package/all.d.ts.map +1 -1
- package/all.js +997 -710
- package/all.js.map +1 -1
- package/index.js +642 -599
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/internal/header.d.ts +7 -0
- package/lib/core/internal/header.d.ts.map +1 -1
- package/lib/core/types.d.ts +151 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js +19 -16
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js +42 -39
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/index.js +25 -22
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
- package/lib/plugins/editing/index.js +53 -48
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js +23 -20
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts +11 -1
- package/lib/plugins/filtering/FilteringPlugin.d.ts.map +1 -1
- package/lib/plugins/filtering/index.js +186 -150
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js +21 -18
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js +67 -64
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js +52 -49
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js +18 -15
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js +25 -22
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js +26 -23
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js +50 -47
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts +98 -0
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -0
- package/lib/plugins/print/index.d.ts +10 -0
- package/lib/plugins/print/index.d.ts.map +1 -0
- package/lib/plugins/print/index.js +626 -0
- package/lib/plugins/print/index.js.map +1 -0
- package/lib/plugins/print/print-isolated.d.ts +26 -0
- package/lib/plugins/print/print-isolated.d.ts.map +1 -0
- package/lib/plugins/print/types.d.ts +147 -0
- package/lib/plugins/print/types.d.ts.map +1 -0
- package/lib/plugins/reorder/index.js +25 -22
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js +20 -17
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js +39 -36
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
- package/lib/plugins/selection/index.js +115 -101
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js +35 -32
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js +26 -23
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js +23 -20
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js +22 -19
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +98 -24
- package/umd/grid.all.umd.js.map +1 -1
- package/umd/grid.umd.js +11 -11
- package/umd/grid.umd.js.map +1 -1
- package/umd/plugins/editing.umd.js +1 -1
- package/umd/plugins/editing.umd.js.map +1 -1
- package/umd/plugins/filtering.umd.js +1 -1
- package/umd/plugins/filtering.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +76 -0
- package/umd/plugins/print.umd.js.map +1 -0
- package/umd/plugins/selection.umd.js +2 -2
- package/umd/plugins/selection.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const he = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{:root{color-scheme:light dark}tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-scrollbar-thumb: var(--tbw-color-border-strong);--tbw-scrollbar-track: var(--tbw-color-bg);--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}', B = {
|
|
1
|
+
const pe = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-scrollbar-thumb: var(--tbw-color-border-strong);--tbw-scrollbar-track: var(--tbw-color-bg);--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator],&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}', G = {
|
|
2
2
|
STRETCH: "stretch",
|
|
3
3
|
FIXED: "fixed"
|
|
4
|
-
},
|
|
4
|
+
}, je = {
|
|
5
5
|
mode: "reduced-motion",
|
|
6
6
|
duration: 200,
|
|
7
7
|
easing: "ease-out"
|
|
8
|
-
}, z = {
|
|
8
|
+
}, ge = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', z = {
|
|
9
9
|
expand: "▶",
|
|
10
10
|
collapse: "▼",
|
|
11
11
|
sortAsc: "▲",
|
|
@@ -13,9 +13,12 @@ const he = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{:root{color-sc
|
|
|
13
13
|
sortNone: "⇅",
|
|
14
14
|
submenuArrow: "▶",
|
|
15
15
|
dragHandle: "⋮⋮",
|
|
16
|
-
toolPanel: "☰"
|
|
16
|
+
toolPanel: "☰",
|
|
17
|
+
filter: ge,
|
|
18
|
+
filterActive: ge,
|
|
19
|
+
print: "🖨️"
|
|
17
20
|
};
|
|
18
|
-
function
|
|
21
|
+
function Ke(t) {
|
|
19
22
|
return Array.from(t.querySelectorAll("tbw-grid-column")).map((o) => {
|
|
20
23
|
const n = o.getAttribute("field") || "";
|
|
21
24
|
if (!n) return null;
|
|
@@ -52,7 +55,7 @@ function Ge(t) {
|
|
|
52
55
|
return h;
|
|
53
56
|
}).filter((o) => !!o);
|
|
54
57
|
}
|
|
55
|
-
function
|
|
58
|
+
function we(t, e) {
|
|
56
59
|
if ((!t || !t.length) && (!e || !e.length)) return [];
|
|
57
60
|
if (!t || !t.length) return e || [];
|
|
58
61
|
if (!e || !e.length) return t;
|
|
@@ -76,7 +79,7 @@ function ue(t, e) {
|
|
|
76
79
|
});
|
|
77
80
|
return Object.keys(o).forEach((i) => n.push(o[i])), n;
|
|
78
81
|
}
|
|
79
|
-
function
|
|
82
|
+
function De(t, e) {
|
|
80
83
|
try {
|
|
81
84
|
t.part?.add?.(e);
|
|
82
85
|
} catch {
|
|
@@ -84,9 +87,9 @@ function fe(t, e) {
|
|
|
84
87
|
const o = t.getAttribute("part");
|
|
85
88
|
o ? o.split(/\s+/).includes(e) || t.setAttribute("part", o + " " + e) : t.setAttribute("part", e);
|
|
86
89
|
}
|
|
87
|
-
function
|
|
88
|
-
const e = t.effectiveConfig?.fitMode || t.fitMode ||
|
|
89
|
-
if (e !==
|
|
90
|
+
function me(t) {
|
|
91
|
+
const e = t.effectiveConfig?.fitMode || t.fitMode || G.STRETCH;
|
|
92
|
+
if (e !== G.STRETCH && e !== G.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
|
|
90
93
|
const o = Array.from(t._headerRowEl?.children || []);
|
|
91
94
|
if (!o.length) return;
|
|
92
95
|
let n = !1;
|
|
@@ -102,32 +105,32 @@ function pe(t) {
|
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
l > 0 && (i.width = l + 2, i.__autoSized = !0, n = !0);
|
|
105
|
-
}), n &&
|
|
108
|
+
}), n && V(t), t.__didInitialAutoSize = !0;
|
|
106
109
|
}
|
|
107
|
-
function
|
|
108
|
-
(t.effectiveConfig?.fitMode || t.fitMode ||
|
|
110
|
+
function V(t) {
|
|
111
|
+
(t.effectiveConfig?.fitMode || t.fitMode || G.STRETCH) === G.STRETCH ? t._gridTemplate = t._visibleColumns.map((o) => {
|
|
109
112
|
if (o.width) return `${o.width}px`;
|
|
110
113
|
const n = o.minWidth;
|
|
111
114
|
return n != null ? `minmax(${n}px, 1fr)` : "1fr";
|
|
112
115
|
}).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((o) => o.width ? `${o.width}px` : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
|
|
113
116
|
}
|
|
114
|
-
function
|
|
117
|
+
function Ze(t) {
|
|
115
118
|
return t == null ? "string" : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t instanceof Date || typeof t == "string" && /\d{4}-\d{2}-\d{2}/.test(t) && !isNaN(Date.parse(t)) ? "date" : "string";
|
|
116
119
|
}
|
|
117
|
-
function
|
|
120
|
+
function Je(t, e) {
|
|
118
121
|
const o = t[0] || {}, n = Object.keys(o).map((r) => {
|
|
119
|
-
const s = o[r], l =
|
|
122
|
+
const s = o[r], l = Ze(s);
|
|
120
123
|
return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: l };
|
|
121
124
|
}), i = {};
|
|
122
125
|
return n.forEach((r) => {
|
|
123
126
|
i[r.field] = r.type || "string";
|
|
124
127
|
}), { columns: n, typeMap: i };
|
|
125
128
|
}
|
|
126
|
-
const
|
|
127
|
-
function
|
|
129
|
+
const Qe = /{{\s*([^}]+)\s*}}/g, O = "__DG_EMPTY__", et = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, tt = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/;
|
|
130
|
+
function ot(t) {
|
|
128
131
|
return !t || typeof t != "string" ? "" : t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
129
132
|
}
|
|
130
|
-
const
|
|
133
|
+
const nt = /* @__PURE__ */ new Set([
|
|
131
134
|
"script",
|
|
132
135
|
"iframe",
|
|
133
136
|
"object",
|
|
@@ -152,23 +155,23 @@ const Qe = /* @__PURE__ */ new Set([
|
|
|
152
155
|
"plaintext",
|
|
153
156
|
"xmp",
|
|
154
157
|
"listing"
|
|
155
|
-
]),
|
|
156
|
-
function
|
|
158
|
+
]), be = /^on\w+$/i, it = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), rt = /^\s*(javascript|vbscript|data|blob):/i;
|
|
159
|
+
function F(t) {
|
|
157
160
|
if (!t || typeof t != "string") return "";
|
|
158
161
|
if (t.indexOf("<") === -1) return t;
|
|
159
162
|
const e = document.createElement("template");
|
|
160
|
-
return e.innerHTML = t,
|
|
163
|
+
return e.innerHTML = t, st(e.content), e.innerHTML;
|
|
161
164
|
}
|
|
162
|
-
function
|
|
165
|
+
function st(t) {
|
|
163
166
|
const e = [], o = t.querySelectorAll("*");
|
|
164
167
|
for (const n of o) {
|
|
165
168
|
const i = n.tagName.toLowerCase();
|
|
166
|
-
if (
|
|
169
|
+
if (nt.has(i)) {
|
|
167
170
|
e.push(n);
|
|
168
171
|
continue;
|
|
169
172
|
}
|
|
170
173
|
if ((i === "svg" || n.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(n.attributes).some(
|
|
171
|
-
(l) =>
|
|
174
|
+
(l) => be.test(l.name) || l.name === "href" || l.name === "xlink:href"
|
|
172
175
|
)) {
|
|
173
176
|
e.push(n);
|
|
174
177
|
continue;
|
|
@@ -176,11 +179,11 @@ function ot(t) {
|
|
|
176
179
|
const r = [];
|
|
177
180
|
for (const s of n.attributes) {
|
|
178
181
|
const l = s.name.toLowerCase();
|
|
179
|
-
if (
|
|
182
|
+
if (be.test(l)) {
|
|
180
183
|
r.push(s.name);
|
|
181
184
|
continue;
|
|
182
185
|
}
|
|
183
|
-
if (
|
|
186
|
+
if (it.has(l) && rt.test(s.value)) {
|
|
184
187
|
r.push(s.name);
|
|
185
188
|
continue;
|
|
186
189
|
}
|
|
@@ -193,22 +196,22 @@ function ot(t) {
|
|
|
193
196
|
}
|
|
194
197
|
e.forEach((n) => n.remove());
|
|
195
198
|
}
|
|
196
|
-
function
|
|
199
|
+
function Me(t, e) {
|
|
197
200
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
198
|
-
const o = [], n = t.replace(
|
|
199
|
-
const a =
|
|
201
|
+
const o = [], n = t.replace(Qe, (l, c) => {
|
|
202
|
+
const a = lt(c, e);
|
|
200
203
|
return o.push({ expr: c.trim(), result: a }), a;
|
|
201
|
-
}), i =
|
|
204
|
+
}), i = at(n), r = o.length && o.every((l) => l.result === "" || l.result === O);
|
|
202
205
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : i;
|
|
203
206
|
}
|
|
204
|
-
function
|
|
207
|
+
function lt(t, e) {
|
|
205
208
|
if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return O;
|
|
206
209
|
if (t === "value") return e.value == null ? O : String(e.value);
|
|
207
210
|
if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
|
|
208
211
|
const n = t.slice(4), i = e.row ? e.row[n] : void 0;
|
|
209
212
|
return i == null ? O : String(i);
|
|
210
213
|
}
|
|
211
|
-
if (t.length > 80 || !
|
|
214
|
+
if (t.length > 80 || !et.test(t) || tt.test(t)) return O;
|
|
212
215
|
const o = t.match(/\./g);
|
|
213
216
|
if (o && o.length > 1) return O;
|
|
214
217
|
try {
|
|
@@ -218,10 +221,10 @@ function nt(t, e) {
|
|
|
218
221
|
return O;
|
|
219
222
|
}
|
|
220
223
|
}
|
|
221
|
-
function
|
|
224
|
+
function at(t) {
|
|
222
225
|
return t && t.replace(new RegExp(O, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
|
|
223
226
|
}
|
|
224
|
-
function
|
|
227
|
+
function ct(t) {
|
|
225
228
|
if (/Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
|
|
226
229
|
if (Array.from(t.childNodes).forEach((e) => {
|
|
227
230
|
e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
|
|
@@ -233,40 +236,40 @@ function rt(t) {
|
|
|
233
236
|
(t.textContent || "").trim().length === 0 && (t.textContent = "");
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
|
-
function
|
|
237
|
-
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" :
|
|
239
|
+
function ve(t) {
|
|
240
|
+
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" : Me(t, n));
|
|
238
241
|
return o.__blocked = e, o;
|
|
239
242
|
}
|
|
240
|
-
const
|
|
241
|
-
class
|
|
242
|
-
#
|
|
243
|
-
#
|
|
244
|
-
#
|
|
243
|
+
const dt = 100;
|
|
244
|
+
class ht {
|
|
245
|
+
#l;
|
|
246
|
+
#i;
|
|
247
|
+
#u;
|
|
245
248
|
#d;
|
|
249
|
+
#h;
|
|
250
|
+
#a = {};
|
|
251
|
+
#n = {};
|
|
252
|
+
#f = !0;
|
|
253
|
+
#g = [];
|
|
254
|
+
#b;
|
|
246
255
|
#s;
|
|
247
|
-
#
|
|
248
|
-
#h = {};
|
|
249
|
-
#u = !0;
|
|
250
|
-
#m = [];
|
|
251
|
-
#l;
|
|
252
|
-
#g;
|
|
253
|
-
#w;
|
|
256
|
+
#v;
|
|
254
257
|
#r;
|
|
255
|
-
#
|
|
258
|
+
#m;
|
|
256
259
|
constructor(e) {
|
|
257
260
|
this.#r = e;
|
|
258
261
|
}
|
|
259
262
|
get original() {
|
|
260
|
-
return this.#
|
|
263
|
+
return this.#a;
|
|
261
264
|
}
|
|
262
265
|
get effective() {
|
|
263
|
-
return this.#
|
|
266
|
+
return this.#n;
|
|
264
267
|
}
|
|
265
268
|
get columns() {
|
|
266
|
-
return this.#
|
|
269
|
+
return this.#n.columns ?? [];
|
|
267
270
|
}
|
|
268
271
|
set columns(e) {
|
|
269
|
-
this.#
|
|
272
|
+
this.#n.columns = e;
|
|
270
273
|
}
|
|
271
274
|
get lightDomColumnsCache() {
|
|
272
275
|
return this.#d;
|
|
@@ -275,55 +278,55 @@ class lt {
|
|
|
275
278
|
this.#d = e;
|
|
276
279
|
}
|
|
277
280
|
get originalColumnNodes() {
|
|
278
|
-
return this.#
|
|
281
|
+
return this.#h;
|
|
279
282
|
}
|
|
280
283
|
set originalColumnNodes(e) {
|
|
281
|
-
this.#
|
|
284
|
+
this.#h = e;
|
|
282
285
|
}
|
|
283
286
|
get lightDomTitle() {
|
|
284
|
-
return this.#
|
|
287
|
+
return this.#m;
|
|
285
288
|
}
|
|
286
289
|
set lightDomTitle(e) {
|
|
287
|
-
this.#
|
|
290
|
+
this.#m = e;
|
|
288
291
|
}
|
|
289
292
|
get initialColumnState() {
|
|
290
|
-
return this.#
|
|
293
|
+
return this.#v;
|
|
291
294
|
}
|
|
292
295
|
set initialColumnState(e) {
|
|
293
|
-
this.#
|
|
296
|
+
this.#v = e;
|
|
294
297
|
}
|
|
295
298
|
get sourcesChanged() {
|
|
296
|
-
return this.#
|
|
299
|
+
return this.#f;
|
|
297
300
|
}
|
|
298
301
|
markSourcesChanged() {
|
|
299
|
-
this.#
|
|
302
|
+
this.#f = !0;
|
|
300
303
|
}
|
|
301
304
|
setGridConfig(e) {
|
|
302
|
-
this.#
|
|
305
|
+
this.#l = e, this.#f = !0, this.#d = void 0;
|
|
303
306
|
}
|
|
304
307
|
getGridConfig() {
|
|
305
|
-
return this.#
|
|
308
|
+
return this.#l;
|
|
306
309
|
}
|
|
307
310
|
setColumns(e) {
|
|
308
|
-
this.#
|
|
311
|
+
this.#i = e, this.#f = !0;
|
|
309
312
|
}
|
|
310
313
|
getColumns() {
|
|
311
|
-
return this.#
|
|
314
|
+
return this.#i;
|
|
312
315
|
}
|
|
313
316
|
setFitMode(e) {
|
|
314
|
-
this.#
|
|
317
|
+
this.#u = e, this.#f = !0;
|
|
315
318
|
}
|
|
316
319
|
getFitMode() {
|
|
317
|
-
return this.#
|
|
320
|
+
return this.#u;
|
|
318
321
|
}
|
|
319
322
|
merge() {
|
|
320
|
-
const e = (this.#
|
|
321
|
-
if (!this.#
|
|
323
|
+
const e = (this.#n.columns?.length ?? 0) > 0;
|
|
324
|
+
if (!this.#f && e)
|
|
322
325
|
return;
|
|
323
|
-
const o = this.#
|
|
324
|
-
this.#
|
|
326
|
+
const o = this.#w();
|
|
327
|
+
this.#f = !1, this.#a = o, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#n = this.#S(this.#a), this.#A();
|
|
325
328
|
}
|
|
326
|
-
#
|
|
329
|
+
#S(e) {
|
|
327
330
|
const o = { ...e };
|
|
328
331
|
return e.columns && (o.columns = e.columns.map((n) => ({ ...n }))), e.shell && (o.shell = {
|
|
329
332
|
...e.shell,
|
|
@@ -333,35 +336,35 @@ class lt {
|
|
|
333
336
|
headerContents: e.shell.headerContents?.map((n) => ({ ...n }))
|
|
334
337
|
}), o;
|
|
335
338
|
}
|
|
336
|
-
#
|
|
337
|
-
const e = this.#
|
|
339
|
+
#A() {
|
|
340
|
+
const e = this.#n;
|
|
338
341
|
e.rowHeight && e.rowHeight > 0 && this.#r.setRowHeight(e.rowHeight), e.fitMode === "fixed" && this.columns.forEach((n) => {
|
|
339
342
|
n.width == null && (n.width = 80);
|
|
340
343
|
}), this.#r.applyAnimationConfig(e);
|
|
341
344
|
}
|
|
342
|
-
#
|
|
343
|
-
const e = this.#
|
|
345
|
+
#w() {
|
|
346
|
+
const e = this.#l ? { ...this.#l } : {}, o = Array.isArray(e.columns) ? [...e.columns] : [], n = (this.#d ?? []).map((s) => ({
|
|
344
347
|
...s
|
|
345
348
|
}));
|
|
346
|
-
let i =
|
|
349
|
+
let i = we(
|
|
347
350
|
o,
|
|
348
351
|
n
|
|
349
352
|
);
|
|
350
|
-
this.#
|
|
351
|
-
this.#
|
|
353
|
+
this.#i && this.#i.length && (i = we(
|
|
354
|
+
this.#i,
|
|
352
355
|
n
|
|
353
356
|
));
|
|
354
357
|
const r = this.#r.getRows();
|
|
355
|
-
return i.length === 0 && r.length && (i =
|
|
358
|
+
return i.length === 0 && r.length && (i = Je(r).columns), i.length && (i.forEach((s) => {
|
|
356
359
|
s.sortable === void 0 && (s.sortable = !0), s.resizable === void 0 && (s.resizable = !0), s.__originalWidth === void 0 && typeof s.width == "number" && (s.__originalWidth = s.width);
|
|
357
360
|
}), i.forEach((s) => {
|
|
358
|
-
s.__viewTemplate && !s.__compiledView && (s.__compiledView =
|
|
359
|
-
}), e.columns = i), this.#
|
|
361
|
+
s.__viewTemplate && !s.__compiledView && (s.__compiledView = ve(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = ve(s.__editorTemplate.innerHTML));
|
|
362
|
+
}), e.columns = i), this.#u && (e.fitMode = this.#u), e.fitMode || (e.fitMode = "stretch"), this.#C(e), e.columnState && !this.#v && (this.#v = e.columnState), e;
|
|
360
363
|
}
|
|
361
|
-
#
|
|
364
|
+
#C(e) {
|
|
362
365
|
e.shell = e.shell ? { ...e.shell } : {}, e.shell.header = e.shell.header ? { ...e.shell.header } : {};
|
|
363
366
|
const o = this.#r.getShellLightDomTitle();
|
|
364
|
-
o && (this.#
|
|
367
|
+
o && (this.#m = o), this.#m && !e.shell.header.title && (e.shell.header.title = this.#m);
|
|
365
368
|
const n = this.#r.getShellLightDomHeaderContent();
|
|
366
369
|
n?.length > 0 && (e.shell.header.lightDomContent = n), this.#r.getShellHasToolButtonsContainer() && (e.shell.header.hasToolButtonsContainer = !0);
|
|
367
370
|
const i = this.#r.getShellToolPanels();
|
|
@@ -374,13 +377,13 @@ class lt {
|
|
|
374
377
|
const u = Array.from(r.values());
|
|
375
378
|
u.sort((p, f) => (p.order ?? 100) - (f.order ?? 100)), e.shell.headerContents = u;
|
|
376
379
|
}
|
|
377
|
-
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), c = this.#
|
|
380
|
+
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), c = this.#l?.shell?.header?.toolbarContents ?? [], a = new Set(c.map((u) => u.id)), h = [...c];
|
|
378
381
|
for (const u of l)
|
|
379
382
|
a.has(u.id) || h.push(u);
|
|
380
383
|
h.sort((u, p) => (u.order ?? 0) - (p.order ?? 0)), e.shell.header.toolbarContents = h;
|
|
381
384
|
}
|
|
382
385
|
collectState(e) {
|
|
383
|
-
const o = this.columns, n = this.#
|
|
386
|
+
const o = this.columns, n = this.#y();
|
|
384
387
|
return {
|
|
385
388
|
columns: o.map((i, r) => {
|
|
386
389
|
const s = {
|
|
@@ -427,7 +430,7 @@ class lt {
|
|
|
427
430
|
l.applyColumnState(c.field, c);
|
|
428
431
|
}
|
|
429
432
|
resetState(e) {
|
|
430
|
-
this.#
|
|
433
|
+
this.#v = void 0, this.#r.setSortState(null), this.#n = this.#S(this.#a), this.#A();
|
|
431
434
|
for (const o of e)
|
|
432
435
|
if (o.applyColumnState)
|
|
433
436
|
for (const n of this.columns)
|
|
@@ -438,7 +441,7 @@ class lt {
|
|
|
438
441
|
});
|
|
439
442
|
this.requestStateChange(e);
|
|
440
443
|
}
|
|
441
|
-
#
|
|
444
|
+
#y() {
|
|
442
445
|
const e = /* @__PURE__ */ new Map(), o = this.#r.getSortState();
|
|
443
446
|
return o && e.set(o.field, {
|
|
444
447
|
direction: o.direction === 1 ? "asc" : "desc",
|
|
@@ -446,11 +449,11 @@ class lt {
|
|
|
446
449
|
}), e;
|
|
447
450
|
}
|
|
448
451
|
requestStateChange(e) {
|
|
449
|
-
this.#
|
|
450
|
-
this.#
|
|
452
|
+
this.#s && clearTimeout(this.#s), this.#s = setTimeout(() => {
|
|
453
|
+
this.#s = void 0;
|
|
451
454
|
const o = this.collectState(e);
|
|
452
455
|
this.#r.emit("column-state-change", o);
|
|
453
|
-
},
|
|
456
|
+
}, dt);
|
|
454
457
|
}
|
|
455
458
|
setColumnVisible(e, o) {
|
|
456
459
|
const n = this.columns, i = n.find((s) => s.field === e);
|
|
@@ -498,42 +501,42 @@ class lt {
|
|
|
498
501
|
this.columns = n, this.#r.renderHeader(), this.#r.updateTemplate(), this.#r.refreshVirtualWindow();
|
|
499
502
|
}
|
|
500
503
|
parseLightDomColumns(e) {
|
|
501
|
-
this.#d || (this.#
|
|
504
|
+
this.#d || (this.#h = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#h.length ? Ke(e) : []);
|
|
502
505
|
}
|
|
503
506
|
clearLightDomCache() {
|
|
504
507
|
this.#d = void 0;
|
|
505
508
|
}
|
|
506
|
-
#
|
|
509
|
+
#p = /* @__PURE__ */ new Map();
|
|
507
510
|
registerLightDomHandler(e, o) {
|
|
508
|
-
this.#
|
|
511
|
+
this.#p.set(e.toLowerCase(), o);
|
|
509
512
|
}
|
|
510
513
|
unregisterLightDomHandler(e) {
|
|
511
|
-
this.#
|
|
514
|
+
this.#p.delete(e.toLowerCase());
|
|
512
515
|
}
|
|
513
516
|
observeLightDOM(e) {
|
|
514
|
-
this.#
|
|
517
|
+
this.#b && this.#b.disconnect();
|
|
515
518
|
const o = /* @__PURE__ */ new Set();
|
|
516
519
|
let n = null;
|
|
517
520
|
const i = () => {
|
|
518
521
|
n = null;
|
|
519
522
|
for (const r of o)
|
|
520
|
-
this.#
|
|
523
|
+
this.#p.get(r)?.();
|
|
521
524
|
o.clear();
|
|
522
525
|
};
|
|
523
|
-
this.#
|
|
526
|
+
this.#b = new MutationObserver((r) => {
|
|
524
527
|
for (const s of r) {
|
|
525
528
|
for (const l of s.addedNodes) {
|
|
526
529
|
if (l.nodeType !== Node.ELEMENT_NODE) continue;
|
|
527
530
|
const a = l.tagName.toLowerCase();
|
|
528
|
-
this.#
|
|
531
|
+
this.#p.has(a) && o.add(a);
|
|
529
532
|
}
|
|
530
533
|
if (s.type === "attributes" && s.target.nodeType === Node.ELEMENT_NODE) {
|
|
531
534
|
const c = s.target.tagName.toLowerCase();
|
|
532
|
-
this.#
|
|
535
|
+
this.#p.has(c) && o.add(c);
|
|
533
536
|
}
|
|
534
537
|
}
|
|
535
538
|
o.size > 0 && !n && (n = setTimeout(i, 0));
|
|
536
|
-
}), this.#
|
|
539
|
+
}), this.#b.observe(e, {
|
|
537
540
|
childList: !0,
|
|
538
541
|
subtree: !0,
|
|
539
542
|
attributes: !0,
|
|
@@ -541,20 +544,20 @@ class lt {
|
|
|
541
544
|
});
|
|
542
545
|
}
|
|
543
546
|
onChange(e) {
|
|
544
|
-
this.#
|
|
547
|
+
this.#g.push(e);
|
|
545
548
|
}
|
|
546
549
|
notifyChange() {
|
|
547
|
-
for (const e of this.#
|
|
550
|
+
for (const e of this.#g)
|
|
548
551
|
e();
|
|
549
552
|
}
|
|
550
553
|
dispose() {
|
|
551
|
-
this.#
|
|
554
|
+
this.#b?.disconnect(), this.#g = [], this.#s && clearTimeout(this.#s);
|
|
552
555
|
}
|
|
553
556
|
}
|
|
554
|
-
function
|
|
557
|
+
function ze(t) {
|
|
555
558
|
return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "🗹" : "☐"}</span>`;
|
|
556
559
|
}
|
|
557
|
-
function
|
|
560
|
+
function Ne(t) {
|
|
558
561
|
if (t == null || t === "") return "";
|
|
559
562
|
if (t instanceof Date)
|
|
560
563
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
|
|
@@ -564,7 +567,7 @@ function Oe(t) {
|
|
|
564
567
|
}
|
|
565
568
|
return "";
|
|
566
569
|
}
|
|
567
|
-
function
|
|
570
|
+
function ke(t) {
|
|
568
571
|
if (!t) return -1;
|
|
569
572
|
const e = t.getAttribute("data-row");
|
|
570
573
|
if (e) return parseInt(e, 10);
|
|
@@ -577,15 +580,15 @@ function De(t) {
|
|
|
577
580
|
if (i[r] === o) return r;
|
|
578
581
|
return -1;
|
|
579
582
|
}
|
|
580
|
-
function
|
|
583
|
+
function ut(t) {
|
|
581
584
|
if (!t) return -1;
|
|
582
585
|
const e = t.getAttribute("data-col");
|
|
583
586
|
return e ? parseInt(e, 10) : -1;
|
|
584
587
|
}
|
|
585
|
-
function
|
|
588
|
+
function he(t) {
|
|
586
589
|
t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
|
|
587
590
|
}
|
|
588
|
-
function
|
|
591
|
+
function Ie(t, e) {
|
|
589
592
|
const o = e.renderer || e.viewRenderer;
|
|
590
593
|
if (o) return o;
|
|
591
594
|
if (!e.type) return;
|
|
@@ -599,31 +602,31 @@ function Me(t, e) {
|
|
|
599
602
|
return r.renderer;
|
|
600
603
|
}
|
|
601
604
|
}
|
|
602
|
-
const
|
|
603
|
-
function
|
|
605
|
+
const qe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
|
|
606
|
+
function ne(t) {
|
|
604
607
|
return (t.__editingCellCount ?? 0) > 0;
|
|
605
608
|
}
|
|
606
|
-
function
|
|
609
|
+
function ie(t) {
|
|
607
610
|
t.__editingCellCount = 0, t.removeAttribute("data-has-editing"), t.querySelectorAll(".cell.editing").forEach((o) => o.classList.remove("editing"));
|
|
608
611
|
}
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
function
|
|
614
|
-
return
|
|
612
|
+
const We = document.createElement("template");
|
|
613
|
+
We.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
|
|
614
|
+
const $e = document.createElement("template");
|
|
615
|
+
$e.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
|
|
616
|
+
function ft() {
|
|
617
|
+
return We.content.firstElementChild.cloneNode(!0);
|
|
615
618
|
}
|
|
616
|
-
function
|
|
617
|
-
return
|
|
619
|
+
function pt() {
|
|
620
|
+
return $e.content.firstElementChild.cloneNode(!0);
|
|
618
621
|
}
|
|
619
|
-
function
|
|
622
|
+
function Y(t) {
|
|
620
623
|
t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
|
|
621
624
|
}
|
|
622
|
-
function
|
|
625
|
+
function gt(t, e, o, n, i) {
|
|
623
626
|
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns, c = l.length;
|
|
624
627
|
let a = t.__cachedHeaderRowCount;
|
|
625
628
|
for (a === void 0 && (a = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = a); t._rowPool.length < r; ) {
|
|
626
|
-
const p =
|
|
629
|
+
const p = pt();
|
|
627
630
|
t._rowPool.push(p);
|
|
628
631
|
}
|
|
629
632
|
if (t._rowPool.length > r) {
|
|
@@ -650,14 +653,14 @@ function ht(t, e, o, n, i) {
|
|
|
650
653
|
}
|
|
651
654
|
}
|
|
652
655
|
if (!T || y) {
|
|
653
|
-
const S =
|
|
654
|
-
S && !P ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1),
|
|
656
|
+
const S = ne(d), P = t._activeEditRows === f;
|
|
657
|
+
S && !P ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), ie(d), B(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : S && P ? (re(t, d, g, f), d.__rowDataRef = g) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), B(t, d, g, f), d.__epoch = n, d.__rowDataRef = g);
|
|
655
658
|
} else if (b) {
|
|
656
|
-
const S =
|
|
657
|
-
S && !P ? (
|
|
659
|
+
const S = ne(d), P = t._activeEditRows === f;
|
|
660
|
+
S && !P ? (ie(d), B(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : (re(t, d, g, f), d.__rowDataRef = g);
|
|
658
661
|
} else {
|
|
659
|
-
const S =
|
|
660
|
-
S && !P ? (
|
|
662
|
+
const S = ne(d), P = t._activeEditRows === f;
|
|
663
|
+
S && !P ? (ie(d), B(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : re(t, d, g, f);
|
|
661
664
|
}
|
|
662
665
|
let E = !1;
|
|
663
666
|
const C = t.changedRowIds;
|
|
@@ -676,8 +679,8 @@ function ht(t, e, o, n, i) {
|
|
|
676
679
|
try {
|
|
677
680
|
const P = N(g);
|
|
678
681
|
if (P && P.length > 0) {
|
|
679
|
-
const
|
|
680
|
-
|
|
682
|
+
const oe = P.filter((X) => X && typeof X == "string");
|
|
683
|
+
oe.forEach((X) => d.classList.add(X)), d.setAttribute("data-dynamic-classes", oe.join(" "));
|
|
681
684
|
} else
|
|
682
685
|
d.removeAttribute("data-dynamic-classes");
|
|
683
686
|
} catch (P) {
|
|
@@ -691,7 +694,7 @@ function ht(t, e, o, n, i) {
|
|
|
691
694
|
}), d.parentNode !== s && s.appendChild(d);
|
|
692
695
|
}
|
|
693
696
|
}
|
|
694
|
-
function
|
|
697
|
+
function re(t, e, o, n) {
|
|
695
698
|
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length, c = s < l ? s : l, a = t._focusRow, h = t._focusCol, u = t._hasAfterCellRenderHook?.() ?? !1;
|
|
696
699
|
let p = t.__hasSpecialColumns;
|
|
697
700
|
if (p === void 0) {
|
|
@@ -728,7 +731,7 @@ function oe(t, e, o, n) {
|
|
|
728
731
|
}
|
|
729
732
|
for (let g = 0; g < c; g++)
|
|
730
733
|
if (r[g].externalView && !i[g].querySelector("[data-external-view]")) {
|
|
731
|
-
|
|
734
|
+
B(t, e, o, n);
|
|
732
735
|
return;
|
|
733
736
|
}
|
|
734
737
|
for (let g = 0; g < c; g++) {
|
|
@@ -752,7 +755,7 @@ function oe(t, e, o, n) {
|
|
|
752
755
|
}
|
|
753
756
|
}
|
|
754
757
|
if (w.classList.contains("editing")) continue;
|
|
755
|
-
const T =
|
|
758
|
+
const T = Ie(t, d);
|
|
756
759
|
if (T) {
|
|
757
760
|
const E = o[d.field], C = T({
|
|
758
761
|
row: o,
|
|
@@ -761,7 +764,7 @@ function oe(t, e, o, n) {
|
|
|
761
764
|
column: d,
|
|
762
765
|
cellEl: w
|
|
763
766
|
});
|
|
764
|
-
typeof C == "string" ? w.innerHTML =
|
|
767
|
+
typeof C == "string" ? w.innerHTML = F(C) : C instanceof Node ? C.parentElement !== w && (w.innerHTML = "", w.appendChild(C)) : C == null && (w.textContent = E == null ? "" : String(E)), u && t._afterCellRender?.({
|
|
765
768
|
row: o,
|
|
766
769
|
rowIndex: n,
|
|
767
770
|
column: d,
|
|
@@ -783,7 +786,7 @@ function oe(t, e, o, n) {
|
|
|
783
786
|
} catch (E) {
|
|
784
787
|
console.warn(`[tbw-grid] Format error in column '${d.field}':`, E), y = b == null ? "" : String(b);
|
|
785
788
|
}
|
|
786
|
-
else d.type === "date" ? (y =
|
|
789
|
+
else d.type === "date" ? (y = Ne(b), w.textContent = y) : d.type === "boolean" ? w.innerHTML = ze(!!b) : (y = b == null ? "" : String(b), w.textContent = y);
|
|
787
790
|
u && t._afterCellRender?.({
|
|
788
791
|
row: o,
|
|
789
792
|
rowIndex: n,
|
|
@@ -795,11 +798,11 @@ function oe(t, e, o, n) {
|
|
|
795
798
|
});
|
|
796
799
|
}
|
|
797
800
|
}
|
|
798
|
-
function
|
|
801
|
+
function B(t, e, o, n) {
|
|
799
802
|
e.innerHTML = "";
|
|
800
803
|
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol, c = t, a = t._hasAfterCellRenderHook?.() ?? !1, h = document.createDocumentFragment();
|
|
801
804
|
for (let u = 0; u < r; u++) {
|
|
802
|
-
const p = i[u], f =
|
|
805
|
+
const p = i[u], f = ft();
|
|
803
806
|
f.setAttribute("aria-colindex", String(u + 1)), f.setAttribute("data-col", String(u)), f.setAttribute("data-row", String(n)), f.setAttribute("data-field", p.field), f.setAttribute("data-header", p.header ?? p.field), p.type && f.setAttribute("data-type", p.type);
|
|
804
807
|
let g = o[p.field];
|
|
805
808
|
if (p.format)
|
|
@@ -808,11 +811,11 @@ function V(t, e, o, n) {
|
|
|
808
811
|
} catch (b) {
|
|
809
812
|
console.warn(`[tbw-grid] Format error in column '${p.field}':`, b);
|
|
810
813
|
}
|
|
811
|
-
const d = p.__compiledView, w = p.__viewTemplate, m =
|
|
814
|
+
const d = p.__compiledView, w = p.__viewTemplate, m = Ie(t, p), R = p.externalView;
|
|
812
815
|
let v = !1;
|
|
813
816
|
if (m) {
|
|
814
817
|
const b = m({ row: o, value: g, field: p.field, column: p, cellEl: f });
|
|
815
|
-
typeof b == "string" ? (f.innerHTML =
|
|
818
|
+
typeof b == "string" ? (f.innerHTML = F(b), v = !0) : b instanceof Node ? b.parentElement !== f && (f.textContent = "", f.appendChild(b)) : b == null && (f.textContent = g == null ? "" : String(g));
|
|
816
819
|
} else if (R) {
|
|
817
820
|
const b = R, y = document.createElement("div");
|
|
818
821
|
y.setAttribute("data-external-view", ""), y.setAttribute("data-field", p.field), f.appendChild(y);
|
|
@@ -840,14 +843,14 @@ function V(t, e, o, n) {
|
|
|
840
843
|
y.setAttribute("data-mounted", "");
|
|
841
844
|
} else if (d) {
|
|
842
845
|
const b = d({ row: o, value: g, field: p.field, column: p }), y = d.__blocked;
|
|
843
|
-
f.innerHTML = y ? "" :
|
|
846
|
+
f.innerHTML = y ? "" : F(b), v = !0, y && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
|
|
844
847
|
} else if (w) {
|
|
845
848
|
const b = w.innerHTML;
|
|
846
|
-
/Reflect\.|\bProxy\b|ownKeys\(/.test(b) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML =
|
|
849
|
+
/Reflect\.|\bProxy\b|ownKeys\(/.test(b) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = F(Me(b, { row: o, value: g })), v = !0);
|
|
847
850
|
} else
|
|
848
|
-
p.type === "date" ? f.textContent =
|
|
851
|
+
p.type === "date" ? f.textContent = Ne(g) : p.type === "boolean" ? f.innerHTML = ze(!!g) : f.textContent = g == null ? "" : String(g);
|
|
849
852
|
if (v) {
|
|
850
|
-
|
|
853
|
+
ct(f);
|
|
851
854
|
const b = f.textContent || "";
|
|
852
855
|
/Proxy|Reflect\.ownKeys/.test(b) && (f.textContent = b.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
|
|
853
856
|
}
|
|
@@ -875,9 +878,9 @@ function V(t, e, o, n) {
|
|
|
875
878
|
}
|
|
876
879
|
e.appendChild(h);
|
|
877
880
|
}
|
|
878
|
-
function
|
|
881
|
+
function Ce(t, e, o) {
|
|
879
882
|
if (e.target?.closest(".resize-handle")) return;
|
|
880
|
-
const n = o.querySelector(".cell[data-row]"), i =
|
|
883
|
+
const n = o.querySelector(".cell[data-row]"), i = ke(n);
|
|
881
884
|
if (i < 0) return;
|
|
882
885
|
const r = t._rows[i];
|
|
883
886
|
if (!r || t._dispatchRowClick?.(e, i, r, o))
|
|
@@ -890,8 +893,8 @@ function me(t, e, o) {
|
|
|
890
893
|
return;
|
|
891
894
|
const c = t._focusRow !== i || t._focusCol !== l;
|
|
892
895
|
if (t._focusRow = i, t._focusCol = l, s.classList.contains("editing")) {
|
|
893
|
-
c && (
|
|
894
|
-
const a = s.querySelector(
|
|
896
|
+
c && (he(t._bodyEl ?? t), s.classList.add("cell-focus"));
|
|
897
|
+
const a = s.querySelector(qe);
|
|
895
898
|
try {
|
|
896
899
|
a?.focus({ preventScroll: !0 });
|
|
897
900
|
} catch {
|
|
@@ -902,7 +905,7 @@ function me(t, e, o) {
|
|
|
902
905
|
}
|
|
903
906
|
}
|
|
904
907
|
}
|
|
905
|
-
function
|
|
908
|
+
function wt(t, e) {
|
|
906
909
|
if (t._dispatchKeyDown?.(e))
|
|
907
910
|
return;
|
|
908
911
|
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) => {
|
|
@@ -982,7 +985,7 @@ function $(t, e) {
|
|
|
982
985
|
}
|
|
983
986
|
}
|
|
984
987
|
const o = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
985
|
-
o || t.refreshVirtualWindow(!1),
|
|
988
|
+
o || t.refreshVirtualWindow(!1), he(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
|
|
986
989
|
s.setAttribute("aria-selected", "false");
|
|
987
990
|
});
|
|
988
991
|
const n = t._focusRow, i = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
|
|
@@ -1005,7 +1008,7 @@ function $(t, e) {
|
|
|
1005
1008
|
}
|
|
1006
1009
|
}
|
|
1007
1010
|
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
|
|
1008
|
-
const a = l.querySelector(
|
|
1011
|
+
const a = l.querySelector(qe);
|
|
1009
1012
|
if (a && document.activeElement !== a)
|
|
1010
1013
|
try {
|
|
1011
1014
|
a.focus({ preventScroll: !0 });
|
|
@@ -1021,12 +1024,12 @@ function $(t, e) {
|
|
|
1021
1024
|
}
|
|
1022
1025
|
}
|
|
1023
1026
|
}
|
|
1024
|
-
const
|
|
1025
|
-
function
|
|
1026
|
-
const o =
|
|
1027
|
-
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n,
|
|
1027
|
+
const ee = /* @__PURE__ */ new WeakMap();
|
|
1028
|
+
function mt(t, e) {
|
|
1029
|
+
const o = ke(e), n = ut(e);
|
|
1030
|
+
o < 0 || n < 0 || (t._focusRow = o, t._focusCol = n, he(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
|
|
1028
1031
|
}
|
|
1029
|
-
function
|
|
1032
|
+
function ue(t, e, o, n) {
|
|
1030
1033
|
let i = null;
|
|
1031
1034
|
const r = o.composedPath?.();
|
|
1032
1035
|
if (r && r.length > 0 ? i = r[0] : i = o.target, i && !e.contains(i)) {
|
|
@@ -1050,119 +1053,149 @@ function ce(t, e, o, n) {
|
|
|
1050
1053
|
cell: a !== void 0 && h !== void 0 && a >= 0 && h >= 0 ? { row: a, col: h } : void 0
|
|
1051
1054
|
};
|
|
1052
1055
|
}
|
|
1053
|
-
function
|
|
1054
|
-
const n =
|
|
1055
|
-
(t._dispatchCellMouseDown?.(n) ?? !1) &&
|
|
1056
|
+
function bt(t, e, o) {
|
|
1057
|
+
const n = ue(t, e, o, "mousedown");
|
|
1058
|
+
(t._dispatchCellMouseDown?.(n) ?? !1) && ee.set(t, !0);
|
|
1056
1059
|
}
|
|
1057
|
-
function
|
|
1058
|
-
if (!
|
|
1059
|
-
const n =
|
|
1060
|
+
function vt(t, e, o) {
|
|
1061
|
+
if (!ee.get(t)) return;
|
|
1062
|
+
const n = ue(t, e, o, "mousemove");
|
|
1060
1063
|
t._dispatchCellMouseMove?.(n);
|
|
1061
1064
|
}
|
|
1062
|
-
function
|
|
1063
|
-
if (!
|
|
1064
|
-
const n =
|
|
1065
|
-
t._dispatchCellMouseUp?.(n),
|
|
1065
|
+
function Ct(t, e, o) {
|
|
1066
|
+
if (!ee.get(t)) return;
|
|
1067
|
+
const n = ue(t, e, o, "mouseup");
|
|
1068
|
+
t._dispatchCellMouseUp?.(n), ee.set(t, !1);
|
|
1066
1069
|
}
|
|
1067
|
-
function
|
|
1070
|
+
function yt(t, e, o) {
|
|
1068
1071
|
e.addEventListener(
|
|
1069
1072
|
"mousedown",
|
|
1070
1073
|
(n) => {
|
|
1071
1074
|
const i = n.target.closest(".cell[data-col]");
|
|
1072
|
-
i && (i.classList.contains("editing") ||
|
|
1075
|
+
i && (i.classList.contains("editing") || mt(t, i));
|
|
1073
1076
|
},
|
|
1074
1077
|
{ signal: o }
|
|
1075
1078
|
), e.addEventListener(
|
|
1076
1079
|
"click",
|
|
1077
1080
|
(n) => {
|
|
1078
1081
|
const i = n.target.closest(".data-grid-row");
|
|
1079
|
-
i &&
|
|
1082
|
+
i && Ce(t, n, i);
|
|
1080
1083
|
},
|
|
1081
1084
|
{ signal: o }
|
|
1082
1085
|
), e.addEventListener(
|
|
1083
1086
|
"dblclick",
|
|
1084
1087
|
(n) => {
|
|
1085
1088
|
const i = n.target.closest(".data-grid-row");
|
|
1086
|
-
i &&
|
|
1089
|
+
i && Ce(t, n, i);
|
|
1087
1090
|
},
|
|
1088
1091
|
{ signal: o }
|
|
1089
1092
|
);
|
|
1090
1093
|
}
|
|
1091
|
-
function
|
|
1092
|
-
e.addEventListener("keydown", (i) =>
|
|
1094
|
+
function _t(t, e, o, n) {
|
|
1095
|
+
e.addEventListener("keydown", (i) => wt(t, i), { signal: n }), o.addEventListener("mousedown", (i) => bt(t, o, i), { signal: n }), document.addEventListener("mousemove", (i) => vt(t, o, i), { signal: n }), document.addEventListener("mouseup", (i) => Ct(t, o, i), { signal: n });
|
|
1093
1096
|
}
|
|
1094
|
-
function
|
|
1097
|
+
function Et(t, e) {
|
|
1095
1098
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1096
1099
|
}
|
|
1097
|
-
function
|
|
1098
|
-
const i = o.find((l) => l.field === e.field)?.sortComparator ??
|
|
1100
|
+
function St(t, e, o) {
|
|
1101
|
+
const i = o.find((l) => l.field === e.field)?.sortComparator ?? Et, { field: r, direction: s } = e;
|
|
1099
1102
|
return [...t].sort((l, c) => i(l[r], c[r], l, c) * s);
|
|
1100
1103
|
}
|
|
1101
|
-
function
|
|
1102
|
-
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1),
|
|
1104
|
+
function ye(t, e, o, n) {
|
|
1105
|
+
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1), te(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1103
1106
|
new CustomEvent("sort-change", { detail: { field: o.field, direction: n } })
|
|
1104
1107
|
), t.requestStateChange?.();
|
|
1105
1108
|
}
|
|
1106
|
-
function
|
|
1107
|
-
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()),
|
|
1109
|
+
function _e(t, e) {
|
|
1110
|
+
!t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), Ee(t, e, 1)) : t._sortState.direction === 1 ? Ee(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), t._rows = t.__originalOrder.slice(), te(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((n) => {
|
|
1108
1111
|
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");
|
|
1109
1112
|
}), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
1110
1113
|
new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
|
|
1111
1114
|
), t.requestStateChange?.());
|
|
1112
1115
|
}
|
|
1113
|
-
function
|
|
1116
|
+
function Ee(t, e, o) {
|
|
1114
1117
|
t._sortState = { field: e.field, direction: o };
|
|
1115
|
-
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ??
|
|
1118
|
+
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ?? St)(t._rows, n, i);
|
|
1116
1119
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1117
|
-
|
|
1118
|
-
}) :
|
|
1120
|
+
ye(t, l, e, o);
|
|
1121
|
+
}) : ye(t, s, e, o);
|
|
1119
1122
|
}
|
|
1120
|
-
function
|
|
1123
|
+
function Rt(t, e) {
|
|
1121
1124
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1122
1125
|
}
|
|
1123
|
-
function
|
|
1126
|
+
function j(t, e) {
|
|
1127
|
+
const o = document.createElement("span");
|
|
1128
|
+
De(o, "sort-indicator");
|
|
1129
|
+
const n = t._sortState?.field === e.field ? t._sortState.direction : 0, i = { ...z, ...t.icons }, r = n === 1 ? i.sortAsc : n === -1 ? i.sortDesc : i.sortNone;
|
|
1130
|
+
return Rt(o, r), o;
|
|
1131
|
+
}
|
|
1132
|
+
function K(t, e, o) {
|
|
1133
|
+
const n = document.createElement("div");
|
|
1134
|
+
return n.className = "resize-handle", n.setAttribute("aria-hidden", "true"), n.addEventListener("mousedown", (i) => {
|
|
1135
|
+
i.stopPropagation(), i.preventDefault(), t._resizeController.start(i, e, o);
|
|
1136
|
+
}), n.addEventListener("dblclick", (i) => {
|
|
1137
|
+
i.stopPropagation(), i.preventDefault(), t._resizeController.resetColumn(e);
|
|
1138
|
+
}), n;
|
|
1139
|
+
}
|
|
1140
|
+
function Z(t, e, o, n) {
|
|
1141
|
+
n.classList.add("sortable"), n.tabIndex = 0;
|
|
1142
|
+
const i = t._sortState?.field === e.field ? t._sortState.direction : 0;
|
|
1143
|
+
n.setAttribute("aria-sort", i === 0 ? "none" : i === 1 ? "ascending" : "descending"), n.addEventListener("click", (r) => {
|
|
1144
|
+
t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, o, n) || _e(t, e);
|
|
1145
|
+
}), n.addEventListener("keydown", (r) => {
|
|
1146
|
+
if (r.key === "Enter" || r.key === " ") {
|
|
1147
|
+
if (r.preventDefault(), t._dispatchHeaderClick?.(r, o, n)) return;
|
|
1148
|
+
_e(t, e);
|
|
1149
|
+
}
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function Tt(t, e) {
|
|
1153
|
+
if (e != null)
|
|
1154
|
+
if (typeof e == "string") {
|
|
1155
|
+
const o = document.createElement("span");
|
|
1156
|
+
for (o.innerHTML = F(e); o.firstChild; )
|
|
1157
|
+
t.appendChild(o.firstChild);
|
|
1158
|
+
} else e instanceof Node && t.appendChild(e);
|
|
1159
|
+
}
|
|
1160
|
+
function te(t) {
|
|
1124
1161
|
t._headerRowEl = t.findHeaderRow();
|
|
1125
1162
|
const e = t._headerRowEl;
|
|
1126
1163
|
e && (e.innerHTML = "", t._visibleColumns.forEach((o, n) => {
|
|
1127
1164
|
const i = document.createElement("div");
|
|
1128
|
-
i.className = "cell",
|
|
1129
|
-
const r = o.
|
|
1130
|
-
if (
|
|
1165
|
+
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));
|
|
1166
|
+
const r = o.header ?? o.field, s = t._sortState?.field === o.field ? t._sortState.direction : 0, l = s === 1 ? "asc" : s === -1 ? "desc" : null;
|
|
1167
|
+
if (o.headerRenderer) {
|
|
1168
|
+
const c = {
|
|
1169
|
+
column: o,
|
|
1170
|
+
value: r,
|
|
1171
|
+
sortState: l,
|
|
1172
|
+
filterActive: !1,
|
|
1173
|
+
cellEl: i,
|
|
1174
|
+
renderSortIcon: () => o.sortable ? j(t, o) : null,
|
|
1175
|
+
renderFilterButton: () => null,
|
|
1176
|
+
renderResizeHandle: () => K(t, n, i)
|
|
1177
|
+
}, a = o.headerRenderer(c);
|
|
1178
|
+
Tt(i, a), o.sortable && Z(t, o, n, i), o.resizable && i.classList.add("resizable");
|
|
1179
|
+
} else if (o.headerLabelRenderer) {
|
|
1180
|
+
const c = {
|
|
1181
|
+
column: o,
|
|
1182
|
+
value: r
|
|
1183
|
+
}, a = o.headerLabelRenderer(c), h = document.createElement("span");
|
|
1184
|
+
a == null ? h.textContent = r : typeof a == "string" ? h.innerHTML = F(a) : a instanceof Node && h.appendChild(a), i.appendChild(h), o.sortable && (Z(t, o, n, i), i.appendChild(j(t, o))), o.resizable && (i.classList.add("resizable"), i.appendChild(K(t, n, i)));
|
|
1185
|
+
} else if (o.__headerTemplate)
|
|
1186
|
+
Array.from(o.__headerTemplate.childNodes).forEach((c) => i.appendChild(c.cloneNode(!0))), o.sortable && (Z(t, o, n, i), i.appendChild(j(t, o))), o.resizable && (i.classList.add("resizable"), i.appendChild(K(t, n, i)));
|
|
1131
1187
|
else {
|
|
1132
|
-
const
|
|
1133
|
-
|
|
1134
|
-
}
|
|
1135
|
-
if (o.sortable) {
|
|
1136
|
-
i.classList.add("sortable"), i.tabIndex = 0;
|
|
1137
|
-
const s = document.createElement("span");
|
|
1138
|
-
fe(s, "sort-indicator");
|
|
1139
|
-
const l = t._sortState?.field === o.field ? t._sortState.direction : 0, c = { ...z, ...t.icons }, a = l === 1 ? c.sortAsc : l === -1 ? c.sortDesc : c.sortNone;
|
|
1140
|
-
yt(s, a), i.appendChild(s), i.setAttribute("aria-sort", l === 0 ? "none" : l === 1 ? "ascending" : "descending"), i.addEventListener("click", (h) => {
|
|
1141
|
-
t._resizeController?.isResizing || t._dispatchHeaderClick?.(h, n, i) || ve(t, o);
|
|
1142
|
-
}), i.addEventListener("keydown", (h) => {
|
|
1143
|
-
if (h.key === "Enter" || h.key === " ") {
|
|
1144
|
-
if (h.preventDefault(), t._dispatchHeaderClick?.(h, n, i)) return;
|
|
1145
|
-
ve(t, o);
|
|
1146
|
-
}
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
if (o.resizable) {
|
|
1150
|
-
i.classList.add("resizable");
|
|
1151
|
-
const s = document.createElement("div");
|
|
1152
|
-
s.className = "resize-handle", s.setAttribute("aria-hidden", "true"), s.addEventListener("mousedown", (l) => {
|
|
1153
|
-
l.stopPropagation(), l.preventDefault(), t._resizeController.start(l, n, i);
|
|
1154
|
-
}), s.addEventListener("dblclick", (l) => {
|
|
1155
|
-
l.stopPropagation(), l.preventDefault(), t._resizeController.resetColumn(n);
|
|
1156
|
-
}), i.appendChild(s);
|
|
1188
|
+
const c = document.createElement("span");
|
|
1189
|
+
c.textContent = r, i.appendChild(c), o.sortable && (Z(t, o, n, i), i.appendChild(j(t, o))), o.resizable && (i.classList.add("resizable"), i.appendChild(K(t, n, i)));
|
|
1157
1190
|
}
|
|
1158
1191
|
e.appendChild(i);
|
|
1159
1192
|
}), e.querySelectorAll(".cell.sortable").forEach((o) => {
|
|
1160
1193
|
o.getAttribute("aria-sort") || o.setAttribute("aria-sort", "none");
|
|
1161
1194
|
}), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
|
|
1162
1195
|
}
|
|
1163
|
-
const
|
|
1164
|
-
function
|
|
1165
|
-
return
|
|
1196
|
+
const Fe = typeof requestIdleCallback == "function";
|
|
1197
|
+
function xt(t, e) {
|
|
1198
|
+
return Fe ? requestIdleCallback(t, e) : window.setTimeout(() => {
|
|
1166
1199
|
const o = Date.now();
|
|
1167
1200
|
t({
|
|
1168
1201
|
didTimeout: !1,
|
|
@@ -1170,54 +1203,54 @@ function _t(t, e) {
|
|
|
1170
1203
|
});
|
|
1171
1204
|
}, 1);
|
|
1172
1205
|
}
|
|
1173
|
-
function
|
|
1174
|
-
|
|
1206
|
+
function Se(t) {
|
|
1207
|
+
Fe ? cancelIdleCallback(t) : clearTimeout(t);
|
|
1175
1208
|
}
|
|
1176
1209
|
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 || {});
|
|
1177
|
-
class
|
|
1178
|
-
#
|
|
1179
|
-
#
|
|
1180
|
-
#
|
|
1210
|
+
class At {
|
|
1211
|
+
#l;
|
|
1212
|
+
#i = 0;
|
|
1213
|
+
#u = 0;
|
|
1181
1214
|
#d = null;
|
|
1182
|
-
#
|
|
1183
|
-
#
|
|
1184
|
-
#
|
|
1215
|
+
#h = null;
|
|
1216
|
+
#a = null;
|
|
1217
|
+
#n = !1;
|
|
1185
1218
|
constructor(e) {
|
|
1186
|
-
this.#
|
|
1219
|
+
this.#l = e;
|
|
1187
1220
|
}
|
|
1188
1221
|
requestPhase(e, o) {
|
|
1189
|
-
e > this.#
|
|
1222
|
+
e > this.#i && (this.#i = e), this.#u === 0 && (this.#f(), this.#u = requestAnimationFrame(() => this.#g()));
|
|
1190
1223
|
}
|
|
1191
1224
|
whenReady() {
|
|
1192
1225
|
return this.#d ? this.#d : Promise.resolve();
|
|
1193
1226
|
}
|
|
1194
1227
|
setInitialReadyResolver(e) {
|
|
1195
|
-
this.#
|
|
1228
|
+
this.#a = e;
|
|
1196
1229
|
}
|
|
1197
1230
|
cancel() {
|
|
1198
|
-
this.#
|
|
1231
|
+
this.#u !== 0 && (cancelAnimationFrame(this.#u), this.#u = 0), this.#i = 0, this.#h && (this.#h(), this.#h = null, this.#d = null);
|
|
1199
1232
|
}
|
|
1200
1233
|
get isPending() {
|
|
1201
|
-
return this.#
|
|
1234
|
+
return this.#i !== 0;
|
|
1202
1235
|
}
|
|
1203
1236
|
get pendingPhase() {
|
|
1204
|
-
return this.#
|
|
1237
|
+
return this.#i;
|
|
1205
1238
|
}
|
|
1206
|
-
#
|
|
1239
|
+
#f() {
|
|
1207
1240
|
this.#d || (this.#d = new Promise((e) => {
|
|
1208
|
-
this.#
|
|
1241
|
+
this.#h = e;
|
|
1209
1242
|
}));
|
|
1210
1243
|
}
|
|
1211
|
-
#
|
|
1212
|
-
if (this.#
|
|
1213
|
-
this.#
|
|
1244
|
+
#g() {
|
|
1245
|
+
if (this.#u = 0, !this.#l.isConnected()) {
|
|
1246
|
+
this.#i = 0, this.#h && (this.#h(), this.#h = null, this.#d = null);
|
|
1214
1247
|
return;
|
|
1215
1248
|
}
|
|
1216
|
-
const e = this.#
|
|
1217
|
-
this.#
|
|
1249
|
+
const e = this.#i;
|
|
1250
|
+
this.#i = 0, e >= 5 && this.#l.mergeConfig(), e >= 4 && this.#l.processRows(), e >= 5 && (this.#l.processColumns(), this.#l.updateTemplate()), e >= 3 && this.#l.renderHeader(), e >= 2 && this.#l.renderVirtualWindow(), e >= 1 && this.#l.afterRender(), !this.#n && this.#a && (this.#n = !0, this.#a()), this.#h && (this.#h(), this.#h = null, this.#d = null);
|
|
1218
1251
|
}
|
|
1219
1252
|
}
|
|
1220
|
-
function
|
|
1253
|
+
function Re(t) {
|
|
1221
1254
|
let e = null, o = null, n = null, i = null;
|
|
1222
1255
|
const r = (c) => {
|
|
1223
1256
|
if (!e) return;
|
|
@@ -1255,55 +1288,55 @@ function _e(t) {
|
|
|
1255
1288
|
}
|
|
1256
1289
|
};
|
|
1257
1290
|
}
|
|
1258
|
-
const
|
|
1291
|
+
const se = "data-animating", Pt = {
|
|
1259
1292
|
change: "--tbw-row-change-duration",
|
|
1260
1293
|
insert: "--tbw-row-insert-duration",
|
|
1261
1294
|
remove: "--tbw-row-remove-duration"
|
|
1262
|
-
},
|
|
1295
|
+
}, Lt = {
|
|
1263
1296
|
change: 500,
|
|
1264
1297
|
insert: 300,
|
|
1265
1298
|
remove: 200
|
|
1266
1299
|
};
|
|
1267
|
-
function
|
|
1300
|
+
function Ht(t) {
|
|
1268
1301
|
const e = t.trim().toLowerCase();
|
|
1269
1302
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
1270
1303
|
}
|
|
1271
|
-
function
|
|
1272
|
-
const o =
|
|
1304
|
+
function Ot(t, e) {
|
|
1305
|
+
const o = Pt[e], n = getComputedStyle(t).getPropertyValue(o);
|
|
1273
1306
|
if (n) {
|
|
1274
|
-
const i =
|
|
1307
|
+
const i = Ht(n);
|
|
1275
1308
|
if (!isNaN(i) && i > 0)
|
|
1276
1309
|
return i;
|
|
1277
1310
|
}
|
|
1278
|
-
return
|
|
1311
|
+
return Lt[e];
|
|
1279
1312
|
}
|
|
1280
|
-
function
|
|
1281
|
-
t.removeAttribute(
|
|
1282
|
-
const n =
|
|
1313
|
+
function Dt(t, e, o) {
|
|
1314
|
+
t.removeAttribute(se), t.offsetWidth, t.setAttribute(se, e);
|
|
1315
|
+
const n = Ot(t, e);
|
|
1283
1316
|
setTimeout(() => {
|
|
1284
|
-
e !== "remove" && t.removeAttribute(
|
|
1317
|
+
e !== "remove" && t.removeAttribute(se);
|
|
1285
1318
|
}, n);
|
|
1286
1319
|
}
|
|
1287
|
-
function
|
|
1320
|
+
function fe(t, e, o) {
|
|
1288
1321
|
if (e < 0)
|
|
1289
1322
|
return !1;
|
|
1290
1323
|
const n = t.findRenderedRowElement?.(e);
|
|
1291
|
-
return n ? (
|
|
1324
|
+
return n ? (Dt(n, o), !0) : !1;
|
|
1292
1325
|
}
|
|
1293
|
-
function
|
|
1326
|
+
function Mt(t, e, o) {
|
|
1294
1327
|
let n = 0;
|
|
1295
1328
|
for (const i of e)
|
|
1296
|
-
|
|
1329
|
+
fe(t, i, o) && n++;
|
|
1297
1330
|
return n;
|
|
1298
1331
|
}
|
|
1299
|
-
function
|
|
1332
|
+
function zt(t, e, o) {
|
|
1300
1333
|
const n = t._rows ?? [], i = t.getRowId;
|
|
1301
1334
|
if (!i)
|
|
1302
1335
|
return !1;
|
|
1303
1336
|
const r = n.findIndex((s) => i(s) === e);
|
|
1304
|
-
return r < 0 ? !1 :
|
|
1337
|
+
return r < 0 ? !1 : fe(t, r, o);
|
|
1305
1338
|
}
|
|
1306
|
-
function
|
|
1339
|
+
function J(t, e, o) {
|
|
1307
1340
|
const n = document.createElement(t);
|
|
1308
1341
|
if (e)
|
|
1309
1342
|
for (const i in e) {
|
|
@@ -1312,7 +1345,7 @@ function Y(t, e, o) {
|
|
|
1312
1345
|
}
|
|
1313
1346
|
return n;
|
|
1314
1347
|
}
|
|
1315
|
-
function
|
|
1348
|
+
function H(t, e) {
|
|
1316
1349
|
const o = document.createElement("div");
|
|
1317
1350
|
if (t && (o.className = t), e)
|
|
1318
1351
|
for (const n in e) {
|
|
@@ -1321,7 +1354,7 @@ function L(t, e) {
|
|
|
1321
1354
|
}
|
|
1322
1355
|
return o;
|
|
1323
1356
|
}
|
|
1324
|
-
function
|
|
1357
|
+
function Ue(t, e, o) {
|
|
1325
1358
|
const n = document.createElement("button");
|
|
1326
1359
|
if (t && (n.className = t), e)
|
|
1327
1360
|
for (const i in e) {
|
|
@@ -1330,8 +1363,8 @@ function qe(t, e, o) {
|
|
|
1330
1363
|
}
|
|
1331
1364
|
return n;
|
|
1332
1365
|
}
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1366
|
+
const Ve = document.createElement("template");
|
|
1367
|
+
Ve.innerHTML = `
|
|
1335
1368
|
<div class="tbw-scroll-area">
|
|
1336
1369
|
<div class="rows-body-wrapper">
|
|
1337
1370
|
<div class="rows-body" role="grid">
|
|
@@ -1350,38 +1383,38 @@ We.innerHTML = `
|
|
|
1350
1383
|
<div class="faux-vscroll-spacer"></div>
|
|
1351
1384
|
</div>
|
|
1352
1385
|
`;
|
|
1353
|
-
function
|
|
1354
|
-
return
|
|
1386
|
+
function Be() {
|
|
1387
|
+
return Ve.content.cloneNode(!0);
|
|
1355
1388
|
}
|
|
1356
|
-
function
|
|
1357
|
-
const e = document.createDocumentFragment(), o =
|
|
1389
|
+
function Te(t) {
|
|
1390
|
+
const e = document.createDocumentFragment(), o = H(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1358
1391
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1359
1392
|
o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
|
|
1360
1393
|
else {
|
|
1361
|
-
const n =
|
|
1362
|
-
n.appendChild(
|
|
1394
|
+
const n = H("tbw-grid-content");
|
|
1395
|
+
n.appendChild(Be()), o.appendChild(n);
|
|
1363
1396
|
}
|
|
1364
1397
|
return e.appendChild(o), e;
|
|
1365
1398
|
}
|
|
1366
|
-
function
|
|
1367
|
-
const e =
|
|
1399
|
+
function Nt(t) {
|
|
1400
|
+
const e = H("tbw-shell-header", { part: "shell-header", role: "presentation" });
|
|
1368
1401
|
if (t.title) {
|
|
1369
|
-
const r =
|
|
1402
|
+
const r = H("tbw-shell-title");
|
|
1370
1403
|
r.textContent = t.title, e.appendChild(r);
|
|
1371
1404
|
}
|
|
1372
|
-
const o =
|
|
1405
|
+
const o = H("tbw-shell-content", {
|
|
1373
1406
|
part: "shell-content",
|
|
1374
1407
|
role: "presentation",
|
|
1375
1408
|
"data-light-dom-header-content": ""
|
|
1376
1409
|
});
|
|
1377
1410
|
e.appendChild(o);
|
|
1378
|
-
const n =
|
|
1411
|
+
const n = H("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
|
|
1379
1412
|
for (const r of t.configButtons)
|
|
1380
|
-
r.hasRender && n.appendChild(
|
|
1413
|
+
r.hasRender && n.appendChild(H("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1381
1414
|
for (const r of t.apiButtons)
|
|
1382
|
-
r.hasRender && n.appendChild(
|
|
1383
|
-
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && n.appendChild(
|
|
1384
|
-
const r =
|
|
1415
|
+
r.hasRender && n.appendChild(H("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
|
|
1416
|
+
if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && n.appendChild(H("tbw-toolbar-separator")), t.hasPanels) {
|
|
1417
|
+
const r = Ue(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
|
|
1385
1418
|
"data-panel-toggle": "",
|
|
1386
1419
|
title: "Settings",
|
|
1387
1420
|
"aria-label": "Toggle settings panel",
|
|
@@ -1392,12 +1425,12 @@ function Ht(t) {
|
|
|
1392
1425
|
}
|
|
1393
1426
|
return e.appendChild(n), e;
|
|
1394
1427
|
}
|
|
1395
|
-
function
|
|
1396
|
-
const e =
|
|
1397
|
-
i.appendChild(
|
|
1428
|
+
function kt(t) {
|
|
1429
|
+
const e = H("tbw-shell-body"), o = t.panels.length > 0, n = t.panels.length === 1, i = H("tbw-grid-content");
|
|
1430
|
+
i.appendChild(Be());
|
|
1398
1431
|
let r = null;
|
|
1399
1432
|
if (o) {
|
|
1400
|
-
r =
|
|
1433
|
+
r = J("aside", {
|
|
1401
1434
|
class: t.isPanelOpen ? "tbw-tool-panel open" : "tbw-tool-panel",
|
|
1402
1435
|
part: "tool-panel",
|
|
1403
1436
|
"data-position": t.position,
|
|
@@ -1406,29 +1439,29 @@ function Ot(t) {
|
|
|
1406
1439
|
});
|
|
1407
1440
|
const s = t.position === "left" ? "right" : "left";
|
|
1408
1441
|
r.appendChild(
|
|
1409
|
-
|
|
1442
|
+
H("tbw-tool-panel-resize", {
|
|
1410
1443
|
"data-resize-handle": "",
|
|
1411
1444
|
"data-handle-position": s,
|
|
1412
1445
|
"aria-hidden": "true"
|
|
1413
1446
|
})
|
|
1414
1447
|
);
|
|
1415
|
-
const l =
|
|
1448
|
+
const l = H("tbw-tool-panel-content", { role: "presentation" }), c = H("tbw-accordion");
|
|
1416
1449
|
for (const a of t.panels) {
|
|
1417
|
-
const h = `tbw-accordion-section${a.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, u =
|
|
1450
|
+
const h = `tbw-accordion-section${a.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, u = H(h, { "data-section": a.id }), p = Ue("tbw-accordion-header", {
|
|
1418
1451
|
"aria-expanded": String(a.isExpanded),
|
|
1419
1452
|
"aria-controls": `tbw-section-${a.id}`
|
|
1420
1453
|
});
|
|
1421
1454
|
if (n && p.setAttribute("aria-disabled", "true"), a.icon) {
|
|
1422
|
-
const g =
|
|
1455
|
+
const g = J("span", { class: "tbw-accordion-icon" });
|
|
1423
1456
|
g.innerHTML = a.icon, p.appendChild(g);
|
|
1424
1457
|
}
|
|
1425
|
-
const f =
|
|
1458
|
+
const f = J("span", { class: "tbw-accordion-title" });
|
|
1426
1459
|
if (f.textContent = a.title, p.appendChild(f), !n) {
|
|
1427
|
-
const g =
|
|
1460
|
+
const g = J("span", { class: "tbw-accordion-chevron" });
|
|
1428
1461
|
g.innerHTML = a.isExpanded ? t.collapseIcon : t.expandIcon, p.appendChild(g);
|
|
1429
1462
|
}
|
|
1430
1463
|
u.appendChild(p), u.appendChild(
|
|
1431
|
-
|
|
1464
|
+
H("tbw-accordion-content", {
|
|
1432
1465
|
id: `tbw-section-${a.id}`,
|
|
1433
1466
|
role: "presentation"
|
|
1434
1467
|
})
|
|
@@ -1441,7 +1474,7 @@ function Ot(t) {
|
|
|
1441
1474
|
function k(t) {
|
|
1442
1475
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1443
1476
|
}
|
|
1444
|
-
function
|
|
1477
|
+
function It() {
|
|
1445
1478
|
return {
|
|
1446
1479
|
toolPanels: /* @__PURE__ */ new Map(),
|
|
1447
1480
|
headerContents: /* @__PURE__ */ new Map(),
|
|
@@ -1460,10 +1493,10 @@ function Dt() {
|
|
|
1460
1493
|
lightDomContentMoved: !1
|
|
1461
1494
|
};
|
|
1462
1495
|
}
|
|
1463
|
-
function
|
|
1496
|
+
function Ge(t) {
|
|
1464
1497
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1465
1498
|
}
|
|
1466
|
-
function
|
|
1499
|
+
function xe(t, e, o = "☰") {
|
|
1467
1500
|
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = k(o), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], c = new Set(s.map((d) => d.id)), a = [...s];
|
|
1468
1501
|
for (const d of l)
|
|
1469
1502
|
c.has(d.id) || a.push(d);
|
|
@@ -1477,7 +1510,7 @@ function Se(t, e, o = "☰") {
|
|
|
1477
1510
|
}
|
|
1478
1511
|
return `
|
|
1479
1512
|
<div class="tbw-shell-header" part="shell-header" role="presentation">
|
|
1480
|
-
${i ? `<div class="tbw-shell-title">${
|
|
1513
|
+
${i ? `<div class="tbw-shell-title">${ot(n)}</div>` : ""}
|
|
1481
1514
|
<div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
|
|
1482
1515
|
<div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
|
|
1483
1516
|
${g}
|
|
@@ -1552,7 +1585,7 @@ function W(t, e, o) {
|
|
|
1552
1585
|
e.toolPanels.set(s, g), e.lightDomToolPanelIds.add(s), r.style.display = "none";
|
|
1553
1586
|
});
|
|
1554
1587
|
}
|
|
1555
|
-
function
|
|
1588
|
+
function qt(t, e, o, n) {
|
|
1556
1589
|
const i = t.querySelector(".tbw-shell-toolbar");
|
|
1557
1590
|
i && i.addEventListener("click", (s) => {
|
|
1558
1591
|
if (s.target.closest("[data-panel-toggle]")) {
|
|
@@ -1569,7 +1602,7 @@ function Mt(t, e, o, n) {
|
|
|
1569
1602
|
}
|
|
1570
1603
|
});
|
|
1571
1604
|
}
|
|
1572
|
-
function
|
|
1605
|
+
function Wt(t, e, o) {
|
|
1573
1606
|
const n = t.querySelector(".tbw-tool-panel"), i = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
|
|
1574
1607
|
if (!n || !i || !r)
|
|
1575
1608
|
return () => {
|
|
@@ -1593,7 +1626,7 @@ function zt(t, e, o) {
|
|
|
1593
1626
|
i.removeEventListener("mousedown", g), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
1594
1627
|
};
|
|
1595
1628
|
}
|
|
1596
|
-
function
|
|
1629
|
+
function Ae(t, e, o) {
|
|
1597
1630
|
const n = e?.header?.toolbarContents ?? [], i = [...o.toolbarContents.values()], r = new Set(n.map((l) => l.id)), s = [...n];
|
|
1598
1631
|
for (const l of i)
|
|
1599
1632
|
r.has(l.id) || s.push(l);
|
|
@@ -1605,7 +1638,7 @@ function Re(t, e, o) {
|
|
|
1605
1638
|
a && o.toolbarContentCleanups.set(l.id, a);
|
|
1606
1639
|
}
|
|
1607
1640
|
}
|
|
1608
|
-
function
|
|
1641
|
+
function ce(t, e) {
|
|
1609
1642
|
const o = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, n = e.headerContents.size > 0;
|
|
1610
1643
|
if (!o && !n) return;
|
|
1611
1644
|
const i = t.querySelector(".tbw-shell-content");
|
|
@@ -1625,7 +1658,7 @@ function se(t, e) {
|
|
|
1625
1658
|
a && e.headerContentCleanups.set(s.id, a);
|
|
1626
1659
|
}
|
|
1627
1660
|
}
|
|
1628
|
-
function
|
|
1661
|
+
function $t(t, e, o) {
|
|
1629
1662
|
if (!e.isPanelOpen) return;
|
|
1630
1663
|
const n = k(o?.expand ?? z.expand), i = k(o?.collapse ?? z.collapse);
|
|
1631
1664
|
for (const [r, s] of e.toolPanels) {
|
|
@@ -1646,15 +1679,15 @@ function Nt(t, e, o) {
|
|
|
1646
1679
|
}
|
|
1647
1680
|
}
|
|
1648
1681
|
}
|
|
1649
|
-
function
|
|
1682
|
+
function Pe(t, e) {
|
|
1650
1683
|
const o = t.querySelector("[data-panel-toggle]");
|
|
1651
1684
|
o && (o.classList.toggle("active", e.isPanelOpen), o.setAttribute("aria-pressed", String(e.isPanelOpen)));
|
|
1652
1685
|
}
|
|
1653
|
-
function
|
|
1686
|
+
function Le(t, e) {
|
|
1654
1687
|
const o = t.querySelector(".tbw-tool-panel");
|
|
1655
1688
|
o && (o.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (o.style.width = ""));
|
|
1656
1689
|
}
|
|
1657
|
-
function
|
|
1690
|
+
function Ft(t) {
|
|
1658
1691
|
for (const e of t.headerContentCleanups.values())
|
|
1659
1692
|
e();
|
|
1660
1693
|
t.headerContentCleanups.clear();
|
|
@@ -1671,7 +1704,7 @@ function kt(t) {
|
|
|
1671
1704
|
t.toolPanels.get(e)?.onClose?.();
|
|
1672
1705
|
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;
|
|
1673
1706
|
}
|
|
1674
|
-
function
|
|
1707
|
+
function Ut(t, e) {
|
|
1675
1708
|
let o = !1;
|
|
1676
1709
|
const n = {
|
|
1677
1710
|
get isInitialized() {
|
|
@@ -1700,7 +1733,7 @@ function It(t, e) {
|
|
|
1700
1733
|
s && t.expandedSections.add(s.id);
|
|
1701
1734
|
}
|
|
1702
1735
|
const i = e.getShadow();
|
|
1703
|
-
|
|
1736
|
+
Pe(i, t), Le(i, t), $t(i, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: n.expandedSections });
|
|
1704
1737
|
},
|
|
1705
1738
|
closeToolPanel() {
|
|
1706
1739
|
if (!t.isPanelOpen) return;
|
|
@@ -1711,7 +1744,7 @@ function It(t, e) {
|
|
|
1711
1744
|
r.onClose?.();
|
|
1712
1745
|
t.isPanelOpen = !1;
|
|
1713
1746
|
const i = e.getShadow();
|
|
1714
|
-
|
|
1747
|
+
Pe(i, t), Le(i, t), e.emit("tool-panel-close", {});
|
|
1715
1748
|
},
|
|
1716
1749
|
toggleToolPanel() {
|
|
1717
1750
|
t.isPanelOpen ? n.closeToolPanel() : n.openToolPanel();
|
|
@@ -1727,16 +1760,16 @@ function It(t, e) {
|
|
|
1727
1760
|
const s = e.getShadow(), l = t.expandedSections.has(i);
|
|
1728
1761
|
if (l) {
|
|
1729
1762
|
const c = t.panelCleanups.get(i);
|
|
1730
|
-
c && (c(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i),
|
|
1763
|
+
c && (c(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), le(s, i, !1);
|
|
1731
1764
|
} else {
|
|
1732
1765
|
for (const [c, a] of t.toolPanels)
|
|
1733
1766
|
if (c !== i && t.expandedSections.has(c)) {
|
|
1734
1767
|
const h = t.panelCleanups.get(c);
|
|
1735
|
-
h && (h(), t.panelCleanups.delete(c)), a.onClose?.(), t.expandedSections.delete(c),
|
|
1768
|
+
h && (h(), t.panelCleanups.delete(c)), a.onClose?.(), t.expandedSections.delete(c), le(s, c, !1);
|
|
1736
1769
|
const u = s.querySelector(`[data-section="${c}"] .tbw-accordion-content`);
|
|
1737
1770
|
u && (u.innerHTML = "");
|
|
1738
1771
|
}
|
|
1739
|
-
t.expandedSections.add(i),
|
|
1772
|
+
t.expandedSections.add(i), le(s, i, !0), Vt(s, t, i);
|
|
1740
1773
|
}
|
|
1741
1774
|
e.emit("tool-panel-section-toggle", { id: i, expanded: !l });
|
|
1742
1775
|
},
|
|
@@ -1765,7 +1798,7 @@ function It(t, e) {
|
|
|
1765
1798
|
console.warn(`[tbw-grid] Header content "${i.id}" already registered`);
|
|
1766
1799
|
return;
|
|
1767
1800
|
}
|
|
1768
|
-
t.headerContents.set(i.id, i), o &&
|
|
1801
|
+
t.headerContents.set(i.id, i), o && ce(e.getShadow(), t);
|
|
1769
1802
|
},
|
|
1770
1803
|
unregisterHeaderContent(i) {
|
|
1771
1804
|
const r = t.headerContentCleanups.get(i);
|
|
@@ -1790,11 +1823,11 @@ function It(t, e) {
|
|
|
1790
1823
|
};
|
|
1791
1824
|
return n;
|
|
1792
1825
|
}
|
|
1793
|
-
function
|
|
1826
|
+
function le(t, e, o) {
|
|
1794
1827
|
const n = t.querySelector(`[data-section="${e}"]`);
|
|
1795
1828
|
n && n.classList.toggle("expanded", o);
|
|
1796
1829
|
}
|
|
1797
|
-
function
|
|
1830
|
+
function Vt(t, e, o) {
|
|
1798
1831
|
const n = e.toolPanels.get(o);
|
|
1799
1832
|
if (!n?.render) return;
|
|
1800
1833
|
const i = t.querySelector(`[data-section="${o}"] .tbw-accordion-content`);
|
|
@@ -1802,8 +1835,8 @@ function qt(t, e, o) {
|
|
|
1802
1835
|
const r = n.render(i);
|
|
1803
1836
|
r && e.panelCleanups.set(o, r);
|
|
1804
1837
|
}
|
|
1805
|
-
function
|
|
1806
|
-
const i =
|
|
1838
|
+
function Bt(t, e, o, n) {
|
|
1839
|
+
const i = Ge(e), r = [], s = [
|
|
1807
1840
|
"tbw-grid-header",
|
|
1808
1841
|
"tbw-grid-tool-buttons",
|
|
1809
1842
|
"tbw-grid-tool-panel",
|
|
@@ -1839,19 +1872,19 @@ function Wt(t, e, o, n) {
|
|
|
1839
1872
|
icon: k(v.icon),
|
|
1840
1873
|
isExpanded: o.expandedSections.has(v.id)
|
|
1841
1874
|
}))
|
|
1842
|
-
}, w =
|
|
1875
|
+
}, w = Nt(g), m = kt(d), R = Te({
|
|
1843
1876
|
hasShell: !0,
|
|
1844
1877
|
shellHeader: w,
|
|
1845
1878
|
shellBody: m
|
|
1846
1879
|
});
|
|
1847
1880
|
t.appendChild(R);
|
|
1848
1881
|
} else {
|
|
1849
|
-
const l =
|
|
1882
|
+
const l = Te({ hasShell: !1 });
|
|
1850
1883
|
t.appendChild(l);
|
|
1851
1884
|
}
|
|
1852
1885
|
return i;
|
|
1853
1886
|
}
|
|
1854
|
-
function
|
|
1887
|
+
function Gt() {
|
|
1855
1888
|
return {
|
|
1856
1889
|
startY: null,
|
|
1857
1890
|
startX: null,
|
|
@@ -1865,19 +1898,19 @@ function $t() {
|
|
|
1865
1898
|
momentumRaf: 0
|
|
1866
1899
|
};
|
|
1867
1900
|
}
|
|
1868
|
-
function
|
|
1901
|
+
function Xt(t) {
|
|
1869
1902
|
t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
|
|
1870
1903
|
}
|
|
1871
|
-
function
|
|
1904
|
+
function Xe(t) {
|
|
1872
1905
|
t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
|
|
1873
1906
|
}
|
|
1874
|
-
function
|
|
1907
|
+
function Yt(t, e, o) {
|
|
1875
1908
|
if (t.touches.length !== 1) return;
|
|
1876
|
-
|
|
1909
|
+
Xe(e);
|
|
1877
1910
|
const n = t.touches[0];
|
|
1878
1911
|
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;
|
|
1879
1912
|
}
|
|
1880
|
-
function
|
|
1913
|
+
function jt(t, e, o) {
|
|
1881
1914
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
1882
1915
|
return !1;
|
|
1883
1916
|
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i, c = e.startX - r;
|
|
@@ -1894,10 +1927,10 @@ function Vt(t, e, o) {
|
|
|
1894
1927
|
}
|
|
1895
1928
|
return f && (o.fauxScrollbar.scrollTop = e.scrollTop + l), g && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + c), f || g;
|
|
1896
1929
|
}
|
|
1897
|
-
function
|
|
1898
|
-
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) &&
|
|
1930
|
+
function Kt(t, e) {
|
|
1931
|
+
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Zt(t, e), Xt(t);
|
|
1899
1932
|
}
|
|
1900
|
-
function
|
|
1933
|
+
function Zt(t, e) {
|
|
1901
1934
|
const i = () => {
|
|
1902
1935
|
t.velocityY *= 0.95, t.velocityX *= 0.95;
|
|
1903
1936
|
const r = t.velocityY * 16, s = t.velocityX * 16;
|
|
@@ -1905,19 +1938,19 @@ function Gt(t, e) {
|
|
|
1905
1938
|
};
|
|
1906
1939
|
t.momentumRaf = requestAnimationFrame(i);
|
|
1907
1940
|
}
|
|
1908
|
-
function
|
|
1909
|
-
t.addEventListener("touchstart", (i) =>
|
|
1941
|
+
function Jt(t, e, o, n) {
|
|
1942
|
+
t.addEventListener("touchstart", (i) => Yt(i, e, o), {
|
|
1910
1943
|
passive: !0,
|
|
1911
1944
|
signal: n
|
|
1912
1945
|
}), t.addEventListener(
|
|
1913
1946
|
"touchmove",
|
|
1914
1947
|
(i) => {
|
|
1915
|
-
|
|
1948
|
+
jt(i, e, o) && i.preventDefault();
|
|
1916
1949
|
},
|
|
1917
1950
|
{ passive: !1, signal: n }
|
|
1918
|
-
), t.addEventListener("touchend", () =>
|
|
1951
|
+
), t.addEventListener("touchend", () => Kt(e, o), { passive: !0, signal: n });
|
|
1919
1952
|
}
|
|
1920
|
-
const
|
|
1953
|
+
const Qt = [
|
|
1921
1954
|
{
|
|
1922
1955
|
property: "editable",
|
|
1923
1956
|
pluginName: "editing",
|
|
@@ -1955,7 +1988,7 @@ const Yt = [
|
|
|
1955
1988
|
importHint: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
|
|
1956
1989
|
isUsed: (t) => t === "left" || t === "right"
|
|
1957
1990
|
}
|
|
1958
|
-
],
|
|
1991
|
+
], eo = [
|
|
1959
1992
|
{
|
|
1960
1993
|
property: "columnGroups",
|
|
1961
1994
|
pluginName: "groupingColumns",
|
|
@@ -1964,7 +1997,7 @@ const Yt = [
|
|
|
1964
1997
|
importHint: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';",
|
|
1965
1998
|
isUsed: (t) => Array.isArray(t) && t.length > 0
|
|
1966
1999
|
}
|
|
1967
|
-
],
|
|
2000
|
+
], to = {
|
|
1968
2001
|
editing: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
|
|
1969
2002
|
selection: "import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';",
|
|
1970
2003
|
reorder: "import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder';",
|
|
@@ -1985,10 +2018,10 @@ const Yt = [
|
|
|
1985
2018
|
serverSide: "import { ServerSidePlugin } from '@toolbox-web/grid/plugins/server-side';",
|
|
1986
2019
|
columnVirtualization: "import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';"
|
|
1987
2020
|
};
|
|
1988
|
-
function
|
|
1989
|
-
return
|
|
2021
|
+
function de(t) {
|
|
2022
|
+
return to[t] ?? `import { ${D(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
|
|
1990
2023
|
}
|
|
1991
|
-
function
|
|
2024
|
+
function Ye() {
|
|
1992
2025
|
if (typeof window < "u" && window.location) {
|
|
1993
2026
|
const t = window.location.hostname;
|
|
1994
2027
|
if (t === "localhost" || t === "127.0.0.1" || t === "::1")
|
|
@@ -1999,11 +2032,11 @@ function Ve() {
|
|
|
1999
2032
|
function D(t) {
|
|
2000
2033
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
2001
2034
|
}
|
|
2002
|
-
function
|
|
2035
|
+
function He(t, e) {
|
|
2003
2036
|
return t.some((o) => o.name === e);
|
|
2004
2037
|
}
|
|
2005
|
-
function
|
|
2006
|
-
const o =
|
|
2038
|
+
function oo(t, e) {
|
|
2039
|
+
const o = Qt, n = eo, i = /* @__PURE__ */ new Map();
|
|
2007
2040
|
function r(l, c, a, h, u = !1) {
|
|
2008
2041
|
i.has(l) || i.set(l, { description: c, importHint: a, fields: [], isConfigProperty: u });
|
|
2009
2042
|
const p = i.get(l);
|
|
@@ -2011,16 +2044,16 @@ function Zt(t, e) {
|
|
|
2011
2044
|
}
|
|
2012
2045
|
for (const l of n) {
|
|
2013
2046
|
const c = t[l.property];
|
|
2014
|
-
(l.isUsed ? l.isUsed(c) : c !== void 0) && !
|
|
2047
|
+
(l.isUsed ? l.isUsed(c) : c !== void 0) && !He(e, l.pluginName) && r(l.pluginName, l.description, l.importHint ?? de(l.pluginName), l.property, !0);
|
|
2015
2048
|
}
|
|
2016
2049
|
const s = t.columns;
|
|
2017
2050
|
if (s && s.length > 0)
|
|
2018
2051
|
for (const l of s)
|
|
2019
2052
|
for (const c of o) {
|
|
2020
2053
|
const a = l[c.property];
|
|
2021
|
-
if ((c.isUsed ? c.isUsed(a) : a !== void 0) && !
|
|
2054
|
+
if ((c.isUsed ? c.isUsed(a) : a !== void 0) && !He(e, c.pluginName)) {
|
|
2022
2055
|
const u = l.field || "<unknown>";
|
|
2023
|
-
r(c.pluginName, c.description, c.importHint ??
|
|
2056
|
+
r(c.pluginName, c.description, c.importHint ?? de(c.pluginName), u);
|
|
2024
2057
|
}
|
|
2025
2058
|
}
|
|
2026
2059
|
if (i.size > 0) {
|
|
@@ -2053,7 +2086,7 @@ This validation helps catch misconfigurations early. The properties listed above
|
|
|
2053
2086
|
);
|
|
2054
2087
|
}
|
|
2055
2088
|
}
|
|
2056
|
-
function
|
|
2089
|
+
function no(t) {
|
|
2057
2090
|
const e = [], o = [];
|
|
2058
2091
|
for (const n of t) {
|
|
2059
2092
|
const r = n.constructor.manifest;
|
|
@@ -2066,7 +2099,7 @@ function Jt(t) {
|
|
|
2066
2099
|
}
|
|
2067
2100
|
}
|
|
2068
2101
|
}
|
|
2069
|
-
if (o.length > 0 &&
|
|
2102
|
+
if (o.length > 0 && Ye())
|
|
2070
2103
|
for (const n of o)
|
|
2071
2104
|
console.warn(n);
|
|
2072
2105
|
if (e.length > 0)
|
|
@@ -2076,12 +2109,12 @@ ${e.join(`
|
|
|
2076
2109
|
|
|
2077
2110
|
`)}`);
|
|
2078
2111
|
}
|
|
2079
|
-
function
|
|
2112
|
+
function io(t, e) {
|
|
2080
2113
|
const o = t.name, i = t.constructor.dependencies ?? [];
|
|
2081
2114
|
for (const r of i) {
|
|
2082
2115
|
const s = r.name, l = r.required ?? !0, c = r.reason;
|
|
2083
2116
|
if (!e.some((h) => h.name === s)) {
|
|
2084
|
-
const h = c ?? `${D(o)}Plugin requires ${D(s)}Plugin`, u =
|
|
2117
|
+
const h = c ?? `${D(o)}Plugin requires ${D(s)}Plugin`, u = de(s);
|
|
2085
2118
|
if (l)
|
|
2086
2119
|
throw new Error(
|
|
2087
2120
|
`[tbw-grid] Plugin dependency error:
|
|
@@ -2098,8 +2131,8 @@ ${h}.
|
|
|
2098
2131
|
}
|
|
2099
2132
|
}
|
|
2100
2133
|
}
|
|
2101
|
-
function
|
|
2102
|
-
if (!
|
|
2134
|
+
function ro(t) {
|
|
2135
|
+
if (!Ye()) return;
|
|
2103
2136
|
const e = new Set(t.map((n) => n.name)), o = /* @__PURE__ */ new Set();
|
|
2104
2137
|
for (const n of t) {
|
|
2105
2138
|
const r = n.constructor.manifest;
|
|
@@ -2121,7 +2154,7 @@ ${D(n.name)}Plugin and ${D(s.name)}Plugin are both loaded, but they are currentl
|
|
|
2121
2154
|
}
|
|
2122
2155
|
}
|
|
2123
2156
|
}
|
|
2124
|
-
class
|
|
2157
|
+
class so {
|
|
2125
2158
|
constructor(e) {
|
|
2126
2159
|
this.grid = e;
|
|
2127
2160
|
}
|
|
@@ -2138,7 +2171,7 @@ class to {
|
|
|
2138
2171
|
this.attach(o);
|
|
2139
2172
|
}
|
|
2140
2173
|
attach(e) {
|
|
2141
|
-
if (
|
|
2174
|
+
if (io(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
|
|
2142
2175
|
for (const [o, n] of Object.entries(e.cellRenderers))
|
|
2143
2176
|
this.cellRenderers.set(o, n);
|
|
2144
2177
|
if (e.headerRenderers)
|
|
@@ -2336,9 +2369,10 @@ class to {
|
|
|
2336
2369
|
return e.sort((o, n) => (o.content.order ?? 0) - (n.content.order ?? 0));
|
|
2337
2370
|
}
|
|
2338
2371
|
}
|
|
2339
|
-
class
|
|
2372
|
+
class L extends HTMLElement {
|
|
2340
2373
|
static tagName = "tbw-grid";
|
|
2341
|
-
static version = "1.
|
|
2374
|
+
static version = "1.4.0";
|
|
2375
|
+
static #l = 0;
|
|
2342
2376
|
static adapters = [];
|
|
2343
2377
|
static registerAdapter(e) {
|
|
2344
2378
|
this.adapters.push(e);
|
|
@@ -2352,35 +2386,35 @@ class H extends HTMLElement {
|
|
|
2352
2386
|
static get observedAttributes() {
|
|
2353
2387
|
return ["rows", "columns", "grid-config", "fit-mode"];
|
|
2354
2388
|
}
|
|
2355
|
-
get #
|
|
2389
|
+
get #i() {
|
|
2356
2390
|
return this;
|
|
2357
2391
|
}
|
|
2358
|
-
#
|
|
2359
|
-
#f;
|
|
2392
|
+
#u = !1;
|
|
2360
2393
|
#d;
|
|
2361
|
-
#
|
|
2362
|
-
|
|
2394
|
+
#h;
|
|
2395
|
+
#a = [];
|
|
2396
|
+
get #n() {
|
|
2363
2397
|
return this.#t?.effective ?? {};
|
|
2364
2398
|
}
|
|
2365
|
-
#
|
|
2366
|
-
#
|
|
2367
|
-
#
|
|
2399
|
+
#f = !1;
|
|
2400
|
+
#g = !1;
|
|
2401
|
+
#b = {
|
|
2368
2402
|
rows: !1,
|
|
2369
2403
|
columns: !1,
|
|
2370
2404
|
gridConfig: !1,
|
|
2371
2405
|
fitMode: !1
|
|
2372
2406
|
};
|
|
2373
|
-
#
|
|
2374
|
-
#
|
|
2375
|
-
#
|
|
2376
|
-
#
|
|
2377
|
-
#
|
|
2378
|
-
#A =
|
|
2379
|
-
#
|
|
2407
|
+
#s;
|
|
2408
|
+
#v = 0;
|
|
2409
|
+
#r = null;
|
|
2410
|
+
#m = !1;
|
|
2411
|
+
#S;
|
|
2412
|
+
#A = Gt();
|
|
2413
|
+
#w;
|
|
2380
2414
|
#C;
|
|
2381
2415
|
#y;
|
|
2382
|
-
#
|
|
2383
|
-
#
|
|
2416
|
+
#p;
|
|
2417
|
+
#ae = {
|
|
2384
2418
|
scrollTop: 0,
|
|
2385
2419
|
scrollLeft: 0,
|
|
2386
2420
|
scrollHeight: 0,
|
|
@@ -2394,17 +2428,17 @@ class H extends HTMLElement {
|
|
|
2394
2428
|
#P;
|
|
2395
2429
|
#L;
|
|
2396
2430
|
#t;
|
|
2397
|
-
#e =
|
|
2398
|
-
#
|
|
2431
|
+
#e = It();
|
|
2432
|
+
#c;
|
|
2399
2433
|
#D;
|
|
2400
2434
|
#H = /* @__PURE__ */ new Map();
|
|
2401
2435
|
_rows = [];
|
|
2402
2436
|
#I = [];
|
|
2403
2437
|
get _columns() {
|
|
2404
|
-
return this.#
|
|
2438
|
+
return this.#n.columns ?? [];
|
|
2405
2439
|
}
|
|
2406
2440
|
set _columns(e) {
|
|
2407
|
-
this.#
|
|
2441
|
+
this.#n.columns = e;
|
|
2408
2442
|
}
|
|
2409
2443
|
get _visibleColumns() {
|
|
2410
2444
|
return this._columns.filter((e) => !e.hidden);
|
|
@@ -2449,11 +2483,11 @@ class H extends HTMLElement {
|
|
|
2449
2483
|
return this._rows;
|
|
2450
2484
|
}
|
|
2451
2485
|
set rows(e) {
|
|
2452
|
-
const o = this.#
|
|
2453
|
-
this.#
|
|
2486
|
+
const o = this.#a;
|
|
2487
|
+
this.#a = e, o !== e && this.#k("rows");
|
|
2454
2488
|
}
|
|
2455
2489
|
get sourceRows() {
|
|
2456
|
-
return this.#
|
|
2490
|
+
return this.#a;
|
|
2457
2491
|
}
|
|
2458
2492
|
get columns() {
|
|
2459
2493
|
return [...this._columns];
|
|
@@ -2463,70 +2497,70 @@ class H extends HTMLElement {
|
|
|
2463
2497
|
this.#t?.setColumns(e), o !== e && this.#k("columns");
|
|
2464
2498
|
}
|
|
2465
2499
|
get gridConfig() {
|
|
2466
|
-
return this.#
|
|
2500
|
+
return this.#n;
|
|
2467
2501
|
}
|
|
2468
2502
|
set gridConfig(e) {
|
|
2469
2503
|
const o = this.#t?.getGridConfig();
|
|
2470
2504
|
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this.#k("gridConfig"));
|
|
2471
2505
|
}
|
|
2472
2506
|
get fitMode() {
|
|
2473
|
-
return this.#
|
|
2507
|
+
return this.#n.fitMode ?? "stretch";
|
|
2474
2508
|
}
|
|
2475
2509
|
set fitMode(e) {
|
|
2476
2510
|
const o = this.#t?.getFitMode();
|
|
2477
2511
|
this.#t?.setFitMode(e), o !== e && this.#k("fitMode");
|
|
2478
2512
|
}
|
|
2479
2513
|
get effectiveConfig() {
|
|
2480
|
-
return this.#
|
|
2514
|
+
return this.#n;
|
|
2481
2515
|
}
|
|
2482
2516
|
get disconnectSignal() {
|
|
2483
|
-
return this.#
|
|
2517
|
+
return this.#w || (this.#w = new AbortController()), this.#w.signal;
|
|
2484
2518
|
}
|
|
2485
2519
|
constructor() {
|
|
2486
|
-
super(), this.#
|
|
2520
|
+
super(), this.#de(), this.#d = new Promise((e) => this.#h = e), this.#s = new At({
|
|
2487
2521
|
mergeConfig: () => {
|
|
2488
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(),
|
|
2522
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), oo(this.#n, this.#o?.getPlugins() ?? []), no(this.#o?.getPlugins() ?? []), ro(this.#o?.getPlugins() ?? []), this.#Ee(), this.#I = [...this._columns];
|
|
2489
2523
|
},
|
|
2490
|
-
processColumns: () => this.#
|
|
2491
|
-
processRows: () => this.#
|
|
2492
|
-
renderHeader: () =>
|
|
2493
|
-
updateTemplate: () =>
|
|
2524
|
+
processColumns: () => this.#Ce(),
|
|
2525
|
+
processRows: () => this.#ye(),
|
|
2526
|
+
renderHeader: () => te(this),
|
|
2527
|
+
updateTemplate: () => V(this),
|
|
2494
2528
|
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2495
2529
|
afterRender: () => {
|
|
2496
|
-
this.#o?.afterRender(), this.#
|
|
2530
|
+
this.#o?.afterRender(), this.#n.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, me(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, $(this)), this._virtualization.enabled && !this.#N && this.#ue();
|
|
2497
2531
|
},
|
|
2498
|
-
isConnected: () => this.isConnected && this.#
|
|
2499
|
-
}), this.#
|
|
2500
|
-
getShadow: () => this.#
|
|
2501
|
-
getShellConfig: () => this.#
|
|
2532
|
+
isConnected: () => this.isConnected && this.#f
|
|
2533
|
+
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = Ut(this.#e, {
|
|
2534
|
+
getShadow: () => this.#i,
|
|
2535
|
+
getShellConfig: () => this.#n?.shell,
|
|
2502
2536
|
getAccordionIcons: () => ({
|
|
2503
|
-
expand: this.#
|
|
2504
|
-
collapse: this.#
|
|
2537
|
+
expand: this.#n?.icons?.expand ?? z.expand,
|
|
2538
|
+
collapse: this.#n?.icons?.collapse ?? z.collapse
|
|
2505
2539
|
}),
|
|
2506
2540
|
emit: (e, o) => this.#T(e, o),
|
|
2507
2541
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2508
|
-
}), this.#t = new
|
|
2509
|
-
getRows: () => this.#
|
|
2542
|
+
}), this.#t = new ht({
|
|
2543
|
+
getRows: () => this.#a,
|
|
2510
2544
|
getSortState: () => this._sortState,
|
|
2511
2545
|
setSortState: (e) => {
|
|
2512
2546
|
this._sortState = e;
|
|
2513
2547
|
},
|
|
2514
2548
|
onConfigChange: () => {
|
|
2515
|
-
this.#
|
|
2549
|
+
this.#s.requestPhase(x.FULL, "configChange");
|
|
2516
2550
|
},
|
|
2517
2551
|
emit: (e, o) => this.#T(e, o),
|
|
2518
2552
|
clearRowPool: () => {
|
|
2519
2553
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
2520
2554
|
},
|
|
2521
2555
|
setup: () => this.#x(),
|
|
2522
|
-
renderHeader: () =>
|
|
2523
|
-
updateTemplate: () =>
|
|
2524
|
-
refreshVirtualWindow: () => this.#
|
|
2556
|
+
renderHeader: () => te(this),
|
|
2557
|
+
updateTemplate: () => V(this),
|
|
2558
|
+
refreshVirtualWindow: () => this.#s.requestPhase(x.VIRTUALIZATION, "configManager"),
|
|
2525
2559
|
getVirtualization: () => this._virtualization,
|
|
2526
2560
|
setRowHeight: (e) => {
|
|
2527
2561
|
this._virtualization.rowHeight = e;
|
|
2528
2562
|
},
|
|
2529
|
-
applyAnimationConfig: (e) => this.#
|
|
2563
|
+
applyAnimationConfig: (e) => this.#_e(e),
|
|
2530
2564
|
getShellLightDomTitle: () => this.#e.lightDomTitle,
|
|
2531
2565
|
getShellToolPanels: () => this.#e.toolPanels,
|
|
2532
2566
|
getShellHeaderContents: () => this.#e.headerContents,
|
|
@@ -2538,22 +2572,22 @@ class H extends HTMLElement {
|
|
|
2538
2572
|
static #Y = "tbw-grid-styles";
|
|
2539
2573
|
static #M = "";
|
|
2540
2574
|
static #q = /* @__PURE__ */ new Map();
|
|
2541
|
-
static #
|
|
2575
|
+
static #ce() {
|
|
2542
2576
|
let e = document.getElementById(this.#Y);
|
|
2543
2577
|
return e || (e = document.createElement("style"), e.id = this.#Y, e.setAttribute("data-tbw-grid", "true"), document.head.appendChild(e)), e;
|
|
2544
2578
|
}
|
|
2545
2579
|
static #W() {
|
|
2546
|
-
const e = this.#
|
|
2580
|
+
const e = this.#ce(), o = Array.from(this.#q.values()).join(`
|
|
2547
2581
|
`);
|
|
2548
2582
|
e.textContent = `${this.#M}
|
|
2549
2583
|
|
|
2550
2584
|
/* Plugin Styles */
|
|
2551
2585
|
${o}`;
|
|
2552
2586
|
}
|
|
2553
|
-
async #
|
|
2554
|
-
if (!
|
|
2555
|
-
if (
|
|
2556
|
-
|
|
2587
|
+
async #de() {
|
|
2588
|
+
if (!L.#M) {
|
|
2589
|
+
if (pe.length > 0) {
|
|
2590
|
+
L.#M = pe, L.#W();
|
|
2557
2591
|
return;
|
|
2558
2592
|
}
|
|
2559
2593
|
await new Promise((e) => setTimeout(e, 50));
|
|
@@ -2570,7 +2604,7 @@ ${o}`;
|
|
|
2570
2604
|
} catch {
|
|
2571
2605
|
continue;
|
|
2572
2606
|
}
|
|
2573
|
-
e ? (
|
|
2607
|
+
e ? (L.#M = e, L.#W()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
|
|
2574
2608
|
"[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
|
|
2575
2609
|
"Available stylesheets:",
|
|
2576
2610
|
Array.from(document.styleSheets).map((o) => o.href || "(inline)")
|
|
@@ -2587,31 +2621,31 @@ ${o}`;
|
|
|
2587
2621
|
return this.#o?.getPluginByName(e);
|
|
2588
2622
|
}
|
|
2589
2623
|
requestRender() {
|
|
2590
|
-
this.#
|
|
2624
|
+
this.#s.requestPhase(x.ROWS, "plugin:requestRender");
|
|
2591
2625
|
}
|
|
2592
2626
|
requestRenderWithFocus() {
|
|
2593
|
-
this._restoreFocusAfterRender = !0, this.#
|
|
2627
|
+
this._restoreFocusAfterRender = !0, this.#s.requestPhase(x.ROWS, "plugin:requestRenderWithFocus");
|
|
2594
2628
|
}
|
|
2595
2629
|
updateTemplate() {
|
|
2596
|
-
|
|
2630
|
+
V(this);
|
|
2597
2631
|
}
|
|
2598
2632
|
requestAfterRender() {
|
|
2599
|
-
this.#
|
|
2633
|
+
this.#s.requestPhase(x.STYLE, "plugin:requestAfterRender");
|
|
2600
2634
|
}
|
|
2601
2635
|
#j() {
|
|
2602
|
-
this.#o = new
|
|
2603
|
-
const e = this.#
|
|
2636
|
+
this.#o = new so(this);
|
|
2637
|
+
const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
|
|
2604
2638
|
this.#o.attachAll(o);
|
|
2605
2639
|
}
|
|
2606
2640
|
#z() {
|
|
2607
2641
|
const e = this.#o?.getPluginStyles() ?? [];
|
|
2608
2642
|
let o = !1;
|
|
2609
2643
|
for (const { name: n, styles: i } of e)
|
|
2610
|
-
|
|
2611
|
-
o &&
|
|
2644
|
+
L.#q.has(n) || (L.#q.set(n, i), o = !0);
|
|
2645
|
+
o && L.#W();
|
|
2612
2646
|
}
|
|
2613
2647
|
#K() {
|
|
2614
|
-
const e = this.#
|
|
2648
|
+
const e = this.#n?.plugins, o = Array.isArray(e) ? e : [];
|
|
2615
2649
|
if (this.#_ !== o) {
|
|
2616
2650
|
if (this.#_ && this.#_.length === o.length && this.#_.every((n, i) => n === o[i])) {
|
|
2617
2651
|
this.#_ = o;
|
|
@@ -2629,10 +2663,10 @@ ${o}`;
|
|
|
2629
2663
|
const i = this.#e.headerContentCleanups.get(n);
|
|
2630
2664
|
i && (i(), this.#e.headerContentCleanups.delete(n)), this.#e.headerContents.delete(n);
|
|
2631
2665
|
}
|
|
2632
|
-
this.#j(), this.#z(), this.#_ = o, this.#Z(), this.#
|
|
2666
|
+
this.#j(), this.#z(), this.#_ = o, this.#Z(), this.#m = this.#o?.getAll().some((n) => n.onScroll) ?? !1;
|
|
2633
2667
|
}
|
|
2634
2668
|
}
|
|
2635
|
-
#
|
|
2669
|
+
#he() {
|
|
2636
2670
|
this.#o?.detachAll();
|
|
2637
2671
|
}
|
|
2638
2672
|
#Z() {
|
|
@@ -2645,7 +2679,7 @@ ${o}`;
|
|
|
2645
2679
|
this.#e.headerContents.has(n.id) || this.#e.headerContents.set(n.id, n);
|
|
2646
2680
|
}
|
|
2647
2681
|
#R() {
|
|
2648
|
-
const e =
|
|
2682
|
+
const e = L.getAdapters();
|
|
2649
2683
|
if (e.length === 0 && !this.__frameworkAdapter) return;
|
|
2650
2684
|
const o = this.__frameworkAdapter;
|
|
2651
2685
|
return (n) => {
|
|
@@ -2661,20 +2695,20 @@ ${o}`;
|
|
|
2661
2695
|
};
|
|
2662
2696
|
}
|
|
2663
2697
|
connectedCallback() {
|
|
2664
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version",
|
|
2665
|
-
const e = this.#
|
|
2666
|
-
this.#_ = Array.isArray(e) ? e : [], this.#Z(), this.#
|
|
2698
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this.id || (this.id = `tbw-grid-${++L.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#w && (this.#w.abort(), this.#O = !1), this.#w = new AbortController(), this.#p && (Se(this.#p), this.#p = void 0), I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#j();
|
|
2699
|
+
const e = this.#n?.plugins;
|
|
2700
|
+
this.#_ = Array.isArray(e) ? e : [], this.#Z(), this.#u || (this.#G(), this.#z(), this.#u = !0), this.#J(), this.#p = xt(
|
|
2667
2701
|
() => {
|
|
2668
|
-
this.#
|
|
2702
|
+
this.#xe();
|
|
2669
2703
|
},
|
|
2670
2704
|
{ timeout: 100 }
|
|
2671
2705
|
);
|
|
2672
2706
|
}
|
|
2673
2707
|
disconnectedCallback() {
|
|
2674
|
-
this.#
|
|
2708
|
+
this.#p && (Se(this.#p), this.#p = void 0), this.#he(), Ft(this.#e), this.#c.setInitialized(!1), this.#D?.(), this.#D = void 0, Xe(this.#A), this.#w && (this.#w.abort(), this.#w = void 0), this.#P?.abort(), this.#P = void 0, this.#O = !1, this._resizeController && this._resizeController.dispose(), this.#C && (this.#C.disconnect(), this.#C = void 0), this.#y && (this.#y.disconnect(), this.#y = void 0, this.#N = !1), Y(this), this.#E.clear(), this.#_ = void 0;
|
|
2675
2709
|
for (const e of this._rowPool)
|
|
2676
2710
|
e.remove();
|
|
2677
|
-
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#
|
|
2711
|
+
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
|
|
2678
2712
|
}
|
|
2679
2713
|
attributeChangedCallback(e, o, n) {
|
|
2680
2714
|
if (!(o === n || !n || n === "null" || n === "undefined"))
|
|
@@ -2688,19 +2722,19 @@ ${o}`;
|
|
|
2688
2722
|
else e === "fit-mode" && (this.fitMode = n);
|
|
2689
2723
|
}
|
|
2690
2724
|
#J() {
|
|
2691
|
-
const o = this.#
|
|
2692
|
-
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#
|
|
2693
|
-
|
|
2694
|
-
const r = this.#
|
|
2725
|
+
const o = this.#i.querySelector(".tbw-grid-content") ?? this.#i.querySelector(".tbw-grid-root");
|
|
2726
|
+
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
2727
|
+
ce(this.#i, this.#e), Ae(this.#i, this.#n?.shell, this.#e);
|
|
2728
|
+
const r = this.#n?.shell?.toolPanel?.defaultOpen;
|
|
2695
2729
|
r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
|
|
2696
2730
|
}
|
|
2697
|
-
if (this.setAttribute("data-upgraded", ""), this.#
|
|
2731
|
+
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = Re(this), this.#x(), this.#ee(o), this.#O)
|
|
2698
2732
|
return;
|
|
2699
2733
|
this.#O = !0;
|
|
2700
2734
|
const n = this.disconnectSignal;
|
|
2701
|
-
|
|
2702
|
-
const i = this.#
|
|
2703
|
-
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#Q()), queueMicrotask(() => this.#
|
|
2735
|
+
_t(this, this, this.#i, n);
|
|
2736
|
+
const i = this.#n.rowHeight;
|
|
2737
|
+
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#Q()), queueMicrotask(() => this.#fe()), this.#s.requestPhase(x.FULL, "afterConnect");
|
|
2704
2738
|
}
|
|
2705
2739
|
#Q() {
|
|
2706
2740
|
if (this.#o.hasExtraHeight())
|
|
@@ -2714,16 +2748,16 @@ ${o}`;
|
|
|
2714
2748
|
l > n && (n = l);
|
|
2715
2749
|
});
|
|
2716
2750
|
const i = e.getBoundingClientRect(), r = Math.max(i.height, n);
|
|
2717
|
-
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#
|
|
2751
|
+
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(x.VIRTUALIZATION, "measureRowHeight"));
|
|
2718
2752
|
}
|
|
2719
2753
|
#ee(e) {
|
|
2720
2754
|
this.#P?.abort(), this.#P = new AbortController();
|
|
2721
2755
|
const o = this.#P.signal, n = e?.querySelector(".faux-vscroll"), i = e?.querySelector(".rows");
|
|
2722
|
-
if (this._virtualization.container = n ?? this, this.#
|
|
2756
|
+
if (this._virtualization.container = n ?? this, this.#m = this.#o?.getAll().some((r) => r.onScroll) ?? !1, n && i) {
|
|
2723
2757
|
n.addEventListener(
|
|
2724
2758
|
"scroll",
|
|
2725
2759
|
() => {
|
|
2726
|
-
if (!this._virtualization.enabled && !this.#
|
|
2760
|
+
if (!this._virtualization.enabled && !this.#m) return;
|
|
2727
2761
|
const l = n.scrollTop, c = this._virtualization.rowHeight;
|
|
2728
2762
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
2729
2763
|
i.style.transform = `translateY(${-l}px)`;
|
|
@@ -2731,13 +2765,13 @@ ${o}`;
|
|
|
2731
2765
|
const a = Math.floor(l / c), h = a - a % 2, u = -(l - h * c);
|
|
2732
2766
|
i.style.transform = `translateY(${u}px)`;
|
|
2733
2767
|
}
|
|
2734
|
-
this.#
|
|
2735
|
-
this.#
|
|
2768
|
+
this.#r = l, this.#v || (this.#v = requestAnimationFrame(() => {
|
|
2769
|
+
this.#v = 0, this.#r !== null && (this.#Se(this.#r), this.#r = null);
|
|
2736
2770
|
}));
|
|
2737
2771
|
},
|
|
2738
2772
|
{ passive: !0, signal: o }
|
|
2739
2773
|
);
|
|
2740
|
-
const r = this.#
|
|
2774
|
+
const r = this.#i.querySelector(".tbw-grid-content"), s = this.#i.querySelector(".tbw-scroll-area");
|
|
2741
2775
|
r && (r.addEventListener(
|
|
2742
2776
|
"wheel",
|
|
2743
2777
|
(l) => {
|
|
@@ -2751,27 +2785,27 @@ ${o}`;
|
|
|
2751
2785
|
}
|
|
2752
2786
|
},
|
|
2753
2787
|
{ passive: !1, signal: o }
|
|
2754
|
-
),
|
|
2788
|
+
), Jt(r, this.#A, { fauxScrollbar: n, scrollArea: s }, o));
|
|
2755
2789
|
}
|
|
2756
|
-
this._bodyEl &&
|
|
2757
|
-
this.#
|
|
2758
|
-
}), this.#C.observe(this._virtualization.viewportEl)), this.#
|
|
2790
|
+
this._bodyEl && yt(this, this._bodyEl, o), this.#C?.disconnect(), this._virtualization.viewportEl && (this.#C = new ResizeObserver(() => {
|
|
2791
|
+
this.#s.requestPhase(x.VIRTUALIZATION, "resize-observer");
|
|
2792
|
+
}), this.#C.observe(this._virtualization.viewportEl)), this.#i.addEventListener(
|
|
2759
2793
|
"focusin",
|
|
2760
2794
|
() => {
|
|
2761
2795
|
this.dataset.hasFocus = "";
|
|
2762
2796
|
},
|
|
2763
2797
|
{ signal: o }
|
|
2764
|
-
), this.#
|
|
2798
|
+
), this.#i.addEventListener(
|
|
2765
2799
|
"focusout",
|
|
2766
2800
|
(r) => {
|
|
2767
2801
|
const s = r.relatedTarget;
|
|
2768
|
-
(!s || !this.#
|
|
2802
|
+
(!s || !this.#i.contains(s)) && delete this.dataset.hasFocus;
|
|
2769
2803
|
},
|
|
2770
2804
|
{ signal: o }
|
|
2771
2805
|
);
|
|
2772
2806
|
}
|
|
2773
2807
|
#N = !1;
|
|
2774
|
-
#
|
|
2808
|
+
#ue() {
|
|
2775
2809
|
if (this.#N) return;
|
|
2776
2810
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2777
2811
|
e && (this.#N = !0, this.#y?.disconnect(), this.#y = new ResizeObserver(() => {
|
|
@@ -2781,7 +2815,7 @@ ${o}`;
|
|
|
2781
2815
|
#T(e, o) {
|
|
2782
2816
|
this.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0, composed: !0 }));
|
|
2783
2817
|
}
|
|
2784
|
-
#
|
|
2818
|
+
#fe() {
|
|
2785
2819
|
this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((o, n) => {
|
|
2786
2820
|
const i = n === this._focusRow;
|
|
2787
2821
|
o.setAttribute("aria-selected", String(i)), o.querySelectorAll(".cell").forEach((r, s) => {
|
|
@@ -2790,31 +2824,31 @@ ${o}`;
|
|
|
2790
2824
|
});
|
|
2791
2825
|
}
|
|
2792
2826
|
#k(e) {
|
|
2793
|
-
this.#
|
|
2827
|
+
this.#b[e] = !0, !this.#g && (this.#g = !0, queueMicrotask(() => this.#pe()));
|
|
2794
2828
|
}
|
|
2795
|
-
#
|
|
2796
|
-
if (!this.#
|
|
2797
|
-
this.#
|
|
2829
|
+
#pe() {
|
|
2830
|
+
if (!this.#g || !this.#f) {
|
|
2831
|
+
this.#g = !1;
|
|
2798
2832
|
return;
|
|
2799
2833
|
}
|
|
2800
|
-
const e = this.#
|
|
2801
|
-
if (this.#
|
|
2834
|
+
const e = this.#b;
|
|
2835
|
+
if (this.#g = !1, this.#b = {
|
|
2802
2836
|
rows: !1,
|
|
2803
2837
|
columns: !1,
|
|
2804
2838
|
gridConfig: !1,
|
|
2805
2839
|
fitMode: !1
|
|
2806
2840
|
}, e.gridConfig) {
|
|
2807
|
-
this.#
|
|
2841
|
+
this.#be(), e.rows && this.#te();
|
|
2808
2842
|
return;
|
|
2809
2843
|
}
|
|
2810
|
-
e.columns && this.#
|
|
2844
|
+
e.columns && this.#we(), e.rows && this.#te(), e.fitMode && this.#me();
|
|
2811
2845
|
}
|
|
2812
2846
|
#te() {
|
|
2813
|
-
this._rows = Array.isArray(this.#
|
|
2847
|
+
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#$(), this.#s.requestPhase(x.ROWS, "applyRowsUpdate");
|
|
2814
2848
|
}
|
|
2815
2849
|
#$() {
|
|
2816
2850
|
this.#H.clear();
|
|
2817
|
-
const e = this.#
|
|
2851
|
+
const e = this.#n.getRowId;
|
|
2818
2852
|
this._rows.forEach((o, n) => {
|
|
2819
2853
|
const i = this.#oe(o, e);
|
|
2820
2854
|
i !== void 0 && this.#H.set(i, { row: o, index: n });
|
|
@@ -2827,7 +2861,7 @@ ${o}`;
|
|
|
2827
2861
|
if ("id" in n && n.id != null) return String(n.id);
|
|
2828
2862
|
if ("_id" in n && n._id != null) return String(n._id);
|
|
2829
2863
|
}
|
|
2830
|
-
#
|
|
2864
|
+
#ge(e, o) {
|
|
2831
2865
|
const n = this.#oe(e, o);
|
|
2832
2866
|
if (n === void 0)
|
|
2833
2867
|
throw new Error(
|
|
@@ -2835,33 +2869,33 @@ ${o}`;
|
|
|
2835
2869
|
);
|
|
2836
2870
|
return n;
|
|
2837
2871
|
}
|
|
2838
|
-
#
|
|
2839
|
-
|
|
2872
|
+
#we() {
|
|
2873
|
+
Y(this), this.#t.merge(), this.#x();
|
|
2840
2874
|
}
|
|
2841
|
-
#
|
|
2842
|
-
this.#t.merge(), this.#
|
|
2875
|
+
#me() {
|
|
2876
|
+
this.#t.merge(), this.#n.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, me(this)) : (this._columns.forEach((o) => {
|
|
2843
2877
|
!o.__userResized && o.__autoSized && delete o.width;
|
|
2844
|
-
}),
|
|
2878
|
+
}), V(this));
|
|
2845
2879
|
}
|
|
2846
|
-
#
|
|
2880
|
+
#be() {
|
|
2847
2881
|
I(this, this.#e), q(this, this.#e);
|
|
2848
|
-
const e = !!this.#
|
|
2882
|
+
const e = !!this.#i.querySelector(".has-shell"), o = !!this.#i.querySelector(".tbw-tool-panel"), n = this.#i.querySelectorAll(".tbw-accordion-section").length;
|
|
2849
2883
|
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#K(), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
2850
|
-
const i =
|
|
2884
|
+
const i = Ge(this.#n?.shell), r = (this.#n?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#n?.shell?.toolPanels?.length ?? 0) !== n;
|
|
2851
2885
|
if (e !== i || !e && i || !o && r || o && s) {
|
|
2852
2886
|
this.#G(), this.#z(), this.#J(), this.#$();
|
|
2853
2887
|
return;
|
|
2854
2888
|
}
|
|
2855
|
-
e && this.#
|
|
2889
|
+
e && this.#ve(), this.#$(), this.#s.requestPhase(x.COLUMNS, "applyGridConfigUpdate");
|
|
2856
2890
|
}
|
|
2857
|
-
#
|
|
2858
|
-
const e = this.#
|
|
2891
|
+
#ve() {
|
|
2892
|
+
const e = this.#i.querySelector(".tbw-shell-header");
|
|
2859
2893
|
if (!e) return;
|
|
2860
|
-
const o = this.#
|
|
2894
|
+
const o = this.#n.shell?.header?.title ?? this.#e.lightDomTitle;
|
|
2861
2895
|
let n = e.querySelector(".tbw-shell-title");
|
|
2862
2896
|
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();
|
|
2863
2897
|
}
|
|
2864
|
-
#
|
|
2898
|
+
#Ce() {
|
|
2865
2899
|
if (this.#o) {
|
|
2866
2900
|
const e = this.#I.length > 0 ? this.#I : this._columns, o = e.filter((r) => !r.hidden), n = e.filter((r) => r.hidden), i = this.#o.processColumns([...o]);
|
|
2867
2901
|
if (i !== o) {
|
|
@@ -2872,21 +2906,21 @@ ${o}`;
|
|
|
2872
2906
|
this._columns = [...e];
|
|
2873
2907
|
}
|
|
2874
2908
|
}
|
|
2875
|
-
#
|
|
2876
|
-
|
|
2877
|
-
const e = Array.isArray(this.#
|
|
2909
|
+
#ye() {
|
|
2910
|
+
Y(this);
|
|
2911
|
+
const e = Array.isArray(this.#a) ? [...this.#a] : [], o = this.#o?.processRows(e) ?? e;
|
|
2878
2912
|
this._rows = o;
|
|
2879
2913
|
}
|
|
2880
|
-
#
|
|
2914
|
+
#_e(e) {
|
|
2881
2915
|
const o = {
|
|
2882
|
-
...
|
|
2916
|
+
...je,
|
|
2883
2917
|
...e.animation
|
|
2884
2918
|
}, n = o.mode ?? "reduced-motion";
|
|
2885
2919
|
let i = 1;
|
|
2886
2920
|
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;
|
|
2887
2921
|
}
|
|
2888
2922
|
#F(e, o, n = this.__rowRenderEpoch) {
|
|
2889
|
-
this.#
|
|
2923
|
+
this.#S || (this.#S = (i, r, s) => this.#o?.renderRow(i, r, s) ?? !1), gt(this, e, o, n, this.#S);
|
|
2890
2924
|
}
|
|
2891
2925
|
#U = -1;
|
|
2892
2926
|
#ne = -1;
|
|
@@ -2896,6 +2930,15 @@ ${o}`;
|
|
|
2896
2930
|
const n = this.#U;
|
|
2897
2931
|
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"));
|
|
2898
2932
|
}
|
|
2933
|
+
#re;
|
|
2934
|
+
#se;
|
|
2935
|
+
#Ee() {
|
|
2936
|
+
if (!this.__rowsBodyEl) return;
|
|
2937
|
+
const e = this.#n.gridAriaLabel, o = this.#n.shell?.header?.title ?? this.#e?.lightDomTitle ?? void 0, n = e ?? o;
|
|
2938
|
+
n !== this.#re && (this.#re = n, n ? this.__rowsBodyEl.setAttribute("aria-label", n) : this.__rowsBodyEl.removeAttribute("aria-label"));
|
|
2939
|
+
const i = this.#n.gridAriaDescribedBy;
|
|
2940
|
+
i !== this.#se && (this.#se = i, i ? this.__rowsBodyEl.setAttribute("aria-describedby", i) : this.__rowsBodyEl.removeAttribute("aria-describedby"));
|
|
2941
|
+
}
|
|
2899
2942
|
#x() {
|
|
2900
2943
|
if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
|
|
2901
2944
|
if (this.#t.parseLightDomColumns(this), this.#L) {
|
|
@@ -2904,17 +2947,17 @@ ${o}`;
|
|
|
2904
2947
|
const o = this.#o?.getAll() ?? [];
|
|
2905
2948
|
this.#t.applyState(e, o);
|
|
2906
2949
|
}
|
|
2907
|
-
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#
|
|
2950
|
+
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(x.FULL, "setup");
|
|
2908
2951
|
}
|
|
2909
2952
|
}
|
|
2910
|
-
#
|
|
2911
|
-
if (this.refreshVirtualWindow(!1), this.#o?.onScrollRender(), this.#
|
|
2912
|
-
const o = this._virtualization.container, n = this.#
|
|
2953
|
+
#Se(e) {
|
|
2954
|
+
if (this.refreshVirtualWindow(!1), this.#o?.onScrollRender(), this.#m) {
|
|
2955
|
+
const o = this._virtualization.container, n = this.#ae;
|
|
2913
2956
|
n.scrollTop = e, n.scrollLeft = o?.scrollLeft ?? 0, n.scrollHeight = o?.scrollHeight ?? 0, n.scrollWidth = o?.scrollWidth ?? 0, n.clientHeight = o?.clientHeight ?? 0, n.clientWidth = o?.clientWidth ?? 0, this.#o?.onScroll(n);
|
|
2914
2957
|
}
|
|
2915
2958
|
}
|
|
2916
2959
|
findHeaderRow() {
|
|
2917
|
-
return this.#
|
|
2960
|
+
return this.#i.querySelector(".header-row");
|
|
2918
2961
|
}
|
|
2919
2962
|
findRenderedRowElement(e) {
|
|
2920
2963
|
return Array.from(this._bodyEl.querySelectorAll(".data-grid-row")).find((o) => {
|
|
@@ -3006,16 +3049,16 @@ ${o}`;
|
|
|
3006
3049
|
return this.#o?.hasAfterRowRenderHook() ?? !1;
|
|
3007
3050
|
}
|
|
3008
3051
|
async ready() {
|
|
3009
|
-
return this.#
|
|
3052
|
+
return this.#d;
|
|
3010
3053
|
}
|
|
3011
3054
|
async forceLayout() {
|
|
3012
|
-
return this.#
|
|
3055
|
+
return this.#s.requestPhase(x.FULL, "forceLayout"), this.#s.whenReady();
|
|
3013
3056
|
}
|
|
3014
3057
|
async getConfig() {
|
|
3015
|
-
return Object.freeze({ ...this.#
|
|
3058
|
+
return Object.freeze({ ...this.#n || {} });
|
|
3016
3059
|
}
|
|
3017
3060
|
getRowId(e) {
|
|
3018
|
-
return this.#
|
|
3061
|
+
return this.#ge(e, this.#n.getRowId);
|
|
3019
3062
|
}
|
|
3020
3063
|
getRow(e) {
|
|
3021
3064
|
return this.#H.get(e)?.row;
|
|
@@ -3042,7 +3085,7 @@ ${o}`;
|
|
|
3042
3085
|
changes: o,
|
|
3043
3086
|
source: n
|
|
3044
3087
|
});
|
|
3045
|
-
l.length > 0 && this.#
|
|
3088
|
+
l.length > 0 && this.#s.requestPhase(x.ROWS, "updateRow");
|
|
3046
3089
|
}
|
|
3047
3090
|
updateRows(e, o = "api") {
|
|
3048
3091
|
let n = !1;
|
|
@@ -3067,16 +3110,16 @@ ${o}`;
|
|
|
3067
3110
|
}));
|
|
3068
3111
|
}
|
|
3069
3112
|
}
|
|
3070
|
-
n && this.#
|
|
3113
|
+
n && this.#s.requestPhase(x.ROWS, "updateRows");
|
|
3071
3114
|
}
|
|
3072
3115
|
animateRow(e, o) {
|
|
3073
|
-
|
|
3116
|
+
fe(this, e, o);
|
|
3074
3117
|
}
|
|
3075
3118
|
animateRows(e, o) {
|
|
3076
|
-
|
|
3119
|
+
Mt(this, e, o);
|
|
3077
3120
|
}
|
|
3078
3121
|
animateRowById(e, o) {
|
|
3079
|
-
return
|
|
3122
|
+
return zt(this, e, o);
|
|
3080
3123
|
}
|
|
3081
3124
|
setColumnVisible(e, o) {
|
|
3082
3125
|
const n = this.#t.setColumnVisible(e, o);
|
|
@@ -3106,12 +3149,12 @@ ${o}`;
|
|
|
3106
3149
|
return this.#t.collectState(e);
|
|
3107
3150
|
}
|
|
3108
3151
|
set columnState(e) {
|
|
3109
|
-
e && (this.#L = e, this.#t.initialColumnState = e, this.#
|
|
3152
|
+
e && (this.#L = e, this.#t.initialColumnState = e, this.#u && this.#Re(e));
|
|
3110
3153
|
}
|
|
3111
3154
|
get columnState() {
|
|
3112
3155
|
return this.getColumnState();
|
|
3113
3156
|
}
|
|
3114
|
-
#
|
|
3157
|
+
#Re(e) {
|
|
3115
3158
|
const o = this.#o?.getAll() ?? [];
|
|
3116
3159
|
this.#t.applyState(e, o), this.#x();
|
|
3117
3160
|
}
|
|
@@ -3125,95 +3168,95 @@ ${o}`;
|
|
|
3125
3168
|
this.#t.resetState(e), this.#t.merge(), this.#x();
|
|
3126
3169
|
}
|
|
3127
3170
|
get isToolPanelOpen() {
|
|
3128
|
-
return this.#
|
|
3171
|
+
return this.#c.isPanelOpen;
|
|
3129
3172
|
}
|
|
3130
3173
|
get expandedToolPanelSections() {
|
|
3131
|
-
return this.#
|
|
3174
|
+
return this.#c.expandedSections;
|
|
3132
3175
|
}
|
|
3133
3176
|
openToolPanel() {
|
|
3134
|
-
this.#
|
|
3177
|
+
this.#c.openToolPanel();
|
|
3135
3178
|
}
|
|
3136
3179
|
closeToolPanel() {
|
|
3137
|
-
this.#
|
|
3180
|
+
this.#c.closeToolPanel();
|
|
3138
3181
|
}
|
|
3139
3182
|
toggleToolPanel() {
|
|
3140
|
-
this.#
|
|
3183
|
+
this.#c.toggleToolPanel();
|
|
3141
3184
|
}
|
|
3142
3185
|
toggleToolPanelSection(e) {
|
|
3143
|
-
this.#
|
|
3186
|
+
this.#c.toggleToolPanelSection(e);
|
|
3144
3187
|
}
|
|
3145
3188
|
getToolPanels() {
|
|
3146
|
-
return this.#
|
|
3189
|
+
return this.#c.getToolPanels();
|
|
3147
3190
|
}
|
|
3148
3191
|
registerToolPanel(e) {
|
|
3149
|
-
this.#e.apiToolPanelIds.add(e.id), this.#
|
|
3192
|
+
this.#e.apiToolPanelIds.add(e.id), this.#c.registerToolPanel(e);
|
|
3150
3193
|
}
|
|
3151
3194
|
unregisterToolPanel(e) {
|
|
3152
|
-
this.#e.apiToolPanelIds.delete(e), this.#
|
|
3195
|
+
this.#e.apiToolPanelIds.delete(e), this.#c.unregisterToolPanel(e);
|
|
3153
3196
|
}
|
|
3154
3197
|
getHeaderContents() {
|
|
3155
|
-
return this.#
|
|
3198
|
+
return this.#c.getHeaderContents();
|
|
3156
3199
|
}
|
|
3157
3200
|
registerHeaderContent(e) {
|
|
3158
|
-
this.#
|
|
3201
|
+
this.#c.registerHeaderContent(e);
|
|
3159
3202
|
}
|
|
3160
3203
|
unregisterHeaderContent(e) {
|
|
3161
|
-
this.#
|
|
3204
|
+
this.#c.unregisterHeaderContent(e);
|
|
3162
3205
|
}
|
|
3163
3206
|
getToolbarContents() {
|
|
3164
|
-
return this.#
|
|
3207
|
+
return this.#c.getToolbarContents();
|
|
3165
3208
|
}
|
|
3166
3209
|
registerToolbarContent(e) {
|
|
3167
|
-
this.#
|
|
3210
|
+
this.#c.registerToolbarContent(e);
|
|
3168
3211
|
}
|
|
3169
3212
|
unregisterToolbarContent(e) {
|
|
3170
|
-
this.#
|
|
3213
|
+
this.#c.unregisterToolbarContent(e);
|
|
3171
3214
|
}
|
|
3172
3215
|
#V = !1;
|
|
3173
3216
|
refreshShellHeader() {
|
|
3174
3217
|
this.#V || (this.#V = !0, queueMicrotask(() => {
|
|
3175
|
-
this.#V = !1, this.isConnected && (I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge(), this.#G(), this.#z(), this.#
|
|
3218
|
+
this.#V = !1, this.isConnected && (I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge(), this.#G(), this.#z(), this.#Te());
|
|
3176
3219
|
}));
|
|
3177
3220
|
}
|
|
3178
|
-
#
|
|
3179
|
-
const o = this.#
|
|
3180
|
-
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#
|
|
3181
|
-
|
|
3182
|
-
const n = this.#
|
|
3221
|
+
#Te() {
|
|
3222
|
+
const o = this.#i.querySelector(".tbw-grid-content") ?? this.#i.querySelector(".tbw-grid-root");
|
|
3223
|
+
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
3224
|
+
ce(this.#i, this.#e), Ae(this.#i, this.#n?.shell, this.#e);
|
|
3225
|
+
const n = this.#n?.shell?.toolPanel?.defaultOpen;
|
|
3183
3226
|
n && this.#e.toolPanels.has(n) && (this.openToolPanel(), this.#e.expandedSections.add(n));
|
|
3184
3227
|
}
|
|
3185
|
-
this._resizeController =
|
|
3228
|
+
this._resizeController = Re(this), this.#ee(o), this.#s.requestPhase(x.COLUMNS, "shellRefresh");
|
|
3186
3229
|
}
|
|
3187
|
-
#
|
|
3230
|
+
#E = /* @__PURE__ */ new Map();
|
|
3188
3231
|
registerStyles(e, o) {
|
|
3189
|
-
let n = this.#
|
|
3190
|
-
n || (n = new CSSStyleSheet(), this.#
|
|
3232
|
+
let n = this.#E.get(e);
|
|
3233
|
+
n || (n = new CSSStyleSheet(), this.#E.set(e, n)), n.replaceSync(o), this.#le();
|
|
3191
3234
|
}
|
|
3192
3235
|
unregisterStyles(e) {
|
|
3193
|
-
this.#
|
|
3236
|
+
this.#E.delete(e) && this.#le();
|
|
3194
3237
|
}
|
|
3195
3238
|
getRegisteredStyles() {
|
|
3196
|
-
return Array.from(this.#
|
|
3239
|
+
return Array.from(this.#E.keys());
|
|
3197
3240
|
}
|
|
3198
|
-
#
|
|
3199
|
-
const e = Array.from(this.#
|
|
3200
|
-
(n) => !Array.from(this.#
|
|
3241
|
+
#le() {
|
|
3242
|
+
const e = Array.from(this.#E.values()), o = document.adoptedStyleSheets.filter(
|
|
3243
|
+
(n) => !Array.from(this.#E.values()).includes(n)
|
|
3201
3244
|
);
|
|
3202
3245
|
document.adoptedStyleSheets = [...o, ...e];
|
|
3203
3246
|
}
|
|
3204
|
-
#
|
|
3247
|
+
#xe() {
|
|
3205
3248
|
const e = () => {
|
|
3206
3249
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3207
3250
|
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R());
|
|
3208
3251
|
const r = this.#e.lightDomTitle, s = this.#e.hasToolButtonsContainer;
|
|
3209
3252
|
if (r && !n || s && !i) {
|
|
3210
3253
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3211
|
-
const l = this.#
|
|
3254
|
+
const l = this.#i.querySelector(".tbw-shell-header");
|
|
3212
3255
|
if (l) {
|
|
3213
|
-
const c =
|
|
3214
|
-
this.#
|
|
3256
|
+
const c = xe(
|
|
3257
|
+
this.#n.shell,
|
|
3215
3258
|
this.#e,
|
|
3216
|
-
this.#
|
|
3259
|
+
this.#n.icons?.toolPanel
|
|
3217
3260
|
), a = document.createElement("div");
|
|
3218
3261
|
a.innerHTML = c;
|
|
3219
3262
|
const h = a.firstElementChild;
|
|
@@ -3226,25 +3269,25 @@ ${o}`;
|
|
|
3226
3269
|
this.#t.registerLightDomHandler("tbw-grid-header", e), this.#t.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#t.registerLightDomHandler("tbw-grid-tool-panel", e), this.#t.registerLightDomHandler("tbw-grid-column", o), this.#t.registerLightDomHandler("tbw-grid-detail", o), this.#t.observeLightDOM(this);
|
|
3227
3270
|
}
|
|
3228
3271
|
refreshColumns() {
|
|
3229
|
-
this.__lightDomColumnsCache = void 0,
|
|
3272
|
+
this.__lightDomColumnsCache = void 0, Y(this), this.#t.parseLightDomColumns(this);
|
|
3230
3273
|
const e = this.#e.lightDomTitle, o = this.#e.hasToolButtonsContainer;
|
|
3231
3274
|
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R());
|
|
3232
3275
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3233
3276
|
if (n && !e || i && !o) {
|
|
3234
3277
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3235
|
-
const s = this.#
|
|
3278
|
+
const s = this.#i.querySelector(".tbw-shell-header");
|
|
3236
3279
|
if (s) {
|
|
3237
|
-
const l =
|
|
3238
|
-
this.#
|
|
3280
|
+
const l = xe(
|
|
3281
|
+
this.#n.shell,
|
|
3239
3282
|
this.#e,
|
|
3240
|
-
this.#
|
|
3283
|
+
this.#n.icons?.toolPanel
|
|
3241
3284
|
), c = document.createElement("div");
|
|
3242
3285
|
c.innerHTML = l;
|
|
3243
3286
|
const a = c.firstElementChild;
|
|
3244
3287
|
a && (s.replaceWith(a), this.#X());
|
|
3245
3288
|
}
|
|
3246
3289
|
}
|
|
3247
|
-
this.#
|
|
3290
|
+
this.#s.requestPhase(x.COLUMNS, "refreshColumns");
|
|
3248
3291
|
}
|
|
3249
3292
|
#B(e) {
|
|
3250
3293
|
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight, c = this.shadowRoot?.querySelector(".tbw-scroll-area"), a = c ? c.clientHeight : r, u = a - s, p = this.#o?.getExtraHeight() ?? 0, f = Math.max(0, r - a);
|
|
@@ -3275,7 +3318,7 @@ ${o}`;
|
|
|
3275
3318
|
const f = Math.ceil(s / l) + 3;
|
|
3276
3319
|
let g = a + f;
|
|
3277
3320
|
if (g > n && (g = n), this._virtualization.start = a, this._virtualization.end = g, i.clientHeight === 0 && s > 0) {
|
|
3278
|
-
this.#
|
|
3321
|
+
this.#s.requestPhase(x.VIRTUALIZATION, "stale-refs-retry");
|
|
3279
3322
|
return;
|
|
3280
3323
|
}
|
|
3281
3324
|
const w = this.#B(n);
|
|
@@ -3290,33 +3333,33 @@ ${o}`;
|
|
|
3290
3333
|
}
|
|
3291
3334
|
#G() {
|
|
3292
3335
|
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#R()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3293
|
-
const e = this.#
|
|
3294
|
-
|
|
3295
|
-
this.#
|
|
3336
|
+
const e = this.#n?.shell;
|
|
3337
|
+
Bt(
|
|
3338
|
+
this.#i,
|
|
3296
3339
|
e,
|
|
3297
3340
|
{ isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
|
|
3298
|
-
this.#
|
|
3299
|
-
) && (this.#X(), this.#
|
|
3341
|
+
this.#n?.icons
|
|
3342
|
+
) && (this.#X(), this.#c.setInitialized(!0));
|
|
3300
3343
|
}
|
|
3301
3344
|
#X() {
|
|
3302
|
-
|
|
3345
|
+
qt(this.#i, this.#n?.shell, this.#e, {
|
|
3303
3346
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3304
3347
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3305
|
-
}), this.#D?.(), this.#D =
|
|
3348
|
+
}), this.#D?.(), this.#D = Wt(this.#i, this.#n?.shell, (e) => {
|
|
3306
3349
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3307
3350
|
});
|
|
3308
3351
|
}
|
|
3309
3352
|
}
|
|
3310
|
-
customElements.get(
|
|
3311
|
-
globalThis.DataGridElement =
|
|
3312
|
-
const
|
|
3353
|
+
customElements.get(L.tagName) || customElements.define(L.tagName, L);
|
|
3354
|
+
globalThis.DataGridElement = L;
|
|
3355
|
+
const ao = {
|
|
3313
3356
|
CAN_MOVE_COLUMN: "canMoveColumn",
|
|
3314
3357
|
GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
|
|
3315
3358
|
};
|
|
3316
|
-
class
|
|
3359
|
+
class co {
|
|
3317
3360
|
static dependencies;
|
|
3318
3361
|
static manifest;
|
|
3319
|
-
version = "1.
|
|
3362
|
+
version = "1.4.0";
|
|
3320
3363
|
styles;
|
|
3321
3364
|
cellRenderers;
|
|
3322
3365
|
headerRenderers;
|
|
@@ -3324,7 +3367,7 @@ class io {
|
|
|
3324
3367
|
grid;
|
|
3325
3368
|
config;
|
|
3326
3369
|
userConfig;
|
|
3327
|
-
#
|
|
3370
|
+
#l;
|
|
3328
3371
|
get defaultConfig() {
|
|
3329
3372
|
return {};
|
|
3330
3373
|
}
|
|
@@ -3332,10 +3375,10 @@ class io {
|
|
|
3332
3375
|
this.userConfig = e;
|
|
3333
3376
|
}
|
|
3334
3377
|
attach(e) {
|
|
3335
|
-
this.#
|
|
3378
|
+
this.#l?.abort(), this.#l = new AbortController(), this.grid = e, this.config = { ...this.defaultConfig, ...this.userConfig };
|
|
3336
3379
|
}
|
|
3337
3380
|
detach() {
|
|
3338
|
-
this.#
|
|
3381
|
+
this.#l?.abort(), this.#l = void 0;
|
|
3339
3382
|
}
|
|
3340
3383
|
getPlugin(e) {
|
|
3341
3384
|
return this.grid?.getPlugin(e);
|
|
@@ -3372,7 +3415,7 @@ class io {
|
|
|
3372
3415
|
return this.grid;
|
|
3373
3416
|
}
|
|
3374
3417
|
get disconnectSignal() {
|
|
3375
|
-
return this.#
|
|
3418
|
+
return this.#l?.signal ?? this.grid?.disconnectSignal;
|
|
3376
3419
|
}
|
|
3377
3420
|
get gridIcons() {
|
|
3378
3421
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
@@ -3436,14 +3479,14 @@ const A = {
|
|
|
3436
3479
|
GROUP_COUNT: "group-count",
|
|
3437
3480
|
RANGE_SELECTION: "range-selection",
|
|
3438
3481
|
SELECTION_OVERLAY: "selection-overlay"
|
|
3439
|
-
},
|
|
3482
|
+
}, Q = {
|
|
3440
3483
|
ROW_INDEX: "data-row-index",
|
|
3441
3484
|
COL_INDEX: "data-col-index",
|
|
3442
3485
|
FIELD: "data-field",
|
|
3443
3486
|
GROUP_KEY: "data-group-key",
|
|
3444
3487
|
TREE_LEVEL: "data-tree-level",
|
|
3445
3488
|
STICKY: "data-sticky"
|
|
3446
|
-
},
|
|
3489
|
+
}, ho = {
|
|
3447
3490
|
ROOT: `.${A.ROOT}`,
|
|
3448
3491
|
HEADER: `.${A.HEADER}`,
|
|
3449
3492
|
HEADER_ROW: `.${A.HEADER_ROW}`,
|
|
@@ -3453,12 +3496,12 @@ const A = {
|
|
|
3453
3496
|
DATA_ROW: `.${A.DATA_ROW}`,
|
|
3454
3497
|
DATA_CELL: `.${A.DATA_CELL}`,
|
|
3455
3498
|
GROUP_ROW: `.${A.GROUP_ROW}`,
|
|
3456
|
-
ROW_BY_INDEX: (t) => `.${A.DATA_ROW}[${
|
|
3457
|
-
CELL_BY_FIELD: (t) => `.${A.DATA_CELL}[${
|
|
3458
|
-
CELL_AT: (t, e) => `.${A.DATA_ROW}[${
|
|
3499
|
+
ROW_BY_INDEX: (t) => `.${A.DATA_ROW}[${Q.ROW_INDEX}="${t}"]`,
|
|
3500
|
+
CELL_BY_FIELD: (t) => `.${A.DATA_CELL}[${Q.FIELD}="${t}"]`,
|
|
3501
|
+
CELL_AT: (t, e) => `.${A.DATA_ROW}[${Q.ROW_INDEX}="${t}"] .${A.DATA_CELL}[${Q.COL_INDEX}="${e}"]`,
|
|
3459
3502
|
SELECTED_ROWS: `.${A.DATA_ROW}.${A.SELECTED}`,
|
|
3460
3503
|
EDITING_CELL: `.${A.DATA_CELL}.${A.EDITING}`
|
|
3461
|
-
},
|
|
3504
|
+
}, uo = {
|
|
3462
3505
|
COLOR_BG: "--tbw-color-bg",
|
|
3463
3506
|
COLOR_FG: "--tbw-color-fg",
|
|
3464
3507
|
COLOR_FG_MUTED: "--tbw-color-fg-muted",
|
|
@@ -3477,14 +3520,14 @@ const A = {
|
|
|
3477
3520
|
BORDER_RADIUS: "--tbw-border-radius",
|
|
3478
3521
|
FOCUS_OUTLINE: "--tbw-focus-outline"
|
|
3479
3522
|
};
|
|
3480
|
-
function
|
|
3523
|
+
function fo(t) {
|
|
3481
3524
|
const e = document.createElement("tbw-grid");
|
|
3482
3525
|
return t && (e.gridConfig = t), e;
|
|
3483
3526
|
}
|
|
3484
|
-
function
|
|
3527
|
+
function po(t, e = document) {
|
|
3485
3528
|
return e.querySelector(t);
|
|
3486
3529
|
}
|
|
3487
|
-
const
|
|
3530
|
+
const go = {
|
|
3488
3531
|
CELL_CHANGE: "cell-change",
|
|
3489
3532
|
CELL_COMMIT: "cell-commit",
|
|
3490
3533
|
ROW_COMMIT: "row-commit",
|
|
@@ -3497,7 +3540,7 @@ const co = {
|
|
|
3497
3540
|
CELL_ACTIVATE: "cell-activate",
|
|
3498
3541
|
GROUP_TOGGLE: "group-toggle",
|
|
3499
3542
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
3500
|
-
},
|
|
3543
|
+
}, wo = {
|
|
3501
3544
|
SELECTION_CHANGE: "selection-change",
|
|
3502
3545
|
TREE_EXPAND: "tree-expand",
|
|
3503
3546
|
FILTER_CHANGE: "filter-change",
|
|
@@ -3515,7 +3558,7 @@ const co = {
|
|
|
3515
3558
|
COLUMN_REORDER: "column-reorder",
|
|
3516
3559
|
DETAIL_EXPAND: "detail-expand",
|
|
3517
3560
|
GROUP_EXPAND: "group-expand"
|
|
3518
|
-
},
|
|
3561
|
+
}, ae = {
|
|
3519
3562
|
sum: (t, e) => t.reduce((o, n) => o + (Number(n[e]) || 0), 0),
|
|
3520
3563
|
avg: (t, e) => {
|
|
3521
3564
|
const o = t.reduce((n, i) => n + (Number(i[e]) || 0), 0);
|
|
@@ -3526,28 +3569,28 @@ const co = {
|
|
|
3526
3569
|
max: (t, e) => Math.max(...t.map((o) => Number(o[e]) || -1 / 0)),
|
|
3527
3570
|
first: (t, e) => t[0]?.[e],
|
|
3528
3571
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
3529
|
-
},
|
|
3572
|
+
}, U = /* @__PURE__ */ new Map(), M = {
|
|
3530
3573
|
register(t, e) {
|
|
3531
|
-
|
|
3574
|
+
U.set(t, e);
|
|
3532
3575
|
},
|
|
3533
3576
|
unregister(t) {
|
|
3534
|
-
|
|
3577
|
+
U.delete(t);
|
|
3535
3578
|
},
|
|
3536
3579
|
get(t) {
|
|
3537
3580
|
if (t !== void 0)
|
|
3538
|
-
return typeof t == "function" ? t :
|
|
3581
|
+
return typeof t == "function" ? t : U.get(t) ?? ae[t];
|
|
3539
3582
|
},
|
|
3540
3583
|
run(t, e, o, n) {
|
|
3541
3584
|
const i = this.get(t);
|
|
3542
3585
|
return i ? i(e, o, n) : void 0;
|
|
3543
3586
|
},
|
|
3544
3587
|
has(t) {
|
|
3545
|
-
return
|
|
3588
|
+
return U.has(t) || t in ae;
|
|
3546
3589
|
},
|
|
3547
3590
|
list() {
|
|
3548
|
-
return [...Object.keys(
|
|
3591
|
+
return [...Object.keys(ae), ...U.keys()];
|
|
3549
3592
|
}
|
|
3550
|
-
},
|
|
3593
|
+
}, Oe = {
|
|
3551
3594
|
sum: (t) => t.reduce((e, o) => e + o, 0),
|
|
3552
3595
|
avg: (t) => t.length ? t.reduce((e, o) => e + o, 0) / t.length : 0,
|
|
3553
3596
|
count: (t) => t.length,
|
|
@@ -3556,46 +3599,46 @@ const co = {
|
|
|
3556
3599
|
first: (t) => t[0] ?? 0,
|
|
3557
3600
|
last: (t) => t[t.length - 1] ?? 0
|
|
3558
3601
|
};
|
|
3559
|
-
function
|
|
3560
|
-
return
|
|
3602
|
+
function lo(t) {
|
|
3603
|
+
return Oe[t] ?? Oe.sum;
|
|
3561
3604
|
}
|
|
3562
|
-
function
|
|
3563
|
-
return
|
|
3605
|
+
function mo(t, e) {
|
|
3606
|
+
return lo(t)(e);
|
|
3564
3607
|
}
|
|
3565
|
-
const
|
|
3608
|
+
const bo = M.register.bind(M), vo = M.unregister.bind(M), Co = M.get.bind(M), yo = M.run.bind(M), _o = M.list.bind(M);
|
|
3566
3609
|
export {
|
|
3567
|
-
|
|
3568
|
-
|
|
3610
|
+
co as BaseGridPlugin,
|
|
3611
|
+
je as DEFAULT_ANIMATION_CONFIG,
|
|
3569
3612
|
z as DEFAULT_GRID_ICONS,
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3613
|
+
go as DGEvents,
|
|
3614
|
+
L as DataGridElement,
|
|
3615
|
+
G as FitModeEnum,
|
|
3616
|
+
uo as GridCSSVars,
|
|
3574
3617
|
A as GridClasses,
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3618
|
+
Q as GridDataAttrs,
|
|
3619
|
+
L as GridElement,
|
|
3620
|
+
ho as GridSelectors,
|
|
3621
|
+
ao as PLUGIN_QUERIES,
|
|
3622
|
+
wo as PluginEvents,
|
|
3623
|
+
so as PluginManager,
|
|
3581
3624
|
x as RenderPhase,
|
|
3582
|
-
|
|
3625
|
+
Dt as a,
|
|
3583
3626
|
M as aggregatorRegistry,
|
|
3584
3627
|
$ as b,
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3628
|
+
St as builtInSort,
|
|
3629
|
+
he as c,
|
|
3630
|
+
fo as createGrid,
|
|
3631
|
+
Et as defaultComparator,
|
|
3632
|
+
Me as e,
|
|
3633
|
+
ke as g,
|
|
3634
|
+
Co as getAggregator,
|
|
3635
|
+
lo as getValueAggregator,
|
|
3636
|
+
_o as listAggregators,
|
|
3637
|
+
po as queryGrid,
|
|
3638
|
+
bo as registerAggregator,
|
|
3639
|
+
yo as runAggregator,
|
|
3640
|
+
mo as runValueAggregator,
|
|
3641
|
+
F as s,
|
|
3642
|
+
vo as unregisterAggregator
|
|
3600
3643
|
};
|
|
3601
3644
|
//# sourceMappingURL=index.js.map
|