@gears-frontx/ui-kit 0.4.10 → 0.5.1
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/grid.BvRXPN-7.css +1 -0
- package/dist/chunks/switch.BYqd9jlJ.css +1 -0
- package/dist/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.d.ts.map +1 -1
- package/dist/components/data-grid/plugins/drag-drop/drag-drop-plugin.d.ts.map +1 -1
- package/dist/components/grid/grid-config.d.ts +29 -0
- package/dist/components/grid/grid-config.d.ts.map +1 -0
- package/dist/components/grid/grid-default-config.json.d.ts +19 -0
- package/dist/components/grid/grid-solver.d.ts +30 -0
- package/dist/components/grid/grid-solver.d.ts.map +1 -0
- package/dist/components/grid/grid.d.ts +24 -0
- package/dist/components/grid/grid.d.ts.map +1 -0
- package/dist/components/grid/public.d.ts +5 -0
- package/dist/components/grid/public.d.ts.map +1 -0
- package/dist/data-grid/actions-menu.js +90 -90
- package/dist/data-grid/actions-menu.js.map +1 -1
- package/dist/data-grid/drag-drop.js +76 -67
- package/dist/data-grid/drag-drop.js.map +1 -1
- package/dist/data-grid/table-tree.js +1 -1
- package/dist/data-grid/table-tree.js.map +1 -1
- package/dist/docs/data-grid.md +3 -2
- package/dist/docs/grid.md +127 -0
- package/dist/frontx-ui-grid-css.mjs +82 -0
- package/dist/grid-config-check.mjs +78 -0
- package/dist/grid-css.mjs +32 -0
- package/dist/grid-default-config.json +16 -0
- package/dist/grid.d.ts +1 -0
- package/dist/grid.js +227 -0
- package/dist/grid.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -260
- package/dist/index.js.map +1 -1
- package/dist/switch.js +10 -10
- package/llms.txt +9 -0
- package/package.json +6 -3
- package/dist/chunks/switch.D3_ZyuVP.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._root_pa68e_9{container:fx-grid / inline-size;min-inline-size:0}._grid_pa68e_20{display:grid;min-inline-size:0}._item_pa68e_31{display:grid;grid-template-columns:minmax(0,1fr);min-inline-size:0;min-block-size:0;overflow:auto}@media print{._grid_pa68e_20{display:block}._item_pa68e_31{display:block;overflow:visible;margin-block-end:var(--space-4)}}:where([data-fx-grid=default])>:where([data-fx-grid-item]){grid-column:var(--_grid-col-base, auto);grid-row:var(--_grid-row-base, auto)}:where([data-fx-grid=default]){grid-template-columns:repeat(var(--_grid-columns, 12),minmax(0,1fr));grid-auto-rows:var(--grid-row-height, 10rem);gap:var(--grid-gap, var(--space-4))}@container fx-grid (min-width: 480px){:where([data-fx-grid=default])>:where([data-fx-grid-item]){grid-column:var(--_grid-col-sm, auto);grid-row:var(--_grid-row-sm, auto)}:where([data-fx-grid=default]){gap:var(--grid-gap, var(--space-4))}}@container fx-grid (min-width: 768px){:where([data-fx-grid=default])>:where([data-fx-grid-item]){grid-column:var(--_grid-col-md, auto);grid-row:var(--_grid-row-md, auto)}:where([data-fx-grid=default]){gap:var(--grid-gap, var(--space-6))}}@container fx-grid (min-width: 1200px){:where([data-fx-grid=default])>:where([data-fx-grid-item]){grid-column:var(--_grid-col-lg, auto);grid-row:var(--_grid-row-lg, auto)}:where([data-fx-grid=default]){gap:var(--grid-gap, var(--space-6))}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._switch_1l0he_6{box-sizing:border-box;position:relative;display:inline-flex;align-items:center;flex-shrink:0;padding:0;border:var(--border-width) solid transparent;border-radius:var(--radius-full);outline:none;transition:background-color .15s ease,border-color .15s ease,box-shadow .15s ease}._switch_1l0he_6:after{content:"";position:absolute;inset:calc(-1 * var(--space-2)) calc(-1 * var(--space-3))}._switch_1l0he_6[data-checked]{background-color:var(--primary)}._switch_1l0he_6[data-unchecked]{background-color:var(--input)}._switch_1l0he_6:focus-visible{outline:var(--border-width-focus) solid var(--ring);outline-offset:2px}@media(forced-colors:active){._switch_1l0he_6:focus-visible{outline:2px solid Highlight;outline-offset:2px}}._switch_1l0he_6[data-disabled]{cursor:not-allowed;opacity:var(--opacity-disabled)}._switch_1l0he_6[aria-invalid=true]{border-color:var(--destructive)}._sizeDefault_1l0he_10{height:1.375rem;width:2.375rem}._sizeSm_1l0he_10{height:.875rem;width:1.5rem}._thumb_1l0he_87{pointer-events:none;display:block;border-radius:var(--radius-full);background-color:var(--primary-foreground);transition:transform .15s ease}@media(prefers-reduced-motion:reduce){._thumb_1l0he_87{transition:none}}._sizeDefault_1l0he_10 ._thumb_1l0he_87{width:1rem;height:1rem;margin-inline-start:2px}._sizeDefault_1l0he_10 ._thumb_1l0he_87[data-checked]{transform:translate(100%)}._sizeDefault_1l0he_10 ._thumb_1l0he_87[data-checked]:dir(rtl){transform:translate(-100%)}._sizeSm_1l0he_10 ._thumb_1l0he_87{width:.75rem;height:.75rem}._thumb_1l0he_87[data-checked]{transform:translate(calc(100% - 2px))}._thumb_1l0he_87[data-checked]:dir(rtl){transform:translate(calc(2px - 100%))}._thumb_1l0he_87[data-unchecked]{transform:translate(0)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-service.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAShE,OAAO,KAAK,EAGV,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAIxB,wBAAgB,mBAAmB,CACjC,IAAI,SAAS,YAAY,GAAG,YAAY,KACrC,qBAAqB,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"export-service.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/data-grid/plugins/actions-menu/menu-items/export-menu-items/export-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAShE,OAAO,KAAK,EAGV,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAIxB,wBAAgB,mBAAmB,CACjC,IAAI,SAAS,YAAY,GAAG,YAAY,KACrC,qBAAqB,CAAC,IAAI,CAAC,CA0Q/B;AAUD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,EAC7C,SAAS,EAAE,MAAM,GAChB,MAAM,CAWR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-drop-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/plugins/drag-drop/drag-drop-plugin.tsx"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAI9F,OAAO,KAAK,EAEV,2BAA2B,EAG5B,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,SAAS,YAAY,GAAG,YAAY,EACpF,MAAM,EAAE,2BAA2B,CAAC,KAAK,CAAC,+DA8D3C;AAED,2CAA2C;AAC3C,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,YAAY,EAAE,EAC5D,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,gBAAgB,GACjB,EAAE;IACD,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAC9D,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,cAAc,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,gBAAgB,EAAE,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC;CAChD,
|
|
1
|
+
{"version":3,"file":"drag-drop-plugin.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-grid/plugins/drag-drop/drag-drop-plugin.tsx"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAI9F,OAAO,KAAK,EAEV,2BAA2B,EAG5B,MAAM,sBAAsB,CAAC;AAE9B;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,SAAS,YAAY,GAAG,YAAY,EACpF,MAAM,EAAE,2BAA2B,CAAC,KAAK,CAAC,+DA8D3C;AAED,2CAA2C;AAC3C,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,YAAY,EAAE,EAC5D,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,cAAc,EACd,gBAAgB,GACjB,EAAE;IACD,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;IACzD,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAC9D,MAAM,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,cAAc,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7D,gBAAgB,EAAE,CAAC,EAAE,EAAE,cAAc,KAAK,IAAI,CAAC;CAChD,QAwBA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type GridSizeClass = 'small' | 'medium' | 'large';
|
|
2
|
+
export type GridHeightClass = 'low' | 'high';
|
|
3
|
+
export interface GridSpanRange {
|
|
4
|
+
min: number;
|
|
5
|
+
preferred: number;
|
|
6
|
+
max: number;
|
|
7
|
+
}
|
|
8
|
+
export interface GridStep {
|
|
9
|
+
name: string;
|
|
10
|
+
minWidth: number;
|
|
11
|
+
gap: string;
|
|
12
|
+
}
|
|
13
|
+
export interface GridConfig {
|
|
14
|
+
name: string;
|
|
15
|
+
columns: number;
|
|
16
|
+
rowHeight: string;
|
|
17
|
+
steps: GridStep[];
|
|
18
|
+
sizes: Record<GridSizeClass, Record<string, GridSpanRange>>;
|
|
19
|
+
}
|
|
20
|
+
export declare const defaultGridConfig: GridConfig;
|
|
21
|
+
export { SIZE_CLASSES } from './grid-config-check.mjs';
|
|
22
|
+
/**
|
|
23
|
+
* Throws with a plain message when a config cannot drive the solver or the
|
|
24
|
+
* generated CSS. One validator with the CSS command (grid-config-check.mjs);
|
|
25
|
+
* the reserved `default` scope is admitted here because defaultGridConfig
|
|
26
|
+
* itself carries it, and Grid refuses it for any other config object.
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateGridConfig(config: GridConfig): void;
|
|
29
|
+
//# sourceMappingURL=grid-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-config.d.ts","sourceRoot":"","sources":["../../../src/components/grid/grid-config.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACzD,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,MAAM,CAAC;AAO7C,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AAOD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAUD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;CAC7D;AAcD,eAAO,MAAM,iBAAiB,EAAE,UAAuD,CAAC;AAIxF,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAE3D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"name": "default",
|
|
3
|
+
"columns": 12,
|
|
4
|
+
"rowHeight": "10rem",
|
|
5
|
+
"steps": [
|
|
6
|
+
{ "name": "base", "minWidth": 0, "gap": "--space-4" },
|
|
7
|
+
{ "name": "sm", "minWidth": 480, "gap": "--space-4" },
|
|
8
|
+
{ "name": "md", "minWidth": 768, "gap": "--space-6" },
|
|
9
|
+
{ "name": "lg", "minWidth": 1200, "gap": "--space-6" }
|
|
10
|
+
],
|
|
11
|
+
"sizes": {
|
|
12
|
+
"small": { "base": { "min": 6, "preferred": 6, "max": 6 }, "sm": { "min": 4, "preferred": 6, "max": 6 }, "md": { "min": 3, "preferred": 3, "max": 4 }, "lg": { "min": 2, "preferred": 3, "max": 4 } },
|
|
13
|
+
"medium": { "base": { "min": 12, "preferred": 12, "max": 12 }, "sm": { "min": 6, "preferred": 6, "max": 12 }, "md": { "min": 4, "preferred": 6, "max": 8 }, "lg": { "min": 4, "preferred": 6, "max": 8 } },
|
|
14
|
+
"large": { "base": { "min": 12, "preferred": 12, "max": 12 }, "sm": { "min": 12, "preferred": 12, "max": 12 }, "md": { "min": 8, "preferred": 12, "max": 12 }, "lg": { "min": 7, "preferred": 12, "max": 12 } }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
;
|
|
18
|
+
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GridConfig, GridHeightClass, GridSizeClass } from './grid-config.js';
|
|
2
|
+
export interface GridItemSpec {
|
|
3
|
+
layoutId: string;
|
|
4
|
+
size: GridSizeClass;
|
|
5
|
+
height?: GridHeightClass;
|
|
6
|
+
}
|
|
7
|
+
export interface GridPlacement {
|
|
8
|
+
colStart: number;
|
|
9
|
+
colSpan: number;
|
|
10
|
+
rowStart: number;
|
|
11
|
+
rowSpan: number;
|
|
12
|
+
}
|
|
13
|
+
export interface GridStepLayout {
|
|
14
|
+
placements: Record<string, GridPlacement>;
|
|
15
|
+
rows: number;
|
|
16
|
+
holes: number;
|
|
17
|
+
}
|
|
18
|
+
export interface GridLayout {
|
|
19
|
+
steps: Record<string, GridStepLayout>;
|
|
20
|
+
}
|
|
21
|
+
export interface GridSolveOptions {
|
|
22
|
+
flexible?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Places ordered items for every step of a config. Pure: no DOM, no
|
|
26
|
+
* measurement, the same input always gives the same output. Throws on an
|
|
27
|
+
* invalid config, a duplicate `layoutId` or an unknown size or height.
|
|
28
|
+
*/
|
|
29
|
+
export declare function solveGridLayout(items: GridItemSpec[], config?: GridConfig, { flexible }?: GridSolveOptions): GridLayout;
|
|
30
|
+
//# sourceMappingURL=grid-solver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid-solver.d.ts","sourceRoot":"","sources":["../../../src/components/grid/grid-solver.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,aAAa,EAEnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACvC;AAQD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAoND;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EAAE,EACrB,MAAM,GAAE,UAA8B,EACtC,EAAE,QAAgB,EAAE,GAAE,gBAAqB,GAC1C,UAAU,CAMZ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { GridConfig, GridHeightClass, GridSizeClass } from './grid-config.js';
|
|
3
|
+
export interface GridItemProps extends ComponentProps<'div'> {
|
|
4
|
+
/** Placement identity, unique within one Grid. Separate from the HTML id. */
|
|
5
|
+
layoutId: string;
|
|
6
|
+
/** The span range the item takes at every step: small, medium or large. */
|
|
7
|
+
size: GridSizeClass;
|
|
8
|
+
/** `low` is one row track, `high` is two tracks and the row gap between them. @default 'low' */
|
|
9
|
+
height?: GridHeightClass;
|
|
10
|
+
}
|
|
11
|
+
export declare function GridItem({ layoutId: _layoutId, size: _size, height: _height, className, ...props }: GridItemProps): import("react").JSX.Element;
|
|
12
|
+
export interface GridProps extends ComponentProps<'div'> {
|
|
13
|
+
/**
|
|
14
|
+
* The config the step CSS is generated from; a custom config needs the
|
|
15
|
+
* stylesheet the `frontx-ui-grid-css` command writes for it.
|
|
16
|
+
* @default defaultGridConfig
|
|
17
|
+
*/
|
|
18
|
+
config?: GridConfig;
|
|
19
|
+
/** Lets spans move inside each size class's range to fill rows. Off: preferred spans only. @default false */
|
|
20
|
+
flexible?: boolean;
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare function Grid({ config, flexible, children, className, ...props }: GridProps): import("react").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/components/grid/grid.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,cAAc,EAGnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGhH,OAAO,kBAAkB,CAAC;AAY1B,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,KAAK,CAAC;IAC1D,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,IAAI,EAAE,aAAa,CAAC;IACpB,gGAAgG;IAChG,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAe,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,+BAEzH;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,KAAK,CAAC;IACtD;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAoBD,wBAAgB,IAAI,CAAC,EAAE,MAA0B,EAAE,QAAgB,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,+BAyC9G"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Grid, GridItem } from './grid.js';
|
|
2
|
+
export type { GridProps, GridItemProps } from './grid.js';
|
|
3
|
+
export { defaultGridConfig } from './grid-config.js';
|
|
4
|
+
export type { GridConfig, GridStep, GridSpanRange, GridSizeClass, GridHeightClass } from './grid-config.js';
|
|
5
|
+
//# sourceMappingURL=public.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/components/grid/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { create as
|
|
3
|
-
import { u as
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import { EllipsisIcon as
|
|
6
|
-
import { m as
|
|
7
|
-
import { u as
|
|
8
|
-
import { DropdownMenu as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { useState as
|
|
11
|
-
import { a as
|
|
12
|
-
import { u as
|
|
13
|
-
import { i as
|
|
14
|
-
function
|
|
15
|
-
const a =
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */
|
|
18
|
-
|
|
2
|
+
import { create as A } from "zustand";
|
|
3
|
+
import { u as B, c as N, a as $ } from "../chunks/plugins-helpers.js";
|
|
4
|
+
import { jsxs as P, jsx as y } from "react/jsx-runtime";
|
|
5
|
+
import { EllipsisIcon as F, ArrowDownToLineIcon as G } from "lucide-react";
|
|
6
|
+
import { m as b } from "../chunks/messages.js";
|
|
7
|
+
import { u as J } from "../chunks/data-grid-portal-container-context.js";
|
|
8
|
+
import { DropdownMenu as O, DropdownMenuTrigger as W, DropdownMenuContent as H, DropdownMenuItem as U } from "../dropdown-menu.js";
|
|
9
|
+
import { Button as z } from "../button.js";
|
|
10
|
+
import { useState as Q } from "react";
|
|
11
|
+
import { a as Z } from "../chunks/table-helpers.js";
|
|
12
|
+
import { u as q } from "../chunks/table-context.js";
|
|
13
|
+
import { i as K } from "../chunks/is-record.js";
|
|
14
|
+
function X() {
|
|
15
|
+
const a = B().getPlugin("actionsMenu").useMenuItems(), i = J();
|
|
16
|
+
return /* @__PURE__ */ P(O, { children: [
|
|
17
|
+
/* @__PURE__ */ y(
|
|
18
|
+
W,
|
|
19
19
|
{
|
|
20
|
-
render: /* @__PURE__ */
|
|
21
|
-
|
|
20
|
+
render: /* @__PURE__ */ y(
|
|
21
|
+
z,
|
|
22
22
|
{
|
|
23
23
|
variant: "ghost",
|
|
24
24
|
size: "sm",
|
|
25
|
-
icon: /* @__PURE__ */
|
|
26
|
-
"aria-label":
|
|
25
|
+
icon: /* @__PURE__ */ y(F, {}),
|
|
26
|
+
"aria-label": b.actionsMenu.actions
|
|
27
27
|
}
|
|
28
28
|
)
|
|
29
29
|
}
|
|
30
30
|
),
|
|
31
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ y(H, { side: "bottom", align: "end", container: i, children: a.map((u) => /* @__PURE__ */ y(u.component, { params: u.params }, u.id)) })
|
|
32
32
|
] });
|
|
33
33
|
}
|
|
34
|
-
const
|
|
35
|
-
const o =
|
|
34
|
+
const ye = N("actionsMenu", (e) => {
|
|
35
|
+
const o = A(() => ({
|
|
36
36
|
menuItems: []
|
|
37
37
|
}));
|
|
38
38
|
return e.registerSlot("top-end", {
|
|
39
39
|
id: "actionsMenu",
|
|
40
|
-
component:
|
|
40
|
+
component: X,
|
|
41
41
|
order: 100
|
|
42
42
|
}), {
|
|
43
43
|
registerMenuItem: u,
|
|
@@ -56,12 +56,12 @@ const xe = j("actionsMenu", (e) => {
|
|
|
56
56
|
g.sort((t, n) => t.order - n.order), o.setState({ menuItems: g });
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
function
|
|
59
|
+
function k(e, o) {
|
|
60
60
|
const a = o.key ? e[o.key] : e[o.id];
|
|
61
61
|
let i;
|
|
62
62
|
return o.formatter ? i = o.formatter(a) : i = String(a ?? ""), { raw: a, formatted: i };
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function T({
|
|
65
65
|
item: e,
|
|
66
66
|
column: o,
|
|
67
67
|
cellValue: a,
|
|
@@ -78,45 +78,45 @@ function C({
|
|
|
78
78
|
u
|
|
79
79
|
) : a.formatted;
|
|
80
80
|
}
|
|
81
|
-
const
|
|
81
|
+
const Y = (e) => {
|
|
82
82
|
const { data: o, columns: a, options: i, gridContext: u } = e, f = i.delimiter || ",", p = i.includeHeaders ?? !0, g = [];
|
|
83
83
|
if (p) {
|
|
84
|
-
const t = a.map((n) =>
|
|
84
|
+
const t = a.map((n) => D(n.label, f)).join(f);
|
|
85
85
|
g.push(t);
|
|
86
86
|
}
|
|
87
87
|
for (const t of o) {
|
|
88
88
|
const n = [];
|
|
89
89
|
for (const s of a) {
|
|
90
|
-
const c =
|
|
90
|
+
const c = k(t, s), l = T({
|
|
91
91
|
item: t,
|
|
92
92
|
column: s,
|
|
93
93
|
cellValue: c,
|
|
94
94
|
transformCellText: i.transformCellText,
|
|
95
95
|
gridContext: u
|
|
96
96
|
});
|
|
97
|
-
n.push(
|
|
97
|
+
n.push(D(l, f));
|
|
98
98
|
}
|
|
99
99
|
g.push(n.join(f));
|
|
100
100
|
}
|
|
101
101
|
return Promise.resolve(g.join(`
|
|
102
102
|
`));
|
|
103
|
-
},
|
|
104
|
-
function
|
|
103
|
+
}, E = /^[=+\-@\t\r]/;
|
|
104
|
+
function D(e, o) {
|
|
105
105
|
const a = String(e ?? "");
|
|
106
106
|
if (a.includes(o) || a.includes(`
|
|
107
|
-
`) || a.includes('"') ||
|
|
107
|
+
`) || a.includes('"') || E.test(a)) {
|
|
108
108
|
const u = a.replace(/"/g, '""');
|
|
109
|
-
return `"${
|
|
109
|
+
return `"${E.test(a) ? " " : ""}${u}"`;
|
|
110
110
|
}
|
|
111
111
|
return a;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const _ = async (e) => {
|
|
114
114
|
const { data: o, columns: a, options: i, gridContext: u } = e;
|
|
115
115
|
if (!i.loadExcelJs)
|
|
116
116
|
throw new Error(
|
|
117
117
|
"Exporting to Excel needs `loadExcelJs`, a function that loads the exceljs package: the grid does not import it itself."
|
|
118
118
|
);
|
|
119
|
-
const f =
|
|
119
|
+
const f = ee(await i.loadExcelJs()), p = new f.Workbook(), g = p.addWorksheet(i.sheetName), t = i.includeHeaders ?? !0;
|
|
120
120
|
let n = 1;
|
|
121
121
|
if (t) {
|
|
122
122
|
const c = g.getRow(n);
|
|
@@ -128,14 +128,14 @@ const K = async (e) => {
|
|
|
128
128
|
for (const c of o) {
|
|
129
129
|
const l = g.getRow(n);
|
|
130
130
|
for (const [r, d] of a.entries()) {
|
|
131
|
-
const m =
|
|
131
|
+
const m = k(c, d), h = T({
|
|
132
132
|
item: c,
|
|
133
133
|
column: d,
|
|
134
134
|
cellValue: m,
|
|
135
135
|
transformCellText: i.transformCellText,
|
|
136
136
|
gridContext: u
|
|
137
|
-
}),
|
|
138
|
-
|
|
137
|
+
}), x = l.getCell(r + 1);
|
|
138
|
+
x.value = te(m.raw, h);
|
|
139
139
|
}
|
|
140
140
|
n++;
|
|
141
141
|
}
|
|
@@ -144,16 +144,16 @@ const K = async (e) => {
|
|
|
144
144
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
145
145
|
});
|
|
146
146
|
};
|
|
147
|
-
function
|
|
147
|
+
function V(e) {
|
|
148
148
|
return "default" in e && !!e.default;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
const o =
|
|
150
|
+
function ee(e) {
|
|
151
|
+
const o = V(e) ? e.default : e;
|
|
152
152
|
if (typeof o.Workbook != "function")
|
|
153
153
|
throw new Error("`loadExcelJs` has to resolve to the exceljs package, which exports `Workbook`.");
|
|
154
154
|
return o;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function te(e, o) {
|
|
157
157
|
if (o !== String(e ?? ""))
|
|
158
158
|
return o;
|
|
159
159
|
if (e == null)
|
|
@@ -172,7 +172,7 @@ function _(e, o) {
|
|
|
172
172
|
}
|
|
173
173
|
return String(e);
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function oe() {
|
|
176
176
|
return {
|
|
177
177
|
exportToCSV: e,
|
|
178
178
|
exportToExcel: o,
|
|
@@ -182,16 +182,16 @@ function V() {
|
|
|
182
182
|
async function e(t, n, s, c) {
|
|
183
183
|
const l = { ...s, format: "csv" };
|
|
184
184
|
try {
|
|
185
|
-
const r = await
|
|
185
|
+
const r = await Y({
|
|
186
186
|
data: t,
|
|
187
187
|
columns: n,
|
|
188
188
|
options: l,
|
|
189
189
|
gridContext: c
|
|
190
|
-
}), d =
|
|
190
|
+
}), d = R(s.filename, "csv");
|
|
191
191
|
a(r, d, "text/csv");
|
|
192
192
|
} catch (r) {
|
|
193
193
|
if (s.onError)
|
|
194
|
-
s.onError(
|
|
194
|
+
s.onError(M(r));
|
|
195
195
|
else
|
|
196
196
|
throw r;
|
|
197
197
|
}
|
|
@@ -199,12 +199,12 @@ function V() {
|
|
|
199
199
|
async function o(t, n, s, c) {
|
|
200
200
|
const l = { ...s, format: "xlsx" };
|
|
201
201
|
try {
|
|
202
|
-
const r = await
|
|
202
|
+
const r = await _({
|
|
203
203
|
data: t,
|
|
204
204
|
columns: n,
|
|
205
205
|
options: l,
|
|
206
206
|
gridContext: c
|
|
207
|
-
}), d =
|
|
207
|
+
}), d = R(s.filename, "xlsx");
|
|
208
208
|
a(
|
|
209
209
|
r,
|
|
210
210
|
d,
|
|
@@ -212,7 +212,7 @@ function V() {
|
|
|
212
212
|
);
|
|
213
213
|
} catch (r) {
|
|
214
214
|
if (s.onError)
|
|
215
|
-
s.onError(
|
|
215
|
+
s.onError(M(r));
|
|
216
216
|
else
|
|
217
217
|
throw r;
|
|
218
218
|
}
|
|
@@ -231,7 +231,7 @@ function V() {
|
|
|
231
231
|
}
|
|
232
232
|
async function f(t, n, s) {
|
|
233
233
|
const c = { page: s.getPage(), limit: s.getLimit() }, l = [], r = /* @__PURE__ */ new Set();
|
|
234
|
-
let d = 1, m = !0;
|
|
234
|
+
let d = 1, m = !0, h = /* @__PURE__ */ new Set();
|
|
235
235
|
for (; m; ) {
|
|
236
236
|
const x = t.triggerLoad({
|
|
237
237
|
loadContext: {
|
|
@@ -241,23 +241,23 @@ function V() {
|
|
|
241
241
|
store: !1
|
|
242
242
|
});
|
|
243
243
|
if (await x.promise, x.processResult) {
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
244
|
+
const v = x.processResult.results;
|
|
245
|
+
if (v.length === 0)
|
|
246
246
|
m = !1;
|
|
247
247
|
else {
|
|
248
|
-
const
|
|
249
|
-
id: t.getItemId(
|
|
250
|
-
item:
|
|
251
|
-
index:
|
|
252
|
-
section:
|
|
253
|
-
}));
|
|
254
|
-
await p(
|
|
248
|
+
const I = v.map((w, j) => ({
|
|
249
|
+
id: t.getItemId(w),
|
|
250
|
+
item: w,
|
|
251
|
+
index: j,
|
|
252
|
+
section: ne()
|
|
253
|
+
})), S = new Set(I.map((w) => w.id)), L = S.size === h.size && [...S].every((w) => h.has(w));
|
|
254
|
+
h = S, await p(
|
|
255
255
|
t,
|
|
256
|
-
|
|
256
|
+
I,
|
|
257
257
|
l,
|
|
258
258
|
r,
|
|
259
259
|
n
|
|
260
|
-
), d++,
|
|
260
|
+
), d++, (L || v.length < c.limit) && (m = !1);
|
|
261
261
|
}
|
|
262
262
|
} else
|
|
263
263
|
m = !1;
|
|
@@ -272,10 +272,10 @@ function V() {
|
|
|
272
272
|
t.getSectionsByParentId(r.id).length || await t.triggerLoad({
|
|
273
273
|
loadContext: { tree: { parentId: r.id } }
|
|
274
274
|
}).promise;
|
|
275
|
-
const
|
|
276
|
-
|
|
275
|
+
const h = t.getRecordsByParentId(r.id);
|
|
276
|
+
h.length > 0 && await p(
|
|
277
277
|
t,
|
|
278
|
-
|
|
278
|
+
h,
|
|
279
279
|
s,
|
|
280
280
|
c,
|
|
281
281
|
l
|
|
@@ -302,48 +302,48 @@ function V() {
|
|
|
302
302
|
return c;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function ne() {
|
|
306
306
|
return { id: "", visible: !0, loadContext: {}, parentId: null, records: [] };
|
|
307
307
|
}
|
|
308
|
-
function
|
|
308
|
+
function M(e) {
|
|
309
309
|
return e instanceof Error ? e : new Error(String(e));
|
|
310
310
|
}
|
|
311
|
-
function
|
|
311
|
+
function R(e, o) {
|
|
312
312
|
return typeof e == "function" ? e() : typeof e == "string" ? e.endsWith(`.${o}`) ? e : `${e}.${o}` : `${(/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/:/g, "-")}.${o}`;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function re(e) {
|
|
315
315
|
return e === "csv" || e === "xlsx";
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
return
|
|
317
|
+
function se(e) {
|
|
318
|
+
return K(e);
|
|
319
319
|
}
|
|
320
|
-
function
|
|
321
|
-
if (!(!e || !
|
|
320
|
+
function ae(e) {
|
|
321
|
+
if (!(!e || !re(e.type)))
|
|
322
322
|
return {
|
|
323
323
|
type: e.type,
|
|
324
|
-
exportConfig:
|
|
324
|
+
exportConfig: se(e.exportConfig) ? e.exportConfig : void 0
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
|
-
function
|
|
328
|
-
const o =
|
|
327
|
+
function C({ params: e }) {
|
|
328
|
+
const o = ae(e), a = $(), i = q(), [u, f] = Q(!1), p = i.useVisibleColumns(), g = (o == null ? void 0 : o.type) === "csv" ? "CSV" : "Excel";
|
|
329
329
|
async function t() {
|
|
330
330
|
if (!(u || !o)) {
|
|
331
331
|
f(!0);
|
|
332
332
|
try {
|
|
333
|
-
const n =
|
|
334
|
-
const
|
|
333
|
+
const n = oe(), s = await n.getAllData(a), c = p.map((m) => {
|
|
334
|
+
const h = Z(m.label);
|
|
335
335
|
return {
|
|
336
336
|
id: m.id,
|
|
337
|
-
label:
|
|
337
|
+
label: h,
|
|
338
338
|
key: m.key,
|
|
339
339
|
formatter: m.formatter
|
|
340
340
|
};
|
|
341
341
|
}), r = {
|
|
342
342
|
...{
|
|
343
343
|
format: o.type,
|
|
344
|
-
filename:
|
|
344
|
+
filename: b.exportMenuItem.defaultFilename,
|
|
345
345
|
includeHeaders: !0,
|
|
346
|
-
...o.type === "xlsx" ? { sheetName:
|
|
346
|
+
...o.type === "xlsx" ? { sheetName: b.exportMenuItem.defaultSheetName } : {}
|
|
347
347
|
},
|
|
348
348
|
...o.exportConfig
|
|
349
349
|
};
|
|
@@ -355,20 +355,20 @@ function D({ params: e }) {
|
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
|
-
return /* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
|
|
358
|
+
return /* @__PURE__ */ P(U, { disabled: u, onClick: t, children: [
|
|
359
|
+
/* @__PURE__ */ y(G, {}),
|
|
360
|
+
b.exportMenuItem.exportAs(g)
|
|
361
361
|
] });
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function be(e) {
|
|
364
364
|
const o = {
|
|
365
|
-
component:
|
|
365
|
+
component: C,
|
|
366
366
|
params: { type: "csv", exportConfig: e }
|
|
367
367
|
};
|
|
368
|
-
return e != null && e.loadExcelJs ? [{ component:
|
|
368
|
+
return e != null && e.loadExcelJs ? [{ component: C, params: { type: "xlsx", exportConfig: e } }, o] : [o];
|
|
369
369
|
}
|
|
370
370
|
export {
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
ye as DataGridActionsMenuPlugin,
|
|
372
|
+
be as exportMenuItems
|
|
373
373
|
};
|
|
374
374
|
//# sourceMappingURL=actions-menu.js.map
|