@gears-frontx/ui-kit 0.4.6 → 0.4.9
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/dist/chunks/data-grid-portal-container-context.js +10 -0
- package/dist/chunks/data-grid-portal-container-context.js.map +1 -0
- package/dist/chunks/{data-grid.-6P4UQGJ.css → data-grid.DSkYrsay.css} +1 -1
- package/dist/chunks/drag-drop.BASVe3_O.css +1 -0
- package/dist/chunks/hooked.js +23 -31
- package/dist/chunks/hooked.js.map +1 -1
- package/dist/chunks/is-record.js +7 -0
- package/dist/chunks/is-record.js.map +1 -0
- package/dist/chunks/messages.js +12 -1
- package/dist/chunks/messages.js.map +1 -1
- package/dist/chunks/pagination.DJ7HJSFX.css +1 -0
- package/dist/chunks/resolve-body-cell-props.BA5IRWq0.css +1 -0
- package/dist/chunks/resolve-body-cell-props.js +80 -96
- package/dist/chunks/resolve-body-cell-props.js.map +1 -1
- package/dist/chunks/row-click-utils.js +12 -0
- package/dist/chunks/row-click-utils.js.map +1 -0
- package/dist/chunks/row-number.BxFT_3yP.css +1 -0
- package/dist/chunks/segment.js +16 -9
- package/dist/chunks/segment.js.map +1 -1
- package/dist/chunks/storage-helpers.js +40 -0
- package/dist/chunks/storage-helpers.js.map +1 -0
- package/dist/chunks/table-helpers.js +20 -0
- package/dist/chunks/table-helpers.js.map +1 -0
- package/dist/chunks/table-tree.DMtpMddS.css +1 -0
- package/dist/chunks/table.biUlW2U6.css +1 -0
- package/dist/chunks/use-latest.js +11 -0
- package/dist/chunks/use-latest.js.map +1 -0
- package/dist/components/data-grid/data-grid-types.d.ts +19 -0
- package/dist/components/data-grid/data-grid-types.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts +1 -1
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/messages.d.ts +9 -0
- package/dist/components/data-grid/messages.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/actions-menu/components/data-grid-actions-menu.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/data-grid-export-menu-item.d.ts +6 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/data-grid-export-menu-item.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-cells.d.ts +18 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-cells.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-menu-items.d.ts +9 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-menu-items.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.d.ts +5 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-types.d.ts +77 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-types.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/csv-formatter.d.ts +3 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/csv-formatter.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/excel-formatter.d.ts +4 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/formatters/excel-formatter.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/actions-menu/public.d.ts +2 -0
- package/dist/components/data-grid/plugins/actions-menu/public.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-body-cell.d.ts +3 -0
- package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-body-cell.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-content.d.ts +7 -0
- package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-content.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-row.d.ts +8 -0
- package/dist/components/data-grid/plugins/drag-drop/components/data-grid-drag-drop-row.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-data.d.ts +4 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-data.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-drop-plugin.d.ts +18 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-drop-plugin.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-drop-types.d.ts +60 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-drop-types.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-preview.d.ts +2 -0
- package/dist/components/data-grid/plugins/drag-drop/drag-preview.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/drag-drop/public.d.ts +3 -0
- package/dist/components/data-grid/plugins/drag-drop/public.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/filters/components/adaptive-popover.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/filters/components/all-filters-button.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/order/components/data-grid-order-button.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/pagination/components/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/pagination/components/pager.d.ts +6 -0
- package/dist/components/data-grid/plugins/pagination/components/pager.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/table-configuration/components/data-grid-table-configuration-trigger.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-body-cell-content.d.ts +9 -0
- package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-body-cell-content.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-expand.d.ts +3 -0
- package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-expand.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-row.d.ts +8 -0
- package/dist/components/data-grid/plugins/table-tree/components/data-grid-table-tree-row.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/table-tree/public.d.ts +3 -0
- package/dist/components/data-grid/plugins/table-tree/public.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/table-tree/table-tree-helpers.d.ts +4 -0
- package/dist/components/data-grid/plugins/table-tree/table-tree-helpers.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/table-tree/table-tree-plugin.d.ts +5 -0
- package/dist/components/data-grid/plugins/table-tree/table-tree-plugin.d.ts.map +1 -0
- package/dist/components/data-grid/plugins/table-tree/table-tree-types.d.ts +33 -0
- package/dist/components/data-grid/plugins/table-tree/table-tree-types.d.ts.map +1 -0
- package/dist/components/data-grid/services/core/data-grid-label-context.d.ts +7 -0
- package/dist/components/data-grid/services/core/data-grid-label-context.d.ts.map +1 -0
- package/dist/components/data-grid/services/core/data-grid-portal-container-context.d.ts +9 -0
- package/dist/components/data-grid/services/core/data-grid-portal-container-context.d.ts.map +1 -0
- package/dist/components/data-grid/services/table/components/data-grid-table.d.ts.map +1 -1
- package/dist/components/pagination/pagination.d.ts +7 -4
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/data-grid/actions-menu.js +350 -33
- package/dist/data-grid/actions-menu.js.map +1 -1
- package/dist/data-grid/drag-drop.d.ts +1 -0
- package/dist/data-grid/drag-drop.js +261 -0
- package/dist/data-grid/drag-drop.js.map +1 -0
- package/dist/data-grid/filters.js +368 -364
- package/dist/data-grid/filters.js.map +1 -1
- package/dist/data-grid/order.js +111 -110
- package/dist/data-grid/order.js.map +1 -1
- package/dist/data-grid/pagination.js +152 -143
- package/dist/data-grid/pagination.js.map +1 -1
- package/dist/data-grid/row-click.js +35 -42
- package/dist/data-grid/row-click.js.map +1 -1
- package/dist/data-grid/row-number.js +6 -6
- package/dist/data-grid/table-configuration.js +49 -37
- package/dist/data-grid/table-configuration.js.map +1 -1
- package/dist/data-grid/table-tree.d.ts +1 -0
- package/dist/data-grid/table-tree.js +233 -0
- package/dist/data-grid/table-tree.js.map +1 -0
- package/dist/data-grid.js +516 -542
- package/dist/data-grid.js.map +1 -1
- package/dist/docs/data-grid.md +309 -11
- package/dist/docs/pagination.md +14 -0
- package/dist/docs/table.md +10 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +375 -370
- package/dist/index.js.map +1 -1
- package/dist/pagination.js +23 -23
- package/dist/pagination.js.map +1 -1
- package/dist/table.js +88 -88
- package/llms.txt +6 -3
- package/package.json +10 -1
- package/dist/chunks/pagination.CKDEuWt6.css +0 -1
- package/dist/chunks/resolve-body-cell-props.DGczzk1U.css +0 -1
- package/dist/chunks/row-number.C7fNu9Bw.css +0 -1
- package/dist/chunks/table.Dmz7LEk7.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-grid-portal-container-context.js","sources":["../../src/components/data-grid/services/core/data-grid-portal-container-context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\n\nimport type { PopoverContentProps } from '../../../popover/public.js';\n\ntype PortalContainer = PopoverContentProps['container'];\n\n/*\n * Where the grid's popups portal, as passed to `DataGrid`'s `portalContainer` prop. Every popup\n * the grid and its plugins open hands it to its `*Content` as `container`. A context rather than a\n * grid store for the same reason as the label: it is read at render time only, and nothing\n * loads, persists or writes it from a second place.\n *\n * `undefined` is what a grid without the prop provides, and the popups then portal to <body>,\n * as they did before the prop existed.\n */\nconst DataGridPortalContainerContext = createContext<PortalContainer>(undefined);\n\nexport const DataGridPortalContainerProvider = DataGridPortalContainerContext.Provider;\n\n/**\n * The grid's `portalContainer` prop, or `undefined` when the grid has none.\n */\nexport function useDataGridPortalContainer(): PortalContainer {\n return useContext(DataGridPortalContainerContext);\n}\n"],"names":["DataGridPortalContainerContext","createContext","DataGridPortalContainerProvider","useDataGridPortalContainer","useContext"],"mappings":";AAeA,MAAMA,IAAiCC,EAA+B,MAAS,GAElEC,IAAkCF,EAA+B;AAKvE,SAASG,IAA8C;AAC5D,SAAOC,EAAWJ,CAA8B;AAClD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
._delayed_1ys81_5{display:inline-flex;animation:_appear_1ys81_1 .5s forwards;animation-delay:.4s;opacity:0}@keyframes _appear_1ys81_1{to{opacity:1}}._root_9f4nk_13{position:relative;box-sizing:border-box;display:flex;flex-direction:column;flex-grow:1;min-block-size:0}.
|
|
1
|
+
._delayed_1ys81_5{display:inline-flex;animation:_appear_1ys81_1 .5s forwards;animation-delay:.4s;opacity:0}@keyframes _appear_1ys81_1{to{opacity:1}}._root_9f4nk_13{position:relative;box-sizing:border-box;display:flex;flex-direction:column;flex-grow:1;min-block-size:0}._loaderOverlay_ff48v_31{position:absolute;z-index:4;display:flex;align-items:center;justify-content:center;animation:_appear_ff48v_1 .5s forwards;animation-delay:.4s;background-color:color-mix(in srgb,var(--surface) 75%,transparent);cursor:default;top:0;right:0;bottom:0;left:0;opacity:0;pointer-events:none}@keyframes _appear_ff48v_1{to{opacity:1;pointer-events:auto}}._emptyState_1tt1k_3{flex:none;margin:auto}._dataGridLayoutMain_ta8be_5{display:flex;overflow:auto;flex-direction:column;flex-grow:1;align-self:stretch;contain:inline-size}._dataGridTopDefault_5t4tt_1{display:flex;flex-wrap:wrap;align-items:center;row-gap:var(--space-2);margin-block-end:var(--space-2);min-inline-size:0}._topStartSlots_5t4tt_16{display:flex;flex:1 1 auto;flex-wrap:wrap;align-items:center;gap:var(--space-2);min-inline-size:0}._topStartSlot_5t4tt_16,._topEndSlot_5t4tt_32{display:contents}._topEndSlots_5t4tt_36{display:flex;flex-shrink:0;align-items:center;gap:var(--space-2);margin-inline-start:auto}._wrapper_1h8lw_7{display:flow-root}._replacement_1h8lw_18{display:flex;flex-direction:column;justify-content:center}._center_s4klt_3{flex:none;margin:auto}._headerCell_18ulc_1{box-sizing:border-box;border-inline-start:var(--_data-grid-table-group-border, 0 solid transparent);border-block-start:var(--_data-grid-header-border-block-start, 0);white-space:nowrap}._headerCellContent_18ulc_13{display:flex;align-items:center;inline-size:min-content;min-block-size:var(--space-6);white-space:nowrap}._extraHeaderCell_18ulc_21{box-sizing:border-box;border-inline-start:var(--_data-grid-table-group-border, 0 solid transparent);border-block-start:var(--_data-grid-header-border-block-start, 0);white-space:nowrap}._tableWrapper_6b0cm_6{contain:inline-size}._table_6b0cm_6{--table-header-fill: var(--data-grid-header-background, var(--card));--table-pinned-fill: var(--data-grid-pinned-background, var(--card));min-inline-size:var(--data-grid-table-min-inline-size, max-content)}._table_6b0cm_6._layoutFixed_6b0cm_39{border-collapse:separate;border-spacing:0;inline-size:100%;table-layout:fixed}._table_6b0cm_6._layoutAuto_6b0cm_46{border-collapse:separate;border-spacing:0;inline-size:100%;table-layout:auto}._tableBordered_6b0cm_53{--_data-grid-table-group-border: var(--border-width) solid var(--border);--_data-grid-header-border-block-start: var(--border-width) solid var(--border)}._theadSticky_167rm_11{position:sticky;z-index:2;inset-block-start:0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._dragHandler_mre9q_12{display:flex;align-items:center;justify-content:center;margin:calc(var(--space-3) * -1) calc(var(--space-4) * -1);block-size:calc(var(--text-meta-line-height) + 2 * var(--space-3));cursor:var(--data-grid-drag-cursor, grab)}._dragHandler_mre9q_12 svg{inline-size:var(--icon-size-sm);block-size:var(--icon-size-sm)}._dragHandler_mre9q_12._dragHandlerLoading_mre9q_26{cursor:progress}._dragRow_mre9q_38._dragRowDragging_mre9q_38{--data-grid-drag-cursor: grabbing;--table-pinned-fill: var(--secondary);position:relative;z-index:10000;background-color:var(--secondary);cursor:grabbing;pointer-events:none;transition:background-color var(--duration-tab)}._dragRow_mre9q_38._dragRowDragging_mre9q_38>td:first-child{border-end-start-radius:var(--radius-md);border-start-start-radius:var(--radius-md)}._dragRow_mre9q_38._dragRowDragging_mre9q_38>td:last-child{border-end-end-radius:var(--radius-md);border-start-end-radius:var(--radius-md)}._dragRow_mre9q_38._dragRowDropping_mre9q_60{--table-pinned-fill: var(--card-hover);background-color:var(--card-hover)}._dragRow_mre9q_38._dragRowDropIndicatorTop_mre9q_66>td{box-shadow:inset 0 2px 0 0 var(--primary)}._dragRow_mre9q_38._dragRowDropIndicatorBottom_mre9q_70>td{box-shadow:inset 0 -2px 0 0 var(--primary)}._dragPreview_mre9q_79{overflow:hidden;border-collapse:separate;border-radius:var(--radius-md);border-spacing:0;background-color:var(--surface);box-shadow:var(--popover-shadow)}._content_mre9q_98{display:flex;flex-direction:column;min-block-size:0}._contentDragging_mre9q_111{--table-row-hover-fill: transparent}._contentRootDropping_mre9q_122{position:relative}._contentRootDropping_mre9q_122:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:5;border:2px dashed var(--primary);background-color:color-mix(in srgb,var(--secondary) 60%,transparent);pointer-events:none}
|
package/dist/chunks/hooked.js
CHANGED
|
@@ -1,44 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}, [e]), c;
|
|
7
|
-
}
|
|
8
|
-
function k() {
|
|
9
|
-
const e = /* @__PURE__ */ new Map();
|
|
10
|
-
return { hook: c, callHook: l, callHookParallel: f, callHookSync: a };
|
|
11
|
-
function c(t, n) {
|
|
12
|
-
if (!t || typeof n != "function")
|
|
1
|
+
function p() {
|
|
2
|
+
const c = /* @__PURE__ */ new Map();
|
|
3
|
+
return { hook: u, callHook: i, callHookParallel: f, callHookSync: a };
|
|
4
|
+
function u(t, e) {
|
|
5
|
+
if (!t || typeof e != "function")
|
|
13
6
|
return () => {
|
|
14
7
|
};
|
|
15
|
-
const
|
|
16
|
-
return o.push(
|
|
17
|
-
const
|
|
18
|
-
if (!
|
|
19
|
-
const
|
|
20
|
-
|
|
8
|
+
const n = e, o = c.get(t) ?? [];
|
|
9
|
+
return o.push(n), c.set(t, o), () => {
|
|
10
|
+
const r = c.get(t);
|
|
11
|
+
if (!r) return;
|
|
12
|
+
const l = r.indexOf(n);
|
|
13
|
+
l !== -1 && r.splice(l, 1), r.length === 0 && c.delete(t);
|
|
21
14
|
};
|
|
22
15
|
}
|
|
23
|
-
function
|
|
24
|
-
return [...
|
|
16
|
+
function s(t) {
|
|
17
|
+
return [...c.get(t) ?? []];
|
|
25
18
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
return [...o,
|
|
19
|
+
function i(t, ...e) {
|
|
20
|
+
const n = s(t).reduce((o, r) => {
|
|
21
|
+
const l = o[o.length - 1] ?? Promise.resolve();
|
|
22
|
+
return [...o, l.then(() => r(...e))];
|
|
30
23
|
}, []);
|
|
31
|
-
return Promise.all(
|
|
24
|
+
return Promise.all(n);
|
|
32
25
|
}
|
|
33
|
-
function f(t, ...
|
|
34
|
-
return Promise.all(
|
|
26
|
+
function f(t, ...e) {
|
|
27
|
+
return Promise.all(s(t).map((n) => n(...e)));
|
|
35
28
|
}
|
|
36
|
-
function a(t, ...
|
|
37
|
-
return
|
|
29
|
+
function a(t, ...e) {
|
|
30
|
+
return s(t).map((n) => n(...e));
|
|
38
31
|
}
|
|
39
32
|
}
|
|
40
33
|
export {
|
|
41
|
-
|
|
42
|
-
g as u
|
|
34
|
+
p as c
|
|
43
35
|
};
|
|
44
36
|
//# sourceMappingURL=hooked.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooked.js","sources":["../../src/components/data-grid/utils/
|
|
1
|
+
{"version":3,"file":"hooked.js","sources":["../../src/components/data-grid/utils/hooked.ts"],"sourcesContent":["/*\n * The grid's hook bus: sync, serial and parallel calls. Plugins depend on these semantics:\n *\n * - a handler list is copied when a hook is called, so a handler may unsubscribe itself (or\n * register another) while the hook runs without changing this run;\n * - `callHook` starts handlers one after another, each only after the previous one settled;\n * - `callHookParallel` starts them all in one synchronous pass, so a handler that throws\n * synchronously throws out of the call instead of rejecting its promise;\n * - every call resolves to the array of the handlers' return values, in registration order.\n */\n\ntype HookName<THooks> = keyof THooks & string;\n\ntype HookArgs<THooks, Name extends keyof THooks> = THooks[Name] extends (\n ...args: infer Args\n) => unknown\n ? Args\n : never;\n\ntype HookReturn<THooks, Name extends keyof THooks> = THooks[Name] extends (\n ...args: never[]\n) => infer Return\n ? Return\n : never;\n\nexport type HookFn<THooks, Name extends keyof THooks> = (\n ...args: HookArgs<THooks, Name>\n) => HookReturn<THooks, Name> | Promise<HookReturn<THooks, Name>>;\n\nexport interface Hooked<THooks> {\n /** Registers a handler. Returns the function that removes it again. */\n hook: <Name extends HookName<THooks>>(name: Name, fn: HookFn<THooks, Name>) => () => void;\n /** Runs the handlers one after another, each after the previous one settled. */\n callHook: <Name extends HookName<THooks>>(\n name: Name,\n ...args: HookArgs<THooks, Name>\n ) => Promise<HookReturn<THooks, Name>[]>;\n /** Runs all the handlers at once. */\n callHookParallel: <Name extends HookName<THooks>>(\n name: Name,\n ...args: HookArgs<THooks, Name>\n ) => Promise<HookReturn<THooks, Name>[]>;\n /** Runs the handlers synchronously and returns their results. */\n callHookSync: <Name extends HookName<THooks>>(\n name: Name,\n ...args: HookArgs<THooks, Name>\n ) => HookReturn<THooks, Name>[];\n}\n\ntype Handler = (...args: unknown[]) => unknown;\n\nexport function createHooked<THooks>(): Hooked<THooks> {\n const handlers = new Map<string, Handler[]>();\n\n return { hook, callHook, callHookParallel, callHookSync };\n\n function hook<Name extends HookName<THooks>>(name: Name, fn: HookFn<THooks, Name>) {\n if (!name || typeof fn !== 'function') {\n return () => {};\n }\n\n // The one cast of this module: the map has to hold handlers of every hook name, so their\n // parameter lists cannot stay typed. The public signatures above are what callers see.\n const handler = fn as Handler;\n const list = handlers.get(name) ?? [];\n list.push(handler);\n handlers.set(name, list);\n\n return () => {\n const current = handlers.get(name);\n if (!current) return;\n\n const index = current.indexOf(handler);\n if (index !== -1) current.splice(index, 1);\n if (current.length === 0) handlers.delete(name);\n };\n }\n\n function snapshot(name: string): Handler[] {\n return [...(handlers.get(name) ?? [])];\n }\n\n function callHook<Name extends HookName<THooks>>(name: Name, ...args: HookArgs<THooks, Name>) {\n const started = snapshot(name).reduce<Promise<unknown>[]>((chain, fn) => {\n const previous = chain[chain.length - 1] ?? Promise.resolve();\n return [...chain, previous.then(() => fn(...args))];\n }, []);\n\n return Promise.all(started) as Promise<HookReturn<THooks, Name>[]>;\n }\n\n function callHookParallel<Name extends HookName<THooks>>(\n name: Name,\n ...args: HookArgs<THooks, Name>\n ) {\n return Promise.all(snapshot(name).map((fn) => fn(...args))) as Promise<\n HookReturn<THooks, Name>[]\n >;\n }\n\n function callHookSync<Name extends HookName<THooks>>(\n name: Name,\n ...args: HookArgs<THooks, Name>\n ) {\n return snapshot(name).map((fn) => fn(...args)) as HookReturn<THooks, Name>[];\n }\n}\n"],"names":["createHooked","handlers","hook","callHook","callHookParallel","callHookSync","name","fn","handler","list","current","index","snapshot","args","started","chain","previous"],"mappings":"AAmDO,SAASA,IAAuC;AACrD,QAAMC,wBAAe,IAAA;AAErB,SAAO,EAAE,MAAAC,GAAM,UAAAC,GAAU,kBAAAC,GAAkB,cAAAC,EAAA;AAE3C,WAASH,EAAoCI,GAAYC,GAA0B;AACjF,QAAI,CAACD,KAAQ,OAAOC,KAAO;AACzB,aAAO,MAAM;AAAA,MAAC;AAKhB,UAAMC,IAAUD,GACVE,IAAOR,EAAS,IAAIK,CAAI,KAAK,CAAA;AACnC,WAAAG,EAAK,KAAKD,CAAO,GACjBP,EAAS,IAAIK,GAAMG,CAAI,GAEhB,MAAM;AACX,YAAMC,IAAUT,EAAS,IAAIK,CAAI;AACjC,UAAI,CAACI,EAAS;AAEd,YAAMC,IAAQD,EAAQ,QAAQF,CAAO;AACrC,MAAIG,MAAU,MAAID,EAAQ,OAAOC,GAAO,CAAC,GACrCD,EAAQ,WAAW,KAAGT,EAAS,OAAOK,CAAI;AAAA,IAChD;AAAA,EACF;AAEA,WAASM,EAASN,GAAyB;AACzC,WAAO,CAAC,GAAIL,EAAS,IAAIK,CAAI,KAAK,CAAA,CAAG;AAAA,EACvC;AAEA,WAASH,EAAwCG,MAAeO,GAA8B;AAC5F,UAAMC,IAAUF,EAASN,CAAI,EAAE,OAA2B,CAACS,GAAOR,MAAO;AACvE,YAAMS,IAAWD,EAAMA,EAAM,SAAS,CAAC,KAAK,QAAQ,QAAA;AACpD,aAAO,CAAC,GAAGA,GAAOC,EAAS,KAAK,MAAMT,EAAG,GAAGM,CAAI,CAAC,CAAC;AAAA,IACpD,GAAG,CAAA,CAAE;AAEL,WAAO,QAAQ,IAAIC,CAAO;AAAA,EAC5B;AAEA,WAASV,EACPE,MACGO,GACH;AACA,WAAO,QAAQ,IAAID,EAASN,CAAI,EAAE,IAAI,CAACC,MAAOA,EAAG,GAAGM,CAAI,CAAC,CAAC;AAAA,EAG5D;AAEA,WAASR,EACPC,MACGO,GACH;AACA,WAAOD,EAASN,CAAI,EAAE,IAAI,CAACC,MAAOA,EAAG,GAAGM,CAAI,CAAC;AAAA,EAC/C;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-record.js","sources":["../../src/components/data-grid/utils/is-record.ts"],"sourcesContent":["/** Any non-null object, arrays included: the shape a value must have to be read by key. */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n"],"names":["isRecord","value"],"mappings":"AACO,SAASA,EAASC,GAAkD;AACzE,SAAO,OAAOA,KAAU,YAAYA,MAAU;AAChD;"}
|
package/dist/chunks/messages.js
CHANGED
|
@@ -30,6 +30,11 @@ const o = {
|
|
|
30
30
|
actionsMenu: {
|
|
31
31
|
actions: "Actions"
|
|
32
32
|
},
|
|
33
|
+
exportMenuItem: {
|
|
34
|
+
defaultFilename: "Report",
|
|
35
|
+
defaultSheetName: "Sheet",
|
|
36
|
+
exportAs: (e) => `Export as ${e}`
|
|
37
|
+
},
|
|
33
38
|
tableConfiguration: {
|
|
34
39
|
header: "Table configuration",
|
|
35
40
|
configureColumns: "Configure columns",
|
|
@@ -45,11 +50,14 @@ const o = {
|
|
|
45
50
|
},
|
|
46
51
|
pagination: {
|
|
47
52
|
ariaLabel: "Pagination",
|
|
53
|
+
// The pager of a grid with a `label`: two grids on one page must not share the landmark name
|
|
54
|
+
// "Pagination" (axe's `landmark-unique`), so the label names each one's nav.
|
|
55
|
+
ariaLabelFor: (e) => `${e} pagination`,
|
|
48
56
|
limitSelectorAriaLabel: "Items per page",
|
|
49
57
|
previousPage: "Previous page",
|
|
50
58
|
nextPage: "Next page",
|
|
51
59
|
goToPage: (e) => `Go to page ${e}`,
|
|
52
|
-
pageInfo: (e,
|
|
60
|
+
pageInfo: (e, t, l) => `Page ${e} of ${t} (${l} items)`
|
|
53
61
|
},
|
|
54
62
|
filters: {
|
|
55
63
|
allFilters: "All filters",
|
|
@@ -61,6 +69,9 @@ const o = {
|
|
|
61
69
|
close: "Close",
|
|
62
70
|
closeDialog: "Close dialog"
|
|
63
71
|
},
|
|
72
|
+
dragDrop: {
|
|
73
|
+
dragHandle: "Drag to reorder row"
|
|
74
|
+
},
|
|
64
75
|
tree: {
|
|
65
76
|
noItems: "No items",
|
|
66
77
|
collapse: "Collapse",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sources":["../../src/components/data-grid/messages.ts"],"sourcesContent":["/*\n * Every user-facing string the grid renders, in one place. The kit has no i18n layer, so these are\n * English literals; one module keeps them findable and lets the tests assert against `messages.*`\n * instead of repeating the text. A string that embeds a count or a name is a function of it.\n */\nexport const messages = {\n emptyState: {\n noResultsFound: 'No results found',\n noResultsFoundDescription: 'Try adjusting your search or filters',\n },\n loadError: {\n headerDefault: 'Something went wrong',\n bodyDefault: 'An error occurred while loading',\n },\n layoutMainSlotSelector: {\n table: 'Table view',\n cards: 'Cards view',\n },\n textSearch: {\n placeholder: 'Search...',\n clear: 'Clear input',\n },\n order: {\n sort: 'Sort',\n sortBy: 'Sort by',\n order: 'Order',\n changeSorting: (columnLabel: string) => `Change sorting of '${columnLabel}' column`,\n ascString: 'A-Z',\n descString: 'Z-A',\n ascNumber: '0-9',\n descNumber: '9-0',\n ascDate: 'Oldest first',\n descDate: 'Newest first',\n },\n actionsMenu: {\n actions: 'Actions',\n },\n tableConfiguration: {\n header: 'Table configuration',\n configureColumns: 'Configure columns',\n pinColumn: 'Pin column',\n unpinColumn: 'Unpin column',\n },\n rowSelect: {\n itemsSelected: (count: number) => (count === 1 ? '1 item selected' : `${count} items selected`),\n pageSelected: (count: number) =>\n count === 1 ? '1 item on this page is selected.' : `All ${count} items on this page are selected.`,\n selectAll: (count: number) => `Select all ${count}`,\n allSelected: (count: number) =>\n count === 1 ? '1 item is selected.' : `All ${count} items are selected.`,\n clearSelection: 'Clear selection',\n },\n pagination: {\n ariaLabel: 'Pagination',\n limitSelectorAriaLabel: 'Items per page',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n goToPage: (page: number) => `Go to page ${page}`,\n pageInfo: (page: number, totalPages: number, total: number) =>\n `Page ${page} of ${totalPages} (${total} items)`,\n },\n filters: {\n allFilters: 'All filters',\n allFiltersTitle: 'All filters',\n apply: 'Apply',\n reset: 'Reset',\n searchPlaceholder: 'Search...',\n noOptionsFound: 'No options found',\n close: 'Close',\n closeDialog: 'Close dialog',\n },\n tree: {\n noItems: 'No items',\n collapse: 'Collapse',\n expand: 'Expand',\n },\n};\n"],"names":["messages","columnLabel","count","page","totalPages","total"],"mappings":"AAKO,MAAMA,IAAW;AAAA,EACtB,YAAY;AAAA,IACV,gBAAgB;AAAA,IAChB,2BAA2B;AAAA,EAAA;AAAA,EAE7B,WAAW;AAAA,IACT,eAAe;AAAA,IACf,aAAa;AAAA,EAAA;AAAA,EAEf,wBAAwB;AAAA,IACtB,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,YAAY;AAAA,IACV,aAAa;AAAA,IACb,OAAO;AAAA,EAAA;AAAA,EAET,OAAO;AAAA,IACL,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,eAAe,CAACC,MAAwB,sBAAsBA,CAAW;AAAA,IACzE,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,UAAU;AAAA,EAAA;AAAA,EAEZ,aAAa;AAAA,IACX,SAAS;AAAA,EAAA;AAAA,EAEX,oBAAoB;AAAA,IAClB,QAAQ;AAAA,IACR,kBAAkB;AAAA,IAClB,WAAW;AAAA,IACX,aAAa;AAAA,EAAA;AAAA,EAEf,WAAW;AAAA,IACT,eAAe,CAACC,MAAmBA,MAAU,IAAI,oBAAoB,GAAGA,CAAK;AAAA,IAC7E,cAAc,CAACA,MACbA,MAAU,IAAI,qCAAqC,OAAOA,CAAK;AAAA,IACjE,WAAW,CAACA,MAAkB,cAAcA,CAAK;AAAA,IACjD,aAAa,CAACA,MACZA,MAAU,IAAI,wBAAwB,OAAOA,CAAK;AAAA,IACpD,gBAAgB;AAAA,EAAA;AAAA,EAElB,YAAY;AAAA,IACV,WAAW;AAAA,
|
|
1
|
+
{"version":3,"file":"messages.js","sources":["../../src/components/data-grid/messages.ts"],"sourcesContent":["/*\n * Every user-facing string the grid renders, in one place. The kit has no i18n layer, so these are\n * English literals; one module keeps them findable and lets the tests assert against `messages.*`\n * instead of repeating the text. A string that embeds a count or a name is a function of it.\n */\nexport const messages = {\n emptyState: {\n noResultsFound: 'No results found',\n noResultsFoundDescription: 'Try adjusting your search or filters',\n },\n loadError: {\n headerDefault: 'Something went wrong',\n bodyDefault: 'An error occurred while loading',\n },\n layoutMainSlotSelector: {\n table: 'Table view',\n cards: 'Cards view',\n },\n textSearch: {\n placeholder: 'Search...',\n clear: 'Clear input',\n },\n order: {\n sort: 'Sort',\n sortBy: 'Sort by',\n order: 'Order',\n changeSorting: (columnLabel: string) => `Change sorting of '${columnLabel}' column`,\n ascString: 'A-Z',\n descString: 'Z-A',\n ascNumber: '0-9',\n descNumber: '9-0',\n ascDate: 'Oldest first',\n descDate: 'Newest first',\n },\n actionsMenu: {\n actions: 'Actions',\n },\n exportMenuItem: {\n defaultFilename: 'Report',\n defaultSheetName: 'Sheet',\n exportAs: (type: string) => `Export as ${type}`,\n },\n tableConfiguration: {\n header: 'Table configuration',\n configureColumns: 'Configure columns',\n pinColumn: 'Pin column',\n unpinColumn: 'Unpin column',\n },\n rowSelect: {\n itemsSelected: (count: number) => (count === 1 ? '1 item selected' : `${count} items selected`),\n pageSelected: (count: number) =>\n count === 1 ? '1 item on this page is selected.' : `All ${count} items on this page are selected.`,\n selectAll: (count: number) => `Select all ${count}`,\n allSelected: (count: number) =>\n count === 1 ? '1 item is selected.' : `All ${count} items are selected.`,\n clearSelection: 'Clear selection',\n },\n pagination: {\n ariaLabel: 'Pagination',\n // The pager of a grid with a `label`: two grids on one page must not share the landmark name\n // \"Pagination\" (axe's `landmark-unique`), so the label names each one's nav.\n ariaLabelFor: (label: string) => `${label} pagination`,\n limitSelectorAriaLabel: 'Items per page',\n previousPage: 'Previous page',\n nextPage: 'Next page',\n goToPage: (page: number) => `Go to page ${page}`,\n pageInfo: (page: number, totalPages: number, total: number) =>\n `Page ${page} of ${totalPages} (${total} items)`,\n },\n filters: {\n allFilters: 'All filters',\n allFiltersTitle: 'All filters',\n apply: 'Apply',\n reset: 'Reset',\n searchPlaceholder: 'Search...',\n noOptionsFound: 'No options found',\n close: 'Close',\n closeDialog: 'Close dialog',\n },\n dragDrop: {\n dragHandle: 'Drag to reorder row',\n },\n tree: {\n noItems: 'No items',\n collapse: 'Collapse',\n expand: 'Expand',\n },\n};\n"],"names":["messages","columnLabel","type","count","label","page","totalPages","total"],"mappings":"AAKO,MAAMA,IAAW;AAAA,EACtB,YAAY;AAAA,IACV,gBAAgB;AAAA,IAChB,2BAA2B;AAAA,EAAA;AAAA,EAE7B,WAAW;AAAA,IACT,eAAe;AAAA,IACf,aAAa;AAAA,EAAA;AAAA,EAEf,wBAAwB;AAAA,IACtB,OAAO;AAAA,IACP,OAAO;AAAA,EAAA;AAAA,EAET,YA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,mBAAmB;AAAA,IACnB,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,aAAa;AAAA,EAAA;AAAA,EAEf,UAAU;AAAA,IACR,YAAY;AAAA,EAAA;AAAA,EAEd,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ;AAAA,EAAA;AAEZ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._pagination_1yypd_16{display:flex;width:100%;justify-content:center;container-type:inline-size;container-name:pagination}._content_1yypd_28{display:flex;align-items:center;gap:var(--space-1);margin:0;padding:0;list-style:none}._link_1yypd_43{box-sizing:border-box;display:inline-flex;height:var(--control-height-xs);align-items:center;justify-content:center;gap:var(--space-1);border:0;border-radius:var(--radius-sm);padding-block:0;padding-inline:var(--space-2);background-color:transparent;color:var(--muted-foreground);font-family:inherit;font-size:var(--text-label-size);line-height:var(--text-label-line-height);font-weight:var(--text-label-weight);letter-spacing:var(--text-label-tracking);text-decoration:none;white-space:nowrap;cursor:pointer;transition:color .15s ease,background-color .15s ease}._link_1yypd_43:hover{color:var(--foreground)}._link_1yypd_43:focus-visible{outline:var(--border-width-focus) solid var(--ring);outline-offset:2px}@media(forced-colors:active){._link_1yypd_43:focus-visible{outline-color:Highlight}}._link_1yypd_43:disabled,._link_1yypd_43[data-disabled]{pointer-events:none;opacity:var(--opacity-disabled)}._link_1yypd_43[data-active]{background-color:var(--background);color:var(--primary)}._link_1yypd_43._square_1yypd_126{width:var(--control-height-xs);padding-inline:0}._previousNextText_1yypd_131{display:none}@media(min-width:640px){._previousNextText_1yypd_131{display:block}}@container pagination (width < 640px){._previousNextText_1yypd_131{display:none}}@container pagination (width >= 640px){._previousNextText_1yypd_131{display:block}}._icon_1yypd_162{width:var(--icon-size-sm);height:var(--icon-size-sm)}._chevron_1yypd_171:dir(rtl){transform:scaleX(-1)}._ellipsis_1yypd_177{display:flex;align-items:center;justify-content:center;width:var(--control-height-xs);height:var(--control-height-xs);color:var(--muted-foreground)}._srOnly_1yypd_188{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._cell_3pzgi_2:first-child{border-inline-start:var(--_data-grid-table-group-border, 0 solid transparent)}._cell_3pzgi_2:last-child{border-inline-end:var(--_data-grid-table-group-border, 0 solid transparent)}._contentRow_3pzgi_11{display:flex;align-items:center;inline-size:min-content;min-block-size:var(--space-6)}[data-overflow=nowrap] ._contentRow_3pzgi_11,[data-capped] ._contentRow_3pzgi_11{max-inline-size:100%}[data-overflow=wrap] ._contentRow_3pzgi_11,[data-header-fill] ._contentRow_3pzgi_11{inline-size:100%}[data-header-fill] ._content_3pzgi_10{flex:1 1 auto}._content_3pzgi_10{display:block;min-inline-size:0;white-space:normal;overflow-wrap:break-word}[data-overflow=nowrap] ._content_3pzgi_10{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-inline-size:var(--_data-grid-col-max, none)}[data-capped][data-overflow=wrap] ._content_3pzgi_10{max-inline-size:var(--_data-grid-col-max, none);overflow-wrap:anywhere}._endSlot_3pzgi_10{display:flex;flex-shrink:0;align-items:center;gap:var(--space-1)}._endSlot_3pzgi_10:not(:empty){margin-inline-start:var(--space-1)}
|
|
@@ -1,140 +1,124 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as c, jsxs as $, Fragment as R } from "react/jsx-runtime";
|
|
2
2
|
import { u as v } from "./table-context.js";
|
|
3
|
-
import { cx as
|
|
4
|
-
import { I as
|
|
5
|
-
import { TableHead as
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { cx as k } from "class-variance-authority";
|
|
4
|
+
import { I as N } from "./ignore-row-click.js";
|
|
5
|
+
import { TableHead as T, TableCell as V } from "../table.js";
|
|
6
|
+
import { r as D } from "./table-helpers.js";
|
|
7
|
+
import './resolve-body-cell-props.BA5IRWq0.css';const E = "_cell_3pzgi_2", O = "_contentRow_3pzgi_11", W = "_content_3pzgi_10", A = "_endSlot_3pzgi_10", a = {
|
|
8
|
+
cell: E,
|
|
9
|
+
contentRow: O,
|
|
10
|
+
content: W,
|
|
11
|
+
endSlot: A
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
-
if (
|
|
14
|
-
return typeof
|
|
13
|
+
function G(t) {
|
|
14
|
+
if (t != null)
|
|
15
|
+
return typeof t == "number" ? `${t}px` : isNaN(Number(t)) ? t : `${t}px`;
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
-
columnId:
|
|
18
|
-
rowspan:
|
|
17
|
+
function B({
|
|
18
|
+
columnId: t,
|
|
19
|
+
rowspan: o,
|
|
19
20
|
className: n,
|
|
20
|
-
style:
|
|
21
|
-
width:
|
|
22
|
-
children:
|
|
23
|
-
header:
|
|
24
|
-
endSlot:
|
|
21
|
+
style: e,
|
|
22
|
+
width: i,
|
|
23
|
+
children: s,
|
|
24
|
+
header: r,
|
|
25
|
+
endSlot: l,
|
|
25
26
|
overflow: d,
|
|
26
27
|
capped: C,
|
|
27
28
|
title: x,
|
|
28
|
-
contentRowRef:
|
|
29
|
-
fillContent:
|
|
30
|
-
ignoreRowClick:
|
|
29
|
+
contentRowRef: g,
|
|
30
|
+
fillContent: b,
|
|
31
|
+
ignoreRowClick: z
|
|
31
32
|
}) {
|
|
32
|
-
const
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
const p = v(), f = p.useColumnStickyOffset(t), m = p.useColumnEndStickyOffset(t), u = f !== void 0, h = m !== void 0, S = /* @__PURE__ */ c("span", { className: a.content, children: s }), I = r ? T : V, y = G(i);
|
|
34
|
+
return /* @__PURE__ */ c(
|
|
34
35
|
I,
|
|
35
36
|
{
|
|
36
|
-
"data-column-id":
|
|
37
|
+
"data-column-id": t,
|
|
37
38
|
"data-overflow": d,
|
|
38
39
|
"data-capped": C || void 0,
|
|
39
|
-
"data-header-fill":
|
|
40
|
-
...
|
|
40
|
+
"data-header-fill": b || void 0,
|
|
41
|
+
...z && { [N]: "" },
|
|
41
42
|
title: x,
|
|
42
|
-
className:
|
|
43
|
-
pinned:
|
|
43
|
+
className: k(a.cell, n),
|
|
44
|
+
pinned: u || h,
|
|
44
45
|
style: {
|
|
45
|
-
...
|
|
46
|
-
...
|
|
47
|
-
...
|
|
48
|
-
...
|
|
46
|
+
...e,
|
|
47
|
+
...y ? { width: y } : {},
|
|
48
|
+
...u ? { insetInlineStart: `${f}px` } : {},
|
|
49
|
+
...h ? { insetInlineEnd: `${m}px` } : {}
|
|
49
50
|
},
|
|
50
|
-
scope:
|
|
51
|
-
rowSpan:
|
|
52
|
-
children:
|
|
51
|
+
scope: r ? "col" : void 0,
|
|
52
|
+
rowSpan: o,
|
|
53
|
+
children: l ? /* @__PURE__ */ $("span", { className: a.contentRow, ref: g, children: [
|
|
53
54
|
S,
|
|
54
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ c("span", { className: a.endSlot, children: l })
|
|
55
56
|
] }) : S
|
|
56
57
|
}
|
|
57
58
|
);
|
|
58
59
|
}
|
|
59
60
|
function J({
|
|
60
|
-
position:
|
|
61
|
+
position: t
|
|
61
62
|
}) {
|
|
62
|
-
const n = v().useExtraColumns(
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
-
|
|
63
|
+
const n = v().useExtraColumns(t);
|
|
64
|
+
return /* @__PURE__ */ c(R, { children: n.map((e) => /* @__PURE__ */ c(
|
|
65
|
+
B,
|
|
65
66
|
{
|
|
66
|
-
columnId:
|
|
67
|
-
width:
|
|
68
|
-
ignoreRowClick:
|
|
69
|
-
children:
|
|
67
|
+
columnId: e.id,
|
|
68
|
+
width: e.width,
|
|
69
|
+
ignoreRowClick: e.ignoreRowClick,
|
|
70
|
+
children: e.body ? /* @__PURE__ */ c(e.body, {}) : null
|
|
70
71
|
},
|
|
71
|
-
|
|
72
|
+
e.id
|
|
72
73
|
)) });
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
-
function
|
|
76
|
-
return typeof
|
|
75
|
+
const L = "--_data-grid-col-max";
|
|
76
|
+
function _(t) {
|
|
77
|
+
return typeof t == "string" && t.trim().endsWith("%");
|
|
77
78
|
}
|
|
78
|
-
function
|
|
79
|
-
return typeof
|
|
79
|
+
function w(t) {
|
|
80
|
+
return typeof t == "number" ? `${t}px` : /^-?\d+(\.\d+)?$/.test(t.trim()) ? `${t}px` : t;
|
|
80
81
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
82
|
+
function M(t, o, n) {
|
|
83
|
+
return o === "auto" ? F(t, n) : j(t, n);
|
|
83
84
|
}
|
|
84
|
-
function
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
if (
|
|
88
|
-
return { headerStyle: { inlineSize:
|
|
89
|
-
const
|
|
85
|
+
function j(t, o) {
|
|
86
|
+
const e = (t.width === "min-content" ? o : t.width) ?? t.minWidth ?? t.maxWidth;
|
|
87
|
+
if (e === void 0) return { headerStyle: {}, contentVars: {}, isCapped: !1 };
|
|
88
|
+
if (_(e))
|
|
89
|
+
return { headerStyle: { inlineSize: e }, contentVars: {}, isCapped: !1 };
|
|
90
|
+
const i = w(e);
|
|
90
91
|
return {
|
|
91
|
-
headerStyle: { width:
|
|
92
|
+
headerStyle: { width: i, minInlineSize: i },
|
|
92
93
|
contentVars: {},
|
|
93
94
|
isCapped: !1
|
|
94
95
|
};
|
|
95
96
|
}
|
|
96
|
-
function
|
|
97
|
-
const { width: n, minWidth:
|
|
97
|
+
function F(t, o) {
|
|
98
|
+
const { width: n, minWidth: e, maxWidth: i } = t, s = {};
|
|
98
99
|
if (n !== void 0)
|
|
99
|
-
if (n === "min-content" &&
|
|
100
|
-
const d = `${
|
|
101
|
-
|
|
102
|
-
} else if (
|
|
103
|
-
|
|
100
|
+
if (n === "min-content" && o !== void 0) {
|
|
101
|
+
const d = `${i !== void 0 ? Math.min(o, i) : o}px`;
|
|
102
|
+
s.width = d, s.minInlineSize = d;
|
|
103
|
+
} else if (_(n))
|
|
104
|
+
s.inlineSize = n;
|
|
104
105
|
else {
|
|
105
|
-
const
|
|
106
|
-
|
|
106
|
+
const l = w(n);
|
|
107
|
+
s.width = l, s.minInlineSize = l;
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
return
|
|
109
|
+
e !== void 0 && (s.minInlineSize = `${e}px`);
|
|
110
|
+
const r = {};
|
|
111
|
+
return i !== void 0 && (n === void 0 && (s.width = `${i}px`), r[L] = `${i}px`), { headerStyle: s, contentVars: r, isCapped: i !== void 0 };
|
|
111
112
|
}
|
|
112
|
-
function Q(
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
function F(e, i) {
|
|
116
|
-
return i.split(".").reduce((n, t) => {
|
|
117
|
-
if (n != null && typeof n == "object")
|
|
118
|
-
return n[t];
|
|
119
|
-
}, e);
|
|
120
|
-
}
|
|
121
|
-
function H(e, i) {
|
|
122
|
-
if (e.render || e.component) return;
|
|
123
|
-
const n = e.key ?? e.id, t = n.includes(".") ? F(i, n) : i[n];
|
|
124
|
-
return e.formatter ? e.formatter(t) : t != null ? String(t) : "";
|
|
125
|
-
}
|
|
126
|
-
function Y(e, i, n) {
|
|
127
|
-
const t = e.cellOverflow ?? "wrap", { contentVars: o, isCapped: r } = L(e, n), s = t === "nowrap" ? H(e, i) : void 0;
|
|
128
|
-
return { style: o, overflow: t, capped: r, title: s || void 0 };
|
|
113
|
+
function Q(t, o, n) {
|
|
114
|
+
const e = t.cellOverflow ?? "wrap", { contentVars: i, isCapped: s } = M(t, n), r = e === "nowrap" ? D(t, o) : void 0;
|
|
115
|
+
return { style: i, overflow: e, capped: s, title: r || void 0 };
|
|
129
116
|
}
|
|
130
117
|
export {
|
|
131
118
|
J as D,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
L as d,
|
|
136
|
-
F as g,
|
|
137
|
-
H as r,
|
|
119
|
+
B as a,
|
|
120
|
+
M as b,
|
|
121
|
+
Q as r,
|
|
138
122
|
a as s
|
|
139
123
|
};
|
|
140
124
|
//# sourceMappingURL=resolve-body-cell-props.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-body-cell-props.js","sources":["../../src/components/data-grid/services/table/components/data-grid-cell.tsx","../../src/components/data-grid/services/table/components/data-grid-extra-body-columns.tsx","../../src/components/data-grid/services/table/resolve-column-style.ts","../../src/components/data-grid/services/table/table-helpers.ts","../../src/components/data-grid/services/table/resolve-body-cell-props.ts"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from 'react';\nimport { cx } from 'class-variance-authority';\nimport { TableCell, TableHead } from '../../../../table/public.js';\nimport type { DataGridItem } from '../../../data-grid-types';\nimport { IGNORE_CLICK_ATTRIBUTE } from '../ignore-row-click';\nimport { useTableService } from '../table-context';\nimport type { DataGridTableColumnOverflow } from '../table-types';\nimport styles from './data-grid-cell.module.css';\n\ninterface DataGridCellProps {\n columnId: string;\n rowspan?: number;\n className?: string;\n style?: CSSProperties;\n width?: string | number;\n children?: ReactNode;\n /** Renders a column header (`<th>`) instead of a body cell (`<td>`). */\n header?: boolean;\n /**\n * Rendered after the overflow-controlled content, outside its clipping contract — used by\n * header cells for the sort-icon / header-cell-end slot, which must stay visible even when the\n * label ellipsizes. Body cells don't pass this.\n */\n endSlot?: ReactNode;\n /** Drives the shared `data-overflow` attribute that both header and body overflow CSS key off. */\n overflow?: DataGridTableColumnOverflow;\n /**\n * Whether `resolveColumnStyle` resolved a real, active `maxWidth` cap for this column (only\n * possible under `tableLayout=\"auto\"`). Drives `data-capped`, which the overflow CSS uses to\n * enforce the cap for `wrap` too -- `nowrap` already reads the cap var directly (mode-agnostic)\n * -- so the column never grows past `maxWidth` regardless of how it wraps.\n */\n capped?: boolean;\n title?: string;\n /**\n * Ref onto the `.contentRow` wrapper -- used by `DataGridHeaderCell` to measure a\n * `width: 'min-content'` column's natural content width, under either `tableLayout` (its own\n * `inline-size: min-content` CSS below makes it shrink-wrap regardless of whatever width the\n * `<th>` itself ends up with, so it's a safe, unstretched measurement target -- see\n * `DataGridHeaderCell` for the ResizeObserver that reads it). Only rendered when `endSlot` is\n * passed, which header cells always do; body cells never pass this ref.\n */\n contentRowRef?: Ref<HTMLSpanElement>;\n /**\n * Whether this header cell's content should fill `.contentRow` instead of shrink-wrapping it,\n * via `data-header-fill` (see data-grid-cell.module.css). Set by `DataGridHeaderCell` only for a\n * custom `headerComponent` (e.g. a select-all checkbox) on a non-min-content column -- that kind\n * of header needs to fill/center like a body cell rather than hug its own min-content width the\n * way a default text label does. Body cells and min-content columns never set this (a min-content\n * column's `.contentRow` doubles as its ResizeObserver measurement target and must keep\n * shrink-wrapping).\n */\n fillContent?: boolean;\n /**\n * When `true`, stamps `data-grid-row-ignore-click` onto the cell element so a plugin that reacts\n * to row clicks can skip clicks anywhere in the cell. Set by extra columns that opt out of row\n * clicks (e.g. a column holding a checkbox).\n */\n ignoreRowClick?: boolean;\n}\n\n// A bare number, or a string holding one, is a pixel width; anything else (`%`, `rem`) is already\n// a CSS length.\nfunction normalizeWidth(width: string | number | undefined): string | undefined {\n if (width == null) return undefined;\n if (typeof width === 'number') return `${width}px`;\n return !isNaN(Number(width)) ? `${width}px` : width;\n}\n\nexport function DataGridCell<TItem extends DataGridItem = DataGridItem>({\n columnId,\n rowspan,\n className,\n style,\n width,\n children,\n header,\n endSlot,\n overflow,\n capped,\n title,\n contentRowRef,\n fillContent,\n ignoreRowClick,\n}: DataGridCellProps) {\n const tableService = useTableService<TItem>();\n\n const stickyOffset = tableService.useColumnStickyOffset(columnId);\n const endStickyOffset = tableService.useColumnEndStickyOffset(columnId);\n\n const isSticky = stickyOffset !== undefined;\n // Extra columns are never in the table's own sticky map, so a pinned `end` column can only ever\n // be one of these two, never both -- it pins to the opposite edge and stays out of the\n // start-side run rather than being parked against it.\n const isStickyEnd = endStickyOffset !== undefined;\n\n const content = <span className={styles.content}>{children}</span>;\n const Cell = header ? TableHead : TableCell;\n const normalizedWidth = normalizeWidth(width);\n\n return (\n <Cell\n data-column-id={columnId}\n data-overflow={overflow}\n data-capped={capped || undefined}\n data-header-fill={fillContent || undefined}\n {...(ignoreRowClick && { [IGNORE_CLICK_ATTRIBUTE]: '' })}\n title={title}\n className={cx(styles.cell, className)}\n pinned={isSticky || isStickyEnd}\n style={{\n ...style,\n ...(normalizedWidth ? { width: normalizedWidth } : {}),\n ...(isSticky ? { insetInlineStart: `${stickyOffset}px` } : {}),\n ...(isStickyEnd ? { insetInlineEnd: `${endStickyOffset}px` } : {}),\n }}\n scope={header ? 'col' : undefined}\n rowSpan={rowspan}\n >\n {endSlot ? (\n <span className={styles.contentRow} ref={contentRowRef}>\n {content}\n <span className={styles.endSlot}>{endSlot}</span>\n </span>\n ) : (\n content\n )}\n </Cell>\n );\n}\n","import type { DataGridItem } from '../../../data-grid-types';\nimport { useTableService } from '../table-context';\nimport type { ExtraColumnPosition } from '../table-types';\nimport { DataGridCell } from './data-grid-cell';\n\ninterface DataGridExtraBodyColumnsProps {\n position: ExtraColumnPosition;\n}\n\nexport function DataGridExtraBodyColumns<TItem extends DataGridItem = DataGridItem>({\n position,\n}: DataGridExtraBodyColumnsProps) {\n const tableService = useTableService<TItem>();\n const extraColumns = tableService.useExtraColumns(position);\n\n return (\n <>\n {extraColumns.map((extra) => (\n <DataGridCell\n key={extra.id}\n columnId={extra.id}\n width={extra.width}\n ignoreRowClick={extra.ignoreRowClick}\n >\n {extra.body ? <extra.body /> : null}\n </DataGridCell>\n ))}\n </>\n );\n}\n","import type { CSSProperties } from 'react';\nimport type { DataGridItem } from '../../data-grid-types';\nimport type { DataGridTableColumn, DataGridTableLayout } from './table-types';\n\n/**\n * Internal CSS var carrying the `tableLayout=\"auto\"` `maxWidth` cap into the per-row content-cap\n * wrapper (`DataGridCell`'s `.content` span). Not documented as public API.\n */\nexport const DATA_GRID_COLUMN_MAX_WIDTH_VAR = '--_data-grid-col-max';\n\nexport interface ResolvedColumnStyle {\n /**\n * `width`/`minWidth`/`maxWidth` mapped to CSS for the header `<th>`. Body cells intentionally\n * receive no box sizing from this — width lives on the header only, since the table already\n * shares one track per column.\n */\n headerStyle: CSSProperties;\n /**\n * Content-cap CSS var(s) needed by the per-row overflow wrapper. Applied on both header and\n * body cells: a CSS custom property set via inline style on one row's `<td>` does not reach a\n * sibling row's `<td>` for the same column, so each row needs its own copy.\n */\n contentVars: CSSProperties;\n /**\n * Whether `maxWidth` is a real, active cap (`tableLayout=\"auto\"` with `maxWidth` set) that the\n * content wrapper's CSS must enforce regardless of overflow mode — `nowrap` reads the cap var\n * directly (mode-agnostic), `wrap` needs this flag to also force word-breaking, so the column\n * never grows past the cap. Always `false` under `tableLayout=\"fixed\"`, where `maxWidth`\n * aliases into the shared track instead.\n */\n isCapped: boolean;\n}\n\ntype ColumnWidthProps<TItem extends DataGridItem> = Pick<\n DataGridTableColumn<TItem>,\n 'width' | 'minWidth' | 'maxWidth'\n>;\n\nfunction isPercent(value: number | string): value is string {\n return typeof value === 'string' && value.trim().endsWith('%');\n}\n\nfunction toLength(value: number | string): string {\n if (typeof value === 'number') return `${value}px`;\n return /^-?\\d+(\\.\\d+)?$/.test(value.trim()) ? `${value}px` : value;\n}\n\n/**\n * Single source of CSS for column `width`/`minWidth`/`maxWidth`, branching on `tableLayout`.\n *\n * - `fixed`: the three props collapse to one shared track. `width` wins when present; a lone\n * `minWidth`/`maxWidth` aliases to the track. (Detecting the contradictory combination — width\n * set alongside `minWidth`/`maxWidth` — is a DEV-only warning emitted separately at column\n * ingestion; this function stays pure and has no side effects.) `width: 'min-content'` opts the\n * column into the same measurement pipeline as under `auto` (see below) -- once\n * `DataGridHeaderCell`'s ResizeObserver has measured it, the pixel value becomes this column's\n * track, same as a literal numeric `width`.\n * - `auto`: the three are independent constraints — `width` sets a preferred size and, absent an\n * explicit `minWidth`, an implicit floor at that same size; `minWidth` is the floor; `maxWidth`\n * is a real cap. A `maxWidth`-without-`width` column also gets its header `width` set to the\n * cap so it stops absorbing container slack under `inline-size: 100%` fill, and `maxWidth`\n * always drives the content-cap CSS var read by the per-row wrapper. `width: 'min-content'` is\n * special-cased: the literal CSS keyword isn't honored by the browser's auto table-layout\n * algorithm as a hint to hold this column narrow against a widthless sibling, so\n * `minContentWidth` (a measured pixel value from `DataGridHeaderCell`'s ResizeObserver, via\n * `table-min-content-width.ts`) stands in for it once measurement has landed.\n *\n * Before the first measurement lands: under `auto`, the raw `'min-content'` keyword still flows\n * through as an inert one-frame fallback (harmless -- the browser ignores it as a `width`/\n * `min-inline-size` value and the column renders under ordinary layout sizing until the\n * ResizeObserver's first callback fires); under `fixed`, the width is simply unset instead\n * (falls to a lone `minWidth`/`maxWidth` alias, or no track at all).\n *\n * `%` strings map to `inline-size`; any other value maps to `width` + `min-inline-size`.\n */\nexport function resolveColumnStyle<TItem extends DataGridItem>(\n column: ColumnWidthProps<TItem>,\n tableLayout: DataGridTableLayout,\n minContentWidth?: number,\n): ResolvedColumnStyle {\n return tableLayout === 'auto'\n ? resolveAutoStyle(column, minContentWidth)\n : resolveFixedStyle(column, minContentWidth);\n}\n\nfunction resolveFixedStyle<TItem extends DataGridItem>(\n column: ColumnWidthProps<TItem>,\n minContentWidth?: number,\n): ResolvedColumnStyle {\n // `'min-content'` resolves from the measured pixel value once it lands (see the function-level\n // doc above) -- exactly like a literal numeric `width` from here on, including winning over\n // `minWidth`/`maxWidth` in the single-track collapse below. Before measurement, it falls back\n // to the `minWidth`/`maxWidth` alias (or no track at all).\n const width: number | string | undefined =\n column.width === 'min-content' ? minContentWidth : column.width;\n const track = width ?? column.minWidth ?? column.maxWidth;\n if (track === undefined) return { headerStyle: {}, contentVars: {}, isCapped: false };\n\n if (isPercent(track)) {\n return { headerStyle: { inlineSize: track }, contentVars: {}, isCapped: false };\n }\n\n const length = toLength(track);\n return {\n headerStyle: { width: length, minInlineSize: length },\n contentVars: {},\n isCapped: false,\n };\n}\n\nfunction resolveAutoStyle<TItem extends DataGridItem>(\n column: ColumnWidthProps<TItem>,\n minContentWidth?: number,\n): ResolvedColumnStyle {\n const { width, minWidth, maxWidth } = column;\n const headerStyle: CSSProperties = {};\n\n if (width !== undefined) {\n // The literal CSS `min-content` keyword isn't honored by the browser's auto table-layout\n // algorithm as a hint to hold this column narrow against a widthless sibling -- once\n // `DataGridHeaderCell`'s ResizeObserver has measured the header content's natural width, that\n // pixel value stands in for the keyword here, exactly like an ordinary numeric `width` (same\n // width + floor pattern below). Checked ahead of `isPercent` purely so its `value is string`\n // guard doesn't narrow `width` to `number`-only in the `else` branch below (a `'min-content'`\n // check there wouldn't type-check). Before the first measurement lands, the raw keyword still\n // flows through via `toLength` as an inert fallback (harmless -- the browser ignores it and\n // the column renders under ordinary auto-layout sizing for one frame).\n if (width === 'min-content' && minContentWidth !== undefined) {\n // A `maxWidth` cap still applies to a measured min-content column -- without this, the\n // header track could exceed its own cap (the measured value is a natural content size, not\n // itself capped) while the per-row content wrapper below enforces the cap independently,\n // leaving the two out of sync.\n const cappedWidth =\n maxWidth !== undefined ? Math.min(minContentWidth, maxWidth) : minContentWidth;\n const length = `${cappedWidth}px`;\n headerStyle.width = length;\n headerStyle.minInlineSize = length;\n } else if (isPercent(width)) {\n headerStyle.inlineSize = width;\n } else {\n const length = toLength(width);\n headerStyle.width = length;\n headerStyle.minInlineSize = length; // preferred size doubles as the floor by default\n }\n }\n\n if (minWidth !== undefined) {\n headerStyle.minInlineSize = `${minWidth}px`; // explicit floor overrides width's implicit one\n }\n\n const contentVars: CSSProperties = {};\n if (maxWidth !== undefined) {\n if (width === undefined) {\n // A widthless-but-capped column still absorbs container slack under `inline-size: 100%`\n // fill — give the header a width so the cap actually holds instead of leaving dead space.\n headerStyle.width = `${maxWidth}px`;\n }\n (contentVars as Record<string, string>)[DATA_GRID_COLUMN_MAX_WIDTH_VAR] = `${maxWidth}px`;\n }\n\n return { headerStyle, contentVars, isCapped: maxWidth !== undefined };\n}\n","import type { DataGridItem } from '../../data-grid-types';\nimport type { DataGridTableColumn } from './table-types';\n\nexport function resolveLabel(label: string | (() => string)): string {\n return typeof label === 'function' ? label() : label;\n}\n\nexport function getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n return path.split('.').reduce<unknown>((acc, key) => {\n if (acc != null && typeof acc === 'object') {\n return (acc as Record<string, unknown>)[key];\n }\n return undefined;\n }, obj);\n}\n\n/**\n * Resolves a body cell's plain-string display value — the same value the default cell renderer\n * shows — or `undefined` when the column uses `component`/`render` (output the kit cannot safely\n * stringify, e.g. for an auto-set `title` fallback). Shared by `DataGridBodyCellContent` (the\n * renderer) and `resolveBodyCellProps` (the `title` fallback for `cellOverflow: 'nowrap'`) so the\n * two never drift on what counts as \"plain string\" content.\n */\nexport function resolveCellDisplayValue<TItem extends DataGridItem>(\n column: DataGridTableColumn<TItem>,\n item: TItem,\n): string | undefined {\n if (column.render || column.component) return undefined;\n\n const key = column.key ?? column.id;\n const rawValue = key.includes('.') ? getNestedValue(item, key) : item[key];\n\n if (column.formatter) return column.formatter(rawValue);\n\n return rawValue != null ? String(rawValue) : '';\n}\n","import type { CSSProperties } from 'react';\nimport type { DataGridItem } from '../../data-grid-types';\nimport { resolveColumnStyle } from './resolve-column-style';\nimport { resolveCellDisplayValue } from './table-helpers';\nimport type { DataGridTableColumn, DataGridTableColumnOverflow, DataGridTableLayout } from './table-types';\n\nexport interface ResolvedBodyCellProps {\n /** Content-cap CSS var(s) forwarded to `DataGridCell`'s `style` prop -- see `resolveColumnStyle`. */\n style: CSSProperties;\n /** Drives `DataGridCell`'s `data-overflow` attribute; defaults to `'wrap'` when unset on the column. */\n overflow: DataGridTableColumnOverflow;\n /** Whether a real, active `maxWidth` cap applies -- forwarded to `DataGridCell`'s `capped` prop. */\n capped: boolean;\n /** Stringified cell value for the native `title` tooltip, or `undefined` when there's none to show. */\n title: string | undefined;\n}\n\n/**\n * Single source of the per-cell overflow/width props a body row forwards to `DataGridCell`, kept\n * apart from `DataGridRow` so the derivation is pure and can be tested without rendering a row.\n *\n * Pure: `useTableLayout()` stays a hook call at each call site, its result passed in here.\n */\nexport function resolveBodyCellProps<TItem extends DataGridItem>(\n column: DataGridTableColumn<TItem>,\n item: TItem,\n tableLayout: DataGridTableLayout,\n): ResolvedBodyCellProps {\n const overflow = column.cellOverflow ?? 'wrap';\n // Width lives on the header only -- the column already shares one track from there. Body cells\n // only need the content-cap var (auto mode + maxWidth) for their own per-row overflow wrapper.\n const { contentVars, isCapped } = resolveColumnStyle(column, tableLayout);\n // Custom `component`/`render` output can't be safely stringified -- the kit can't supply a\n // title fallback for it, so resolveCellDisplayValue returns undefined there. `nowrap` is the\n // clipping mode (single line, ellipsis on overflow) -- `wrap` never clips.\n const displayValue = overflow === 'nowrap' ? resolveCellDisplayValue(column, item) : undefined;\n // An empty stringified value (e.g. `null`) must not become an empty `title=\"\"` attribute --\n // only set `title` when there's real content to show.\n const title = displayValue ? displayValue : undefined;\n\n return { style: contentVars, overflow, capped: isCapped, title };\n}\n"],"names":["normalizeWidth","width","DataGridCell","columnId","rowspan","className","style","children","header","endSlot","overflow","capped","title","contentRowRef","fillContent","ignoreRowClick","tableService","useTableService","stickyOffset","endStickyOffset","isSticky","isStickyEnd","content","jsx","styles","Cell","TableHead","TableCell","normalizedWidth","IGNORE_CLICK_ATTRIBUTE","cx","jsxs","DataGridExtraBodyColumns","position","extraColumns","Fragment","extra","DATA_GRID_COLUMN_MAX_WIDTH_VAR","isPercent","value","toLength","resolveColumnStyle","column","tableLayout","minContentWidth","resolveAutoStyle","resolveFixedStyle","track","length","minWidth","maxWidth","headerStyle","contentVars","resolveLabel","label","getNestedValue","obj","path","acc","key","resolveCellDisplayValue","item","rawValue","resolveBodyCellProps","isCapped","displayValue"],"mappings":";;;;;;;;;;;AA+DA,SAASA,EAAeC,GAAwD;AAC9E,MAAIA,KAAS;AACb,WAAI,OAAOA,KAAU,WAAiB,GAAGA,CAAK,OACtC,MAAM,OAAOA,CAAK,CAAC,IAAmBA,IAAf,GAAGA,CAAK;AACzC;AAEO,SAASC,EAAwD;AAAA,EACtE,UAAAC;AAAA,E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AUA,EAAO,UAAW;AAEvC,QAAMiB,IAAMjB,EAAO,OAAOA,EAAO,IAC3BoB,IAAWH,EAAI,SAAS,GAAG,IAAIJ,EAAeM,GAAMF,CAAG,IAAIE,EAAKF,CAAG;AAEzE,SAAIjB,EAAO,YAAkBA,EAAO,UAAUoB,CAAQ,IAE/CA,KAAY,OAAO,OAAOA,CAAQ,IAAI;AAC/C;ACZO,SAASC,EACdrB,GACAmB,GACAlB,GACuB;AACvB,QAAMjC,IAAWgC,EAAO,gBAAgB,QAGlC,EAAE,aAAAU,GAAa,UAAAY,EAAA,IAAavB,EAAmBC,GAAQC,CAAW,GAIlEsB,IAAevD,MAAa,WAAWkD,EAAwBlB,GAAQmB,CAAI,IAAI;AAKrF,SAAO,EAAE,OAAOT,GAAa,UAAA1C,GAAU,QAAQsD,GAAU,OAF3CC,KAA8B,OAEa;AAC3D;"}
|
|
1
|
+
{"version":3,"file":"resolve-body-cell-props.js","sources":["../../src/components/data-grid/services/table/components/data-grid-cell.tsx","../../src/components/data-grid/services/table/components/data-grid-extra-body-columns.tsx","../../src/components/data-grid/services/table/resolve-column-style.ts","../../src/components/data-grid/services/table/resolve-body-cell-props.ts"],"sourcesContent":["import type { CSSProperties, ReactNode, Ref } from 'react';\nimport { cx } from 'class-variance-authority';\nimport { TableCell, TableHead } from '../../../../table/public.js';\nimport type { DataGridItem } from '../../../data-grid-types';\nimport { IGNORE_CLICK_ATTRIBUTE } from '../ignore-row-click';\nimport { useTableService } from '../table-context';\nimport type { DataGridTableColumnOverflow } from '../table-types';\nimport styles from './data-grid-cell.module.css';\n\ninterface DataGridCellProps {\n columnId: string;\n rowspan?: number;\n className?: string;\n style?: CSSProperties;\n width?: string | number;\n children?: ReactNode;\n /** Renders a column header (`<th>`) instead of a body cell (`<td>`). */\n header?: boolean;\n /**\n * Rendered after the overflow-controlled content, outside its clipping contract — used by\n * header cells for the sort-icon / header-cell-end slot, which must stay visible even when the\n * label ellipsizes. Body cells don't pass this.\n */\n endSlot?: ReactNode;\n /** Drives the shared `data-overflow` attribute that both header and body overflow CSS key off. */\n overflow?: DataGridTableColumnOverflow;\n /**\n * Whether `resolveColumnStyle` resolved a real, active `maxWidth` cap for this column (only\n * possible under `tableLayout=\"auto\"`). Drives `data-capped`, which the overflow CSS uses to\n * enforce the cap for `wrap` too -- `nowrap` already reads the cap var directly (mode-agnostic)\n * -- so the column never grows past `maxWidth` regardless of how it wraps.\n */\n capped?: boolean;\n title?: string;\n /**\n * Ref onto the `.contentRow` wrapper -- used by `DataGridHeaderCell` to measure a\n * `width: 'min-content'` column's natural content width, under either `tableLayout` (its own\n * `inline-size: min-content` CSS below makes it shrink-wrap regardless of whatever width the\n * `<th>` itself ends up with, so it's a safe, unstretched measurement target -- see\n * `DataGridHeaderCell` for the ResizeObserver that reads it). Only rendered when `endSlot` is\n * passed, which header cells always do; body cells never pass this ref.\n */\n contentRowRef?: Ref<HTMLSpanElement>;\n /**\n * Whether this header cell's content should fill `.contentRow` instead of shrink-wrapping it,\n * via `data-header-fill` (see data-grid-cell.module.css). Set by `DataGridHeaderCell` only for a\n * custom `headerComponent` (e.g. a select-all checkbox) on a non-min-content column -- that kind\n * of header needs to fill/center like a body cell rather than hug its own min-content width the\n * way a default text label does. Body cells and min-content columns never set this (a min-content\n * column's `.contentRow` doubles as its ResizeObserver measurement target and must keep\n * shrink-wrapping).\n */\n fillContent?: boolean;\n /**\n * When `true`, stamps `data-grid-row-ignore-click` onto the cell element so a plugin that reacts\n * to row clicks can skip clicks anywhere in the cell. Set by extra columns that opt out of row\n * clicks (e.g. a column holding a checkbox).\n */\n ignoreRowClick?: boolean;\n}\n\n// A bare number, or a string holding one, is a pixel width; anything else (`%`, `rem`) is already\n// a CSS length.\nfunction normalizeWidth(width: string | number | undefined): string | undefined {\n if (width == null) return undefined;\n if (typeof width === 'number') return `${width}px`;\n return !isNaN(Number(width)) ? `${width}px` : width;\n}\n\nexport function DataGridCell<TItem extends DataGridItem = DataGridItem>({\n columnId,\n rowspan,\n className,\n style,\n width,\n children,\n header,\n endSlot,\n overflow,\n capped,\n title,\n contentRowRef,\n fillContent,\n ignoreRowClick,\n}: DataGridCellProps) {\n const tableService = useTableService<TItem>();\n\n const stickyOffset = tableService.useColumnStickyOffset(columnId);\n const endStickyOffset = tableService.useColumnEndStickyOffset(columnId);\n\n const isSticky = stickyOffset !== undefined;\n // Extra columns are never in the table's own sticky map, so a pinned `end` column can only ever\n // be one of these two, never both -- it pins to the opposite edge and stays out of the\n // start-side run rather than being parked against it.\n const isStickyEnd = endStickyOffset !== undefined;\n\n const content = <span className={styles.content}>{children}</span>;\n const Cell = header ? TableHead : TableCell;\n const normalizedWidth = normalizeWidth(width);\n\n return (\n <Cell\n data-column-id={columnId}\n data-overflow={overflow}\n data-capped={capped || undefined}\n data-header-fill={fillContent || undefined}\n {...(ignoreRowClick && { [IGNORE_CLICK_ATTRIBUTE]: '' })}\n title={title}\n className={cx(styles.cell, className)}\n pinned={isSticky || isStickyEnd}\n style={{\n ...style,\n ...(normalizedWidth ? { width: normalizedWidth } : {}),\n ...(isSticky ? { insetInlineStart: `${stickyOffset}px` } : {}),\n ...(isStickyEnd ? { insetInlineEnd: `${endStickyOffset}px` } : {}),\n }}\n scope={header ? 'col' : undefined}\n rowSpan={rowspan}\n >\n {endSlot ? (\n <span className={styles.contentRow} ref={contentRowRef}>\n {content}\n <span className={styles.endSlot}>{endSlot}</span>\n </span>\n ) : (\n content\n )}\n </Cell>\n );\n}\n","import type { DataGridItem } from '../../../data-grid-types';\nimport { useTableService } from '../table-context';\nimport type { ExtraColumnPosition } from '../table-types';\nimport { DataGridCell } from './data-grid-cell';\n\ninterface DataGridExtraBodyColumnsProps {\n position: ExtraColumnPosition;\n}\n\nexport function DataGridExtraBodyColumns<TItem extends DataGridItem = DataGridItem>({\n position,\n}: DataGridExtraBodyColumnsProps) {\n const tableService = useTableService<TItem>();\n const extraColumns = tableService.useExtraColumns(position);\n\n return (\n <>\n {extraColumns.map((extra) => (\n <DataGridCell\n key={extra.id}\n columnId={extra.id}\n width={extra.width}\n ignoreRowClick={extra.ignoreRowClick}\n >\n {extra.body ? <extra.body /> : null}\n </DataGridCell>\n ))}\n </>\n );\n}\n","import type { CSSProperties } from 'react';\nimport type { DataGridItem } from '../../data-grid-types';\nimport type { DataGridTableColumn, DataGridTableLayout } from './table-types';\n\n/**\n * Internal CSS var carrying the `tableLayout=\"auto\"` `maxWidth` cap into the per-row content-cap\n * wrapper (`DataGridCell`'s `.content` span). Not documented as public API.\n */\nexport const DATA_GRID_COLUMN_MAX_WIDTH_VAR = '--_data-grid-col-max';\n\nexport interface ResolvedColumnStyle {\n /**\n * `width`/`minWidth`/`maxWidth` mapped to CSS for the header `<th>`. Body cells intentionally\n * receive no box sizing from this — width lives on the header only, since the table already\n * shares one track per column.\n */\n headerStyle: CSSProperties;\n /**\n * Content-cap CSS var(s) needed by the per-row overflow wrapper. Applied on both header and\n * body cells: a CSS custom property set via inline style on one row's `<td>` does not reach a\n * sibling row's `<td>` for the same column, so each row needs its own copy.\n */\n contentVars: CSSProperties;\n /**\n * Whether `maxWidth` is a real, active cap (`tableLayout=\"auto\"` with `maxWidth` set) that the\n * content wrapper's CSS must enforce regardless of overflow mode — `nowrap` reads the cap var\n * directly (mode-agnostic), `wrap` needs this flag to also force word-breaking, so the column\n * never grows past the cap. Always `false` under `tableLayout=\"fixed\"`, where `maxWidth`\n * aliases into the shared track instead.\n */\n isCapped: boolean;\n}\n\ntype ColumnWidthProps<TItem extends DataGridItem> = Pick<\n DataGridTableColumn<TItem>,\n 'width' | 'minWidth' | 'maxWidth'\n>;\n\nfunction isPercent(value: number | string): value is string {\n return typeof value === 'string' && value.trim().endsWith('%');\n}\n\nfunction toLength(value: number | string): string {\n if (typeof value === 'number') return `${value}px`;\n return /^-?\\d+(\\.\\d+)?$/.test(value.trim()) ? `${value}px` : value;\n}\n\n/**\n * Single source of CSS for column `width`/`minWidth`/`maxWidth`, branching on `tableLayout`.\n *\n * - `fixed`: the three props collapse to one shared track. `width` wins when present; a lone\n * `minWidth`/`maxWidth` aliases to the track. (Detecting the contradictory combination — width\n * set alongside `minWidth`/`maxWidth` — is a DEV-only warning emitted separately at column\n * ingestion; this function stays pure and has no side effects.) `width: 'min-content'` opts the\n * column into the same measurement pipeline as under `auto` (see below) -- once\n * `DataGridHeaderCell`'s ResizeObserver has measured it, the pixel value becomes this column's\n * track, same as a literal numeric `width`.\n * - `auto`: the three are independent constraints — `width` sets a preferred size and, absent an\n * explicit `minWidth`, an implicit floor at that same size; `minWidth` is the floor; `maxWidth`\n * is a real cap. A `maxWidth`-without-`width` column also gets its header `width` set to the\n * cap so it stops absorbing container slack under `inline-size: 100%` fill, and `maxWidth`\n * always drives the content-cap CSS var read by the per-row wrapper. `width: 'min-content'` is\n * special-cased: the literal CSS keyword isn't honored by the browser's auto table-layout\n * algorithm as a hint to hold this column narrow against a widthless sibling, so\n * `minContentWidth` (a measured pixel value from `DataGridHeaderCell`'s ResizeObserver, via\n * `table-min-content-width.ts`) stands in for it once measurement has landed.\n *\n * Before the first measurement lands: under `auto`, the raw `'min-content'` keyword still flows\n * through as an inert one-frame fallback (harmless -- the browser ignores it as a `width`/\n * `min-inline-size` value and the column renders under ordinary layout sizing until the\n * ResizeObserver's first callback fires); under `fixed`, the width is simply unset instead\n * (falls to a lone `minWidth`/`maxWidth` alias, or no track at all).\n *\n * `%` strings map to `inline-size`; any other value maps to `width` + `min-inline-size`.\n */\nexport function resolveColumnStyle<TItem extends DataGridItem>(\n column: ColumnWidthProps<TItem>,\n tableLayout: DataGridTableLayout,\n minContentWidth?: number,\n): ResolvedColumnStyle {\n return tableLayout === 'auto'\n ? resolveAutoStyle(column, minContentWidth)\n : resolveFixedStyle(column, minContentWidth);\n}\n\nfunction resolveFixedStyle<TItem extends DataGridItem>(\n column: ColumnWidthProps<TItem>,\n minContentWidth?: number,\n): ResolvedColumnStyle {\n // `'min-content'` resolves from the measured pixel value once it lands (see the function-level\n // doc above) -- exactly like a literal numeric `width` from here on, including winning over\n // `minWidth`/`maxWidth` in the single-track collapse below. Before measurement, it falls back\n // to the `minWidth`/`maxWidth` alias (or no track at all).\n const width: number | string | undefined =\n column.width === 'min-content' ? minContentWidth : column.width;\n const track = width ?? column.minWidth ?? column.maxWidth;\n if (track === undefined) return { headerStyle: {}, contentVars: {}, isCapped: false };\n\n if (isPercent(track)) {\n return { headerStyle: { inlineSize: track }, contentVars: {}, isCapped: false };\n }\n\n const length = toLength(track);\n return {\n headerStyle: { width: length, minInlineSize: length },\n contentVars: {},\n isCapped: false,\n };\n}\n\nfunction resolveAutoStyle<TItem extends DataGridItem>(\n column: ColumnWidthProps<TItem>,\n minContentWidth?: number,\n): ResolvedColumnStyle {\n const { width, minWidth, maxWidth } = column;\n const headerStyle: CSSProperties = {};\n\n if (width !== undefined) {\n // The literal CSS `min-content` keyword isn't honored by the browser's auto table-layout\n // algorithm as a hint to hold this column narrow against a widthless sibling -- once\n // `DataGridHeaderCell`'s ResizeObserver has measured the header content's natural width, that\n // pixel value stands in for the keyword here, exactly like an ordinary numeric `width` (same\n // width + floor pattern below). Checked ahead of `isPercent` purely so its `value is string`\n // guard doesn't narrow `width` to `number`-only in the `else` branch below (a `'min-content'`\n // check there wouldn't type-check). Before the first measurement lands, the raw keyword still\n // flows through via `toLength` as an inert fallback (harmless -- the browser ignores it and\n // the column renders under ordinary auto-layout sizing for one frame).\n if (width === 'min-content' && minContentWidth !== undefined) {\n // A `maxWidth` cap still applies to a measured min-content column -- without this, the\n // header track could exceed its own cap (the measured value is a natural content size, not\n // itself capped) while the per-row content wrapper below enforces the cap independently,\n // leaving the two out of sync.\n const cappedWidth =\n maxWidth !== undefined ? Math.min(minContentWidth, maxWidth) : minContentWidth;\n const length = `${cappedWidth}px`;\n headerStyle.width = length;\n headerStyle.minInlineSize = length;\n } else if (isPercent(width)) {\n headerStyle.inlineSize = width;\n } else {\n const length = toLength(width);\n headerStyle.width = length;\n headerStyle.minInlineSize = length; // preferred size doubles as the floor by default\n }\n }\n\n if (minWidth !== undefined) {\n headerStyle.minInlineSize = `${minWidth}px`; // explicit floor overrides width's implicit one\n }\n\n const contentVars: CSSProperties = {};\n if (maxWidth !== undefined) {\n if (width === undefined) {\n // A widthless-but-capped column still absorbs container slack under `inline-size: 100%`\n // fill — give the header a width so the cap actually holds instead of leaving dead space.\n headerStyle.width = `${maxWidth}px`;\n }\n (contentVars as Record<string, string>)[DATA_GRID_COLUMN_MAX_WIDTH_VAR] = `${maxWidth}px`;\n }\n\n return { headerStyle, contentVars, isCapped: maxWidth !== undefined };\n}\n","import type { CSSProperties } from 'react';\nimport type { DataGridItem } from '../../data-grid-types';\nimport { resolveColumnStyle } from './resolve-column-style';\nimport { resolveCellDisplayValue } from './table-helpers';\nimport type { DataGridTableColumn, DataGridTableColumnOverflow, DataGridTableLayout } from './table-types';\n\nexport interface ResolvedBodyCellProps {\n /** Content-cap CSS var(s) forwarded to `DataGridCell`'s `style` prop -- see `resolveColumnStyle`. */\n style: CSSProperties;\n /** Drives `DataGridCell`'s `data-overflow` attribute; defaults to `'wrap'` when unset on the column. */\n overflow: DataGridTableColumnOverflow;\n /** Whether a real, active `maxWidth` cap applies -- forwarded to `DataGridCell`'s `capped` prop. */\n capped: boolean;\n /** Stringified cell value for the native `title` tooltip, or `undefined` when there's none to show. */\n title: string | undefined;\n}\n\n/**\n * Single source of the per-cell overflow/width props a body row forwards to `DataGridCell`, kept\n * apart from `DataGridRow` so the derivation is pure and can be tested without rendering a row.\n *\n * Pure: `useTableLayout()` stays a hook call at each call site, its result passed in here.\n */\nexport function resolveBodyCellProps<TItem extends DataGridItem>(\n column: DataGridTableColumn<TItem>,\n item: TItem,\n tableLayout: DataGridTableLayout,\n): ResolvedBodyCellProps {\n const overflow = column.cellOverflow ?? 'wrap';\n // Width lives on the header only -- the column already shares one track from there. Body cells\n // only need the content-cap var (auto mode + maxWidth) for their own per-row overflow wrapper.\n const { contentVars, isCapped } = resolveColumnStyle(column, tableLayout);\n // Custom `component`/`render` output can't be safely stringified -- the kit can't supply a\n // title fallback for it, so resolveCellDisplayValue returns undefined there. `nowrap` is the\n // clipping mode (single line, ellipsis on overflow) -- `wrap` never clips.\n const displayValue = overflow === 'nowrap' ? resolveCellDisplayValue(column, item) : undefined;\n // An empty stringified value (e.g. `null`) must not become an empty `title=\"\"` attribute --\n // only set `title` when there's real content to show.\n const title = displayValue ? displayValue : undefined;\n\n return { style: contentVars, overflow, capped: isCapped, title };\n}\n"],"names":["normalizeWidth","width","DataGridCell","columnId","rowspan","className","style","children","header","endSlot","overflow","capped","title","contentRowRef","fillContent","ignoreRowClick","tableService","useTableService","stickyOffset","endStickyOffset","isSticky","isStickyEnd","content","jsx","styles","Cell","TableHead","TableCell","normalizedWidth","IGNORE_CLICK_ATTRIBUTE","cx","jsxs","DataGridExtraBodyColumns","position","extraColumns","Fragment","extra","DATA_GRID_COLUMN_MAX_WIDTH_VAR","isPercent","value","toLength","resolveColumnStyle","column","tableLayout","minContentWidth","resolveAutoStyle","resolveFixedStyle","track","length","minWidth","maxWidth","headerStyle","contentVars","resolveBodyCellProps","item","isCapped","displayValue","resolveCellDisplayValue"],"mappings":";;;;;;;;;;;;AA+DA,SAASA,EAAeC,GAAwD;AAC9E,MAAIA,KAAS;AACb,WAAI,OAAOA,KAAU,WAAiB,GAAGA,CAAK,OACtC,MAAM,OAAOA,CAAK,CAAC,IAAmBA,IAAf,GAAGA,CAAK;AACzC;AAEO,SAASC,EAAwD;AAAA,EACtE,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAL;AAAA,EACA,UAAAM;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,gBAAAC;AACF,GAAsB;AACpB,QAAMC,IAAeC,EAAA,GAEfC,IAAeF,EAAa,sBAAsBb,CAAQ,GAC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AAU,iBAAiB2C,MAAoB,QAAW;AAO5D,YAAMI,IAAS,GADbE,MAAa,SAAY,KAAK,IAAIN,GAAiBM,CAAQ,IAAIN,CACpC;AAC7B,MAAAO,EAAY,QAAQH,GACpBG,EAAY,gBAAgBH;AAAA,IAC9B,WAAWV,EAAUrC,CAAK;AACxB,MAAAkD,EAAY,aAAalD;AAAA,SACpB;AACL,YAAM+C,IAASR,EAASvC,CAAK;AAC7B,MAAAkD,EAAY,QAAQH,GACpBG,EAAY,gBAAgBH;AAAA,IAC9B;AAGF,EAAIC,MAAa,WACfE,EAAY,gBAAgB,GAAGF,CAAQ;AAGzC,QAAMG,IAA6B,CAAA;AACnC,SAAIF,MAAa,WACXjD,MAAU,WAGZkD,EAAY,QAAQ,GAAGD,CAAQ,OAEhCE,EAAuCf,CAA8B,IAAI,GAAGa,CAAQ,OAGhF,EAAE,aAAAC,GAAa,aAAAC,GAAa,UAAUF,MAAa,OAAA;AAC5D;AC1IO,SAASG,EACdX,GACAY,GACAX,GACuB;AACvB,QAAMjC,IAAWgC,EAAO,gBAAgB,QAGlC,EAAE,aAAAU,GAAa,UAAAG,EAAA,IAAad,EAAmBC,GAAQC,CAAW,GAIlEa,IAAe9C,MAAa,WAAW+C,EAAwBf,GAAQY,CAAI,IAAI;AAKrF,SAAO,EAAE,OAAOF,GAAa,UAAA1C,GAAU,QAAQ6C,GAAU,OAF3CC,KAA8B,OAEa;AAC3D;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { I as i } from "./ignore-row-click.js";
|
|
2
|
+
const o = `[${i}]`;
|
|
3
|
+
function c(r, n) {
|
|
4
|
+
return (t) => {
|
|
5
|
+
const e = n();
|
|
6
|
+
e && ((t.target instanceof HTMLElement || t.target instanceof SVGElement) && t.target.closest(o) || e(r));
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
c as g
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=row-click-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row-click-utils.js","sources":["../../src/components/data-grid/plugins/row-click/row-click-utils.ts"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react';\nimport type { DataGridItem } from '../../data-grid-types';\nimport { IGNORE_CLICK_ATTRIBUTE } from '../../services/table/ignore-row-click';\nimport type { DataGridRowClickCallback } from './row-click-plugin';\n\nconst IGNORE_CLICK_SELECTOR = `[${IGNORE_CLICK_ATTRIBUTE}]`;\n\n/**\n * Accepts a getter so the callback is read at event time from the mutable plugin API,\n * avoiding stale closures when onPropsChange updates the API without re-rendering the row.\n */\nexport function getClickListener<TItem extends DataGridItem>(\n item: TItem,\n getCb: () => DataGridRowClickCallback<TItem> | undefined,\n) {\n return (event: MouseEvent | KeyboardEvent) => {\n const cb = getCb();\n if (!cb) return;\n if (event.target instanceof HTMLElement || event.target instanceof SVGElement) {\n if (event.target.closest(IGNORE_CLICK_SELECTOR)) {\n return;\n }\n }\n cb(item);\n };\n}\n"],"names":["IGNORE_CLICK_SELECTOR","IGNORE_CLICK_ATTRIBUTE","getClickListener","item","getCb","event","cb"],"mappings":";AAKA,MAAMA,IAAwB,IAAIC,CAAsB;AAMjD,SAASC,EACdC,GACAC,GACA;AACA,SAAO,CAACC,MAAsC;AAC5C,UAAMC,IAAKF,EAAA;AACX,IAAKE,OACDD,EAAM,kBAAkB,eAAeA,EAAM,kBAAkB,eAC7DA,EAAM,OAAO,QAAQL,CAAqB,KAIhDM,EAAGH,CAAI;AAAA,EACT;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._rowNumber_c3lgn_8{display:inline-block;vertical-align:top;font-family:var(--font-mono);white-space:nowrap}
|