xmlui 0.9.20 → 0.9.23
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/{apiInterceptorWorker-BBls674G.mjs → apiInterceptorWorker-DZyEgCvB.mjs} +1 -1
- package/dist/{index-CbU44pSb.mjs → index-B8C8yAZL.mjs} +1919 -2284
- package/dist/index.css +2023 -914
- package/dist/{lint-Cd70ckJ6.mjs → lint-EcgF-9Wr.mjs} +22 -46
- package/dist/scripts/src/components/App/App.js +2 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +0 -1
- package/dist/scripts/src/components/App/AppNative.js +7 -5
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +5 -4
- package/dist/scripts/src/components/ComponentProvider.js +0 -10
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +3 -1
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +10 -2
- package/dist/scripts/src/components/Footer/FooterNative.js +1 -2
- package/dist/scripts/src/components/Form/FormContext.js +5 -0
- package/dist/scripts/src/components/Form/FormNative.js +11 -27
- package/dist/scripts/src/components/Form/formActions.js +3 -2
- package/dist/scripts/src/components/FormItem/FormItem.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItemNative.js +54 -7
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
- package/dist/scripts/src/components/Icon/StarsIcon.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +4 -1
- package/dist/scripts/src/components/InspectButton/InspectButton.js +5 -3
- package/dist/scripts/src/components/Items/ItemsNative.js +8 -6
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -3
- package/dist/scripts/src/components/Select/SelectNative.js +3 -1
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -1
- package/dist/scripts/src/components-core/InspectorContext.js +4 -5
- package/dist/scripts/src/components-core/rendering/Container.js +1 -6
- package/dist/style.css +2004 -838
- package/dist/xmlui-metadata.mjs +1410 -1506
- package/dist/xmlui-metadata.umd.js +1409 -1505
- package/dist/xmlui-parser.mjs +17 -17
- package/dist/xmlui-standalone.umd.js +4339 -3614
- package/dist/xmlui.d.ts +1 -1
- package/dist/xmlui.mjs +1 -1
- package/package.json +3 -2
- package/dist/scripts/src/components/Alert/Alert.js +0 -61
- package/dist/scripts/src/components/Alert/AlertNative.js +0 -8
- package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +0 -55
- package/dist/scripts/src/components/ButtonGroup/ButtonGroupNative.js +0 -8
- package/dist/scripts/src/components/OffCanvas/OffCanvas.js +0 -57
- package/dist/scripts/src/components/OffCanvas/OffCanvasNative.js +0 -48
- package/dist/scripts/src/components/StateViewer/StateViewerNative.js +0 -19
- package/dist/scripts/src/components/SubNavPanel/SubNavPanel.js +0 -22
- package/dist/scripts/src/components/SubNavPanel/SubNavPanelNative.js +0 -9
|
@@ -105,28 +105,6 @@ const iconPositionMd = [
|
|
|
105
105
|
description: "The icon will appear at the end (right side when the left-to-right direction is set)"
|
|
106
106
|
}
|
|
107
107
|
];
|
|
108
|
-
const statusColorMd = [
|
|
109
|
-
{ value: "primary", description: "Primary theme color, no default icon" },
|
|
110
|
-
{ value: "secondary", description: "Secondary theme color, no default icon" },
|
|
111
|
-
{ value: "success", description: 'Success theme color, "success" icon' },
|
|
112
|
-
{ value: "danger", description: 'Warning theme color, "warning" icon' },
|
|
113
|
-
{ value: "warning", description: 'Danger theme color, "danger" icon' },
|
|
114
|
-
{ value: "info", description: 'Info theme color, "info" icon' },
|
|
115
|
-
{ value: "light", description: "Light theme color, no default icon" },
|
|
116
|
-
{ value: "dark", description: "Dark theme color, no default icon" }
|
|
117
|
-
];
|
|
118
|
-
const placementMd = [
|
|
119
|
-
{
|
|
120
|
-
value: "start",
|
|
121
|
-
description: "The left side of the window (left-to-right) or the right side of the window (right-to-left)"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
value: "end",
|
|
125
|
-
description: "The right side of the window (left-to-right) or the left side of the window (right-to-left)"
|
|
126
|
-
},
|
|
127
|
-
{ value: "top", description: "The top of the window" },
|
|
128
|
-
{ value: "bottom", description: "The bottom of the window" }
|
|
129
|
-
];
|
|
130
108
|
const labelPositionMd = [
|
|
131
109
|
{
|
|
132
110
|
value: "start",
|
|
@@ -6265,30 +6243,28 @@ export {
|
|
|
6265
6243
|
buttonVariantNames as a4,
|
|
6266
6244
|
nodeToComponentDef as a5,
|
|
6267
6245
|
triggerPositionNames as a6,
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
onPrefixRegex as at,
|
|
6291
|
-
CORE_NAMESPACE_VALUE as au,
|
|
6246
|
+
httpMethodNames as a7,
|
|
6247
|
+
PARSED_MARK_PROP as a8,
|
|
6248
|
+
layoutOptionKeys as a9,
|
|
6249
|
+
viewportSizeNames as aa,
|
|
6250
|
+
componentFileExtension as ab,
|
|
6251
|
+
codeBehindFileExtension as ac,
|
|
6252
|
+
getLintSeverity as ad,
|
|
6253
|
+
LintSeverity as ae,
|
|
6254
|
+
lintApp as af,
|
|
6255
|
+
printComponentLints as ag,
|
|
6256
|
+
lintErrorsComponent as ah,
|
|
6257
|
+
collectCodeBehindFromSource as ai,
|
|
6258
|
+
removeCodeBehindTokensFromTree as aj,
|
|
6259
|
+
COMPOUND_COMP_ID as ak,
|
|
6260
|
+
moduleFileExtension as al,
|
|
6261
|
+
LintDiagKind as am,
|
|
6262
|
+
lint as an,
|
|
6263
|
+
ParserError2 as ao,
|
|
6264
|
+
errorMessages as ap,
|
|
6265
|
+
UCRegex as aq,
|
|
6266
|
+
onPrefixRegex as ar,
|
|
6267
|
+
CORE_NAMESPACE_VALUE as as,
|
|
6292
6268
|
alignmentOptionMd as b,
|
|
6293
6269
|
buttonTypesMd as c,
|
|
6294
6270
|
buttonThemeMd as d,
|
|
@@ -77,6 +77,7 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
77
77
|
themeVarDescriptions: {
|
|
78
78
|
"maxWidth‑content‑App": "This theme variable defines the maximum width of the main content. If the main " +
|
|
79
79
|
"content is broader, the engine adds margins to keep the expected maximum size.",
|
|
80
|
+
"maxWidth-App-vertical": "This theme variable defines the app's full width in vertical layouts.",
|
|
80
81
|
"boxShadow‑header‑App": "This theme variable sets the shadow of the app's header section.",
|
|
81
82
|
"boxShadow‑navPanel‑App": "This theme variable sets the shadow of the app's navigation panel section " +
|
|
82
83
|
"(visible only in vertical layouts).",
|
|
@@ -86,6 +87,7 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
86
87
|
defaultThemeVars: {
|
|
87
88
|
[`width-navPanel-${COMP}`]: "$space-64",
|
|
88
89
|
[`maxWidth-content-${COMP}`]: "$maxWidth-content",
|
|
90
|
+
[`maxWidth-${COMP}-vertical`]: "100%",
|
|
89
91
|
[`boxShadow-header-${COMP}`]: "$boxShadow-spread",
|
|
90
92
|
[`boxShadow-navPanel-${COMP}`]: "$boxShadow-spread",
|
|
91
93
|
[`scroll-padding-block-Pages`]: "$space-4",
|
|
@@ -36,6 +36,8 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
36
36
|
const { setActiveThemeTone, setActiveThemeId, themes } = (0, ThemeContext_1.useThemes)();
|
|
37
37
|
const mounted = (0, react_1.useRef)(false);
|
|
38
38
|
const layoutWithDefaultValue = layout || getThemeVar("layout-App") || "condensed-sticky";
|
|
39
|
+
const isFullVerticalWidth = getThemeVar("maxWidth-App-vertical") === "100%";
|
|
40
|
+
console.log("isVerticalMaxWidth", isFullVerticalWidth);
|
|
39
41
|
const safeLayout = layoutWithDefaultValue === null || layoutWithDefaultValue === void 0 ? void 0 : layoutWithDefaultValue.trim().replace(/[\u2013\u2014\u2011]/g, "-"); //It replaces all – (–) and — (—) and non-breaking hyphen '‑' symbols with simple dashes (-).
|
|
40
42
|
const { setLoggedInUser, mediaSize } = (0, AppContext_1.useAppContext)();
|
|
41
43
|
const hasRegisteredHeader = header !== undefined;
|
|
@@ -138,6 +140,8 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
138
140
|
logoContentDef,
|
|
139
141
|
registerSubNavPanelSlot,
|
|
140
142
|
subNavPanelSlot,
|
|
143
|
+
isFullVerticalWidth,
|
|
144
|
+
scrollWholePage,
|
|
141
145
|
};
|
|
142
146
|
}, [
|
|
143
147
|
hasRegisteredNavPanel,
|
|
@@ -153,6 +157,8 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
153
157
|
logoContentDef,
|
|
154
158
|
registerSubNavPanelSlot,
|
|
155
159
|
subNavPanelSlot,
|
|
160
|
+
isFullVerticalWidth,
|
|
161
|
+
scrollWholePage,
|
|
156
162
|
]);
|
|
157
163
|
(0, react_1.useEffect)(() => {
|
|
158
164
|
if (navPanelVisible) {
|
|
@@ -183,10 +189,7 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
183
189
|
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.vertical, App_module_scss_1.default.sticky), style: styleWithHelpers, children: [navPanelVisible && (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(App_module_scss_1.default.navPanelWrapper), children: navPanel }), (0, jsx_runtime_1.jsxs)("div", { className: App_module_scss_1.default.contentWrapper, ref: scrollPageContainerRef, children: [(0, jsx_runtime_1.jsx)("header", { ref: headerRefCallback, className: (0, classnames_1.default)(App_module_scss_1.default.headerWrapper, App_module_scss_1.default.sticky), children: header }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapper, ref: noScrollPageContainerRef, children: (0, jsx_runtime_1.jsx)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapperInner, style: pagesWrapperInnerStyle, children: children }) }) }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.footerWrapper, ref: footerRefCallback, children: footer })] })] }));
|
|
184
190
|
break;
|
|
185
191
|
case "vertical-full-header":
|
|
186
|
-
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.verticalFullHeader), style: styleWithHelpers, ref: scrollPageContainerRef, children: [(0, jsx_runtime_1.jsx)("header", { className: (0, classnames_1.default)(App_module_scss_1.default.headerWrapper, App_module_scss_1.default.sticky), ref: headerRefCallback, children: header }), (0, jsx_runtime_1.jsxs)("div", { className: App_module_scss_1.default.content, children: [navPanelVisible && (0, jsx_runtime_1.jsx)("aside", { className: App_module_scss_1.default.navPanelWrapper, children: navPanel }), (0, jsx_runtime_1.jsx)("main", { className: App_module_scss_1.default.contentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapper, ref: noScrollPageContainerRef, children: (0, jsx_runtime_1.jsx)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapperInner, style: pagesWrapperInnerStyle, children: children }) }) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.footerWrapper, ref: footerRefCallback, children: footer })] }));
|
|
187
|
-
break;
|
|
188
|
-
case "vertical-constrained-width":
|
|
189
|
-
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.verticalConstrained), style: styleWithHelpers, ref: scrollPageContainerRef, children: [(0, jsx_runtime_1.jsx)("header", { className: (0, classnames_1.default)(App_module_scss_1.default.headerWrapper, App_module_scss_1.default.sticky), ref: headerRefCallback, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.header, style: { paddingInline: 0 }, children: header }) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(App_module_scss_1.default.content, App_module_scss_1.default.verticalConstrained), children: [navPanelVisible && (0, jsx_runtime_1.jsx)("aside", { className: App_module_scss_1.default.navPanelWrapper, children: navPanel }), (0, jsx_runtime_1.jsx)("main", { className: App_module_scss_1.default.contentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapper, ref: noScrollPageContainerRef, children: (0, jsx_runtime_1.jsx)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapperInner, style: pagesWrapperInnerStyle, children: children }) }) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.footerWrapper, ref: footerRefCallback, children: footer })] }));
|
|
192
|
+
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.verticalFullHeader), style: styleWithHelpers, ref: scrollPageContainerRef, children: [(0, jsx_runtime_1.jsx)("header", { className: (0, classnames_1.default)(App_module_scss_1.default.headerWrapper, App_module_scss_1.default.sticky), ref: headerRefCallback, children: header }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.contentScroller, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.contentAligner, children: (0, jsx_runtime_1.jsxs)("div", { className: App_module_scss_1.default.content, children: [navPanelVisible && (0, jsx_runtime_1.jsx)("aside", { className: App_module_scss_1.default.navPanelWrapper, children: navPanel }), (0, jsx_runtime_1.jsx)("main", { className: App_module_scss_1.default.contentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapper, ref: noScrollPageContainerRef, children: (0, jsx_runtime_1.jsx)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapperInner, style: pagesWrapperInnerStyle, children: children }) }) }) })] }) }) }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.footerWrapper, ref: footerRefCallback, children: footer })] }));
|
|
190
193
|
break;
|
|
191
194
|
case "condensed":
|
|
192
195
|
case "condensed-sticky":
|
|
@@ -213,7 +216,6 @@ function getAppLayoutOrientation(appLayout) {
|
|
|
213
216
|
case "vertical":
|
|
214
217
|
case "vertical-sticky":
|
|
215
218
|
case "vertical-full-header":
|
|
216
|
-
case "vertical-constrained-width":
|
|
217
219
|
return "vertical";
|
|
218
220
|
default:
|
|
219
221
|
return "horizontal";
|
|
@@ -40,16 +40,18 @@ function useLogoUrl() {
|
|
|
40
40
|
const toneLogoUrl = (0, ThemeContext_1.useResourceUrl)(`resource:logo-${activeThemeTone}`) || logoUrlByTone[activeThemeTone];
|
|
41
41
|
return toneLogoUrl || baseLogoUrl;
|
|
42
42
|
}
|
|
43
|
-
const AppHeader = ({ children, profileMenu, style = constants_1.EMPTY_OBJECT, logoContent, className,
|
|
43
|
+
const AppHeader = ({ children, profileMenu, style = constants_1.EMPTY_OBJECT, logoContent, className, navPanelVisible = true, toggleDrawer, showLogo, hasRegisteredNavPanel, title, titleContent, registerSubNavPanelSlot, }) => {
|
|
44
44
|
const { mediaSize } = (0, AppContext_1.useAppContext)();
|
|
45
45
|
const logoUrl = useLogoUrl();
|
|
46
46
|
const subNavPanelSlot = (0, react_1.useRef)(null);
|
|
47
47
|
const safeLogoTitle = mediaSize.sizeIndex < 2 ? null : !titleContent && title ? ((0, jsx_runtime_1.jsx)(NavLinkNative_1.NavLink, { to: "/", displayActive: false, style: { paddingLeft: 0 }, children: title })) : (titleContent);
|
|
48
|
+
const layoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
48
49
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
49
50
|
registerSubNavPanelSlot === null || registerSubNavPanelSlot === void 0 ? void 0 : registerSubNavPanelSlot(subNavPanelSlot.current);
|
|
50
51
|
}, []);
|
|
51
52
|
return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.header, className), style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.headerInner, {
|
|
52
|
-
[AppHeader_module_scss_1.default.
|
|
53
|
+
[AppHeader_module_scss_1.default.verticalFullHeader]: (layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.layout) === "vertical-full-header",
|
|
54
|
+
[AppHeader_module_scss_1.default.scrollWholePage]: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.scrollWholePage,
|
|
53
55
|
}), children: [!navPanelVisible && hasRegisteredNavPanel && ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: toggleDrawer, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "hamburger" }), variant: "ghost", style: { color: "inherit", flexShrink: 0 } })), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoAndTitle, children: (showLogo || !navPanelVisible) &&
|
|
54
56
|
(logoContent ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.customLogoContainer, children: logoContent }), safeLogoTitle] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!logoUrl && ((0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoContainer, children: (0, jsx_runtime_1.jsx)(NavLinkNative_1.NavLink, { to: "/", displayActive: false, style: { padding: 0, height: "100%" }, children: (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }) })), safeLogoTitle] }))) }), (0, jsx_runtime_1.jsx)("div", { ref: subNavPanelSlot, className: AppHeader_module_scss_1.default.subNavPanelSlot }), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.childrenWrapper, children: children }), profileMenu && (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.rightItems, children: profileMenu })] }) }));
|
|
55
57
|
};
|
|
@@ -59,6 +61,5 @@ function AppContextAwareAppHeader({ children, logoContent, profileMenu, style, c
|
|
|
59
61
|
const { navPanelVisible, toggleDrawer, layout, hasRegisteredNavPanel, navPanelDef, logoContentDef, registerSubNavPanelSlot, } = appLayoutContext || {};
|
|
60
62
|
// console.log("APP LAYOUT CONTEXT", appLayoutContext);
|
|
61
63
|
const displayLogo = layout !== "vertical" && layout !== "vertical-sticky" && showLogo;
|
|
62
|
-
|
|
63
|
-
return ((0, jsx_runtime_1.jsxs)(exports.AppHeader, { hasRegisteredNavPanel: hasRegisteredNavPanel, navPanelVisible: navPanelVisible, toggleDrawer: toggleDrawer, canRestrictContentWidth: canRestrictContentWidth, showLogo: displayLogo, logoContent: logoContent || renderChild(logoContentDef), profileMenu: profileMenu, style: style, className: className, title: title, titleContent: titleContent, registerSubNavPanelSlot: registerSubNavPanelSlot, children: [(layout === null || layout === void 0 ? void 0 : layout.startsWith("condensed")) && navPanelVisible && ((0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0 }, children: renderChild(navPanelDef) })), children] }));
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)(exports.AppHeader, { hasRegisteredNavPanel: hasRegisteredNavPanel, navPanelVisible: navPanelVisible, toggleDrawer: toggleDrawer, showLogo: displayLogo, logoContent: logoContent || renderChild(logoContentDef), profileMenu: profileMenu, style: style, className: className, title: title, titleContent: titleContent, registerSubNavPanelSlot: registerSubNavPanelSlot, children: [(layout === null || layout === void 0 ? void 0 : layout.startsWith("condensed")) && navPanelVisible && ((0, jsx_runtime_1.jsx)("div", { style: { minWidth: 0 }, children: renderChild(navPanelDef) })), children] }));
|
|
64
65
|
}
|
|
@@ -81,13 +81,10 @@ const Bookmark_1 = require("./Bookmark/Bookmark");
|
|
|
81
81
|
const AppState_1 = require("./AppState/AppState");
|
|
82
82
|
const TableOfContents_1 = require("./TableOfContents/TableOfContents");
|
|
83
83
|
const Accordion_1 = require("./Accordion/Accordion");
|
|
84
|
-
const Alert_1 = require("./Alert/Alert");
|
|
85
|
-
const OffCanvas_1 = require("./OffCanvas/OffCanvas");
|
|
86
84
|
const XmluiCodeHighlighter_1 = require("../components-core/XmluiCodeHighlighter");
|
|
87
85
|
const TabItem_1 = require("./Tabs/TabItem");
|
|
88
86
|
const AccordionItem_1 = require("./Accordion/AccordionItem");
|
|
89
87
|
const Slider_1 = require("./Slider/Slider");
|
|
90
|
-
const ButtonGroup_1 = require("./ButtonGroup/ButtonGroup");
|
|
91
88
|
const Carousel_1 = require("./Carousel/Carousel");
|
|
92
89
|
const CarouselItem_1 = require("./Carousel/CarouselItem");
|
|
93
90
|
const renderers_1 = require("../components-core/renderers");
|
|
@@ -100,7 +97,6 @@ const Backdrop_1 = require("./Backdrop/Backdrop");
|
|
|
100
97
|
const HtmlTags_1 = require("./HtmlTags/HtmlTags");
|
|
101
98
|
const ColorPicker_1 = require("./ColorPicker/ColorPicker");
|
|
102
99
|
const RadioItem_1 = require("./RadioGroup/RadioItem");
|
|
103
|
-
const SubNavPanel_1 = require("./SubNavPanel/SubNavPanel");
|
|
104
100
|
const InspectButton_1 = require("./InspectButton/InspectButton");
|
|
105
101
|
/**
|
|
106
102
|
* The framework has a specialized component concept, the "property holder
|
|
@@ -275,9 +271,6 @@ class ComponentRegistry {
|
|
|
275
271
|
if (process.env.VITE_USED_COMPONENTS_NavPanel !== "false") {
|
|
276
272
|
this.registerCoreComponent(NavPanel_1.navPanelRenderer);
|
|
277
273
|
}
|
|
278
|
-
if (process.env.VITE_USED_COMPONENTS_SubNavPanel !== "false") {
|
|
279
|
-
this.registerCoreComponent(SubNavPanel_1.subNavPanelRenderer);
|
|
280
|
-
}
|
|
281
274
|
if (process.env.VITE_USED_COMPONENTS_Pages !== "false") {
|
|
282
275
|
this.registerCoreComponent(Pages_1.pagesRenderer);
|
|
283
276
|
this.registerCoreComponent(Pages_1.pageRenderer);
|
|
@@ -390,10 +383,7 @@ class ComponentRegistry {
|
|
|
390
383
|
// --- New Bootstrap-inspired components
|
|
391
384
|
this.registerCoreComponent(Carousel_1.carouselComponentRenderer);
|
|
392
385
|
this.registerCoreComponent(Accordion_1.accordionComponentRenderer);
|
|
393
|
-
this.registerCoreComponent(Alert_1.alertComponentRenderer);
|
|
394
|
-
this.registerCoreComponent(OffCanvas_1.offCanvasComponentRenderer);
|
|
395
386
|
this.registerCoreComponent(Slider_1.sliderComponentRenderer);
|
|
396
|
-
this.registerCoreComponent(ButtonGroup_1.buttonGroupComponentRenderer);
|
|
397
387
|
this.registerCoreComponent(Backdrop_1.backdropComponentRenderer);
|
|
398
388
|
this.registerCoreComponent(HtmlTags_1.htmlATagRenderer);
|
|
399
389
|
this.registerCoreComponent(HtmlTags_1.htmlAbbrTagRenderer);
|
|
@@ -99,6 +99,7 @@ exports.MenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
99
99
|
valueType: "boolean",
|
|
100
100
|
defaultValue: DropdownMenuNative_1.defaultMenuItemProps.active,
|
|
101
101
|
},
|
|
102
|
+
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
102
103
|
},
|
|
103
104
|
events: {
|
|
104
105
|
click: (0, metadata_helpers_1.dClick)(MICOMP),
|
|
@@ -107,6 +108,7 @@ exports.MenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
107
108
|
defaultThemeVars: {
|
|
108
109
|
[`backgroundColor-${MICOMP}`]: "$backgroundColor-dropdown-item",
|
|
109
110
|
[`color-${MICOMP}`]: "$textColor-primary",
|
|
111
|
+
[`color-${MICOMP}--disabled`]: "$textColor--disabled",
|
|
110
112
|
[`fontFamily-${MICOMP}`]: "$fontFamily",
|
|
111
113
|
[`fontSize-${MICOMP}`]: "$fontSize-small",
|
|
112
114
|
[`paddingVertical-${MICOMP}`]: "$space-2",
|
|
@@ -131,7 +133,7 @@ exports.menuItemRenderer = (0, renderers_1.createComponentRenderer)(MICOMP, expo
|
|
|
131
133
|
navigateAction === null || navigateAction === void 0 ? void 0 : navigateAction({ pathname: to });
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
|
-
return ((0, jsx_runtime_1.jsx)(DropdownMenuNative_1.MenuItem, { onClick: clickHandler, label: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.label), style: layoutCss, iconPosition: extractValue(node.props.iconPosition), icon: ((_b = node.props) === null || _b === void 0 ? void 0 : _b.icon) && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: extractValue(node.props.icon) }), active: extractValue.asOptionalBoolean(node.props.active, false), children: renderChild(node.children) }));
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuNative_1.MenuItem, { onClick: clickHandler, label: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.label), style: layoutCss, iconPosition: extractValue(node.props.iconPosition), icon: ((_b = node.props) === null || _b === void 0 ? void 0 : _b.icon) && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: extractValue(node.props.icon) }), active: extractValue.asOptionalBoolean(node.props.active, false), enabled: extractValue.asOptionalBoolean(node.props.enabled, true), children: renderChild(node.children) }));
|
|
135
137
|
});
|
|
136
138
|
const SMCOMP = "SubMenuItem";
|
|
137
139
|
exports.SubMenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
@@ -87,13 +87,21 @@ exports.defaultMenuItemProps = {
|
|
|
87
87
|
iconPosition: "start",
|
|
88
88
|
active: false,
|
|
89
89
|
};
|
|
90
|
-
exports.MenuItem = (0, react_1.forwardRef)(function MenuItem({ children, onClick = constants_1.noop, label, style, icon, iconPosition = exports.defaultMenuItemProps.iconPosition, active = exports.defaultMenuItemProps.active, }, ref) {
|
|
90
|
+
exports.MenuItem = (0, react_1.forwardRef)(function MenuItem({ children, onClick = constants_1.noop, label, style, icon, iconPosition = exports.defaultMenuItemProps.iconPosition, active = exports.defaultMenuItemProps.active, enabled = true, }, ref) {
|
|
91
91
|
const iconToStart = iconPosition === "start";
|
|
92
92
|
return ((0, jsx_runtime_1.jsxs)(ReactDropdownMenu.Item, { style: style, className: (0, classnames_1.default)(DropdownMenu_module_scss_1.default.DropdownMenuItem, {
|
|
93
93
|
[DropdownMenu_module_scss_1.default.active]: active,
|
|
94
|
+
[DropdownMenu_module_scss_1.default.disabled]: !enabled,
|
|
94
95
|
}), onClick: (event) => {
|
|
96
|
+
if (!enabled) {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
event.stopPropagation();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
95
101
|
event.stopPropagation();
|
|
96
|
-
|
|
102
|
+
if (enabled) {
|
|
103
|
+
onClick(event);
|
|
104
|
+
}
|
|
97
105
|
}, ref: ref, children: [iconToStart && icon, (0, jsx_runtime_1.jsx)("div", { className: DropdownMenu_module_scss_1.default.wrapper, children: label !== null && label !== void 0 ? label : children }), !iconToStart && icon] }));
|
|
98
106
|
});
|
|
99
107
|
function SubMenuItem({ children, label, triggerTemplate }) {
|
|
@@ -13,8 +13,7 @@ const AppLayoutContext_1 = require("../App/AppLayoutContext");
|
|
|
13
13
|
// React Footer component implementation
|
|
14
14
|
exports.Footer = (0, react_1.forwardRef)(function Footer({ children, style, className, }, forwardedRef) {
|
|
15
15
|
const { layout } = (0, AppLayoutContext_1.useAppLayoutContext)() || {};
|
|
16
|
-
const canRestrictContentWidth = layout !== "vertical-full-header";
|
|
17
16
|
return ((0, jsx_runtime_1.jsx)("div", { className: Footer_module_scss_1.default.outerWrapper, ref: forwardedRef, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Footer_module_scss_1.default.wrapper, className, {
|
|
18
|
-
[Footer_module_scss_1.default.
|
|
17
|
+
[Footer_module_scss_1.default.verticalFullHeader]: layout === "vertical-full-header",
|
|
19
18
|
}), children: children }) }));
|
|
20
19
|
});
|
|
@@ -48,6 +48,7 @@ exports.formControlTypes = [
|
|
|
48
48
|
"switch",
|
|
49
49
|
"slider",
|
|
50
50
|
"colorpicker",
|
|
51
|
+
"items",
|
|
51
52
|
];
|
|
52
53
|
exports.formControlTypesMd = [
|
|
53
54
|
{
|
|
@@ -106,6 +107,10 @@ exports.formControlTypesMd = [
|
|
|
106
107
|
value: "colorpicker",
|
|
107
108
|
description: "Renders ColorPicker",
|
|
108
109
|
},
|
|
110
|
+
{
|
|
111
|
+
value: "items",
|
|
112
|
+
description: "Renders Items",
|
|
113
|
+
},
|
|
109
114
|
{
|
|
110
115
|
value: "custom",
|
|
111
116
|
description: "Custom control specified in children",
|
|
@@ -32,31 +32,13 @@ const ValidationSummary_1 = require("../ValidationSummary/ValidationSummary");
|
|
|
32
32
|
const Validations_1 = require("../FormItem/Validations");
|
|
33
33
|
const formActions_2 = require("../Form/formActions");
|
|
34
34
|
const FormContext_1 = require("./FormContext");
|
|
35
|
-
const
|
|
36
|
-
const keys = path.split(".");
|
|
37
|
-
for (let i = 0; i < keys.length; i++) {
|
|
38
|
-
const currentKey = keys[i];
|
|
39
|
-
const nextKey = keys[i + 1];
|
|
40
|
-
if (typeof nextKey !== "undefined") {
|
|
41
|
-
obj[currentKey] = obj[currentKey] ? obj[currentKey] : {};
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
obj[currentKey] = val;
|
|
45
|
-
}
|
|
46
|
-
obj = obj[currentKey];
|
|
47
|
-
}
|
|
48
|
-
};
|
|
35
|
+
const lodash_es_1 = require("lodash-es");
|
|
49
36
|
const getByPath = (obj, path) => {
|
|
50
|
-
|
|
51
|
-
let ret = obj;
|
|
52
|
-
for (let i = 0; i < keys.length; i++) {
|
|
53
|
-
ret = ret === null || ret === void 0 ? void 0 : ret[keys[i]];
|
|
54
|
-
}
|
|
55
|
-
return ret;
|
|
37
|
+
return (0, lodash_es_1.get)(obj, path);
|
|
56
38
|
};
|
|
57
39
|
exports.getByPath = getByPath;
|
|
58
40
|
const formReducer = (0, immer_1.default)((state, action) => {
|
|
59
|
-
var _a, _b, _c, _d;
|
|
41
|
+
var _a, _b, _c, _d, _e;
|
|
60
42
|
const { uid } = action.payload;
|
|
61
43
|
if (uid !== undefined && !state.interactionFlags[uid]) {
|
|
62
44
|
state.interactionFlags[uid] = {
|
|
@@ -70,17 +52,18 @@ const formReducer = (0, immer_1.default)((state, action) => {
|
|
|
70
52
|
}
|
|
71
53
|
switch (action.type) {
|
|
72
54
|
case formActions_1.FormActionKind.FIELD_INITIALIZED: {
|
|
73
|
-
if (!state.interactionFlags[uid].isDirty) {
|
|
74
|
-
|
|
55
|
+
if (!state.interactionFlags[uid].isDirty || action.payload.force) {
|
|
56
|
+
(0, lodash_es_1.set)(state.subject, uid, action.payload.value);
|
|
75
57
|
}
|
|
76
58
|
break;
|
|
77
59
|
}
|
|
78
60
|
case formActions_1.FormActionKind.FIELD_REMOVED: {
|
|
79
61
|
delete state.validationResults[uid];
|
|
62
|
+
delete state.interactionFlags[uid];
|
|
80
63
|
break;
|
|
81
64
|
}
|
|
82
65
|
case formActions_1.FormActionKind.FIELD_VALUE_CHANGED: {
|
|
83
|
-
|
|
66
|
+
(0, lodash_es_1.set)(state.subject, uid, action.payload.value);
|
|
84
67
|
state.interactionFlags[uid].isDirty = true;
|
|
85
68
|
state.interactionFlags[uid].forceShowValidationResult = false;
|
|
86
69
|
break;
|
|
@@ -167,10 +150,10 @@ const formReducer = (0, immer_1.default)((state, action) => {
|
|
|
167
150
|
}
|
|
168
151
|
case formActions_1.FormActionKind.RESET: {
|
|
169
152
|
const { originalSubject } = action.payload;
|
|
170
|
-
return Object.assign(Object.assign({}, initialState), { subject: originalSubject });
|
|
171
|
-
break;
|
|
153
|
+
return Object.assign(Object.assign({}, initialState), { subject: originalSubject, resetVersion: ((_e = state.resetVersion) !== null && _e !== void 0 ? _e : 0) + 1 });
|
|
172
154
|
}
|
|
173
155
|
default:
|
|
156
|
+
break;
|
|
174
157
|
}
|
|
175
158
|
});
|
|
176
159
|
const initialState = {
|
|
@@ -179,6 +162,7 @@ const initialState = {
|
|
|
179
162
|
generalValidationResults: [],
|
|
180
163
|
interactionFlags: {},
|
|
181
164
|
submitInProgress: false,
|
|
165
|
+
resetVersion: 0,
|
|
182
166
|
};
|
|
183
167
|
exports.defaultProps = {
|
|
184
168
|
cancelLabel: "Cancel",
|
|
@@ -328,7 +312,7 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
328
312
|
update: updateData,
|
|
329
313
|
});
|
|
330
314
|
}, [doReset, updateData, registerComponentApi]);
|
|
331
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { style: style, className: Form_module_scss_1.default.wrapper, onSubmit: doSubmit, onReset: doReset, id: id, ref: formRef, children: [(0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults }), (0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, { value: formContextValue, children: children }), buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] }))] }), confirmSubmitModalVisible && ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { onClose: () => setConfirmSubmitModalVisible(false), isInitiallyOpen: true, title: "Are you sure want to move forward?", children: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "vertical", style: { gap: "0.5rem" }, children: [(0, jsx_runtime_1.jsx)(TextNative_1.Text, { children: "The following warnings were found during validation. Please make sure you are willing to move forward despite these issues." }), (0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults, fieldValidationResults: formState.validationResults }), (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", horizontalAlignment: "end", style: { gap: "1em" }, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", onClick: () => setConfirmSubmitModalVisible(false), children: "No" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => doSubmit(), autoFocus: true, children: "Yes, proceed" })] })] }) }))] }));
|
|
315
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("form", { style: style, className: Form_module_scss_1.default.wrapper, onSubmit: doSubmit, onReset: doReset, id: id, ref: formRef, children: [(0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults }), (0, jsx_runtime_1.jsx)(FormContext_1.FormContext.Provider, { value: formContextValue, children: children }), buttonRow || ((0, jsx_runtime_1.jsxs)("div", { className: Form_module_scss_1.default.buttonRow, children: [swapCancelAndSave && [submitButton, cancelButton], !swapCancelAndSave && [cancelButton, submitButton]] }))] }, formState.resetVersion), confirmSubmitModalVisible && ((0, jsx_runtime_1.jsx)(ModalDialogNative_1.ModalDialog, { onClose: () => setConfirmSubmitModalVisible(false), isInitiallyOpen: true, title: "Are you sure want to move forward?", children: (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "vertical", style: { gap: "0.5rem" }, children: [(0, jsx_runtime_1.jsx)(TextNative_1.Text, { children: "The following warnings were found during validation. Please make sure you are willing to move forward despite these issues." }), (0, jsx_runtime_1.jsx)(ValidationSummary_1.ValidationSummary, { generalValidationResults: formState.generalValidationResults, fieldValidationResults: formState.validationResults }), (0, jsx_runtime_1.jsxs)(StackNative_1.Stack, { orientation: "horizontal", horizontalAlignment: "end", style: { gap: "1em" }, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", onClick: () => setConfirmSubmitModalVisible(false), children: "No" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => doSubmit(), autoFocus: true, children: "Yes, proceed" })] })] }) }))] }));
|
|
332
316
|
});
|
|
333
317
|
Form.displayName = "Form";
|
|
334
318
|
function FormWithContextVar({ node, renderChild, extractValue, style, lookupEventHandler, registerComponentApi, }) {
|
|
@@ -27,12 +27,13 @@ var FormActionKind;
|
|
|
27
27
|
FormActionKind["SUBMITTED"] = "FormActionKind:SUBMITTED";
|
|
28
28
|
FormActionKind["RESET"] = "FormActionKind:RESET";
|
|
29
29
|
})(FormActionKind || (exports.FormActionKind = FormActionKind = {}));
|
|
30
|
-
function fieldInitialized(uid, value) {
|
|
30
|
+
function fieldInitialized(uid, value, force = false) {
|
|
31
31
|
return {
|
|
32
32
|
type: FormActionKind.FIELD_INITIALIZED,
|
|
33
33
|
payload: {
|
|
34
34
|
uid,
|
|
35
35
|
value,
|
|
36
|
+
force
|
|
36
37
|
},
|
|
37
38
|
};
|
|
38
39
|
}
|
|
@@ -41,7 +42,7 @@ function fieldChanged(uid, value) {
|
|
|
41
42
|
type: FormActionKind.FIELD_VALUE_CHANGED,
|
|
42
43
|
payload: {
|
|
43
44
|
uid,
|
|
44
|
-
value
|
|
45
|
+
value
|
|
45
46
|
},
|
|
46
47
|
};
|
|
47
48
|
}
|
|
@@ -203,7 +203,7 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
|
|
|
203
203
|
const formItemType = extractValue.asOptionalString(type);
|
|
204
204
|
const isCustomFormItem = formItemType === undefined && !!node.children;
|
|
205
205
|
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
206
|
-
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem, Object.assign({ style: layoutCss, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, validations: resolvedValidationPropsAndEvents, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), inputRenderer: inputTemplate
|
|
206
|
+
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem, Object.assign({ style: layoutCss, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, validations: resolvedValidationPropsAndEvents, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), itemIndex: extractValue("{$itemIndex}"), initialValue: extractValue(node.props.initialValue), inputRenderer: inputTemplate
|
|
207
207
|
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
208
208
|
: undefined }, resolvedRestProps, { children: isCustomFormItem ? ((0, jsx_runtime_1.jsx)(FormItemNative_1.CustomFormItem, { renderChild: renderChild, node: node, bindTo: extractValue.asString(bindTo) })) : (renderChild(node.children, {
|
|
209
209
|
type: formItemType,
|
|
@@ -36,6 +36,8 @@ const SliderNative_1 = require("../Slider/SliderNative");
|
|
|
36
36
|
const ColorPickerNative_1 = require("../ColorPicker/ColorPickerNative");
|
|
37
37
|
const HelperText_1 = require("./HelperText");
|
|
38
38
|
const NumberBox2Native_1 = require("../NumberBox/NumberBox2Native");
|
|
39
|
+
const ItemsNative_1 = require("../Items/ItemsNative");
|
|
40
|
+
const constants_1 = require("../../components-core/constants");
|
|
39
41
|
const DEFAULT_LABEL_POSITIONS = {
|
|
40
42
|
checkbox: "end",
|
|
41
43
|
};
|
|
@@ -45,25 +47,63 @@ exports.defaultProps = {
|
|
|
45
47
|
enabled: true,
|
|
46
48
|
customValidationsDebounce: 0,
|
|
47
49
|
};
|
|
50
|
+
const FormItemContext = (0, react_1.createContext)({ parentFormItemId: null });
|
|
51
|
+
function ArrayLikeFormItem({ children, formItemId, registerComponentApi, value = constants_1.EMPTY_ARRAY, updateState, }) {
|
|
52
|
+
const formContextValue = (0, react_1.useMemo)(() => {
|
|
53
|
+
return {
|
|
54
|
+
parentFormItemId: formItemId,
|
|
55
|
+
};
|
|
56
|
+
}, [formItemId]);
|
|
57
|
+
const addItem = (0, misc_1.useEvent)((item) => {
|
|
58
|
+
updateState({ value: [...value, item] });
|
|
59
|
+
});
|
|
60
|
+
const removeItem = (0, misc_1.useEvent)((index) => {
|
|
61
|
+
updateState({ value: value.filter((item, i) => i !== index) });
|
|
62
|
+
});
|
|
63
|
+
(0, react_1.useEffect)(() => {
|
|
64
|
+
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
65
|
+
addItem: addItem,
|
|
66
|
+
removeItem: removeItem,
|
|
67
|
+
});
|
|
68
|
+
}, [addItem, registerComponentApi, removeItem]);
|
|
69
|
+
return (0, jsx_runtime_1.jsx)(FormItemContext.Provider, { value: formContextValue, children: children });
|
|
70
|
+
}
|
|
48
71
|
exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
49
|
-
var { style, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, validations, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer"]);
|
|
72
|
+
var { style, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, validations, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer, itemIndex, initialValue: initialValueFromProps } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer", "itemIndex", "initialValue"]);
|
|
50
73
|
const defaultId = (0, react_1.useId)();
|
|
51
|
-
const
|
|
74
|
+
const { parentFormItemId } = (0, react_1.useContext)(FormItemContext);
|
|
75
|
+
const formItemId = (0, react_1.useMemo)(() => {
|
|
76
|
+
const safeBindTo = bindTo || `${defaultId}${formActions_1.UNBOUND_FIELD_SUFFIX}`;
|
|
77
|
+
if (parentFormItemId) {
|
|
78
|
+
if (itemIndex !== undefined) {
|
|
79
|
+
let parentFieldReference = `${parentFormItemId}[${itemIndex}]`;
|
|
80
|
+
if (bindTo !== undefined && bindTo.trim() === "") {
|
|
81
|
+
return parentFieldReference;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
return `${parentFieldReference}.${safeBindTo}`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return safeBindTo;
|
|
90
|
+
}
|
|
91
|
+
}, [bindTo, defaultId, itemIndex, parentFormItemId]);
|
|
52
92
|
const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || value.itemLabelWidth);
|
|
53
93
|
const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value.itemLabelBreak);
|
|
54
94
|
const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || value.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type]);
|
|
55
95
|
const initialValueFromSubject = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.originalSubject, formItemId));
|
|
56
|
-
const initialValue = initialValueFromSubject === undefined ?
|
|
96
|
+
const initialValue = initialValueFromSubject === undefined ? initialValueFromProps : initialValueFromSubject;
|
|
57
97
|
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, formItemId));
|
|
58
98
|
const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[formItemId]);
|
|
59
99
|
const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
|
|
60
100
|
const formEnabled = (0, FormContext_1.useFormContextPart)((value) => value.enabled);
|
|
61
101
|
const isEnabled = enabled && formEnabled;
|
|
62
102
|
(0, react_1.useEffect)(() => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, [
|
|
103
|
+
if (initialValue !== undefined) {
|
|
104
|
+
dispatch((0, formActions_1.fieldInitialized)(formItemId, initialValue));
|
|
105
|
+
}
|
|
106
|
+
}, [dispatch, formItemId, initialValue]);
|
|
67
107
|
(0, Validations_1.useValidation)(validations, onValidate, value, dispatch, formItemId, customValidationsDebounce);
|
|
68
108
|
const onStateChange = (0, react_1.useCallback)(({ value }, options) => {
|
|
69
109
|
//we already handled the initial value in the useEffect with fieldInitialized(...);
|
|
@@ -143,6 +183,10 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
143
183
|
formControl = ((0, jsx_runtime_1.jsx)(ColorPickerNative_1.ColorPicker, Object.assign({}, rest, { value: value, updateState: onStateChange, registerComponentApi: registerComponentApi, enabled: isEnabled, validationStatus: validationStatus })));
|
|
144
184
|
break;
|
|
145
185
|
}
|
|
186
|
+
case "items": {
|
|
187
|
+
formControl = ((0, jsx_runtime_1.jsx)(ArrayLikeFormItem, { formItemId: formItemId, registerComponentApi: registerComponentApi, updateState: onStateChange, value: value, children: (0, jsx_runtime_1.jsx)(ItemsNative_1.Items, { items: value, renderItem: inputRenderer }) }));
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
146
190
|
case "custom": {
|
|
147
191
|
formControl = children;
|
|
148
192
|
break;
|
|
@@ -164,6 +208,9 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
164
208
|
(validationResult === null || validationResult === void 0 ? void 0 : validationResult.validations.map((singleValidation, i) => ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [singleValidation.isValid && !!singleValidation.validMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.validMessage, status: "valid", style: { opacity: singleValidation.stale ? 0.5 : undefined } })), !singleValidation.isValid && !!singleValidation.invalidMessage && ((0, jsx_runtime_1.jsx)(HelperText_1.HelperText, { text: singleValidation.invalidMessage, status: singleValidation.severity, style: { opacity: singleValidation.stale ? 0.5 : undefined } }))] }, i)))) }), children: formControl }));
|
|
165
209
|
});
|
|
166
210
|
function CustomFormItem({ renderChild, node, bindTo, }) {
|
|
211
|
+
// IMPORTANT NOTE:
|
|
212
|
+
// why we use useFormContextPart, and not useFormContext?
|
|
213
|
+
// because we want to avoid re-rendering the whole form when the form state changes.
|
|
167
214
|
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, bindTo));
|
|
168
215
|
const validationResult = (0, FormContext_1.useFormContextPart)((value) => value.validationResults[bindTo]);
|
|
169
216
|
const dispatch = (0, FormContext_1.useFormContextPart)((value) => value.dispatch);
|
|
@@ -14,7 +14,7 @@ const numberRegex = /^[0-9]+$/;
|
|
|
14
14
|
exports.ItemWithLabel = (0, react_1.forwardRef)(function ItemWithLabel({ id, labelPosition = "top", style, label, labelBreak = true, labelWidth, enabled = true, required = false, children, validationInProgress = false, shrinkToLabel = false, onFocus, onBlur, labelStyle, validationResult, isInputTemplateUsed = false, }, ref) {
|
|
15
15
|
const generatedId = (0, react_1.useId)();
|
|
16
16
|
const inputId = id || generatedId;
|
|
17
|
-
if (label === undefined) {
|
|
17
|
+
if (label === undefined && !validationResult) {
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)(react_slot_1.Slot, { style: style, id: inputId, ref: ref, children: children }));
|
|
19
19
|
// return cloneElement(children as ReactElement, {
|
|
20
20
|
// ...mergeProps((children as ReactElement).props, {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MoonIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const moon_svg_react_1 = __importDefault(require("./svg/moon.svg?react"));
|
|
9
|
+
const MoonIcon = (props) => ((0, jsx_runtime_1.jsx)(moon_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.MoonIcon = MoonIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StarsIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const stars_svg_react_1 = __importDefault(require("./svg/stars.svg?react"));
|
|
9
|
+
const StarsIcon = (props) => ((0, jsx_runtime_1.jsx)(stars_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.StarsIcon = StarsIcon;
|
|
@@ -79,6 +79,8 @@ const SortDescendingIcon_1 = require("./Icon/SortDescendingIcon");
|
|
|
79
79
|
const NoSortIcon_1 = require("./Icon/NoSortIcon");
|
|
80
80
|
const TrendingLevelIcon_1 = require("./Icon/TrendingLevelIcon");
|
|
81
81
|
const Inspect_1 = require("./Icon/Inspect");
|
|
82
|
+
const MoonIcon_1 = require("./Icon/MoonIcon");
|
|
83
|
+
const StarsIcon_1 = require("./Icon/StarsIcon");
|
|
82
84
|
const pool = new Map();
|
|
83
85
|
function registerIconRenderer(name, renderer) {
|
|
84
86
|
if (typeof name === "object") {
|
|
@@ -194,7 +196,8 @@ registerIconRenderer("duplicate", (props) => (0, jsx_runtime_1.jsx)(hi_1.HiOutli
|
|
|
194
196
|
registerIconRenderer("connect", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxLightningBolt, Object.assign({}, props)));
|
|
195
197
|
registerIconRenderer("cog", (props) => (0, jsx_runtime_1.jsx)(hi_1.HiOutlineCog, Object.assign({}, props)));
|
|
196
198
|
registerIconRenderer("sun", (props) => (0, jsx_runtime_1.jsx)(hi2_1.HiSun, Object.assign({}, props)));
|
|
197
|
-
registerIconRenderer("moon", (props) => (0, jsx_runtime_1.jsx)(
|
|
199
|
+
registerIconRenderer("moon", (props) => (0, jsx_runtime_1.jsx)(MoonIcon_1.MoonIcon, Object.assign({}, props)));
|
|
200
|
+
registerIconRenderer("stars", (props) => (0, jsx_runtime_1.jsx)(StarsIcon_1.StarsIcon, Object.assign({}, props)));
|
|
198
201
|
registerIconRenderer("share", (props) => (0, jsx_runtime_1.jsx)(ShareIcon_1.ShareIcon, Object.assign({}, props)));
|
|
199
202
|
registerIconRenderer("new-window", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, Object.assign({}, props)));
|
|
200
203
|
registerIconRenderer("paint", (props) => (0, jsx_runtime_1.jsx)(hi2_1.HiOutlinePaintBrush, Object.assign({}, props)));
|