@kosdev-code/base-ui-components 0.1.0-dev.5385 → 0.1.0-dev.5605
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/components/atoms/button/index.d.ts +1 -1
- package/components/atoms/button/index.d.ts.map +1 -1
- package/components/atoms/button-group/button-group-item.d.ts +42 -0
- package/components/atoms/button-group/button-group-item.d.ts.map +1 -0
- package/components/atoms/button-group/button-group.d.ts +40 -0
- package/components/atoms/button-group/button-group.d.ts.map +1 -0
- package/components/atoms/button-group/hooks/use-button-group-context.d.ts +8 -0
- package/components/atoms/button-group/hooks/use-button-group-context.d.ts.map +1 -0
- package/components/atoms/button-group/index.d.ts +4 -0
- package/components/atoms/button-group/index.d.ts.map +1 -0
- package/components/atoms/icon/common/types.d.ts +2 -2
- package/components/atoms/icon/common/types.d.ts.map +1 -1
- package/components/atoms/index.d.ts +2 -0
- package/components/atoms/index.d.ts.map +1 -1
- package/components/atoms/resizable-panel-group/common/hooks/use-resizable-panel-group-context/helpers/get-resize-panel-element.d.ts +6 -1
- package/components/atoms/resizable-panel-group/common/hooks/use-resizable-panel-group-context/helpers/get-resize-panel-element.d.ts.map +1 -1
- package/components/atoms/resizable-panel-group/common/hooks/use-resizable-panel-group-context/use-resizable-panel-group-context.d.ts +6 -2
- package/components/atoms/resizable-panel-group/common/hooks/use-resizable-panel-group-context/use-resizable-panel-group-context.d.ts.map +1 -1
- package/components/atoms/resizable-panel-group/common/types.d.ts +6 -0
- package/components/atoms/resizable-panel-group/common/types.d.ts.map +1 -1
- package/components/atoms/resizable-panel-group/index.d.ts +1 -0
- package/components/atoms/resizable-panel-group/index.d.ts.map +1 -1
- package/components/atoms/resizable-panel-group/resizable-panel-group.d.ts +8 -4
- package/components/atoms/resizable-panel-group/resizable-panel-group.d.ts.map +1 -1
- package/components/molecules/dropdown-menu/dropdown-menu.d.ts.map +1 -1
- package/components/molecules/form/components/form-input.d.ts +2 -2
- package/components/molecules/form/components/form-input.d.ts.map +1 -1
- package/components/molecules/form/components/form-submit.d.ts.map +1 -1
- package/components/molecules/index.d.ts +2 -0
- package/components/molecules/index.d.ts.map +1 -1
- package/components/molecules/item-selection-list/item-selection-list.d.ts +1 -1
- package/components/molecules/item-selection-list/item-selection-list.d.ts.map +1 -1
- package/components/molecules/list/async-list/async-list-group-header.d.ts +12 -0
- package/components/molecules/list/async-list/async-list-group-header.d.ts.map +1 -0
- package/components/molecules/list/async-list/async-list.d.ts +139 -0
- package/components/molecules/list/async-list/async-list.d.ts.map +1 -0
- package/components/molecules/list/async-list/helpers/is-item-template-factory.d.ts +19 -0
- package/components/molecules/list/async-list/helpers/is-item-template-factory.d.ts.map +1 -0
- package/components/molecules/list/async-list/index.d.ts +9 -0
- package/components/molecules/list/async-list/index.d.ts.map +1 -0
- package/components/molecules/list/async-list/item-action-bar.d.ts +31 -0
- package/components/molecules/list/async-list/item-action-bar.d.ts.map +1 -0
- package/components/molecules/list/async-list/templates/studio-named-list-item.d.ts +41 -0
- package/components/molecules/list/async-list/templates/studio-named-list-item.d.ts.map +1 -0
- package/components/molecules/list/async-list/types.d.ts +286 -0
- package/components/molecules/list/async-list/types.d.ts.map +1 -0
- package/components/molecules/list/common/data-providers/base-async-tree-data-provider.d.ts +117 -56
- package/components/molecules/list/common/data-providers/base-async-tree-data-provider.d.ts.map +1 -1
- package/components/molecules/list/common/types.d.ts +111 -0
- package/components/molecules/list/common/types.d.ts.map +1 -1
- package/components/molecules/list/index.d.ts +1 -0
- package/components/molecules/list/index.d.ts.map +1 -1
- package/components/molecules/list/select-list/select-list.d.ts +1 -0
- package/components/molecules/list/select-list/select-list.d.ts.map +1 -1
- package/components/molecules/list/tree-list/async-tree-list.d.ts +253 -30
- package/components/molecules/list/tree-list/async-tree-list.d.ts.map +1 -1
- package/components/molecules/list/tree-list/helpers/is-item-template-factory.d.ts +19 -0
- package/components/molecules/list/tree-list/helpers/is-item-template-factory.d.ts.map +1 -0
- package/components/molecules/list/tree-list/templates/async-named-collapsible-branch.d.ts.map +1 -1
- package/components/molecules/table/table.d.ts.map +1 -1
- package/components/molecules/table/virtual-table.d.ts.map +1 -1
- package/components/molecules/view/action-bar.d.ts +27 -0
- package/components/molecules/view/action-bar.d.ts.map +1 -0
- package/components/molecules/view/index.d.ts +9 -0
- package/components/molecules/view/index.d.ts.map +1 -0
- package/components/molecules/view/types.d.ts +103 -0
- package/components/molecules/view/types.d.ts.map +1 -0
- package/components/molecules/view/view-header.d.ts +32 -0
- package/components/molecules/view/view-header.d.ts.map +1 -0
- package/components/molecules/view/view.d.ts +60 -0
- package/components/molecules/view/view.d.ts.map +1 -0
- package/components/molecules/view-container/index.d.ts +6 -0
- package/components/molecules/view-container/index.d.ts.map +1 -0
- package/components/molecules/view-container/types.d.ts +28 -0
- package/components/molecules/view-container/types.d.ts.map +1 -0
- package/components/molecules/view-container/view-container.d.ts +52 -0
- package/components/molecules/view-container/view-container.d.ts.map +1 -0
- package/index.cjs +1058 -824
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +6531 -4648
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/providers/data-providers/create-observable-list-provider.d.ts +116 -0
- package/providers/data-providers/create-observable-list-provider.d.ts.map +1 -0
- package/providers/data-providers/index.d.ts +86 -0
- package/providers/data-providers/index.d.ts.map +1 -0
- package/providers/data-providers/lifecycle-aware-list-provider.d.ts +206 -0
- package/providers/data-providers/lifecycle-aware-list-provider.d.ts.map +1 -0
- package/providers/data-providers/lifecycle-aware-tree-provider.d.ts +187 -0
- package/providers/data-providers/lifecycle-aware-tree-provider.d.ts.map +1 -0
- package/providers/data-providers/types.d.ts +124 -0
- package/providers/data-providers/types.d.ts.map +1 -0
- package/providers/index.d.ts +13 -0
- package/providers/index.d.ts.map +1 -0
- package/styles/tokens/component-tokens/button-group/index.d.ts +18 -0
- package/styles/tokens/component-tokens/button-group/index.d.ts.map +1 -0
- package/styles/tokens/component-tokens/icon/index.d.ts +1 -0
- package/styles/tokens/component-tokens/icon/index.d.ts.map +1 -1
- package/styles/tokens/component-tokens/index.d.ts +80 -0
- package/styles/tokens/component-tokens/index.d.ts.map +1 -1
- package/styles/tokens/component-tokens/notification/index.d.ts +37 -0
- package/styles/tokens/component-tokens/notification/index.d.ts.map +1 -0
- package/styles/tokens/component-tokens/studio-list-item/index.d.ts +13 -0
- package/styles/tokens/component-tokens/studio-list-item/index.d.ts.map +1 -0
- package/styles/tokens/component-tokens/view/index.d.ts +24 -0
- package/styles/tokens/component-tokens/view/index.d.ts.map +1 -0
- package/styles/tokens/component-tokens/view-container/index.d.ts +12 -0
- package/styles/tokens/component-tokens/view-container/index.d.ts.map +1 -0
- package/styles/tokens/index.d.ts +81 -1
- package/styles/tokens/index.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/base-ui-components",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.5605",
|
|
4
4
|
"main": "./index.cjs",
|
|
5
5
|
"module": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./style.css": "./style.css"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@kosdev-code/kos-ui-sdk": "0.1.0-dev.
|
|
23
|
+
"@kosdev-code/kos-ui-sdk": "0.1.0-dev.5605",
|
|
24
24
|
"@emotion/react": "^11.11.1",
|
|
25
25
|
"@emotion/styled": "^11.11.0",
|
|
26
26
|
"react": "^18.2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"kos": {
|
|
37
37
|
"build": {
|
|
38
|
-
"gitHash": "
|
|
38
|
+
"gitHash": "3b135f03270ef3cef0e4d3d37f8f3c3d3561b5bb"
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ObservableListDataProvider, ObservableListProviderConfig } from './types';
|
|
2
|
+
import { ListItem } from '../../components/molecules/list/common/types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Factory function that creates an observable-based data provider for AsyncList.
|
|
6
|
+
*
|
|
7
|
+
* This eliminates boilerplate by:
|
|
8
|
+
* - Automatically tracking changes to observable arrays via MobX reactions
|
|
9
|
+
* - Transforming raw items to ListItem format
|
|
10
|
+
* - Maintaining originalItems map for action integration
|
|
11
|
+
* - Managing initialization and disposal lifecycle
|
|
12
|
+
*
|
|
13
|
+
* The provider integrates seamlessly with AsyncList component and provides automatic
|
|
14
|
+
* UI updates when the underlying model data changes.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam M - The model type containing observable data
|
|
17
|
+
* @typeParam I - The raw item type from the model's observable array
|
|
18
|
+
* @typeParam T - The transformed ListItem type
|
|
19
|
+
*
|
|
20
|
+
* @param config - Configuration object
|
|
21
|
+
* @returns An AsyncListDataProvider-compatible provider with observable tracking
|
|
22
|
+
*
|
|
23
|
+
* @category Data Providers
|
|
24
|
+
*
|
|
25
|
+
* @example Basic usage with a projects model
|
|
26
|
+
* ```typescript
|
|
27
|
+
* interface Project {
|
|
28
|
+
* id: string;
|
|
29
|
+
* name: string;
|
|
30
|
+
* description: string;
|
|
31
|
+
* status: 'active' | 'archived';
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* interface ProjectListItem extends ListItem {
|
|
35
|
+
* subText?: string;
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* class ProjectsModel {
|
|
39
|
+
* @observable projects: Project[] = [];
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* const projectsModel = new ProjectsModel();
|
|
43
|
+
*
|
|
44
|
+
* const provider = createObservableListProvider({
|
|
45
|
+
* model: projectsModel,
|
|
46
|
+
* itemsExpression: (m) => m.projects,
|
|
47
|
+
* transformer: (project) => ({
|
|
48
|
+
* id: project.id,
|
|
49
|
+
* name: project.name,
|
|
50
|
+
* subText: project.description,
|
|
51
|
+
* }),
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* // Use with AsyncList
|
|
55
|
+
* <AsyncList
|
|
56
|
+
* dataProvider={provider}
|
|
57
|
+
* ItemTemplate={StudioNamedListItem}
|
|
58
|
+
* itemActions={[...]}
|
|
59
|
+
* />
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @example Filtering items in the expression
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const activeProjectsProvider = createObservableListProvider({
|
|
65
|
+
* model: projectsModel,
|
|
66
|
+
* // Only show active projects - MobX tracks both array changes and status changes
|
|
67
|
+
* itemsExpression: (m) => m.projects.filter(p => p.status === 'active'),
|
|
68
|
+
* transformer: (project) => ({
|
|
69
|
+
* id: project.id,
|
|
70
|
+
* name: project.name,
|
|
71
|
+
* subText: `Status: ${project.status}`,
|
|
72
|
+
* }),
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example Complex transformation with additional data
|
|
77
|
+
* ```typescript
|
|
78
|
+
* interface EnhancedProjectListItem extends ListItem {
|
|
79
|
+
* subText?: string;
|
|
80
|
+
* type?: string;
|
|
81
|
+
* }
|
|
82
|
+
*
|
|
83
|
+
* const provider = createObservableListProvider<
|
|
84
|
+
* ProjectsModel,
|
|
85
|
+
* Project,
|
|
86
|
+
* EnhancedProjectListItem
|
|
87
|
+
* >({
|
|
88
|
+
* model: projectsModel,
|
|
89
|
+
* itemsExpression: (m) => m.projects,
|
|
90
|
+
* transformer: (project) => ({
|
|
91
|
+
* id: project.id,
|
|
92
|
+
* name: project.name,
|
|
93
|
+
* subText: `${project.description} - ${project.status}`,
|
|
94
|
+
* type: project.status, // Can be used with itemIconMap
|
|
95
|
+
* }),
|
|
96
|
+
* });
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example Manual disposal control
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const provider = createObservableListProvider({
|
|
102
|
+
* model: projectsModel,
|
|
103
|
+
* itemsExpression: (m) => m.projects,
|
|
104
|
+
* transformer: (project) => ({ id: project.id, name: project.name }),
|
|
105
|
+
* autoDispose: false, // Manual disposal control
|
|
106
|
+
* });
|
|
107
|
+
*
|
|
108
|
+
* // Later, manually dispose when needed
|
|
109
|
+
* provider.dispose();
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @see {@link ObservableListDataProvider} for the provider interface
|
|
113
|
+
* @see {@link AsyncList} for the component that consumes this provider
|
|
114
|
+
*/
|
|
115
|
+
export declare function createObservableListProvider<M, I extends Record<string, any>, T extends ListItem>(config: ObservableListProviderConfig<M, I, T>): ObservableListDataProvider<M, I, T>;
|
|
116
|
+
//# sourceMappingURL=create-observable-list-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-observable-list-provider.d.ts","sourceRoot":"","sources":["../../../../../../packages/libraries/base-ui-components/src/providers/data-providers/create-observable-list-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EACV,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,SAAS,CAAC;AA8NjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8GG;AACH,wBAAgB,4BAA4B,CAC1C,CAAC,EACD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,QAAQ,EAElB,MAAM,EAAE,4BAA4B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC5C,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAErC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* (C) Copyright 2025, TCCC, All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Observable List Data Providers
|
|
6
|
+
*
|
|
7
|
+
* This module provides observable-based data provider utilities that integrate
|
|
8
|
+
* MobX models with AsyncList component, eliminating boilerplate for reactive data binding.
|
|
9
|
+
*
|
|
10
|
+
* ## Overview
|
|
11
|
+
*
|
|
12
|
+
* The Observable List Data Provider system enables automatic UI updates when model
|
|
13
|
+
* data changes by leveraging MobX reactions. This eliminates the need for manual
|
|
14
|
+
* state synchronization and reduces boilerplate code.
|
|
15
|
+
*
|
|
16
|
+
* ## Key Features
|
|
17
|
+
*
|
|
18
|
+
* - **Automatic Updates**: MobX reactions track observable changes and update UI automatically
|
|
19
|
+
* - **Type Safety**: Full generic type inference for model, raw items, and transformed items
|
|
20
|
+
* - **Memory Safe**: Proper disposal and WeakMap usage prevent memory leaks
|
|
21
|
+
* - **Action Integration**: Maintains originalItems map for action callbacks
|
|
22
|
+
* - **Simple API**: Single factory function creates fully-functional providers
|
|
23
|
+
*
|
|
24
|
+
* ## Usage Pattern
|
|
25
|
+
*
|
|
26
|
+
* 1. Define your model with observable data
|
|
27
|
+
* 2. Create provider with expression and transformer
|
|
28
|
+
* 3. Pass provider to AsyncList component
|
|
29
|
+
* 4. UI updates automatically when model data changes
|
|
30
|
+
*
|
|
31
|
+
* @example Basic Usage
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // 1. Model with observable data
|
|
34
|
+
* class ProjectsModel {
|
|
35
|
+
* @observable projects: Project[] = [];
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* // 2. Create observable provider
|
|
39
|
+
* const provider = createObservableListProvider({
|
|
40
|
+
* model: projectsModel,
|
|
41
|
+
* itemsExpression: (m) => m.projects,
|
|
42
|
+
* transformer: (project) => ({
|
|
43
|
+
* id: project.id,
|
|
44
|
+
* name: project.name,
|
|
45
|
+
* subText: project.description,
|
|
46
|
+
* }),
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* // 3. Use with AsyncList
|
|
50
|
+
* <AsyncList
|
|
51
|
+
* dataProvider={provider}
|
|
52
|
+
* ItemTemplate={StudioNamedListItem}
|
|
53
|
+
* itemActions={[
|
|
54
|
+
* {
|
|
55
|
+
* id: 'delete',
|
|
56
|
+
* iconId: 'DeleteOutlined',
|
|
57
|
+
* onClick: (id, item) => handleDelete(id),
|
|
58
|
+
* }
|
|
59
|
+
* ]}
|
|
60
|
+
* />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @example Filtering in Expression
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const activeProjectsProvider = createObservableListProvider({
|
|
66
|
+
* model: projectsModel,
|
|
67
|
+
* // MobX tracks both array changes and property changes
|
|
68
|
+
* itemsExpression: (m) => m.projects.filter(p => p.status === 'active'),
|
|
69
|
+
* transformer: (project) => ({
|
|
70
|
+
* id: project.id,
|
|
71
|
+
* name: project.name,
|
|
72
|
+
* subText: `Status: ${project.status}`,
|
|
73
|
+
* }),
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @module providers/data-providers
|
|
78
|
+
* @category Data Providers
|
|
79
|
+
*/
|
|
80
|
+
export { createObservableListProvider } from './create-observable-list-provider';
|
|
81
|
+
export { createLifecycleAwareProvider, LifecycleAwareListProvider, } from './lifecycle-aware-list-provider';
|
|
82
|
+
export { createLifecycleAwareTreeProvider, LifecycleAwareTreeProvider, } from './lifecycle-aware-tree-provider';
|
|
83
|
+
export type { ObservableExpression, ItemTransformer, ObservableListProviderConfig, ObservableListDataProvider, } from './types';
|
|
84
|
+
export type { LifecycleAwareProviderConfig, ViewContextData, } from './lifecycle-aware-list-provider';
|
|
85
|
+
export type { LifecycleAwareTreeProviderConfig, TreeViewContextData, ChildrenExpression, HasChildrenExpression, } from './lifecycle-aware-tree-provider';
|
|
86
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/libraries/base-ui-components/src/providers/data-providers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,gCAAgC,EAChC,0BAA0B,GAC3B,MAAM,iCAAiC,CAAC;AAEzC,YAAY,EACV,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,4BAA4B,EAC5B,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,gCAAgC,EAChC,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { ItemTransformer, ObservableExpression, ObservableListDataProvider } from './types';
|
|
2
|
+
import { ListItem } from '../../components/molecules/list/common/types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for creating a lifecycle-aware list data provider.
|
|
6
|
+
* Supports both static and dynamic model IDs with automatic model lifecycle tracking.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam M - The model type containing observable data
|
|
9
|
+
* @typeParam I - The raw item type from the model
|
|
10
|
+
* @typeParam T - The transformed ListItem type
|
|
11
|
+
*/
|
|
12
|
+
export interface LifecycleAwareProviderConfig<M, I extends Record<string, any>, T extends ListItem> {
|
|
13
|
+
/**
|
|
14
|
+
* Model type name (e.g., "ArtifactContainerModel")
|
|
15
|
+
*/
|
|
16
|
+
modelType: string;
|
|
17
|
+
/**
|
|
18
|
+
* Model ID to retrieve from KOS ModelManager (e.g., "artifact-container")
|
|
19
|
+
*/
|
|
20
|
+
modelId: string | ((context: ViewContextData) => string | undefined);
|
|
21
|
+
/**
|
|
22
|
+
* Expression to extract items from the model
|
|
23
|
+
*/
|
|
24
|
+
itemsExpression: ObservableExpression<M, I>;
|
|
25
|
+
/**
|
|
26
|
+
* Transformer to convert raw items to ListItem format
|
|
27
|
+
*/
|
|
28
|
+
transformer: ItemTransformer<I, T>;
|
|
29
|
+
/**
|
|
30
|
+
* View context data for dynamic modelId evaluation
|
|
31
|
+
*/
|
|
32
|
+
context: ViewContextData;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to call activate() on the model when retrieved from ModelManager.
|
|
35
|
+
* Only set to true if the model needs activation to load its data.
|
|
36
|
+
* Default: false
|
|
37
|
+
*/
|
|
38
|
+
activate?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Simplified ViewContext interface to avoid circular dependencies.
|
|
42
|
+
* Contains only the properties needed for dynamic modelId evaluation.
|
|
43
|
+
*/
|
|
44
|
+
export interface ViewContextData {
|
|
45
|
+
selectedItems: string[];
|
|
46
|
+
activeFilters: Record<string, unknown>;
|
|
47
|
+
searchQuery: string;
|
|
48
|
+
userPermissions: string[];
|
|
49
|
+
applicationState: Record<string, unknown>;
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Lifecycle-aware wrapper for ObservableListDataProvider that enables
|
|
54
|
+
* declarative view registration independent of component lifecycle and model availability.
|
|
55
|
+
*
|
|
56
|
+
* This provider:
|
|
57
|
+
* - Subscribes to KOS model lifecycle events via EventBus
|
|
58
|
+
* - Automatically creates inner provider when model becomes ready
|
|
59
|
+
* - Supports both static and dynamic model IDs
|
|
60
|
+
* - Returns empty array until model is ready
|
|
61
|
+
* - Properly disposes subscriptions and inner providers
|
|
62
|
+
*
|
|
63
|
+
* **Architecture:**
|
|
64
|
+
* 1. **Registration Time**: View registered with modelId (string or function)
|
|
65
|
+
* 2. **Provider Creation**: Lifecycle-aware wrapper created immediately
|
|
66
|
+
* 3. **Model Waiting**: Wrapper subscribes to EventBus for model-ready events
|
|
67
|
+
* 4. **Model Ready**: Wrapper looks up model from ModelManager and creates inner provider
|
|
68
|
+
* 5. **Dynamic Updates**: For function-based modelIds, MobX reaction tracks changes
|
|
69
|
+
*
|
|
70
|
+
* @typeParam M - The model type containing observable data
|
|
71
|
+
* @typeParam I - The raw item type from the model
|
|
72
|
+
* @typeParam T - The transformed ListItem type
|
|
73
|
+
*
|
|
74
|
+
* @example Static model ID
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const provider = new LifecycleAwareListProvider({
|
|
77
|
+
* modelId: "artifact-container",
|
|
78
|
+
* itemsExpression: (m) => m.publishedAvailableArtifacts,
|
|
79
|
+
* transformer: (artifact) => ({ id: artifact.id, name: artifact.name }),
|
|
80
|
+
* context: viewContext.data
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @example Dynamic model ID
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const provider = new LifecycleAwareListProvider({
|
|
87
|
+
* modelId: (context) => context.selectedProjectId,
|
|
88
|
+
* itemsExpression: (m) => m.artifacts,
|
|
89
|
+
* transformer: (artifact) => ({ id: artifact.id, name: artifact.name }),
|
|
90
|
+
* context: viewContext.data
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare class LifecycleAwareListProvider<M, I extends Record<string, any>, T extends ListItem> implements ObservableListDataProvider<M, I, T> {
|
|
95
|
+
readonly itemsExpression: ObservableExpression<M, I>;
|
|
96
|
+
readonly transformer: ItemTransformer<I, T>;
|
|
97
|
+
readonly autoDispose: boolean;
|
|
98
|
+
private _modelId;
|
|
99
|
+
private _context;
|
|
100
|
+
private _innerProvider;
|
|
101
|
+
private _isInitialized;
|
|
102
|
+
private _isDisposed;
|
|
103
|
+
private _isLoading;
|
|
104
|
+
private _eventBusUnsubscribe;
|
|
105
|
+
private _modelIdReactionDisposer;
|
|
106
|
+
private _currentModelId;
|
|
107
|
+
private _modelType;
|
|
108
|
+
private _shouldActivate;
|
|
109
|
+
private _items;
|
|
110
|
+
constructor(config: LifecycleAwareProviderConfig<M, I, T>);
|
|
111
|
+
/**
|
|
112
|
+
* Returns the current model instance from the inner provider, or undefined.
|
|
113
|
+
*/
|
|
114
|
+
get model(): M;
|
|
115
|
+
/**
|
|
116
|
+
* Returns items from the inner provider, or empty array if model not ready.
|
|
117
|
+
* Computed to ensure MobX tracks changes to the inner provider's items.
|
|
118
|
+
*/
|
|
119
|
+
get items(): T[];
|
|
120
|
+
get isInitialized(): boolean;
|
|
121
|
+
get isDisposed(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Returns true when the provider is loading data.
|
|
124
|
+
* This includes:
|
|
125
|
+
* - Model activation (if configured)
|
|
126
|
+
* - Waiting for model to become ready
|
|
127
|
+
* - Dynamic modelId changes causing new model lookup
|
|
128
|
+
*
|
|
129
|
+
* Does NOT include:
|
|
130
|
+
* - No selection made yet (dynamic modelId returns undefined)
|
|
131
|
+
*
|
|
132
|
+
* The provider is only "loading" if we have a valid modelId but no inner provider yet.
|
|
133
|
+
* If modelId is undefined (no selection), we're in an empty/unselected state, not loading.
|
|
134
|
+
*/
|
|
135
|
+
get isLoading(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Map of original items by ID for action integration.
|
|
138
|
+
* Delegates to inner provider when available.
|
|
139
|
+
*/
|
|
140
|
+
get originalItems(): Map<string, I>;
|
|
141
|
+
/**
|
|
142
|
+
* Initialize the lifecycle-aware provider.
|
|
143
|
+
* Sets up EventBus subscription and MobX reaction for dynamic modelId.
|
|
144
|
+
* Can be called again after dispose() to re-initialize.
|
|
145
|
+
*/
|
|
146
|
+
init(): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Handle changes to dynamic modelId.
|
|
149
|
+
* Disposes old provider and subscribes to new model.
|
|
150
|
+
* Wrapped in runInAction to comply with MobX strict mode.
|
|
151
|
+
*/
|
|
152
|
+
private handleModelIdChange;
|
|
153
|
+
/**
|
|
154
|
+
* Subscribe to EventBus for model lifecycle events.
|
|
155
|
+
* When model becomes ready, creates the inner provider.
|
|
156
|
+
*/
|
|
157
|
+
private subscribeToModelLifecycle;
|
|
158
|
+
/**
|
|
159
|
+
* Create the inner ObservableListDataProvider with the ready model.
|
|
160
|
+
* Sets loading state during async activation.
|
|
161
|
+
* Wrapped in runInAction to comply with MobX strict mode.
|
|
162
|
+
*/
|
|
163
|
+
private createInnerProvider;
|
|
164
|
+
/**
|
|
165
|
+
* Get model from KOS ModelManager.
|
|
166
|
+
* Optionally calls activate() if configured to do so.
|
|
167
|
+
* Sets loading state during async activation.
|
|
168
|
+
* Uses runInAction to comply with MobX strict mode.
|
|
169
|
+
*/
|
|
170
|
+
private getModelFromManager;
|
|
171
|
+
/**
|
|
172
|
+
* Dispose of the provider and clean up all subscriptions.
|
|
173
|
+
* Uses runInAction for observable state changes to comply with MobX strict mode.
|
|
174
|
+
*/
|
|
175
|
+
dispose(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Promise that resolves when provider is ready.
|
|
178
|
+
*/
|
|
179
|
+
whenReady(): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Refresh the data by delegating to inner provider.
|
|
182
|
+
*/
|
|
183
|
+
refresh(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Factory function to create a lifecycle-aware list data provider.
|
|
187
|
+
*
|
|
188
|
+
* @typeParam M - The model type containing observable data
|
|
189
|
+
* @typeParam I - The raw item type from the model
|
|
190
|
+
* @typeParam T - The transformed ListItem type
|
|
191
|
+
*
|
|
192
|
+
* @param config - Configuration including modelId (string or function)
|
|
193
|
+
* @returns Lifecycle-aware provider that waits for model to be ready
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const provider = createLifecycleAwareProvider({
|
|
198
|
+
* modelId: "artifact-container",
|
|
199
|
+
* itemsExpression: (m) => m.publishedAvailableArtifacts,
|
|
200
|
+
* transformer: (artifact) => ({ id: artifact.id, name: artifact.name }),
|
|
201
|
+
* context: viewContext.data
|
|
202
|
+
* });
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
export declare function createLifecycleAwareProvider<M, I extends Record<string, any>, T extends ListItem>(config: LifecycleAwareProviderConfig<M, I, T>): ObservableListDataProvider<M, I, T>;
|
|
206
|
+
//# sourceMappingURL=lifecycle-aware-list-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-aware-list-provider.d.ts","sourceRoot":"","sources":["../../../../../../packages/libraries/base-ui-components/src/providers/data-providers/lifecycle-aware-list-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAQjB;;;;;;;GAOG;AACH,MAAM,WAAW,4BAA4B,CAC3C,CAAC,EACD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,QAAQ;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC,OAAO,EAAE,eAAe,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;IAErE;;OAEG;IACH,eAAe,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5C;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEnC;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,e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W,KAAK,IAAI,CAAC,EAAE,CAEtB;IAED,IAAW,aAAa,IAAI,OAAO,CAElC;IAED,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED;;;;;;;;;;;;OAYG;IACH,IAAW,SAAS,IAAI,OAAO,CAK9B;IAED;;;OAGG;IACH,IAAW,aAAa,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAEzC;IAED;;;;OAIG;IACU,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IA2ClC;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACH,OAAO,CAAC,yBAAyB;IAsBjC;;;;OAIG;YACW,mBAAmB;IAsBjC;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAuB3B;;;OAGG;IACI,OAAO,IAAI,IAAI;IA8BtB;;OAEG;IACU,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAiBvC;;OAEG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMtC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAC1C,CAAC,EACD,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC7B,CAAC,SAAS,QAAQ,EAElB,MAAM,EAAE,4BAA4B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC5C,0BAA0B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAErC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ItemTransformer, ObservableExpression } from './types';
|
|
2
|
+
import { ListItem } from '../../components/molecules/list/common/types';
|
|
3
|
+
import { AsyncTreeBranch } from '../../components/molecules/list/common/data-providers/async-tree-data-provider';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Expression to extract children from a parent item.
|
|
7
|
+
*/
|
|
8
|
+
export type ChildrenExpression<M, I> = (model: M, parentItem: I) => I[];
|
|
9
|
+
/**
|
|
10
|
+
* Expression to determine if an item has children.
|
|
11
|
+
*/
|
|
12
|
+
export type HasChildrenExpression<M, I> = (model: M, item: I) => boolean | "unknown";
|
|
13
|
+
/**
|
|
14
|
+
* Simplified ViewContext interface to avoid circular dependencies.
|
|
15
|
+
*/
|
|
16
|
+
export interface TreeViewContextData {
|
|
17
|
+
selectedItems: string[];
|
|
18
|
+
activeFilters: Record<string, unknown>;
|
|
19
|
+
searchQuery: string;
|
|
20
|
+
userPermissions: string[];
|
|
21
|
+
applicationState: Record<string, unknown>;
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for creating a lifecycle-aware tree data provider.
|
|
26
|
+
*/
|
|
27
|
+
export interface LifecycleAwareTreeProviderConfig<M, I extends Record<string, any>, T extends ListItem> {
|
|
28
|
+
/**
|
|
29
|
+
* Model type name (e.g., "VirtualMachineContainerModel")
|
|
30
|
+
*/
|
|
31
|
+
modelType: string;
|
|
32
|
+
/**
|
|
33
|
+
* Model ID to retrieve from KOS ModelManager
|
|
34
|
+
*/
|
|
35
|
+
modelId: string | ((context: TreeViewContextData) => string | undefined);
|
|
36
|
+
/**
|
|
37
|
+
* Expression to extract root items from the model
|
|
38
|
+
*/
|
|
39
|
+
rootsExpression: ObservableExpression<M, I>;
|
|
40
|
+
/**
|
|
41
|
+
* Expression to get children of a specific item
|
|
42
|
+
*/
|
|
43
|
+
childrenExpression: ChildrenExpression<M, I>;
|
|
44
|
+
/**
|
|
45
|
+
* Expression to determine if an item has children
|
|
46
|
+
*/
|
|
47
|
+
hasChildrenExpression: HasChildrenExpression<M, I>;
|
|
48
|
+
/**
|
|
49
|
+
* Function to extract unique ID from an item
|
|
50
|
+
*/
|
|
51
|
+
getItemId: (item: I) => string;
|
|
52
|
+
/**
|
|
53
|
+
* Transformer to convert raw items to ListItem format
|
|
54
|
+
*/
|
|
55
|
+
transformer: ItemTransformer<I, T>;
|
|
56
|
+
/**
|
|
57
|
+
* View context data for dynamic modelId evaluation
|
|
58
|
+
*/
|
|
59
|
+
context: TreeViewContextData;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to call activate() on the model when retrieved
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
64
|
+
activate?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Lifecycle-aware tree data provider using composition pattern.
|
|
68
|
+
*
|
|
69
|
+
* Uses composition instead of inheritance to properly delegate to inner provider
|
|
70
|
+
* without MobX observable override conflicts.
|
|
71
|
+
*
|
|
72
|
+
* Implements AsyncTreeDataProvider interface directly.
|
|
73
|
+
*/
|
|
74
|
+
export declare class LifecycleAwareTreeProvider<M extends Record<string, any>, I extends Record<string, any>, T extends ListItem> {
|
|
75
|
+
private _modelId;
|
|
76
|
+
private _context;
|
|
77
|
+
private _innerProvider;
|
|
78
|
+
private _isInitialized;
|
|
79
|
+
private _isInitializing;
|
|
80
|
+
private _isDisposed;
|
|
81
|
+
private _isLoading;
|
|
82
|
+
private _eventBusUnsubscribe;
|
|
83
|
+
private _modelIdReactionDisposer;
|
|
84
|
+
private _currentModelId;
|
|
85
|
+
private _modelType;
|
|
86
|
+
private _shouldActivate;
|
|
87
|
+
private _rootsExpression;
|
|
88
|
+
private _childrenExpression;
|
|
89
|
+
private _hasChildrenExpression;
|
|
90
|
+
private _getItemIdFn;
|
|
91
|
+
private _transformer;
|
|
92
|
+
constructor(config: LifecycleAwareTreeProviderConfig<M, I, T>);
|
|
93
|
+
/**
|
|
94
|
+
* Returns items from the inner provider's tree, or empty if not ready.
|
|
95
|
+
*/
|
|
96
|
+
get tree(): AsyncTreeBranch<T>[];
|
|
97
|
+
/**
|
|
98
|
+
* Returns the original items map from the inner provider.
|
|
99
|
+
*/
|
|
100
|
+
get originalItems(): ReadonlyMap<string, I>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns initialization status
|
|
103
|
+
*/
|
|
104
|
+
get initialized(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Returns loading status
|
|
107
|
+
*/
|
|
108
|
+
get isLoading(): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Check if an item has children
|
|
111
|
+
*/
|
|
112
|
+
hasChildren(item: I): boolean | "unknown";
|
|
113
|
+
/**
|
|
114
|
+
* Get the unique ID for an item
|
|
115
|
+
*/
|
|
116
|
+
getItemId(item: I): string;
|
|
117
|
+
/**
|
|
118
|
+
* Initialize the lifecycle-aware provider.
|
|
119
|
+
* Can be called again after dispose() to re-initialize.
|
|
120
|
+
*/
|
|
121
|
+
init(): Promise<void>;
|
|
122
|
+
/**
|
|
123
|
+
* Handle changes to dynamic modelId.
|
|
124
|
+
*/
|
|
125
|
+
private handleModelIdChange;
|
|
126
|
+
/**
|
|
127
|
+
* Subscribe to EventBus for model lifecycle events.
|
|
128
|
+
* Returns a promise that resolves when the inner provider is ready.
|
|
129
|
+
*/
|
|
130
|
+
private subscribeToModelLifecycle;
|
|
131
|
+
/**
|
|
132
|
+
* Create the inner tree provider with the ready model.
|
|
133
|
+
*/
|
|
134
|
+
private createInnerProvider;
|
|
135
|
+
/**
|
|
136
|
+
* Get model from KOS ModelManager.
|
|
137
|
+
*/
|
|
138
|
+
private getModelFromManager;
|
|
139
|
+
/**
|
|
140
|
+
* Expand a branch - delegates to inner provider
|
|
141
|
+
*/
|
|
142
|
+
expandBranch(itemId: string, item: I): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Expand all nodes recursively - delegates to inner provider.
|
|
145
|
+
* Call this when expandedMode is true.
|
|
146
|
+
*/
|
|
147
|
+
expandAll(): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Collapse a branch - delegates to inner provider
|
|
150
|
+
*/
|
|
151
|
+
collapseBranch(itemId: string): void;
|
|
152
|
+
/**
|
|
153
|
+
* Clear cache - delegates to inner provider
|
|
154
|
+
*/
|
|
155
|
+
clearCache(itemId?: string): void;
|
|
156
|
+
/**
|
|
157
|
+
* Refresh - delegates to inner provider
|
|
158
|
+
*/
|
|
159
|
+
refresh(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Wait for provider to be ready
|
|
162
|
+
*/
|
|
163
|
+
whenReady(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Dispose of the provider and clean up all subscriptions.
|
|
166
|
+
*/
|
|
167
|
+
dispose(): void;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Factory function to create a lifecycle-aware tree data provider.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const provider = createLifecycleAwareTreeProvider({
|
|
175
|
+
* modelType: "VirtualMachineContainerModel",
|
|
176
|
+
* modelId: "VirtualMachineContainerModel",
|
|
177
|
+
* rootsExpression: (model) => model.models.filter(vm => !vm.parentId),
|
|
178
|
+
* childrenExpression: (model, item) => model.models.filter(vm => vm.parentId === item.id),
|
|
179
|
+
* hasChildrenExpression: (model, item) => model.models.some(vm => vm.parentId === item.id),
|
|
180
|
+
* getItemId: (item) => item.id,
|
|
181
|
+
* transformer: (vm) => ({ id: vm.id, name: vm.name }),
|
|
182
|
+
* context: studio.data
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export declare function createLifecycleAwareTreeProvider<M extends Record<string, any>, I extends Record<string, any>, T extends ListItem>(config: LifecycleAwareTreeProviderConfig<M, I, T>): LifecycleAwareTreeProvider<M, I, T>;
|
|
187
|
+
//# sourceMappingURL=lifecycle-aware-tree-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle-aware-tree-provider.d.ts","sourceRoot":"","sources":["../../../../../../packages/libraries/base-ui-components/src/providers/data-providers/lifecycle-aware-tree-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gFAAgF,CAAC;AAEtH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAA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