@toolbox-web/grid 1.6.2 → 1.7.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.js +9 -8
- package/all.js.map +1 -1
- package/index.js +668 -583
- package/index.js.map +1 -1
- package/lib/core/grid.d.ts +46 -0
- package/lib/core/grid.d.ts.map +1 -1
- package/lib/core/types.d.ts +114 -0
- package/lib/core/types.d.ts.map +1 -1
- package/lib/plugins/clipboard/index.js.map +1 -1
- package/lib/plugins/column-virtualization/index.js.map +1 -1
- package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
- package/lib/plugins/context-menu/index.js +72 -71
- package/lib/plugins/context-menu/index.js.map +1 -1
- package/lib/plugins/editing/index.js.map +1 -1
- package/lib/plugins/export/index.js.map +1 -1
- package/lib/plugins/filtering/index.js.map +1 -1
- package/lib/plugins/grouping-columns/index.js.map +1 -1
- package/lib/plugins/grouping-rows/index.js.map +1 -1
- package/lib/plugins/master-detail/index.js.map +1 -1
- package/lib/plugins/multi-sort/index.js.map +1 -1
- package/lib/plugins/pinned-columns/index.js.map +1 -1
- package/lib/plugins/pinned-rows/index.js.map +1 -1
- package/lib/plugins/pivot/index.js.map +1 -1
- package/lib/plugins/print/PrintPlugin.d.ts.map +1 -1
- package/lib/plugins/print/index.js +1 -1
- package/lib/plugins/print/index.js.map +1 -1
- package/lib/plugins/reorder/index.js.map +1 -1
- package/lib/plugins/responsive/index.js.map +1 -1
- package/lib/plugins/row-reorder/index.js.map +1 -1
- package/lib/plugins/selection/index.js.map +1 -1
- package/lib/plugins/server-side/index.js.map +1 -1
- package/lib/plugins/tree/index.js.map +1 -1
- package/lib/plugins/undo-redo/index.js.map +1 -1
- package/lib/plugins/visibility/index.js.map +1 -1
- package/package.json +1 -1
- package/public.d.ts +1 -1
- package/public.d.ts.map +1 -1
- package/umd/grid.all.umd.js +13 -13
- 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/context-menu.umd.js +1 -1
- package/umd/plugins/context-menu.umd.js.map +1 -1
- package/umd/plugins/print.umd.js +1 -1
- package/umd/plugins/print.umd.js.map +1 -1
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const ge = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-scrollbar-thumb: var(--tbw-color-border-strong);--tbw-scrollbar-track: var(--tbw-color-bg);--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator],&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}', X = {
|
|
1
|
+
const ge = '@layer tbw-base,tbw-plugins,tbw-theme;@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm);color-scheme:light dark;position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);text-transform:var(--tbw-header-text-transform);letter-spacing:var(--tbw-header-letter-spacing);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;color:var(--tbw-sort-indicator-color);display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible;opacity:1;color:var(--tbw-sort-indicator-active-color)}&:last-child{border-right:0}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.tbw-grid-root{position:relative;display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;content-visibility:auto;contain-intrinsic-size:auto var(--tbw-row-height);&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);line-height:calc(var(--tbw-row-height) - 5px);border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:left;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}@keyframes tbw-spin{to{transform:rotate(360deg)}}.tbw-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:1000;pointer-events:all;animation:tbw-fade-in .15s ease-out}@keyframes tbw-fade-in{0%{opacity:0}to{opacity:1}}.tbw-spinner{--tbw-spinner-size: 48px;--tbw-spinner-border-width: 3px;--tbw-spinner-color: var(--tbw-color-accent);--tbw-spinner-track-color: var(--tbw-color-border);width:var(--tbw-spinner-size);height:var(--tbw-spinner-size);border:var(--tbw-spinner-border-width) solid var(--tbw-spinner-track-color);border-top-color:var(--tbw-spinner-color);border-radius:50%;animation:tbw-spin .8s linear infinite}.tbw-spinner--large{--tbw-spinner-size: min(48px, calc(100% - 16px) )}.tbw-spinner--small{--tbw-spinner-size: calc(var(--tbw-row-height, 28px) * .6);--tbw-spinner-border-width: 2px}.data-grid-row.tbw-row-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .6);content:"";position:absolute;left:var(--tbw-spacing-md);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}.cell.tbw-cell-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .5);content:"";position:absolute;left:var(--tbw-spacing-sm);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}}', X = {
|
|
2
2
|
STRETCH: "stretch",
|
|
3
3
|
FIXED: "fixed"
|
|
4
4
|
}, Ze = {
|
|
5
5
|
mode: "reduced-motion",
|
|
6
6
|
duration: 200,
|
|
7
7
|
easing: "ease-out"
|
|
8
|
-
}, we = '<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>',
|
|
8
|
+
}, we = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', k = {
|
|
9
9
|
expand: "▶",
|
|
10
10
|
collapse: "▼",
|
|
11
11
|
sortAsc: "▲",
|
|
@@ -22,40 +22,40 @@ function Je(t) {
|
|
|
22
22
|
return Array.from(t.querySelectorAll("tbw-grid-column")).map((o) => {
|
|
23
23
|
const n = o.getAttribute("field") || "";
|
|
24
24
|
if (!n) return null;
|
|
25
|
-
const i = o.getAttribute("type") || void 0, s = i && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(i) ? i : void 0, l = o.getAttribute("header") || void 0,
|
|
25
|
+
const i = o.getAttribute("type") || void 0, s = i && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(i) ? i : void 0, l = o.getAttribute("header") || void 0, a = o.hasAttribute("sortable"), c = o.hasAttribute("editable"), h = { field: n, type: s, header: l, sortable: a, editable: c }, u = o.getAttribute("width");
|
|
26
26
|
if (u) {
|
|
27
|
-
const
|
|
28
|
-
!isNaN(
|
|
27
|
+
const m = parseFloat(u);
|
|
28
|
+
!isNaN(m) && /^\d+(\.\d+)?$/.test(u.trim()) ? h.width = m : h.width = u;
|
|
29
29
|
}
|
|
30
30
|
const p = o.getAttribute("minWidth") || o.getAttribute("min-width");
|
|
31
31
|
if (p) {
|
|
32
|
-
const
|
|
33
|
-
isNaN(
|
|
32
|
+
const m = parseFloat(p);
|
|
33
|
+
isNaN(m) || (h.minWidth = m);
|
|
34
34
|
}
|
|
35
35
|
o.hasAttribute("resizable") && (h.resizable = !0), o.hasAttribute("sizable") && (h.resizable = !0);
|
|
36
36
|
const f = o.getAttribute("editor"), g = o.getAttribute("renderer");
|
|
37
37
|
f && (h.__editorName = f), g && (h.__rendererName = g);
|
|
38
38
|
const d = o.getAttribute("options");
|
|
39
|
-
d && (h.options = d.split(",").map((
|
|
40
|
-
const [
|
|
41
|
-
return { value:
|
|
39
|
+
d && (h.options = d.split(",").map((m) => {
|
|
40
|
+
const [M, R] = m.includes(":") ? m.split(":") : [m.trim(), m.trim()];
|
|
41
|
+
return { value: M.trim(), label: R?.trim() || M.trim() };
|
|
42
42
|
}));
|
|
43
|
-
const w = o.querySelector("tbw-grid-column-view"),
|
|
44
|
-
w && (h.__viewTemplate = w),
|
|
45
|
-
const _ = globalThis.DataGridElement?.getAdapters?.() ?? [],
|
|
43
|
+
const w = o.querySelector("tbw-grid-column-view"), b = o.querySelector("tbw-grid-column-editor"), S = o.querySelector("tbw-grid-column-header");
|
|
44
|
+
w && (h.__viewTemplate = w), b && (h.__editorTemplate = b), S && (h.__headerTemplate = S);
|
|
45
|
+
const _ = globalThis.DataGridElement?.getAdapters?.() ?? [], T = w ?? o, v = _.find((m) => m.canHandle(T));
|
|
46
46
|
if (v) {
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const m = v.createRenderer(T);
|
|
48
|
+
m && (h.viewRenderer = m);
|
|
49
49
|
}
|
|
50
|
-
const E =
|
|
50
|
+
const E = b ?? o, y = _.find((m) => m.canHandle(E));
|
|
51
51
|
if (y) {
|
|
52
|
-
const
|
|
53
|
-
|
|
52
|
+
const m = y.createEditor(E);
|
|
53
|
+
m && (h.editor = m);
|
|
54
54
|
}
|
|
55
55
|
return h;
|
|
56
56
|
}).filter((o) => !!o);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function be(t, e) {
|
|
59
59
|
if ((!t || !t.length) && (!e || !e.length)) return [];
|
|
60
60
|
if (!t || !t.length) return e || [];
|
|
61
61
|
if (!e || !e.length) return t;
|
|
@@ -74,12 +74,12 @@ function me(t, e) {
|
|
|
74
74
|
if (!r) return i;
|
|
75
75
|
const s = { ...i };
|
|
76
76
|
r.header && !s.header && (s.header = r.header), r.type && !s.type && (s.type = r.type), s.sortable = i.sortable || r.sortable, (i.resizable === !0 || r.resizable === !0) && (s.resizable = !0), s.editable = i.editable || r.editable, r.width != null && s.width == null && (s.width = r.width), r.minWidth != null && s.minWidth == null && (s.minWidth = r.minWidth), r.__viewTemplate && (s.__viewTemplate = r.__viewTemplate), r.__editorTemplate && (s.__editorTemplate = r.__editorTemplate), r.__headerTemplate && (s.__headerTemplate = r.__headerTemplate);
|
|
77
|
-
const l = r.renderer || r.viewRenderer,
|
|
78
|
-
return l && !
|
|
77
|
+
const l = r.renderer || r.viewRenderer, a = s.renderer || s.viewRenderer;
|
|
78
|
+
return l && !a && (s.viewRenderer = l, r.renderer && (s.renderer = l)), r.editor && !s.editor && (s.editor = r.editor), delete o[i.field], s;
|
|
79
79
|
});
|
|
80
80
|
return Object.keys(o).forEach((i) => n.push(o[i])), n;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function ze(t, e) {
|
|
83
83
|
try {
|
|
84
84
|
t.part?.add?.(e);
|
|
85
85
|
} catch {
|
|
@@ -87,7 +87,7 @@ function Me(t, e) {
|
|
|
87
87
|
const o = t.getAttribute("part");
|
|
88
88
|
o ? o.split(/\s+/).includes(e) || t.setAttribute("part", o + " " + e) : t.setAttribute("part", e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function me(t) {
|
|
91
91
|
const e = t.effectiveConfig?.fitMode || t.fitMode || X.STRETCH;
|
|
92
92
|
if (e !== X.STRETCH && e !== X.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
|
|
93
93
|
const o = Array.from(t._headerRowEl?.children || []);
|
|
@@ -97,10 +97,10 @@ function be(t) {
|
|
|
97
97
|
if (i.width) return;
|
|
98
98
|
const s = o[r];
|
|
99
99
|
let l = s ? s.scrollWidth : 0;
|
|
100
|
-
for (const
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
const h =
|
|
100
|
+
for (const a of t._rowPool) {
|
|
101
|
+
const c = a.children[r];
|
|
102
|
+
if (c) {
|
|
103
|
+
const h = c.scrollWidth;
|
|
104
104
|
h > l && (l = h);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -196,11 +196,11 @@ function at(t) {
|
|
|
196
196
|
}
|
|
197
197
|
e.forEach((n) => n.remove());
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function Me(t, e) {
|
|
200
200
|
if (!t || t.indexOf("{{") === -1) return t;
|
|
201
|
-
const o = [], n = t.replace(tt, (l,
|
|
202
|
-
const
|
|
203
|
-
return o.push({ expr:
|
|
201
|
+
const o = [], n = t.replace(tt, (l, a) => {
|
|
202
|
+
const c = ct(a, e);
|
|
203
|
+
return o.push({ expr: a.trim(), result: c }), c;
|
|
204
204
|
}), i = dt(n), r = o.length && o.every((l) => l.result === "" || l.result === O);
|
|
205
205
|
return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : i;
|
|
206
206
|
}
|
|
@@ -237,7 +237,7 @@ function ht(t) {
|
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
function Ce(t) {
|
|
240
|
-
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" :
|
|
240
|
+
const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), o = ((n) => e ? "" : Me(t, n));
|
|
241
241
|
return o.__blocked = e, o;
|
|
242
242
|
}
|
|
243
243
|
const ut = 100;
|
|
@@ -248,14 +248,14 @@ class ft {
|
|
|
248
248
|
#d;
|
|
249
249
|
#h;
|
|
250
250
|
#a = {};
|
|
251
|
-
#
|
|
251
|
+
#o = {};
|
|
252
252
|
#f = !0;
|
|
253
253
|
#g = [];
|
|
254
|
-
#
|
|
254
|
+
#m;
|
|
255
255
|
#s;
|
|
256
256
|
#v;
|
|
257
257
|
#r;
|
|
258
|
-
#
|
|
258
|
+
#b;
|
|
259
259
|
constructor(e) {
|
|
260
260
|
this.#r = e;
|
|
261
261
|
}
|
|
@@ -263,13 +263,13 @@ class ft {
|
|
|
263
263
|
return this.#a;
|
|
264
264
|
}
|
|
265
265
|
get effective() {
|
|
266
|
-
return this.#
|
|
266
|
+
return this.#o;
|
|
267
267
|
}
|
|
268
268
|
get columns() {
|
|
269
|
-
return this.#
|
|
269
|
+
return this.#o.columns ?? [];
|
|
270
270
|
}
|
|
271
271
|
set columns(e) {
|
|
272
|
-
this.#
|
|
272
|
+
this.#o.columns = e;
|
|
273
273
|
}
|
|
274
274
|
get lightDomColumnsCache() {
|
|
275
275
|
return this.#d;
|
|
@@ -284,10 +284,10 @@ class ft {
|
|
|
284
284
|
this.#h = e;
|
|
285
285
|
}
|
|
286
286
|
get lightDomTitle() {
|
|
287
|
-
return this.#
|
|
287
|
+
return this.#b;
|
|
288
288
|
}
|
|
289
289
|
set lightDomTitle(e) {
|
|
290
|
-
this.#
|
|
290
|
+
this.#b = e;
|
|
291
291
|
}
|
|
292
292
|
get initialColumnState() {
|
|
293
293
|
return this.#v;
|
|
@@ -320,13 +320,13 @@ class ft {
|
|
|
320
320
|
return this.#u;
|
|
321
321
|
}
|
|
322
322
|
merge() {
|
|
323
|
-
const e = (this.#
|
|
323
|
+
const e = (this.#o.columns?.length ?? 0) > 0;
|
|
324
324
|
if (!this.#f && e)
|
|
325
325
|
return;
|
|
326
326
|
const o = this.#w();
|
|
327
|
-
this.#f = !1, this.#a = o, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#
|
|
327
|
+
this.#f = !1, this.#a = o, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#o = this.#R(this.#a), this.#H();
|
|
328
328
|
}
|
|
329
|
-
#
|
|
329
|
+
#R(e) {
|
|
330
330
|
const o = { ...e };
|
|
331
331
|
return e.columns && (o.columns = e.columns.map((n) => ({ ...n }))), e.shell && (o.shell = {
|
|
332
332
|
...e.shell,
|
|
@@ -336,8 +336,8 @@ class ft {
|
|
|
336
336
|
headerContents: e.shell.headerContents?.map((n) => ({ ...n }))
|
|
337
337
|
}), o;
|
|
338
338
|
}
|
|
339
|
-
#
|
|
340
|
-
const e = this.#
|
|
339
|
+
#H() {
|
|
340
|
+
const e = this.#o;
|
|
341
341
|
e.rowHeight && e.rowHeight > 0 && this.#r.setRowHeight(e.rowHeight), e.fitMode === "fixed" && this.columns.forEach((n) => {
|
|
342
342
|
n.width == null && (n.width = 80);
|
|
343
343
|
}), this.#r.applyAnimationConfig(e);
|
|
@@ -346,11 +346,11 @@ class ft {
|
|
|
346
346
|
const e = this.#l ? { ...this.#l } : {}, o = Array.isArray(e.columns) ? [...e.columns] : [], n = (this.#d ?? []).map((s) => ({
|
|
347
347
|
...s
|
|
348
348
|
}));
|
|
349
|
-
let i =
|
|
349
|
+
let i = be(
|
|
350
350
|
o,
|
|
351
351
|
n
|
|
352
352
|
);
|
|
353
|
-
this.#i && this.#i.length && (i =
|
|
353
|
+
this.#i && this.#i.length && (i = be(
|
|
354
354
|
this.#i,
|
|
355
355
|
n
|
|
356
356
|
));
|
|
@@ -364,7 +364,7 @@ class ft {
|
|
|
364
364
|
#C(e) {
|
|
365
365
|
e.shell = e.shell ? { ...e.shell } : {}, e.shell.header = e.shell.header ? { ...e.shell.header } : {};
|
|
366
366
|
const o = this.#r.getShellLightDomTitle();
|
|
367
|
-
o && (this.#
|
|
367
|
+
o && (this.#b = o), this.#b && !e.shell.header.title && (e.shell.header.title = this.#b);
|
|
368
368
|
const n = this.#r.getShellLightDomHeaderContent();
|
|
369
369
|
n?.length > 0 && (e.shell.header.lightDomContent = n), this.#r.getShellHasToolButtonsContainer() && (e.shell.header.hasToolButtonsContainer = !0);
|
|
370
370
|
const i = this.#r.getShellToolPanels();
|
|
@@ -377,9 +377,9 @@ class ft {
|
|
|
377
377
|
const u = Array.from(r.values());
|
|
378
378
|
u.sort((p, f) => (p.order ?? 100) - (f.order ?? 100)), e.shell.headerContents = u;
|
|
379
379
|
}
|
|
380
|
-
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()),
|
|
380
|
+
const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((u) => u.id)), h = [...a];
|
|
381
381
|
for (const u of l)
|
|
382
|
-
|
|
382
|
+
c.has(u.id) || h.push(u);
|
|
383
383
|
h.sort((u, p) => (u.order ?? 0) - (p.order ?? 0)), e.shell.header.toolbarContents = h;
|
|
384
384
|
}
|
|
385
385
|
collectState(e) {
|
|
@@ -392,11 +392,11 @@ class ft {
|
|
|
392
392
|
visible: !i.hidden
|
|
393
393
|
}, l = i;
|
|
394
394
|
l.__renderedWidth !== void 0 ? s.width = l.__renderedWidth : i.width !== void 0 && (s.width = typeof i.width == "string" ? parseFloat(i.width) : i.width);
|
|
395
|
-
const
|
|
396
|
-
|
|
397
|
-
for (const
|
|
398
|
-
if (
|
|
399
|
-
const h =
|
|
395
|
+
const a = n.get(i.field);
|
|
396
|
+
a && (s.sort = a);
|
|
397
|
+
for (const c of e)
|
|
398
|
+
if (c.getColumnState) {
|
|
399
|
+
const h = c.getColumnState(i.field);
|
|
400
400
|
h && Object.assign(s, h);
|
|
401
401
|
}
|
|
402
402
|
return s;
|
|
@@ -406,16 +406,16 @@ class ft {
|
|
|
406
406
|
applyState(e, o) {
|
|
407
407
|
if (!e.columns || e.columns.length === 0) return;
|
|
408
408
|
const n = this.columns, i = new Map(e.columns.map((l) => [l.field, l])), r = n.map((l) => {
|
|
409
|
-
const
|
|
410
|
-
if (!
|
|
411
|
-
const
|
|
412
|
-
return
|
|
409
|
+
const a = i.get(l.field);
|
|
410
|
+
if (!a) return l;
|
|
411
|
+
const c = { ...l };
|
|
412
|
+
return a.width !== void 0 && (c.width = a.width, c.__renderedWidth = a.width), a.visible !== void 0 && (c.hidden = !a.visible), c;
|
|
413
413
|
});
|
|
414
|
-
r.sort((l,
|
|
415
|
-
const
|
|
416
|
-
return
|
|
414
|
+
r.sort((l, a) => {
|
|
415
|
+
const c = i.get(l.field)?.order ?? 1 / 0, h = i.get(a.field)?.order ?? 1 / 0;
|
|
416
|
+
return c - h;
|
|
417
417
|
}), this.columns = r;
|
|
418
|
-
const s = e.columns.filter((l) => l.sort !== void 0).sort((l,
|
|
418
|
+
const s = e.columns.filter((l) => l.sort !== void 0).sort((l, a) => (l.sort?.priority ?? 0) - (a.sort?.priority ?? 0));
|
|
419
419
|
if (s.length > 0) {
|
|
420
420
|
const l = s[0];
|
|
421
421
|
l.sort && this.#r.setSortState({
|
|
@@ -426,11 +426,11 @@ class ft {
|
|
|
426
426
|
this.#r.setSortState(null);
|
|
427
427
|
for (const l of o)
|
|
428
428
|
if (l.applyColumnState)
|
|
429
|
-
for (const
|
|
430
|
-
l.applyColumnState(
|
|
429
|
+
for (const a of e.columns)
|
|
430
|
+
l.applyColumnState(a.field, a);
|
|
431
431
|
}
|
|
432
432
|
resetState(e) {
|
|
433
|
-
this.#v = void 0, this.#r.setSortState(null), this.#
|
|
433
|
+
this.#v = void 0, this.#r.setSortState(null), this.#o = this.#R(this.#a), this.#H();
|
|
434
434
|
for (const o of e)
|
|
435
435
|
if (o.applyColumnState)
|
|
436
436
|
for (const n of this.columns)
|
|
@@ -514,7 +514,7 @@ class ft {
|
|
|
514
514
|
this.#p.delete(e.toLowerCase());
|
|
515
515
|
}
|
|
516
516
|
observeLightDOM(e) {
|
|
517
|
-
this.#
|
|
517
|
+
this.#m && this.#m.disconnect();
|
|
518
518
|
const o = /* @__PURE__ */ new Set();
|
|
519
519
|
let n = null;
|
|
520
520
|
const i = () => {
|
|
@@ -523,20 +523,20 @@ class ft {
|
|
|
523
523
|
this.#p.get(r)?.();
|
|
524
524
|
o.clear();
|
|
525
525
|
};
|
|
526
|
-
this.#
|
|
526
|
+
this.#m = new MutationObserver((r) => {
|
|
527
527
|
for (const s of r) {
|
|
528
528
|
for (const l of s.addedNodes) {
|
|
529
529
|
if (l.nodeType !== Node.ELEMENT_NODE) continue;
|
|
530
|
-
const
|
|
531
|
-
this.#p.has(
|
|
530
|
+
const c = l.tagName.toLowerCase();
|
|
531
|
+
this.#p.has(c) && o.add(c);
|
|
532
532
|
}
|
|
533
533
|
if (s.type === "attributes" && s.target.nodeType === Node.ELEMENT_NODE) {
|
|
534
|
-
const
|
|
535
|
-
this.#p.has(
|
|
534
|
+
const a = s.target.tagName.toLowerCase();
|
|
535
|
+
this.#p.has(a) && o.add(a);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
o.size > 0 && !n && (n = setTimeout(i, 0));
|
|
539
|
-
}), this.#
|
|
539
|
+
}), this.#m.observe(e, {
|
|
540
540
|
childList: !0,
|
|
541
541
|
subtree: !0,
|
|
542
542
|
attributes: !0,
|
|
@@ -551,13 +551,13 @@ class ft {
|
|
|
551
551
|
e();
|
|
552
552
|
}
|
|
553
553
|
dispose() {
|
|
554
|
-
this.#
|
|
554
|
+
this.#m?.disconnect(), this.#g = [], this.#s && clearTimeout(this.#s);
|
|
555
555
|
}
|
|
556
556
|
}
|
|
557
|
-
function
|
|
557
|
+
function ke(t) {
|
|
558
558
|
return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "🗹" : "☐"}</span>`;
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Ne(t) {
|
|
561
561
|
if (t == null || t === "") return "";
|
|
562
562
|
if (t instanceof Date)
|
|
563
563
|
return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
|
|
@@ -635,10 +635,10 @@ function wt() {
|
|
|
635
635
|
function j(t) {
|
|
636
636
|
t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
639
|
-
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns,
|
|
640
|
-
let
|
|
641
|
-
for (
|
|
638
|
+
function bt(t, e, o, n, i) {
|
|
639
|
+
const r = Math.max(0, o - e), s = t._bodyEl, l = t._visibleColumns, a = l.length;
|
|
640
|
+
let c = t.__cachedHeaderRowCount;
|
|
641
|
+
for (c === void 0 && (c = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
|
|
642
642
|
const p = wt();
|
|
643
643
|
t._rowPool.push(p);
|
|
644
644
|
}
|
|
@@ -652,28 +652,28 @@ function mt(t, e, o, n, i) {
|
|
|
652
652
|
const h = i && t.__hasRenderRowPlugins !== !1, u = t._hasAfterRowRenderHook?.() ?? !1;
|
|
653
653
|
for (let p = 0; p < r; p++) {
|
|
654
654
|
const f = e + p, g = t._rows[f], d = t._rowPool[p];
|
|
655
|
-
if (d.setAttribute("aria-rowindex", String(f +
|
|
655
|
+
if (d.setAttribute("aria-rowindex", String(f + c + 1)), h && i(g, d, f)) {
|
|
656
656
|
d.__epoch = n, d.__rowDataRef = g, d.parentNode !== s && s.appendChild(d);
|
|
657
657
|
continue;
|
|
658
658
|
}
|
|
659
|
-
const w = d.__epoch,
|
|
659
|
+
const w = d.__epoch, b = d.__rowDataRef, S = d.children.length, _ = w === n && S === a, T = b !== g;
|
|
660
660
|
let v = !1;
|
|
661
|
-
if (_ &&
|
|
662
|
-
for (let R = 0; R <
|
|
661
|
+
if (_ && T) {
|
|
662
|
+
for (let R = 0; R < a; R++)
|
|
663
663
|
if (l[R].externalView && !d.querySelector(`.cell[data-col="${R}"] [data-external-view]`)) {
|
|
664
664
|
v = !0;
|
|
665
665
|
break;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
if (!_ || v) {
|
|
669
|
-
const R = ie(d),
|
|
670
|
-
R && !
|
|
671
|
-
} else if (
|
|
672
|
-
const R = ie(d),
|
|
673
|
-
R && !
|
|
669
|
+
const R = ie(d), x = t._activeEditRows === f;
|
|
670
|
+
R && !x ? (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), re(d), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : R && x ? (se(t, d, g, f), d.__rowDataRef = g) : (d.__isCustomRow && (d.className = "data-grid-row", d.setAttribute("role", "row"), d.__isCustomRow = !1), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g);
|
|
671
|
+
} else if (T) {
|
|
672
|
+
const R = ie(d), x = t._activeEditRows === f;
|
|
673
|
+
R && !x ? (re(d), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : (se(t, d, g, f), d.__rowDataRef = g);
|
|
674
674
|
} else {
|
|
675
|
-
const R = ie(d),
|
|
676
|
-
R && !
|
|
675
|
+
const R = ie(d), x = t._activeEditRows === f;
|
|
676
|
+
R && !x ? (re(d), G(t, d, g, f), d.__epoch = n, d.__rowDataRef = g) : se(t, d, g, f);
|
|
677
677
|
}
|
|
678
678
|
let E = !1;
|
|
679
679
|
const y = t.changedRowIds;
|
|
@@ -683,21 +683,21 @@ function mt(t, e, o, n, i) {
|
|
|
683
683
|
R && (E = y.includes(R));
|
|
684
684
|
} catch {
|
|
685
685
|
}
|
|
686
|
-
const
|
|
687
|
-
E !==
|
|
688
|
-
const
|
|
689
|
-
if (
|
|
686
|
+
const m = d.classList.contains("changed");
|
|
687
|
+
E !== m && d.classList.toggle("changed", E);
|
|
688
|
+
const M = t.effectiveConfig?.rowClass;
|
|
689
|
+
if (M) {
|
|
690
690
|
const R = d.getAttribute("data-dynamic-classes");
|
|
691
|
-
R && R.split(" ").forEach((
|
|
691
|
+
R && R.split(" ").forEach((x) => x && d.classList.remove(x));
|
|
692
692
|
try {
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const ne =
|
|
693
|
+
const x = M(g);
|
|
694
|
+
if (x && x.length > 0) {
|
|
695
|
+
const ne = x.filter((Y) => Y && typeof Y == "string");
|
|
696
696
|
ne.forEach((Y) => d.classList.add(Y)), d.setAttribute("data-dynamic-classes", ne.join(" "));
|
|
697
697
|
} else
|
|
698
698
|
d.removeAttribute("data-dynamic-classes");
|
|
699
|
-
} catch (
|
|
700
|
-
console.warn("[tbw-grid] rowClass callback error:",
|
|
699
|
+
} catch (x) {
|
|
700
|
+
console.warn("[tbw-grid] rowClass callback error:", x), d.removeAttribute("data-dynamic-classes");
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
u && t._afterRowRender?.({
|
|
@@ -708,14 +708,14 @@ function mt(t, e, o, n, i) {
|
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
710
|
function se(t, e, o, n) {
|
|
711
|
-
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length,
|
|
711
|
+
const i = e.children, r = t._visibleColumns, s = r.length, l = i.length, a = s < l ? s : l, c = t._focusRow, h = t._focusCol, u = t._hasAfterCellRenderHook?.() ?? !1;
|
|
712
712
|
let p = t.__hasSpecialColumns;
|
|
713
713
|
if (p === void 0) {
|
|
714
714
|
p = !1;
|
|
715
715
|
const g = t.effectiveConfig?.typeDefaults, d = t.__frameworkAdapter;
|
|
716
716
|
for (let w = 0; w < s; w++) {
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
717
|
+
const b = r[w];
|
|
718
|
+
if (b.__viewTemplate || b.__compiledView || b.renderer || b.viewRenderer || b.externalView || b.format || b.type === "date" || b.type === "boolean" || b.type && g?.[b.type]?.renderer || b.type && g?.[b.type]?.format || b.type && d?.getTypeDefault?.(b.type)?.renderer || b.type && d?.getTypeDefault?.(b.type)?.format) {
|
|
719
719
|
p = !0;
|
|
720
720
|
break;
|
|
721
721
|
}
|
|
@@ -724,60 +724,60 @@ function se(t, e, o, n) {
|
|
|
724
724
|
}
|
|
725
725
|
const f = String(n);
|
|
726
726
|
if (!p) {
|
|
727
|
-
for (let g = 0; g <
|
|
727
|
+
for (let g = 0; g < a; g++) {
|
|
728
728
|
const d = i[g];
|
|
729
729
|
if (d.classList.contains("editing")) continue;
|
|
730
|
-
const w = r[g],
|
|
731
|
-
d.textContent =
|
|
732
|
-
const S =
|
|
730
|
+
const w = r[g], b = o[w.field];
|
|
731
|
+
d.textContent = b == null ? "" : String(b), d.getAttribute("data-row") !== f && d.setAttribute("data-row", f);
|
|
732
|
+
const S = c === n && h === g, C = d.classList.contains("cell-focus");
|
|
733
733
|
S !== C && (d.classList.toggle("cell-focus", S), d.setAttribute("aria-selected", String(S))), u && t._afterCellRender?.({
|
|
734
734
|
row: o,
|
|
735
735
|
rowIndex: n,
|
|
736
736
|
column: w,
|
|
737
737
|
colIndex: g,
|
|
738
|
-
value:
|
|
738
|
+
value: b,
|
|
739
739
|
cellElement: d,
|
|
740
740
|
rowElement: e
|
|
741
741
|
});
|
|
742
742
|
}
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
|
-
for (let g = 0; g <
|
|
745
|
+
for (let g = 0; g < a; g++)
|
|
746
746
|
if (r[g].externalView && !i[g].querySelector("[data-external-view]")) {
|
|
747
747
|
G(t, e, o, n);
|
|
748
748
|
return;
|
|
749
749
|
}
|
|
750
|
-
for (let g = 0; g <
|
|
750
|
+
for (let g = 0; g < a; g++) {
|
|
751
751
|
const d = r[g], w = i[g];
|
|
752
752
|
w.getAttribute("data-row") !== f && w.setAttribute("data-row", f);
|
|
753
|
-
const
|
|
754
|
-
|
|
753
|
+
const b = c === n && h === g, S = w.classList.contains("cell-focus");
|
|
754
|
+
b !== S && (w.classList.toggle("cell-focus", b), w.setAttribute("aria-selected", String(b)));
|
|
755
755
|
const C = d.cellClass;
|
|
756
756
|
if (C) {
|
|
757
757
|
const y = w.getAttribute("data-dynamic-classes");
|
|
758
|
-
y && y.split(" ").forEach((
|
|
758
|
+
y && y.split(" ").forEach((m) => m && w.classList.remove(m));
|
|
759
759
|
try {
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
762
|
-
const R =
|
|
763
|
-
R.forEach((
|
|
760
|
+
const m = o[d.field], M = C(m, o, d);
|
|
761
|
+
if (M && M.length > 0) {
|
|
762
|
+
const R = M.filter((x) => x && typeof x == "string");
|
|
763
|
+
R.forEach((x) => w.classList.add(x)), w.setAttribute("data-dynamic-classes", R.join(" "));
|
|
764
764
|
} else
|
|
765
765
|
w.removeAttribute("data-dynamic-classes");
|
|
766
|
-
} catch (
|
|
767
|
-
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`,
|
|
766
|
+
} catch (m) {
|
|
767
|
+
console.warn(`[tbw-grid] cellClass callback error for column '${d.field}':`, m), w.removeAttribute("data-dynamic-classes");
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
if (w.classList.contains("editing")) continue;
|
|
771
771
|
const _ = qe(t, d);
|
|
772
772
|
if (_) {
|
|
773
|
-
const y = o[d.field],
|
|
773
|
+
const y = o[d.field], m = _({
|
|
774
774
|
row: o,
|
|
775
775
|
value: y,
|
|
776
776
|
field: d.field,
|
|
777
777
|
column: d,
|
|
778
778
|
cellEl: w
|
|
779
779
|
});
|
|
780
|
-
typeof
|
|
780
|
+
typeof m == "string" ? w.innerHTML = F(m) : m instanceof Node ? m.parentElement !== w && (w.innerHTML = "", w.appendChild(m)) : m == null && (w.textContent = y == null ? "" : String(y)), u && t._afterCellRender?.({
|
|
781
781
|
row: o,
|
|
782
782
|
rowIndex: n,
|
|
783
783
|
column: d,
|
|
@@ -790,23 +790,23 @@ function se(t, e, o, n) {
|
|
|
790
790
|
}
|
|
791
791
|
if (d.__viewTemplate || d.__compiledView || d.externalView)
|
|
792
792
|
continue;
|
|
793
|
-
const
|
|
793
|
+
const T = o[d.field];
|
|
794
794
|
let v;
|
|
795
795
|
const E = We(t, d);
|
|
796
796
|
if (E)
|
|
797
797
|
try {
|
|
798
|
-
const y = E(
|
|
798
|
+
const y = E(T, o);
|
|
799
799
|
v = y == null ? "" : String(y);
|
|
800
800
|
} catch (y) {
|
|
801
|
-
console.warn(`[tbw-grid] Format error in column '${d.field}':`, y), v =
|
|
801
|
+
console.warn(`[tbw-grid] Format error in column '${d.field}':`, y), v = T == null ? "" : String(T);
|
|
802
802
|
}
|
|
803
|
-
else d.type === "date" ? (v =
|
|
803
|
+
else d.type === "date" ? (v = Ne(T), w.textContent = v) : d.type === "boolean" ? w.innerHTML = ke(!!T) : (v = T == null ? "" : String(T), w.textContent = v);
|
|
804
804
|
u && t._afterCellRender?.({
|
|
805
805
|
row: o,
|
|
806
806
|
rowIndex: n,
|
|
807
807
|
column: d,
|
|
808
808
|
colIndex: g,
|
|
809
|
-
value:
|
|
809
|
+
value: T,
|
|
810
810
|
cellElement: w,
|
|
811
811
|
rowElement: e
|
|
812
812
|
});
|
|
@@ -814,7 +814,7 @@ function se(t, e, o, n) {
|
|
|
814
814
|
}
|
|
815
815
|
function G(t, e, o, n) {
|
|
816
816
|
e.innerHTML = "";
|
|
817
|
-
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol,
|
|
817
|
+
const i = t._visibleColumns, r = i.length, s = t._focusRow, l = t._focusCol, a = t, c = t._hasAfterCellRenderHook?.() ?? !1, h = document.createDocumentFragment();
|
|
818
818
|
for (let u = 0; u < r; u++) {
|
|
819
819
|
const p = i[u], f = gt();
|
|
820
820
|
f.setAttribute("aria-colindex", String(u + 1)), f.setAttribute("data-col", String(u)), f.setAttribute("data-row", String(n)), f.setAttribute("data-field", p.field), f.setAttribute("data-header", p.header ?? p.field), p.type && f.setAttribute("data-type", p.type);
|
|
@@ -826,7 +826,7 @@ function G(t, e, o, n) {
|
|
|
826
826
|
} catch (v) {
|
|
827
827
|
console.warn(`[tbw-grid] Format error in column '${p.field}':`, v);
|
|
828
828
|
}
|
|
829
|
-
const w = p.__compiledView,
|
|
829
|
+
const w = p.__compiledView, b = p.__viewTemplate, S = qe(t, p), C = p.externalView;
|
|
830
830
|
let _ = !1;
|
|
831
831
|
if (S) {
|
|
832
832
|
const v = S({ row: o, value: g, field: p.field, column: p, cellEl: f });
|
|
@@ -838,50 +838,50 @@ function G(t, e, o, n) {
|
|
|
838
838
|
if (v.mount)
|
|
839
839
|
try {
|
|
840
840
|
v.mount({ placeholder: E, context: y, spec: v });
|
|
841
|
-
} catch (
|
|
842
|
-
console.warn(`[tbw-grid] External view mount error for column '${p.field}':`,
|
|
841
|
+
} catch (m) {
|
|
842
|
+
console.warn(`[tbw-grid] External view mount error for column '${p.field}':`, m);
|
|
843
843
|
}
|
|
844
844
|
else
|
|
845
845
|
queueMicrotask(() => {
|
|
846
846
|
try {
|
|
847
|
-
|
|
847
|
+
a.dispatchEvent(
|
|
848
848
|
new CustomEvent("mount-external-view", {
|
|
849
849
|
bubbles: !0,
|
|
850
850
|
composed: !0,
|
|
851
851
|
detail: { placeholder: E, spec: v, context: y }
|
|
852
852
|
})
|
|
853
853
|
);
|
|
854
|
-
} catch (
|
|
855
|
-
console.warn(`[tbw-grid] External view event dispatch error for column '${p.field}':`,
|
|
854
|
+
} catch (m) {
|
|
855
|
+
console.warn(`[tbw-grid] External view event dispatch error for column '${p.field}':`, m);
|
|
856
856
|
}
|
|
857
857
|
});
|
|
858
858
|
E.setAttribute("data-mounted", "");
|
|
859
859
|
} else if (w) {
|
|
860
860
|
const v = w({ row: o, value: g, field: p.field, column: p }), E = w.__blocked;
|
|
861
861
|
f.innerHTML = E ? "" : F(v), _ = !0, E && (f.textContent = "", f.setAttribute("data-blocked-template", ""));
|
|
862
|
-
} else if (
|
|
863
|
-
const v =
|
|
864
|
-
/Reflect\.|\bProxy\b|ownKeys\(/.test(v) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = F(
|
|
862
|
+
} else if (b) {
|
|
863
|
+
const v = b.innerHTML;
|
|
864
|
+
/Reflect\.|\bProxy\b|ownKeys\(/.test(v) ? (f.textContent = "", f.setAttribute("data-blocked-template", "")) : (f.innerHTML = F(Me(v, { row: o, value: g })), _ = !0);
|
|
865
865
|
} else
|
|
866
|
-
p.type === "date" ? f.textContent =
|
|
866
|
+
p.type === "date" ? f.textContent = Ne(g) : p.type === "boolean" ? f.innerHTML = ke(!!g) : f.textContent = g == null ? "" : String(g);
|
|
867
867
|
if (_) {
|
|
868
868
|
ht(f);
|
|
869
869
|
const v = f.textContent || "";
|
|
870
870
|
/Proxy|Reflect\.ownKeys/.test(v) && (f.textContent = v.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(f.textContent || "") && (f.textContent = ""));
|
|
871
871
|
}
|
|
872
872
|
f.hasAttribute("data-blocked-template") && (f.textContent || "").trim().length && (f.textContent = ""), p.editable ? f.tabIndex = 0 : p.type === "boolean" && (f.hasAttribute("tabindex") || (f.tabIndex = 0)), s === n && l === u ? (f.classList.add("cell-focus"), f.setAttribute("aria-selected", "true")) : f.setAttribute("aria-selected", "false");
|
|
873
|
-
const
|
|
874
|
-
if (
|
|
873
|
+
const T = p.cellClass;
|
|
874
|
+
if (T)
|
|
875
875
|
try {
|
|
876
|
-
const v = o[p.field], E =
|
|
876
|
+
const v = o[p.field], E = T(v, o, p);
|
|
877
877
|
if (E && E.length > 0) {
|
|
878
|
-
const y = E.filter((
|
|
879
|
-
y.forEach((
|
|
878
|
+
const y = E.filter((m) => m && typeof m == "string");
|
|
879
|
+
y.forEach((m) => f.classList.add(m)), f.setAttribute("data-dynamic-classes", y.join(" "));
|
|
880
880
|
}
|
|
881
881
|
} catch (v) {
|
|
882
882
|
console.warn(`[tbw-grid] cellClass callback error for column '${p.field}':`, v);
|
|
883
883
|
}
|
|
884
|
-
|
|
884
|
+
c && t._afterCellRender?.({
|
|
885
885
|
row: o,
|
|
886
886
|
rowIndex: n,
|
|
887
887
|
column: p,
|
|
@@ -906,12 +906,12 @@ function ye(t, e, o) {
|
|
|
906
906
|
if (!isNaN(l)) {
|
|
907
907
|
if (t._dispatchCellClick?.(e, i, l, s))
|
|
908
908
|
return;
|
|
909
|
-
const
|
|
909
|
+
const a = t._focusRow !== i || t._focusCol !== l;
|
|
910
910
|
if (t._focusRow = i, t._focusCol = l, s.classList.contains("editing")) {
|
|
911
|
-
|
|
912
|
-
const
|
|
911
|
+
a && (ue(t._bodyEl ?? t), s.classList.add("cell-focus"));
|
|
912
|
+
const c = s.querySelector($e);
|
|
913
913
|
try {
|
|
914
|
-
|
|
914
|
+
c?.focus({ preventScroll: !0 });
|
|
915
915
|
} catch {
|
|
916
916
|
}
|
|
917
917
|
return;
|
|
@@ -920,15 +920,15 @@ function ye(t, e, o) {
|
|
|
920
920
|
}
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
-
function
|
|
923
|
+
function mt(t, e) {
|
|
924
924
|
if (t._dispatchKeyDown?.(e))
|
|
925
925
|
return;
|
|
926
|
-
const o = t._rows.length - 1, n = t._visibleColumns.length - 1, i = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [],
|
|
926
|
+
const o = t._rows.length - 1, n = t._visibleColumns.length - 1, i = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [], a = l.length ? l[0] : e.target, c = (h) => {
|
|
927
927
|
if (!h) return !1;
|
|
928
928
|
const u = h.tagName;
|
|
929
929
|
return !!(u === "INPUT" || u === "SELECT" || u === "TEXTAREA" || h.isContentEditable);
|
|
930
930
|
};
|
|
931
|
-
if (!(a
|
|
931
|
+
if (!(c(a) && (e.key === "Home" || e.key === "End")) && !(c(a) && (e.key === "ArrowUp" || e.key === "ArrowDown") && a.tagName === "INPUT" && a.type === "number") && !(c(a) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) && !(c(a) && (e.key === "Enter" || e.key === "Escape")) && !(i && s === "select" && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
|
|
932
932
|
switch (e.key) {
|
|
933
933
|
case "Tab": {
|
|
934
934
|
e.preventDefault(), !e.shiftKey ? t._focusCol < n ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < o && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = n), $(t);
|
|
@@ -961,7 +961,7 @@ function bt(t, e) {
|
|
|
961
961
|
case "Enter": {
|
|
962
962
|
const h = t._focusRow, u = t._focusCol, p = t._visibleColumns[u], f = t._rows[h], g = p?.field ?? "", d = g && f ? f[g] : void 0, w = t.querySelector(
|
|
963
963
|
`[data-row="${h}"][data-col="${u}"]`
|
|
964
|
-
),
|
|
964
|
+
), b = {
|
|
965
965
|
rowIndex: h,
|
|
966
966
|
colIndex: u,
|
|
967
967
|
field: g,
|
|
@@ -972,7 +972,7 @@ function bt(t, e) {
|
|
|
972
972
|
originalEvent: e
|
|
973
973
|
}, S = new CustomEvent("cell-activate", {
|
|
974
974
|
cancelable: !0,
|
|
975
|
-
detail:
|
|
975
|
+
detail: b
|
|
976
976
|
});
|
|
977
977
|
t.dispatchEvent(S);
|
|
978
978
|
const C = new CustomEvent("activate-cell", {
|
|
@@ -993,10 +993,10 @@ function bt(t, e) {
|
|
|
993
993
|
}
|
|
994
994
|
function $(t, e) {
|
|
995
995
|
if (t._virtualization?.enabled) {
|
|
996
|
-
const { rowHeight: s, container: l, viewportEl:
|
|
997
|
-
if (
|
|
996
|
+
const { rowHeight: s, container: l, viewportEl: a } = t._virtualization, c = l, h = a?.clientHeight ?? c?.clientHeight ?? 0;
|
|
997
|
+
if (c && h > 0) {
|
|
998
998
|
const u = t._focusRow * s;
|
|
999
|
-
u <
|
|
999
|
+
u < c.scrollTop ? c.scrollTop = u : u + s > c.scrollTop + h && (c.scrollTop = u - h + s);
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
1002
|
const o = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
|
|
@@ -1009,24 +1009,24 @@ function $(t, e) {
|
|
|
1009
1009
|
let l = s?.children[t._focusCol];
|
|
1010
1010
|
if ((!l || !l.classList?.contains("cell")) && (l = s?.querySelector(`.cell[data-col="${t._focusCol}"]`) ?? s?.querySelector(".cell[data-col]")), l) {
|
|
1011
1011
|
l.classList.add("cell-focus"), l.setAttribute("aria-selected", "true");
|
|
1012
|
-
const
|
|
1013
|
-
if (
|
|
1012
|
+
const a = t.querySelector(".tbw-scroll-area");
|
|
1013
|
+
if (a && l && !o)
|
|
1014
1014
|
if (e?.forceScrollLeft)
|
|
1015
|
-
|
|
1015
|
+
a.scrollLeft = 0;
|
|
1016
1016
|
else if (e?.forceScrollRight)
|
|
1017
|
-
|
|
1017
|
+
a.scrollLeft = a.scrollWidth - a.clientWidth;
|
|
1018
1018
|
else {
|
|
1019
|
-
const
|
|
1020
|
-
if (!
|
|
1021
|
-
const h = l.getBoundingClientRect(), u =
|
|
1022
|
-
p < g ?
|
|
1019
|
+
const c = t._getHorizontalScrollOffsets?.(s ?? void 0, l) ?? { left: 0, right: 0 };
|
|
1020
|
+
if (!c.skipScroll) {
|
|
1021
|
+
const h = l.getBoundingClientRect(), u = a.getBoundingClientRect(), p = h.left - u.left + a.scrollLeft, f = p + h.width, g = a.scrollLeft + c.left, d = a.scrollLeft + a.clientWidth - c.right;
|
|
1022
|
+
p < g ? a.scrollLeft = p - c.left : f > d && (a.scrollLeft = f - a.clientWidth + c.right);
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
1025
|
if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
|
|
1026
|
-
const
|
|
1027
|
-
if (
|
|
1026
|
+
const c = l.querySelector($e);
|
|
1027
|
+
if (c && document.activeElement !== c)
|
|
1028
1028
|
try {
|
|
1029
|
-
|
|
1029
|
+
c.focus({ preventScroll: !0 });
|
|
1030
1030
|
} catch {
|
|
1031
1031
|
}
|
|
1032
1032
|
} else if (!l.contains(document.activeElement)) {
|
|
@@ -1051,12 +1051,12 @@ function fe(t, e, o, n) {
|
|
|
1051
1051
|
const d = document.elementFromPoint(o.clientX, o.clientY);
|
|
1052
1052
|
d && (i = d);
|
|
1053
1053
|
}
|
|
1054
|
-
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"),
|
|
1055
|
-
let
|
|
1056
|
-
return s && (
|
|
1054
|
+
const s = i?.closest?.("[data-col]"), l = i?.closest?.(".data-grid-row"), a = i?.closest?.(".header-row");
|
|
1055
|
+
let c, h, u, p, f, g;
|
|
1056
|
+
return s && (c = parseInt(s.getAttribute("data-row") ?? "-1", 10), h = parseInt(s.getAttribute("data-col") ?? "-1", 10), c >= 0 && h >= 0 && (u = t._rows[c], g = t._columns[h], p = g?.field, f = u && p ? u[p] : void 0)), {
|
|
1057
1057
|
type: n,
|
|
1058
1058
|
row: u,
|
|
1059
|
-
rowIndex:
|
|
1059
|
+
rowIndex: c !== void 0 && c >= 0 ? c : void 0,
|
|
1060
1060
|
colIndex: h !== void 0 && h >= 0 ? h : void 0,
|
|
1061
1061
|
field: p,
|
|
1062
1062
|
value: f,
|
|
@@ -1064,8 +1064,8 @@ function fe(t, e, o, n) {
|
|
|
1064
1064
|
originalEvent: o,
|
|
1065
1065
|
cellElement: s ?? void 0,
|
|
1066
1066
|
rowElement: l ?? void 0,
|
|
1067
|
-
isHeader: !!
|
|
1068
|
-
cell:
|
|
1067
|
+
isHeader: !!a,
|
|
1068
|
+
cell: c !== void 0 && h !== void 0 && c >= 0 && h >= 0 ? { row: c, col: h } : void 0
|
|
1069
1069
|
};
|
|
1070
1070
|
}
|
|
1071
1071
|
function Ct(t, e, o) {
|
|
@@ -1107,14 +1107,14 @@ function Et(t, e, o) {
|
|
|
1107
1107
|
);
|
|
1108
1108
|
}
|
|
1109
1109
|
function St(t, e, o, n) {
|
|
1110
|
-
e.addEventListener("keydown", (i) =>
|
|
1110
|
+
e.addEventListener("keydown", (i) => mt(t, i), { signal: n }), o.addEventListener("mousedown", (i) => Ct(t, o, i), { signal: n }), document.addEventListener("mousemove", (i) => yt(t, o, i), { signal: n }), document.addEventListener("mouseup", (i) => _t(t, o, i), { signal: n });
|
|
1111
1111
|
}
|
|
1112
1112
|
function Rt(t, e) {
|
|
1113
1113
|
return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1115
|
+
function xt(t, e, o) {
|
|
1116
1116
|
const i = o.find((l) => l.field === e.field)?.sortComparator ?? Rt, { field: r, direction: s } = e;
|
|
1117
|
-
return [...t].sort((l,
|
|
1117
|
+
return [...t].sort((l, a) => i(l[r], a[r], l, a) * s);
|
|
1118
1118
|
}
|
|
1119
1119
|
function _e(t, e, o, n) {
|
|
1120
1120
|
t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((i) => i.__epoch = -1), oe(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
|
|
@@ -1130,7 +1130,7 @@ function Ee(t, e) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
function Se(t, e, o) {
|
|
1132
1132
|
t._sortState = { field: e.field, direction: o };
|
|
1133
|
-
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ??
|
|
1133
|
+
const n = { field: e.field, direction: o }, i = t._columns, s = (t.effectiveConfig?.sortHandler ?? xt)(t._rows, n, i);
|
|
1134
1134
|
s && typeof s.then == "function" ? s.then((l) => {
|
|
1135
1135
|
_e(t, l, e, o);
|
|
1136
1136
|
}) : _e(t, s, e, o);
|
|
@@ -1138,14 +1138,14 @@ function Se(t, e, o) {
|
|
|
1138
1138
|
function U(t, e) {
|
|
1139
1139
|
return t.effectiveConfig?.sortable !== !1 && e.sortable === !0;
|
|
1140
1140
|
}
|
|
1141
|
-
function
|
|
1141
|
+
function Tt(t, e) {
|
|
1142
1142
|
typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
|
|
1143
1143
|
}
|
|
1144
1144
|
function K(t, e) {
|
|
1145
1145
|
const o = document.createElement("span");
|
|
1146
|
-
|
|
1147
|
-
const n = t._sortState?.field === e.field ? t._sortState.direction : 0, i = { ...
|
|
1148
|
-
return
|
|
1146
|
+
ze(o, "sort-indicator");
|
|
1147
|
+
const n = t._sortState?.field === e.field ? t._sortState.direction : 0, i = { ...k, ...t.icons }, r = n === 1 ? i.sortAsc : n === -1 ? i.sortDesc : i.sortNone;
|
|
1148
|
+
return Tt(o, r), o;
|
|
1149
1149
|
}
|
|
1150
1150
|
function Z(t, e, o) {
|
|
1151
1151
|
const n = document.createElement("div");
|
|
@@ -1180,10 +1180,10 @@ function oe(t) {
|
|
|
1180
1180
|
const e = t._headerRowEl;
|
|
1181
1181
|
e && (e.innerHTML = "", t._visibleColumns.forEach((o, n) => {
|
|
1182
1182
|
const i = document.createElement("div");
|
|
1183
|
-
i.className = "cell",
|
|
1183
|
+
i.className = "cell", ze(i, "header-cell"), i.setAttribute("role", "columnheader"), i.setAttribute("aria-colindex", String(n + 1)), i.setAttribute("data-field", o.field), i.setAttribute("data-col", String(n));
|
|
1184
1184
|
const r = o.header ?? o.field, s = t._sortState?.field === o.field ? t._sortState.direction : 0, l = s === 1 ? "asc" : s === -1 ? "desc" : null;
|
|
1185
1185
|
if (o.headerRenderer) {
|
|
1186
|
-
const
|
|
1186
|
+
const a = {
|
|
1187
1187
|
column: o,
|
|
1188
1188
|
value: r,
|
|
1189
1189
|
sortState: l,
|
|
@@ -1192,19 +1192,19 @@ function oe(t) {
|
|
|
1192
1192
|
renderSortIcon: () => U(t, o) ? K(t, o) : null,
|
|
1193
1193
|
renderFilterButton: () => null,
|
|
1194
1194
|
renderResizeHandle: () => Z(t, n, i)
|
|
1195
|
-
},
|
|
1196
|
-
At(i,
|
|
1195
|
+
}, c = o.headerRenderer(a);
|
|
1196
|
+
At(i, c), U(t, o) && J(t, o, n, i), o.resizable && i.classList.add("resizable");
|
|
1197
1197
|
} else if (o.headerLabelRenderer) {
|
|
1198
|
-
const
|
|
1198
|
+
const a = {
|
|
1199
1199
|
column: o,
|
|
1200
1200
|
value: r
|
|
1201
|
-
},
|
|
1202
|
-
|
|
1201
|
+
}, c = o.headerLabelRenderer(a), h = document.createElement("span");
|
|
1202
|
+
c == null ? h.textContent = r : typeof c == "string" ? h.innerHTML = F(c) : c instanceof Node && h.appendChild(c), i.appendChild(h), U(t, o) && (J(t, o, n, i), i.appendChild(K(t, o))), o.resizable && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1203
1203
|
} else if (o.__headerTemplate)
|
|
1204
|
-
Array.from(o.__headerTemplate.childNodes).forEach((
|
|
1204
|
+
Array.from(o.__headerTemplate.childNodes).forEach((a) => i.appendChild(a.cloneNode(!0))), U(t, o) && (J(t, o, n, i), i.appendChild(K(t, o))), o.resizable && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1205
1205
|
else {
|
|
1206
|
-
const
|
|
1207
|
-
|
|
1206
|
+
const a = document.createElement("span");
|
|
1207
|
+
a.textContent = r, i.appendChild(a), U(t, o) && (J(t, o, n, i), i.appendChild(K(t, o))), o.resizable && (i.classList.add("resizable"), i.appendChild(Z(t, n, i)));
|
|
1208
1208
|
}
|
|
1209
1209
|
e.appendChild(i);
|
|
1210
1210
|
}), e.querySelectorAll(".cell.sortable").forEach((o) => {
|
|
@@ -1232,7 +1232,7 @@ class Lt {
|
|
|
1232
1232
|
#d = null;
|
|
1233
1233
|
#h = null;
|
|
1234
1234
|
#a = null;
|
|
1235
|
-
#
|
|
1235
|
+
#o = !1;
|
|
1236
1236
|
constructor(e) {
|
|
1237
1237
|
this.#l = e;
|
|
1238
1238
|
}
|
|
@@ -1265,14 +1265,14 @@ class Lt {
|
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
1267
|
const e = this.#i;
|
|
1268
|
-
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.#
|
|
1268
|
+
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.#o && this.#a && (this.#o = !0, this.#a()), this.#h && (this.#h(), this.#h = null, this.#d = null);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
function
|
|
1271
|
+
function xe(t) {
|
|
1272
1272
|
let e = null, o = null, n = null, i = null;
|
|
1273
|
-
const r = (
|
|
1273
|
+
const r = (a) => {
|
|
1274
1274
|
if (!e) return;
|
|
1275
|
-
const
|
|
1275
|
+
const c = a.clientX - e.startX, h = Math.max(40, e.startWidth + c), u = t._visibleColumns[e.colIndex];
|
|
1276
1276
|
u.width = h, u.__userResized = !0, u.__renderedWidth = h, o == null && (o = requestAnimationFrame(() => {
|
|
1277
1277
|
o = null, t.updateTemplate?.();
|
|
1278
1278
|
})), t.dispatchEvent(
|
|
@@ -1281,24 +1281,24 @@ function Te(t) {
|
|
|
1281
1281
|
};
|
|
1282
1282
|
let s = !1;
|
|
1283
1283
|
const l = () => {
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1284
|
+
const a = e !== null;
|
|
1285
|
+
a && (s = !0, requestAnimationFrame(() => {
|
|
1286
1286
|
s = !1;
|
|
1287
|
-
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null,
|
|
1287
|
+
})), window.removeEventListener("mousemove", r), window.removeEventListener("mouseup", l), n !== null && (document.documentElement.style.cursor = n, n = null), i !== null && (document.body.style.userSelect = i, i = null), e = null, a && t.requestStateChange && t.requestStateChange();
|
|
1288
1288
|
};
|
|
1289
1289
|
return {
|
|
1290
1290
|
get isResizing() {
|
|
1291
1291
|
return e !== null || s;
|
|
1292
1292
|
},
|
|
1293
|
-
start(
|
|
1294
|
-
|
|
1295
|
-
const u = t._visibleColumns[
|
|
1296
|
-
e = { startX:
|
|
1293
|
+
start(a, c, h) {
|
|
1294
|
+
a.preventDefault();
|
|
1295
|
+
const u = t._visibleColumns[c], p = typeof u?.width == "number" ? u.width : void 0, f = u?.__renderedWidth ?? p ?? h.getBoundingClientRect().width;
|
|
1296
|
+
e = { startX: a.clientX, colIndex: c, startWidth: f }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l), n === null && (n = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", i === null && (i = document.body.style.userSelect), document.body.style.userSelect = "none";
|
|
1297
1297
|
},
|
|
1298
|
-
resetColumn(
|
|
1299
|
-
const
|
|
1300
|
-
|
|
1301
|
-
new CustomEvent("column-resize-reset", { detail: { field:
|
|
1298
|
+
resetColumn(a) {
|
|
1299
|
+
const c = t._visibleColumns[a];
|
|
1300
|
+
c && (c.__userResized = !1, c.__renderedWidth = void 0, c.width = c.__originalWidth, t.updateTemplate?.(), t.requestStateChange?.(), t.dispatchEvent(
|
|
1301
|
+
new CustomEvent("column-resize-reset", { detail: { field: c.field, width: c.width } })
|
|
1302
1302
|
));
|
|
1303
1303
|
},
|
|
1304
1304
|
dispose() {
|
|
@@ -1319,7 +1319,7 @@ function Dt(t) {
|
|
|
1319
1319
|
const e = t.trim().toLowerCase();
|
|
1320
1320
|
return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
|
|
1321
1321
|
}
|
|
1322
|
-
function
|
|
1322
|
+
function zt(t, e) {
|
|
1323
1323
|
const o = Ht[e], n = getComputedStyle(t).getPropertyValue(o);
|
|
1324
1324
|
if (n) {
|
|
1325
1325
|
const i = Dt(n);
|
|
@@ -1328,9 +1328,9 @@ function Mt(t, e) {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
return Ot[e];
|
|
1330
1330
|
}
|
|
1331
|
-
function
|
|
1331
|
+
function Mt(t, e, o) {
|
|
1332
1332
|
t.removeAttribute(le), t.offsetWidth, t.setAttribute(le, e);
|
|
1333
|
-
const n =
|
|
1333
|
+
const n = zt(t, e);
|
|
1334
1334
|
setTimeout(() => {
|
|
1335
1335
|
e !== "remove" && t.removeAttribute(le);
|
|
1336
1336
|
}, n);
|
|
@@ -1339,15 +1339,15 @@ function pe(t, e, o) {
|
|
|
1339
1339
|
if (e < 0)
|
|
1340
1340
|
return !1;
|
|
1341
1341
|
const n = t.findRenderedRowElement?.(e);
|
|
1342
|
-
return n ? (
|
|
1342
|
+
return n ? (Mt(n, o), !0) : !1;
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function kt(t, e, o) {
|
|
1345
1345
|
let n = 0;
|
|
1346
1346
|
for (const i of e)
|
|
1347
1347
|
pe(t, i, o) && n++;
|
|
1348
1348
|
return n;
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1350
|
+
function Nt(t, e, o) {
|
|
1351
1351
|
const n = t._rows ?? [], i = t.getRowId;
|
|
1352
1352
|
if (!i)
|
|
1353
1353
|
return !1;
|
|
@@ -1404,7 +1404,7 @@ Ge.innerHTML = `
|
|
|
1404
1404
|
function Xe() {
|
|
1405
1405
|
return Ge.content.cloneNode(!0);
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1407
|
+
function Te(t) {
|
|
1408
1408
|
const e = document.createDocumentFragment(), o = H(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
|
|
1409
1409
|
if (t.hasShell && t.shellHeader && t.shellBody)
|
|
1410
1410
|
o.appendChild(t.shellHeader), o.appendChild(t.shellBody);
|
|
@@ -1463,33 +1463,33 @@ function qt(t) {
|
|
|
1463
1463
|
"aria-hidden": "true"
|
|
1464
1464
|
})
|
|
1465
1465
|
);
|
|
1466
|
-
const l = H("tbw-tool-panel-content", { role: "presentation" }),
|
|
1467
|
-
for (const
|
|
1468
|
-
const h = `tbw-accordion-section${
|
|
1469
|
-
"aria-expanded": String(
|
|
1470
|
-
"aria-controls": `tbw-section-${
|
|
1466
|
+
const l = H("tbw-tool-panel-content", { role: "presentation" }), a = H("tbw-accordion");
|
|
1467
|
+
for (const c of t.panels) {
|
|
1468
|
+
const h = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${n ? " single" : ""}`, u = H(h, { "data-section": c.id }), p = Be("tbw-accordion-header", {
|
|
1469
|
+
"aria-expanded": String(c.isExpanded),
|
|
1470
|
+
"aria-controls": `tbw-section-${c.id}`
|
|
1471
1471
|
});
|
|
1472
|
-
if (n && p.setAttribute("aria-disabled", "true"),
|
|
1472
|
+
if (n && p.setAttribute("aria-disabled", "true"), c.icon) {
|
|
1473
1473
|
const g = Q("span", { class: "tbw-accordion-icon" });
|
|
1474
|
-
g.innerHTML =
|
|
1474
|
+
g.innerHTML = c.icon, p.appendChild(g);
|
|
1475
1475
|
}
|
|
1476
1476
|
const f = Q("span", { class: "tbw-accordion-title" });
|
|
1477
|
-
if (f.textContent =
|
|
1477
|
+
if (f.textContent = c.title, p.appendChild(f), !n) {
|
|
1478
1478
|
const g = Q("span", { class: "tbw-accordion-chevron" });
|
|
1479
|
-
g.innerHTML =
|
|
1479
|
+
g.innerHTML = c.isExpanded ? t.collapseIcon : t.expandIcon, p.appendChild(g);
|
|
1480
1480
|
}
|
|
1481
1481
|
u.appendChild(p), u.appendChild(
|
|
1482
1482
|
H("tbw-accordion-content", {
|
|
1483
|
-
id: `tbw-section-${
|
|
1483
|
+
id: `tbw-section-${c.id}`,
|
|
1484
1484
|
role: "presentation"
|
|
1485
1485
|
})
|
|
1486
|
-
),
|
|
1486
|
+
), a.appendChild(u);
|
|
1487
1487
|
}
|
|
1488
|
-
l.appendChild(
|
|
1488
|
+
l.appendChild(a), r.appendChild(l);
|
|
1489
1489
|
}
|
|
1490
1490
|
return t.position === "left" && r ? (e.appendChild(r), e.appendChild(i)) : (e.appendChild(i), r && e.appendChild(r)), e;
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function N(t) {
|
|
1493
1493
|
return t ? typeof t == "string" ? t : t.outerHTML : "";
|
|
1494
1494
|
}
|
|
1495
1495
|
function Wt() {
|
|
@@ -1515,10 +1515,10 @@ function Ye(t) {
|
|
|
1515
1515
|
return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
|
|
1516
1516
|
}
|
|
1517
1517
|
function Ae(t, e, o = "☰") {
|
|
1518
|
-
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r =
|
|
1518
|
+
const n = t?.header?.title ?? e.lightDomTitle ?? "", i = !!n, r = N(o), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], a = new Set(s.map((d) => d.id)), c = [...s];
|
|
1519
1519
|
for (const d of l)
|
|
1520
|
-
|
|
1521
|
-
const h =
|
|
1520
|
+
a.has(d.id) || c.push(d);
|
|
1521
|
+
const h = c.length > 0, u = e.toolPanels.size > 0, p = h && u, f = [...c].sort((d, w) => (d.order ?? 0) - (w.order ?? 0));
|
|
1522
1522
|
let g = "";
|
|
1523
1523
|
for (const d of f)
|
|
1524
1524
|
g += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${d.id}"></div>`;
|
|
@@ -1571,7 +1571,7 @@ function W(t, e, o) {
|
|
|
1571
1571
|
);
|
|
1572
1572
|
return;
|
|
1573
1573
|
}
|
|
1574
|
-
const
|
|
1574
|
+
const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0, h = parseInt(r.getAttribute("order") ?? "100", 10);
|
|
1575
1575
|
let u;
|
|
1576
1576
|
const p = o?.(r);
|
|
1577
1577
|
if (p)
|
|
@@ -1579,14 +1579,14 @@ function W(t, e, o) {
|
|
|
1579
1579
|
else {
|
|
1580
1580
|
const d = r.innerHTML.trim();
|
|
1581
1581
|
u = (w) => {
|
|
1582
|
-
const
|
|
1583
|
-
return
|
|
1582
|
+
const b = document.createElement("div");
|
|
1583
|
+
return b.innerHTML = d, w.appendChild(b), () => b.remove();
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
1586
|
const f = e.toolPanels.get(s);
|
|
1587
1587
|
if (f) {
|
|
1588
1588
|
if (p) {
|
|
1589
|
-
f.render = u, f.order = h, f.icon =
|
|
1589
|
+
f.render = u, f.order = h, f.icon = a, f.tooltip = c;
|
|
1590
1590
|
const d = e.panelCleanups.get(s);
|
|
1591
1591
|
d && (d(), e.panelCleanups.delete(s));
|
|
1592
1592
|
}
|
|
@@ -1595,8 +1595,8 @@ function W(t, e, o) {
|
|
|
1595
1595
|
const g = {
|
|
1596
1596
|
id: s,
|
|
1597
1597
|
title: l,
|
|
1598
|
-
icon:
|
|
1599
|
-
tooltip:
|
|
1598
|
+
icon: a,
|
|
1599
|
+
tooltip: c,
|
|
1600
1600
|
order: h,
|
|
1601
1601
|
render: u
|
|
1602
1602
|
};
|
|
@@ -1613,9 +1613,9 @@ function $t(t, e, o, n) {
|
|
|
1613
1613
|
});
|
|
1614
1614
|
const r = t.querySelector(".tbw-accordion");
|
|
1615
1615
|
r && r.addEventListener("click", (s) => {
|
|
1616
|
-
const
|
|
1617
|
-
if (
|
|
1618
|
-
const h =
|
|
1616
|
+
const a = s.target.closest(".tbw-accordion-header");
|
|
1617
|
+
if (a) {
|
|
1618
|
+
const h = a.closest("[data-section]")?.getAttribute("data-section");
|
|
1619
1619
|
h && n.onSectionToggle(h);
|
|
1620
1620
|
}
|
|
1621
1621
|
});
|
|
@@ -1626,19 +1626,19 @@ function Ft(t, e, o) {
|
|
|
1626
1626
|
return () => {
|
|
1627
1627
|
};
|
|
1628
1628
|
const s = e?.toolPanel?.position ?? "right", l = 200;
|
|
1629
|
-
let
|
|
1629
|
+
let a = 0, c = 0, h = 0, u = !1;
|
|
1630
1630
|
const p = (d) => {
|
|
1631
1631
|
if (!u) return;
|
|
1632
1632
|
d.preventDefault();
|
|
1633
|
-
const w = s === "left" ? d.clientX -
|
|
1634
|
-
n.style.width = `${
|
|
1633
|
+
const w = s === "left" ? d.clientX - a : a - d.clientX, b = Math.min(h, Math.max(l, c + w));
|
|
1634
|
+
n.style.width = `${b}px`;
|
|
1635
1635
|
}, f = () => {
|
|
1636
1636
|
if (!u) return;
|
|
1637
1637
|
u = !1, i.classList.remove("resizing"), n.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
1638
1638
|
const d = n.getBoundingClientRect().width;
|
|
1639
1639
|
o(d), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
1640
1640
|
}, g = (d) => {
|
|
1641
|
-
d.preventDefault(), u = !0,
|
|
1641
|
+
d.preventDefault(), u = !0, a = d.clientX, c = n.getBoundingClientRect().width, h = r.getBoundingClientRect().width - 20, i.classList.add("resizing"), n.style.transition = "none", document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", p), document.addEventListener("mouseup", f);
|
|
1642
1642
|
};
|
|
1643
1643
|
return i.addEventListener("mousedown", g), () => {
|
|
1644
1644
|
i.removeEventListener("mousedown", g), document.removeEventListener("mousemove", p), document.removeEventListener("mouseup", f);
|
|
@@ -1650,10 +1650,10 @@ function Pe(t, e, o) {
|
|
|
1650
1650
|
r.has(l.id) || s.push(l);
|
|
1651
1651
|
for (const l of s) {
|
|
1652
1652
|
if (o.toolbarContentCleanups.has(l.id) || !l.render) continue;
|
|
1653
|
-
const
|
|
1654
|
-
if (!
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1653
|
+
const a = t.querySelector(`[data-toolbar-content="${l.id}"]`);
|
|
1654
|
+
if (!a) continue;
|
|
1655
|
+
const c = l.render(a);
|
|
1656
|
+
c && o.toolbarContentCleanups.set(l.id, c);
|
|
1657
1657
|
}
|
|
1658
1658
|
}
|
|
1659
1659
|
function de(t, e) {
|
|
@@ -1670,30 +1670,30 @@ function de(t, e) {
|
|
|
1670
1670
|
for (const s of r) {
|
|
1671
1671
|
const l = e.headerContentCleanups.get(s.id);
|
|
1672
1672
|
l && (l(), e.headerContentCleanups.delete(s.id));
|
|
1673
|
-
let
|
|
1674
|
-
|
|
1675
|
-
const
|
|
1676
|
-
|
|
1673
|
+
let a = i.querySelector(`[data-header-content="${s.id}"]`);
|
|
1674
|
+
a || (a = document.createElement("div"), a.setAttribute("data-header-content", s.id), i.appendChild(a));
|
|
1675
|
+
const c = s.render(a);
|
|
1676
|
+
c && e.headerContentCleanups.set(s.id, c);
|
|
1677
1677
|
}
|
|
1678
1678
|
}
|
|
1679
1679
|
function Ut(t, e, o) {
|
|
1680
1680
|
if (!e.isPanelOpen) return;
|
|
1681
|
-
const n =
|
|
1681
|
+
const n = N(o?.expand ?? k.expand), i = N(o?.collapse ?? k.collapse);
|
|
1682
1682
|
for (const [r, s] of e.toolPanels) {
|
|
1683
|
-
const l = e.expandedSections.has(r),
|
|
1684
|
-
if (!
|
|
1685
|
-
|
|
1686
|
-
const h =
|
|
1683
|
+
const l = e.expandedSections.has(r), a = t.querySelector(`[data-section="${r}"]`), c = a?.querySelector(".tbw-accordion-content");
|
|
1684
|
+
if (!a || !c) continue;
|
|
1685
|
+
a.classList.toggle("expanded", l);
|
|
1686
|
+
const h = a.querySelector(".tbw-accordion-header");
|
|
1687
1687
|
h && h.setAttribute("aria-expanded", String(l));
|
|
1688
|
-
const u =
|
|
1688
|
+
const u = a.querySelector(".tbw-accordion-chevron");
|
|
1689
1689
|
if (u && (u.innerHTML = l ? i : n), l) {
|
|
1690
|
-
if (
|
|
1691
|
-
const p = s.render(
|
|
1690
|
+
if (c.children.length === 0) {
|
|
1691
|
+
const p = s.render(c);
|
|
1692
1692
|
p && e.panelCleanups.set(r, p);
|
|
1693
1693
|
}
|
|
1694
1694
|
} else {
|
|
1695
1695
|
const p = e.panelCleanups.get(r);
|
|
1696
|
-
p && (p(), e.panelCleanups.delete(r)),
|
|
1696
|
+
p && (p(), e.panelCleanups.delete(r)), c.innerHTML = "";
|
|
1697
1697
|
}
|
|
1698
1698
|
}
|
|
1699
1699
|
}
|
|
@@ -1747,7 +1747,7 @@ function Bt(t, e) {
|
|
|
1747
1747
|
return;
|
|
1748
1748
|
}
|
|
1749
1749
|
if (t.isPanelOpen = !0, t.expandedSections.size === 0 && t.toolPanels.size > 0) {
|
|
1750
|
-
const s = [...t.toolPanels.values()].sort((l,
|
|
1750
|
+
const s = [...t.toolPanels.values()].sort((l, a) => (l.order ?? 100) - (a.order ?? 100))[0];
|
|
1751
1751
|
s && t.expandedSections.add(s.id);
|
|
1752
1752
|
}
|
|
1753
1753
|
const i = e.getShadow();
|
|
@@ -1777,14 +1777,14 @@ function Bt(t, e) {
|
|
|
1777
1777
|
return;
|
|
1778
1778
|
const s = e.getShadow(), l = t.expandedSections.has(i);
|
|
1779
1779
|
if (l) {
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1780
|
+
const a = t.panelCleanups.get(i);
|
|
1781
|
+
a && (a(), t.panelCleanups.delete(i)), r.onClose?.(), t.expandedSections.delete(i), ae(s, i, !1);
|
|
1782
1782
|
} else {
|
|
1783
|
-
for (const [
|
|
1784
|
-
if (
|
|
1785
|
-
const h = t.panelCleanups.get(
|
|
1786
|
-
h && (h(), t.panelCleanups.delete(
|
|
1787
|
-
const u = s.querySelector(`[data-section="${
|
|
1783
|
+
for (const [a, c] of t.toolPanels)
|
|
1784
|
+
if (a !== i && t.expandedSections.has(a)) {
|
|
1785
|
+
const h = t.panelCleanups.get(a);
|
|
1786
|
+
h && (h(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), ae(s, a, !1);
|
|
1787
|
+
const u = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
|
|
1788
1788
|
u && (u.innerHTML = "");
|
|
1789
1789
|
}
|
|
1790
1790
|
t.expandedSections.add(i), ae(s, i, !0), Gt(s, t, i);
|
|
@@ -1863,12 +1863,12 @@ function Xt(t, e, o, n) {
|
|
|
1863
1863
|
"tbw-grid-responsive-card"
|
|
1864
1864
|
];
|
|
1865
1865
|
for (const l of s)
|
|
1866
|
-
t.querySelectorAll(`:scope > ${l}`).forEach((
|
|
1866
|
+
t.querySelectorAll(`:scope > ${l}`).forEach((c) => r.push(c));
|
|
1867
1867
|
t.replaceChildren();
|
|
1868
1868
|
for (const l of r)
|
|
1869
1869
|
t.appendChild(l);
|
|
1870
1870
|
if (i) {
|
|
1871
|
-
const l =
|
|
1871
|
+
const l = N(n?.toolPanel ?? k.toolPanel), a = N(n?.expand ?? k.expand), c = N(n?.collapse ?? k.collapse), u = [...e?.header?.toolbarContents ?? []].sort((C, _) => (C.order ?? 0) - (_.order ?? 0)), f = [...e?.toolPanels ?? []].sort((C, _) => (C.order ?? 100) - (_.order ?? 100)), g = {
|
|
1872
1872
|
title: e?.header?.title ?? void 0,
|
|
1873
1873
|
hasPanels: f.length > 0,
|
|
1874
1874
|
isPanelOpen: o.isPanelOpen,
|
|
@@ -1882,22 +1882,22 @@ function Xt(t, e, o, n) {
|
|
|
1882
1882
|
}, d = {
|
|
1883
1883
|
position: e?.toolPanel?.position ?? "right",
|
|
1884
1884
|
isPanelOpen: o.isPanelOpen,
|
|
1885
|
-
expandIcon:
|
|
1886
|
-
collapseIcon:
|
|
1885
|
+
expandIcon: a,
|
|
1886
|
+
collapseIcon: c,
|
|
1887
1887
|
panels: f.map((C) => ({
|
|
1888
1888
|
id: C.id,
|
|
1889
1889
|
title: C.title,
|
|
1890
|
-
icon:
|
|
1890
|
+
icon: N(C.icon),
|
|
1891
1891
|
isExpanded: o.expandedSections.has(C.id)
|
|
1892
1892
|
}))
|
|
1893
|
-
}, w = It(g),
|
|
1893
|
+
}, w = It(g), b = qt(d), S = Te({
|
|
1894
1894
|
hasShell: !0,
|
|
1895
1895
|
shellHeader: w,
|
|
1896
|
-
shellBody:
|
|
1896
|
+
shellBody: b
|
|
1897
1897
|
});
|
|
1898
1898
|
t.appendChild(S);
|
|
1899
1899
|
} else {
|
|
1900
|
-
const l =
|
|
1900
|
+
const l = Te({ hasShell: !1 });
|
|
1901
1901
|
t.appendChild(l);
|
|
1902
1902
|
}
|
|
1903
1903
|
return i;
|
|
@@ -1931,19 +1931,19 @@ function Kt(t, e, o) {
|
|
|
1931
1931
|
function Zt(t, e, o) {
|
|
1932
1932
|
if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
|
|
1933
1933
|
return !1;
|
|
1934
|
-
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i,
|
|
1934
|
+
const n = t.touches[0], i = n.clientY, r = n.clientX, s = performance.now(), l = e.startY - i, a = e.startX - r;
|
|
1935
1935
|
if (e.lastTime !== null && e.lastY !== null && e.lastX !== null) {
|
|
1936
1936
|
const d = s - e.lastTime;
|
|
1937
1937
|
d > 0 && (e.velocityY = (e.lastY - i) / d, e.velocityX = (e.lastX - r) / d);
|
|
1938
1938
|
}
|
|
1939
1939
|
e.lastY = i, e.lastX = r, e.lastTime = s;
|
|
1940
|
-
const { scrollTop:
|
|
1940
|
+
const { scrollTop: c, scrollHeight: h, clientHeight: u } = o.fauxScrollbar, p = h - u, f = l > 0 && c < p || l < 0 && c > 0;
|
|
1941
1941
|
let g = !1;
|
|
1942
1942
|
if (o.scrollArea) {
|
|
1943
|
-
const { scrollLeft: d, scrollWidth: w, clientWidth:
|
|
1944
|
-
g =
|
|
1943
|
+
const { scrollLeft: d, scrollWidth: w, clientWidth: b } = o.scrollArea, S = w - b;
|
|
1944
|
+
g = a > 0 && d < S || a < 0 && d > 0;
|
|
1945
1945
|
}
|
|
1946
|
-
return f && (o.fauxScrollbar.scrollTop = e.scrollTop + l), g && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft +
|
|
1946
|
+
return f && (o.fauxScrollbar.scrollTop = e.scrollTop + l), g && o.scrollArea && (o.scrollArea.scrollLeft = e.scrollLeft + a), f || g;
|
|
1947
1947
|
}
|
|
1948
1948
|
function Jt(t, e) {
|
|
1949
1949
|
(Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Qt(t, e), jt(t);
|
|
@@ -2055,42 +2055,42 @@ function Oe(t, e) {
|
|
|
2055
2055
|
}
|
|
2056
2056
|
function io(t, e) {
|
|
2057
2057
|
const o = to, n = oo, i = /* @__PURE__ */ new Map();
|
|
2058
|
-
function r(l,
|
|
2059
|
-
i.has(l) || i.set(l, { description:
|
|
2058
|
+
function r(l, a, c, h, u = !1) {
|
|
2059
|
+
i.has(l) || i.set(l, { description: a, importHint: c, fields: [], isConfigProperty: u });
|
|
2060
2060
|
const p = i.get(l);
|
|
2061
2061
|
p.fields.includes(h) || p.fields.push(h);
|
|
2062
2062
|
}
|
|
2063
2063
|
for (const l of n) {
|
|
2064
|
-
const
|
|
2065
|
-
(l.isUsed ? l.isUsed(
|
|
2064
|
+
const a = t[l.property];
|
|
2065
|
+
(l.isUsed ? l.isUsed(a) : a !== void 0) && !Oe(e, l.pluginName) && r(l.pluginName, l.description, l.importHint ?? he(l.pluginName), l.property, !0);
|
|
2066
2066
|
}
|
|
2067
2067
|
const s = t.columns;
|
|
2068
2068
|
if (s && s.length > 0)
|
|
2069
2069
|
for (const l of s)
|
|
2070
|
-
for (const
|
|
2071
|
-
const
|
|
2072
|
-
if ((
|
|
2070
|
+
for (const a of o) {
|
|
2071
|
+
const c = l[a.property];
|
|
2072
|
+
if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !Oe(e, a.pluginName)) {
|
|
2073
2073
|
const u = l.field || "<unknown>";
|
|
2074
|
-
r(
|
|
2074
|
+
r(a.pluginName, a.description, a.importHint ?? he(a.pluginName), u);
|
|
2075
2075
|
}
|
|
2076
2076
|
}
|
|
2077
2077
|
if (i.size > 0) {
|
|
2078
2078
|
const l = [];
|
|
2079
|
-
for (const [
|
|
2079
|
+
for (const [a, { description: c, importHint: h, fields: u, isConfigProperty: p }] of i)
|
|
2080
2080
|
if (p)
|
|
2081
2081
|
l.push(
|
|
2082
|
-
`Config uses ${
|
|
2082
|
+
`Config uses ${c}, but the required plugin is not loaded.
|
|
2083
2083
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2084
2084
|
${h}
|
|
2085
|
-
plugins: [new ${
|
|
2085
|
+
plugins: [new ${a.charAt(0).toUpperCase() + a.slice(1)}Plugin(), ...]`
|
|
2086
2086
|
);
|
|
2087
2087
|
else {
|
|
2088
2088
|
const f = u.slice(0, 3).join(", ") + (u.length > 3 ? `, ... (${u.length} total)` : "");
|
|
2089
2089
|
l.push(
|
|
2090
|
-
`Column(s) [${f}] use ${
|
|
2090
|
+
`Column(s) [${f}] use ${c}, but the required plugin is not loaded.
|
|
2091
2091
|
→ Add the plugin to your gridConfig.plugins array:
|
|
2092
2092
|
${h}
|
|
2093
|
-
plugins: [new ${
|
|
2093
|
+
plugins: [new ${a.charAt(0).toUpperCase() + a.slice(1)}Plugin(), ...]`
|
|
2094
2094
|
);
|
|
2095
2095
|
}
|
|
2096
2096
|
throw new Error(
|
|
@@ -2112,8 +2112,8 @@ function ro(t) {
|
|
|
2112
2112
|
for (const s of r.configRules) {
|
|
2113
2113
|
const l = n.config;
|
|
2114
2114
|
if (s.check(l)) {
|
|
2115
|
-
const
|
|
2116
|
-
s.severity === "error" ? e.push(
|
|
2115
|
+
const c = `${`[tbw-grid:${D(n.name)}Plugin]`} Configuration warning: ${s.message}`;
|
|
2116
|
+
s.severity === "error" ? e.push(c) : o.push(c);
|
|
2117
2117
|
}
|
|
2118
2118
|
}
|
|
2119
2119
|
}
|
|
@@ -2130,9 +2130,9 @@ ${e.join(`
|
|
|
2130
2130
|
function so(t, e) {
|
|
2131
2131
|
const o = t.name, i = t.constructor.dependencies ?? [];
|
|
2132
2132
|
for (const r of i) {
|
|
2133
|
-
const s = r.name, l = r.required ?? !0,
|
|
2133
|
+
const s = r.name, l = r.required ?? !0, a = r.reason;
|
|
2134
2134
|
if (!e.some((h) => h.name === s)) {
|
|
2135
|
-
const h =
|
|
2135
|
+
const h = a ?? `${D(o)}Plugin requires ${D(s)}Plugin`, u = he(s);
|
|
2136
2136
|
if (l)
|
|
2137
2137
|
throw new Error(
|
|
2138
2138
|
`[tbw-grid] Plugin dependency error:
|
|
@@ -2389,7 +2389,7 @@ class ao {
|
|
|
2389
2389
|
}
|
|
2390
2390
|
class L extends HTMLElement {
|
|
2391
2391
|
static tagName = "tbw-grid";
|
|
2392
|
-
static version = "1.
|
|
2392
|
+
static version = "1.7.0";
|
|
2393
2393
|
static #l = 0;
|
|
2394
2394
|
static adapters = [];
|
|
2395
2395
|
static registerAdapter(e) {
|
|
@@ -2402,7 +2402,7 @@ class L extends HTMLElement {
|
|
|
2402
2402
|
this.adapters = [];
|
|
2403
2403
|
}
|
|
2404
2404
|
static get observedAttributes() {
|
|
2405
|
-
return ["rows", "columns", "grid-config", "fit-mode"];
|
|
2405
|
+
return ["rows", "columns", "grid-config", "fit-mode", "loading"];
|
|
2406
2406
|
}
|
|
2407
2407
|
get #i() {
|
|
2408
2408
|
return this;
|
|
@@ -2411,12 +2411,12 @@ class L extends HTMLElement {
|
|
|
2411
2411
|
#d;
|
|
2412
2412
|
#h;
|
|
2413
2413
|
#a = [];
|
|
2414
|
-
get #
|
|
2414
|
+
get #o() {
|
|
2415
2415
|
return this.#t?.effective ?? {};
|
|
2416
2416
|
}
|
|
2417
2417
|
#f = !1;
|
|
2418
2418
|
#g = !1;
|
|
2419
|
-
#
|
|
2419
|
+
#m = {
|
|
2420
2420
|
rows: !1,
|
|
2421
2421
|
columns: !1,
|
|
2422
2422
|
gridConfig: !1,
|
|
@@ -2425,14 +2425,14 @@ class L extends HTMLElement {
|
|
|
2425
2425
|
#s;
|
|
2426
2426
|
#v = 0;
|
|
2427
2427
|
#r = null;
|
|
2428
|
-
#
|
|
2429
|
-
#
|
|
2430
|
-
#
|
|
2428
|
+
#b = !1;
|
|
2429
|
+
#R;
|
|
2430
|
+
#H = Yt();
|
|
2431
2431
|
#w;
|
|
2432
2432
|
#C;
|
|
2433
2433
|
#y;
|
|
2434
2434
|
#p;
|
|
2435
|
-
#
|
|
2435
|
+
#pe = {
|
|
2436
2436
|
scrollTop: 0,
|
|
2437
2437
|
scrollLeft: 0,
|
|
2438
2438
|
scrollHeight: 0,
|
|
@@ -2440,23 +2440,27 @@ class L extends HTMLElement {
|
|
|
2440
2440
|
clientHeight: 0,
|
|
2441
2441
|
clientWidth: 0
|
|
2442
2442
|
};
|
|
2443
|
-
#
|
|
2443
|
+
#n;
|
|
2444
2444
|
#_;
|
|
2445
|
-
#
|
|
2446
|
-
#
|
|
2447
|
-
#
|
|
2445
|
+
#z = !1;
|
|
2446
|
+
#O;
|
|
2447
|
+
#D;
|
|
2448
2448
|
#t;
|
|
2449
2449
|
#e = Wt();
|
|
2450
2450
|
#c;
|
|
2451
|
-
#
|
|
2452
|
-
#
|
|
2451
|
+
#M;
|
|
2452
|
+
#k = !1;
|
|
2453
|
+
#x = /* @__PURE__ */ new Set();
|
|
2454
|
+
#T = /* @__PURE__ */ new Map();
|
|
2455
|
+
#N;
|
|
2456
|
+
#E = /* @__PURE__ */ new Map();
|
|
2453
2457
|
_rows = [];
|
|
2454
|
-
#
|
|
2458
|
+
#F = [];
|
|
2455
2459
|
get _columns() {
|
|
2456
|
-
return this.#
|
|
2460
|
+
return this.#o.columns ?? [];
|
|
2457
2461
|
}
|
|
2458
2462
|
set _columns(e) {
|
|
2459
|
-
this.#
|
|
2463
|
+
this.#o.columns = e;
|
|
2460
2464
|
}
|
|
2461
2465
|
get _visibleColumns() {
|
|
2462
2466
|
return this._columns.filter((e) => !e.hidden);
|
|
@@ -2502,7 +2506,7 @@ class L extends HTMLElement {
|
|
|
2502
2506
|
}
|
|
2503
2507
|
set rows(e) {
|
|
2504
2508
|
const o = this.#a;
|
|
2505
|
-
this.#a = e, o !== e && this
|
|
2509
|
+
this.#a = e, o !== e && this.#$("rows");
|
|
2506
2510
|
}
|
|
2507
2511
|
get sourceRows() {
|
|
2508
2512
|
return this.#a;
|
|
@@ -2512,50 +2516,82 @@ class L extends HTMLElement {
|
|
|
2512
2516
|
}
|
|
2513
2517
|
set columns(e) {
|
|
2514
2518
|
const o = this.#t?.getColumns();
|
|
2515
|
-
this.#t?.setColumns(e), o !== e && this
|
|
2519
|
+
this.#t?.setColumns(e), o !== e && this.#$("columns");
|
|
2516
2520
|
}
|
|
2517
2521
|
get gridConfig() {
|
|
2518
|
-
return this.#
|
|
2522
|
+
return this.#o;
|
|
2519
2523
|
}
|
|
2520
2524
|
set gridConfig(e) {
|
|
2521
2525
|
const o = this.#t?.getGridConfig();
|
|
2522
|
-
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this
|
|
2526
|
+
this.#t?.setGridConfig(e), o !== e && (this.#t.clearLightDomCache(), this.#$("gridConfig"));
|
|
2523
2527
|
}
|
|
2524
2528
|
get fitMode() {
|
|
2525
|
-
return this.#
|
|
2529
|
+
return this.#o.fitMode ?? "stretch";
|
|
2526
2530
|
}
|
|
2527
2531
|
set fitMode(e) {
|
|
2528
2532
|
const o = this.#t?.getFitMode();
|
|
2529
|
-
this.#t?.setFitMode(e), o !== e && this
|
|
2533
|
+
this.#t?.setFitMode(e), o !== e && this.#$("fitMode");
|
|
2534
|
+
}
|
|
2535
|
+
get loading() {
|
|
2536
|
+
return this.#k;
|
|
2537
|
+
}
|
|
2538
|
+
set loading(e) {
|
|
2539
|
+
const o = this.#k;
|
|
2540
|
+
this.#k = e, e ? this.setAttribute("loading", "") : this.removeAttribute("loading"), o !== e && this.#Oe();
|
|
2541
|
+
}
|
|
2542
|
+
setRowLoading(e, o) {
|
|
2543
|
+
const n = this.#x.has(e);
|
|
2544
|
+
o ? this.#x.add(e) : this.#x.delete(e), n !== o && this.#he(e, o);
|
|
2545
|
+
}
|
|
2546
|
+
setCellLoading(e, o, n) {
|
|
2547
|
+
let i = this.#T.get(e);
|
|
2548
|
+
const r = i?.has(o) ?? !1;
|
|
2549
|
+
n ? (i || (i = /* @__PURE__ */ new Set(), this.#T.set(e, i)), i.add(o)) : (i?.delete(o), i?.size === 0 && this.#T.delete(e)), r !== n && this.#ue(e, o, n);
|
|
2550
|
+
}
|
|
2551
|
+
isRowLoading(e) {
|
|
2552
|
+
return this.#x.has(e);
|
|
2553
|
+
}
|
|
2554
|
+
isCellLoading(e, o) {
|
|
2555
|
+
return this.#T.get(e)?.has(o) ?? !1;
|
|
2556
|
+
}
|
|
2557
|
+
clearAllLoading() {
|
|
2558
|
+
this.loading = !1;
|
|
2559
|
+
for (const e of this.#x)
|
|
2560
|
+
this.#he(e, !1);
|
|
2561
|
+
this.#x.clear();
|
|
2562
|
+
for (const [e, o] of this.#T)
|
|
2563
|
+
for (const n of o)
|
|
2564
|
+
this.#ue(e, n, !1);
|
|
2565
|
+
this.#T.clear();
|
|
2530
2566
|
}
|
|
2531
2567
|
get effectiveConfig() {
|
|
2532
|
-
return this.#
|
|
2568
|
+
return this.#o;
|
|
2533
2569
|
}
|
|
2534
2570
|
get disconnectSignal() {
|
|
2535
2571
|
return this.#w || (this.#w = new AbortController()), this.#w.signal;
|
|
2536
2572
|
}
|
|
2537
2573
|
constructor() {
|
|
2538
|
-
super(), this.#
|
|
2574
|
+
super(), this.#we(), this.#d = new Promise((e) => this.#h = e), this.#s = new Lt({
|
|
2539
2575
|
mergeConfig: () => {
|
|
2540
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#
|
|
2576
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), io(this.#o, this.#n?.getPlugins() ?? []), ro(this.#n?.getPlugins() ?? []), lo(this.#n?.getPlugins() ?? []), this.#Pe(), this.#F = [...this._columns];
|
|
2541
2577
|
},
|
|
2542
|
-
processColumns: () => this.#
|
|
2543
|
-
processRows: () => this.#
|
|
2578
|
+
processColumns: () => this.#xe(),
|
|
2579
|
+
processRows: () => this.#Te(),
|
|
2544
2580
|
renderHeader: () => oe(this),
|
|
2545
2581
|
updateTemplate: () => B(this),
|
|
2546
2582
|
renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
|
|
2547
2583
|
afterRender: () => {
|
|
2548
|
-
this.#
|
|
2584
|
+
this.#n?.afterRender(), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, me(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, $(this)), this._virtualization.enabled && !this.#W && this.#me();
|
|
2549
2585
|
},
|
|
2550
2586
|
isConnected: () => this.isConnected && this.#f
|
|
2551
2587
|
}), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = Bt(this.#e, {
|
|
2552
2588
|
getShadow: () => this.#i,
|
|
2553
|
-
getShellConfig: () => this.#
|
|
2589
|
+
getShellConfig: () => this.#o?.shell,
|
|
2554
2590
|
getAccordionIcons: () => ({
|
|
2555
|
-
expand: this.#
|
|
2556
|
-
collapse: this.#
|
|
2591
|
+
expand: this.#o?.icons?.expand ?? k.expand,
|
|
2592
|
+
collapse: this.#o?.icons?.collapse ?? k.collapse
|
|
2557
2593
|
}),
|
|
2558
|
-
emit: (e, o) => this.#
|
|
2594
|
+
emit: (e, o) => this.#P(e, o),
|
|
2559
2595
|
refreshShellHeader: () => this.refreshShellHeader()
|
|
2560
2596
|
}), this.#t = new ft({
|
|
2561
2597
|
getRows: () => this.#a,
|
|
@@ -2566,11 +2602,11 @@ class L extends HTMLElement {
|
|
|
2566
2602
|
onConfigChange: () => {
|
|
2567
2603
|
this.#s.requestPhase(A.FULL, "configChange");
|
|
2568
2604
|
},
|
|
2569
|
-
emit: (e, o) => this.#
|
|
2605
|
+
emit: (e, o) => this.#P(e, o),
|
|
2570
2606
|
clearRowPool: () => {
|
|
2571
2607
|
this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
|
|
2572
2608
|
},
|
|
2573
|
-
setup: () => this.#
|
|
2609
|
+
setup: () => this.#L(),
|
|
2574
2610
|
renderHeader: () => oe(this),
|
|
2575
2611
|
updateTemplate: () => B(this),
|
|
2576
2612
|
refreshVirtualWindow: () => this.#s.requestPhase(A.VIRTUALIZATION, "configManager"),
|
|
@@ -2578,7 +2614,7 @@ class L extends HTMLElement {
|
|
|
2578
2614
|
setRowHeight: (e) => {
|
|
2579
2615
|
this._virtualization.rowHeight = e;
|
|
2580
2616
|
},
|
|
2581
|
-
applyAnimationConfig: (e) => this.#
|
|
2617
|
+
applyAnimationConfig: (e) => this.#Ae(e),
|
|
2582
2618
|
getShellLightDomTitle: () => this.#e.lightDomTitle,
|
|
2583
2619
|
getShellToolPanels: () => this.#e.toolPanels,
|
|
2584
2620
|
getShellHeaderContents: () => this.#e.headerContents,
|
|
@@ -2587,25 +2623,25 @@ class L extends HTMLElement {
|
|
|
2587
2623
|
getShellHasToolButtonsContainer: () => this.#e.hasToolButtonsContainer
|
|
2588
2624
|
});
|
|
2589
2625
|
}
|
|
2590
|
-
static #
|
|
2591
|
-
static #
|
|
2592
|
-
static #
|
|
2593
|
-
static #
|
|
2594
|
-
let e = document.getElementById(this.#
|
|
2595
|
-
return e || (e = document.createElement("style"), e.id = this.#
|
|
2626
|
+
static #J = "tbw-grid-styles";
|
|
2627
|
+
static #I = "";
|
|
2628
|
+
static #U = /* @__PURE__ */ new Map();
|
|
2629
|
+
static #ge() {
|
|
2630
|
+
let e = document.getElementById(this.#J);
|
|
2631
|
+
return e || (e = document.createElement("style"), e.id = this.#J, e.setAttribute("data-tbw-grid", "true"), document.head.appendChild(e)), e;
|
|
2596
2632
|
}
|
|
2597
|
-
static #
|
|
2598
|
-
const e = this.#
|
|
2633
|
+
static #V() {
|
|
2634
|
+
const e = this.#ge(), o = Array.from(this.#U.values()).join(`
|
|
2599
2635
|
`);
|
|
2600
|
-
e.textContent = `${this.#
|
|
2636
|
+
e.textContent = `${this.#I}
|
|
2601
2637
|
|
|
2602
2638
|
/* Plugin Styles */
|
|
2603
2639
|
${o}`;
|
|
2604
2640
|
}
|
|
2605
|
-
async #
|
|
2606
|
-
if (!L.#
|
|
2641
|
+
async #we() {
|
|
2642
|
+
if (!L.#I) {
|
|
2607
2643
|
if (ge.length > 0) {
|
|
2608
|
-
L.#
|
|
2644
|
+
L.#I = ge, L.#V();
|
|
2609
2645
|
return;
|
|
2610
2646
|
}
|
|
2611
2647
|
await new Promise((e) => setTimeout(e, 50));
|
|
@@ -2622,7 +2658,7 @@ ${o}`;
|
|
|
2622
2658
|
} catch {
|
|
2623
2659
|
continue;
|
|
2624
2660
|
}
|
|
2625
|
-
e ? (L.#
|
|
2661
|
+
e ? (L.#I = e, L.#V()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
|
|
2626
2662
|
"[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
|
|
2627
2663
|
"Available stylesheets:",
|
|
2628
2664
|
Array.from(document.styleSheets).map((o) => o.href || "(inline)")
|
|
@@ -2633,10 +2669,10 @@ ${o}`;
|
|
|
2633
2669
|
}
|
|
2634
2670
|
}
|
|
2635
2671
|
getPlugin(e) {
|
|
2636
|
-
return this.#
|
|
2672
|
+
return this.#n?.getPlugin(e);
|
|
2637
2673
|
}
|
|
2638
2674
|
getPluginByName(e) {
|
|
2639
|
-
return this.#
|
|
2675
|
+
return this.#n?.getPluginByName(e);
|
|
2640
2676
|
}
|
|
2641
2677
|
requestRender() {
|
|
2642
2678
|
this.#s.requestPhase(A.ROWS, "plugin:requestRender");
|
|
@@ -2650,26 +2686,26 @@ ${o}`;
|
|
|
2650
2686
|
requestAfterRender() {
|
|
2651
2687
|
this.#s.requestPhase(A.STYLE, "plugin:requestAfterRender");
|
|
2652
2688
|
}
|
|
2653
|
-
#
|
|
2654
|
-
this.#
|
|
2655
|
-
const e = this.#
|
|
2656
|
-
this.#
|
|
2689
|
+
#Q() {
|
|
2690
|
+
this.#n = new ao(this);
|
|
2691
|
+
const e = this.#o?.plugins, o = Array.isArray(e) ? e : [];
|
|
2692
|
+
this.#n.attachAll(o);
|
|
2657
2693
|
}
|
|
2658
|
-
#
|
|
2659
|
-
const e = this.#
|
|
2694
|
+
#q() {
|
|
2695
|
+
const e = this.#n?.getPluginStyles() ?? [];
|
|
2660
2696
|
let o = !1;
|
|
2661
2697
|
for (const { name: n, styles: i } of e)
|
|
2662
|
-
L.#
|
|
2663
|
-
o && L.#
|
|
2698
|
+
L.#U.has(n) || (L.#U.set(n, i), o = !0);
|
|
2699
|
+
o && L.#V();
|
|
2664
2700
|
}
|
|
2665
|
-
#
|
|
2666
|
-
const e = this.#
|
|
2701
|
+
#ee() {
|
|
2702
|
+
const e = this.#o?.plugins, o = Array.isArray(e) ? e : [];
|
|
2667
2703
|
if (this.#_ !== o) {
|
|
2668
2704
|
if (this.#_ && this.#_.length === o.length && this.#_.every((n, i) => n === o[i])) {
|
|
2669
2705
|
this.#_ = o;
|
|
2670
2706
|
return;
|
|
2671
2707
|
}
|
|
2672
|
-
this.#
|
|
2708
|
+
this.#n && this.#n.detachAll();
|
|
2673
2709
|
for (const n of this.#e.toolPanels.keys()) {
|
|
2674
2710
|
const i = this.#e.lightDomToolPanelIds.has(n), r = this.#e.apiToolPanelIds.has(n);
|
|
2675
2711
|
if (!i && !r) {
|
|
@@ -2681,22 +2717,22 @@ ${o}`;
|
|
|
2681
2717
|
const i = this.#e.headerContentCleanups.get(n);
|
|
2682
2718
|
i && (i(), this.#e.headerContentCleanups.delete(n)), this.#e.headerContents.delete(n);
|
|
2683
2719
|
}
|
|
2684
|
-
this.#
|
|
2720
|
+
this.#Q(), this.#q(), this.#_ = o, this.#te(), this.#b = this.#n?.getAll().some((n) => n.onScroll) ?? !1;
|
|
2685
2721
|
}
|
|
2686
2722
|
}
|
|
2687
|
-
#
|
|
2688
|
-
this.#
|
|
2723
|
+
#be() {
|
|
2724
|
+
this.#n?.detachAll();
|
|
2689
2725
|
}
|
|
2690
|
-
#
|
|
2691
|
-
if (!this.#
|
|
2692
|
-
const e = this.#
|
|
2726
|
+
#te() {
|
|
2727
|
+
if (!this.#n) return;
|
|
2728
|
+
const e = this.#n.getToolPanels();
|
|
2693
2729
|
for (const { panel: n } of e)
|
|
2694
2730
|
this.#e.toolPanels.has(n.id) || this.#e.toolPanels.set(n.id, n);
|
|
2695
|
-
const o = this.#
|
|
2731
|
+
const o = this.#n.getHeaderContents();
|
|
2696
2732
|
for (const { content: n } of o)
|
|
2697
2733
|
this.#e.headerContents.has(n.id) || this.#e.headerContents.set(n.id, n);
|
|
2698
2734
|
}
|
|
2699
|
-
#
|
|
2735
|
+
#A() {
|
|
2700
2736
|
const e = L.getAdapters();
|
|
2701
2737
|
if (e.length === 0 && !this.__frameworkAdapter) return;
|
|
2702
2738
|
const o = this.__frameworkAdapter;
|
|
@@ -2713,22 +2749,27 @@ ${o}`;
|
|
|
2713
2749
|
};
|
|
2714
2750
|
}
|
|
2715
2751
|
connectedCallback() {
|
|
2716
|
-
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this.id || (this.id = `tbw-grid-${++L.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#w && (this.#w.abort(), this.#
|
|
2717
|
-
const e = this.#
|
|
2718
|
-
this.#_ = Array.isArray(e) ? e : [], this.#
|
|
2752
|
+
this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", L.version), this.id || (this.id = `tbw-grid-${++L.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#w && (this.#w.abort(), this.#z = !1), this.#w = new AbortController(), this.#p && (Re(this.#p), this.#p = void 0), I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A()), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#Q();
|
|
2753
|
+
const e = this.#o?.plugins;
|
|
2754
|
+
this.#_ = Array.isArray(e) ? e : [], this.#te(), this.#u || (this.#K(), this.#q(), this.#u = !0), this.#oe(), this.#p = Pt(
|
|
2719
2755
|
() => {
|
|
2720
|
-
this.#
|
|
2756
|
+
this.#ke();
|
|
2721
2757
|
},
|
|
2722
2758
|
{ timeout: 100 }
|
|
2723
2759
|
);
|
|
2724
2760
|
}
|
|
2725
2761
|
disconnectedCallback() {
|
|
2726
|
-
this.#p && (Re(this.#p), this.#p = void 0), this.#
|
|
2762
|
+
this.#p && (Re(this.#p), this.#p = void 0), this.#be(), Vt(this.#e), this.#c.setInitialized(!1), this.#M?.(), this.#M = void 0, je(this.#H), this.#w && (this.#w.abort(), this.#w = void 0), this.#O?.abort(), this.#O = void 0, this.#z = !1, this._resizeController && this._resizeController.dispose(), this.#C && (this.#C.disconnect(), this.#C = void 0), this.#y && (this.#y.disconnect(), this.#y = void 0, this.#W = !1), j(this), this.#S.clear(), this.#_ = void 0;
|
|
2727
2763
|
for (const e of this._rowPool)
|
|
2728
2764
|
e.remove();
|
|
2729
2765
|
this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
|
|
2730
2766
|
}
|
|
2731
2767
|
attributeChangedCallback(e, o, n) {
|
|
2768
|
+
if (e === "loading") {
|
|
2769
|
+
const i = n !== null && n !== "false";
|
|
2770
|
+
this.loading !== i && (this.loading = i);
|
|
2771
|
+
return;
|
|
2772
|
+
}
|
|
2732
2773
|
if (!(o === n || !n || n === "null" || n === "undefined"))
|
|
2733
2774
|
if (e === "rows" || e === "columns" || e === "grid-config")
|
|
2734
2775
|
try {
|
|
@@ -2739,23 +2780,23 @@ ${o}`;
|
|
|
2739
2780
|
}
|
|
2740
2781
|
else e === "fit-mode" && (this.fitMode = n);
|
|
2741
2782
|
}
|
|
2742
|
-
#
|
|
2783
|
+
#oe() {
|
|
2743
2784
|
const o = this.#i.querySelector(".tbw-grid-content") ?? this.#i.querySelector(".tbw-grid-root");
|
|
2744
2785
|
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
2745
|
-
de(this.#i, this.#e), Pe(this.#i, this.#
|
|
2746
|
-
const r = this.#
|
|
2786
|
+
de(this.#i, this.#e), Pe(this.#i, this.#o?.shell, this.#e);
|
|
2787
|
+
const r = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
2747
2788
|
r && this.#e.toolPanels.has(r) && (this.openToolPanel(), this.#e.expandedSections.add(r));
|
|
2748
2789
|
}
|
|
2749
|
-
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController =
|
|
2790
|
+
if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = xe(this), this.#L(), this.#ie(o), this.#z)
|
|
2750
2791
|
return;
|
|
2751
|
-
this.#
|
|
2792
|
+
this.#z = !0;
|
|
2752
2793
|
const n = this.disconnectSignal;
|
|
2753
2794
|
St(this, this, this.#i, n);
|
|
2754
|
-
const i = this.#
|
|
2755
|
-
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#
|
|
2795
|
+
const i = this.#o.rowHeight;
|
|
2796
|
+
i && i > 0 ? this._virtualization.rowHeight = i : requestAnimationFrame(() => this.#ne()), queueMicrotask(() => this.#ve()), this.#s.requestPhase(A.FULL, "afterConnect");
|
|
2756
2797
|
}
|
|
2757
|
-
#
|
|
2758
|
-
if (this.#
|
|
2798
|
+
#ne() {
|
|
2799
|
+
if (this.#n.hasExtraHeight())
|
|
2759
2800
|
return;
|
|
2760
2801
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2761
2802
|
if (!e) return;
|
|
@@ -2768,23 +2809,23 @@ ${o}`;
|
|
|
2768
2809
|
const i = e.getBoundingClientRect(), r = Math.max(i.height, n);
|
|
2769
2810
|
r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(A.VIRTUALIZATION, "measureRowHeight"));
|
|
2770
2811
|
}
|
|
2771
|
-
#
|
|
2772
|
-
this.#
|
|
2773
|
-
const o = this.#
|
|
2774
|
-
if (this._virtualization.container = n ?? this, this.#
|
|
2812
|
+
#ie(e) {
|
|
2813
|
+
this.#O?.abort(), this.#O = new AbortController();
|
|
2814
|
+
const o = this.#O.signal, n = e?.querySelector(".faux-vscroll"), i = e?.querySelector(".rows");
|
|
2815
|
+
if (this._virtualization.container = n ?? this, this.#b = this.#n?.getAll().some((r) => r.onScroll) ?? !1, n && i) {
|
|
2775
2816
|
n.addEventListener(
|
|
2776
2817
|
"scroll",
|
|
2777
2818
|
() => {
|
|
2778
|
-
if (!this._virtualization.enabled && !this.#
|
|
2779
|
-
const l = n.scrollTop,
|
|
2819
|
+
if (!this._virtualization.enabled && !this.#b) return;
|
|
2820
|
+
const l = n.scrollTop, a = this._virtualization.rowHeight;
|
|
2780
2821
|
if (this._rows.length <= this._virtualization.bypassThreshold)
|
|
2781
2822
|
i.style.transform = `translateY(${-l}px)`;
|
|
2782
2823
|
else {
|
|
2783
|
-
const
|
|
2824
|
+
const c = Math.floor(l / a), h = c - c % 2, u = -(l - h * a);
|
|
2784
2825
|
i.style.transform = `translateY(${u}px)`;
|
|
2785
2826
|
}
|
|
2786
2827
|
this.#r = l, this.#v || (this.#v = requestAnimationFrame(() => {
|
|
2787
|
-
this.#v = 0, this.#r !== null && (this.#
|
|
2828
|
+
this.#v = 0, this.#r !== null && (this.#De(this.#r), this.#r = null);
|
|
2788
2829
|
}));
|
|
2789
2830
|
},
|
|
2790
2831
|
{ passive: !0, signal: o }
|
|
@@ -2793,17 +2834,17 @@ ${o}`;
|
|
|
2793
2834
|
r && (r.addEventListener(
|
|
2794
2835
|
"wheel",
|
|
2795
2836
|
(l) => {
|
|
2796
|
-
const
|
|
2797
|
-
if (
|
|
2798
|
-
const
|
|
2799
|
-
(
|
|
2800
|
-
} else if (!
|
|
2801
|
-
const { scrollTop:
|
|
2802
|
-
(l.deltaY > 0 &&
|
|
2837
|
+
const a = l.shiftKey || Math.abs(l.deltaX) > Math.abs(l.deltaY);
|
|
2838
|
+
if (a && s) {
|
|
2839
|
+
const c = l.shiftKey ? l.deltaY : l.deltaX, { scrollLeft: h, scrollWidth: u, clientWidth: p } = s;
|
|
2840
|
+
(c > 0 && h < u - p || c < 0 && h > 0) && (l.preventDefault(), s.scrollLeft += c);
|
|
2841
|
+
} else if (!a) {
|
|
2842
|
+
const { scrollTop: c, scrollHeight: h, clientHeight: u } = n;
|
|
2843
|
+
(l.deltaY > 0 && c < h - u || l.deltaY < 0 && c > 0) && (l.preventDefault(), n.scrollTop += l.deltaY);
|
|
2803
2844
|
}
|
|
2804
2845
|
},
|
|
2805
2846
|
{ passive: !1, signal: o }
|
|
2806
|
-
), eo(r, this.#
|
|
2847
|
+
), eo(r, this.#H, { fauxScrollbar: n, scrollArea: s }, o));
|
|
2807
2848
|
}
|
|
2808
2849
|
this._bodyEl && Et(this, this._bodyEl, o), this.#C?.disconnect(), this._virtualization.viewportEl && (this.#C = new ResizeObserver(() => {
|
|
2809
2850
|
this.#s.requestPhase(A.VIRTUALIZATION, "resize-observer");
|
|
@@ -2822,18 +2863,18 @@ ${o}`;
|
|
|
2822
2863
|
{ signal: o }
|
|
2823
2864
|
);
|
|
2824
2865
|
}
|
|
2825
|
-
#
|
|
2826
|
-
#
|
|
2827
|
-
if (this.#
|
|
2866
|
+
#W = !1;
|
|
2867
|
+
#me() {
|
|
2868
|
+
if (this.#W) return;
|
|
2828
2869
|
const e = this._bodyEl?.querySelector(".data-grid-row");
|
|
2829
|
-
e && (this.#
|
|
2830
|
-
this.#
|
|
2870
|
+
e && (this.#W = !0, this.#y?.disconnect(), this.#y = new ResizeObserver(() => {
|
|
2871
|
+
this.#ne();
|
|
2831
2872
|
}), this.#y.observe(e));
|
|
2832
2873
|
}
|
|
2833
|
-
#
|
|
2874
|
+
#P(e, o) {
|
|
2834
2875
|
this.dispatchEvent(new CustomEvent(e, { detail: o, bubbles: !0, composed: !0 }));
|
|
2835
2876
|
}
|
|
2836
|
-
#
|
|
2877
|
+
#ve() {
|
|
2837
2878
|
this._bodyEl?.querySelectorAll(".data-grid-row")?.forEach((o, n) => {
|
|
2838
2879
|
const i = n === this._focusRow;
|
|
2839
2880
|
o.setAttribute("aria-selected", String(i)), o.querySelectorAll(".cell").forEach((r, s) => {
|
|
@@ -2841,81 +2882,81 @@ ${o}`;
|
|
|
2841
2882
|
});
|
|
2842
2883
|
});
|
|
2843
2884
|
}
|
|
2844
|
-
|
|
2845
|
-
this.#
|
|
2885
|
+
#$(e) {
|
|
2886
|
+
this.#m[e] = !0, !this.#g && (this.#g = !0, queueMicrotask(() => this.#Ce()));
|
|
2846
2887
|
}
|
|
2847
|
-
#
|
|
2888
|
+
#Ce() {
|
|
2848
2889
|
if (!this.#g || !this.#f) {
|
|
2849
2890
|
this.#g = !1;
|
|
2850
2891
|
return;
|
|
2851
2892
|
}
|
|
2852
|
-
const e = this.#
|
|
2853
|
-
if (this.#g = !1, this.#
|
|
2893
|
+
const e = this.#m;
|
|
2894
|
+
if (this.#g = !1, this.#m = {
|
|
2854
2895
|
rows: !1,
|
|
2855
2896
|
columns: !1,
|
|
2856
2897
|
gridConfig: !1,
|
|
2857
2898
|
fitMode: !1
|
|
2858
2899
|
}, e.gridConfig) {
|
|
2859
|
-
this.#
|
|
2900
|
+
this.#Se(), e.rows && this.#re();
|
|
2860
2901
|
return;
|
|
2861
2902
|
}
|
|
2862
|
-
e.columns && this.#
|
|
2903
|
+
e.columns && this.#_e(), e.rows && this.#re(), e.fitMode && this.#Ee();
|
|
2863
2904
|
}
|
|
2864
|
-
#
|
|
2865
|
-
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this
|
|
2905
|
+
#re() {
|
|
2906
|
+
this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#B(), this.#s.requestPhase(A.ROWS, "applyRowsUpdate");
|
|
2866
2907
|
}
|
|
2867
|
-
|
|
2868
|
-
this.#
|
|
2869
|
-
const e = this.#
|
|
2908
|
+
#B() {
|
|
2909
|
+
this.#E.clear();
|
|
2910
|
+
const e = this.#o.getRowId;
|
|
2870
2911
|
this._rows.forEach((o, n) => {
|
|
2871
|
-
const i = this.#
|
|
2872
|
-
i !== void 0 && this.#
|
|
2912
|
+
const i = this.#se(o, e);
|
|
2913
|
+
i !== void 0 && this.#E.set(i, { row: o, index: n });
|
|
2873
2914
|
});
|
|
2874
2915
|
}
|
|
2875
|
-
#
|
|
2916
|
+
#se(e, o) {
|
|
2876
2917
|
if (o)
|
|
2877
2918
|
return o(e);
|
|
2878
2919
|
const n = e;
|
|
2879
2920
|
if ("id" in n && n.id != null) return String(n.id);
|
|
2880
2921
|
if ("_id" in n && n._id != null) return String(n._id);
|
|
2881
2922
|
}
|
|
2882
|
-
#
|
|
2883
|
-
const n = this.#
|
|
2923
|
+
#ye(e, o) {
|
|
2924
|
+
const n = this.#se(e, o);
|
|
2884
2925
|
if (n === void 0)
|
|
2885
2926
|
throw new Error(
|
|
2886
2927
|
'[tbw-grid] Cannot determine row ID. Configure getRowId in gridConfig or ensure rows have an "id" property.'
|
|
2887
2928
|
);
|
|
2888
2929
|
return n;
|
|
2889
2930
|
}
|
|
2890
|
-
#
|
|
2891
|
-
j(this), this.#t.merge(), this.#
|
|
2931
|
+
#_e() {
|
|
2932
|
+
j(this), this.#t.merge(), this.#L();
|
|
2892
2933
|
}
|
|
2893
|
-
#
|
|
2894
|
-
this.#t.merge(), this.#
|
|
2934
|
+
#Ee() {
|
|
2935
|
+
this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, me(this)) : (this._columns.forEach((o) => {
|
|
2895
2936
|
!o.__userResized && o.__autoSized && delete o.width;
|
|
2896
2937
|
}), B(this));
|
|
2897
2938
|
}
|
|
2898
|
-
#
|
|
2939
|
+
#Se() {
|
|
2899
2940
|
I(this, this.#e), q(this, this.#e);
|
|
2900
2941
|
const e = !!this.#i.querySelector(".has-shell"), o = !!this.#i.querySelector(".tbw-tool-panel"), n = this.#i.querySelectorAll(".tbw-accordion-section").length;
|
|
2901
|
-
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#
|
|
2902
|
-
const i = Ye(this.#
|
|
2942
|
+
this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), W(this, this.#e, this.#A()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
2943
|
+
const i = Ye(this.#o?.shell), r = (this.#o?.shell?.toolPanels?.length ?? 0) > 0, s = (this.#o?.shell?.toolPanels?.length ?? 0) !== n;
|
|
2903
2944
|
if (e !== i || !e && i || !o && r || o && s) {
|
|
2904
|
-
this.#
|
|
2945
|
+
this.#K(), this.#q(), this.#oe(), this.#B();
|
|
2905
2946
|
return;
|
|
2906
2947
|
}
|
|
2907
|
-
e && this.#
|
|
2948
|
+
e && this.#Re(), this.#B(), this.#s.requestPhase(A.COLUMNS, "applyGridConfigUpdate");
|
|
2908
2949
|
}
|
|
2909
|
-
#
|
|
2950
|
+
#Re() {
|
|
2910
2951
|
const e = this.#i.querySelector(".tbw-shell-header");
|
|
2911
2952
|
if (!e) return;
|
|
2912
|
-
const o = this.#
|
|
2953
|
+
const o = this.#o.shell?.header?.title ?? this.#e.lightDomTitle;
|
|
2913
2954
|
let n = e.querySelector(".tbw-shell-title");
|
|
2914
2955
|
o ? (n || (n = document.createElement("h2"), n.className = "tbw-shell-title", n.setAttribute("part", "shell-title"), e.insertBefore(n, e.firstChild)), n.textContent = o) : n && n.remove();
|
|
2915
2956
|
}
|
|
2916
|
-
#
|
|
2917
|
-
if (this.#
|
|
2918
|
-
const e = this.#
|
|
2957
|
+
#xe() {
|
|
2958
|
+
if (this.#n) {
|
|
2959
|
+
const e = this.#F.length > 0 ? this.#F : this._columns, o = e.filter((r) => !r.hidden), n = e.filter((r) => r.hidden), i = this.#n.processColumns([...o]);
|
|
2919
2960
|
if (i !== o) {
|
|
2920
2961
|
new Set(o.map((l) => l.field));
|
|
2921
2962
|
const r = new Set(i.map((l) => l.field));
|
|
@@ -2924,12 +2965,12 @@ ${o}`;
|
|
|
2924
2965
|
this._columns = [...e];
|
|
2925
2966
|
}
|
|
2926
2967
|
}
|
|
2927
|
-
#
|
|
2968
|
+
#Te() {
|
|
2928
2969
|
j(this);
|
|
2929
|
-
const e = Array.isArray(this.#a) ? [...this.#a] : [], o = this.#
|
|
2970
|
+
const e = Array.isArray(this.#a) ? [...this.#a] : [], o = this.#n?.processRows(e) ?? e;
|
|
2930
2971
|
this._rows = o;
|
|
2931
2972
|
}
|
|
2932
|
-
#
|
|
2973
|
+
#Ae(e) {
|
|
2933
2974
|
const o = {
|
|
2934
2975
|
...Ze,
|
|
2935
2976
|
...e.animation
|
|
@@ -2937,41 +2978,85 @@ ${o}`;
|
|
|
2937
2978
|
let i = 1;
|
|
2938
2979
|
n === !1 || n === "off" ? i = 0 : (n === !0 || n === "on") && (i = 1), this.style.setProperty("--tbw-animation-duration", `${o.duration}ms`), this.style.setProperty("--tbw-animation-easing", o.easing ?? "ease-out"), this.style.setProperty("--tbw-animation-enabled", String(i)), this.dataset.animationMode = typeof n == "boolean" ? n ? "on" : "off" : n;
|
|
2939
2980
|
}
|
|
2940
|
-
#
|
|
2941
|
-
this.#
|
|
2981
|
+
#G(e, o, n = this.__rowRenderEpoch) {
|
|
2982
|
+
this.#R || (this.#R = (i, r, s) => this.#n?.renderRow(i, r, s) ?? !1), bt(this, e, o, n, this.#R);
|
|
2942
2983
|
}
|
|
2943
|
-
#
|
|
2944
|
-
#
|
|
2945
|
-
#
|
|
2946
|
-
if (e === this.#
|
|
2984
|
+
#X = -1;
|
|
2985
|
+
#le = -1;
|
|
2986
|
+
#ae(e, o) {
|
|
2987
|
+
if (e === this.#X && o === this.#le)
|
|
2947
2988
|
return;
|
|
2948
|
-
const n = this.#
|
|
2949
|
-
this.#
|
|
2989
|
+
const n = this.#X;
|
|
2990
|
+
this.#X = e, this.#le = o, this.__rowsBodyEl && (this.__rowsBodyEl.setAttribute("aria-rowcount", String(e)), this.__rowsBodyEl.setAttribute("aria-colcount", String(o))), e !== n && this._bodyEl && (e > 0 ? this._bodyEl.setAttribute("role", "rowgroup") : this._bodyEl.removeAttribute("role"));
|
|
2950
2991
|
}
|
|
2951
|
-
#
|
|
2952
|
-
#
|
|
2953
|
-
#
|
|
2992
|
+
#ce;
|
|
2993
|
+
#de;
|
|
2994
|
+
#Pe() {
|
|
2954
2995
|
if (!this.__rowsBodyEl) return;
|
|
2955
|
-
const e = this.#
|
|
2956
|
-
n !== this.#
|
|
2957
|
-
const i = this.#
|
|
2958
|
-
i !== this.#
|
|
2996
|
+
const e = this.#o.gridAriaLabel, o = this.#o.shell?.header?.title ?? this.#e?.lightDomTitle ?? void 0, n = e ?? o;
|
|
2997
|
+
n !== this.#ce && (this.#ce = n, n ? this.__rowsBodyEl.setAttribute("aria-label", n) : this.__rowsBodyEl.removeAttribute("aria-label"));
|
|
2998
|
+
const i = this.#o.gridAriaDescribedBy;
|
|
2999
|
+
i !== this.#de && (this.#de = i, i ? this.__rowsBodyEl.setAttribute("aria-describedby", i) : this.__rowsBodyEl.removeAttribute("aria-describedby"));
|
|
3000
|
+
}
|
|
3001
|
+
#Le(e) {
|
|
3002
|
+
const o = document.createElement("div");
|
|
3003
|
+
return o.className = `tbw-spinner tbw-spinner--${e}`, o.setAttribute("role", "progressbar"), o.setAttribute("aria-label", "Loading"), o;
|
|
3004
|
+
}
|
|
3005
|
+
#He(e) {
|
|
3006
|
+
const o = this.#o?.loadingRenderer;
|
|
3007
|
+
if (o) {
|
|
3008
|
+
const n = o({ size: e });
|
|
3009
|
+
if (typeof n == "string") {
|
|
3010
|
+
const i = document.createElement("div");
|
|
3011
|
+
return i.innerHTML = n, i;
|
|
3012
|
+
}
|
|
3013
|
+
return n;
|
|
3014
|
+
}
|
|
3015
|
+
return this.#Le(e);
|
|
2959
3016
|
}
|
|
2960
|
-
#
|
|
3017
|
+
#Oe() {
|
|
3018
|
+
const e = this.querySelector(".tbw-grid-root");
|
|
3019
|
+
if (e)
|
|
3020
|
+
if (this.#k) {
|
|
3021
|
+
if (!this.#N) {
|
|
3022
|
+
const o = document.createElement("div");
|
|
3023
|
+
o.className = "tbw-loading-overlay", o.setAttribute("role", "status"), o.setAttribute("aria-live", "polite"), o.appendChild(this.#He("large")), this.#N = o;
|
|
3024
|
+
}
|
|
3025
|
+
e.appendChild(this.#N);
|
|
3026
|
+
} else
|
|
3027
|
+
this.#N?.remove();
|
|
3028
|
+
}
|
|
3029
|
+
#he(e, o) {
|
|
3030
|
+
const n = this.#E.get(e);
|
|
3031
|
+
if (!n) return;
|
|
3032
|
+
const i = this.findRenderedRowElement?.(n.index);
|
|
3033
|
+
i && (o ? (i.classList.add("tbw-row-loading"), i.setAttribute("aria-busy", "true")) : (i.classList.remove("tbw-row-loading"), i.removeAttribute("aria-busy")));
|
|
3034
|
+
}
|
|
3035
|
+
#ue(e, o, n) {
|
|
3036
|
+
const i = this.#E.get(e);
|
|
3037
|
+
if (!i) return;
|
|
3038
|
+
const r = this.findRenderedRowElement?.(i.index);
|
|
3039
|
+
if (!r) return;
|
|
3040
|
+
const s = this._visibleColumns.findIndex((a) => a.field === o);
|
|
3041
|
+
if (s < 0) return;
|
|
3042
|
+
const l = r.children[s];
|
|
3043
|
+
l && (n ? (l.classList.add("tbw-cell-loading"), l.setAttribute("aria-busy", "true")) : (l.classList.remove("tbw-cell-loading"), l.removeAttribute("aria-busy")));
|
|
3044
|
+
}
|
|
3045
|
+
#L() {
|
|
2961
3046
|
if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
|
|
2962
|
-
if (this.#t.parseLightDomColumns(this), this.#
|
|
2963
|
-
const e = this.#
|
|
2964
|
-
this.#
|
|
2965
|
-
const o = this.#
|
|
3047
|
+
if (this.#t.parseLightDomColumns(this), this.#D) {
|
|
3048
|
+
const e = this.#D;
|
|
3049
|
+
this.#D = void 0, this.#t.merge();
|
|
3050
|
+
const o = this.#n?.getAll() ?? [];
|
|
2966
3051
|
this.#t.applyState(e, o);
|
|
2967
3052
|
}
|
|
2968
3053
|
this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(A.FULL, "setup");
|
|
2969
3054
|
}
|
|
2970
3055
|
}
|
|
2971
|
-
#
|
|
2972
|
-
if (this.refreshVirtualWindow(!1), this.#
|
|
2973
|
-
const o = this._virtualization.container, n = this.#
|
|
2974
|
-
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.#
|
|
3056
|
+
#De(e) {
|
|
3057
|
+
if (this.refreshVirtualWindow(!1), this.#n?.onScrollRender(), this.#b) {
|
|
3058
|
+
const o = this._virtualization.container, n = this.#pe;
|
|
3059
|
+
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.#n?.onScroll(n);
|
|
2975
3060
|
}
|
|
2976
3061
|
}
|
|
2977
3062
|
findHeaderRow() {
|
|
@@ -2986,7 +3071,7 @@ ${o}`;
|
|
|
2986
3071
|
_dispatchCellClick(e, o, n, i) {
|
|
2987
3072
|
const r = this._rows[o], s = this._columns[n];
|
|
2988
3073
|
if (!r || !s) return !1;
|
|
2989
|
-
const l = s.field,
|
|
3074
|
+
const l = s.field, a = r[l], c = new CustomEvent("cell-activate", {
|
|
2990
3075
|
cancelable: !0,
|
|
2991
3076
|
bubbles: !0,
|
|
2992
3077
|
composed: !0,
|
|
@@ -2994,25 +3079,25 @@ ${o}`;
|
|
|
2994
3079
|
rowIndex: o,
|
|
2995
3080
|
colIndex: n,
|
|
2996
3081
|
field: l,
|
|
2997
|
-
value:
|
|
3082
|
+
value: a,
|
|
2998
3083
|
row: r,
|
|
2999
3084
|
cellEl: i,
|
|
3000
3085
|
trigger: "pointer",
|
|
3001
3086
|
originalEvent: e
|
|
3002
3087
|
}
|
|
3003
3088
|
});
|
|
3004
|
-
if (this.dispatchEvent(
|
|
3089
|
+
if (this.dispatchEvent(c), c.defaultPrevented)
|
|
3005
3090
|
return !0;
|
|
3006
3091
|
const h = {
|
|
3007
3092
|
row: r,
|
|
3008
3093
|
rowIndex: o,
|
|
3009
3094
|
colIndex: n,
|
|
3010
3095
|
field: l,
|
|
3011
|
-
value:
|
|
3096
|
+
value: a,
|
|
3012
3097
|
cellEl: i,
|
|
3013
3098
|
originalEvent: e
|
|
3014
|
-
}, u = this.#
|
|
3015
|
-
return this.#
|
|
3099
|
+
}, u = this.#n?.onCellClick(h) ?? !1;
|
|
3100
|
+
return this.#P("cell-click", h), u;
|
|
3016
3101
|
}
|
|
3017
3102
|
_dispatchRowClick(e, o, n, i) {
|
|
3018
3103
|
if (!n) return !1;
|
|
@@ -3021,8 +3106,8 @@ ${o}`;
|
|
|
3021
3106
|
row: n,
|
|
3022
3107
|
rowEl: i,
|
|
3023
3108
|
originalEvent: e
|
|
3024
|
-
}, s = this.#
|
|
3025
|
-
return this.#
|
|
3109
|
+
}, s = this.#n?.onRowClick(r) ?? !1;
|
|
3110
|
+
return this.#P("row-click", r), s;
|
|
3026
3111
|
}
|
|
3027
3112
|
_dispatchHeaderClick(e, o, n) {
|
|
3028
3113
|
const i = this._columns[o];
|
|
@@ -3034,37 +3119,37 @@ ${o}`;
|
|
|
3034
3119
|
headerEl: n,
|
|
3035
3120
|
originalEvent: e
|
|
3036
3121
|
};
|
|
3037
|
-
return this.#
|
|
3122
|
+
return this.#n?.onHeaderClick(r) ?? !1;
|
|
3038
3123
|
}
|
|
3039
3124
|
_dispatchKeyDown(e) {
|
|
3040
|
-
return this.#
|
|
3125
|
+
return this.#n?.onKeyDown(e) ?? !1;
|
|
3041
3126
|
}
|
|
3042
3127
|
_getHorizontalScrollOffsets(e, o) {
|
|
3043
|
-
return this.#
|
|
3128
|
+
return this.#n?.getHorizontalScrollOffsets(e, o) ?? { left: 0, right: 0 };
|
|
3044
3129
|
}
|
|
3045
3130
|
queryPlugins(e) {
|
|
3046
|
-
return this.#
|
|
3131
|
+
return this.#n?.queryPlugins(e) ?? [];
|
|
3047
3132
|
}
|
|
3048
3133
|
_dispatchCellMouseDown(e) {
|
|
3049
|
-
return this.#
|
|
3134
|
+
return this.#n?.onCellMouseDown(e) ?? !1;
|
|
3050
3135
|
}
|
|
3051
3136
|
_dispatchCellMouseMove(e) {
|
|
3052
|
-
this.#
|
|
3137
|
+
this.#n?.onCellMouseMove(e);
|
|
3053
3138
|
}
|
|
3054
3139
|
_dispatchCellMouseUp(e) {
|
|
3055
|
-
this.#
|
|
3140
|
+
this.#n?.onCellMouseUp(e);
|
|
3056
3141
|
}
|
|
3057
3142
|
_afterCellRender(e) {
|
|
3058
|
-
this.#
|
|
3143
|
+
this.#n?.afterCellRender(e);
|
|
3059
3144
|
}
|
|
3060
3145
|
_hasAfterCellRenderHook() {
|
|
3061
|
-
return this.#
|
|
3146
|
+
return this.#n?.hasAfterCellRenderHook() ?? !1;
|
|
3062
3147
|
}
|
|
3063
3148
|
_afterRowRender(e) {
|
|
3064
|
-
this.#
|
|
3149
|
+
this.#n?.afterRowRender(e);
|
|
3065
3150
|
}
|
|
3066
3151
|
_hasAfterRowRenderHook() {
|
|
3067
|
-
return this.#
|
|
3152
|
+
return this.#n?.hasAfterRowRenderHook() ?? !1;
|
|
3068
3153
|
}
|
|
3069
3154
|
async ready() {
|
|
3070
3155
|
return this.#d;
|
|
@@ -3073,32 +3158,32 @@ ${o}`;
|
|
|
3073
3158
|
return this.#s.requestPhase(A.FULL, "forceLayout"), this.#s.whenReady();
|
|
3074
3159
|
}
|
|
3075
3160
|
async getConfig() {
|
|
3076
|
-
return Object.freeze({ ...this.#
|
|
3161
|
+
return Object.freeze({ ...this.#o || {} });
|
|
3077
3162
|
}
|
|
3078
3163
|
getRowId(e) {
|
|
3079
|
-
return this.#
|
|
3164
|
+
return this.#ye(e, this.#o.getRowId);
|
|
3080
3165
|
}
|
|
3081
3166
|
getRow(e) {
|
|
3082
|
-
return this.#
|
|
3167
|
+
return this.#E.get(e)?.row;
|
|
3083
3168
|
}
|
|
3084
3169
|
updateRow(e, o, n = "api") {
|
|
3085
|
-
const i = this.#
|
|
3170
|
+
const i = this.#E.get(e);
|
|
3086
3171
|
if (!i)
|
|
3087
3172
|
throw new Error(
|
|
3088
3173
|
`[tbw-grid] Row with ID "${e}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
3089
3174
|
);
|
|
3090
3175
|
const { row: r, index: s } = i, l = [];
|
|
3091
|
-
for (const [
|
|
3092
|
-
const h = r[
|
|
3093
|
-
h !==
|
|
3176
|
+
for (const [a, c] of Object.entries(o)) {
|
|
3177
|
+
const h = r[a];
|
|
3178
|
+
h !== c && (l.push({ field: a, oldValue: h, newValue: c }), r[a] = c);
|
|
3094
3179
|
}
|
|
3095
|
-
for (const { field:
|
|
3096
|
-
this.#
|
|
3180
|
+
for (const { field: a, oldValue: c, newValue: h } of l)
|
|
3181
|
+
this.#P("cell-change", {
|
|
3097
3182
|
row: r,
|
|
3098
3183
|
rowId: e,
|
|
3099
3184
|
rowIndex: s,
|
|
3100
|
-
field:
|
|
3101
|
-
oldValue:
|
|
3185
|
+
field: a,
|
|
3186
|
+
oldValue: c,
|
|
3102
3187
|
newValue: h,
|
|
3103
3188
|
changes: o,
|
|
3104
3189
|
source: n
|
|
@@ -3108,19 +3193,19 @@ ${o}`;
|
|
|
3108
3193
|
updateRows(e, o = "api") {
|
|
3109
3194
|
let n = !1;
|
|
3110
3195
|
for (const { id: i, changes: r } of e) {
|
|
3111
|
-
const s = this.#
|
|
3196
|
+
const s = this.#E.get(i);
|
|
3112
3197
|
if (!s)
|
|
3113
3198
|
throw new Error(
|
|
3114
3199
|
`[tbw-grid] Row with ID "${i}" not found. Ensure the row exists and getRowId is correctly configured.`
|
|
3115
3200
|
);
|
|
3116
|
-
const { row: l, index:
|
|
3117
|
-
for (const [
|
|
3118
|
-
const u = l[
|
|
3119
|
-
u !== h && (n = !0, l[
|
|
3201
|
+
const { row: l, index: a } = s;
|
|
3202
|
+
for (const [c, h] of Object.entries(r)) {
|
|
3203
|
+
const u = l[c];
|
|
3204
|
+
u !== h && (n = !0, l[c] = h, this.#P("cell-change", {
|
|
3120
3205
|
row: l,
|
|
3121
3206
|
rowId: i,
|
|
3122
|
-
rowIndex:
|
|
3123
|
-
field:
|
|
3207
|
+
rowIndex: a,
|
|
3208
|
+
field: c,
|
|
3124
3209
|
oldValue: u,
|
|
3125
3210
|
newValue: h,
|
|
3126
3211
|
changes: r,
|
|
@@ -3134,10 +3219,10 @@ ${o}`;
|
|
|
3134
3219
|
pe(this, e, o);
|
|
3135
3220
|
}
|
|
3136
3221
|
animateRows(e, o) {
|
|
3137
|
-
|
|
3222
|
+
kt(this, e, o);
|
|
3138
3223
|
}
|
|
3139
3224
|
animateRowById(e, o) {
|
|
3140
|
-
return
|
|
3225
|
+
return Nt(this, e, o);
|
|
3141
3226
|
}
|
|
3142
3227
|
setColumnVisible(e, o) {
|
|
3143
3228
|
const n = this.#t.setColumnVisible(e, o);
|
|
@@ -3163,27 +3248,27 @@ ${o}`;
|
|
|
3163
3248
|
return this.#t.getColumnOrder();
|
|
3164
3249
|
}
|
|
3165
3250
|
getColumnState() {
|
|
3166
|
-
const e = this.#
|
|
3251
|
+
const e = this.#n?.getAll() ?? [];
|
|
3167
3252
|
return this.#t.collectState(e);
|
|
3168
3253
|
}
|
|
3169
3254
|
set columnState(e) {
|
|
3170
|
-
e && (this.#
|
|
3255
|
+
e && (this.#D = e, this.#t.initialColumnState = e, this.#u && this.#ze(e));
|
|
3171
3256
|
}
|
|
3172
3257
|
get columnState() {
|
|
3173
3258
|
return this.getColumnState();
|
|
3174
3259
|
}
|
|
3175
|
-
#
|
|
3176
|
-
const o = this.#
|
|
3177
|
-
this.#t.applyState(e, o), this.#
|
|
3260
|
+
#ze(e) {
|
|
3261
|
+
const o = this.#n?.getAll() ?? [];
|
|
3262
|
+
this.#t.applyState(e, o), this.#L();
|
|
3178
3263
|
}
|
|
3179
3264
|
requestStateChange() {
|
|
3180
|
-
const e = this.#
|
|
3265
|
+
const e = this.#n?.getAll() ?? [];
|
|
3181
3266
|
this.#t.requestStateChange(e);
|
|
3182
3267
|
}
|
|
3183
3268
|
resetColumnState() {
|
|
3184
|
-
this.#
|
|
3185
|
-
const e = this.#
|
|
3186
|
-
this.#t.resetState(e), this.#t.merge(), this.#
|
|
3269
|
+
this.#D = void 0, this.__originalOrder = [];
|
|
3270
|
+
const e = this.#n?.getAll() ?? [];
|
|
3271
|
+
this.#t.resetState(e), this.#t.merge(), this.#L();
|
|
3187
3272
|
}
|
|
3188
3273
|
get isToolPanelOpen() {
|
|
3189
3274
|
return this.#c.isPanelOpen;
|
|
@@ -3230,140 +3315,140 @@ ${o}`;
|
|
|
3230
3315
|
unregisterToolbarContent(e) {
|
|
3231
3316
|
this.#c.unregisterToolbarContent(e);
|
|
3232
3317
|
}
|
|
3233
|
-
#
|
|
3318
|
+
#Y = !1;
|
|
3234
3319
|
refreshShellHeader() {
|
|
3235
|
-
this.#
|
|
3236
|
-
this.#
|
|
3320
|
+
this.#Y || (this.#Y = !0, queueMicrotask(() => {
|
|
3321
|
+
this.#Y = !1, this.isConnected && (I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A()), this.#t.markSourcesChanged(), this.#t.merge(), this.#K(), this.#q(), this.#Me());
|
|
3237
3322
|
}));
|
|
3238
3323
|
}
|
|
3239
|
-
#
|
|
3324
|
+
#Me() {
|
|
3240
3325
|
const o = this.#i.querySelector(".tbw-grid-content") ?? this.#i.querySelector(".tbw-grid-root");
|
|
3241
3326
|
if (this._headerRowEl = o?.querySelector(".header-row"), this._virtualization.totalHeightEl = o?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = o?.querySelector(".rows-viewport"), this._bodyEl = o?.querySelector(".rows"), this.__rowsBodyEl = o?.querySelector(".rows-body"), this.#c.isInitialized) {
|
|
3242
|
-
de(this.#i, this.#e), Pe(this.#i, this.#
|
|
3243
|
-
const n = this.#
|
|
3327
|
+
de(this.#i, this.#e), Pe(this.#i, this.#o?.shell, this.#e);
|
|
3328
|
+
const n = this.#o?.shell?.toolPanel?.defaultOpen;
|
|
3244
3329
|
n && this.#e.toolPanels.has(n) && (this.openToolPanel(), this.#e.expandedSections.add(n));
|
|
3245
3330
|
}
|
|
3246
|
-
this._resizeController =
|
|
3331
|
+
this._resizeController = xe(this), this.#ie(o), this.#s.requestPhase(A.COLUMNS, "shellRefresh");
|
|
3247
3332
|
}
|
|
3248
|
-
#
|
|
3333
|
+
#S = /* @__PURE__ */ new Map();
|
|
3249
3334
|
registerStyles(e, o) {
|
|
3250
|
-
let n = this.#
|
|
3251
|
-
n || (n = new CSSStyleSheet(), this.#
|
|
3335
|
+
let n = this.#S.get(e);
|
|
3336
|
+
n || (n = new CSSStyleSheet(), this.#S.set(e, n)), n.replaceSync(o), this.#fe();
|
|
3252
3337
|
}
|
|
3253
3338
|
unregisterStyles(e) {
|
|
3254
|
-
this.#
|
|
3339
|
+
this.#S.delete(e) && this.#fe();
|
|
3255
3340
|
}
|
|
3256
3341
|
getRegisteredStyles() {
|
|
3257
|
-
return Array.from(this.#
|
|
3342
|
+
return Array.from(this.#S.keys());
|
|
3258
3343
|
}
|
|
3259
|
-
#
|
|
3260
|
-
const e = Array.from(this.#
|
|
3261
|
-
(n) => !Array.from(this.#
|
|
3344
|
+
#fe() {
|
|
3345
|
+
const e = Array.from(this.#S.values()), o = document.adoptedStyleSheets.filter(
|
|
3346
|
+
(n) => !Array.from(this.#S.values()).includes(n)
|
|
3262
3347
|
);
|
|
3263
3348
|
document.adoptedStyleSheets = [...o, ...e];
|
|
3264
3349
|
}
|
|
3265
|
-
#
|
|
3350
|
+
#ke() {
|
|
3266
3351
|
const e = () => {
|
|
3267
3352
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3268
|
-
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#
|
|
3353
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A());
|
|
3269
3354
|
const r = this.#e.lightDomTitle, s = this.#e.hasToolButtonsContainer;
|
|
3270
3355
|
if (r && !n || s && !i) {
|
|
3271
3356
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3272
3357
|
const l = this.#i.querySelector(".tbw-shell-header");
|
|
3273
3358
|
if (l) {
|
|
3274
|
-
const
|
|
3275
|
-
this.#
|
|
3359
|
+
const a = Ae(
|
|
3360
|
+
this.#o.shell,
|
|
3276
3361
|
this.#e,
|
|
3277
|
-
this.#
|
|
3278
|
-
),
|
|
3279
|
-
|
|
3280
|
-
const h =
|
|
3281
|
-
h && (l.replaceWith(h), this.#
|
|
3362
|
+
this.#o.icons?.toolPanel
|
|
3363
|
+
), c = document.createElement("div");
|
|
3364
|
+
c.innerHTML = a;
|
|
3365
|
+
const h = c.firstElementChild;
|
|
3366
|
+
h && (l.replaceWith(h), this.#Z());
|
|
3282
3367
|
}
|
|
3283
3368
|
}
|
|
3284
3369
|
}, o = () => {
|
|
3285
|
-
this.__lightDomColumnsCache = void 0, this.#
|
|
3370
|
+
this.__lightDomColumnsCache = void 0, this.#L();
|
|
3286
3371
|
};
|
|
3287
3372
|
this.#t.registerLightDomHandler("tbw-grid-header", e), this.#t.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#t.registerLightDomHandler("tbw-grid-tool-panel", e), this.#t.registerLightDomHandler("tbw-grid-column", o), this.#t.registerLightDomHandler("tbw-grid-detail", o), this.#t.observeLightDOM(this);
|
|
3288
3373
|
}
|
|
3289
3374
|
refreshColumns() {
|
|
3290
3375
|
this.__lightDomColumnsCache = void 0, j(this), this.#t.parseLightDomColumns(this);
|
|
3291
3376
|
const e = this.#e.lightDomTitle, o = this.#e.hasToolButtonsContainer;
|
|
3292
|
-
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#
|
|
3377
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A());
|
|
3293
3378
|
const n = this.#e.lightDomTitle, i = this.#e.hasToolButtonsContainer;
|
|
3294
3379
|
if (n && !e || i && !o) {
|
|
3295
3380
|
this.#t.markSourcesChanged(), this.#t.merge();
|
|
3296
3381
|
const s = this.#i.querySelector(".tbw-shell-header");
|
|
3297
3382
|
if (s) {
|
|
3298
3383
|
const l = Ae(
|
|
3299
|
-
this.#
|
|
3384
|
+
this.#o.shell,
|
|
3300
3385
|
this.#e,
|
|
3301
|
-
this.#
|
|
3302
|
-
),
|
|
3303
|
-
|
|
3304
|
-
const
|
|
3305
|
-
|
|
3386
|
+
this.#o.icons?.toolPanel
|
|
3387
|
+
), a = document.createElement("div");
|
|
3388
|
+
a.innerHTML = l;
|
|
3389
|
+
const c = a.firstElementChild;
|
|
3390
|
+
c && (s.replaceWith(c), this.#Z());
|
|
3306
3391
|
}
|
|
3307
3392
|
}
|
|
3308
3393
|
this.#s.requestPhase(A.COLUMNS, "refreshColumns");
|
|
3309
3394
|
}
|
|
3310
|
-
#
|
|
3311
|
-
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight,
|
|
3395
|
+
#j(e) {
|
|
3396
|
+
const o = this._virtualization.rowHeight, n = this._virtualization.container ?? this, i = this._virtualization.viewportEl ?? n, r = n.clientHeight, s = i.clientHeight, a = this.shadowRoot?.querySelector(".tbw-scroll-area"), c = a ? a.clientHeight : r, u = c - s, p = this.#n?.getExtraHeight() ?? 0, f = Math.max(0, r - c);
|
|
3312
3397
|
return e * o + u + p + f;
|
|
3313
3398
|
}
|
|
3314
3399
|
refreshVirtualWindow(e = !1, o = !1) {
|
|
3315
3400
|
if (!this._bodyEl) return;
|
|
3316
3401
|
const n = this._rows.length;
|
|
3317
3402
|
if (!this._virtualization.enabled) {
|
|
3318
|
-
this.#
|
|
3403
|
+
this.#G(0, n), o || this.#n?.afterRender();
|
|
3319
3404
|
return;
|
|
3320
3405
|
}
|
|
3321
3406
|
if (this._rows.length <= this._virtualization.bypassThreshold) {
|
|
3322
|
-
this._virtualization.start = 0, this._virtualization.end = n, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#
|
|
3407
|
+
this._virtualization.start = 0, this._virtualization.end = n, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#G(0, n, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#j(n)}px`), this.#ae(n, this._visibleColumns.length), o || this.#n?.afterRender();
|
|
3323
3408
|
return;
|
|
3324
3409
|
}
|
|
3325
|
-
const i = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? i, s = r.clientHeight, l = this._virtualization.rowHeight,
|
|
3326
|
-
let
|
|
3410
|
+
const i = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? i, s = r.clientHeight, l = this._virtualization.rowHeight, a = i.scrollTop;
|
|
3411
|
+
let c = Math.floor(a / l), h = 0;
|
|
3327
3412
|
const u = 10;
|
|
3328
3413
|
for (; h < u; ) {
|
|
3329
|
-
const C = this.#
|
|
3330
|
-
if (_ >=
|
|
3331
|
-
|
|
3414
|
+
const C = this.#n?.getExtraHeightBefore?.(c) ?? 0, _ = Math.floor((a - C) / l);
|
|
3415
|
+
if (_ >= c || _ < 0) break;
|
|
3416
|
+
c = _, h++;
|
|
3332
3417
|
}
|
|
3333
|
-
|
|
3334
|
-
const p = this.#
|
|
3335
|
-
p !== void 0 && p <
|
|
3418
|
+
c = c - c % 2, c < 0 && (c = 0);
|
|
3419
|
+
const p = this.#n?.adjustVirtualStart(c, a, l);
|
|
3420
|
+
p !== void 0 && p < c && (c = p, c = c - c % 2, c < 0 && (c = 0));
|
|
3336
3421
|
const f = Math.ceil(s / l) + 3;
|
|
3337
|
-
let g =
|
|
3338
|
-
if (g > n && (g = n), this._virtualization.start =
|
|
3422
|
+
let g = c + f;
|
|
3423
|
+
if (g > n && (g = n), this._virtualization.start = c, this._virtualization.end = g, i.clientHeight === 0 && s > 0) {
|
|
3339
3424
|
this.#s.requestPhase(A.VIRTUALIZATION, "stale-refs-retry");
|
|
3340
3425
|
return;
|
|
3341
3426
|
}
|
|
3342
|
-
const w = this.#
|
|
3427
|
+
const w = this.#j(n);
|
|
3343
3428
|
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${w}px`);
|
|
3344
|
-
const
|
|
3345
|
-
this._bodyEl.style.transform = `translateY(${S}px)`, this.#
|
|
3429
|
+
const b = this.#n?.getExtraHeightBefore?.(c) ?? 0, S = -(a - c * l - b);
|
|
3430
|
+
this._bodyEl.style.transform = `translateY(${S}px)`, this.#G(c, g, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), this.#ae(n, this._visibleColumns.length), e && !o && (this.#n?.afterRender(), queueMicrotask(() => {
|
|
3346
3431
|
const C = i.clientHeight, _ = r.clientHeight;
|
|
3347
3432
|
if (C === 0 && _ > 0) return;
|
|
3348
|
-
const
|
|
3349
|
-
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${
|
|
3433
|
+
const T = this.#j(n);
|
|
3434
|
+
this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${T}px`);
|
|
3350
3435
|
}));
|
|
3351
3436
|
}
|
|
3352
|
-
#
|
|
3353
|
-
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#
|
|
3354
|
-
const e = this.#
|
|
3437
|
+
#K() {
|
|
3438
|
+
I(this, this.#e), q(this, this.#e), W(this, this.#e, this.#A()), this.#t.markSourcesChanged(), this.#t.merge();
|
|
3439
|
+
const e = this.#o?.shell;
|
|
3355
3440
|
Xt(
|
|
3356
3441
|
this.#i,
|
|
3357
3442
|
e,
|
|
3358
3443
|
{ isPanelOpen: this.#e.isPanelOpen, expandedSections: this.#e.expandedSections },
|
|
3359
|
-
this.#
|
|
3360
|
-
) && (this.#
|
|
3444
|
+
this.#o?.icons
|
|
3445
|
+
) && (this.#Z(), this.#c.setInitialized(!0));
|
|
3361
3446
|
}
|
|
3362
|
-
#
|
|
3363
|
-
$t(this.#i, this.#
|
|
3447
|
+
#Z() {
|
|
3448
|
+
$t(this.#i, this.#o?.shell, this.#e, {
|
|
3364
3449
|
onPanelToggle: () => this.toggleToolPanel(),
|
|
3365
3450
|
onSectionToggle: (e) => this.toggleToolPanelSection(e)
|
|
3366
|
-
}), this.#
|
|
3451
|
+
}), this.#M?.(), this.#M = Ft(this.#i, this.#o?.shell, (e) => {
|
|
3367
3452
|
this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
|
|
3368
3453
|
});
|
|
3369
3454
|
}
|
|
@@ -3377,7 +3462,7 @@ const ho = {
|
|
|
3377
3462
|
class uo {
|
|
3378
3463
|
static dependencies;
|
|
3379
3464
|
static manifest;
|
|
3380
|
-
version = "1.
|
|
3465
|
+
version = "1.7.0";
|
|
3381
3466
|
styles;
|
|
3382
3467
|
cellRenderers;
|
|
3383
3468
|
headerRenderers;
|
|
@@ -3437,7 +3522,7 @@ class uo {
|
|
|
3437
3522
|
}
|
|
3438
3523
|
get gridIcons() {
|
|
3439
3524
|
const e = this.grid?.gridConfig?.icons ?? {};
|
|
3440
|
-
return { ...
|
|
3525
|
+
return { ...k, ...e };
|
|
3441
3526
|
}
|
|
3442
3527
|
get isAnimationEnabled() {
|
|
3443
3528
|
const e = this.grid?.effectiveConfig?.animation?.mode ?? "reduced-motion";
|
|
@@ -3545,7 +3630,7 @@ function go(t) {
|
|
|
3545
3630
|
function wo(t, e = document) {
|
|
3546
3631
|
return e.querySelector(t);
|
|
3547
3632
|
}
|
|
3548
|
-
const
|
|
3633
|
+
const bo = {
|
|
3549
3634
|
CELL_CHANGE: "cell-change",
|
|
3550
3635
|
CELL_COMMIT: "cell-commit",
|
|
3551
3636
|
ROW_COMMIT: "row-commit",
|
|
@@ -3558,7 +3643,7 @@ const mo = {
|
|
|
3558
3643
|
CELL_ACTIVATE: "cell-activate",
|
|
3559
3644
|
GROUP_TOGGLE: "group-toggle",
|
|
3560
3645
|
COLUMN_STATE_CHANGE: "column-state-change"
|
|
3561
|
-
},
|
|
3646
|
+
}, mo = {
|
|
3562
3647
|
SELECTION_CHANGE: "selection-change",
|
|
3563
3648
|
TREE_EXPAND: "tree-expand",
|
|
3564
3649
|
FILTER_CHANGE: "filter-change",
|
|
@@ -3587,7 +3672,7 @@ const mo = {
|
|
|
3587
3672
|
max: (t, e) => Math.max(...t.map((o) => Number(o[e]) || -1 / 0)),
|
|
3588
3673
|
first: (t, e) => t[0]?.[e],
|
|
3589
3674
|
last: (t, e) => t[t.length - 1]?.[e]
|
|
3590
|
-
}, V = /* @__PURE__ */ new Map(),
|
|
3675
|
+
}, V = /* @__PURE__ */ new Map(), z = {
|
|
3591
3676
|
register(t, e) {
|
|
3592
3677
|
V.set(t, e);
|
|
3593
3678
|
},
|
|
@@ -3623,12 +3708,12 @@ function co(t) {
|
|
|
3623
3708
|
function vo(t, e) {
|
|
3624
3709
|
return co(t)(e);
|
|
3625
3710
|
}
|
|
3626
|
-
const Co =
|
|
3711
|
+
const Co = z.register.bind(z), yo = z.unregister.bind(z), _o = z.get.bind(z), Eo = z.run.bind(z), So = z.list.bind(z);
|
|
3627
3712
|
export {
|
|
3628
3713
|
uo as BaseGridPlugin,
|
|
3629
3714
|
Ze as DEFAULT_ANIMATION_CONFIG,
|
|
3630
|
-
|
|
3631
|
-
|
|
3715
|
+
k as DEFAULT_GRID_ICONS,
|
|
3716
|
+
bo as DGEvents,
|
|
3632
3717
|
L as DataGridElement,
|
|
3633
3718
|
X as FitModeEnum,
|
|
3634
3719
|
po as GridCSSVars,
|
|
@@ -3637,17 +3722,17 @@ export {
|
|
|
3637
3722
|
L as GridElement,
|
|
3638
3723
|
fo as GridSelectors,
|
|
3639
3724
|
ho as PLUGIN_QUERIES,
|
|
3640
|
-
|
|
3725
|
+
mo as PluginEvents,
|
|
3641
3726
|
ao as PluginManager,
|
|
3642
3727
|
A as RenderPhase,
|
|
3643
|
-
|
|
3644
|
-
|
|
3728
|
+
Mt as a,
|
|
3729
|
+
z as aggregatorRegistry,
|
|
3645
3730
|
$ as b,
|
|
3646
|
-
|
|
3731
|
+
xt as builtInSort,
|
|
3647
3732
|
ue as c,
|
|
3648
3733
|
go as createGrid,
|
|
3649
3734
|
Rt as defaultComparator,
|
|
3650
|
-
|
|
3735
|
+
Me as e,
|
|
3651
3736
|
Ie as g,
|
|
3652
3737
|
_o as getAggregator,
|
|
3653
3738
|
co as getValueAggregator,
|