xmlui 0.10.19 → 0.10.21
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-BiS4wEuu.mjs} +1486 -1211
- package/dist/lib/index.css +1 -1
- package/dist/{metadata/initMock-C-cnv--V.mjs → lib/initMock-CB_cMi6U.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-MFUg6aSX.mjs} +1655 -1390
- package/dist/{lib/initMock-BMxsanHc.mjs → metadata/initMock-Dw9wrVkQ.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 +3 -6
- package/dist/scripts/src/components/Animation/AnimationNative.js +28 -28
- package/dist/scripts/src/components/App/App.js +4 -4
- package/dist/scripts/src/components/App/App.spec.js +17 -17
- package/dist/scripts/src/components/App/AppNative.js +1 -1
- 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/DateInput/DateInputNative.js +0 -1
- 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 -5
- 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/IFrame/IFrameNative.js +0 -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/Text/Text.js +5 -1
- package/dist/scripts/src/components/Text/Text.spec.js +317 -0
- package/dist/scripts/src/components/Text/TextNative.js +112 -1
- 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/TimeInput/TimeInputNative.js +0 -1
- package/dist/scripts/src/components/Timer/TimerNative.js +0 -1
- package/dist/scripts/src/components/Tree/TreeNative.js +16 -23
- 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 +35 -35
- package/package.json +3 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.21",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/color": "3.0.6",
|
|
55
55
|
"@vitejs/plugin-react": "4.3.0",
|
|
56
56
|
"adm-zip": "0.5.10",
|
|
57
|
-
"axios": "1.
|
|
57
|
+
"axios": "1.12.0",
|
|
58
58
|
"chroma-js": "^3.1.2",
|
|
59
59
|
"classnames": "2.5.1",
|
|
60
60
|
"cmdk": "^1.0.4",
|
|
@@ -95,8 +95,6 @@
|
|
|
95
95
|
"react-sticky-el": "^2.1.1",
|
|
96
96
|
"react-textarea-autosize": "8.5.3",
|
|
97
97
|
"react-time-picker": "^8.0.2",
|
|
98
|
-
"react-virtualized-auto-sizer": "1.0.24",
|
|
99
|
-
"react-window": "1.8.10",
|
|
100
98
|
"recharts": "^2.15.1",
|
|
101
99
|
"rehype-raw": "^7.0.0",
|
|
102
100
|
"remark-gfm": "^4.0.1",
|
|
@@ -106,7 +104,7 @@
|
|
|
106
104
|
"turndown": "^7.2.0",
|
|
107
105
|
"unist-util-visit": "^5.0.0",
|
|
108
106
|
"use-context-selector": "1.4.1",
|
|
109
|
-
"virtua": "0.40.0",
|
|
107
|
+
"virtua": "^0.40.0",
|
|
110
108
|
"vite-plugin-lib-inject-css": "1.3.0",
|
|
111
109
|
"vite-plugin-svgr": "4.2.0",
|
|
112
110
|
"vscode-languageserver": "^9.0.1",
|
|
@@ -131,7 +129,6 @@
|
|
|
131
129
|
"@types/react-datepicker": "4.19.5",
|
|
132
130
|
"@types/react-dom": "18.2.8",
|
|
133
131
|
"@types/react-measure": "^2.0.8",
|
|
134
|
-
"@types/react-window": "1.8.8",
|
|
135
132
|
"@types/yargs": "17.0.31",
|
|
136
133
|
"@typescript-eslint/eslint-plugin": "8.15.0",
|
|
137
134
|
"@typescript-eslint/parser": "8.15.0",
|
|
@@ -64,61 +64,61 @@ exports.defaultProps = {
|
|
|
64
64
|
animateWhenInView: false,
|
|
65
65
|
reverse: false,
|
|
66
66
|
loop: false,
|
|
67
|
-
once: false
|
|
67
|
+
once: false,
|
|
68
68
|
};
|
|
69
69
|
const parseAnimation = (animation) => {
|
|
70
|
-
if (typeof animation ===
|
|
70
|
+
if (typeof animation === "object") {
|
|
71
71
|
return animation;
|
|
72
72
|
}
|
|
73
73
|
const presetAnimations = {
|
|
74
74
|
fadein: {
|
|
75
75
|
from: { opacity: 0 },
|
|
76
|
-
to: { opacity: 1 }
|
|
76
|
+
to: { opacity: 1 },
|
|
77
77
|
},
|
|
78
78
|
fadeout: {
|
|
79
79
|
from: { opacity: 1 },
|
|
80
|
-
to: { opacity: 0 }
|
|
80
|
+
to: { opacity: 0 },
|
|
81
81
|
},
|
|
82
82
|
slidein: {
|
|
83
|
-
from: { transform:
|
|
84
|
-
to: { transform:
|
|
83
|
+
from: { transform: "translateX(-100%)" },
|
|
84
|
+
to: { transform: "translateX(0%)" },
|
|
85
85
|
},
|
|
86
86
|
slideout: {
|
|
87
|
-
from: { transform:
|
|
88
|
-
to: { transform:
|
|
87
|
+
from: { transform: "translateX(0%)" },
|
|
88
|
+
to: { transform: "translateX(100%)" },
|
|
89
89
|
},
|
|
90
90
|
popin: {
|
|
91
|
-
from: { transform:
|
|
92
|
-
to: { transform:
|
|
91
|
+
from: { transform: "scale(0.8)", opacity: 0 },
|
|
92
|
+
to: { transform: "scale(1)", opacity: 1 },
|
|
93
93
|
},
|
|
94
94
|
popout: {
|
|
95
|
-
from: { transform:
|
|
96
|
-
to: { transform:
|
|
95
|
+
from: { transform: "scale(1)", opacity: 1 },
|
|
96
|
+
to: { transform: "scale(0.8)", opacity: 0 },
|
|
97
97
|
},
|
|
98
98
|
flipin: {
|
|
99
|
-
from: { transform:
|
|
100
|
-
to: { transform:
|
|
99
|
+
from: { transform: "rotateY(90deg)", opacity: 0 },
|
|
100
|
+
to: { transform: "rotateY(0deg)", opacity: 1 },
|
|
101
101
|
},
|
|
102
102
|
flipout: {
|
|
103
|
-
from: { transform:
|
|
104
|
-
to: { transform:
|
|
103
|
+
from: { transform: "rotateY(0deg)", opacity: 1 },
|
|
104
|
+
to: { transform: "rotateY(90deg)", opacity: 0 },
|
|
105
105
|
},
|
|
106
106
|
rotatein: {
|
|
107
|
-
from: { transform:
|
|
108
|
-
to: { transform:
|
|
107
|
+
from: { transform: "rotate(-180deg)", opacity: 0 },
|
|
108
|
+
to: { transform: "rotate(0deg)", opacity: 1 },
|
|
109
109
|
},
|
|
110
110
|
rotateout: {
|
|
111
|
-
from: { transform:
|
|
112
|
-
to: { transform:
|
|
111
|
+
from: { transform: "rotate(0deg)", opacity: 1 },
|
|
112
|
+
to: { transform: "rotate(180deg)", opacity: 0 },
|
|
113
113
|
},
|
|
114
114
|
zoomin: {
|
|
115
|
-
from: { transform:
|
|
116
|
-
to: { transform:
|
|
115
|
+
from: { transform: "scale(0)", opacity: 0 },
|
|
116
|
+
to: { transform: "scale(1)", opacity: 1 },
|
|
117
117
|
},
|
|
118
118
|
zoomout: {
|
|
119
|
-
from: { transform:
|
|
120
|
-
to: { transform:
|
|
121
|
-
}
|
|
119
|
+
from: { transform: "scale(1)", opacity: 1 },
|
|
120
|
+
to: { transform: "scale(0)", opacity: 0 },
|
|
121
|
+
},
|
|
122
122
|
};
|
|
123
123
|
return presetAnimations[animation] || { from: {}, to: {} };
|
|
124
124
|
};
|
|
@@ -232,9 +232,9 @@ exports.Animation = (0, react_1.forwardRef)(function Animation(_a, forwardedRef)
|
|
|
232
232
|
onStart,
|
|
233
233
|
onStop,
|
|
234
234
|
reset,
|
|
235
|
+
once,
|
|
235
236
|
reverse,
|
|
236
237
|
toggle,
|
|
237
|
-
animationId,
|
|
238
238
|
]);
|
|
239
239
|
const [springs, api] = (0, web_1.useSpring)(() => (Object.assign({}, animationSettings)), [animationSettings]);
|
|
240
240
|
const [ref, animationStyles] = (0, web_1.useInView)(() => animationSettings, {
|
|
@@ -242,7 +242,7 @@ exports.Animation = (0, react_1.forwardRef)(function Animation(_a, forwardedRef)
|
|
|
242
242
|
});
|
|
243
243
|
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, forwardedRef) : forwardedRef;
|
|
244
244
|
const startAnimation = (0, react_2.useCallback)(() => {
|
|
245
|
-
api.start(_animation);
|
|
245
|
+
void api.start(_animation);
|
|
246
246
|
return () => {
|
|
247
247
|
api.stop();
|
|
248
248
|
};
|
|
@@ -258,6 +258,6 @@ exports.Animation = (0, react_1.forwardRef)(function Animation(_a, forwardedRef)
|
|
|
258
258
|
}, [registerComponentApi, startAnimation, stopAnimation]);
|
|
259
259
|
const content = (0, react_1.useMemo)(() => {
|
|
260
260
|
return react_1.Children.map(children, (child, index) => animateWhenInView ? ((0, jsx_runtime_1.jsx)(AnimatedComponent, Object.assign({}, rest, { style: animationStyles, ref: composedRef, children: child }), index)) : ((0, jsx_runtime_1.jsx)(AnimatedComponent, Object.assign({}, rest, { style: springs, ref: forwardedRef, children: child }), index)));
|
|
261
|
-
}, [animateWhenInView, animationStyles, children, springs, rest]);
|
|
261
|
+
}, [animateWhenInView, animationStyles, children, springs, rest, composedRef, forwardedRef]);
|
|
262
262
|
return content;
|
|
263
263
|
});
|
|
@@ -121,7 +121,7 @@ exports.AppMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
121
121
|
},
|
|
122
122
|
},
|
|
123
123
|
});
|
|
124
|
-
function AppNode({ node, extractValue, renderChild, className, lookupEventHandler }) {
|
|
124
|
+
function AppNode({ node, extractValue, renderChild, className, lookupEventHandler, registerComponentApi }) {
|
|
125
125
|
// --- Use ref to track if we've already processed the navigation to avoid duplicates in strict mode
|
|
126
126
|
const processedNavRef = (0, react_1.useRef)(false);
|
|
127
127
|
// --- Memoize the layout type to avoid unnecessary re-extraction
|
|
@@ -330,7 +330,7 @@ function AppNode({ node, extractValue, renderChild, className, lookupEventHandle
|
|
|
330
330
|
const renderedFooter = (0, react_1.useMemo)(() => renderChild(Footer), [Footer, renderChild]);
|
|
331
331
|
const renderedNavPanel = (0, react_1.useMemo)(() => renderChild(NavPanel), [NavPanel, renderChild]);
|
|
332
332
|
const renderedContent = (0, react_1.useMemo)(() => renderChild(restChildren), [restChildren, renderChild]);
|
|
333
|
-
return ((0, jsx_runtime_1.jsxs)(AppNative_1.App, Object.assign({}, appProps, { header: renderedHeader, footer: renderedFooter, navPanel: renderedNavPanel, navPanelDef: NavPanel, logoContentDef: node.props.logoTemplate, renderChild: renderChild, children: [renderedContent, (0, jsx_runtime_1.jsx)(SearchIndexCollector, { Pages: Pages, renderChild: renderChild })] })));
|
|
333
|
+
return ((0, jsx_runtime_1.jsxs)(AppNative_1.App, Object.assign({}, appProps, { header: renderedHeader, footer: renderedFooter, navPanel: renderedNavPanel, navPanelDef: NavPanel, logoContentDef: node.props.logoTemplate, renderChild: renderChild, registerComponentApi: registerComponentApi, children: [renderedContent, (0, jsx_runtime_1.jsx)(SearchIndexCollector, { Pages: Pages, renderChild: renderChild })] })));
|
|
334
334
|
}
|
|
335
335
|
const HIDDEN_STYLE = {
|
|
336
336
|
position: "absolute",
|
|
@@ -457,8 +457,8 @@ function PageIndexer({ Page, renderChild, onIndexed, }) {
|
|
|
457
457
|
// console.log(`PageIndexer (${pageUrl}): Rendering content for ref population.`);
|
|
458
458
|
return (0, jsx_runtime_1.jsx)("div", { ref: contentRef, children: renderChild(Page.children) });
|
|
459
459
|
}
|
|
460
|
-
exports.appRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppMd, ({ node, extractValue, renderChild, className, lookupEventHandler }) => {
|
|
461
|
-
return ((0, jsx_runtime_1.jsx)(AppNode, { node: node, renderChild: renderChild, extractValue: extractValue, className: className, lookupEventHandler: lookupEventHandler }));
|
|
460
|
+
exports.appRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppMd, ({ node, extractValue, renderChild, className, lookupEventHandler, registerComponentApi }) => {
|
|
461
|
+
return ((0, jsx_runtime_1.jsx)(AppNode, { node: node, renderChild: renderChild, extractValue: extractValue, className: className, lookupEventHandler: lookupEventHandler, registerComponentApi: registerComponentApi }));
|
|
462
462
|
});
|
|
463
463
|
// --- Process the entire navigation tree recursively and build hierarchy
|
|
464
464
|
function processNavItems(items, parentHierarchy, extractValue) {
|
|
@@ -42,7 +42,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
|
|
|
42
42
|
`);
|
|
43
43
|
const buttonDriver = yield createButtonDriver("toggleLayout");
|
|
44
44
|
yield (0, fixtures_1.expect)(page.getByTestId("app")).toHaveClass(/vertical/);
|
|
45
|
-
buttonDriver.click();
|
|
45
|
+
yield buttonDriver.click();
|
|
46
46
|
yield (0, fixtures_1.expect)(page.getByTestId("app")).toHaveClass(/horizontal/);
|
|
47
47
|
}));
|
|
48
48
|
(0, fixtures_1.test)("sets document title from name prop", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
@@ -115,8 +115,8 @@ fixtures_1.test.describe("Edge Cases", () => {
|
|
|
115
115
|
fixtures_1.test.describe("Event Handling", () => {
|
|
116
116
|
(0, fixtures_1.test)("ready event is triggered when App component finishes rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, }) {
|
|
117
117
|
const { testStateDriver } = yield initTestBed(`
|
|
118
|
-
<App
|
|
119
|
-
onReady="() => testState = 'app-ready'"
|
|
118
|
+
<App
|
|
119
|
+
onReady="() => testState = 'app-ready'"
|
|
120
120
|
testId="app"
|
|
121
121
|
/>
|
|
122
122
|
`);
|
|
@@ -125,8 +125,8 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
125
125
|
}));
|
|
126
126
|
(0, fixtures_1.test)("ready event is triggered for App with complex content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed }) {
|
|
127
127
|
const { testStateDriver } = yield initTestBed(`
|
|
128
|
-
<App
|
|
129
|
-
onReady="() => testState = 'complex-app-ready'"
|
|
128
|
+
<App
|
|
129
|
+
onReady="() => testState = 'complex-app-ready'"
|
|
130
130
|
layout="horizontal"
|
|
131
131
|
testId="app"
|
|
132
132
|
>
|
|
@@ -150,15 +150,15 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
150
150
|
}));
|
|
151
151
|
(0, fixtures_1.test)("ready event fires only once during component lifecycle", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
152
152
|
const { testStateDriver } = yield initTestBed(`
|
|
153
|
-
<App
|
|
153
|
+
<App
|
|
154
154
|
var.counter="{0}"
|
|
155
|
-
onReady="() => { counter = counter + 1; testState = counter; }"
|
|
155
|
+
onReady="() => { counter = counter + 1; testState = counter; }"
|
|
156
156
|
testId="app"
|
|
157
157
|
>
|
|
158
|
-
<Button
|
|
159
|
-
testId="trigger-rerender"
|
|
160
|
-
label="Re-render"
|
|
161
|
-
onClick="counter = counter"
|
|
158
|
+
<Button
|
|
159
|
+
testId="trigger-rerender"
|
|
160
|
+
label="Re-render"
|
|
161
|
+
onClick="counter = counter"
|
|
162
162
|
/>
|
|
163
163
|
</App>
|
|
164
164
|
`);
|
|
@@ -171,8 +171,8 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
171
171
|
}));
|
|
172
172
|
(0, fixtures_1.test)("messageReceived event is triggered when window receives a message", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
173
173
|
const { testStateDriver } = yield initTestBed(`
|
|
174
|
-
<App
|
|
175
|
-
onMessageReceived="(msg, ev) => testState = msg"
|
|
174
|
+
<App
|
|
175
|
+
onMessageReceived="(msg, ev) => testState = msg"
|
|
176
176
|
testId="app"
|
|
177
177
|
/>
|
|
178
178
|
`);
|
|
@@ -185,8 +185,8 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
185
185
|
}));
|
|
186
186
|
(0, fixtures_1.test)("messageReceived event receives both message data and event object", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
187
187
|
const { testStateDriver } = yield initTestBed(`
|
|
188
|
-
<App
|
|
189
|
-
onMessageReceived="(msg, ev) => testState = { message: msg, eventType: ev.type, origin: ev.origin }"
|
|
188
|
+
<App
|
|
189
|
+
onMessageReceived="(msg, ev) => testState = { message: msg, eventType: ev.type, origin: ev.origin }"
|
|
190
190
|
testId="app"
|
|
191
191
|
/>
|
|
192
192
|
`);
|
|
@@ -203,8 +203,8 @@ fixtures_1.test.describe("Event Handling", () => {
|
|
|
203
203
|
}));
|
|
204
204
|
(0, fixtures_1.test)("messageReceived event handles complex data objects", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
205
205
|
const { testStateDriver } = yield initTestBed(`
|
|
206
|
-
<App
|
|
207
|
-
onMessageReceived="(msg, ev) => testState = msg"
|
|
206
|
+
<App
|
|
207
|
+
onMessageReceived="(msg, ev) => testState = msg"
|
|
208
208
|
testId="app"
|
|
209
209
|
/>
|
|
210
210
|
`);
|
|
@@ -44,7 +44,7 @@ exports.defaultProps = {
|
|
|
44
44
|
onMessageReceived: lodash_es_1.noop,
|
|
45
45
|
};
|
|
46
46
|
function App(_a) {
|
|
47
|
-
var { children, style = constants_1.EMPTY_OBJECT, layout, loggedInUser, scrollWholePage = exports.defaultProps.scrollWholePage, noScrollbarGutters = exports.defaultProps.noScrollbarGutters, onReady = exports.defaultProps.onReady, onMessageReceived = exports.defaultProps.onMessageReceived, header, navPanel, footer, navPanelDef, logoContentDef, logo, logoDark, logoLight, defaultTone, defaultTheme, autoDetectTone = exports.defaultProps.autoDetectTone, renderChild, name, className, applyDefaultContentPadding } = _a, rest = __rest(_a, ["children", "style", "layout", "loggedInUser", "scrollWholePage", "noScrollbarGutters", "onReady", "onMessageReceived", "header", "navPanel", "footer", "navPanelDef", "logoContentDef", "logo", "logoDark", "logoLight", "defaultTone", "defaultTheme", "autoDetectTone", "renderChild", "name", "className", "applyDefaultContentPadding"]);
|
|
47
|
+
var { children, style = constants_1.EMPTY_OBJECT, layout, loggedInUser, scrollWholePage = exports.defaultProps.scrollWholePage, noScrollbarGutters = exports.defaultProps.noScrollbarGutters, onReady = exports.defaultProps.onReady, onMessageReceived = exports.defaultProps.onMessageReceived, header, navPanel, footer, navPanelDef, logoContentDef, logo, logoDark, logoLight, defaultTone, defaultTheme, autoDetectTone = exports.defaultProps.autoDetectTone, renderChild, name, className, applyDefaultContentPadding, registerComponentApi } = _a, rest = __rest(_a, ["children", "style", "layout", "loggedInUser", "scrollWholePage", "noScrollbarGutters", "onReady", "onMessageReceived", "header", "navPanel", "footer", "navPanelDef", "logoContentDef", "logo", "logoDark", "logoLight", "defaultTone", "defaultTheme", "autoDetectTone", "renderChild", "name", "className", "applyDefaultContentPadding", "registerComponentApi"]);
|
|
48
48
|
const { getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
49
49
|
const { setActiveThemeTone, setActiveThemeId, themes } = (0, ThemeContext_1.useThemes)();
|
|
50
50
|
const mounted = (0, react_1.useRef)(false);
|
|
@@ -28,8 +28,9 @@ exports.AppStateMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
28
28
|
description: `This property contains the initial state value. Though you can use multiple \`${COMP}\`` +
|
|
29
29
|
`component instances for the same bucket with their \`initialValue\` set, it may result ` +
|
|
30
30
|
`in faulty app logic. When xmlui instantiates an \`${COMP}\` with an explicit initial ` +
|
|
31
|
-
`value, that value is immediately
|
|
32
|
-
`
|
|
31
|
+
`value, that value is immediately merged with the existing state. ` +
|
|
32
|
+
`The issue may come from the behavior that \`initialValue\` is set (merged) only when a component mounts. ` +
|
|
33
|
+
`By default, the bucket's initial state is undefined.`,
|
|
33
34
|
},
|
|
34
35
|
},
|
|
35
36
|
apis: {
|
|
@@ -35,6 +35,18 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
35
35
|
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toBeVisible();
|
|
36
36
|
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toHaveText("|true|");
|
|
37
37
|
}));
|
|
38
|
+
(0, fixtures_1.test)("initializes with multiple initial state value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
39
|
+
yield initTestBed(`
|
|
40
|
+
<Fragment>
|
|
41
|
+
<AppState id="appState" initialValue="{{ mode: true }}"/>
|
|
42
|
+
<AppState id="appState2" initialValue="{{ otherMode: 123 }}"/>
|
|
43
|
+
<Text testId="stateValue">|{appState.value.mode}|{appState2.value.otherMode}|</Text>
|
|
44
|
+
</Fragment>
|
|
45
|
+
`);
|
|
46
|
+
// AppState should initialize with default bucket and display the correct value
|
|
47
|
+
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toBeVisible();
|
|
48
|
+
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toHaveText("|true|123|");
|
|
49
|
+
}));
|
|
38
50
|
(0, fixtures_1.test)("initializes with provided bucket name and no initial value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
39
51
|
yield initTestBed(`
|
|
40
52
|
<Fragment>
|
|
@@ -57,6 +69,18 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
57
69
|
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toBeVisible();
|
|
58
70
|
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toHaveText("|true|");
|
|
59
71
|
}));
|
|
72
|
+
(0, fixtures_1.test)("initializes with bucket name and multiple initial state value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
73
|
+
yield initTestBed(`
|
|
74
|
+
<Fragment>
|
|
75
|
+
<AppState id="appState" bucket="settings" initialValue="{{ mode: true }}"/>
|
|
76
|
+
<AppState id="appState2" bucket="settings" initialValue="{{ otherMode: 123 }}"/>
|
|
77
|
+
<Text testId="stateValue">|{appState.value.mode}|{appState.value.otherMode}|</Text>
|
|
78
|
+
</Fragment>
|
|
79
|
+
`);
|
|
80
|
+
// AppState should initialize with default bucket and display the correct value
|
|
81
|
+
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toBeVisible();
|
|
82
|
+
yield (0, fixtures_1.expect)(page.getByTestId("stateValue")).toHaveText("|true|123|");
|
|
83
|
+
}));
|
|
60
84
|
(0, fixtures_1.test)("updates state using the update API", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
61
85
|
yield initTestBed(`
|
|
62
86
|
<Fragment>
|
|
@@ -226,7 +250,7 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
226
250
|
// =============================================================================
|
|
227
251
|
// INTEGRATION TESTS
|
|
228
252
|
// =============================================================================
|
|
229
|
-
(0, fixtures_1.test)("integrates with other components that consume app state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page
|
|
253
|
+
(0, fixtures_1.test)("integrates with other components that consume app state", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
230
254
|
// TODO: review these Copilot-created tests
|
|
231
255
|
yield initTestBed(`
|
|
232
256
|
<Fragment>
|
|
@@ -244,7 +268,7 @@ const fixtures_1 = require("../../testing/fixtures");
|
|
|
244
268
|
// Check that the value was correctly retrieved from AppState
|
|
245
269
|
yield (0, fixtures_1.expect)(page.getByTestId("themeValue")).toHaveText("light");
|
|
246
270
|
}));
|
|
247
|
-
(0, fixtures_1.test)("works correctly when wrapped in conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page
|
|
271
|
+
(0, fixtures_1.test)("works correctly when wrapped in conditional rendering", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
248
272
|
// TODO: review these Copilot-created tests
|
|
249
273
|
yield initTestBed(`
|
|
250
274
|
<Fragment var.showState="{false}">
|
|
@@ -8,14 +8,13 @@ exports.defaultProps = {
|
|
|
8
8
|
bucket: "default",
|
|
9
9
|
};
|
|
10
10
|
function AppState({ bucket = exports.defaultProps.bucket, updateState, initialValue, registerComponentApi, onDidUpdate, }) {
|
|
11
|
-
const registerAppState = (0, AppStateContext_1.useAppStateContextPart)((value) => value.registerAppState);
|
|
12
11
|
const update = (0, AppStateContext_1.useAppStateContextPart)((value) => value.update);
|
|
12
|
+
const value = (0, AppStateContext_1.useAppStateContextPart)((value) => { var _a; return (_a = value === null || value === void 0 ? void 0 : value.appState) === null || _a === void 0 ? void 0 : _a[bucket]; });
|
|
13
13
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
14
14
|
if (initialValue !== undefined) {
|
|
15
|
-
|
|
15
|
+
update(bucket, initialValue);
|
|
16
16
|
}
|
|
17
|
-
}, [bucket, initialValue
|
|
18
|
-
const value = (0, AppStateContext_1.useAppStateContextPart)((value) => value.appState[bucket]);
|
|
17
|
+
}, [bucket, initialValue]);
|
|
19
18
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
20
19
|
updateState({ value });
|
|
21
20
|
// Fire the didUpdate event when value changes
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.autoCompleteComponentRenderer = exports.AutoCompleteMd = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const AutoComplete_module_scss_1 = __importDefault(require("
|
|
8
|
+
const AutoComplete_module_scss_1 = __importDefault(require("./AutoComplete.module.scss"));
|
|
9
9
|
const renderers_1 = require("../../components-core/renderers");
|
|
10
10
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
11
11
|
const container_helpers_1 = require("../container-helpers");
|
|
@@ -42,7 +42,7 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
42
42
|
itemCreated: {
|
|
43
43
|
description: "This event is triggered when a new item is created by the user " +
|
|
44
44
|
"(if `creatable` is enabled).",
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
46
|
},
|
|
47
47
|
apis: {
|
|
48
48
|
focus: {
|
|
@@ -70,26 +70,31 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
70
70
|
},
|
|
71
71
|
themeVars: (0, themeVars_1.parseScssVar)(AutoComplete_module_scss_1.default.themeVars),
|
|
72
72
|
defaultThemeVars: {
|
|
73
|
-
[`backgroundColor-menu-${COMP}`]: "$
|
|
73
|
+
[`backgroundColor-menu-${COMP}`]: "$color-surface-raised",
|
|
74
74
|
[`boxShadow-menu-${COMP}`]: "$boxShadow-md",
|
|
75
75
|
[`borderRadius-menu-${COMP}`]: "$borderRadius",
|
|
76
76
|
[`borderWidth-menu-${COMP}`]: "1px",
|
|
77
77
|
[`borderColor-menu-${COMP}`]: "$borderColor",
|
|
78
|
-
[`backgroundColor-item-${COMP}`]: "$backgroundColor-dropdown-item",
|
|
79
|
-
[`backgroundColor-item-${COMP}--hover`]: "$backgroundColor-dropdown-item--active",
|
|
80
|
-
[`backgroundColor-item-${COMP}--active`]: "$backgroundColor-dropdown-item--active",
|
|
81
|
-
[`minHeight-Input`]: "39px",
|
|
82
78
|
[`backgroundColor-${COMP}-badge`]: "$color-primary-500",
|
|
83
79
|
[`fontSize-${COMP}-badge`]: "$fontSize-sm",
|
|
80
|
+
[`paddingHorizontal-${COMP}-badge`]: "$space-2_5",
|
|
81
|
+
[`paddingVertical-${COMP}-badge`]: "$space-0_5",
|
|
84
82
|
[`borderRadius-${COMP}-badge`]: "$borderRadius",
|
|
85
|
-
[`paddingHorizontal-${COMP}
|
|
86
|
-
[`paddingVertical-${COMP}
|
|
87
|
-
[`paddingHorizontal-${COMP}`]: "$space-
|
|
83
|
+
[`paddingHorizontal-item-${COMP}`]: "$space-2",
|
|
84
|
+
[`paddingVertical-item-${COMP}`]: "$space-2",
|
|
85
|
+
[`paddingHorizontal-${COMP}`]: "$space-2",
|
|
88
86
|
[`paddingVertical-${COMP}`]: "$space-2",
|
|
87
|
+
[`opacity-text-item-${COMP}--disabled`]: "0.5",
|
|
88
|
+
[`opacity-${COMP}--disabled`]: "0.5",
|
|
89
89
|
[`backgroundColor-${COMP}-badge--hover`]: "$color-primary-400",
|
|
90
90
|
[`backgroundColor-${COMP}-badge--active`]: "$color-primary-500",
|
|
91
91
|
[`textColor-item-${COMP}--disabled`]: "$color-surface-200",
|
|
92
92
|
[`textColor-${COMP}-badge`]: "$const-color-surface-50",
|
|
93
|
+
[`backgroundColor-item-${COMP}`]: "$backgroundColor-dropdown-item",
|
|
94
|
+
[`backgroundColor-item-${COMP}--hover`]: "$backgroundColor-dropdown-item--hover",
|
|
95
|
+
[`backgroundColor-item-${COMP}--active`]: "$backgroundColor-dropdown-item--active",
|
|
96
|
+
// Default borderColor-Input--disabled is too light so the disabled component is barely visible
|
|
97
|
+
[`borderColor-${COMP}--disabled`]: "initial",
|
|
93
98
|
},
|
|
94
99
|
});
|
|
95
100
|
exports.autoCompleteComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AutoCompleteMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, registerComponentApi, className, }) => {
|
|
@@ -360,7 +360,7 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
360
360
|
// Reset highlighted option when dropdown closes
|
|
361
361
|
setSelectedIndex(-1);
|
|
362
362
|
}
|
|
363
|
-
}, modal: false, children: [(0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, ref: setReferenceElement, children: (0, jsx_runtime_1.jsxs)("div", { style: style, "data-part-id": PART_LIST_WRAPPER, className: (0, classnames_1.default)(className, AutoComplete_module_scss_1.default.badgeListWrapper, AutoComplete_module_scss_1.default[validationStatus], {
|
|
363
|
+
}, modal: false, children: [(0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, ref: setReferenceElement, children: (0, jsx_runtime_1.jsxs)("div", { ref: forwardedRef, style: style, "data-part-id": PART_LIST_WRAPPER, className: (0, classnames_1.default)(className, AutoComplete_module_scss_1.default.badgeListWrapper, AutoComplete_module_scss_1.default[validationStatus], {
|
|
364
364
|
[AutoComplete_module_scss_1.default.disabled]: !enabled,
|
|
365
365
|
[AutoComplete_module_scss_1.default.focused]: isFocused,
|
|
366
366
|
}), "aria-expanded": open, children: [Array.isArray(selectedValue) && selectedValue.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: AutoComplete_module_scss_1.default.badgeList, children: selectedValue.map((v, index) => ((0, jsx_runtime_1.jsxs)("span", { className: AutoComplete_module_scss_1.default.badge, children: [v === null || v === void 0 ? void 0 : v.label, !readOnly && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
|
|
@@ -441,7 +441,7 @@ function CreatableItem({ onNewItem, isHighlighted = false }) {
|
|
|
441
441
|
if (setSelectedIndex) {
|
|
442
442
|
setSelectedIndex(0); // CreatableItem is always at index 0
|
|
443
443
|
}
|
|
444
|
-
}, onClick: handleClick, role: "option", "aria-selected":
|
|
444
|
+
}, onClick: handleClick, role: "option", "aria-selected": false, children: `Create "${searchTerm}"` }));
|
|
445
445
|
// For normal creatable
|
|
446
446
|
if (searchTerm.length > 0) {
|
|
447
447
|
return Item;
|
|
@@ -449,7 +449,7 @@ function CreatableItem({ onNewItem, isHighlighted = false }) {
|
|
|
449
449
|
return (0, jsx_runtime_1.jsx)("span", { style: { display: "none" } });
|
|
450
450
|
}
|
|
451
451
|
function AutoCompleteOption(option) {
|
|
452
|
-
const { value, label, enabled = true,
|
|
452
|
+
const { value, label, enabled = true, readOnly, children, isHighlighted = false, itemIndex, } = option;
|
|
453
453
|
const id = (0, react_1.useId)();
|
|
454
454
|
const { value: selectedValue, onChange, multi, setOpen, setSelectedIndex, optionRenderer, } = (0, AutoCompleteContext_1.useAutoComplete)();
|
|
455
455
|
const selected = multi ? selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.includes(value) : selectedValue === value;
|
|
@@ -459,7 +459,7 @@ function AutoCompleteOption(option) {
|
|
|
459
459
|
setOpen(false);
|
|
460
460
|
}
|
|
461
461
|
};
|
|
462
|
-
return ((0, jsx_runtime_1.jsx)("div", { id: id, role: "option", "aria-disabled": !enabled, "aria-selected":
|
|
462
|
+
return ((0, jsx_runtime_1.jsx)("div", { id: id, role: "option", "aria-disabled": !enabled, "aria-selected": selected, className: (0, classnames_1.default)(AutoComplete_module_scss_1.default.autoCompleteOption, {
|
|
463
463
|
[AutoComplete_module_scss_1.default.disabledOption]: !enabled,
|
|
464
464
|
[AutoComplete_module_scss_1.default.highlighted]: isHighlighted,
|
|
465
465
|
}), onMouseDown: (e) => {
|