xmlui 0.10.16 → 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-D4RYJasT.mjs → index-Cy6Emsex.mjs} +1370 -1548
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-qzTZlH-6.mjs → initMock-B-rmnC-t.mjs} +1 -1
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{collectedComponentMetadata-BQaefK3f.mjs → collectedComponentMetadata-CB63ngkU.mjs} +1483 -1670
- package/dist/metadata/{initMock-Cz6QssI3.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/AutoComplete/AutoComplete.spec.js +29 -0
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +81 -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 +15 -9
- 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/Input/PartialInput.js +2 -2
- package/dist/scripts/src/components/NumberBox/NumberBox.js +1 -5
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +33 -4
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +15 -17
- 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/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 +29 -0
- package/dist/scripts/src/components/Slider/SliderNative.js +18 -19
- 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-icons.spec.js +206 -0
- package/dist/scripts/src/components/Tree/Tree.spec.js +1 -94
- package/dist/scripts/src/components/Tree/TreeComponent.js +44 -7
- package/dist/scripts/src/components/Tree/TreeNative.js +127 -85
- package/dist/scripts/src/components/Tree/testData.js +25 -1
- package/dist/scripts/src/components-core/behaviors/Behavior.js +2 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +8 -5
- package/dist/scripts/src/components-core/rendering/AppRoot.js +1 -2
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +12 -13
- package/dist/scripts/src/components-core/utils/treeUtils.js +8 -5
- package/dist/scripts/src/testing/ComponentDrivers.js +2 -4
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -54
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const fixtures_1 = require("../../testing/fixtures");
|
|
13
|
+
const testData_1 = require("./testData");
|
|
14
|
+
(0, fixtures_1.test)("default collapsed icon appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
15
|
+
yield initTestBed(`
|
|
16
|
+
<VStack height="400px">
|
|
17
|
+
<Tree testId="tree" data='{${JSON.stringify(testData_1.flatTreeData)}}' />
|
|
18
|
+
</VStack>
|
|
19
|
+
`);
|
|
20
|
+
const tree = yield createTreeDriver("tree");
|
|
21
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("chevronright")).toBeVisible();
|
|
22
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("chevrondown")).not.toBeVisible();
|
|
23
|
+
}));
|
|
24
|
+
(0, fixtures_1.test)("custom iconCollapsed appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
25
|
+
yield initTestBed(`
|
|
26
|
+
<VStack height="400px">
|
|
27
|
+
<Tree
|
|
28
|
+
testId="tree"
|
|
29
|
+
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
30
|
+
iconCollapsed="phone"
|
|
31
|
+
iconExpanded="email"
|
|
32
|
+
/>
|
|
33
|
+
</VStack>
|
|
34
|
+
`);
|
|
35
|
+
const tree = yield createTreeDriver("tree");
|
|
36
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
37
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
38
|
+
}));
|
|
39
|
+
(0, fixtures_1.test)("default expanded icon appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
40
|
+
yield initTestBed(`
|
|
41
|
+
<VStack height="400px">
|
|
42
|
+
<Tree
|
|
43
|
+
testId="tree"
|
|
44
|
+
defaultExpanded="all"
|
|
45
|
+
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
46
|
+
/>
|
|
47
|
+
</VStack>
|
|
48
|
+
`);
|
|
49
|
+
const tree = yield createTreeDriver("tree");
|
|
50
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("chevrondown")).toBeVisible();
|
|
51
|
+
}));
|
|
52
|
+
(0, fixtures_1.test)("custom iconExpanded appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
53
|
+
yield initTestBed(`
|
|
54
|
+
<VStack height="400px">
|
|
55
|
+
<Tree
|
|
56
|
+
testId="tree"
|
|
57
|
+
defaultExpanded="all"
|
|
58
|
+
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
59
|
+
iconCollapsed="phone"
|
|
60
|
+
iconExpanded="email"
|
|
61
|
+
/>
|
|
62
|
+
</VStack>
|
|
63
|
+
`);
|
|
64
|
+
const tree = yield createTreeDriver("tree");
|
|
65
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).not.toBeVisible();
|
|
66
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).toHaveCount(2);
|
|
67
|
+
}));
|
|
68
|
+
(0, fixtures_1.test)("both custom icons work together", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver, page }) {
|
|
69
|
+
yield initTestBed(`
|
|
70
|
+
<VStack height="400px">
|
|
71
|
+
<Tree
|
|
72
|
+
id="tree"
|
|
73
|
+
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
74
|
+
iconCollapsed="phone"
|
|
75
|
+
iconExpanded="email"
|
|
76
|
+
>
|
|
77
|
+
<property name="itemTemplate">
|
|
78
|
+
<HStack testId="{$item.id}" verticalAlignment="center">
|
|
79
|
+
<Icon name="folder" />
|
|
80
|
+
<Text value="{$item.name}" />
|
|
81
|
+
</HStack>
|
|
82
|
+
</property>
|
|
83
|
+
</Tree>
|
|
84
|
+
<Button testId="expand1" onClick="tree.expandNode(1)">Expand Node 1</Button>
|
|
85
|
+
<Button testId="expand2" onClick="tree.collapseNode(1)">Collapse Node 2</Button>
|
|
86
|
+
</VStack>
|
|
87
|
+
|
|
88
|
+
`);
|
|
89
|
+
const tree = yield createTreeDriver("tree");
|
|
90
|
+
yield (0, fixtures_1.expect)(tree.component).toBeVisible();
|
|
91
|
+
// Initially should show collapsed icon
|
|
92
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("phone")).toBeVisible();
|
|
93
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).not.toBeVisible();
|
|
94
|
+
// Expand the first node
|
|
95
|
+
yield page.getByTestId("expand1").click();
|
|
96
|
+
// Should now show expanded icon and hide collapsed icon
|
|
97
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).toBeVisible();
|
|
98
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("phone")).toBeVisible();
|
|
99
|
+
// Collapse again
|
|
100
|
+
yield page.getByTestId("expand2").click();
|
|
101
|
+
// Should show collapsed icon again
|
|
102
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("phone")).toBeVisible();
|
|
103
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).not.toBeVisible();
|
|
104
|
+
}));
|
|
105
|
+
(0, fixtures_1.test)("iconExpanded fields are used", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTreeDriver }) {
|
|
106
|
+
yield initTestBed(`
|
|
107
|
+
<VStack height="400px">
|
|
108
|
+
<Tree
|
|
109
|
+
testId="tree"
|
|
110
|
+
id="tree"
|
|
111
|
+
defaultExpanded="first-level"
|
|
112
|
+
data='{${JSON.stringify(testData_1.flatTreeDataWithIcons1)}}' />
|
|
113
|
+
<Button testId="expand1" onClick="tree.expandNode(2)">Expand Node 2</Button>
|
|
114
|
+
</VStack>
|
|
115
|
+
`);
|
|
116
|
+
const tree = yield createTreeDriver("tree");
|
|
117
|
+
// --- Initila state
|
|
118
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
119
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
120
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevronright")).toHaveCount(1);
|
|
121
|
+
yield page.getByTestId("expand1").click();
|
|
122
|
+
// --- After expanding node 2
|
|
123
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
124
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).toBeVisible();
|
|
125
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevronright")).toHaveCount(0);
|
|
126
|
+
}));
|
|
127
|
+
(0, fixtures_1.test)("iconExpanded fields (with alias) are used", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTreeDriver, }) {
|
|
128
|
+
yield initTestBed(`
|
|
129
|
+
<VStack height="400px">
|
|
130
|
+
<Tree
|
|
131
|
+
testId="tree"
|
|
132
|
+
id="tree"
|
|
133
|
+
iconExpandedField="iconExp"
|
|
134
|
+
defaultExpanded="first-level"
|
|
135
|
+
data='{${JSON.stringify(testData_1.flatTreeDataWithIconsAndAlias1)}}' />
|
|
136
|
+
<Button testId="expand1" onClick="tree.expandNode(2)">Expand Node 2</Button>
|
|
137
|
+
</VStack>
|
|
138
|
+
`);
|
|
139
|
+
const tree = yield createTreeDriver("tree");
|
|
140
|
+
// --- Initila state
|
|
141
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
142
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
143
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevronright")).toHaveCount(1);
|
|
144
|
+
yield page.getByTestId("expand1").click();
|
|
145
|
+
// --- After expanding node 2
|
|
146
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
147
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).toBeVisible();
|
|
148
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevronright")).toHaveCount(0);
|
|
149
|
+
}));
|
|
150
|
+
(0, fixtures_1.test)("iconCollapsed fields are used", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTreeDriver }) {
|
|
151
|
+
yield initTestBed(`
|
|
152
|
+
<VStack height="400px">
|
|
153
|
+
<Tree
|
|
154
|
+
testId="tree"
|
|
155
|
+
id="tree"
|
|
156
|
+
defaultExpanded="none"
|
|
157
|
+
data='{${JSON.stringify(testData_1.flatTreeDataWithIcons2)}}' />
|
|
158
|
+
<Button testId="expand1" onClick="tree.expandNode(1)">Expand Node 1</Button>
|
|
159
|
+
<Button testId="expand2" onClick="tree.expandNode(2)">Expand Node 2</Button>
|
|
160
|
+
</VStack>
|
|
161
|
+
`);
|
|
162
|
+
const tree = yield createTreeDriver("tree");
|
|
163
|
+
// --- Initila state
|
|
164
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
165
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
166
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevronright")).toHaveCount(0);
|
|
167
|
+
yield page.getByTestId("expand1").click();
|
|
168
|
+
// --- After expanding node 1
|
|
169
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).not.toBeVisible();
|
|
170
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).toBeVisible();
|
|
171
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevrondown")).toHaveCount(1);
|
|
172
|
+
yield page.getByTestId("expand2").click();
|
|
173
|
+
// --- After expanding node 2
|
|
174
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).not.toBeVisible();
|
|
175
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
176
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevrondown")).toHaveCount(2);
|
|
177
|
+
}));
|
|
178
|
+
(0, fixtures_1.test)("iconCollapsed fields (with alias) are used", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createTreeDriver }) {
|
|
179
|
+
yield initTestBed(`
|
|
180
|
+
<VStack height="400px">
|
|
181
|
+
<Tree
|
|
182
|
+
testId="tree"
|
|
183
|
+
id="tree"
|
|
184
|
+
iconCollapsedField="iconColl"
|
|
185
|
+
defaultExpanded="none"
|
|
186
|
+
data='{${JSON.stringify(testData_1.flatTreeDataWithIcons2)}}' />
|
|
187
|
+
<Button testId="expand1" onClick="tree.expandNode(1)">Expand Node 1</Button>
|
|
188
|
+
<Button testId="expand2" onClick="tree.expandNode(2)">Expand Node 2</Button>
|
|
189
|
+
</VStack>
|
|
190
|
+
`);
|
|
191
|
+
const tree = yield createTreeDriver("tree");
|
|
192
|
+
// --- Initila state
|
|
193
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
194
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
195
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevronright")).toHaveCount(0);
|
|
196
|
+
yield page.getByTestId("expand1").click();
|
|
197
|
+
// --- After expanding node 1
|
|
198
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).not.toBeVisible();
|
|
199
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).toBeVisible();
|
|
200
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevrondown")).toHaveCount(1);
|
|
201
|
+
yield page.getByTestId("expand2").click();
|
|
202
|
+
// --- After expanding node 2
|
|
203
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).not.toBeVisible();
|
|
204
|
+
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
205
|
+
yield (0, fixtures_1.expect)(tree.getIconsByName("chevrondown")).toHaveCount(2);
|
|
206
|
+
}));
|
|
@@ -1232,7 +1232,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
1232
1232
|
yield (0, fixtures_1.expect)(tree.getNodeWrapperByTestId("1")).toBeVisible();
|
|
1233
1233
|
// Focus the tree and navigate to an item
|
|
1234
1234
|
yield tree.component.focus();
|
|
1235
|
-
yield page.keyboard.press("ArrowDown");
|
|
1235
|
+
yield page.keyboard.press("ArrowDown", { delay: 100 });
|
|
1236
1236
|
// Test focused item has all custom theme variables applied
|
|
1237
1237
|
const focusedItem = tree.getNodeWrapperByTestId("2");
|
|
1238
1238
|
yield (0, fixtures_1.expect)(focusedItem).toHaveClass(/focused/);
|
|
@@ -2837,96 +2837,3 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
2837
2837
|
yield (0, fixtures_1.expect)(tree.component).toBeVisible();
|
|
2838
2838
|
}));
|
|
2839
2839
|
});
|
|
2840
|
-
fixtures_1.test.describe("icon props", () => {
|
|
2841
|
-
(0, fixtures_1.test)("default collapsed icon appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
2842
|
-
yield initTestBed(`
|
|
2843
|
-
<VStack height="400px">
|
|
2844
|
-
<Tree testId="tree" data='{${JSON.stringify(testData_1.flatTreeData)}}' />
|
|
2845
|
-
</VStack>
|
|
2846
|
-
`);
|
|
2847
|
-
const tree = yield createTreeDriver("tree");
|
|
2848
|
-
yield (0, fixtures_1.expect)(tree.getIconByName("chevronright")).toBeVisible();
|
|
2849
|
-
yield (0, fixtures_1.expect)(tree.getIconByName("chevrondown")).not.toBeVisible();
|
|
2850
|
-
}));
|
|
2851
|
-
(0, fixtures_1.test)("custom iconCollapsed appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
2852
|
-
yield initTestBed(`
|
|
2853
|
-
<VStack height="400px">
|
|
2854
|
-
<Tree
|
|
2855
|
-
testId="tree"
|
|
2856
|
-
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
2857
|
-
iconCollapsed="phone"
|
|
2858
|
-
iconExpanded="email"
|
|
2859
|
-
/>
|
|
2860
|
-
</VStack>
|
|
2861
|
-
`);
|
|
2862
|
-
const tree = yield createTreeDriver("tree");
|
|
2863
|
-
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).toBeVisible();
|
|
2864
|
-
yield (0, fixtures_1.expect)(tree.getIconByName("email")).not.toBeVisible();
|
|
2865
|
-
}));
|
|
2866
|
-
(0, fixtures_1.test)("default expanded icon appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
2867
|
-
yield initTestBed(`
|
|
2868
|
-
<VStack height="400px">
|
|
2869
|
-
<Tree
|
|
2870
|
-
testId="tree"
|
|
2871
|
-
defaultExpanded="all"
|
|
2872
|
-
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
2873
|
-
/>
|
|
2874
|
-
</VStack>
|
|
2875
|
-
`);
|
|
2876
|
-
const tree = yield createTreeDriver("tree");
|
|
2877
|
-
yield (0, fixtures_1.expect)(tree.getIconByName("chevrondown")).toBeVisible();
|
|
2878
|
-
}));
|
|
2879
|
-
(0, fixtures_1.test)("custom iconExpanded appears", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver }) {
|
|
2880
|
-
yield initTestBed(`
|
|
2881
|
-
<VStack height="400px">
|
|
2882
|
-
<Tree
|
|
2883
|
-
testId="tree"
|
|
2884
|
-
defaultExpanded="all"
|
|
2885
|
-
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
2886
|
-
iconCollapsed="phone"
|
|
2887
|
-
iconExpanded="email"
|
|
2888
|
-
/>
|
|
2889
|
-
</VStack>
|
|
2890
|
-
`);
|
|
2891
|
-
const tree = yield createTreeDriver("tree");
|
|
2892
|
-
yield (0, fixtures_1.expect)(tree.getIconByName("phone")).not.toBeVisible();
|
|
2893
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).toHaveCount(2);
|
|
2894
|
-
}));
|
|
2895
|
-
(0, fixtures_1.test)("both custom icons work together", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTreeDriver, page }) {
|
|
2896
|
-
yield initTestBed(`
|
|
2897
|
-
<VStack height="400px">
|
|
2898
|
-
<Tree
|
|
2899
|
-
id="tree"
|
|
2900
|
-
data='{${JSON.stringify(testData_1.flatTreeData)}}'
|
|
2901
|
-
iconCollapsed="phone"
|
|
2902
|
-
iconExpanded="email"
|
|
2903
|
-
>
|
|
2904
|
-
<property name="itemTemplate">
|
|
2905
|
-
<HStack testId="{$item.id}" verticalAlignment="center">
|
|
2906
|
-
<Icon name="folder" />
|
|
2907
|
-
<Text value="{$item.name}" />
|
|
2908
|
-
</HStack>
|
|
2909
|
-
</property>
|
|
2910
|
-
</Tree>
|
|
2911
|
-
<Button testId="expand1" onClick="tree.expandNode(1)">Expand Node 1</Button>
|
|
2912
|
-
<Button testId="expand2" onClick="tree.collapseNode(1)">Collapse Node 2</Button>
|
|
2913
|
-
</VStack>
|
|
2914
|
-
|
|
2915
|
-
`);
|
|
2916
|
-
const tree = yield createTreeDriver("tree");
|
|
2917
|
-
yield (0, fixtures_1.expect)(tree.component).toBeVisible();
|
|
2918
|
-
// Initially should show collapsed icon
|
|
2919
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("phone")).toBeVisible();
|
|
2920
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).not.toBeVisible();
|
|
2921
|
-
// Expand the first node
|
|
2922
|
-
yield page.getByTestId("expand1").click();
|
|
2923
|
-
// Should now show expanded icon and hide collapsed icon
|
|
2924
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).toBeVisible();
|
|
2925
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("phone")).toBeVisible();
|
|
2926
|
-
// Collapse again
|
|
2927
|
-
yield page.getByTestId("expand2").click();
|
|
2928
|
-
// Should show collapsed icon again
|
|
2929
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("phone")).toBeVisible();
|
|
2930
|
-
yield (0, fixtures_1.expect)(tree.getIconsByName("email")).not.toBeVisible();
|
|
2931
|
-
}));
|
|
2932
|
-
});
|
|
@@ -137,8 +137,8 @@ exports.TreeMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
137
137
|
signature: `(node: FlatTreeNode) => void`,
|
|
138
138
|
},
|
|
139
139
|
loadChildren: {
|
|
140
|
-
description: `Fired when a tree node needs to load children dynamically. Should return
|
|
141
|
-
signature: `(node: FlatTreeNode) =>
|
|
140
|
+
description: `Fired when a tree node needs to load children dynamically. Should return an array of child data.`,
|
|
141
|
+
signature: `(node: FlatTreeNode) => any[]`,
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
apis: {
|
|
@@ -159,21 +159,21 @@ exports.TreeMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
159
159
|
},
|
|
160
160
|
expandNode: {
|
|
161
161
|
description: `Expand a specific node by its source data ID.`,
|
|
162
|
-
signature: "expandNode(nodeId: string): void",
|
|
162
|
+
signature: "expandNode(nodeId: string | number): void",
|
|
163
163
|
parameters: {
|
|
164
164
|
nodeId: "The ID of the node to expand (source data format)",
|
|
165
165
|
},
|
|
166
166
|
},
|
|
167
167
|
collapseNode: {
|
|
168
168
|
description: `Collapse a specific node by its source data ID.`,
|
|
169
|
-
signature: "collapseNode(nodeId: string): void",
|
|
169
|
+
signature: "collapseNode(nodeId: string | number): void",
|
|
170
170
|
parameters: {
|
|
171
171
|
nodeId: "The ID of the node to collapse (source data format)",
|
|
172
172
|
},
|
|
173
173
|
},
|
|
174
174
|
selectNode: {
|
|
175
175
|
description: `Programmatically select a node by its source data ID.`,
|
|
176
|
-
signature: "selectNode(nodeId: string): void",
|
|
176
|
+
signature: "selectNode(nodeId: string | number): void",
|
|
177
177
|
parameters: {
|
|
178
178
|
nodeId: "The ID of the node to select (source data format)",
|
|
179
179
|
},
|
|
@@ -184,19 +184,34 @@ exports.TreeMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
184
184
|
},
|
|
185
185
|
getNodeById: {
|
|
186
186
|
description: `Get a tree node by its source data ID.`,
|
|
187
|
-
signature: "getNodeById(nodeId: string): TreeNode | null",
|
|
187
|
+
signature: "getNodeById(nodeId: string | number): TreeNode | null",
|
|
188
188
|
parameters: {
|
|
189
189
|
nodeId: "The ID of the node to retrieve (source data format)",
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
192
|
getExpandedNodes: {
|
|
193
193
|
description: `Get an array of currently expanded node IDs in source data format.`,
|
|
194
|
-
signature: "getExpandedNodes(): string[]",
|
|
194
|
+
signature: "getExpandedNodes(): (string | number)[]",
|
|
195
195
|
},
|
|
196
196
|
getSelectedNode: {
|
|
197
197
|
description: `Get the currently selected tree node.`,
|
|
198
198
|
signature: "getSelectedNode(): TreeNode | null",
|
|
199
199
|
},
|
|
200
|
+
scrollIntoView: {
|
|
201
|
+
description: `Scroll to a specific node and expand parent nodes as needed to make it visible.`,
|
|
202
|
+
signature: "scrollIntoView(nodeId: string | number, options?: ScrollIntoViewOptions): void",
|
|
203
|
+
parameters: {
|
|
204
|
+
nodeId: "The ID of the node to scroll to (source data format)",
|
|
205
|
+
options: "Optional scroll options",
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
scrollToItem: {
|
|
209
|
+
description: `Scroll to a specific node if it's currently visible in the tree.`,
|
|
210
|
+
signature: "scrollToItem(nodeId: string | number): void",
|
|
211
|
+
parameters: {
|
|
212
|
+
nodeId: "The ID of the node to scroll to (source data format)",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
200
215
|
appendNode: {
|
|
201
216
|
description: `Add a new node to the tree as a child of the specified parent node.`,
|
|
202
217
|
signature: "appendNode(parentNodeId: string | number | null, nodeData: any): void",
|
|
@@ -235,6 +250,27 @@ exports.TreeMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
235
250
|
nodeData: "The node data object using the format specified in dataFormat and field properties",
|
|
236
251
|
},
|
|
237
252
|
},
|
|
253
|
+
getNodeLoadingState: {
|
|
254
|
+
description: `Get the loading state of a dynamic node.`,
|
|
255
|
+
signature: "getNodeLoadingState(nodeId: string | number): NodeLoadingState",
|
|
256
|
+
parameters: {
|
|
257
|
+
nodeId: "The ID of the node to check loading state for",
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
markNodeLoaded: {
|
|
261
|
+
description: `Mark a dynamic node as loaded.`,
|
|
262
|
+
signature: "markNodeLoaded(nodeId: string | number): void",
|
|
263
|
+
parameters: {
|
|
264
|
+
nodeId: "The ID of the node to mark as loaded",
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
markNodeUnloaded: {
|
|
268
|
+
description: `Mark a dynamic node as unloaded and collapse it.`,
|
|
269
|
+
signature: "markNodeUnloaded(nodeId: string | number): void",
|
|
270
|
+
parameters: {
|
|
271
|
+
nodeId: "The ID of the node to mark as unloaded",
|
|
272
|
+
},
|
|
273
|
+
},
|
|
238
274
|
},
|
|
239
275
|
themeVars: (0, themeVars_1.parseScssVar)(TreeComponent_module_scss_1.default.themeVars),
|
|
240
276
|
defaultThemeVars: {
|
|
@@ -263,6 +299,7 @@ exports.treeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, e
|
|
|
263
299
|
type: "HStack",
|
|
264
300
|
props: {
|
|
265
301
|
verticalAlignment: "center",
|
|
302
|
+
gap: "$space-4"
|
|
266
303
|
},
|
|
267
304
|
children: [
|
|
268
305
|
{
|