@toolbox-web/grid-react 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/chunks/grid-detail-panel-CR7YUhdN.js +52 -0
- package/chunks/grid-responsive-card-BB28Zl2O.js +45 -0
- package/chunks/portal-bridge-DLA6Zs11.js +51 -0
- package/chunks/react-column-config-Sb-U7Bq3.js +109 -0
- package/chunks/react-grid-adapter-CzByOnua.js +416 -0
- package/features/editing.js +5 -0
- package/features/filtering.d.ts.map +1 -1
- package/features/filtering.js +55 -45
- package/features/grouping-columns.js +18 -23
- package/features/grouping-rows.js +11 -16
- package/features/index.js +3 -3
- package/features/master-detail.js +18 -0
- package/features/pinned-rows.d.ts.map +1 -1
- package/features/pinned-rows.js +24 -17
- package/features/responsive.js +18 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/index.js +438 -895
- package/lib/column-shorthand.d.ts +22 -1
- package/lib/column-shorthand.d.ts.map +1 -1
- package/lib/data-grid.d.ts.map +1 -1
- package/lib/editor-mount-hooks.d.ts +39 -0
- package/lib/editor-mount-hooks.d.ts.map +1 -0
- package/lib/event-props.d.ts +132 -6
- package/lib/event-props.d.ts.map +1 -1
- package/lib/feature-props.d.ts +17 -2
- package/lib/feature-props.d.ts.map +1 -1
- package/lib/portal-bridge.d.ts +11 -0
- package/lib/portal-bridge.d.ts.map +1 -1
- package/lib/portal-manager.d.ts.map +1 -1
- package/lib/react-column-config.d.ts +36 -5
- package/lib/react-column-config.d.ts.map +1 -1
- package/lib/react-grid-adapter.d.ts +111 -14
- package/lib/react-grid-adapter.d.ts.map +1 -1
- package/lib/use-grid-overlay.d.ts +74 -0
- package/lib/use-grid-overlay.d.ts.map +1 -0
- package/package.json +1 -1
- package/chunks/portal-bridge-DZ4yQkmm.js +0 -42
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,IAAI,cAAc,EAE5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"react-grid-adapter.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/react-grid-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,IAAI,cAAc,EAE5B,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAuB,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE1G,OAAO,KAAK,EAAmC,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAM7F,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,CAAC;AAIzD;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;CAC3E;AAED;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,IAAI,GAAG,OAAO,EAC7C,MAAM,EAAE,WAAW,EACnB,GAAG,EAAE,oBAAoB,KACtB,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC,GAAG,SAAS,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACzC,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,GAAG,EAAE,oBA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,EAAE,MAAM,KAAK,WAAW,CAAC,GAAG,SAAS;IAI7D;;;;;;;OAOG;IACH,0BAA0B,CAAC,IAAI,GAAG,OAAO,EACvC,WAAW,EAAE,OAAO,GACnB,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC,GAAG,SAAS;IAO7D;;;OAGG;IACH,uBAAuB,CAAC,OAAO,EAAE,WAAW,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,SAAS;IA0B5G;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,cAAc,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS;IA2CjG;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAE5B;IAEF,oDAAoD;IACpD,OAAO,CAAC,WAAW;IASnB,sDAAsD;IACtD,OAAO,CAAC,aAAa;IAerB;;;OAGG;IACH,OAAO,IAAI,IAAI;IAaf;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAiBtC;;OAEG;IACH,OAAO,CAAC,SAAS,EAAE,WAAW,GAAG,IAAI;CAOtC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DataGridElement } from '@toolbox-web/grid';
|
|
2
|
+
import { RefObject } from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link useGridOverlay}.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface UseGridOverlayOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the overlay is currently open.
|
|
11
|
+
*
|
|
12
|
+
* Set to `false` to unregister the panel without unmounting it (e.g. when
|
|
13
|
+
* the consumer toggles visibility via CSS rather than conditional render).
|
|
14
|
+
* Defaults to `true`.
|
|
15
|
+
*/
|
|
16
|
+
open?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional explicit grid element. When omitted, the hook resolves the
|
|
19
|
+
* grid by:
|
|
20
|
+
*
|
|
21
|
+
* 1. Walking up the DOM from `panelRef.current` via `closest('tbw-grid')`
|
|
22
|
+
* (works for inline overlays).
|
|
23
|
+
* 2. Falling back to the {@link GridElementContext} populated by
|
|
24
|
+
* `<DataGrid>` / `<GridProvider>` (works for portal-rendered overlays
|
|
25
|
+
* whose DOM is detached from the grid subtree).
|
|
26
|
+
*/
|
|
27
|
+
gridElement?: DataGridElement | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Register a custom overlay panel (popover, listbox, calendar, color
|
|
31
|
+
* picker) as part of the active editor so the grid does not commit and
|
|
32
|
+
* exit row edit when focus or pointer interaction enters the panel.
|
|
33
|
+
*
|
|
34
|
+
* Mirrors the Angular `BaseOverlayEditor` contract for React custom
|
|
35
|
+
* editors. Wires `registerExternalFocusContainer(panel)` on mount/open
|
|
36
|
+
* and `unregisterExternalFocusContainer(panel)` on unmount/close.
|
|
37
|
+
*
|
|
38
|
+
* Pair with `ColumnEditorContext.grid` (see {@link DataGridElement}) when
|
|
39
|
+
* the panel is rendered outside any `<DataGrid>` provider.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* function AutocompleteEditor({ value, commit, cancel }: GridEditorContext<Row>) {
|
|
44
|
+
* const [open, setOpen] = useState(false);
|
|
45
|
+
* const panelRef = useRef<HTMLDivElement | null>(null);
|
|
46
|
+
* useGridOverlay(panelRef, { open });
|
|
47
|
+
* return (
|
|
48
|
+
* <>
|
|
49
|
+
* <input
|
|
50
|
+
* aria-expanded={open}
|
|
51
|
+
* aria-controls="ac-listbox"
|
|
52
|
+
* onClick={() => setOpen(true)}
|
|
53
|
+
* onKeyDown={(e) => e.key === 'Enter' && commit(e.currentTarget.value)}
|
|
54
|
+
* />
|
|
55
|
+
* {open &&
|
|
56
|
+
* createPortal(
|
|
57
|
+
* <div id="ac-listbox" ref={panelRef} role="listbox">
|
|
58
|
+
* {options}
|
|
59
|
+
* </div>,
|
|
60
|
+
* document.body,
|
|
61
|
+
* )}
|
|
62
|
+
* </>
|
|
63
|
+
* );
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param panelRef - Ref to the overlay panel DOM element. The hook is a
|
|
68
|
+
* no-op while `panelRef.current` is `null`.
|
|
69
|
+
* @param options - {@link UseGridOverlayOptions}.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export declare function useGridOverlay(panelRef: RefObject<HTMLElement | null>, options?: UseGridOverlayOptions): void;
|
|
74
|
+
//# sourceMappingURL=use-grid-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-grid-overlay.d.ts","sourceRoot":"","sources":["../../../../libs/grid-react/src/lib/use-grid-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI,CAiBjH"}
|
package/package.json
CHANGED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { flushSync as d } from "react-dom";
|
|
2
|
-
import { createRoot as p } from "react-dom/client";
|
|
3
|
-
const r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
4
|
-
let m = 0;
|
|
5
|
-
function w(t, e) {
|
|
6
|
-
e ? r.set(t, e) : r.delete(t);
|
|
7
|
-
}
|
|
8
|
-
function g(t, e) {
|
|
9
|
-
if (e) return e;
|
|
10
|
-
const o = t.closest("tbw-grid");
|
|
11
|
-
if (o) return o;
|
|
12
|
-
if (r.size === 1) return r.keys().next().value;
|
|
13
|
-
}
|
|
14
|
-
function u(t) {
|
|
15
|
-
const e = c.get(t);
|
|
16
|
-
if (e) {
|
|
17
|
-
try {
|
|
18
|
-
e.unmount();
|
|
19
|
-
} catch {
|
|
20
|
-
}
|
|
21
|
-
c.delete(t);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function b(t, e, o, l) {
|
|
25
|
-
const n = o ?? `p-${m++}`, s = g(t, l), f = s ? r.get(s) : void 0;
|
|
26
|
-
if (f)
|
|
27
|
-
u(n), s && i.set(n, s), f.renderPortal(n, t, e);
|
|
28
|
-
else {
|
|
29
|
-
let a = c.get(n);
|
|
30
|
-
a || (a = p(t), c.set(n, a)), d(() => a.render(e));
|
|
31
|
-
}
|
|
32
|
-
return n;
|
|
33
|
-
}
|
|
34
|
-
function x(t, e) {
|
|
35
|
-
const o = i.get(t);
|
|
36
|
-
(o ? r.get(o) : void 0)?.removePortal(t, e?.sync), i.delete(t), u(t);
|
|
37
|
-
}
|
|
38
|
-
export {
|
|
39
|
-
b as a,
|
|
40
|
-
x as r,
|
|
41
|
-
w as s
|
|
42
|
-
};
|