xmlui 0.10.19 → 0.10.20
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/{apiInterceptorWorker-DPgtUtdA.mjs → apiInterceptorWorker-QiltRtq1.mjs} +1 -1
- package/dist/lib/{index-cuh97e2e.mjs → index-Ckhnrf1F.mjs} +848 -615
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-C-cnv--V.mjs → lib/initMock-qnCFw6Zc.mjs} +25 -15
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-CtY0QcvH.mjs → metadata-utils-BTIt1_wE.mjs} +1 -1
- package/dist/lib/{server-common-Cine5nRR.mjs → server-common-DYZtsdM7.mjs} +51 -14
- package/dist/lib/{transform-bHBjkKSL.mjs → transform-Tooy42EB.mjs} +16 -18
- package/dist/lib/xmlui-parser.mjs +2 -2
- package/dist/lib/{xmlui-serializer-DB6BLiXK.mjs → xmlui-serializer-uCYa8_tZ.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +11 -3
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{apiInterceptorWorker-BmKP8bnq.mjs → apiInterceptorWorker-Dql7QGw2.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-Cp-9lpnG.mjs → collectedComponentMetadata-Dg7P-zOz.mjs} +824 -600
- package/dist/{lib/initMock-BMxsanHc.mjs → metadata/initMock-ZyyFNOpL.mjs} +25 -15
- 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 +28 -28
- package/dist/scripts/src/components/App/App.spec.js +17 -17
- package/dist/scripts/src/components/AppState/AppState.js +3 -2
- package/dist/scripts/src/components/AppState/AppState.spec.js +26 -2
- package/dist/scripts/src/components/AppState/AppStateNative.js +3 -4
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +15 -10
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +4 -4
- package/dist/scripts/src/components/Carousel/Carousel.spec.js +214 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +193 -0
- package/dist/scripts/src/components/DateInput/DateInput.spec.js +6 -6
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +3 -3
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +4 -13
- package/dist/scripts/src/components/Form/Form.spec.js +25 -9
- package/dist/scripts/src/components/Form/FormNative.js +7 -4
- package/dist/scripts/src/components/FormItem/FormItem.js +3 -1
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +5 -14
- package/dist/scripts/src/components/FormItem/FormItemNative.js +12 -8
- package/dist/scripts/src/components/FormItem/Validations.js +2 -2
- package/dist/scripts/src/components/IconRegistryContext.js +1 -1
- package/dist/scripts/src/components/List/ListNative.js +2 -2
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +3 -12
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +2 -2
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +6 -3
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +3 -3
- package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +2 -2
- package/dist/scripts/src/components/Pagination/Pagination.spec.js +5 -0
- package/dist/scripts/src/components/Pagination/PaginationNative.js +1 -3
- package/dist/scripts/src/components/Queue/Queue.spec.js +45 -47
- package/dist/scripts/src/components/Queue/QueueNative.js +1 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +5 -5
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +1 -1
- package/dist/scripts/src/components/Select/MultiSelectOption.js +42 -0
- package/dist/scripts/src/components/Select/Select.js +3 -3
- package/dist/scripts/src/components/Select/SelectContext.js +8 -1
- package/dist/scripts/src/components/Select/SelectNative.js +134 -142
- package/dist/scripts/src/components/Select/SelectOption.js +34 -0
- package/dist/scripts/src/components/Select/SimpleSelect.js +57 -0
- package/dist/scripts/src/components/Spinner/Spinner.spec.js +1 -1
- package/dist/scripts/src/components/Table/useRowSelection.js +14 -23
- package/dist/scripts/src/components/TextArea/TextArea.spec.js +8 -8
- package/dist/scripts/src/components/Theme/Theme.js +2 -1
- package/dist/scripts/src/components/Theme/Theme.spec.js +266 -0
- package/dist/scripts/src/components/Theme/ThemeNative.js +8 -1
- package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +3 -3
- package/dist/scripts/src/components/Tree/TreeNative.js +9 -11
- package/dist/scripts/src/components-core/InspectorContext.js +1 -1
- package/dist/scripts/src/components-core/StandaloneApp.js +6 -8
- package/dist/scripts/src/components-core/action/FileUploadAction.js +1 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +50 -0
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +6 -1
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +9 -11
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +3 -3
- package/dist/scripts/src/components-core/interception/Backend.js +1 -1
- package/dist/scripts/src/components-core/interception/IndexedDb.js +64 -66
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +2 -2
- package/dist/scripts/src/components-core/loader/DataLoader.js +6 -14
- package/dist/scripts/src/components-core/loader/Loader.js +11 -11
- package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +4 -2
- package/dist/scripts/src/components-core/loader/PageableLoader.js +10 -9
- package/dist/scripts/src/components-core/rendering/AppContent.js +1 -7
- package/dist/scripts/src/components-core/rendering/ErrorBoundary.js +1 -1
- package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +1 -1
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +180 -186
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +6 -6
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +2 -2
- package/dist/scripts/src/components-core/utils/actionUtils.js +1 -1
- package/dist/scripts/src/components-core/utils/hooks.js +1 -1
- package/dist/scripts/src/components-core/utils/misc.js +4 -4
- package/dist/scripts/src/components-core/xmlui-parser.js +47 -31
- package/dist/scripts/src/language-server/server-common.js +25 -24
- package/dist/scripts/src/language-server/services/common/lsp-utils.js +2 -2
- package/dist/scripts/src/language-server/services/completion.js +20 -2
- package/dist/scripts/src/language-server/services/diagnostic.js +1 -1
- package/dist/scripts/src/language-server/services/hover.js +2 -2
- package/dist/scripts/src/parsers/common/utils.js +2 -2
- package/dist/scripts/src/parsers/scripting/Lexer.js +21 -15
- package/dist/scripts/src/parsers/scripting/Parser.js +8 -9
- package/dist/scripts/src/parsers/style-parser/StyleLexer.js +22 -22
- package/dist/scripts/src/parsers/style-parser/StyleParser.js +70 -68
- package/dist/scripts/src/testing/ComponentDrivers.js +20 -39
- package/dist/scripts/src/testing/component-test-helpers.js +34 -50
- package/dist/scripts/src/testing/fixtures.js +114 -113
- package/dist/scripts/src/testing/themed-app-test-helpers.js +7 -13
- package/dist/standalone/xmlui-standalone.es.d.ts +11 -3
- package/dist/standalone/xmlui-standalone.umd.js +12 -12
- package/package.json +1 -1
|
@@ -98,7 +98,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
98
98
|
const textarea = page.getByRole("textbox");
|
|
99
99
|
yield textarea.fill("Some content");
|
|
100
100
|
yield (0, fixtures_1.expect)(textarea).toHaveValue("Some content");
|
|
101
|
-
(0, fixtures_1.expect)(textarea).toHaveAttribute("placeholder", "Enter comments");
|
|
101
|
+
yield (0, fixtures_1.expect)(textarea).toHaveAttribute("placeholder", "Enter comments");
|
|
102
102
|
}));
|
|
103
103
|
(0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
104
104
|
yield initTestBed(`<TextArea maxLength="10" />`);
|
|
@@ -275,7 +275,7 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
275
275
|
}));
|
|
276
276
|
(0, fixtures_1.test)("component is keyboard accessible when interactive", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
277
277
|
const { testStateDriver } = yield initTestBed(`
|
|
278
|
-
<TextArea
|
|
278
|
+
<TextArea
|
|
279
279
|
label="Comments"
|
|
280
280
|
onGotFocus="testState = 'keyboard-focused'"
|
|
281
281
|
/>
|
|
@@ -408,7 +408,7 @@ fixtures_1.test.describe("Visual States", () => {
|
|
|
408
408
|
testThemeVars: {
|
|
409
409
|
"backgroundColor-TextArea--disabled": "rgb(255, 0, 0)",
|
|
410
410
|
"textColor-TextArea--disabled": "rgb(0, 255, 0)",
|
|
411
|
-
"borderColor-TextArea--disabled": "rgb(0, 0, 255)"
|
|
411
|
+
"borderColor-TextArea--disabled": "rgb(0, 0, 255)",
|
|
412
412
|
},
|
|
413
413
|
});
|
|
414
414
|
const textarea = page.getByRole("textbox");
|
|
@@ -510,15 +510,15 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
510
510
|
yield (0, fixtures_1.expect)(textarea).toBeVisible();
|
|
511
511
|
yield (0, fixtures_1.expect)(textarea).toHaveValue(longValue);
|
|
512
512
|
}));
|
|
513
|
-
(0, fixtures_1.test)("component handles invalid maxRows/minRows combinations with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
513
|
+
(0, fixtures_1.test)("component handles invalid maxRows/minRows combinations with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
514
514
|
yield initTestBed(`<TextArea autoSize="true" maxRows="2" minRows="5" />`);
|
|
515
515
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
516
516
|
}));
|
|
517
|
-
(0, fixtures_1.test)("component handles zero maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
517
|
+
(0, fixtures_1.test)("component handles zero maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
518
518
|
yield initTestBed(`<TextArea autoSize="true" maxRows="0" minRows="0" />`);
|
|
519
519
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
520
520
|
}));
|
|
521
|
-
(0, fixtures_1.test)("component handles negative maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
521
|
+
(0, fixtures_1.test)("component handles negative maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
522
522
|
yield initTestBed(`<TextArea autoSize="true" maxRows="{-1}" minRows="{-1}" />`);
|
|
523
523
|
yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
|
|
524
524
|
}));
|
|
@@ -529,7 +529,7 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
529
529
|
fixtures_1.test.describe("Performance", () => {
|
|
530
530
|
(0, fixtures_1.test)("component memoization prevents unnecessary re-renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
531
531
|
const { testStateDriver } = yield initTestBed(`
|
|
532
|
-
<TextArea
|
|
532
|
+
<TextArea
|
|
533
533
|
label="Performance Test"
|
|
534
534
|
onDidChange="testState = ++testState || 1"
|
|
535
535
|
/>
|
|
@@ -620,7 +620,7 @@ fixtures_1.test.describe("Integration", () => {
|
|
|
620
620
|
(0, fixtures_1.test)("component works with event handling chain", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
621
621
|
const { testStateDriver } = yield initTestBed(`
|
|
622
622
|
<Fragment>
|
|
623
|
-
<TextArea
|
|
623
|
+
<TextArea
|
|
624
624
|
onGotFocus="testState = 'focused'"
|
|
625
625
|
onLostFocus="testState = 'blurred'"
|
|
626
626
|
onDidChange="(value) => testState = 'changed: ' + value"
|
|
@@ -31,6 +31,7 @@ exports.ThemeMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
31
31
|
defaultValue: "light",
|
|
32
32
|
},
|
|
33
33
|
root: (0, metadata_helpers_1.d)(`This property indicates whether the component is at the root of the application.`, undefined, "boolean", ThemeNative_1.defaultProps.root),
|
|
34
|
+
applyIf: (0, metadata_helpers_1.d)(`This property controls whether the theme wrapper is applied. When true (default), the theme wraps the children. When false, children are rendered unwrapped.`, undefined, "boolean", true),
|
|
34
35
|
},
|
|
35
36
|
opaque: true,
|
|
36
37
|
});
|
|
@@ -42,5 +43,5 @@ exports.themeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
|
|
|
42
43
|
if (themeTone && themeTone !== "dark") {
|
|
43
44
|
themeTone = "light";
|
|
44
45
|
}
|
|
45
|
-
return ((0, jsx_runtime_1.jsx)(ThemeNative_1.Theme, { id: extractValue.asOptionalString(node.props.themeId), isRoot: extractValue.asOptionalBoolean(node.props.root), layoutContext: layoutContext, renderChild: renderChild, tone: themeTone, toastDuration: toastDuration, themeVars: extractValue(restProps), node: node }));
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(ThemeNative_1.Theme, { id: extractValue.asOptionalString(node.props.themeId), isRoot: extractValue.asOptionalBoolean(node.props.root), applyIf: extractValue.asOptionalBoolean(node.props.applyIf), layoutContext: layoutContext, renderChild: renderChild, tone: themeTone, toastDuration: toastDuration, themeVars: extractValue(restProps), node: node }));
|
|
46
47
|
});
|
|
@@ -122,3 +122,269 @@ fixtures_1.test.use({ viewport: { width: PAGE_WIDTH, height: PAGE_HEIGHT } });
|
|
|
122
122
|
(0, fixtures_1.expect)(h1Color).toBe("rgb(255, 0, 0)");
|
|
123
123
|
(0, fixtures_1.expect)(h2Color).toBe("rgb(0, 255, 0)");
|
|
124
124
|
}));
|
|
125
|
+
// =============================================================================
|
|
126
|
+
// APPLYIF PROPERTY TESTS
|
|
127
|
+
// =============================================================================
|
|
128
|
+
fixtures_1.test.describe("applyIf Property", () => {
|
|
129
|
+
(0, fixtures_1.test)("applies theme when applyIf is true (default)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
130
|
+
const EXPECTED_COLOR = "rgb(255, 0, 0)";
|
|
131
|
+
yield initTestBed(`
|
|
132
|
+
<App>
|
|
133
|
+
<Theme backgroundColor-Button="${EXPECTED_COLOR}" applyIf="true">
|
|
134
|
+
<Button testId="themed-button">Themed Button</Button>
|
|
135
|
+
</Theme>
|
|
136
|
+
</App>
|
|
137
|
+
`);
|
|
138
|
+
const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("themed-button"), "background-color");
|
|
139
|
+
(0, fixtures_1.expect)(backgroundColor).toBe(EXPECTED_COLOR);
|
|
140
|
+
}));
|
|
141
|
+
(0, fixtures_1.test)("applies theme when applyIf is omitted (defaults to true)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
142
|
+
const EXPECTED_COLOR = "rgb(0, 255, 0)";
|
|
143
|
+
yield initTestBed(`
|
|
144
|
+
<App>
|
|
145
|
+
<Theme backgroundColor-Button="${EXPECTED_COLOR}">
|
|
146
|
+
<Button testId="themed-button">Themed Button</Button>
|
|
147
|
+
</Theme>
|
|
148
|
+
</App>
|
|
149
|
+
`);
|
|
150
|
+
const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("themed-button"), "background-color");
|
|
151
|
+
(0, fixtures_1.expect)(backgroundColor).toBe(EXPECTED_COLOR);
|
|
152
|
+
}));
|
|
153
|
+
(0, fixtures_1.test)("does not apply theme when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
154
|
+
const THEME_COLOR = "rgb(255, 0, 0)";
|
|
155
|
+
yield initTestBed(`
|
|
156
|
+
<App>
|
|
157
|
+
<Theme backgroundColor-Button="${THEME_COLOR}" applyIf="false">
|
|
158
|
+
<Button testId="unthemed-button">Unthemed Button</Button>
|
|
159
|
+
</Theme>
|
|
160
|
+
</App>
|
|
161
|
+
`);
|
|
162
|
+
const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("unthemed-button"), "background-color");
|
|
163
|
+
// Should not have the theme color when applyIf is false
|
|
164
|
+
(0, fixtures_1.expect)(backgroundColor).not.toBe(THEME_COLOR);
|
|
165
|
+
}));
|
|
166
|
+
(0, fixtures_1.test)("renders children without theme wrapper when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
167
|
+
yield initTestBed(`
|
|
168
|
+
<App>
|
|
169
|
+
<Theme tone="dark" applyIf="false">
|
|
170
|
+
<Button testId="button">Button Text</Button>
|
|
171
|
+
<H1 testId="header">Header Text</H1>
|
|
172
|
+
</Theme>
|
|
173
|
+
</App>
|
|
174
|
+
`);
|
|
175
|
+
// Children should still be rendered and visible
|
|
176
|
+
yield (0, fixtures_1.expect)(page.getByTestId("button")).toBeVisible();
|
|
177
|
+
yield (0, fixtures_1.expect)(page.getByTestId("header")).toBeVisible();
|
|
178
|
+
yield (0, fixtures_1.expect)(page.getByTestId("button")).toHaveText("Button Text");
|
|
179
|
+
yield (0, fixtures_1.expect)(page.getByTestId("header")).toHaveText("Header Text");
|
|
180
|
+
}));
|
|
181
|
+
(0, fixtures_1.test)("supports dynamic applyIf with binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
182
|
+
const { testStateDriver } = yield initTestBed(`
|
|
183
|
+
<App>
|
|
184
|
+
<Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState === true}">
|
|
185
|
+
<Button testId="conditional-button" onClick="testState = testState === true ? false : true">Toggle Theme</Button>
|
|
186
|
+
</Theme>
|
|
187
|
+
</App>
|
|
188
|
+
`);
|
|
189
|
+
// Initially testState is null, expression evaluates to false
|
|
190
|
+
const initialBackground = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("conditional-button"), "background-color");
|
|
191
|
+
(0, fixtures_1.expect)(initialBackground.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
192
|
+
// Click to make testState true, theme should be applied
|
|
193
|
+
yield page.getByTestId("conditional-button").click();
|
|
194
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(true);
|
|
195
|
+
const appliedBackground = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("conditional-button"), "background-color");
|
|
196
|
+
(0, fixtures_1.expect)(appliedBackground.backgroundColor).toBe("rgb(255, 0, 0)");
|
|
197
|
+
// Click again to make testState false, theme should not be applied
|
|
198
|
+
yield page.getByTestId("conditional-button").click();
|
|
199
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(false);
|
|
200
|
+
const removedBackground = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("conditional-button"), "background-color");
|
|
201
|
+
(0, fixtures_1.expect)(removedBackground.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
202
|
+
}));
|
|
203
|
+
(0, fixtures_1.test)("handles nested themes with different applyIf values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
204
|
+
const OUTER_COLOR = "rgb(255, 0, 0)";
|
|
205
|
+
const INNER_COLOR = "rgb(0, 255, 0)";
|
|
206
|
+
yield initTestBed(`
|
|
207
|
+
<App>
|
|
208
|
+
<Theme backgroundColor-Button="${OUTER_COLOR}" applyIf="true">
|
|
209
|
+
<Button testId="outer-themed">Outer Themed</Button>
|
|
210
|
+
<Theme backgroundColor-Button="${INNER_COLOR}" applyIf="false">
|
|
211
|
+
<Button testId="inner-unthemed">Inner Unthemed</Button>
|
|
212
|
+
</Theme>
|
|
213
|
+
</Theme>
|
|
214
|
+
</App>
|
|
215
|
+
`);
|
|
216
|
+
// Outer button should have outer theme applied
|
|
217
|
+
const { backgroundColor: outerBg } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("outer-themed"), "background-color");
|
|
218
|
+
(0, fixtures_1.expect)(outerBg).toBe(OUTER_COLOR);
|
|
219
|
+
// Inner button should inherit outer theme (inner theme not applied due to applyIf=false)
|
|
220
|
+
const { backgroundColor: innerBg } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("inner-unthemed"), "background-color");
|
|
221
|
+
(0, fixtures_1.expect)(innerBg).toBe(OUTER_COLOR); // Should inherit from outer theme
|
|
222
|
+
}));
|
|
223
|
+
(0, fixtures_1.test)("applies multiple theme variables when applyIf is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
224
|
+
const BG_COLOR = "rgb(255, 0, 0)";
|
|
225
|
+
const TEXT_COLOR = "rgb(0, 255, 0)";
|
|
226
|
+
yield initTestBed(`
|
|
227
|
+
<App>
|
|
228
|
+
<Theme
|
|
229
|
+
backgroundColor-Button="${BG_COLOR}"
|
|
230
|
+
textColor-Button="${TEXT_COLOR}"
|
|
231
|
+
applyIf="true"
|
|
232
|
+
>
|
|
233
|
+
<Button testId="multi-themed">Multi Themed</Button>
|
|
234
|
+
</Theme>
|
|
235
|
+
</App>
|
|
236
|
+
`);
|
|
237
|
+
const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("multi-themed"), "background-color");
|
|
238
|
+
const { color } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("multi-themed"), "color");
|
|
239
|
+
(0, fixtures_1.expect)(backgroundColor).toBe(BG_COLOR);
|
|
240
|
+
(0, fixtures_1.expect)(color).toBe(TEXT_COLOR);
|
|
241
|
+
}));
|
|
242
|
+
(0, fixtures_1.test)("does not apply any theme variables when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
243
|
+
const BG_COLOR = "rgb(255, 0, 0)";
|
|
244
|
+
const TEXT_COLOR = "rgb(0, 255, 0)";
|
|
245
|
+
yield initTestBed(`
|
|
246
|
+
<App>
|
|
247
|
+
<Theme
|
|
248
|
+
backgroundColor-Button="${BG_COLOR}"
|
|
249
|
+
textColor-Button="${TEXT_COLOR}"
|
|
250
|
+
applyIf="false"
|
|
251
|
+
>
|
|
252
|
+
<Button testId="no-theme">No Theme</Button>
|
|
253
|
+
</Theme>
|
|
254
|
+
</App>
|
|
255
|
+
`);
|
|
256
|
+
const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("no-theme"), "background-color");
|
|
257
|
+
const { color } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("no-theme"), "color");
|
|
258
|
+
(0, fixtures_1.expect)(backgroundColor).not.toBe(BG_COLOR);
|
|
259
|
+
(0, fixtures_1.expect)(color).not.toBe(TEXT_COLOR);
|
|
260
|
+
}));
|
|
261
|
+
});
|
|
262
|
+
// =============================================================================
|
|
263
|
+
// APPLYIF EDGE CASES
|
|
264
|
+
// =============================================================================
|
|
265
|
+
fixtures_1.test.describe("applyIf Edge Cases", () => {
|
|
266
|
+
(0, fixtures_1.test)("handles null applyIf value gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
267
|
+
const { testStateDriver } = yield initTestBed(`
|
|
268
|
+
<App>
|
|
269
|
+
<Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState === 'apply'}">
|
|
270
|
+
<Button testId="null-apply" onClick="testState = testState === 'apply' ? null : 'apply'">Button</Button>
|
|
271
|
+
</Theme>
|
|
272
|
+
</App>
|
|
273
|
+
`);
|
|
274
|
+
// Initially testState is null, expression evaluates to false
|
|
275
|
+
const initialBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("null-apply"), "background-color");
|
|
276
|
+
(0, fixtures_1.expect)(initialBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
277
|
+
// Button should still be visible
|
|
278
|
+
yield (0, fixtures_1.expect)(page.getByTestId("null-apply")).toBeVisible();
|
|
279
|
+
// Click to set testState to 'apply', theme should be applied
|
|
280
|
+
yield page.getByTestId("null-apply").click();
|
|
281
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe("apply");
|
|
282
|
+
const appliedBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("null-apply"), "background-color");
|
|
283
|
+
(0, fixtures_1.expect)(appliedBg.backgroundColor).toBe("rgb(255, 0, 0)");
|
|
284
|
+
// Click again to set testState to null, theme should not be applied
|
|
285
|
+
yield page.getByTestId("null-apply").click();
|
|
286
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(null);
|
|
287
|
+
const removedBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("null-apply"), "background-color");
|
|
288
|
+
(0, fixtures_1.expect)(removedBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
289
|
+
}));
|
|
290
|
+
(0, fixtures_1.test)("handles undefined applyIf value (defaults to true)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
291
|
+
const { testStateDriver } = yield initTestBed(`
|
|
292
|
+
<App>
|
|
293
|
+
<Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState > 10 ? true : undefined}">
|
|
294
|
+
<Button testId="undefined-apply" onClick="testState = testState == null ? 5 : testState + 10">Button</Button>
|
|
295
|
+
</Theme>
|
|
296
|
+
</App>
|
|
297
|
+
`);
|
|
298
|
+
// Initially testState is null, expression evaluates to undefined (should use default true)
|
|
299
|
+
const initialBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("undefined-apply"), "background-color");
|
|
300
|
+
(0, fixtures_1.expect)(initialBg.backgroundColor).toBe("rgb(255, 0, 0)"); // undefined should default to true
|
|
301
|
+
// Button should still be visible
|
|
302
|
+
yield (0, fixtures_1.expect)(page.getByTestId("undefined-apply")).toBeVisible();
|
|
303
|
+
// Click to set testState to 5, expression evaluates to undefined (should use default true)
|
|
304
|
+
yield page.getByTestId("undefined-apply").click();
|
|
305
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(5);
|
|
306
|
+
const afterFirstClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("undefined-apply"), "background-color");
|
|
307
|
+
(0, fixtures_1.expect)(afterFirstClickBg.backgroundColor).toBe("rgb(255, 0, 0)"); // undefined should default to true
|
|
308
|
+
// Click again to set testState to 15, expression evaluates to true (explicit true)
|
|
309
|
+
yield page.getByTestId("undefined-apply").click();
|
|
310
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(15);
|
|
311
|
+
const afterSecondClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("undefined-apply"), "background-color");
|
|
312
|
+
(0, fixtures_1.expect)(afterSecondClickBg.backgroundColor).toBe("rgb(255, 0, 0)");
|
|
313
|
+
}));
|
|
314
|
+
(0, fixtures_1.test)("handles string 'false' as truthy value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
315
|
+
yield initTestBed(`
|
|
316
|
+
<App>
|
|
317
|
+
<Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="false">
|
|
318
|
+
<Button testId="string-false">Button</Button>
|
|
319
|
+
</Theme>
|
|
320
|
+
</App>
|
|
321
|
+
`);
|
|
322
|
+
// String "false" should be treated as boolean false, so theme should not be applied
|
|
323
|
+
const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("string-false"), "background-color");
|
|
324
|
+
(0, fixtures_1.expect)(backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
325
|
+
}));
|
|
326
|
+
(0, fixtures_1.test)("handles numeric values correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
327
|
+
const THEME_COLOR = "rgb(255, 0, 0)";
|
|
328
|
+
// Test with 0 (falsy)
|
|
329
|
+
yield initTestBed(`
|
|
330
|
+
<App>
|
|
331
|
+
<Theme backgroundColor-Button="${THEME_COLOR}" applyIf="{0}">
|
|
332
|
+
<Button testId="zero-apply">Button Zero</Button>
|
|
333
|
+
</Theme>
|
|
334
|
+
</App>
|
|
335
|
+
`);
|
|
336
|
+
const { backgroundColor: zeroBg } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("zero-apply"), "background-color");
|
|
337
|
+
(0, fixtures_1.expect)(zeroBg).not.toBe(THEME_COLOR);
|
|
338
|
+
}));
|
|
339
|
+
(0, fixtures_1.test)("works with complex conditional expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
340
|
+
const { testStateDriver } = yield initTestBed(`
|
|
341
|
+
<App>
|
|
342
|
+
<Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState > 5}">
|
|
343
|
+
<Button testId="complex-condition" onClick="testState = testState == null ? 1 : testState + 3">
|
|
344
|
+
Increment by 3
|
|
345
|
+
</Button>
|
|
346
|
+
</Theme>
|
|
347
|
+
</App>
|
|
348
|
+
`);
|
|
349
|
+
// Initially testState is null, condition should be false
|
|
350
|
+
const initialBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
|
|
351
|
+
(0, fixtures_1.expect)(initialBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
352
|
+
// Click once: testState becomes 1 (1 > 5 is false)
|
|
353
|
+
yield page.getByTestId("complex-condition").click();
|
|
354
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(1);
|
|
355
|
+
const firstClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
|
|
356
|
+
(0, fixtures_1.expect)(firstClickBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
357
|
+
// Click again: testState becomes 4 (4 > 5 is false)
|
|
358
|
+
yield page.getByTestId("complex-condition").click();
|
|
359
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(4);
|
|
360
|
+
const secondClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
|
|
361
|
+
(0, fixtures_1.expect)(secondClickBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
|
|
362
|
+
// Click again: testState becomes 7 (7 > 5 is true, theme should apply)
|
|
363
|
+
yield page.getByTestId("complex-condition").click();
|
|
364
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(7);
|
|
365
|
+
const thirdClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
|
|
366
|
+
(0, fixtures_1.expect)(thirdClickBg.backgroundColor).toBe("rgb(255, 0, 0)");
|
|
367
|
+
}));
|
|
368
|
+
(0, fixtures_1.test)("preserves children structure when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
|
|
369
|
+
yield initTestBed(`
|
|
370
|
+
<App>
|
|
371
|
+
<Theme applyIf="false">
|
|
372
|
+
<VStack testId="container">
|
|
373
|
+
<Button testId="first-button">First</Button>
|
|
374
|
+
<H1 testId="header">Header</H1>
|
|
375
|
+
<Button testId="second-button">Second</Button>
|
|
376
|
+
</VStack>
|
|
377
|
+
</Theme>
|
|
378
|
+
</App>
|
|
379
|
+
`);
|
|
380
|
+
// All children should be present and in correct order
|
|
381
|
+
yield (0, fixtures_1.expect)(page.getByTestId("container")).toBeVisible();
|
|
382
|
+
yield (0, fixtures_1.expect)(page.getByTestId("first-button")).toBeVisible();
|
|
383
|
+
yield (0, fixtures_1.expect)(page.getByTestId("header")).toBeVisible();
|
|
384
|
+
yield (0, fixtures_1.expect)(page.getByTestId("second-button")).toBeVisible();
|
|
385
|
+
// Check text content is preserved
|
|
386
|
+
yield (0, fixtures_1.expect)(page.getByTestId("first-button")).toHaveText("First");
|
|
387
|
+
yield (0, fixtures_1.expect)(page.getByTestId("header")).toHaveText("Header");
|
|
388
|
+
yield (0, fixtures_1.expect)(page.getByTestId("second-button")).toHaveText("Second");
|
|
389
|
+
}));
|
|
390
|
+
});
|
|
@@ -22,11 +22,12 @@ const StyleContext_1 = require("../../components-core/theming/StyleContext");
|
|
|
22
22
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
23
23
|
exports.defaultProps = {
|
|
24
24
|
isRoot: false,
|
|
25
|
+
applyIf: true,
|
|
25
26
|
toastDuration: 5000,
|
|
26
27
|
themeVars: constants_1.EMPTY_OBJECT,
|
|
27
28
|
root: false,
|
|
28
29
|
};
|
|
29
|
-
function Theme({ id, isRoot = exports.defaultProps.isRoot, renderChild, node, tone, toastDuration = exports.defaultProps.toastDuration, themeVars = exports.defaultProps.themeVars, layoutContext, children, }) {
|
|
30
|
+
function Theme({ id, isRoot = exports.defaultProps.isRoot, applyIf, renderChild, node, tone, toastDuration = exports.defaultProps.toastDuration, themeVars = exports.defaultProps.themeVars, layoutContext, children, }) {
|
|
30
31
|
const generatedId = (0, react_1.useId)();
|
|
31
32
|
const { themes, resources, resourceMap, activeThemeId } = (0, ThemeContext_1.useThemes)();
|
|
32
33
|
const { activeTheme, activeThemeTone, root } = (0, ThemeContext_1.useTheme)();
|
|
@@ -115,6 +116,12 @@ function Theme({ id, isRoot = exports.defaultProps.isRoot, renderChild, node, to
|
|
|
115
116
|
if (indexing) {
|
|
116
117
|
return children;
|
|
117
118
|
}
|
|
119
|
+
// Use default value if applyIf is undefined
|
|
120
|
+
const shouldApplyTheme = applyIf !== null && applyIf !== void 0 ? applyIf : exports.defaultProps.applyIf;
|
|
121
|
+
// If applyIf is false, render children unwrapped without theme context
|
|
122
|
+
if (!shouldApplyTheme) {
|
|
123
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderChild && renderChild(node.children), children] }));
|
|
124
|
+
}
|
|
118
125
|
if (isRoot) {
|
|
119
126
|
const faviconUrl = getResourceUrl("resource:favicon") || "/resources/favicon.ico";
|
|
120
127
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_async_1.Helmet, { children: [!!faviconUrl && (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/svg+xml", href: faviconUrl }), fontLinks === null || fontLinks === void 0 ? void 0 : fontLinks.map((fontLink) => (0, jsx_runtime_1.jsx)("link", { href: fontLink, rel: "stylesheet" }, fontLink))] }), (0, jsx_runtime_1.jsx)(RootClasses, { classNames: rootClasses }), (0, jsx_runtime_1.jsxs)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "theme-root", children: [renderChild && renderChild(node.children), children] }), (0, jsx_runtime_1.jsx)(NotificationToast_1.NotificationToast, { toastDuration: toastDuration })] }));
|
|
@@ -328,18 +328,18 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
328
328
|
(0, fixtures_1.test)("clears value when clear button is clicked (clearToInitialValue is true)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver, }) {
|
|
329
329
|
yield initTestBed(`<TimeInput testId="timeInput" clearable="true" initialValue="14:30" />`);
|
|
330
330
|
const driver = yield createTimeInputDriver("timeInput");
|
|
331
|
-
driver.hourInput.fill("05");
|
|
331
|
+
yield driver.hourInput.fill("05");
|
|
332
332
|
yield driver.clearButton.click();
|
|
333
333
|
yield (0, fixtures_1.expect)(driver.hourInput).toHaveValue("14");
|
|
334
334
|
yield (0, fixtures_1.expect)(driver.minuteInput).toHaveValue("30");
|
|
335
335
|
}));
|
|
336
336
|
(0, fixtures_1.test)("clears value when clear button is clicked (clearToInitialValue is false)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver, }) {
|
|
337
337
|
yield initTestBed(`
|
|
338
|
-
<TimeInput testId="timeInput" clearable="true"
|
|
338
|
+
<TimeInput testId="timeInput" clearable="true"
|
|
339
339
|
clearToInitialValue="false" initialValue="14:30" />
|
|
340
340
|
`);
|
|
341
341
|
const driver = yield createTimeInputDriver("timeInput");
|
|
342
|
-
driver.hourInput.fill("05");
|
|
342
|
+
yield driver.hourInput.fill("05");
|
|
343
343
|
yield driver.clearButton.click();
|
|
344
344
|
yield (0, fixtures_1.expect)(driver.hourInput).toHaveValue("");
|
|
345
345
|
yield (0, fixtures_1.expect)(driver.minuteInput).toHaveValue("");
|
|
@@ -156,7 +156,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
156
156
|
// Helper function to update internal data and force re-render
|
|
157
157
|
const updateInternalData = (0, react_1.useCallback)((updater) => {
|
|
158
158
|
setInternalData(updater);
|
|
159
|
-
setDataRevision(prev => prev + 1);
|
|
159
|
+
setDataRevision((prev) => prev + 1);
|
|
160
160
|
}, []);
|
|
161
161
|
// Build field configuration
|
|
162
162
|
const fieldConfig = (0, react_1.useMemo)(() => ({
|
|
@@ -265,9 +265,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
265
265
|
return !!(fieldConfig.dynamicField && node[fieldConfig.dynamicField]);
|
|
266
266
|
};
|
|
267
267
|
if (defaultExpanded === "first-level") {
|
|
268
|
-
return treeData
|
|
269
|
-
.filter(node => !isDynamic(node))
|
|
270
|
-
.map((node) => node.key);
|
|
268
|
+
return treeData.filter((node) => !isDynamic(node)).map((node) => node.key);
|
|
271
269
|
}
|
|
272
270
|
else if (defaultExpanded === "all") {
|
|
273
271
|
const allIds = [];
|
|
@@ -288,7 +286,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
288
286
|
// Expand full paths to specified nodes by including all parent nodes
|
|
289
287
|
// But exclude dynamic nodes from the expansion
|
|
290
288
|
const expandedPaths = expandParentPaths(defaultExpanded, treeItemsById);
|
|
291
|
-
return expandedPaths.filter(nodeId => {
|
|
289
|
+
return expandedPaths.filter((nodeId) => {
|
|
292
290
|
const node = treeItemsById[String(nodeId)];
|
|
293
291
|
return !node || !isDynamic(node);
|
|
294
292
|
});
|
|
@@ -417,7 +415,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
417
415
|
const currentData = prevData !== null && prevData !== void 0 ? prevData : data;
|
|
418
416
|
if (dataFormat === "flat" && Array.isArray(currentData)) {
|
|
419
417
|
// Remove existing children of this node
|
|
420
|
-
return currentData.filter(item => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
|
|
418
|
+
return currentData.filter((item) => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
|
|
421
419
|
}
|
|
422
420
|
else if (dataFormat === "hierarchy" && Array.isArray(currentData)) {
|
|
423
421
|
// For hierarchy format, clear children array
|
|
@@ -446,7 +444,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
446
444
|
if (dataFormat === "flat" && Array.isArray(currentData)) {
|
|
447
445
|
// Replace existing children with newly loaded data
|
|
448
446
|
// Remove existing children of this node
|
|
449
|
-
const filteredData = currentData.filter(item => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
|
|
447
|
+
const filteredData = currentData.filter((item) => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
|
|
450
448
|
// Add new children
|
|
451
449
|
const newItems = loadedData.map((item) => (Object.assign(Object.assign({}, item), { [fieldConfig.parentField || "parentId"]: String(node.key) })));
|
|
452
450
|
return [...filteredData, ...newItems];
|
|
@@ -518,7 +516,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
518
516
|
const currentNode = flatTreeData[currentIndex];
|
|
519
517
|
if (currentNode.hasChildren && !currentNode.isExpanded) {
|
|
520
518
|
// Expand node
|
|
521
|
-
toggleNode(currentNode);
|
|
519
|
+
void toggleNode(currentNode);
|
|
522
520
|
}
|
|
523
521
|
else if (currentNode.hasChildren &&
|
|
524
522
|
currentNode.isExpanded &&
|
|
@@ -535,7 +533,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
535
533
|
const currentNode = flatTreeData[currentIndex];
|
|
536
534
|
if (currentNode.hasChildren && currentNode.isExpanded) {
|
|
537
535
|
// Collapse node
|
|
538
|
-
toggleNode(currentNode);
|
|
536
|
+
void toggleNode(currentNode);
|
|
539
537
|
}
|
|
540
538
|
else if (currentNode.depth > 0) {
|
|
541
539
|
// Move to parent - find previous node with smaller depth
|
|
@@ -572,7 +570,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
572
570
|
}
|
|
573
571
|
// Handle expansion for Enter key
|
|
574
572
|
if (e.key === "Enter" && currentNode.hasChildren) {
|
|
575
|
-
toggleNode(currentNode);
|
|
573
|
+
void toggleNode(currentNode);
|
|
576
574
|
}
|
|
577
575
|
}
|
|
578
576
|
handled = true;
|
|
@@ -683,7 +681,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
|
|
|
683
681
|
if (dataFormat === "flat" && Array.isArray(currentData)) {
|
|
684
682
|
// Replace existing children with newly loaded data
|
|
685
683
|
// Remove existing children of this node
|
|
686
|
-
const filteredData = currentData.filter(item => String(item[fieldConfig.parentField || "parentId"]) !== String(nodeId));
|
|
684
|
+
const filteredData = currentData.filter((item) => String(item[fieldConfig.parentField || "parentId"]) !== String(nodeId));
|
|
687
685
|
// Add new children
|
|
688
686
|
const newItems = loadedData.map((item) => (Object.assign(Object.assign({}, item), { [fieldConfig.parentField || "parentId"]: String(nodeId) })));
|
|
689
687
|
return [...filteredData, ...newItems];
|
|
@@ -175,7 +175,7 @@ function InspectButton({ inspectId, node, inspectedNode, setInspectedNode, setSh
|
|
|
175
175
|
htmlElement.removeEventListener("mouseenter", mouseenter);
|
|
176
176
|
htmlElement.removeEventListener("mouseleave", mouseleave);
|
|
177
177
|
};
|
|
178
|
-
}, [inspectId, node, inspectMode, setShowCode]);
|
|
178
|
+
}, [inspectId, node, inspectMode, setShowCode, setInspectedNode]);
|
|
179
179
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: inspectMode
|
|
180
180
|
? null
|
|
181
181
|
: visible &&
|
|
@@ -47,7 +47,7 @@ const metadataProvider = new metadata_utils_1.MetadataProvider(collectedComponen
|
|
|
47
47
|
* representation); ApiInterceptor can emulate some backend functionality
|
|
48
48
|
* running in the browser.
|
|
49
49
|
*/
|
|
50
|
-
function StandaloneApp({ appDef, appGlobals: globals, decorateComponentsWithTestId, debugEnabled = false, runtime, extensionManager, waitForApiInterceptor = false, children }) {
|
|
50
|
+
function StandaloneApp({ appDef, appGlobals: globals, decorateComponentsWithTestId, debugEnabled = false, runtime, extensionManager, waitForApiInterceptor = false, children, }) {
|
|
51
51
|
var _a;
|
|
52
52
|
// --- Fetch all files constituting the standalone app, including components,
|
|
53
53
|
// --- themes, and other artifacts. Display the app version numbers in the
|
|
@@ -377,12 +377,10 @@ function loadThemeFile(url) {
|
|
|
377
377
|
* @returns The source file contents response
|
|
378
378
|
*/
|
|
379
379
|
function fetchWithoutCache(url) {
|
|
380
|
-
return
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
},
|
|
385
|
-
});
|
|
380
|
+
return fetch((0, misc_1.normalizePath)(url), {
|
|
381
|
+
headers: {
|
|
382
|
+
"Cache-Control": "no-cache, no-store",
|
|
383
|
+
},
|
|
386
384
|
});
|
|
387
385
|
}
|
|
388
386
|
/**
|
|
@@ -412,7 +410,7 @@ function useStandalone(standaloneAppDef, runtime = constants_1.EMPTY_OBJECT, ext
|
|
|
412
410
|
});
|
|
413
411
|
const [projectCompilation, setProjectCompilation] = (0, react_1.useState)(null);
|
|
414
412
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
415
|
-
(function () {
|
|
413
|
+
void (function () {
|
|
416
414
|
return __awaiter(this, void 0, void 0, function* () {
|
|
417
415
|
var _a, _b, _c, _d, _e, _f;
|
|
418
416
|
const resolvedRuntime = resolveRuntime(runtime);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBehaviors = exports.BehaviorsProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const CoreBehaviors_1 = require("./CoreBehaviors");
|
|
7
|
+
// --- Create the context with a default value
|
|
8
|
+
const BehaviorContext = (0, react_1.createContext)(undefined);
|
|
9
|
+
/**
|
|
10
|
+
* A provider component that makes the behavior management system available to
|
|
11
|
+
* its children.
|
|
12
|
+
*/
|
|
13
|
+
const BehaviorsProvider = ({ children }) => {
|
|
14
|
+
const behaviors = (0, react_1.useMemo)(() => new Map(), []);
|
|
15
|
+
const registerBehavior = (0, react_1.useCallback)((behavior) => {
|
|
16
|
+
behaviors.set(behavior.name, behavior);
|
|
17
|
+
}, [behaviors]);
|
|
18
|
+
(0, react_1.useMemo)(() => {
|
|
19
|
+
if (process.env.VITE_USED_BEHAVIORS_Animation !== "false") {
|
|
20
|
+
registerBehavior(CoreBehaviors_1.animationBehavior);
|
|
21
|
+
}
|
|
22
|
+
if (process.env.VITE_USED_BEHAVIORS_Tooltip !== "false") {
|
|
23
|
+
registerBehavior(CoreBehaviors_1.tooltipBehavior);
|
|
24
|
+
}
|
|
25
|
+
if (process.env.VITE_USED_BEHAVIORS_Label !== "false") {
|
|
26
|
+
registerBehavior(CoreBehaviors_1.labelBehavior);
|
|
27
|
+
}
|
|
28
|
+
}, [registerBehavior]);
|
|
29
|
+
const contextValue = (0, react_1.useMemo)(() => ({
|
|
30
|
+
behaviors,
|
|
31
|
+
registerBehavior,
|
|
32
|
+
unregisterBehavior: (name) => behaviors.delete(name),
|
|
33
|
+
getBehaviors: () => {
|
|
34
|
+
return Array.from(behaviors.values());
|
|
35
|
+
},
|
|
36
|
+
}), [behaviors, registerBehavior]);
|
|
37
|
+
return (0, jsx_runtime_1.jsx)(BehaviorContext.Provider, { value: contextValue, children: children });
|
|
38
|
+
};
|
|
39
|
+
exports.BehaviorsProvider = BehaviorsProvider;
|
|
40
|
+
/**
|
|
41
|
+
* A custom hook to access the behavior context.
|
|
42
|
+
*/
|
|
43
|
+
const useBehaviors = () => {
|
|
44
|
+
const context = (0, react_1.useContext)(BehaviorContext);
|
|
45
|
+
if (!context) {
|
|
46
|
+
throw new Error("useBehaviors must be used within a BehaviorsProvider");
|
|
47
|
+
}
|
|
48
|
+
return context;
|
|
49
|
+
};
|
|
50
|
+
exports.useBehaviors = useBehaviors;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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");
|
|
5
6
|
const AnimationNative_1 = require("../../components/Animation/AnimationNative");
|
|
6
7
|
const ItemWithLabel_1 = require("../../components/FormItem/ItemWithLabel");
|
|
7
8
|
const TooltipNative_1 = require("../../components/Tooltip/TooltipNative");
|
|
@@ -41,7 +42,11 @@ exports.animationBehavior = {
|
|
|
41
42
|
const animation = extractValue((_a = context.node.props) === null || _a === void 0 ? void 0 : _a.animation, true);
|
|
42
43
|
const animationOptions = extractValue((_b = context.node.props) === null || _b === void 0 ? void 0 : _b.animationOptions, true);
|
|
43
44
|
const parsedOptions = (0, AnimationNative_1.parseAnimationOptions)(animationOptions);
|
|
44
|
-
return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, Object.assign({ animation: (0, AnimationNative_1.parseAnimation)(animation) }, parsedOptions, { children: node
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, Object.assign({ animation: (0, AnimationNative_1.parseAnimation)(animation) }, parsedOptions, { children: context.node.type === "ModalDialog"
|
|
46
|
+
? (0, react_1.cloneElement)(node, {
|
|
47
|
+
externalAnimation: true,
|
|
48
|
+
})
|
|
49
|
+
: node })));
|
|
45
50
|
},
|
|
46
51
|
};
|
|
47
52
|
/**
|