@genesislcap/foundation-react-utils 15.46.2-FUI-2628.2 → 15.46.2-FUI-2625.2

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 CHANGED
@@ -47,47 +47,6 @@ resolving a second copy of the library, which breaks the `instanceof` checks `fl
47
47
  relies on internally; the entry point logs a warning when the version it loads differs from the one
48
48
  the theme was generated against.
49
49
 
50
- ## foundation-workspace
51
-
52
- Workspaces (save/load of layouts, grid column state and filters) work in React through the element
53
- wrappers `@genesislcap/foundation-workspace/react` already ships, plus one hook for filter state:
54
-
55
- ```tsx
56
- import { registerFactory } from '@genesislcap/foundation-layout';
57
- import { reactFactory } from '@genesislcap/foundation-react-utils';
58
- import { useWorkspaceFilter } from '@genesislcap/foundation-react-utils/workspace';
59
- import { GridRegister, LayoutWrapper, WorkspaceManager } from '@genesislcap/foundation-workspace/react';
60
-
61
- const PositionsPanel = () => {
62
- const [search, setSearch] = useState('');
63
- useWorkspaceFilter('positions-search', search, setSearch);
64
- return (
65
- <GridRegister gridKey="positions">
66
- <RapidGridPro persistColumnStateKey="positions">…</RapidGridPro>
67
- </GridRegister>
68
- );
69
- };
70
-
71
- registerFactory('positions', reactFactory(PositionsPanel));
72
-
73
- <LayoutWrapper layoutKey="my-layout">
74
- <rapid-layout auto-save-key="my-layout">
75
- <rapid-layout-region>
76
- <rapid-layout-item registration="positions" title="Positions" />
77
- </rapid-layout-region>
78
- </rapid-layout>
79
- </LayoutWrapper>
80
-
81
- <WorkspaceManager />
82
- ```
83
-
84
- - Register `workspaceComponents` from `@genesislcap/foundation-workspace` with your design system.
85
- - Render layout panes through `registerFactory` + `reactFactory`, not as JSX children of
86
- `rapid-layout-item`. Loading a saved layout rebuilds the panes, and cloned DOM loses React-set
87
- properties such as `gridOptions`.
88
- - `useWorkspaceFilter` also applies the current workspace's saved value on mount, so a filter
89
- inside a pane that is recreated by a layout load still picks up its saved value.
90
-
91
50
  ## License
92
51
 
93
52
  Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.
@@ -531,70 +531,6 @@
531
531
  }
532
532
  }
533
533
  ]
534
- },
535
- {
536
- "kind": "javascript-module",
537
- "path": "src/workspace/index.ts",
538
- "declarations": [],
539
- "exports": [
540
- {
541
- "kind": "js",
542
- "name": "useWorkspaceFilter",
543
- "declaration": {
544
- "name": "useWorkspaceFilter",
545
- "module": "./use-workspace-filter"
546
- }
547
- }
548
- ]
549
- },
550
- {
551
- "kind": "javascript-module",
552
- "path": "src/workspace/use-workspace-filter.ts",
553
- "declarations": [
554
- {
555
- "kind": "function",
556
- "name": "useWorkspaceFilter",
557
- "return": {
558
- "type": {
559
- "text": "void"
560
- }
561
- },
562
- "parameters": [
563
- {
564
- "name": "filterKey",
565
- "type": {
566
- "text": "string"
567
- },
568
- "description": "Unique key the value is saved under. An empty key skips registration."
569
- },
570
- {
571
- "name": "value",
572
- "type": {
573
- "text": "string"
574
- },
575
- "description": "Current filter value."
576
- },
577
- {
578
- "name": "setValue",
579
- "type": {
580
- "text": "(value: string) => void"
581
- },
582
- "description": "Called with the saved value when a workspace is loaded."
583
- }
584
- ],
585
- "description": "Registers a piece of React filter state with the foundation-workspace `FilterRegistry`, so\n`<workspace-manager>` saves it with the workspace and restores it on load."
586
- }
587
- ],
588
- "exports": [
589
- {
590
- "kind": "js",
591
- "name": "useWorkspaceFilter",
592
- "declaration": {
593
- "name": "useWorkspaceFilter",
594
- "module": "src/workspace/use-workspace-filter.ts"
595
- }
596
- }
597
- ]
598
534
  }
599
535
  ]
600
536
  }
@@ -18,7 +18,6 @@
18
18
  * Rapid Design System theme for it installed on import. Import from there rather than adding
19
19
  * `flexlayout-react` to an app's own dependencies.
20
20
  * - `./router` — route table helpers (`renderAppRoutes` and friends).
21
- * - `./workspace` — foundation-workspace helpers (`useWorkspaceFilter`).
22
21
  */
23
22
  export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
24
23
  export { createReactRenderer } from './create-react-renderer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,YAAY,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,YAAY,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,YAAY,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC"}
package/dist/esm/index.js CHANGED
@@ -18,7 +18,6 @@
18
18
  * Rapid Design System theme for it installed on import. Import from there rather than adding
19
19
  * `flexlayout-react` to an app's own dependencies.
20
20
  * - `./router` — route table helpers (`renderAppRoutes` and friends).
21
- * - `./workspace` — foundation-workspace helpers (`useWorkspaceFilter`).
22
21
  */
23
22
  export { reactFactory, reactFactoryWithProvider } from './react-layout-factory';
24
23
  export { createReactRenderer } from './create-react-renderer';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-react-utils",
3
3
  "description": "Genesis Foundation React Utils",
4
- "version": "15.46.2-FUI-2628.2",
4
+ "version": "15.46.2-FUI-2625.2",
5
5
  "sideEffects": [
6
6
  "./dist/esm/flexlayout/index.js"
7
7
  ],
@@ -21,10 +21,6 @@
21
21
  "types": "./dist/dts/flexlayout/index.d.ts",
22
22
  "default": "./dist/esm/flexlayout/index.js"
23
23
  },
24
- "./workspace": {
25
- "types": "./dist/dts/workspace/index.d.ts",
26
- "default": "./dist/esm/workspace/index.js"
27
- },
28
24
  "./package.json": "./package.json"
29
25
  },
30
26
  "typesVersions": {
@@ -34,9 +30,6 @@
34
30
  ],
35
31
  "flexlayout": [
36
32
  "./dist/dts/flexlayout/index.d.ts"
37
- ],
38
- "workspace": [
39
- "./dist/dts/workspace/index.d.ts"
40
33
  ]
41
34
  }
42
35
  },
@@ -63,12 +56,12 @@
63
56
  }
64
57
  },
65
58
  "devDependencies": {
66
- "@genesislcap/foundation-testing": "15.46.2-FUI-2628.2",
67
- "@genesislcap/genx": "15.46.2-FUI-2628.2",
68
- "@genesislcap/ts-builder": "15.46.2-FUI-2628.2",
69
- "@genesislcap/uvu-playwright-builder": "15.46.2-FUI-2628.2",
70
- "@genesislcap/vite-builder": "15.46.2-FUI-2628.2",
71
- "@genesislcap/webpack-builder": "15.46.2-FUI-2628.2",
59
+ "@genesislcap/foundation-testing": "15.46.2-FUI-2625.2",
60
+ "@genesislcap/genx": "15.46.2-FUI-2625.2",
61
+ "@genesislcap/ts-builder": "15.46.2-FUI-2625.2",
62
+ "@genesislcap/uvu-playwright-builder": "15.46.2-FUI-2625.2",
63
+ "@genesislcap/vite-builder": "15.46.2-FUI-2625.2",
64
+ "@genesislcap/webpack-builder": "15.46.2-FUI-2625.2",
72
65
  "react-router-dom": "^7.1.3"
73
66
  },
74
67
  "peerDependencies": {
@@ -82,12 +75,11 @@
82
75
  }
83
76
  },
84
77
  "dependencies": {
85
- "@genesislcap/foundation-forms": "15.46.2-FUI-2628.2",
86
- "@genesislcap/foundation-layout": "15.46.2-FUI-2628.2",
87
- "@genesislcap/foundation-logger": "15.46.2-FUI-2628.2",
88
- "@genesislcap/foundation-workspace": "15.46.2-FUI-2628.2",
89
- "@genesislcap/rapid-design-system": "15.46.2-FUI-2628.2",
90
- "@genesislcap/web-core": "15.46.2-FUI-2628.2",
78
+ "@genesislcap/foundation-forms": "15.46.2-FUI-2625.2",
79
+ "@genesislcap/foundation-layout": "15.46.2-FUI-2625.2",
80
+ "@genesislcap/foundation-logger": "15.46.2-FUI-2625.2",
81
+ "@genesislcap/rapid-design-system": "15.46.2-FUI-2625.2",
82
+ "@genesislcap/web-core": "15.46.2-FUI-2625.2",
91
83
  "@jsonforms/core": "^3.2.1",
92
84
  "@r2wc/core": "1.3.1",
93
85
  "@r2wc/react-to-web-component": "^2.0.2",
@@ -1,19 +0,0 @@
1
- /**
2
- * `@genesislcap/foundation-react-utils/workspace`
3
- *
4
- * React helpers for `@genesislcap/foundation-workspace` (save/load of layouts, grid column state
5
- * and filters).
6
- *
7
- * Exposed as a subpath (`/workspace`) rather than from the package root so that consumers which
8
- * don't use workspaces don't load foundation-workspace (and the grid-pro graph behind it).
9
- *
10
- * Grids, layouts and the save/load UI need no hook: use the element wrappers from
11
- * `@genesislcap/foundation-workspace/react` (`GridRegister`, `LayoutWrapper`, `WorkspaceManager`).
12
- * Inside a `rapid-layout`, render panes through `registerFactory` + `reactFactory` rather than as
13
- * JSX children, because loading a saved layout rebuilds panes and cloned DOM loses React state.
14
- *
15
- * Key exports:
16
- * - `useWorkspaceFilter` — register React filter state so workspaces save and restore it.
17
- */
18
- export { useWorkspaceFilter } from './use-workspace-filter';
19
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * Registers a piece of React filter state with the foundation-workspace `FilterRegistry`, so
3
- * `<workspace-manager>` saves it with the workspace and restores it on load.
4
- *
5
- * @remarks
6
- * Grids and layouts are covered by the `GridRegister` / `LayoutWrapper` elements; filters have no
7
- * element wrapper because their value lives in app state, so this hook is the React equivalent.
8
- *
9
- * - Registers on mount and unregisters on unmount (or when `filterKey` changes).
10
- * - The registry always reads the latest `value` and calls the latest `setValue`, so neither needs
11
- * to be memoised.
12
- * - On mount, the registry applies its stored value for `filterKey` (if any): the loaded
13
- * workspace's value, or this filter's last value from earlier in the session. This covers a
14
- * filter that wasn't mounted when the workspace loaded (e.g. on another route), and a filter
15
- * inside a layout pane that a layout reload remounts.
16
- * - On unmount, the registry keeps the last value, so saving a workspace while the filter isn't
17
- * mounted still includes it.
18
- *
19
- * @param filterKey - Unique key the value is saved under. An empty key skips registration.
20
- * @param value - Current filter value.
21
- * @param setValue - Called with the saved value when a workspace is loaded.
22
- *
23
- * @example
24
- * ```tsx
25
- * const [instrument, setInstrument] = useState('');
26
- * useWorkspaceFilter('positions-instrument', instrument, setInstrument);
27
- * ```
28
- * @alpha
29
- */
30
- export declare function useWorkspaceFilter(filterKey: string, value: string, setValue: (value: string) => void): void;
31
- //# sourceMappingURL=use-workspace-filter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-workspace-filter.d.ts","sourceRoot":"","sources":["../../../src/workspace/use-workspace-filter.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAChC,IAAI,CAwBN"}
@@ -1,18 +0,0 @@
1
- /**
2
- * `@genesislcap/foundation-react-utils/workspace`
3
- *
4
- * React helpers for `@genesislcap/foundation-workspace` (save/load of layouts, grid column state
5
- * and filters).
6
- *
7
- * Exposed as a subpath (`/workspace`) rather than from the package root so that consumers which
8
- * don't use workspaces don't load foundation-workspace (and the grid-pro graph behind it).
9
- *
10
- * Grids, layouts and the save/load UI need no hook: use the element wrappers from
11
- * `@genesislcap/foundation-workspace/react` (`GridRegister`, `LayoutWrapper`, `WorkspaceManager`).
12
- * Inside a `rapid-layout`, render panes through `registerFactory` + `reactFactory` rather than as
13
- * JSX children, because loading a saved layout rebuilds panes and cloned DOM loses React state.
14
- *
15
- * Key exports:
16
- * - `useWorkspaceFilter` — register React filter state so workspaces save and restore it.
17
- */
18
- export { useWorkspaceFilter } from './use-workspace-filter';
@@ -1,48 +0,0 @@
1
- import { FilterRegistry } from '@genesislcap/foundation-workspace';
2
- import { DI } from '@genesislcap/web-core';
3
- import { useEffect, useLayoutEffect, useRef } from 'react';
4
- /**
5
- * Registers a piece of React filter state with the foundation-workspace `FilterRegistry`, so
6
- * `<workspace-manager>` saves it with the workspace and restores it on load.
7
- *
8
- * @remarks
9
- * Grids and layouts are covered by the `GridRegister` / `LayoutWrapper` elements; filters have no
10
- * element wrapper because their value lives in app state, so this hook is the React equivalent.
11
- *
12
- * - Registers on mount and unregisters on unmount (or when `filterKey` changes).
13
- * - The registry always reads the latest `value` and calls the latest `setValue`, so neither needs
14
- * to be memoised.
15
- * - On mount, the registry applies its stored value for `filterKey` (if any): the loaded
16
- * workspace's value, or this filter's last value from earlier in the session. This covers a
17
- * filter that wasn't mounted when the workspace loaded (e.g. on another route), and a filter
18
- * inside a layout pane that a layout reload remounts.
19
- * - On unmount, the registry keeps the last value, so saving a workspace while the filter isn't
20
- * mounted still includes it.
21
- *
22
- * @param filterKey - Unique key the value is saved under. An empty key skips registration.
23
- * @param value - Current filter value.
24
- * @param setValue - Called with the saved value when a workspace is loaded.
25
- *
26
- * @example
27
- * ```tsx
28
- * const [instrument, setInstrument] = useState('');
29
- * useWorkspaceFilter('positions-instrument', instrument, setInstrument);
30
- * ```
31
- * @alpha
32
- */
33
- export function useWorkspaceFilter(filterKey, value, setValue) {
34
- const latest = useRef({ value, setValue });
35
- useLayoutEffect(() => {
36
- latest.current = { value, setValue };
37
- });
38
- useEffect(() => {
39
- if (!filterKey) {
40
- return undefined;
41
- }
42
- const filterRegistry = DI.getOrCreateDOMContainer().get(FilterRegistry);
43
- filterRegistry.registerFilter(filterKey, () => ({ filterKey, value: latest.current.value }), (savedValue) => latest.current.setValue(savedValue));
44
- return () => {
45
- filterRegistry.unregisterFilter(filterKey);
46
- };
47
- }, [filterKey]);
48
- }