xmlui 0.9.57 → 0.9.59
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-B1gPLO_w.mjs → apiInterceptorWorker-BYU_Trhx.mjs} +1 -1
- package/dist/lib/{index-CT_r2BBM.mjs → index-JqY6G28u.mjs} +13289 -12725
- package/dist/lib/index.css +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-4EQ6kQIM.mjs → metadata-utils-BXdiMJQN.mjs} +40 -31
- package/dist/lib/{server-common-C0cF2UTg.mjs → server-common-DGglaqCL.mjs} +5574 -4952
- package/dist/lib/{transform-CgRMkbb0.mjs → transform-BboeJCuA.mjs} +798 -733
- package/dist/lib/xmlui-parser.d.ts +31 -6
- package/dist/lib/xmlui-parser.mjs +49 -42
- package/dist/lib/{xmlui-serializer-EDw51UFN.mjs → xmlui-serializer-D0p6Hyum.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +46 -7
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/{apiInterceptorWorker-aMnSPA-u.mjs → apiInterceptorWorker-CqXRCP46.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-C0kcXW_l.mjs → collectedComponentMetadata-BA6d7xt-.mjs} +13477 -12827
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +123 -123
- package/dist/scripts/package.json +5 -4
- package/dist/scripts/src/components/APICall/APICall.js +12 -11
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -1
- package/dist/scripts/src/components/App/App.js +8 -4
- package/dist/scripts/src/components/App/AppNative.js +11 -1
- package/dist/scripts/src/components/AppHeader/AppHeader.js +3 -1
- package/dist/scripts/src/components/AppState/AppState.js +4 -2
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +4 -2
- package/dist/scripts/src/components/Avatar/Avatar.js +4 -1
- package/dist/scripts/src/components/Badge/Badge.js +3 -1
- package/dist/scripts/src/components/Button/Button.js +3 -1
- package/dist/scripts/src/components/Card/Card.js +5 -2
- package/dist/scripts/src/components/Card/CardNative.js +2 -1
- package/dist/scripts/src/components/ChangeListener/ChangeListener.js +4 -2
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +4 -2
- package/dist/scripts/src/components/Charts/DonutChart/DonutChart.js +6 -5
- package/dist/scripts/src/components/Charts/LabelList/LabelList.js +4 -1
- package/dist/scripts/src/components/Charts/Legend/Legend.js +4 -1
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +4 -1
- package/dist/scripts/src/components/Charts/PieChart/PieChart.js +13 -7
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +9 -4
- package/dist/scripts/src/components/Checkbox/Checkbox.js +3 -2
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +4 -1
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
- package/dist/scripts/src/components/ColorPicker/ColorPicker.js +1 -1
- package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +2 -2
- package/dist/scripts/src/components/Column/Column.js +14 -12
- package/dist/scripts/src/components/ComponentProvider.js +4 -0
- package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +4 -3
- package/dist/scripts/src/components/DatePicker/DatePicker.js +4 -1
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +18 -6
- package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +2 -2
- package/dist/scripts/src/components/ExpandableItem/ExpandableItem.js +6 -5
- package/dist/scripts/src/components/FileInput/FileInput.js +8 -3
- package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +2 -2
- package/dist/scripts/src/components/FlowLayout/FlowLayout.js +2 -2
- package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +35 -6
- package/dist/scripts/src/components/Footer/Footer.js +5 -2
- package/dist/scripts/src/components/Form/Form.js +8 -2
- package/dist/scripts/src/components/Form/FormNative.js +12 -4
- package/dist/scripts/src/components/FormItem/FormItem.js +7 -8
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/FormSection/FormSection.js +2 -3
- package/dist/scripts/src/components/Heading/Heading.js +6 -3
- package/dist/scripts/src/components/HelloWorld/HelloWorld.js +103 -0
- package/dist/scripts/src/components/HelloWorld/HelloWorldNative.js +92 -0
- package/dist/scripts/src/components/Icon/Icon.js +3 -1
- package/dist/scripts/src/components/Image/Image.js +3 -2
- package/dist/scripts/src/components/Items/Items.js +7 -6
- package/dist/scripts/src/components/Link/Link.js +4 -2
- package/dist/scripts/src/components/Link/LinkNative.js +46 -1
- package/dist/scripts/src/components/List/List.js +9 -7
- package/dist/scripts/src/components/Logo/Logo.js +6 -4
- package/dist/scripts/src/components/Markdown/Markdown.js +6 -4
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +2 -3
- package/dist/scripts/src/components/Markdown/utils.js +21 -12
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +6 -7
- package/dist/scripts/src/components/NavGroup/NavGroup.js +4 -2
- package/dist/scripts/src/components/NavGroup/NavGroupContext.js +1 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +6 -2
- package/dist/scripts/src/components/NavLink/NavLink.js +4 -2
- package/dist/scripts/src/components/NavLink/NavLinkNative.js +10 -9
- package/dist/scripts/src/components/NavPanel/NavPanel.js +8 -4
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +132 -3
- package/dist/scripts/src/components/NestedApp/AppWithCodeView.js +22 -3
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +66 -7
- package/dist/scripts/src/components/NestedApp/NestedApp.js +13 -7
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +8 -6
- package/dist/scripts/src/components/NoResult/NoResult.js +1 -2
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -2
- package/dist/scripts/src/components/Option/Option.js +5 -3
- package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +2 -2
- package/dist/scripts/src/components/Pages/Pages.js +11 -9
- package/dist/scripts/src/components/Pages/PagesNative.js +8 -3
- package/dist/scripts/src/components/ProgressBar/ProgressBar.js +4 -1
- package/dist/scripts/src/components/Queue/Queue.js +2 -2
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +16 -14
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +13 -28
- package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +1 -1
- package/dist/scripts/src/components/Redirect/Redirect.js +3 -3
- package/dist/scripts/src/components/Select/Select.js +8 -4
- package/dist/scripts/src/components/Select/SelectNative.js +1 -1
- package/dist/scripts/src/components/Slider/Slider.js +4 -2
- package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +2 -2
- package/dist/scripts/src/components/Spinner/Spinner.js +2 -2
- package/dist/scripts/src/components/Splitter/Splitter.js +3 -2
- package/dist/scripts/src/components/Stack/Stack.js +4 -1
- package/dist/scripts/src/components/StickyBox/StickyBox.js +1 -2
- package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +2 -0
- package/dist/scripts/src/components/Switch/Switch.js +7 -5
- package/dist/scripts/src/components/Table/Table.js +1 -2
- package/dist/scripts/src/components/Table/TableNative.js +6 -2
- package/dist/scripts/src/components/Table/useRowSelection.js +6 -2
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +2 -3
- package/dist/scripts/src/components/Tabs/TabItem.js +5 -2
- package/dist/scripts/src/components/Tabs/Tabs.js +9 -3
- package/dist/scripts/src/components/Text/Text.js +2 -2
- package/dist/scripts/src/components/TextArea/TextArea.js +1 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +5 -4
- package/dist/scripts/src/components/Theme/NotificationToast.js +11 -0
- package/dist/scripts/src/components/Theme/Theme.js +2 -4
- package/dist/scripts/src/components/Theme/ThemeNative.js +4 -4
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +4 -4
- package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +2 -0
- package/dist/scripts/src/components-core/Fragment.js +5 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
- package/dist/scripts/src/components-core/appContext/date-functions.js +1 -0
- package/dist/scripts/src/components-core/descriptorHelper.js +9 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +2 -2
- package/dist/scripts/src/components-core/rendering/AppContent.js +6 -2
- package/dist/scripts/src/components-core/rendering/AppRoot.js +4 -2
- package/dist/scripts/src/components-core/rendering/StateContainer.js +6 -0
- package/dist/scripts/src/components-core/theming/layout-resolver.js +18 -0
- package/dist/scripts/src/components-core/theming/themes/root.js +3 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +60 -0
- package/dist/scripts/src/parsers/xmlui-parser/parser.js +42 -39
- package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +65 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +10 -8
- package/dist/scripts/src/parsers/xmlui-parser/utils.js +1 -2
- package/dist/standalone/xmlui-standalone.es.d.ts +46 -7
- package/dist/standalone/xmlui-standalone.umd.js +240 -240
- package/package.json +5 -4
|
@@ -37,6 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.NavPanel = exports.NavPanelContext = exports.defaultProps = void 0;
|
|
40
|
+
exports.buildNavHierarchy = buildNavHierarchy;
|
|
41
|
+
exports.buildLinkMap = buildLinkMap;
|
|
40
42
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
43
|
const react_1 = __importStar(require("react"));
|
|
42
44
|
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
@@ -46,6 +48,126 @@ const ScrollContext_1 = require("../../components-core/ScrollContext");
|
|
|
46
48
|
const LogoNative_1 = require("../Logo/LogoNative");
|
|
47
49
|
const AppLayoutContext_1 = require("../App/AppLayoutContext");
|
|
48
50
|
const AppNative_1 = require("../App/AppNative");
|
|
51
|
+
// Function to build navigation hierarchy from component children
|
|
52
|
+
function buildNavHierarchy(children, extractValue, parent, pathSegments = []) {
|
|
53
|
+
if (!children)
|
|
54
|
+
return [];
|
|
55
|
+
const hierarchy = [];
|
|
56
|
+
// Skip non-object children
|
|
57
|
+
children.filter(child => child && typeof child === 'object').forEach((child) => {
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
59
|
+
if (child.type === "NavLink") {
|
|
60
|
+
const label = ((_a = extractValue.asOptionalString) === null || _a === void 0 ? void 0 : _a.call(extractValue, (_b = child.props) === null || _b === void 0 ? void 0 : _b.label)) || extractValue((_c = child.props) === null || _c === void 0 ? void 0 : _c.label);
|
|
61
|
+
const to = ((_d = extractValue.asOptionalString) === null || _d === void 0 ? void 0 : _d.call(extractValue, (_e = child.props) === null || _e === void 0 ? void 0 : _e.to)) || extractValue((_f = child.props) === null || _f === void 0 ? void 0 : _f.to);
|
|
62
|
+
// Handle case where label might not be in props but in children as text
|
|
63
|
+
let finalLabel = label;
|
|
64
|
+
if (!finalLabel && ((_g = child.children) === null || _g === void 0 ? void 0 : _g.length) === 1 && child.children[0].type === "TextNode") {
|
|
65
|
+
finalLabel = extractValue((_h = child.children[0].props) === null || _h === void 0 ? void 0 : _h.value);
|
|
66
|
+
}
|
|
67
|
+
// Only include NavLinks that have both label and to values
|
|
68
|
+
if (finalLabel && to) {
|
|
69
|
+
const node = {
|
|
70
|
+
type: "NavLink",
|
|
71
|
+
label: finalLabel,
|
|
72
|
+
to: to,
|
|
73
|
+
parent: parent,
|
|
74
|
+
pathSegments: [...pathSegments],
|
|
75
|
+
};
|
|
76
|
+
hierarchy.push(node);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else if (child.type === "NavGroup") {
|
|
80
|
+
const label = ((_j = extractValue.asOptionalString) === null || _j === void 0 ? void 0 : _j.call(extractValue, (_k = child.props) === null || _k === void 0 ? void 0 : _k.label)) || extractValue((_l = child.props) === null || _l === void 0 ? void 0 : _l.label);
|
|
81
|
+
// NavGroups only need a label, no "to" value required
|
|
82
|
+
if (label) {
|
|
83
|
+
const groupNode = {
|
|
84
|
+
type: "NavGroup",
|
|
85
|
+
label: label,
|
|
86
|
+
parent: parent,
|
|
87
|
+
pathSegments: [...pathSegments],
|
|
88
|
+
children: [],
|
|
89
|
+
};
|
|
90
|
+
// Build children with this groupNode as parent and updated path
|
|
91
|
+
const newPathSegments = [...pathSegments, groupNode];
|
|
92
|
+
groupNode.children = buildNavHierarchy(child.children, extractValue, groupNode, newPathSegments);
|
|
93
|
+
hierarchy.push(groupNode);
|
|
94
|
+
}
|
|
95
|
+
else if (child.children && child.children.length > 0) {
|
|
96
|
+
// If no label but has children, process them at the current level with same parent and path
|
|
97
|
+
hierarchy.push(...buildNavHierarchy(child.children, extractValue, parent, pathSegments));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else if (child.children && child.children.length > 0) {
|
|
101
|
+
// Process any children that might contain NavGroup and NavLink components recursively
|
|
102
|
+
const nestedNodes = buildNavHierarchy(child.children, extractValue, parent, pathSegments);
|
|
103
|
+
if (nestedNodes.length > 0) {
|
|
104
|
+
hierarchy.push(...nestedNodes);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
// Set navigation properties after building the hierarchy
|
|
109
|
+
setNavigationProperties(hierarchy);
|
|
110
|
+
return hierarchy;
|
|
111
|
+
}
|
|
112
|
+
// Helper function to set navigation properties (prevLink, nextLink, firstLink, lastLink)
|
|
113
|
+
function setNavigationProperties(hierarchy) {
|
|
114
|
+
// Collect all NavLinks in traversal order
|
|
115
|
+
const allNavLinks = [];
|
|
116
|
+
function collectNavLinks(nodes) {
|
|
117
|
+
nodes.forEach((node) => {
|
|
118
|
+
if (node.type === "NavLink") {
|
|
119
|
+
allNavLinks.push(node);
|
|
120
|
+
}
|
|
121
|
+
if (node.children) {
|
|
122
|
+
collectNavLinks(node.children);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
collectNavLinks(hierarchy);
|
|
127
|
+
// Set prevLink and nextLink for all NavLinks
|
|
128
|
+
allNavLinks.forEach((link, index) => {
|
|
129
|
+
if (index > 0) {
|
|
130
|
+
link.prevLink = allNavLinks[index - 1];
|
|
131
|
+
}
|
|
132
|
+
if (index < allNavLinks.length - 1) {
|
|
133
|
+
link.nextLink = allNavLinks[index + 1];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
// Set firstLink and lastLink properties
|
|
137
|
+
function setFirstLastProperties(nodes) {
|
|
138
|
+
const navLinks = nodes.filter((node) => node.type === "NavLink");
|
|
139
|
+
if (navLinks.length > 0) {
|
|
140
|
+
navLinks[0].firstLink = true;
|
|
141
|
+
navLinks[navLinks.length - 1].lastLink = true;
|
|
142
|
+
}
|
|
143
|
+
// Recursively process children
|
|
144
|
+
nodes.forEach((node) => {
|
|
145
|
+
if (node.children) {
|
|
146
|
+
setFirstLastProperties(node.children);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
setFirstLastProperties(hierarchy);
|
|
151
|
+
}
|
|
152
|
+
// Function to build a map of NavLinks by their "to" property
|
|
153
|
+
function buildLinkMap(navLinks) {
|
|
154
|
+
const linkMap = new Map();
|
|
155
|
+
if (!navLinks)
|
|
156
|
+
return linkMap;
|
|
157
|
+
function processNodes(nodes) {
|
|
158
|
+
nodes.forEach((node) => {
|
|
159
|
+
if (node.type === "NavLink" && node.to) {
|
|
160
|
+
// If multiple items use the same "to" value, the last wins
|
|
161
|
+
linkMap.set(node.to, node);
|
|
162
|
+
}
|
|
163
|
+
if (node.children) {
|
|
164
|
+
processNodes(node.children);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
processNodes(navLinks);
|
|
169
|
+
return linkMap;
|
|
170
|
+
}
|
|
49
171
|
// Default props for NavPanel component
|
|
50
172
|
exports.defaultProps = {
|
|
51
173
|
inDrawer: false,
|
|
@@ -54,11 +176,11 @@ exports.NavPanelContext = react_1.default.createContext(null);
|
|
|
54
176
|
const contextValue = {
|
|
55
177
|
inDrawer: true,
|
|
56
178
|
};
|
|
57
|
-
function DrawerNavPanel({ logoContent, children, className, style, }) {
|
|
179
|
+
function DrawerNavPanel({ logoContent, children, className, style, navLinks, }) {
|
|
58
180
|
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
59
181
|
return ((0, jsx_runtime_1.jsx)(exports.NavPanelContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)("div", { ref: scrollContainerRef, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className), style: style, children: (0, jsx_runtime_1.jsxs)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper, NavPanel_module_scss_1.default.inDrawer), children: logoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] }) }) }));
|
|
60
182
|
}
|
|
61
|
-
exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style, logoContent, className, inDrawer = exports.defaultProps.inDrawer, renderChild }, forwardedRef) {
|
|
183
|
+
exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style, logoContent, className, inDrawer = exports.defaultProps.inDrawer, renderChild, navLinks, }, forwardedRef) {
|
|
62
184
|
var _a, _b;
|
|
63
185
|
const scrollContainerRef = (0, react_1.useRef)(null);
|
|
64
186
|
const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(scrollContainerRef, forwardedRef) : scrollContainerRef;
|
|
@@ -68,8 +190,15 @@ exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style,
|
|
|
68
190
|
const isCondensed = (_a = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _a === void 0 ? void 0 : _a.startsWith("condensed");
|
|
69
191
|
const vertical = (_b = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _b === void 0 ? void 0 : _b.startsWith("vertical");
|
|
70
192
|
const safeLogoContent = logoContent || renderChild(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.logoContentDef);
|
|
193
|
+
// Register the linkMap when navLinks change
|
|
194
|
+
(0, react_1.useEffect)(() => {
|
|
195
|
+
if ((appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.registerLinkMap) && navLinks) {
|
|
196
|
+
const linkMap = buildLinkMap(navLinks);
|
|
197
|
+
appLayoutContext.registerLinkMap(linkMap);
|
|
198
|
+
}
|
|
199
|
+
}, [navLinks, appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.registerLinkMap]);
|
|
71
200
|
if (inDrawer) {
|
|
72
|
-
return ((0, jsx_runtime_1.jsx)(DrawerNavPanel, { style: style, logoContent: safeLogoContent, className: className, children: children }));
|
|
201
|
+
return ((0, jsx_runtime_1.jsx)(DrawerNavPanel, { style: style, logoContent: safeLogoContent, className: className, navLinks: navLinks, children: children }));
|
|
73
202
|
}
|
|
74
203
|
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className, {
|
|
75
204
|
[NavPanel_module_scss_1.default.horizontal]: horizontal,
|
|
@@ -21,7 +21,7 @@ It supports both side-by-side and stacked layouts.`,
|
|
|
21
21
|
description: "The markdown content to be displayed alongside the app",
|
|
22
22
|
valueType: "string",
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
splitView: {
|
|
25
25
|
description: "Whether to render the markdown and app side by side or stacked vertically",
|
|
26
26
|
valueType: "boolean",
|
|
27
27
|
},
|
|
@@ -66,7 +66,26 @@ It supports both side-by-side and stacked layouts.`,
|
|
|
66
66
|
themeVars: (0, themeVars_1.parseScssVar)(AppWithCodeView_module_scss_1.default.themeVars),
|
|
67
67
|
defaultThemeVars: {},
|
|
68
68
|
});
|
|
69
|
-
exports.appWithCodeViewComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppWithCodeViewMd, ({ node, extractValue }) => {
|
|
69
|
+
exports.appWithCodeViewComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppWithCodeViewMd, ({ node, extractValue, renderChild }) => {
|
|
70
70
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
71
|
-
|
|
71
|
+
let renderedChildren = "";
|
|
72
|
+
// 1. Static content prop fallback
|
|
73
|
+
if (!renderedChildren) {
|
|
74
|
+
renderedChildren = extractValue.asString(node.props.markdown);
|
|
75
|
+
}
|
|
76
|
+
// 2. "data" property fallback
|
|
77
|
+
if (!renderedChildren && typeof node.props.data === "string") {
|
|
78
|
+
renderedChildren = extractValue.asString(node.props.data);
|
|
79
|
+
}
|
|
80
|
+
// 3. Children fallback
|
|
81
|
+
if (!renderedChildren) {
|
|
82
|
+
((_a = node.children) !== null && _a !== void 0 ? _a : []).forEach((child) => {
|
|
83
|
+
const renderedChild = renderChild(child);
|
|
84
|
+
console.log("renderedChild", renderedChild);
|
|
85
|
+
if (typeof renderedChild === "string") {
|
|
86
|
+
renderedChildren += renderedChild;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.AppWithCodeViewNative, { markdown: renderedChildren, splitView: extractValue.asOptionalBoolean((_b = node.props) === null || _b === void 0 ? void 0 : _b.splitView), app: (_c = node.props) === null || _c === void 0 ? void 0 : _c.app, api: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.api), components: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.components), config: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.config), activeTheme: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.activeTheme), activeTone: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.activeTone), title: extractValue((_j = node.props) === null || _j === void 0 ? void 0 : _j.title), height: extractValue((_k = node.props) === null || _k === void 0 ? void 0 : _k.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_l = node.props) === null || _l === void 0 ? void 0 : _l.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_m = node.props) === null || _m === void 0 ? void 0 : _m.withFrame) }));
|
|
72
91
|
});
|
|
@@ -1,22 +1,81 @@
|
|
|
1
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
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
exports.AppWithCodeViewNative = AppWithCodeViewNative;
|
|
7
16
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const
|
|
9
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
17
|
+
const react_1 = require("react");
|
|
10
18
|
const NestedAppNative_1 = require("./NestedAppNative");
|
|
11
19
|
const Markdown_1 = require("../Markdown/Markdown");
|
|
20
|
+
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
21
|
+
const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
|
|
22
|
+
const AppHeaderNative_1 = require("../AppHeader/AppHeaderNative");
|
|
23
|
+
const Tooltip_1 = require("./Tooltip");
|
|
24
|
+
const rx_1 = require("react-icons/rx");
|
|
25
|
+
const lia_1 = require("react-icons/lia");
|
|
26
|
+
const utils_1 = require("./utils");
|
|
27
|
+
const AppContext_1 = require("../../components-core/AppContext");
|
|
28
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
29
|
+
const logo_svg_react_1 = __importDefault(require("./logo.svg?react"));
|
|
12
30
|
/**
|
|
13
31
|
* A component that displays markdown content on the left and a NestedApp on the right
|
|
14
32
|
*/
|
|
15
|
-
function AppWithCodeViewNative({ markdown,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
function AppWithCodeViewNative({ markdown, splitView, initiallyShowCode = false, app, api, components = [], config, activeTone, activeTheme, title, height, allowPlaygroundPopup, }) {
|
|
34
|
+
const [showCode, setShowCode] = (0, react_1.useState)(initiallyShowCode);
|
|
35
|
+
const logoUrl = (0, AppHeaderNative_1.useLogoUrl)();
|
|
36
|
+
const { appGlobals } = (0, AppContext_1.useAppContext)();
|
|
37
|
+
const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
|
|
38
|
+
const useHashBasedRouting = (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) || true;
|
|
39
|
+
const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const data = {
|
|
41
|
+
standalone: {
|
|
42
|
+
app,
|
|
43
|
+
components,
|
|
44
|
+
config: {
|
|
45
|
+
name: title,
|
|
46
|
+
themes: [],
|
|
47
|
+
defaultTheme: activeTheme,
|
|
48
|
+
},
|
|
49
|
+
api: api,
|
|
50
|
+
},
|
|
51
|
+
options: {
|
|
52
|
+
fixedTheme: false,
|
|
53
|
+
swapped: false,
|
|
54
|
+
previewMode: false,
|
|
55
|
+
orientation: "horizontal",
|
|
56
|
+
activeTheme,
|
|
57
|
+
activeTone,
|
|
58
|
+
content: "app",
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const appQueryString = yield (0, utils_1.createQueryString)(JSON.stringify(data));
|
|
62
|
+
window.open(useHashBasedRouting
|
|
63
|
+
? `https://docs.xmlui.com/#/playground#${appQueryString}`
|
|
64
|
+
: `https://docs.xmlui.com/playground#${appQueryString}`, "_blank");
|
|
65
|
+
}), [app, components, title, activeTheme, api, activeTone, useHashBasedRouting]);
|
|
66
|
+
if (splitView) {
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, style: { height }, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)(logo_svg_react_1.default, { className: NestedApp_module_scss_1.default.logo }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.viewControls, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(true), variant: showCode ? "solid" : "ghost", className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton), style: {
|
|
68
|
+
backgroundColor: !showCode ? "transparent" : "",
|
|
69
|
+
}, children: "XML" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(false), variant: showCode ? "ghost" : "solid", className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton), style: {
|
|
70
|
+
backgroundColor: showCode ? "transparent" : "",
|
|
71
|
+
}, children: "UI" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
72
|
+
openPlayground();
|
|
73
|
+
}, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
74
|
+
setShowCode(false);
|
|
75
|
+
setRefreshVersion(refreshVersion + 1);
|
|
76
|
+
}, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.contentContainer, children: [showCode && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { style: { height: "100%" }, children: markdown }), !showCode && ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { refVersion: refreshVersion, app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, title: title, allowPlaygroundPopup: allowPlaygroundPopup, withFrame: false }))] })] }));
|
|
77
|
+
}
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, title: title, height: height, allowPlaygroundPopup: allowPlaygroundPopup, withFrame: true }) })] }));
|
|
20
79
|
}
|
|
21
80
|
/**
|
|
22
81
|
* Export a named default for easier imports
|
|
@@ -58,17 +58,23 @@ exports.NestedAppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
58
58
|
defaultThemeVars: {
|
|
59
59
|
[`marginTop-${COMP}`]: "$space-3",
|
|
60
60
|
[`marginBottom-${COMP}`]: "$space-3",
|
|
61
|
-
[`padding-${COMP}`]: "
|
|
62
|
-
[`paddingTop-${COMP}`]: "
|
|
63
|
-
[`border-${COMP}`]: "
|
|
64
|
-
[`borderRadius-${COMP}`]: "$space-
|
|
61
|
+
[`padding-${COMP}`]: "0",
|
|
62
|
+
[`paddingTop-${COMP}`]: "0",
|
|
63
|
+
[`border-${COMP}`]: "0.5px solid $borderColor",
|
|
64
|
+
[`borderRadius-${COMP}`]: "$space-2",
|
|
65
65
|
[`backgroundColor-frame-${COMP}`]: "$color-primary-50",
|
|
66
|
-
[`gap-frame-${COMP}`]: "
|
|
66
|
+
[`gap-frame-${COMP}`]: "0",
|
|
67
67
|
[`fontWeight-header-${COMP}`]: "$fontWeight-bold",
|
|
68
68
|
[`boxShadow-${COMP}`]: "$boxShadow-md",
|
|
69
|
+
[`backgroundColor-viewControls-${COMP}`]: "$color-primary-100",
|
|
70
|
+
[`borderRadius-viewControls-${COMP}`]: "5px",
|
|
71
|
+
[`padding-viewControls-${COMP}`]: "$space-0_5",
|
|
72
|
+
[`padding-button-splitView-${COMP}`]: "4px 6px",
|
|
73
|
+
[`width-button-splitView-${COMP}`]: "60px",
|
|
74
|
+
[`borderBottom-header-${COMP}`]: "0.5px solid $borderColor",
|
|
69
75
|
},
|
|
70
76
|
});
|
|
71
|
-
exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue }) => {
|
|
77
|
+
exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue, layoutCss }) => {
|
|
72
78
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: (_a = node.props) === null || _a === void 0 ? void 0 : _a.app, api: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.api), components: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.components), config: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.config), activeTheme: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.activeTheme), activeTone: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.activeTone), title: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.title), height: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_k = node.props) === null || _k === void 0 ? void 0 : _k.withFrame) }));
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: (_a = node.props) === null || _a === void 0 ? void 0 : _a.app, style: layoutCss, api: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.api), components: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.components), config: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.config), activeTheme: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.activeTheme), activeTone: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.activeTone), title: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.title), height: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_k = node.props) === null || _k === void 0 ? void 0 : _k.withFrame) }));
|
|
74
80
|
});
|
|
@@ -53,22 +53,25 @@ function IndexAwareNestedApp(props) {
|
|
|
53
53
|
}
|
|
54
54
|
return (0, jsx_runtime_1.jsx)(LazyNestedApp, Object.assign({}, props));
|
|
55
55
|
}
|
|
56
|
-
function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = defaultProps_1.defaultProps.allowPlaygroundPopup, withFrame = defaultProps_1.defaultProps.withFrame, }) {
|
|
56
|
+
function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = defaultProps_1.defaultProps.allowPlaygroundPopup, withFrame = defaultProps_1.defaultProps.withFrame, style, refVersion = 0, }) {
|
|
57
57
|
const rootRef = (0, react_1.useRef)(null);
|
|
58
58
|
const shadowRef = (0, react_1.useRef)(null);
|
|
59
59
|
const contentRootRef = (0, react_1.useRef)(null);
|
|
60
60
|
const nestedAppId = (0, react_1.useId)();
|
|
61
|
-
const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(
|
|
61
|
+
const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(refVersion);
|
|
62
62
|
const theme = (0, ThemeContext_1.useTheme)();
|
|
63
63
|
const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
|
|
64
64
|
const { appGlobals } = (0, AppContext_1.useAppContext)();
|
|
65
65
|
const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
|
|
66
66
|
const { interceptorWorker } = (0, useApiInterceptorContext_1.useApiInterceptorContext)();
|
|
67
|
+
(0, react_1.useEffect)(() => {
|
|
68
|
+
setRefreshVersion(refVersion);
|
|
69
|
+
}, [refVersion]);
|
|
67
70
|
//TODO illesg: we should come up with something to make sure that nestedApps doesn't overwrite each other's mocked api endpoints
|
|
68
71
|
// disabled for now, as it messes up the paths of not mocked APIs (e.g. resources/{staticJsonfiles})
|
|
69
72
|
//const safeId = playgroundId || nestedAppId;
|
|
70
73
|
//const apiUrl = api ? `/${safeId.replaceAll(":", "")}` : '';
|
|
71
|
-
const apiUrl =
|
|
74
|
+
const apiUrl = "";
|
|
72
75
|
const mock = (0, react_1.useMemo)(() => {
|
|
73
76
|
if (!api) {
|
|
74
77
|
return undefined;
|
|
@@ -85,7 +88,6 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
85
88
|
}
|
|
86
89
|
return Object.assign(Object.assign({}, apiObject), { type: "in-memory" });
|
|
87
90
|
}, [api]);
|
|
88
|
-
//console.log("mock", mock);
|
|
89
91
|
const useHashBasedRouting = (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) || true;
|
|
90
92
|
const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
91
93
|
const data = {
|
|
@@ -149,13 +151,13 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
149
151
|
Object.keys(theme.themeStyles).forEach((key) => {
|
|
150
152
|
themeVarReset[key] = "initial";
|
|
151
153
|
});
|
|
152
|
-
let nestedAppRoot = ((0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: interceptorWorker, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign({ height }, themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
|
|
154
|
+
let nestedAppRoot = ((0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: interceptorWorker, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign(Object.assign({ height }, style), themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { isNested: true, previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
|
|
153
155
|
compoundComponents,
|
|
154
156
|
themes: config === null || config === void 0 ? void 0 : config.themes,
|
|
155
157
|
}, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }, `app-${nestedAppId}-${refreshVersion}`) }) }));
|
|
156
158
|
(_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.render((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: component, children: withFrame ? ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.spacer }), allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
157
159
|
openPlayground();
|
|
158
|
-
}, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "
|
|
160
|
+
}, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
|
|
159
161
|
setRefreshVersion(refreshVersion + 1);
|
|
160
162
|
}, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), nestedAppRoot] })) : (nestedAppRoot) }));
|
|
161
163
|
}, [
|
|
@@ -13,8 +13,7 @@ const metadata_helpers_1 = require("../metadata-helpers");
|
|
|
13
13
|
const NoResultNative_1 = require("./NoResultNative");
|
|
14
14
|
const COMP = "NoResult";
|
|
15
15
|
exports.NoResultMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
|
-
description:
|
|
17
|
-
`resulted in no (zero) items.`,
|
|
16
|
+
description: "`NoResult` displays a visual indication that a query or search returned nothing.",
|
|
18
17
|
props: {
|
|
19
18
|
label: (0, metadata_helpers_1.dLabel)(),
|
|
20
19
|
icon: {
|
|
@@ -14,8 +14,10 @@ const NumberBoxNative_1 = require("./NumberBoxNative");
|
|
|
14
14
|
const COMP = "NumberBox";
|
|
15
15
|
exports.NumberBoxMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
16
|
status: "stable",
|
|
17
|
-
description: `
|
|
18
|
-
|
|
17
|
+
description: "`NumberBox` provides a specialized input field for numeric values with built-in " +
|
|
18
|
+
"validation, spinner buttons, and flexible formatting options. It supports both " +
|
|
19
|
+
"integer and floating-point numbers, handles empty states as null values, and " +
|
|
20
|
+
"integrates seamlessly with form validation.",
|
|
19
21
|
props: {
|
|
20
22
|
placeholder: (0, metadata_helpers_1.dPlaceholder)(),
|
|
21
23
|
initialValue: (0, metadata_helpers_1.dInitialValue)(),
|
|
@@ -8,9 +8,11 @@ const container_helpers_1 = require("../container-helpers");
|
|
|
8
8
|
const OptionNative_1 = require("./OptionNative");
|
|
9
9
|
const COMP = "Option";
|
|
10
10
|
exports.OptionMd = (0, ComponentDefs_1.createMetadata)({
|
|
11
|
-
description:
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
description: "`Option` defines selectable items for choice-based components, providing both " +
|
|
12
|
+
"the underlying value and display text for selection interfaces. It serves as " +
|
|
13
|
+
"a non-visual data structure that describes individual choices within " +
|
|
14
|
+
"[Select](/components/Select), [AutoComplete](/components/AutoComplete), " +
|
|
15
|
+
"and other selection components.",
|
|
14
16
|
props: {
|
|
15
17
|
label: (0, ComponentDefs_1.d)(`This property defines the text to display for the option. If \`label\` is not defined, ` +
|
|
16
18
|
`\`Option\` will use the \`value\` as the label.`),
|
|
@@ -7,8 +7,8 @@ const renderers_1 = require("../../components-core/renderers");
|
|
|
7
7
|
const PageMetaTilteNative_1 = require("./PageMetaTilteNative");
|
|
8
8
|
const COMP = "PageMetaTitle";
|
|
9
9
|
exports.PageMetaTitleMd = (0, ComponentDefs_1.createMetadata)({
|
|
10
|
-
description: `
|
|
11
|
-
|
|
10
|
+
description: "`PageMetaTitle` dynamically sets or updates the browser tab title, enabling " +
|
|
11
|
+
"pages and components to override the default application name with context-specific titles.",
|
|
12
12
|
props: {
|
|
13
13
|
value: {
|
|
14
14
|
description: `This property sets the page's title to display in the browser tab.`,
|
|
@@ -10,9 +10,11 @@ const PagesNative_1 = require("./PagesNative");
|
|
|
10
10
|
const PAGE = "Page";
|
|
11
11
|
exports.PageMd = (0, ComponentDefs_1.createMetadata)({
|
|
12
12
|
status: "stable",
|
|
13
|
-
docFolder:
|
|
14
|
-
description: `
|
|
15
|
-
|
|
13
|
+
docFolder: "Pages",
|
|
14
|
+
description: "`Page` defines route endpoints within an application, mapping specific URL " +
|
|
15
|
+
"patterns to content that displays when users navigate to those routes. Each " +
|
|
16
|
+
"Page represents a distinct view or screen in your single-page application's " +
|
|
17
|
+
"routing system.",
|
|
16
18
|
props: {
|
|
17
19
|
//TODO illesg rename to path
|
|
18
20
|
url: (0, ComponentDefs_1.d)(`The URL of the route associated with the content. If not set, the page is not available.`),
|
|
@@ -25,15 +27,15 @@ exports.pageRenderer = (0, renderers_1.createComponentRenderer)(PAGE, exports.Pa
|
|
|
25
27
|
});
|
|
26
28
|
const COMP = "Pages";
|
|
27
29
|
exports.PagesMd = (0, ComponentDefs_1.createMetadata)({
|
|
28
|
-
description: `
|
|
29
|
-
|
|
30
|
+
description: "`Pages` serves as the routing coordinator within an [App](/components/App), " +
|
|
31
|
+
"managing which [Page](/components/Page) displays based on the current URL.",
|
|
30
32
|
props: {
|
|
31
|
-
|
|
32
|
-
description: `The
|
|
33
|
-
defaultValue: PagesNative_1.defaultProps.
|
|
33
|
+
fallbackPath: {
|
|
34
|
+
description: `The fallback path when the current URL does not match any of the paths of the pages.`,
|
|
35
|
+
defaultValue: PagesNative_1.defaultProps.fallbackPath,
|
|
34
36
|
},
|
|
35
37
|
},
|
|
36
38
|
});
|
|
37
39
|
exports.pagesRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.PagesMd, ({ node, extractValue, renderChild }) => {
|
|
38
|
-
return ((0, jsx_runtime_1.jsx)(PagesNative_1.Pages, {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(PagesNative_1.Pages, { fallbackPath: extractValue(node.props.fallbackPath), node: node, renderChild: renderChild, extractValue: extractValue }));
|
|
39
41
|
});
|
|
@@ -23,12 +23,17 @@ const react_2 = require("@remix-run/react");
|
|
|
23
23
|
const classnames_1 = __importDefault(require("classnames"));
|
|
24
24
|
const constants_1 = require("../../components-core/constants");
|
|
25
25
|
const Pages_module_scss_1 = __importDefault(require("./Pages.module.scss"));
|
|
26
|
+
const AppLayoutContext_1 = require("../App/AppLayoutContext");
|
|
26
27
|
// Default props for Pages component
|
|
27
28
|
exports.defaultProps = {
|
|
28
|
-
|
|
29
|
+
fallbackPath: "/",
|
|
29
30
|
};
|
|
30
31
|
function RouteWrapper({ childRoute = constants_1.EMPTY_ARRAY, renderChild, layoutContext, style, uid, }) {
|
|
32
|
+
var _a;
|
|
31
33
|
const params = (0, react_2.useParams)();
|
|
34
|
+
const location = (0, react_2.useLocation)();
|
|
35
|
+
const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
36
|
+
const linkInfo = ((_a = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.linkMap) === null || _a === void 0 ? void 0 : _a.get(location.pathname)) || {};
|
|
32
37
|
//we need to wrap the child route in a container to make sure the route params are available.
|
|
33
38
|
// we do this wrapping by providing an empty object to vars.
|
|
34
39
|
// this way it becomes an 'implicit' container (vars/state inside this container is propagated to the parent)
|
|
@@ -54,7 +59,7 @@ function RouteWrapper({ childRoute = constants_1.EMPTY_ARRAY, renderChild, layou
|
|
|
54
59
|
}, [style]);
|
|
55
60
|
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Pages_module_scss_1.default.wrapper, "xmlui-page-root"), style: wrapperStyle, children: renderChild(wrappedWithContainer, layoutContext) }, JSON.stringify(params)));
|
|
56
61
|
}
|
|
57
|
-
function Pages({ node, renderChild, extractValue,
|
|
62
|
+
function Pages({ node, renderChild, extractValue, fallbackPath }) {
|
|
58
63
|
var _a;
|
|
59
64
|
const routes = [];
|
|
60
65
|
const restChildren = [];
|
|
@@ -68,5 +73,5 @@ function Pages({ node, renderChild, extractValue, defaultRoute }) {
|
|
|
68
73
|
});
|
|
69
74
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.Routes, { children: [routes.map((child, i) => {
|
|
70
75
|
return ((0, jsx_runtime_1.jsx)(react_2.Route, { path: extractValue(child.props.url), element: renderChild(child) }, i));
|
|
71
|
-
}), !!
|
|
76
|
+
}), !!fallbackPath && (0, jsx_runtime_1.jsx)(react_2.Route, { path: "*", element: (0, jsx_runtime_1.jsx)(react_2.Navigate, { to: fallbackPath, replace: true }) })] }), renderChild(restChildren)] }));
|
|
72
77
|
}
|
|
@@ -12,7 +12,10 @@ const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
|
12
12
|
const ProgressBarNative_1 = require("./ProgressBarNative");
|
|
13
13
|
const COMP = "ProgressBar";
|
|
14
14
|
exports.ProgressBarMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
-
description: `
|
|
15
|
+
description: "`ProgressBar` provides a visual indicator showing the completion percentage " +
|
|
16
|
+
"of tasks, processes, or any measurable progress. It displays as a horizontal " +
|
|
17
|
+
"bar that fills from left to right based on the provided value between 0 " +
|
|
18
|
+
"(empty) and 1 (complete).",
|
|
16
19
|
props: {
|
|
17
20
|
value: {
|
|
18
21
|
description: `This property defines the progress value with a number between 0 and 1.`,
|
|
@@ -8,8 +8,8 @@ const container_helpers_1 = require("../container-helpers");
|
|
|
8
8
|
const QueueNative_1 = require("./QueueNative");
|
|
9
9
|
const COMP = "Queue";
|
|
10
10
|
exports.QueueMd = (0, ComponentDefs_1.createMetadata)({
|
|
11
|
-
description: `
|
|
12
|
-
|
|
11
|
+
description: "`Queue` manages sequential processing of items in FIFO (first-in, first-out) " +
|
|
12
|
+
"order. It is a non-visual component but provides UI progress reporting and result display.",
|
|
13
13
|
props: {
|
|
14
14
|
progressFeedback: (0, ComponentDefs_1.d)("This property defines the component template of the UI that displays " +
|
|
15
15
|
"progress information whenever, the queue's \`progressReport\` function " +
|
|
@@ -14,9 +14,10 @@ const RadioGroupNative_1 = require("./RadioGroupNative");
|
|
|
14
14
|
const COMP = "RadioGroup";
|
|
15
15
|
const RGOption = `RadioGroupOption`;
|
|
16
16
|
exports.RadioGroupMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
|
-
description: `
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
description: "`RadioGroup` creates a mutually exclusive selection interface where users can " +
|
|
18
|
+
"choose only one option from a group of radio buttons. It manages the selection " +
|
|
19
|
+
"state and ensures that selecting one option automatically deselects all others in " +
|
|
20
|
+
"the group.",
|
|
20
21
|
props: {
|
|
21
22
|
initialValue: Object.assign(Object.assign({}, (0, metadata_helpers_1.dInitialValue)()), { defaultValue: RadioGroupNative_1.defaultProps.initialValue }),
|
|
22
23
|
autoFocus: (0, metadata_helpers_1.dAutoFocus)(),
|
|
@@ -40,20 +41,21 @@ exports.RadioGroupMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
40
41
|
defaultThemeVars: {
|
|
41
42
|
[`gap-${RGOption}`]: "$space-1_5",
|
|
42
43
|
[`borderWidth-${RGOption}`]: "1px",
|
|
43
|
-
[`
|
|
44
|
-
[`backgroundColor-checked-${RGOption}--disabled]`]: `$borderColor-${RGOption}--disabled`,
|
|
45
|
-
[`backgroundColor-checked-${RGOption}-error`]: `$borderColor-${RGOption}-error`,
|
|
46
|
-
[`backgroundColor-checked-${RGOption}-warning`]: `$borderColor-${RGOption}-warning`,
|
|
47
|
-
[`backgroundColor-checked-${RGOption}-success`]: `$borderColor-${RGOption}-success`,
|
|
48
|
-
[`fontSize-${RGOption}`]: "$fontSize-small",
|
|
49
|
-
[`fontWeight-${RGOption}`]: "$fontWeight-bold",
|
|
50
|
-
[`textColor-${RGOption}-error`]: `$borderColor-${RGOption}-error`,
|
|
51
|
-
[`textColor-${RGOption}-warning`]: `$borderColor-${RGOption}-warning`,
|
|
52
|
-
[`textColor-${RGOption}-success`]: `$borderColor-${RGOption}-success`,
|
|
53
|
-
[`backgroundColor-checked-${RGOption}-default`]: "$color-primary-500",
|
|
44
|
+
[`borderWidth-${RGOption}-validation`]: `2px`,
|
|
54
45
|
[`borderColor-${RGOption}-default`]: "$color-surface-500",
|
|
46
|
+
[`borderColor-checked-${RGOption}`]: "$color-primary-500",
|
|
55
47
|
[`borderColor-${RGOption}-default--hover`]: "$color-surface-700",
|
|
56
48
|
[`borderColor-${RGOption}-default--active`]: "$color-primary-500",
|
|
49
|
+
[`backgroundColor-${RGOption}--disabled`]: "$backgroundColor--disabled",
|
|
50
|
+
[`backgroundColor-checked-${RGOption}`]: "$color-primary-500",
|
|
51
|
+
[`backgroundColor-${RGOption}-checked--disabled`]: `$textColor--disabled`,
|
|
52
|
+
[`backgroundColor-checked-indicator-${RGOption}`]: `transparent`,
|
|
53
|
+
[`backgroundColor-${RGOption}-checked-indicator--disabled`]: `transparent`,
|
|
54
|
+
[`backgroundColor-checked-${RGOption}-error`]: `$borderColor-error`,
|
|
55
|
+
[`backgroundColor-checked-${RGOption}-warning`]: `$borderColor-warning`,
|
|
56
|
+
[`backgroundColor-checked-${RGOption}-success`]: `$borderColor-success`,
|
|
57
|
+
[`fontSize-${RGOption}`]: "$fontSize-small",
|
|
58
|
+
[`fontWeight-${RGOption}`]: "$fontWeight-bold",
|
|
57
59
|
},
|
|
58
60
|
});
|
|
59
61
|
exports.radioGroupRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.RadioGroupMd, ({ node, extractValue, layoutCss, state, updateState, lookupEventHandler, renderChild, registerComponentApi, }) => {
|