xmlui 0.10.15 → 0.10.18
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-Cy6Emsex.mjs} +3452 -1954
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-BoTWMs19.mjs → initMock-B-rmnC-t.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-CB63ngkU.mjs} +3845 -2357
- package/dist/metadata/{initMock-Bi5kF5Af.mjs → initMock-D0wDKF_I.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/Accordion/Accordion.spec.js +1 -1
- package/dist/scripts/src/components/Accordion/AccordionItemNative.js +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/AutoComplete.spec.js +29 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +262 -62
- package/dist/scripts/src/components/Checkbox/Checkbox.js +1 -5
- package/dist/scripts/src/components/ColorPicker/ColorPicker.js +2 -6
- package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +29 -0
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +12 -9
- package/dist/scripts/src/components/ComponentProvider.js +2 -0
- package/dist/scripts/src/components/DateInput/DateInput.js +1 -5
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +29 -0
- package/dist/scripts/src/components/DateInput/DateInputNative.js +12 -16
- package/dist/scripts/src/components/DatePicker/DatePicker.js +1 -5
- package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +29 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +12 -13
- package/dist/scripts/src/components/FileInput/FileInput.js +1 -5
- package/dist/scripts/src/components/FileInput/FileInput.spec.js +29 -0
- package/dist/scripts/src/components/FileInput/FileInputNative.js +14 -15
- package/dist/scripts/src/components/Form/Form.spec.js +11 -9
- package/dist/scripts/src/components/Form/FormNative.js +41 -27
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +179 -30
- package/dist/scripts/src/components/FormItem/FormItemNative.js +20 -22
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +8 -17
- package/dist/scripts/src/components/FormItem/Validations.js +25 -6
- package/dist/scripts/src/components/Icon/IconNative.js +18 -15
- package/dist/scripts/src/components/Input/PartialInput.js +2 -2
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBox.js +5 -9
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +142 -430
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +33 -21
- package/dist/scripts/src/components/Option/Option.js +3 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +1 -5
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +4 -5
- package/dist/scripts/src/components/RadioGroup/RadioItem.js +28 -0
- package/dist/scripts/src/components/Select/HiddenOption.js +1 -1
- package/dist/scripts/src/components/Select/Select.js +1 -5
- package/dist/scripts/src/components/Select/Select.spec.js +31 -3
- package/dist/scripts/src/components/Select/SelectNative.js +26 -32
- package/dist/scripts/src/components/Slider/Slider.js +1 -5
- package/dist/scripts/src/components/Slider/Slider.spec.js +75 -13
- package/dist/scripts/src/components/Slider/SliderNative.js +33 -24
- package/dist/scripts/src/components/Switch/Switch.js +1 -5
- package/dist/scripts/src/components/TextArea/TextArea.js +1 -5
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +29 -0
- package/dist/scripts/src/components/TextArea/TextAreaNative.js +8 -29
- package/dist/scripts/src/components/TextBox/TextBox.spec.js +38 -7
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +31 -0
- package/dist/scripts/src/components/Timer/Timer.spec.js +66 -96
- package/dist/scripts/src/components/Toggle/Toggle.js +28 -25
- package/dist/scripts/src/components/Tree/Tree-dynamic.spec.js +2894 -0
- package/dist/scripts/src/components/Tree/Tree-icons.spec.js +206 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +2839 -0
- package/dist/scripts/src/components/Tree/TreeComponent.js +303 -10
- package/dist/scripts/src/components/Tree/TreeNative.js +1090 -23
- package/dist/scripts/src/components/Tree/testData.js +296 -0
- package/dist/scripts/src/components-core/behaviors/Behavior.js +2 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +8 -4
- package/dist/scripts/src/components-core/rendering/AppRoot.js +1 -2
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +13 -15
- package/dist/scripts/src/components-core/utils/treeUtils.js +190 -12
- package/dist/scripts/src/testing/ComponentDrivers.js +79 -7
- 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 +36 -36
- package/package.json +1 -1
- package/dist/scripts/src/components/Animation/Animation.js +0 -50
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -54
- package/dist/scripts/src/testing/drivers/SliderDriver.js +0 -20
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.flatTreeDataWithIconsAndAlias2 = exports.flatTreeDataWithIcons2 = exports.flatTreeDataWithIconsAndAlias1 = exports.flatTreeDataWithIcons1 = exports.dynamicFlatData = exports.customDynamicTreeData = exports.dynamicTreeData = exports.hierarchyWithStateIcons = exports.customIconFieldHierarchy = exports.hierarchyDataWithIcons = exports.apiStyleHierarchy = exports.databaseStyleHierarchy = exports.customFieldsHierarchy2 = exports.customFieldsHierarchy1 = exports.dataWithStateIcons = exports.customIconFieldData = exports.flatDataWithIcons = exports.multiBranchTreeData = exports.apiStyleData = exports.databaseStyleData = exports.customFieldsData2 = exports.customFieldsData1 = exports.hierarchyTreeData = exports.flatTreeData = void 0;
|
|
4
|
+
exports.flatTreeData = [
|
|
5
|
+
{ id: 1, name: "Root Item 1", parentId: null },
|
|
6
|
+
{ id: 2, name: "Child Item 1.1", parentId: 1 },
|
|
7
|
+
{ id: 3, name: "Child Item 1.2", parentId: 1 },
|
|
8
|
+
{ id: 4, name: "Grandchild Item 1.1.1", parentId: 2 },
|
|
9
|
+
];
|
|
10
|
+
exports.hierarchyTreeData = [
|
|
11
|
+
{
|
|
12
|
+
id: 1,
|
|
13
|
+
name: "Root Item 1",
|
|
14
|
+
children: [
|
|
15
|
+
{ id: 2, name: "Child Item 1.1", children: [] },
|
|
16
|
+
{
|
|
17
|
+
id: 3,
|
|
18
|
+
name: "Child Item 1.2",
|
|
19
|
+
children: [{ id: 4, name: "Grandchild Item 1.2.1", children: [] }],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
// Test data with custom field names for field mapping validation
|
|
25
|
+
exports.customFieldsData1 = [
|
|
26
|
+
{ nodeId: "A1", title: "Root Item 1", parent: null },
|
|
27
|
+
{ nodeId: "A2", title: "Child Item 1.1", parent: "A1" },
|
|
28
|
+
{ nodeId: "A3", title: "Child Item 1.2", parent: "A1" },
|
|
29
|
+
{ nodeId: "A4", title: "Grandchild Item 1.1.1", parent: "A2" },
|
|
30
|
+
];
|
|
31
|
+
exports.customFieldsData2 = [
|
|
32
|
+
{ id: 100, displayName: "Root Item 1", parentId: null },
|
|
33
|
+
{ id: 101, displayName: "Child Item 1.1", parentId: 100 },
|
|
34
|
+
{ id: 102, displayName: "Child Item 1.2", parentId: 100 },
|
|
35
|
+
{ id: 103, displayName: "Grandchild Item 1.1.1", parentId: 101 },
|
|
36
|
+
];
|
|
37
|
+
exports.databaseStyleData = [
|
|
38
|
+
{ pk: "root-1", label: "Root Item 1", parent_id: null },
|
|
39
|
+
{ pk: "child-1", label: "Child Item 1.1", parent_id: "root-1" },
|
|
40
|
+
{ pk: "child-2", label: "Child Item 1.2", parent_id: "root-1" },
|
|
41
|
+
{ pk: "grandchild-1", label: "Grandchild Item 1.1.1", parent_id: "child-1" },
|
|
42
|
+
];
|
|
43
|
+
exports.apiStyleData = [
|
|
44
|
+
{ key: "item1", text: "Root Item 1", parentKey: undefined },
|
|
45
|
+
{ key: "item2", text: "Child Item 1.1", parentKey: "item1" },
|
|
46
|
+
{ key: "item3", text: "Child Item 1.2", parentKey: "item1" },
|
|
47
|
+
{ key: "item4", text: "Grandchild Item 1.1.1", parentKey: "item2" },
|
|
48
|
+
];
|
|
49
|
+
// Test data with multiple independent branches for comprehensive defaultExpanded testing
|
|
50
|
+
exports.multiBranchTreeData = [
|
|
51
|
+
// Branch A: Documents
|
|
52
|
+
{ id: "doc-root", name: "Documents", parentId: null },
|
|
53
|
+
{ id: "doc-reports", name: "Reports", parentId: "doc-root" },
|
|
54
|
+
{ id: "doc-invoices", name: "Invoices", parentId: "doc-root" },
|
|
55
|
+
{ id: "doc-q1-report", name: "Q1 Report.pdf", parentId: "doc-reports" },
|
|
56
|
+
{ id: "doc-q2-report", name: "Q2 Report.pdf", parentId: "doc-reports" },
|
|
57
|
+
{ id: "doc-inv-001", name: "Invoice-001.pdf", parentId: "doc-invoices" },
|
|
58
|
+
// Branch B: Projects
|
|
59
|
+
{ id: "proj-root", name: "Projects", parentId: null },
|
|
60
|
+
{ id: "proj-web", name: "Web Apps", parentId: "proj-root" },
|
|
61
|
+
{ id: "proj-mobile", name: "Mobile Apps", parentId: "proj-root" },
|
|
62
|
+
{ id: "proj-ecommerce", name: "E-commerce Site", parentId: "proj-web" },
|
|
63
|
+
{ id: "proj-dashboard", name: "Admin Dashboard", parentId: "proj-web" },
|
|
64
|
+
{ id: "proj-ios-app", name: "iOS Shopping App", parentId: "proj-mobile" },
|
|
65
|
+
// Branch C: Media
|
|
66
|
+
{ id: "media-root", name: "Media", parentId: null },
|
|
67
|
+
{ id: "media-images", name: "Images", parentId: "media-root" },
|
|
68
|
+
{ id: "media-videos", name: "Videos", parentId: "media-root" },
|
|
69
|
+
{ id: "media-profile-pic", name: "profile.jpg", parentId: "media-images" },
|
|
70
|
+
{ id: "media-banner", name: "banner.png", parentId: "media-images" },
|
|
71
|
+
];
|
|
72
|
+
// Test data with icon fields for icon mapping validation
|
|
73
|
+
exports.flatDataWithIcons = [
|
|
74
|
+
{ id: 1, name: "Documents", icon: "folder", parentId: null },
|
|
75
|
+
{ id: 2, name: "Report.pdf", icon: "file-pdf", parentId: 1 },
|
|
76
|
+
{ id: 3, name: "Images", icon: "folder", parentId: null },
|
|
77
|
+
{ id: 4, name: "Photo.jpg", icon: "file-image", parentId: 3 },
|
|
78
|
+
];
|
|
79
|
+
exports.customIconFieldData = [
|
|
80
|
+
{ nodeId: "A1", title: "Project", iconType: "project-folder", parent: null },
|
|
81
|
+
{ nodeId: "A2", title: "Source", iconType: "code-folder", parent: "A1" },
|
|
82
|
+
{ nodeId: "A3", title: "App.tsx", iconType: "typescript-file", parent: "A2" },
|
|
83
|
+
{ nodeId: "A4", title: "Utils.ts", iconType: "typescript-file", parent: "A2" },
|
|
84
|
+
];
|
|
85
|
+
exports.dataWithStateIcons = [
|
|
86
|
+
{
|
|
87
|
+
id: 1,
|
|
88
|
+
name: "Shared Folder",
|
|
89
|
+
icon: "folder",
|
|
90
|
+
iconExpanded: "folder-open",
|
|
91
|
+
iconCollapsed: "folder-closed",
|
|
92
|
+
parentId: null,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 2,
|
|
96
|
+
name: "Subfolder",
|
|
97
|
+
icon: "folder",
|
|
98
|
+
iconExpanded: "folder-open",
|
|
99
|
+
iconCollapsed: "folder-closed",
|
|
100
|
+
parentId: 1,
|
|
101
|
+
},
|
|
102
|
+
{ id: 3, name: "Document.txt", icon: "file-text", parentId: 2 },
|
|
103
|
+
];
|
|
104
|
+
// Hierarchical test data with custom field names for field mapping validation
|
|
105
|
+
exports.customFieldsHierarchy1 = [
|
|
106
|
+
{
|
|
107
|
+
nodeId: "A1",
|
|
108
|
+
title: "Root Item 1",
|
|
109
|
+
items: [
|
|
110
|
+
{
|
|
111
|
+
nodeId: "A2",
|
|
112
|
+
title: "Child Item 1.1",
|
|
113
|
+
items: [{ nodeId: "A4", title: "Grandchild Item 1.1.1", items: [] }],
|
|
114
|
+
},
|
|
115
|
+
{ nodeId: "A3", title: "Child Item 1.2", items: [] },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
exports.customFieldsHierarchy2 = [
|
|
120
|
+
{
|
|
121
|
+
id: 100,
|
|
122
|
+
displayName: "Root Item 1",
|
|
123
|
+
subNodes: [
|
|
124
|
+
{
|
|
125
|
+
id: 101,
|
|
126
|
+
displayName: "Child Item 1.1",
|
|
127
|
+
subNodes: [{ id: 103, displayName: "Grandchild Item 1.1.1", subNodes: [] }],
|
|
128
|
+
},
|
|
129
|
+
{ id: 102, displayName: "Child Item 1.2", subNodes: [] },
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
];
|
|
133
|
+
exports.databaseStyleHierarchy = [
|
|
134
|
+
{
|
|
135
|
+
pk: "root-1",
|
|
136
|
+
label: "Root Item 1",
|
|
137
|
+
nested_items: [
|
|
138
|
+
{
|
|
139
|
+
pk: "child-1",
|
|
140
|
+
label: "Child Item 1.1",
|
|
141
|
+
nested_items: [{ pk: "grandchild-1", label: "Grandchild Item 1.1.1", nested_items: [] }],
|
|
142
|
+
},
|
|
143
|
+
{ pk: "child-2", label: "Child Item 1.2", nested_items: [] },
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
];
|
|
147
|
+
exports.apiStyleHierarchy = [
|
|
148
|
+
{
|
|
149
|
+
key: "item1",
|
|
150
|
+
text: "Root Item 1",
|
|
151
|
+
nodes: [
|
|
152
|
+
{
|
|
153
|
+
key: "item2",
|
|
154
|
+
text: "Child Item 1.1",
|
|
155
|
+
nodes: [{ key: "item4", text: "Grandchild Item 1.1.1", nodes: [] }],
|
|
156
|
+
},
|
|
157
|
+
{ key: "item3", text: "Child Item 1.2", nodes: [] },
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
// Hierarchical test data with icon fields
|
|
162
|
+
exports.hierarchyDataWithIcons = [
|
|
163
|
+
{
|
|
164
|
+
id: 1,
|
|
165
|
+
name: "Documents",
|
|
166
|
+
icon: "folder",
|
|
167
|
+
children: [
|
|
168
|
+
{ id: 2, name: "Report.pdf", icon: "file-pdf", children: [] },
|
|
169
|
+
{
|
|
170
|
+
id: 3,
|
|
171
|
+
name: "Images",
|
|
172
|
+
icon: "folder",
|
|
173
|
+
children: [{ id: 4, name: "Photo.jpg", icon: "file-image", children: [] }],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
exports.customIconFieldHierarchy = [
|
|
179
|
+
{
|
|
180
|
+
nodeId: "A1",
|
|
181
|
+
title: "Project",
|
|
182
|
+
iconType: "project-folder",
|
|
183
|
+
items: [
|
|
184
|
+
{
|
|
185
|
+
nodeId: "A2",
|
|
186
|
+
title: "Source",
|
|
187
|
+
iconType: "code-folder",
|
|
188
|
+
items: [
|
|
189
|
+
{ nodeId: "A3", title: "App.tsx", iconType: "typescript-file", items: [] },
|
|
190
|
+
{ nodeId: "A4", title: "Utils.ts", iconType: "typescript-file", items: [] },
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
];
|
|
196
|
+
exports.hierarchyWithStateIcons = [
|
|
197
|
+
{
|
|
198
|
+
id: 1,
|
|
199
|
+
name: "Shared Folder",
|
|
200
|
+
icon: "folder",
|
|
201
|
+
iconExpanded: "folder-open",
|
|
202
|
+
iconCollapsed: "folder-closed",
|
|
203
|
+
children: [
|
|
204
|
+
{
|
|
205
|
+
id: 2,
|
|
206
|
+
name: "Subfolder",
|
|
207
|
+
icon: "folder",
|
|
208
|
+
iconExpanded: "folder-open",
|
|
209
|
+
iconCollapsed: "folder-closed",
|
|
210
|
+
children: [{ id: 3, name: "Document.txt", icon: "file-text", children: [] }],
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
];
|
|
215
|
+
exports.dynamicTreeData = [
|
|
216
|
+
{
|
|
217
|
+
id: 1,
|
|
218
|
+
name: "Normal Node",
|
|
219
|
+
children: [{ id: 2, name: "Child Node", children: [] }],
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
id: 3,
|
|
223
|
+
name: "Dynamic Node (no children)",
|
|
224
|
+
dynamic: true,
|
|
225
|
+
children: [],
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
id: 4,
|
|
229
|
+
name: "Regular Leaf Node",
|
|
230
|
+
children: [],
|
|
231
|
+
},
|
|
232
|
+
];
|
|
233
|
+
exports.customDynamicTreeData = [
|
|
234
|
+
{
|
|
235
|
+
id: 1,
|
|
236
|
+
name: "Normal Node",
|
|
237
|
+
children: [{ id: 2, name: "Child Node", children: [] }],
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: 3,
|
|
241
|
+
name: "Dynamic Node (no children)",
|
|
242
|
+
canLoadMore: true,
|
|
243
|
+
children: [],
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 4,
|
|
247
|
+
name: "Regular Leaf Node",
|
|
248
|
+
children: [],
|
|
249
|
+
},
|
|
250
|
+
];
|
|
251
|
+
exports.dynamicFlatData = [
|
|
252
|
+
{
|
|
253
|
+
id: 1,
|
|
254
|
+
name: "Normal Node",
|
|
255
|
+
parentId: null,
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: 2,
|
|
259
|
+
name: "Child Node",
|
|
260
|
+
parentId: 1,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
id: 3,
|
|
264
|
+
name: "Dynamic Node (no children)",
|
|
265
|
+
dynamic: true,
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
id: 4,
|
|
269
|
+
name: "Regular Leaf Node",
|
|
270
|
+
parentId: null,
|
|
271
|
+
},
|
|
272
|
+
];
|
|
273
|
+
exports.flatTreeDataWithIcons1 = [
|
|
274
|
+
{ id: 1, name: "Root Item 1", iconExpanded: "phone", parentId: null },
|
|
275
|
+
{ id: 2, name: "Child Item 1.1", iconExpanded: "email", parentId: 1 },
|
|
276
|
+
{ id: 3, name: "Child Item 1.2", parentId: 1 },
|
|
277
|
+
{ id: 4, name: "Grandchild Item 1.1.1", parentId: 2 },
|
|
278
|
+
];
|
|
279
|
+
exports.flatTreeDataWithIconsAndAlias1 = [
|
|
280
|
+
{ id: 1, name: "Root Item 1", iconExp: "phone", parentId: null },
|
|
281
|
+
{ id: 2, name: "Child Item 1.1", iconExp: "email", parentId: 1 },
|
|
282
|
+
{ id: 3, name: "Child Item 1.2", parentId: 1 },
|
|
283
|
+
{ id: 4, name: "Grandchild Item 1.1.1", parentId: 2 },
|
|
284
|
+
];
|
|
285
|
+
exports.flatTreeDataWithIcons2 = [
|
|
286
|
+
{ id: 1, name: "Root Item 1", iconCollapsed: "phone", parentId: null },
|
|
287
|
+
{ id: 2, name: "Child Item 1.1", iconCollapsed: "email", parentId: 1 },
|
|
288
|
+
{ id: 3, name: "Child Item 1.2", parentId: 1 },
|
|
289
|
+
{ id: 4, name: "Grandchild Item 1.1.1", parentId: 2 },
|
|
290
|
+
];
|
|
291
|
+
exports.flatTreeDataWithIconsAndAlias2 = [
|
|
292
|
+
{ id: 1, name: "Root Item 1", iconColl: "phone", parentId: null },
|
|
293
|
+
{ id: 2, name: "Child Item 1.1", iconColl: "email", parentId: 1 },
|
|
294
|
+
{ id: 3, name: "Child Item 1.2", parentId: 1 },
|
|
295
|
+
{ id: 4, name: "Grandchild Item 1.1.1", parentId: 2 },
|
|
296
|
+
];
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.labelBehavior = exports.animationBehavior = exports.tooltipBehavior = void 0;
|
|
3
|
+
exports.getCoreBehaviors = exports.labelBehavior = exports.animationBehavior = exports.tooltipBehavior = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
5
|
const AnimationNative_1 = require("../../components/Animation/AnimationNative");
|
|
7
6
|
const ItemWithLabel_1 = require("../../components/FormItem/ItemWithLabel");
|
|
8
7
|
const TooltipNative_1 = require("../../components/Tooltip/TooltipNative");
|
|
@@ -65,6 +64,7 @@ exports.labelBehavior = {
|
|
|
65
64
|
return true;
|
|
66
65
|
},
|
|
67
66
|
attach: (context, node) => {
|
|
67
|
+
var _a;
|
|
68
68
|
const { extractValue, node: componentNode, className } = context;
|
|
69
69
|
const label = extractValue.asOptionalString(componentNode.props.label);
|
|
70
70
|
const labelPosition = extractValue(componentNode.props.labelPosition);
|
|
@@ -74,7 +74,11 @@ exports.labelBehavior = {
|
|
|
74
74
|
const enabled = extractValue.asOptionalBoolean(componentNode.props.enabled, true);
|
|
75
75
|
const shrinkToLabel = extractValue.asOptionalBoolean(componentNode.props.shrinkToLabel);
|
|
76
76
|
const style = extractValue(componentNode.props.style);
|
|
77
|
-
const
|
|
78
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, {
|
|
77
|
+
const readOnly = extractValue.asOptionalBoolean(componentNode.props.readOnly);
|
|
78
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, style: style, className: className, shrinkToLabel: shrinkToLabel, labelStyle: { pointerEvents: readOnly ? "none" : undefined }, isInputTemplateUsed: !!((_a = componentNode.props) === null || _a === void 0 ? void 0 : _a.inputTemplate), children: node }));
|
|
79
79
|
},
|
|
80
80
|
};
|
|
81
|
+
const getCoreBehaviors = () => {
|
|
82
|
+
return [exports.tooltipBehavior, exports.animationBehavior, exports.labelBehavior];
|
|
83
|
+
};
|
|
84
|
+
exports.getCoreBehaviors = getCoreBehaviors;
|
|
@@ -11,7 +11,6 @@ const ComponentProvider_1 = require("../../components/ComponentProvider");
|
|
|
11
11
|
const DebugViewProvider_1 = require("../DebugViewProvider");
|
|
12
12
|
const AppWrapper_1 = require("./AppWrapper");
|
|
13
13
|
const StyleContext_1 = require("../theming/StyleContext");
|
|
14
|
-
const BehaviorContext_1 = require("../behaviors/BehaviorContext");
|
|
15
14
|
// --- We want to enable the produce method of `immer` on Map objects
|
|
16
15
|
(0, immer_1.enableMapSet)();
|
|
17
16
|
// --- We use this object in the app context to represent the `QlientQuery`
|
|
@@ -60,7 +59,7 @@ function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTest
|
|
|
60
59
|
const enhancedGlobalProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, globalProps), { isNested })), [globalProps, isNested]);
|
|
61
60
|
// --- Render the app providing a component registry (in which the engine finds a
|
|
62
61
|
// --- component definition by its name). Ensure the app has a context for debugging.
|
|
63
|
-
return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, extensionManager: extensionManager, children: (0, jsx_runtime_1.jsx)(StyleContext_1.StyleProvider, { children: (0, jsx_runtime_1.jsx)(
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, extensionManager: extensionManager, children: (0, jsx_runtime_1.jsx)(StyleContext_1.StyleProvider, { children: (0, jsx_runtime_1.jsx)(DebugViewProvider_1.DebugViewProvider, { debugConfig: globalProps === null || globalProps === void 0 ? void 0 : globalProps.debug, children: (0, jsx_runtime_1.jsx)(AppWrapper_1.AppWrapper, { projectCompilation: projectCompilation, resourceMap: resourceMap, apiInterceptor: apiInterceptor, node: rootNode, contributes: contributes, resources: resources, routerBaseName: routerBaseName, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, defaultTheme: defaultTheme, defaultTone: defaultTone, globalProps: enhancedGlobalProps, standalone: standalone, trackContainerHeight: trackContainerHeight, previewMode: previewMode, sources: sources, onInit: onInit, children: children }) }) }) }));
|
|
64
63
|
}
|
|
65
64
|
/**
|
|
66
65
|
*
|
|
@@ -69,7 +69,7 @@ const event_handlers_1 = require("../event-handlers");
|
|
|
69
69
|
const UnknownComponent_1 = __importDefault(require("./UnknownComponent"));
|
|
70
70
|
const InvalidComponent_1 = __importDefault(require("./InvalidComponent"));
|
|
71
71
|
const layout_resolver_1 = require("../theming/layout-resolver");
|
|
72
|
-
const
|
|
72
|
+
const CoreBehaviors_1 = require("../behaviors/CoreBehaviors");
|
|
73
73
|
/**
|
|
74
74
|
* This component's primary responsibility is to transform a particular component definition
|
|
75
75
|
* into its React representation using the current rendering context.
|
|
@@ -214,6 +214,17 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
214
214
|
// --- Render the component using the renderer function obtained from the component registry
|
|
215
215
|
renderedNode = renderer(rendererContext);
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Apply any core behaviors to the component.
|
|
219
|
+
*/
|
|
220
|
+
const behaviors = (0, CoreBehaviors_1.getCoreBehaviors)();
|
|
221
|
+
if (!isCompoundComponent) {
|
|
222
|
+
for (const behavior of behaviors) {
|
|
223
|
+
if (behavior.canAttach(rendererContext.node, descriptor)) {
|
|
224
|
+
renderedNode = behavior.attach(rendererContext, renderedNode);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
217
228
|
// --- Components may have a `testId` property for E2E testing purposes. Inject the value of `testId`
|
|
218
229
|
// --- into the DOM object of the rendered React component.
|
|
219
230
|
if (
|
|
@@ -272,20 +283,7 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
272
283
|
? (0, react_1.cloneElement)(renderedNode, null, children)
|
|
273
284
|
: renderedNode;
|
|
274
285
|
}
|
|
275
|
-
|
|
276
|
-
const applyBehaviors = (node) => {
|
|
277
|
-
const behaviors = getBehaviors();
|
|
278
|
-
let wrappedNode = node;
|
|
279
|
-
if (!isCompoundComponent) {
|
|
280
|
-
for (const behavior of behaviors) {
|
|
281
|
-
if (behavior.canAttach(rendererContext.node, descriptor)) {
|
|
282
|
-
wrappedNode = behavior.attach(rendererContext, wrappedNode);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return wrappedNode;
|
|
287
|
-
};
|
|
288
|
-
return applyBehaviors(nodeToRender);
|
|
286
|
+
return nodeToRender;
|
|
289
287
|
});
|
|
290
288
|
/**
|
|
291
289
|
* This function renders the content of a slot. If the slot is named, it looks for a template
|
|
@@ -4,21 +4,34 @@ exports.flattenNode = flattenNode;
|
|
|
4
4
|
exports.toFlatTree = toFlatTree;
|
|
5
5
|
exports.walkTree = walkTree;
|
|
6
6
|
exports.unPackTree = unPackTree;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
exports.flatToNative = flatToNative;
|
|
8
|
+
exports.hierarchyToNative = hierarchyToNative;
|
|
9
|
+
function flattenNode(node, depth, result, openedIds, dynamicField, nodeStates) {
|
|
10
|
+
const { children, key } = node;
|
|
11
|
+
const isExpanded = openedIds.includes(key);
|
|
12
|
+
// Check if node has actual children OR is a dynamic node that can load children
|
|
13
|
+
const hasActualChildren = !!children && children.length > 0;
|
|
14
|
+
const isDynamic = dynamicField && node[dynamicField];
|
|
15
|
+
const hasChildren = hasActualChildren || isDynamic;
|
|
16
|
+
// Get loading state for this node
|
|
17
|
+
const loadingState = (nodeStates === null || nodeStates === void 0 ? void 0 : nodeStates.get(key)) || (isDynamic ? 'unloaded' : 'loaded');
|
|
18
|
+
const flatNode = Object.assign(Object.assign({}, node), { hasChildren,
|
|
19
|
+
depth,
|
|
20
|
+
isExpanded,
|
|
21
|
+
loadingState,
|
|
22
|
+
// Ensure key is preserved (in case it was overwritten by ...node spread)
|
|
23
|
+
key: key || node.key || node.id });
|
|
24
|
+
result.push(flatNode);
|
|
12
25
|
if (isExpanded && children) {
|
|
13
26
|
for (let child of children) {
|
|
14
|
-
flattenNode(child, depth + 1, result, openedIds);
|
|
27
|
+
flattenNode(child, depth + 1, result, openedIds, dynamicField, nodeStates);
|
|
15
28
|
}
|
|
16
29
|
}
|
|
17
30
|
}
|
|
18
|
-
function toFlatTree(treeData, openedIds) {
|
|
31
|
+
function toFlatTree(treeData, openedIds, dynamicField, nodeStates) {
|
|
19
32
|
const ret = [];
|
|
20
33
|
treeData.forEach((node) => {
|
|
21
|
-
flattenNode(node, 0, ret, openedIds);
|
|
34
|
+
flattenNode(node, 0, ret, openedIds, dynamicField, nodeStates);
|
|
22
35
|
});
|
|
23
36
|
return ret;
|
|
24
37
|
}
|
|
@@ -33,12 +46,12 @@ function unPackTree(items = [], parentIds = [], parentPath = []) {
|
|
|
33
46
|
let treeItemsById = {};
|
|
34
47
|
items.forEach((item, index) => {
|
|
35
48
|
const path = [...parentPath, index];
|
|
36
|
-
const
|
|
37
|
-
const childTree = unPackTree(item.children, [...parentIds,
|
|
38
|
-
const treeItem = Object.assign(Object.assign({}, item), {
|
|
49
|
+
const id = item.id || item.cid;
|
|
50
|
+
const childTree = unPackTree(item.children, [...parentIds, id], path);
|
|
51
|
+
const treeItem = Object.assign(Object.assign({}, item), { id: id, key: id, parentIds,
|
|
39
52
|
path, children: childTree.treeData, selectable: item.selectable });
|
|
40
53
|
treeData.push(treeItem);
|
|
41
|
-
treeItemsById[
|
|
54
|
+
treeItemsById[id] = treeItem;
|
|
42
55
|
treeItemsById = Object.assign(Object.assign({}, treeItemsById), childTree.treeItemsById);
|
|
43
56
|
});
|
|
44
57
|
return {
|
|
@@ -46,3 +59,168 @@ function unPackTree(items = [], parentIds = [], parentPath = []) {
|
|
|
46
59
|
treeItemsById,
|
|
47
60
|
};
|
|
48
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Transforms flat array data with parent-child relationships into UnPackedTreeData format
|
|
64
|
+
* @param flatData Array of flat objects with id and parentId relationships
|
|
65
|
+
* @param fieldConfig Configuration for mapping object fields to tree properties
|
|
66
|
+
* @returns UnPackedTreeData structure suitable for Tree component
|
|
67
|
+
*/
|
|
68
|
+
function flatToNative(flatData, fieldConfig) {
|
|
69
|
+
if (!flatData || flatData.length === 0) {
|
|
70
|
+
return { treeData: [], treeItemsById: {} };
|
|
71
|
+
}
|
|
72
|
+
// Build parent-to-children map for efficient lookup
|
|
73
|
+
const childrenMap = new Map();
|
|
74
|
+
const itemsById = new Map();
|
|
75
|
+
const rootItems = [];
|
|
76
|
+
// First pass: organize items and build relationships
|
|
77
|
+
flatData.forEach(item => {
|
|
78
|
+
const id = item[fieldConfig.idField];
|
|
79
|
+
const parentId = item[fieldConfig.parentField || 'parentId'];
|
|
80
|
+
// Store item for lookup
|
|
81
|
+
itemsById.set(id, item);
|
|
82
|
+
if (parentId && parentId !== '') {
|
|
83
|
+
// Convert parentId to string for consistent type in childrenMap
|
|
84
|
+
const parentKey = String(parentId);
|
|
85
|
+
// Has parent - add to children map
|
|
86
|
+
if (!childrenMap.has(parentKey)) {
|
|
87
|
+
childrenMap.set(parentKey, []);
|
|
88
|
+
}
|
|
89
|
+
childrenMap.get(parentKey).push(item);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// Root item
|
|
93
|
+
rootItems.push(item);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
// Generate unique IDs for internal tree structure
|
|
97
|
+
let idCounter = 1;
|
|
98
|
+
const sourceIdToId = new Map();
|
|
99
|
+
const getOrCreateId = (sourceId) => {
|
|
100
|
+
if (!sourceIdToId.has(sourceId)) {
|
|
101
|
+
sourceIdToId.set(sourceId, `flat_${idCounter++}`);
|
|
102
|
+
}
|
|
103
|
+
return sourceIdToId.get(sourceId);
|
|
104
|
+
};
|
|
105
|
+
// Recursive function to build TreeNode structure
|
|
106
|
+
const buildTreeNode = (item, parentIds = [], pathSegments = []) => {
|
|
107
|
+
var _a;
|
|
108
|
+
const sourceId = item[fieldConfig.idField];
|
|
109
|
+
const id = getOrCreateId(sourceId);
|
|
110
|
+
const displayName = item[fieldConfig.labelField] || sourceId;
|
|
111
|
+
const currentPath = [...pathSegments, displayName];
|
|
112
|
+
// Get children for this item
|
|
113
|
+
const sourceKey = String(sourceId);
|
|
114
|
+
const childItems = childrenMap.get(sourceKey) || [];
|
|
115
|
+
const children = childItems.map(childItem => buildTreeNode(childItem, [...parentIds, sourceId], currentPath));
|
|
116
|
+
// Build the TreeNode
|
|
117
|
+
const treeNode = Object.assign(Object.assign(Object.assign(Object.assign({ id, key: sourceId, path: currentPath, displayName,
|
|
118
|
+
parentIds, selectable: fieldConfig.selectableField ? ((_a = item[fieldConfig.selectableField]) !== null && _a !== void 0 ? _a : true) : true, children }, item), (fieldConfig.iconField && item[fieldConfig.iconField] && {
|
|
119
|
+
icon: item[fieldConfig.iconField]
|
|
120
|
+
})), (fieldConfig.iconExpandedField && item[fieldConfig.iconExpandedField] && {
|
|
121
|
+
iconExpanded: item[fieldConfig.iconExpandedField]
|
|
122
|
+
})), (fieldConfig.iconCollapsedField && item[fieldConfig.iconCollapsedField] && {
|
|
123
|
+
iconCollapsed: item[fieldConfig.iconCollapsedField]
|
|
124
|
+
}));
|
|
125
|
+
return treeNode;
|
|
126
|
+
};
|
|
127
|
+
// Build tree structure from root items
|
|
128
|
+
const treeData = rootItems.map(rootItem => buildTreeNode(rootItem));
|
|
129
|
+
// Build lookup map by ID
|
|
130
|
+
const treeItemsById = {};
|
|
131
|
+
const collectNodes = (nodes) => {
|
|
132
|
+
nodes.forEach(node => {
|
|
133
|
+
treeItemsById[node.id] = node;
|
|
134
|
+
if (node.children) {
|
|
135
|
+
collectNodes(node.children);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
collectNodes(treeData);
|
|
140
|
+
return {
|
|
141
|
+
treeData,
|
|
142
|
+
treeItemsById,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Transforms hierarchical nested object data into UnPackedTreeData format
|
|
147
|
+
* @param hierarchyData Single object or array of objects with nested children structure
|
|
148
|
+
* @param fieldConfig Configuration for mapping object fields to tree properties
|
|
149
|
+
* @returns UnPackedTreeData structure suitable for Tree component
|
|
150
|
+
*/
|
|
151
|
+
function hierarchyToNative(hierarchyData, fieldConfig) {
|
|
152
|
+
if (!hierarchyData) {
|
|
153
|
+
return { treeData: [], treeItemsById: {} };
|
|
154
|
+
}
|
|
155
|
+
// Ensure we're working with an array
|
|
156
|
+
const rootItems = Array.isArray(hierarchyData) ? hierarchyData : [hierarchyData];
|
|
157
|
+
if (rootItems.length === 0) {
|
|
158
|
+
return { treeData: [], treeItemsById: {} };
|
|
159
|
+
}
|
|
160
|
+
// Generate unique IDs for internal tree structure
|
|
161
|
+
let idCounter = 1;
|
|
162
|
+
const sourceIdToId = new Map();
|
|
163
|
+
const getOrCreateId = (sourceId) => {
|
|
164
|
+
if (!sourceIdToId.has(sourceId)) {
|
|
165
|
+
sourceIdToId.set(sourceId, `hierarchy_${idCounter++}`);
|
|
166
|
+
}
|
|
167
|
+
return sourceIdToId.get(sourceId);
|
|
168
|
+
};
|
|
169
|
+
// Set to track visited nodes for circular reference detection
|
|
170
|
+
const visitedIds = new Set();
|
|
171
|
+
// Recursive function to build TreeNode structure from hierarchical data
|
|
172
|
+
const buildTreeNode = (item, parentIds = [], pathSegments = []) => {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
const sourceId = item[fieldConfig.idField];
|
|
175
|
+
const displayName = item[fieldConfig.labelField] || sourceId;
|
|
176
|
+
// Circular reference detection
|
|
177
|
+
if (visitedIds.has(sourceId)) {
|
|
178
|
+
// Return a simple node without children to break the cycle
|
|
179
|
+
const id = getOrCreateId(sourceId);
|
|
180
|
+
return Object.assign(Object.assign({ id, key: sourceId, path: [...pathSegments, displayName], displayName,
|
|
181
|
+
parentIds, selectable: fieldConfig.selectableField ? ((_a = item[fieldConfig.selectableField]) !== null && _a !== void 0 ? _a : true) : true, children: [] }, item), (fieldConfig.iconField && item[fieldConfig.iconField] && {
|
|
182
|
+
icon: item[fieldConfig.iconField]
|
|
183
|
+
}));
|
|
184
|
+
}
|
|
185
|
+
// Mark as visited
|
|
186
|
+
visitedIds.add(sourceId);
|
|
187
|
+
const id = getOrCreateId(sourceId);
|
|
188
|
+
const currentPath = [...pathSegments, displayName];
|
|
189
|
+
// Get children from the specified children field
|
|
190
|
+
const childrenField = fieldConfig.childrenField || 'children';
|
|
191
|
+
const childItems = item[childrenField] || [];
|
|
192
|
+
// Recursively build children
|
|
193
|
+
const children = childItems.map((childItem) => buildTreeNode(childItem, [...parentIds, sourceId], currentPath));
|
|
194
|
+
// Unmark as visited after processing (for depth-first traversal)
|
|
195
|
+
visitedIds.delete(sourceId);
|
|
196
|
+
// Build the TreeNode
|
|
197
|
+
const treeNode = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ id, path: currentPath, displayName,
|
|
198
|
+
parentIds, selectable: fieldConfig.selectableField ? ((_b = item[fieldConfig.selectableField]) !== null && _b !== void 0 ? _b : true) : true }, item), (fieldConfig.iconField && item[fieldConfig.iconField] && {
|
|
199
|
+
icon: item[fieldConfig.iconField]
|
|
200
|
+
})), (fieldConfig.iconExpandedField && item[fieldConfig.iconExpandedField] && {
|
|
201
|
+
iconExpanded: item[fieldConfig.iconExpandedField]
|
|
202
|
+
})), (fieldConfig.iconCollapsedField && item[fieldConfig.iconCollapsedField] && {
|
|
203
|
+
iconCollapsed: item[fieldConfig.iconCollapsedField]
|
|
204
|
+
})), {
|
|
205
|
+
// Set TreeNode-specific properties AFTER spreading item to ensure they're not overwritten
|
|
206
|
+
children, key: sourceId });
|
|
207
|
+
return treeNode;
|
|
208
|
+
};
|
|
209
|
+
// Build tree structure from root items
|
|
210
|
+
const treeData = rootItems.map(rootItem => buildTreeNode(rootItem));
|
|
211
|
+
// Build lookup map by ID
|
|
212
|
+
const treeItemsById = {};
|
|
213
|
+
const collectNodes = (nodes) => {
|
|
214
|
+
nodes.forEach(node => {
|
|
215
|
+
treeItemsById[node.id] = node;
|
|
216
|
+
if (node.children) {
|
|
217
|
+
collectNodes(node.children);
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
collectNodes(treeData);
|
|
222
|
+
return {
|
|
223
|
+
treeData,
|
|
224
|
+
treeItemsById,
|
|
225
|
+
};
|
|
226
|
+
}
|