xmlui 0.10.15 → 0.10.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/{index-axjeT2uJ.mjs → index-D4RYJasT.mjs} +2251 -575
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-BoTWMs19.mjs → initMock-qzTZlH-6.mjs} +1 -1
- package/dist/lib/xmlui-parser.d.ts +1 -1
- package/dist/lib/xmlui.d.ts +4 -6
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{collectedComponentMetadata-CQywuPDB.mjs → collectedComponentMetadata-BQaefK3f.mjs} +2536 -861
- package/dist/metadata/{initMock-Bi5kF5Af.mjs → initMock-Cz6QssI3.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/Animation/AnimationNative.js +5 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +1 -5
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +263 -82
- package/dist/scripts/src/components/Form/FormNative.js +33 -25
- package/dist/scripts/src/components/Icon/IconNative.js +18 -15
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -4
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +109 -426
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +18 -4
- package/dist/scripts/src/components/Option/Option.js +3 -1
- package/dist/scripts/src/components/Select/HiddenOption.js +1 -1
- package/dist/scripts/src/components/Slider/Slider.spec.js +46 -13
- package/dist/scripts/src/components/Slider/SliderNative.js +19 -9
- package/dist/scripts/src/components/Tree/Tree-dynamic.spec.js +2894 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +2932 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +266 -10
- package/dist/scripts/src/components/Tree/TreeNative.js +1048 -23
- package/dist/scripts/src/components/Tree/testData.js +272 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +1 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +13 -14
- package/dist/scripts/src/components-core/utils/treeUtils.js +187 -12
- package/dist/scripts/src/testing/ComponentDrivers.js +77 -3
- package/dist/scripts/src/testing/drivers/NumberBoxDriver.js +2 -2
- package/dist/scripts/src/testing/drivers/TreeDriver.js +13 -0
- package/dist/scripts/src/testing/fixtures.js +7 -2
- package/dist/standalone/xmlui-standalone.es.d.ts +4 -6
- package/dist/standalone/xmlui-standalone.umd.js +34 -34
- package/package.json +1 -1
- package/dist/scripts/src/components/Animation/Animation.js +0 -50
- package/dist/scripts/src/testing/drivers/SliderDriver.js +0 -20
|
@@ -1,31 +1,287 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.treeComponentRenderer = exports.TreeMd = void 0;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
8
|
const renderers_1 = require("../../components-core/renderers");
|
|
9
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
6
10
|
const container_helpers_1 = require("../container-helpers");
|
|
7
11
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
8
12
|
const TreeNative_1 = require("./TreeNative");
|
|
13
|
+
const TreeComponent_module_scss_1 = __importDefault(require("./TreeComponent.module.scss"));
|
|
9
14
|
const COMP = "Tree";
|
|
10
15
|
exports.TreeMd = (0, metadata_helpers_1.createMetadata)({
|
|
11
|
-
status: "
|
|
12
|
-
description: `The \`${COMP}\` component is a virtualized tree component that displays hierarchical data.`,
|
|
16
|
+
status: "stable",
|
|
17
|
+
description: `The \`${COMP}\` component is a virtualized tree component that displays hierarchical data with support for flat and hierarchy data formats.`,
|
|
13
18
|
props: {
|
|
14
19
|
data: {
|
|
15
|
-
description: `The data source of the tree.`,
|
|
16
|
-
|
|
20
|
+
description: `The data source of the tree. Format depends on the dataFormat property.`,
|
|
21
|
+
isRequired: true,
|
|
17
22
|
},
|
|
18
|
-
|
|
19
|
-
description: `The
|
|
23
|
+
dataFormat: {
|
|
24
|
+
description: `The input data structure format: "flat" (array with parent relationships) or "hierarchy" (nested objects).`,
|
|
25
|
+
valueType: "string",
|
|
26
|
+
defaultValue: TreeNative_1.defaultProps.dataFormat,
|
|
27
|
+
},
|
|
28
|
+
idField: {
|
|
29
|
+
description: `The property name in source data for unique identifiers.`,
|
|
30
|
+
valueType: "string",
|
|
31
|
+
defaultValue: TreeNative_1.defaultProps.idField,
|
|
32
|
+
},
|
|
33
|
+
nameField: {
|
|
34
|
+
description: `The property name in source data for display text.`,
|
|
35
|
+
valueType: "string",
|
|
36
|
+
defaultValue: TreeNative_1.defaultProps.nameField,
|
|
37
|
+
},
|
|
38
|
+
iconField: {
|
|
39
|
+
description: `The property name in source data for icon identifiers.`,
|
|
40
|
+
valueType: "string",
|
|
41
|
+
defaultValue: TreeNative_1.defaultProps.iconField,
|
|
42
|
+
},
|
|
43
|
+
iconExpandedField: {
|
|
44
|
+
description: `The property name in source data for expanded state icons.`,
|
|
45
|
+
valueType: "string",
|
|
46
|
+
defaultValue: TreeNative_1.defaultProps.iconExpandedField,
|
|
47
|
+
},
|
|
48
|
+
iconCollapsedField: {
|
|
49
|
+
description: `The property name in source data for collapsed state icons.`,
|
|
50
|
+
valueType: "string",
|
|
51
|
+
defaultValue: TreeNative_1.defaultProps.iconCollapsedField,
|
|
52
|
+
},
|
|
53
|
+
parentIdField: {
|
|
54
|
+
description: `The property name in source data for parent relationships (used in flat format).`,
|
|
55
|
+
valueType: "string",
|
|
56
|
+
defaultValue: TreeNative_1.defaultProps.parentIdField,
|
|
57
|
+
},
|
|
58
|
+
childrenField: {
|
|
59
|
+
description: `The property name in source data for child arrays (used in hierarchy format).`,
|
|
60
|
+
valueType: "string",
|
|
61
|
+
defaultValue: TreeNative_1.defaultProps.childrenField,
|
|
62
|
+
},
|
|
63
|
+
selectableField: {
|
|
64
|
+
description: `The property name in source data for selectable state (default: "selectable").`,
|
|
65
|
+
valueType: "string",
|
|
66
|
+
defaultValue: TreeNative_1.defaultProps.selectableField,
|
|
67
|
+
},
|
|
68
|
+
selectedValue: {
|
|
69
|
+
description: `The selected item ID in source data format.`,
|
|
70
|
+
},
|
|
71
|
+
defaultExpanded: {
|
|
72
|
+
description: `Initial expansion state: "none", "all", "first-level", or array of specific IDs.`,
|
|
73
|
+
valueType: "string",
|
|
74
|
+
defaultValue: TreeNative_1.defaultProps.defaultExpanded,
|
|
75
|
+
},
|
|
76
|
+
autoExpandToSelection: {
|
|
77
|
+
description: `Automatically expand the path to the selected item.`,
|
|
78
|
+
valueType: "boolean",
|
|
79
|
+
defaultValue: TreeNative_1.defaultProps.autoExpandToSelection,
|
|
80
|
+
},
|
|
81
|
+
itemClickExpands: {
|
|
82
|
+
description: "Whether clicking anywhere on a tree item should expand/collapse the node, not just the expand/collapse icon.",
|
|
83
|
+
valueType: "boolean",
|
|
84
|
+
defaultValue: TreeNative_1.defaultProps.itemClickExpands,
|
|
85
|
+
},
|
|
86
|
+
iconCollapsed: {
|
|
87
|
+
description: `The icon name to use for collapsed nodes (default: "chevronright").`,
|
|
88
|
+
valueType: "string",
|
|
89
|
+
defaultValue: TreeNative_1.defaultProps.iconCollapsed,
|
|
90
|
+
},
|
|
91
|
+
iconExpanded: {
|
|
92
|
+
description: `The icon name to use for expanded nodes (default: "chevrondown").`,
|
|
93
|
+
valueType: "string",
|
|
94
|
+
defaultValue: TreeNative_1.defaultProps.iconExpanded,
|
|
95
|
+
},
|
|
96
|
+
iconSize: {
|
|
97
|
+
description: `The size of the expand/collapse icons (default: "16").`,
|
|
98
|
+
valueType: "string",
|
|
99
|
+
defaultValue: TreeNative_1.defaultProps.iconSize,
|
|
100
|
+
},
|
|
101
|
+
itemHeight: {
|
|
102
|
+
description: `The height of each tree row in pixels (default: 35).`,
|
|
103
|
+
valueType: "number",
|
|
104
|
+
defaultValue: TreeNative_1.defaultProps.itemHeight,
|
|
105
|
+
},
|
|
106
|
+
animateExpand: {
|
|
107
|
+
description: `When true, uses only the collapsed icon and rotates it for expansion instead of switching icons (default: false).`,
|
|
108
|
+
valueType: "boolean",
|
|
109
|
+
defaultValue: TreeNative_1.defaultProps.animateExpand,
|
|
110
|
+
},
|
|
111
|
+
expandRotation: {
|
|
112
|
+
description: `The number of degrees to rotate the collapsed icon when expanded in animate mode (default: 90).`,
|
|
113
|
+
valueType: "number",
|
|
114
|
+
defaultValue: TreeNative_1.defaultProps.expandRotation,
|
|
115
|
+
},
|
|
116
|
+
dynamicField: {
|
|
117
|
+
description: `The property name in source data for dynamic loading state (default: "dynamic").`,
|
|
118
|
+
valueType: "string",
|
|
119
|
+
defaultValue: TreeNative_1.defaultProps.dynamicField,
|
|
120
|
+
},
|
|
121
|
+
itemTemplate: {
|
|
122
|
+
description: "The template for each item in the tree.",
|
|
123
|
+
valueType: "ComponentDef",
|
|
20
124
|
},
|
|
21
|
-
|
|
125
|
+
},
|
|
126
|
+
events: {
|
|
127
|
+
selectionDidChange: {
|
|
128
|
+
description: `Fired when the tree selection changes.`,
|
|
129
|
+
signature: `(event: TreeSelectionEvent) => void`,
|
|
130
|
+
},
|
|
131
|
+
nodeDidExpand: {
|
|
132
|
+
description: `Fired when a tree node is expanded.`,
|
|
133
|
+
signature: `(node: FlatTreeNode) => void`,
|
|
134
|
+
},
|
|
135
|
+
nodeDidCollapse: {
|
|
136
|
+
description: `Fired when a tree node is collapsed.`,
|
|
137
|
+
signature: `(node: FlatTreeNode) => void`,
|
|
138
|
+
},
|
|
139
|
+
loadChildren: {
|
|
140
|
+
description: `Fired when a tree node needs to load children dynamically. Should return a Promise that resolves to an array of child data.`,
|
|
141
|
+
signature: `(node: FlatTreeNode) => Promise<any[]>`,
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
apis: {
|
|
145
|
+
expandAll: {
|
|
146
|
+
description: `Expand all nodes in the tree.`,
|
|
147
|
+
signature: "expandAll(): void",
|
|
148
|
+
},
|
|
149
|
+
collapseAll: {
|
|
150
|
+
description: `Collapse all nodes in the tree.`,
|
|
151
|
+
signature: "collapseAll(): void",
|
|
152
|
+
},
|
|
153
|
+
expandToLevel: {
|
|
154
|
+
description: `Expand nodes up to the specified depth level (0-based).`,
|
|
155
|
+
signature: "expandToLevel(level: number): void",
|
|
156
|
+
parameters: {
|
|
157
|
+
level: "The maximum depth level to expand (0 = root level only)",
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
expandNode: {
|
|
161
|
+
description: `Expand a specific node by its source data ID.`,
|
|
162
|
+
signature: "expandNode(nodeId: string): void",
|
|
163
|
+
parameters: {
|
|
164
|
+
nodeId: "The ID of the node to expand (source data format)",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
collapseNode: {
|
|
168
|
+
description: `Collapse a specific node by its source data ID.`,
|
|
169
|
+
signature: "collapseNode(nodeId: string): void",
|
|
170
|
+
parameters: {
|
|
171
|
+
nodeId: "The ID of the node to collapse (source data format)",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
selectNode: {
|
|
175
|
+
description: `Programmatically select a node by its source data ID.`,
|
|
176
|
+
signature: "selectNode(nodeId: string): void",
|
|
177
|
+
parameters: {
|
|
178
|
+
nodeId: "The ID of the node to select (source data format)",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
clearSelection: {
|
|
182
|
+
description: `Clear the current selection.`,
|
|
183
|
+
signature: "clearSelection(): void",
|
|
184
|
+
},
|
|
185
|
+
getNodeById: {
|
|
186
|
+
description: `Get a tree node by its source data ID.`,
|
|
187
|
+
signature: "getNodeById(nodeId: string): TreeNode | null",
|
|
188
|
+
parameters: {
|
|
189
|
+
nodeId: "The ID of the node to retrieve (source data format)",
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
getExpandedNodes: {
|
|
193
|
+
description: `Get an array of currently expanded node IDs in source data format.`,
|
|
194
|
+
signature: "getExpandedNodes(): string[]",
|
|
195
|
+
},
|
|
196
|
+
getSelectedNode: {
|
|
197
|
+
description: `Get the currently selected tree node.`,
|
|
198
|
+
signature: "getSelectedNode(): TreeNode | null",
|
|
199
|
+
},
|
|
200
|
+
appendNode: {
|
|
201
|
+
description: `Add a new node to the tree as a child of the specified parent node.`,
|
|
202
|
+
signature: "appendNode(parentNodeId: string | number | null, nodeData: any): void",
|
|
203
|
+
parameters: {
|
|
204
|
+
parentNodeId: "The ID of the parent node, or null/undefined to add to root level",
|
|
205
|
+
nodeData: "The node data object using the format specified in dataFormat and field properties",
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
removeNode: {
|
|
209
|
+
description: `Remove a node and all its descendants from the tree.`,
|
|
210
|
+
signature: "removeNode(nodeId: string | number): void",
|
|
211
|
+
parameters: {
|
|
212
|
+
nodeId: "The ID of the node to remove (along with all its descendants)",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
removeChildren: {
|
|
216
|
+
description: `Remove all children (descendants) of a node while keeping the node itself.`,
|
|
217
|
+
signature: "removeChildren(nodeId: string | number): void",
|
|
218
|
+
parameters: {
|
|
219
|
+
nodeId: "The ID of the parent node whose children should be removed",
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
insertNodeBefore: {
|
|
223
|
+
description: `Insert a new node before an existing node at the same level.`,
|
|
224
|
+
signature: "insertNodeBefore(beforeNodeId: string | number, nodeData: any): void",
|
|
225
|
+
parameters: {
|
|
226
|
+
beforeNodeId: "The ID of the existing node before which the new node should be inserted",
|
|
227
|
+
nodeData: "The node data object using the format specified in dataFormat and field properties",
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
insertNodeAfter: {
|
|
231
|
+
description: `Insert a new node after an existing node at the same level.`,
|
|
232
|
+
signature: "insertNodeAfter(afterNodeId: string | number, nodeData: any): void",
|
|
233
|
+
parameters: {
|
|
234
|
+
afterNodeId: "The ID of the existing node after which the new node should be inserted",
|
|
235
|
+
nodeData: "The node data object using the format specified in dataFormat and field properties",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
themeVars: (0, themeVars_1.parseScssVar)(TreeComponent_module_scss_1.default.themeVars),
|
|
240
|
+
defaultThemeVars: {
|
|
241
|
+
[`backgroundColor-${COMP}-row--selected`]: "$color-primary-50",
|
|
242
|
+
[`backgroundColor-${COMP}-row--hover`]: "$color-surface-100",
|
|
243
|
+
[`textColor-${COMP}`]: "$textColor-primary",
|
|
244
|
+
[`textColor-${COMP}--selected`]: "$color-primary-900",
|
|
245
|
+
[`textColor-${COMP}--hover`]: "$textColor-primary",
|
|
246
|
+
[`borderColor-${COMP}-row--focus`]: "$color-primary-500",
|
|
247
|
+
[`outlineColor-${COMP}--focus`]: "$outlineColor--focus",
|
|
248
|
+
[`outlineWidth-${COMP}--focus`]: "$outlineWidth--focus",
|
|
249
|
+
[`outlineStyle-${COMP}--focus`]: "$outlineStyle--focus",
|
|
250
|
+
[`outlineOffset-${COMP}--focus`]: "$outlineOffset--focus",
|
|
22
251
|
},
|
|
23
252
|
});
|
|
24
253
|
/**
|
|
25
254
|
* This function defines the renderer for the Tree component.
|
|
26
255
|
*/
|
|
27
|
-
exports.treeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TreeMd, ({ node, extractValue, renderChild, className }) => {
|
|
28
|
-
|
|
29
|
-
|
|
256
|
+
exports.treeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TreeMd, ({ node, extractValue, renderChild, className, lookupEventHandler, registerComponentApi }) => {
|
|
257
|
+
// Default item template if none is provided:
|
|
258
|
+
// <HStack verticalAlignment="center">
|
|
259
|
+
// <Icon when="{$item.icon}" name="{$item.icon}" />
|
|
260
|
+
// <Text value="{$item.name}" />
|
|
261
|
+
// </HStack>
|
|
262
|
+
const defaultItemTemplate = {
|
|
263
|
+
type: "HStack",
|
|
264
|
+
props: {
|
|
265
|
+
verticalAlignment: "center",
|
|
266
|
+
},
|
|
267
|
+
children: [
|
|
268
|
+
{
|
|
269
|
+
type: "Icon",
|
|
270
|
+
when: "{$item.icon}",
|
|
271
|
+
props: {
|
|
272
|
+
name: "{$item.icon}",
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
type: "Text",
|
|
277
|
+
props: {
|
|
278
|
+
value: "{$item.name}",
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
};
|
|
283
|
+
return ((0, jsx_runtime_1.jsx)(TreeNative_1.TreeComponent, { registerComponentApi: registerComponentApi, className: className, data: extractValue(node.props.data), dataFormat: extractValue(node.props.dataFormat), idField: extractValue(node.props.idField), nameField: extractValue(node.props.nameField), iconField: extractValue(node.props.iconField), iconExpandedField: extractValue(node.props.iconExpandedField), iconCollapsedField: extractValue(node.props.iconCollapsedField), parentIdField: extractValue(node.props.parentIdField), childrenField: extractValue(node.props.childrenField), selectableField: extractValue(node.props.selectableField), dynamicField: extractValue(node.props.dynamicField), selectedValue: extractValue(node.props.selectedValue), selectedId: extractValue(node.props.selectedId), defaultExpanded: extractValue(node.props.defaultExpanded), autoExpandToSelection: extractValue(node.props.autoExpandToSelection), itemClickExpands: extractValue.asOptionalBoolean(node.props.itemClickExpands), iconCollapsed: extractValue(node.props.iconCollapsed), iconExpanded: extractValue(node.props.iconExpanded), iconSize: extractValue(node.props.iconSize), itemHeight: extractValue.asOptionalNumber(node.props.itemHeight, TreeNative_1.defaultProps.itemHeight), animateExpand: extractValue.asOptionalBoolean(node.props.animateExpand, TreeNative_1.defaultProps.animateExpand), expandRotation: extractValue.asOptionalNumber(node.props.expandRotation, TreeNative_1.defaultProps.expandRotation), onSelectionChanged: lookupEventHandler("selectionDidChange"), onNodeExpanded: lookupEventHandler("nodeDidExpand"), onNodeCollapsed: lookupEventHandler("nodeDidCollapse"), loadChildren: lookupEventHandler("loadChildren"), itemRenderer: (flatTreeNode) => {
|
|
284
|
+
const itemContext = Object.assign({ id: flatTreeNode.id, name: flatTreeNode.displayName, depth: flatTreeNode.depth, isExpanded: flatTreeNode.isExpanded, hasChildren: flatTreeNode.hasChildren }, flatTreeNode);
|
|
285
|
+
return node.props.itemTemplate ? ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.itemTemplate, item: itemContext, renderChild: renderChild })) : ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: defaultItemTemplate, item: itemContext, renderChild: renderChild }));
|
|
30
286
|
} }));
|
|
31
287
|
});
|