@kosdev-code/base-ui-components 0.1.0-dev.5382 → 0.1.0-dev.5596
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.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 +1062 -823
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +6499 -4613
- 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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ResolvedAction } from './types';
|
|
2
|
+
|
|
3
|
+
export interface ItemActionBarProps {
|
|
4
|
+
/** Actions to render */
|
|
5
|
+
actions: ResolvedAction[];
|
|
6
|
+
/** Whether the parent item is selected (affects colors) */
|
|
7
|
+
isSelected?: boolean;
|
|
8
|
+
/** Whether selection styling is disabled */
|
|
9
|
+
disableSelectionStyling?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* ItemActionBar renders actions with primary/secondary/overflow behavior for list items.
|
|
13
|
+
*
|
|
14
|
+
* - Primary actions (isPrimary=true) are rendered inline as icon buttons (max 3)
|
|
15
|
+
* - Secondary actions (isPrimary=false or undefined) appear in the overflow menu
|
|
16
|
+
* - If more than 3 primary actions exist, extras are shown at the top of the
|
|
17
|
+
* overflow menu with a separator below them
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <ItemActionBar
|
|
22
|
+
* actions={[
|
|
23
|
+
* { id: 'edit', iconId: 'Edit', tooltip: 'Edit', isPrimary: true, onClick: handleEdit },
|
|
24
|
+
* { id: 'delete', iconId: 'Delete', tooltip: 'Delete', label: 'Delete', onClick: handleDelete },
|
|
25
|
+
* ]}
|
|
26
|
+
* isSelected={false}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const ItemActionBar: import('react').NamedExoticComponent<ItemActionBarProps>;
|
|
31
|
+
//# sourceMappingURL=item-action-bar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-action-bar.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/libraries/base-ui-components/src/components/molecules/list/async-list/item-action-bar.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAWH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAO9C,MAAM,WAAW,kBAAkB;IACjC,wBAAwB;IACxB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4CAA4C;IAC5C,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,0DAyJzB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ResolvedAction, ResolvedDecorator } from '../types';
|
|
2
|
+
import { ListItem } from '../../common/types';
|
|
3
|
+
import { IconColors, IconIds } from '../../../../atoms';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Studio 2.0 list item template with external decoration support.
|
|
8
|
+
* Aligns with Studio architecture patterns for actions, decorators, and state management.
|
|
9
|
+
*
|
|
10
|
+
* This template is designed to be generic and data-minimal - the item itself only
|
|
11
|
+
* provides name and optional subtitle. All decorations (icons, actions, badges) are
|
|
12
|
+
* resolved and passed in by the parent list component via registration props.
|
|
13
|
+
*
|
|
14
|
+
* Supports two modes:
|
|
15
|
+
* 1. Simple mode: Provide name and optional subText
|
|
16
|
+
* 2. Custom content mode: Provide children for complete control over content
|
|
17
|
+
*
|
|
18
|
+
* @category Components
|
|
19
|
+
* @version 2.0.0
|
|
20
|
+
*/
|
|
21
|
+
export interface StudioNamedListItemProps extends ListItem {
|
|
22
|
+
/** Optional subtitle (only used when children not provided) */
|
|
23
|
+
subText?: string;
|
|
24
|
+
/** Custom content - when provided, replaces name/subText rendering */
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
iconId?: IconIds;
|
|
27
|
+
iconColor?: IconColors;
|
|
28
|
+
actions?: ResolvedAction[];
|
|
29
|
+
decorators?: ResolvedDecorator[];
|
|
30
|
+
className?: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
"data-depth"?: number;
|
|
33
|
+
"data-indent-size"?: number;
|
|
34
|
+
/**
|
|
35
|
+
* When true, disables the default selection styling (blue background, white text).
|
|
36
|
+
* Selection state is still tracked but visual styling is suppressed.
|
|
37
|
+
*/
|
|
38
|
+
"data-disable-selection-styling"?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare const StudioNamedListItem: import('react').FunctionComponent<StudioNamedListItemProps>;
|
|
41
|
+
//# sourceMappingURL=studio-named-list-item.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio-named-list-item.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/libraries/base-ui-components/src/components/molecules/list/async-list/templates/studio-named-list-item.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAOlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,wBAAyB,SAAQ,QAAQ;IACxD,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,SAAS,CAAC;IAGrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAGjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAGnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,eAAO,MAAM,mBAAmB,6DAmG/B,CAAC"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { ListItem } from '../common/types';
|
|
2
|
+
import { IconColors, IconIds } from '../../../atoms/icon';
|
|
3
|
+
import { FunctionComponent, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Configuration for an icon
|
|
7
|
+
*/
|
|
8
|
+
export interface IconConfig {
|
|
9
|
+
iconId: IconIds;
|
|
10
|
+
color?: IconColors;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Maps items to icons - can be static map or dynamic function
|
|
14
|
+
*/
|
|
15
|
+
export type ItemIconMap<T extends ListItem = ListItem> = Record<string, IconConfig> | ((item: T) => IconConfig | undefined);
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for an item action button
|
|
18
|
+
*
|
|
19
|
+
* Supports dual visibility patterns:
|
|
20
|
+
* 1. `visibilityExpression` - Context-based visibility (evaluated first)
|
|
21
|
+
* Example: "activePage == 'artifacts-page'" or "views['artifacts'].selectedId != undefined"
|
|
22
|
+
* Evaluated against studio context. If false, action is filtered out before rendering.
|
|
23
|
+
*
|
|
24
|
+
* 2. `visibleFor` - Item-specific visibility (evaluated second)
|
|
25
|
+
* Example: (item) => !item.isSystemItem
|
|
26
|
+
* Evaluated per-item during rendering. If false, action is hidden for that item.
|
|
27
|
+
*
|
|
28
|
+
* Evaluation order:
|
|
29
|
+
* - If `visibilityExpression` is provided and evaluates to false, action is never passed to AsyncList
|
|
30
|
+
* - If `visibilityExpression` is true (or undefined), action proceeds to AsyncList
|
|
31
|
+
* - AsyncList then evaluates `visibleFor` per-item to determine final visibility
|
|
32
|
+
*
|
|
33
|
+
* Both conditions must be true for the action to be visible.
|
|
34
|
+
*/
|
|
35
|
+
export interface ItemActionConfig<I extends Record<string, any>, T extends ListItem = ListItem> {
|
|
36
|
+
id: string;
|
|
37
|
+
iconId: IconIds;
|
|
38
|
+
tooltip?: string;
|
|
39
|
+
/** Label text for the action (shown in overflow menu) */
|
|
40
|
+
label?: string;
|
|
41
|
+
color?: IconColors;
|
|
42
|
+
/**
|
|
43
|
+
* Whether this is a primary action displayed inline.
|
|
44
|
+
* Primary actions appear as icon buttons; secondary actions
|
|
45
|
+
* (isPrimary=false or undefined) appear in the overflow menu.
|
|
46
|
+
* Max 3 primary actions are shown; extras overflow with a separator.
|
|
47
|
+
*/
|
|
48
|
+
isPrimary?: boolean;
|
|
49
|
+
onClick: (itemId: string, originalItem: I) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Context-based visibility expression (evaluated against studio context).
|
|
52
|
+
* If false, action is filtered out before reaching AsyncList.
|
|
53
|
+
* Example: "activePage == 'artifacts-page'"
|
|
54
|
+
*/
|
|
55
|
+
visibilityExpression?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Item-specific visibility function (evaluated per-item during rendering).
|
|
58
|
+
* If false, action is hidden for that specific item.
|
|
59
|
+
* Example: (item) => !item.isSystemItem
|
|
60
|
+
*/
|
|
61
|
+
visibleFor?: (item: T) => boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Enablement expression for disabling action while keeping it visible.
|
|
64
|
+
*
|
|
65
|
+
* Evaluated with both studio context AND item context merged.
|
|
66
|
+
* When the expression evaluates to false, the action is shown but disabled.
|
|
67
|
+
*
|
|
68
|
+
* **Item context access:**
|
|
69
|
+
* - `item` - The ListItem (transformed item with id, name, etc.)
|
|
70
|
+
* Note: To access properties like `locked`, ensure your transformer
|
|
71
|
+
* includes them in the ListItem output.
|
|
72
|
+
*
|
|
73
|
+
* **Studio context access:**
|
|
74
|
+
* - `offline` - Whether app is offline
|
|
75
|
+
* - `user.isAdmin` - Whether user is an admin
|
|
76
|
+
* - `orgState.mutable` - Whether org data can be modified
|
|
77
|
+
* - All other studio context variables
|
|
78
|
+
*
|
|
79
|
+
* @example Disable for locked items (requires transformer to include `locked`)
|
|
80
|
+
* ```typescript
|
|
81
|
+
* // Transformer: (item) => ({ id: item.id, name: item.name, locked: item.locked })
|
|
82
|
+
* enablementExpression: "not item.locked"
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example Admin can edit locked items
|
|
86
|
+
* ```typescript
|
|
87
|
+
* enablementExpression: "user.isAdmin or not item.locked"
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example Disable when offline
|
|
91
|
+
* ```typescript
|
|
92
|
+
* enablementExpression: "not offline"
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
enablementExpression?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Item-specific enabled function (evaluated per-item during rendering).
|
|
98
|
+
* If false, action is shown but disabled for that specific item.
|
|
99
|
+
* Example: (item) => !item.locked
|
|
100
|
+
*
|
|
101
|
+
* Use this for programmatic enablement logic.
|
|
102
|
+
* For declarative enablement based on expressions, use `enablementExpression`.
|
|
103
|
+
*/
|
|
104
|
+
enabledFor?: (item: T) => boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Resolved action ready to render
|
|
108
|
+
*/
|
|
109
|
+
export interface ResolvedAction {
|
|
110
|
+
id: string;
|
|
111
|
+
iconId: IconIds;
|
|
112
|
+
color?: IconColors;
|
|
113
|
+
tooltip?: string;
|
|
114
|
+
/** Label text for the action (shown in overflow menu) */
|
|
115
|
+
label?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Whether this is a primary action displayed inline.
|
|
118
|
+
* Primary actions appear as icon buttons; secondary actions
|
|
119
|
+
* (isPrimary=false or undefined) appear in the overflow menu.
|
|
120
|
+
* Max 3 primary actions are shown; extras overflow with a separator.
|
|
121
|
+
*/
|
|
122
|
+
isPrimary?: boolean;
|
|
123
|
+
onClick: () => void;
|
|
124
|
+
/** Whether the action is disabled (shown but not clickable) */
|
|
125
|
+
disabled?: boolean;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Configuration for an item decorator (icon or badge)
|
|
129
|
+
*
|
|
130
|
+
* Supports dual visibility patterns:
|
|
131
|
+
* 1. `visibilityExpression` - Context-based visibility (evaluated first)
|
|
132
|
+
* Example: "activePage == 'artifacts-page'" or "views['artifacts'].selectedId != undefined"
|
|
133
|
+
* Evaluated against studio context. If false, decorator is filtered out before rendering.
|
|
134
|
+
*
|
|
135
|
+
* 2. `visibleFor` - Item-specific visibility (evaluated second)
|
|
136
|
+
* Example: (item) => item.hasWarning
|
|
137
|
+
* Evaluated per-item during rendering. If false, decorator is hidden for that item.
|
|
138
|
+
*
|
|
139
|
+
* Evaluation order:
|
|
140
|
+
* - If `visibilityExpression` is provided and evaluates to false, decorator is never passed to AsyncList
|
|
141
|
+
* - If `visibilityExpression` is true (or undefined), decorator proceeds to AsyncList
|
|
142
|
+
* - AsyncList then evaluates `visibleFor` per-item to determine final visibility
|
|
143
|
+
*
|
|
144
|
+
* Both conditions must be true for the decorator to be visible.
|
|
145
|
+
*/
|
|
146
|
+
export interface ItemDecoratorConfig<T extends ListItem = ListItem> {
|
|
147
|
+
id: string;
|
|
148
|
+
iconId: IconIds;
|
|
149
|
+
color?: IconColors;
|
|
150
|
+
tooltip?: string;
|
|
151
|
+
/**
|
|
152
|
+
* Context-based visibility expression (evaluated against studio context).
|
|
153
|
+
* If false, decorator is filtered out before reaching AsyncList.
|
|
154
|
+
* Example: "activePage == 'artifacts-page'"
|
|
155
|
+
*/
|
|
156
|
+
visibilityExpression?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Item-specific visibility function (evaluated per-item during rendering).
|
|
159
|
+
* If false, decorator is hidden for that specific item.
|
|
160
|
+
* Example: (item) => item.hasWarning
|
|
161
|
+
*/
|
|
162
|
+
visibleFor?: (item: T) => boolean;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Resolved decorator ready to render
|
|
166
|
+
*/
|
|
167
|
+
export interface ResolvedDecorator {
|
|
168
|
+
id: string;
|
|
169
|
+
iconId: IconIds;
|
|
170
|
+
color?: IconColors;
|
|
171
|
+
tooltip?: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Content renderer function for custom item content.
|
|
175
|
+
* Matches NodeContentRenderer signature for consistency between list and tree views.
|
|
176
|
+
*
|
|
177
|
+
* @param item - The list item to render
|
|
178
|
+
* @param isSelected - Whether the item is currently selected (optional for backwards compatibility)
|
|
179
|
+
* @returns React content to render
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```tsx
|
|
183
|
+
* const itemContentRenderer: ItemContentRenderer<MyItem> = (item, isSelected) => (
|
|
184
|
+
* <div className={isSelected ? 'selected' : ''}>
|
|
185
|
+
* <span>{item.name}</span>
|
|
186
|
+
* <CustomBadge status={item.status} />
|
|
187
|
+
* </div>
|
|
188
|
+
* );
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export type ItemContentRenderer<T extends ListItem = ListItem> = (item: T, isSelected?: boolean) => ReactNode;
|
|
192
|
+
/**
|
|
193
|
+
* Props for rendering an async list item.
|
|
194
|
+
*
|
|
195
|
+
* @category Components
|
|
196
|
+
* @typeParam T - The ListItem type for this item
|
|
197
|
+
*/
|
|
198
|
+
export type AsyncListItemTemplateProps<T extends ListItem = ListItem> = T & {
|
|
199
|
+
/** CSS class name for styling */
|
|
200
|
+
className?: string;
|
|
201
|
+
/** Custom content - when provided, replaces default content rendering */
|
|
202
|
+
children?: ReactNode;
|
|
203
|
+
/** Resolved icon ID for this item */
|
|
204
|
+
iconId?: IconConfig["iconId"];
|
|
205
|
+
/** Resolved icon color for this item */
|
|
206
|
+
iconColor?: IconConfig["color"];
|
|
207
|
+
/** Resolved action buttons for this item */
|
|
208
|
+
actions?: ResolvedAction[];
|
|
209
|
+
/** Resolved decorators for this item */
|
|
210
|
+
decorators?: ResolvedDecorator[];
|
|
211
|
+
/** Data attribute for depth (for nested contexts) */
|
|
212
|
+
"data-depth"?: number;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Basic data provider interface for async lists
|
|
216
|
+
* Can be extended for pagination, cursor-based loading, etc.
|
|
217
|
+
*/
|
|
218
|
+
export interface AsyncListDataProvider<I extends Record<string, any>, T extends ListItem = ListItem> {
|
|
219
|
+
/** Observable items array */
|
|
220
|
+
items: T[];
|
|
221
|
+
/** Original items map for resolving actions */
|
|
222
|
+
originalItems: Map<string, I>;
|
|
223
|
+
/**
|
|
224
|
+
* Observable loading state.
|
|
225
|
+
* True when the provider is loading data (initialization, activation, etc.)
|
|
226
|
+
*/
|
|
227
|
+
isLoading?: boolean;
|
|
228
|
+
/** Initialize the provider */
|
|
229
|
+
init(): Promise<void>;
|
|
230
|
+
/** Dispose of the provider */
|
|
231
|
+
dispose(): void;
|
|
232
|
+
/** Promise that resolves when provider is ready */
|
|
233
|
+
whenReady?: () => Promise<void>;
|
|
234
|
+
/** Refresh the data */
|
|
235
|
+
refresh?: () => Promise<void>;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Factory for creating item templates based on item data.
|
|
239
|
+
* Enables dynamic template selection for different item types or states.
|
|
240
|
+
*
|
|
241
|
+
* @category Components
|
|
242
|
+
* @typeParam T - The ListItem type for this factory
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```tsx
|
|
246
|
+
* const itemFactory: AsyncListItemTemplateFactory<MyItem> = {
|
|
247
|
+
* build: (item) => {
|
|
248
|
+
* if (item.type === 'folder') return FolderTemplate;
|
|
249
|
+
* return FileTemplate;
|
|
250
|
+
* }
|
|
251
|
+
* };
|
|
252
|
+
*
|
|
253
|
+
* <AsyncList ItemTemplate={itemFactory} dataProvider={provider} />
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export interface AsyncListItemTemplateFactory<T extends ListItem> {
|
|
257
|
+
/** Build an item component based on item data */
|
|
258
|
+
build: (item: T) => FunctionComponent<AsyncListItemTemplateProps<T>>;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Item template type - can be a static component or a factory.
|
|
262
|
+
*
|
|
263
|
+
* Use a factory when you need to dynamically select templates based on item data.
|
|
264
|
+
* Use a static component when all items share the same template.
|
|
265
|
+
*
|
|
266
|
+
* @category Components
|
|
267
|
+
* @typeParam T - The ListItem type for this template
|
|
268
|
+
*/
|
|
269
|
+
export type AsyncListItemTemplateType<T extends ListItem> = FunctionComponent<AsyncListItemTemplateProps<T>> | AsyncListItemTemplateFactory<T>;
|
|
270
|
+
/**
|
|
271
|
+
* Expression function that extracts a group name from a transformed item.
|
|
272
|
+
* Returns the group name string, or undefined for ungrouped items.
|
|
273
|
+
*
|
|
274
|
+
* Ungrouped items (returning undefined) appear at the top of the list.
|
|
275
|
+
* Groups are sorted alphabetically by their group name.
|
|
276
|
+
*
|
|
277
|
+
* @typeParam T - The transformed ListItem type
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* const groupExpression: ItemGroupExpression<MyItem> = (item) => item.category;
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
export type ItemGroupExpression<T extends ListItem = ListItem> = (item: T) => string | undefined;
|
|
285
|
+
export { isItemTemplateFactory } from './helpers/is-item-template-factory';
|
|
286
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/libraries/base-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C,CAAC,CAAC,CAAC,CAAC;CACtE;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,QAAQ,IACpD,iBAAiB,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,GAChD,4BAA4B,CAAC,CAAC,CAAC,CAAC;AAEpC;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,IAAI,CAC/D,IAAI,EAAE,CAAC,KACJ,MAAM,GAAG,SAAS,CAAC;AAGxB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { AsyncTreeBranch, AsyncTreeDataProvider, BranchLoadingState } from './async-tree-data-provider';
|
|
2
2
|
import { InputFilterAware, InputSortAware, ListItem, OutputFilterAware, OutputSortAware, DataProviderContext, DataProviderContextAware, ItemMap } from '../types';
|
|
3
|
-
import { IObservableArray } from 'mobx';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
|
-
* Base implementation of async tree data provider with
|
|
5
|
+
* Base implementation of async tree data provider with node-map architecture.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
7
|
+
* ARCHITECTURE:
|
|
8
|
+
* - Single `_nodes` map stores all node data (original, transformed, children, fetch state)
|
|
9
|
+
* - `_rootIds` array tracks root node order
|
|
10
|
+
* - Tree structure is derived from the flat node map
|
|
11
|
+
* - Supports both eager (all data upfront) and lazy (fetch on expand) loading
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* - Branch cache maintains object references across recomputations
|
|
13
|
+
* LOADING STRATEGIES:
|
|
14
|
+
* - Eager: All data available in model, tree built synchronously
|
|
15
|
+
* - Lazy: Children fetched on demand via expandBranch()
|
|
16
|
+
* - expandAll(): Recursively expands all nodes (for expandedMode)
|
|
18
17
|
*
|
|
19
18
|
* DATA PIPELINE:
|
|
20
19
|
* Raw Items (I[])
|
|
@@ -23,53 +22,60 @@ import { IObservableArray } from 'mobx';
|
|
|
23
22
|
* → itemMap (transform I → T)
|
|
24
23
|
* → filterItem (egress filter on T)
|
|
25
24
|
* → sortItem (egress sort on T)
|
|
26
|
-
* → Build
|
|
25
|
+
* → Build tree from node map
|
|
27
26
|
*
|
|
28
27
|
* @category Data Providers
|
|
29
28
|
* @typeParam P - Parent model type that provides data
|
|
30
29
|
* @typeParam I - Raw input item type from the data source
|
|
31
30
|
* @typeParam T - Transformed ListItem type for display
|
|
32
31
|
* @typeParam C - Context data type for filtering and sorting
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* class MyTreeProvider extends BaseAsyncTreeDataProvider<Model, RawItem, TreeItem> {
|
|
37
|
-
* constructor(model: Model) {
|
|
38
|
-
* super(
|
|
39
|
-
* model,
|
|
40
|
-
* async function() { return await this.getRoots(); },
|
|
41
|
-
* async function(item) { return await this.getChildren(item.id); },
|
|
42
|
-
* (item) => ({ id: item.id, name: item.name })
|
|
43
|
-
* );
|
|
44
|
-
* }
|
|
45
|
-
*
|
|
46
|
-
* hasChildren(item: RawItem) { return item.type === 'folder'; }
|
|
47
|
-
* getItemId(item: RawItem) { return item.id; }
|
|
48
|
-
* }
|
|
49
|
-
* ```
|
|
50
|
-
*
|
|
51
|
-
* @see {@link AsyncTreeDataProvider} for the interface this implements
|
|
52
|
-
* @see {@link AsyncTreeList} for the React component that uses this provider
|
|
53
|
-
*
|
|
54
|
-
* @author TBD
|
|
55
|
-
* @version 2.1.1
|
|
56
32
|
*/
|
|
57
33
|
export declare abstract class BaseAsyncTreeDataProvider<P extends Record<string, any>, I extends Record<string, any>, T extends ListItem = ListItem, C extends Record<string, any> = Record<string, any>> implements AsyncTreeDataProvider<I, T, C>, InputSortAware<I>, InputFilterAware<I, C>, OutputSortAware<T>, OutputFilterAware<T, C>, DataProviderContextAware<C> {
|
|
58
34
|
protected parent: P;
|
|
59
35
|
private _itemMap;
|
|
60
36
|
private rootResolver;
|
|
61
|
-
|
|
37
|
+
protected childResolver: (this: P, item: I, context?: DataProviderContext<C>) => Promise<I[]>;
|
|
62
38
|
private rootDisposer?;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Optional synchronous function for MobX tracking of root items.
|
|
41
|
+
* When provided, this is called inside the reaction to track observable dependencies.
|
|
42
|
+
* This is necessary because the async rootResolver can't be tracked by MobX.
|
|
43
|
+
*/
|
|
44
|
+
protected rootTrackingFn?: (parent: P, context?: DataProviderContext<C>) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Optional synchronous function for MobX tracking of child items.
|
|
47
|
+
* When provided, this is called inside child reactions to track observable dependencies.
|
|
48
|
+
*/
|
|
49
|
+
protected childTrackingFn?: (parent: P, item: I, context?: DataProviderContext<C>) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Single source of truth: all nodes keyed by ID
|
|
52
|
+
*/
|
|
53
|
+
private _nodes;
|
|
54
|
+
/**
|
|
55
|
+
* Root node IDs in display order
|
|
56
|
+
*/
|
|
57
|
+
private _rootIds;
|
|
58
|
+
/**
|
|
59
|
+
* Provider context for filtering/sorting
|
|
60
|
+
*/
|
|
67
61
|
context: DataProviderContext<C>;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Version tracking for manual refresh
|
|
64
|
+
*/
|
|
71
65
|
version: number;
|
|
66
|
+
/**
|
|
67
|
+
* Whether provider is initialized
|
|
68
|
+
*/
|
|
72
69
|
initialized: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether expandAll is in progress
|
|
72
|
+
*/
|
|
73
|
+
private _expandingAll;
|
|
74
|
+
/**
|
|
75
|
+
* Reaction disposers for expanded branches.
|
|
76
|
+
* Tracks observable changes in children for each expanded node.
|
|
77
|
+
*/
|
|
78
|
+
private _childDisposers;
|
|
73
79
|
constructor(parent: P, rootResolver: (this: P, context?: DataProviderContext<C>) => Promise<I[]>, childResolver: (this: P, item: I, context?: DataProviderContext<C>) => Promise<I[]>, itemMap: ItemMap<I, T, C>, contextData?: C);
|
|
74
80
|
/**
|
|
75
81
|
* Abstract method to check if an item has children.
|
|
@@ -128,49 +134,104 @@ export declare abstract class BaseAsyncTreeDataProvider<P extends Record<string,
|
|
|
128
134
|
removeContextValue(key: keyof C): void;
|
|
129
135
|
/**
|
|
130
136
|
* Computed tree structure with loading states.
|
|
131
|
-
*
|
|
137
|
+
* Derived from the flat node map.
|
|
132
138
|
*/
|
|
133
139
|
get tree(): AsyncTreeBranch<T>[];
|
|
134
140
|
/**
|
|
135
|
-
* Computed
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
141
|
+
* Computed root items array for interface compatibility.
|
|
142
|
+
*/
|
|
143
|
+
get rootItems(): I[];
|
|
144
|
+
/**
|
|
145
|
+
* Computed loading states map for interface compatibility.
|
|
146
|
+
*/
|
|
147
|
+
get loadingStates(): Map<string, BranchLoadingState>;
|
|
148
|
+
/**
|
|
149
|
+
* Computed loaded children map for interface compatibility.
|
|
150
|
+
*/
|
|
151
|
+
get loadedChildren(): Map<string, I[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Computed original items map for interface compatibility.
|
|
139
154
|
*/
|
|
140
155
|
get originalItems(): ReadonlyMap<string, I>;
|
|
141
156
|
/**
|
|
142
|
-
* Build
|
|
143
|
-
* MobX tracks individual map entries, so only affected branches recompute.
|
|
157
|
+
* Build a branch and its children from the node map.
|
|
144
158
|
*/
|
|
145
|
-
private
|
|
159
|
+
private buildBranch;
|
|
160
|
+
/**
|
|
161
|
+
* Add or update a node in the map.
|
|
162
|
+
* If the node is being moved (parentId changed), removes it from the old parent's children.
|
|
163
|
+
*/
|
|
164
|
+
private setNode;
|
|
165
|
+
/**
|
|
166
|
+
* Set children for a node.
|
|
167
|
+
*/
|
|
168
|
+
private setChildren;
|
|
146
169
|
/**
|
|
147
170
|
* Expand a branch and load its children if not already loaded.
|
|
148
|
-
* Sets up reactive tracking
|
|
149
|
-
*
|
|
171
|
+
* Sets up reactive tracking to automatically reload children when
|
|
172
|
+
* the underlying data changes.
|
|
150
173
|
*/
|
|
151
174
|
expandBranch(itemId: string, item: I): Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Set up a reaction to track changes in a branch's children.
|
|
177
|
+
* When the childResolver's observable dependencies change, the children are reloaded.
|
|
178
|
+
*/
|
|
179
|
+
private setupChildReaction;
|
|
180
|
+
/**
|
|
181
|
+
* Reload children for a specific branch without full re-initialization.
|
|
182
|
+
* Called by the kosAutoEffect when child data changes.
|
|
183
|
+
*/
|
|
184
|
+
private reloadChildren;
|
|
185
|
+
/**
|
|
186
|
+
* Dispose of a child reaction for a specific branch.
|
|
187
|
+
*/
|
|
188
|
+
private disposeChildReaction;
|
|
189
|
+
/**
|
|
190
|
+
* Expand all nodes recursively.
|
|
191
|
+
* Call this when expandedMode is true.
|
|
192
|
+
*
|
|
193
|
+
* @returns Promise that resolves when all nodes are expanded
|
|
194
|
+
*/
|
|
195
|
+
expandAll(): Promise<void>;
|
|
196
|
+
/**
|
|
197
|
+
* Recursively expand nodes that have children.
|
|
198
|
+
*/
|
|
199
|
+
private expandNodesRecursively;
|
|
152
200
|
/**
|
|
153
201
|
* Collapse a branch.
|
|
154
|
-
*
|
|
202
|
+
* Clears loaded children and disposes of child reaction to free memory.
|
|
155
203
|
*/
|
|
156
204
|
collapseBranch(itemId: string): void;
|
|
205
|
+
/**
|
|
206
|
+
* Recursively dispose of child reactions for all descendants.
|
|
207
|
+
*/
|
|
208
|
+
private disposeDescendantReactions;
|
|
209
|
+
/**
|
|
210
|
+
* Recursively remove children from the node map.
|
|
211
|
+
*/
|
|
212
|
+
private removeChildrenRecursively;
|
|
157
213
|
/**
|
|
158
214
|
* Clear cached children for a branch or all branches.
|
|
159
|
-
* Disposes child reactions for cleared branches.
|
|
160
215
|
*/
|
|
161
216
|
clearCache(itemId?: string): void;
|
|
162
217
|
/**
|
|
163
218
|
* Initialize the data provider.
|
|
164
219
|
* Loads root items and sets up reactivity.
|
|
220
|
+
* If already initialized, clears cache and reloads.
|
|
165
221
|
*/
|
|
166
222
|
init(): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Reload root items without full re-initialization.
|
|
225
|
+
* Called by the kosAutoEffect when model data changes.
|
|
226
|
+
*/
|
|
227
|
+
private reloadRoots;
|
|
167
228
|
/**
|
|
168
229
|
* Wait for the provider to be initialized.
|
|
169
230
|
*/
|
|
170
231
|
whenReady(): Promise<void>;
|
|
171
232
|
/**
|
|
172
233
|
* Dispose of the data provider.
|
|
173
|
-
* Cleans up all
|
|
234
|
+
* Cleans up all state.
|
|
174
235
|
*/
|
|
175
236
|
dispose(): void;
|
|
176
237
|
}
|
package/components/molecules/list/common/data-providers/base-async-tree-data-provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-async-tree-data-provider.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/libraries/base-ui-components/src/components/molecules/list/common/data-providers/base-async-tree-data-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"base-async-tree-data-provider.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/libraries/base-ui-components/src/components/molecules/list/common/data-providers/base-async-tree-data-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH,OAAO,EAEL,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,OAAO,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAyBpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;A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