xmlui 0.9.58 → 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-uyd3MlHU.mjs → apiInterceptorWorker-BYU_Trhx.mjs} +1 -1
- package/dist/lib/{index-BqBDeBdn.mjs → index-JqY6G28u.mjs} +10990 -10720
- 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/{server-common-CN44QquQ.mjs → server-common-DGglaqCL.mjs} +4519 -4476
- package/dist/lib/xmlui.d.ts +42 -4
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{apiInterceptorWorker-B4dqtAX9.mjs → apiInterceptorWorker-CqXRCP46.mjs} +1 -1
- package/dist/metadata/{collectedComponentMetadata-DFcuGgT_.mjs → collectedComponentMetadata-BA6d7xt-.mjs} +11900 -11632
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +115 -115
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/App/App.js +5 -1
- package/dist/scripts/src/components/App/AppNative.js +11 -1
- package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +1 -1
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +4 -1
- package/dist/scripts/src/components/Footer/Footer.js +1 -0
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- 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/NavGroup/NavGroupContext.js +1 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +6 -2
- package/dist/scripts/src/components/NavLink/NavLinkNative.js +10 -9
- package/dist/scripts/src/components/NavPanel/NavPanel.js +3 -2
- 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 +11 -5
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +7 -4
- package/dist/scripts/src/components/Pages/Pages.js +4 -4
- package/dist/scripts/src/components/Pages/PagesNative.js +8 -3
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +12 -11
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +13 -28
- package/dist/scripts/src/components/Select/Select.js +2 -1
- package/dist/scripts/src/components/Switch/Switch.js +6 -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/TextBox/TextBox.js +1 -1
- package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +2 -0
- package/dist/scripts/src/components-core/Fragment.js +3 -0
- package/dist/scripts/src/components-core/appContext/date-functions.js +1 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +2 -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/themes/root.js +3 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +60 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +42 -4
- package/dist/standalone/xmlui-standalone.umd.js +231 -231
- package/package.json +1 -1
|
@@ -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,14 +58,20 @@ 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
77
|
exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue, layoutCss }) => {
|
|
@@ -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, style }) {
|
|
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;
|
|
@@ -148,7 +151,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
148
151
|
Object.keys(theme.themeStyles).forEach((key) => {
|
|
149
152
|
themeVarReset[key] = "initial";
|
|
150
153
|
});
|
|
151
|
-
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, { 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: {
|
|
152
155
|
compoundComponents,
|
|
153
156
|
themes: config === null || config === void 0 ? void 0 : config.themes,
|
|
154
157
|
}, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }, `app-${nestedAppId}-${refreshVersion}`) }) }));
|
|
@@ -30,12 +30,12 @@ exports.PagesMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
30
30
|
description: "`Pages` serves as the routing coordinator within an [App](/components/App), " +
|
|
31
31
|
"managing which [Page](/components/Page) displays based on the current URL.",
|
|
32
32
|
props: {
|
|
33
|
-
|
|
34
|
-
description: `The
|
|
35
|
-
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,
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
});
|
|
39
39
|
exports.pagesRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.PagesMd, ({ node, extractValue, renderChild }) => {
|
|
40
|
-
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 }));
|
|
41
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
|
}
|
|
@@ -41,20 +41,21 @@ exports.RadioGroupMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
41
41
|
defaultThemeVars: {
|
|
42
42
|
[`gap-${RGOption}`]: "$space-1_5",
|
|
43
43
|
[`borderWidth-${RGOption}`]: "1px",
|
|
44
|
-
[`
|
|
45
|
-
[`backgroundColor-checked-${RGOption}--disabled]`]: `$borderColor-${RGOption}--disabled`,
|
|
46
|
-
[`backgroundColor-checked-${RGOption}-error`]: `$borderColor-${RGOption}-error`,
|
|
47
|
-
[`backgroundColor-checked-${RGOption}-warning`]: `$borderColor-${RGOption}-warning`,
|
|
48
|
-
[`backgroundColor-checked-${RGOption}-success`]: `$borderColor-${RGOption}-success`,
|
|
49
|
-
[`fontSize-${RGOption}`]: "$fontSize-small",
|
|
50
|
-
[`fontWeight-${RGOption}`]: "$fontWeight-bold",
|
|
51
|
-
[`textColor-${RGOption}-error`]: `$borderColor-${RGOption}-error`,
|
|
52
|
-
[`textColor-${RGOption}-warning`]: `$borderColor-${RGOption}-warning`,
|
|
53
|
-
[`textColor-${RGOption}-success`]: `$borderColor-${RGOption}-success`,
|
|
54
|
-
[`backgroundColor-checked-${RGOption}-default`]: "$color-primary-500",
|
|
44
|
+
[`borderWidth-${RGOption}-validation`]: `2px`,
|
|
55
45
|
[`borderColor-${RGOption}-default`]: "$color-surface-500",
|
|
46
|
+
[`borderColor-checked-${RGOption}`]: "$color-primary-500",
|
|
56
47
|
[`borderColor-${RGOption}-default--hover`]: "$color-surface-700",
|
|
57
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",
|
|
58
59
|
},
|
|
59
60
|
});
|
|
60
61
|
exports.radioGroupRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.RadioGroupMd, ({ node, extractValue, layoutCss, state, updateState, lookupEventHandler, renderChild, registerComponentApi, }) => {
|
|
@@ -37,7 +37,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.RadioGroupOption = exports.RadioGroup = exports.defaultProps = void 0;
|
|
40
|
-
exports.useRadioGroupValue = useRadioGroupValue;
|
|
41
40
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
42
41
|
const react_1 = __importStar(require("react"));
|
|
43
42
|
const InnerRadioGroup = __importStar(require("@radix-ui/react-radio-group"));
|
|
@@ -54,8 +53,9 @@ exports.defaultProps = {
|
|
|
54
53
|
validationStatus: "none",
|
|
55
54
|
required: false,
|
|
56
55
|
};
|
|
57
|
-
const
|
|
56
|
+
const RadioGroupStatusContext = (0, react_1.createContext)({
|
|
58
57
|
status: "none",
|
|
58
|
+
enabled: exports.defaultProps.enabled,
|
|
59
59
|
});
|
|
60
60
|
exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup({ id, value = exports.defaultProps.value, initialValue = exports.defaultProps.initialValue, enabled = exports.defaultProps.enabled, validationStatus = exports.defaultProps.validationStatus, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, updateState = constants_1.noop, onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, children, registerComponentApi, style, }, forwardedRef) {
|
|
61
61
|
const [focused, setFocused] = react_1.default.useState(false);
|
|
@@ -90,40 +90,25 @@ exports.RadioGroup = (0, react_1.forwardRef)(function RadioGroup({ id, value = e
|
|
|
90
90
|
});
|
|
91
91
|
}, [/* focus, */ registerComponentApi, setValue]);
|
|
92
92
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
93
|
-
return { value, status: validationStatus };
|
|
94
|
-
}, [value, validationStatus]);
|
|
95
|
-
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: exports.RadioGroupOption, children: (0, jsx_runtime_1.jsx)(
|
|
93
|
+
return { value, status: validationStatus, enabled };
|
|
94
|
+
}, [value, validationStatus, enabled]);
|
|
95
|
+
return ((0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: exports.RadioGroupOption, children: (0, jsx_runtime_1.jsx)(RadioGroupStatusContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Root, { id: id, onBlur: handleOnBlur, onFocus: handleOnFocus, onValueChange: onInputChange, value: value, disabled: !enabled, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioGroupContainer, {
|
|
96
96
|
[RadioGroup_module_scss_1.default.focused]: focused,
|
|
97
97
|
[RadioGroup_module_scss_1.default.disabled]: !enabled,
|
|
98
98
|
}), children: children }) }) }) }));
|
|
99
99
|
});
|
|
100
|
-
function useRadioGroupValue() {
|
|
101
|
-
const context = (0, react_1.useContext)(RadioGroupValidationStatusContext);
|
|
102
|
-
if (!context) {
|
|
103
|
-
throw new Error("useRadioGroupValue must be used within a RadioGroup");
|
|
104
|
-
}
|
|
105
|
-
const { value } = context;
|
|
106
|
-
const isChecked = (0, react_1.useCallback)((optionValue) => value === optionValue, [value]);
|
|
107
|
-
return {
|
|
108
|
-
value,
|
|
109
|
-
isChecked,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
100
|
const RadioGroupOption = ({ value, label, enabled = true, optionRenderer, style, }) => {
|
|
113
101
|
const id = (0, react_1.useId)();
|
|
114
|
-
const
|
|
115
|
-
const { isChecked } = useRadioGroupValue();
|
|
102
|
+
const radioGroupContext = (0, react_1.useContext)(RadioGroupStatusContext);
|
|
116
103
|
const statusStyles = (0, react_1.useMemo)(() => ({
|
|
117
|
-
[RadioGroup_module_scss_1.default.disabled]: !enabled,
|
|
118
|
-
[RadioGroup_module_scss_1.default.error]: value ===
|
|
119
|
-
[RadioGroup_module_scss_1.default.warning]: value ===
|
|
120
|
-
[RadioGroup_module_scss_1.default.valid]: value ===
|
|
121
|
-
}), [enabled,
|
|
122
|
-
const item = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles, {
|
|
123
|
-
[RadioGroup_module_scss_1.default.checked]: isChecked(value),
|
|
124
|
-
}), value: value, disabled: !enabled, id: id, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.label, statusStyles), children: label !== null && label !== void 0 ? label : value })] })), [enabled, id, label, statusStyles, value]);
|
|
104
|
+
[RadioGroup_module_scss_1.default.disabled]: radioGroupContext.enabled === false ? true : !enabled,
|
|
105
|
+
[RadioGroup_module_scss_1.default.error]: value === radioGroupContext.value && radioGroupContext.status === "error",
|
|
106
|
+
[RadioGroup_module_scss_1.default.warning]: value === radioGroupContext.value && radioGroupContext.status === "warning",
|
|
107
|
+
[RadioGroup_module_scss_1.default.valid]: value === radioGroupContext.value && radioGroupContext.status === "valid",
|
|
108
|
+
}), [enabled, radioGroupContext, value]);
|
|
109
|
+
const item = (0, react_1.useMemo)(() => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(InnerRadioGroup.Item, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.radioOption, statusStyles), value: value, disabled: !enabled, id: id, children: (0, jsx_runtime_1.jsx)(InnerRadioGroup.Indicator, { className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.indicator, statusStyles) }) }), (0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: (0, classnames_1.default)(RadioGroup_module_scss_1.default.label, statusStyles), children: label !== null && label !== void 0 ? label : value })] })), [enabled, id, label, statusStyles, value]);
|
|
125
110
|
return ((0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.radioOptionContainer, style: style, children: optionRenderer ? ((0, jsx_runtime_1.jsxs)("label", { className: RadioGroup_module_scss_1.default.optionLabel, children: [(0, jsx_runtime_1.jsx)("div", { className: RadioGroup_module_scss_1.default.itemContainer, children: item }), optionRenderer({
|
|
126
|
-
$checked: value ===
|
|
111
|
+
$checked: value === radioGroupContext.value,
|
|
127
112
|
})] })) : (item) }, id));
|
|
128
113
|
};
|
|
129
114
|
exports.RadioGroupOption = RadioGroupOption;
|
|
@@ -75,7 +75,6 @@ exports.SelectMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
75
75
|
[`borderRadius-menu-${COMP}`]: "$borderRadius",
|
|
76
76
|
[`borderWidth-menu-${COMP}`]: "1px",
|
|
77
77
|
[`borderColor-menu-${COMP}`]: "$borderColor",
|
|
78
|
-
[`minHeight-Input`]: "39px",
|
|
79
78
|
[`backgroundColor-${COMP}-badge`]: "$color-primary-500",
|
|
80
79
|
[`fontSize-${COMP}-badge`]: "$fontSize-small",
|
|
81
80
|
[`paddingHorizontal-${COMP}-badge`]: "$space-1",
|
|
@@ -91,6 +90,8 @@ exports.SelectMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
91
90
|
[`backgroundColor-item-${COMP}`]: "$backgroundColor-dropdown-item",
|
|
92
91
|
[`backgroundColor-item-${COMP}--hover`]: "$backgroundColor-dropdown-item--hover",
|
|
93
92
|
[`backgroundColor-item-${COMP}--active`]: "$backgroundColor-dropdown-item--active",
|
|
93
|
+
// Default borderColor-Input--disabled is too light so the disabled component is barely visible
|
|
94
|
+
[`borderColor-${COMP}--disabled`]: "initial",
|
|
94
95
|
},
|
|
95
96
|
});
|
|
96
97
|
exports.selectComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SelectMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, layoutCss, registerComponentApi, }) => {
|
|
@@ -47,14 +47,18 @@ exports.SwitchMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
47
47
|
[`backgroundColor-checked-${COMP}-warning`]: `$borderColor-${COMP}-warning`,
|
|
48
48
|
[`borderColor-checked-${COMP}-success`]: `$borderColor-${COMP}-success`,
|
|
49
49
|
[`backgroundColor-checked-${COMP}-success`]: `$borderColor-${COMP}-success`,
|
|
50
|
-
[`backgroundColor-${COMP}`]: "$
|
|
50
|
+
[`backgroundColor-${COMP}`]: "$color-surface-0",
|
|
51
51
|
[`borderColor-${COMP}`]: "$color-surface-200",
|
|
52
52
|
[`borderWidth-${COMP}`]: "1px",
|
|
53
|
-
[`backgroundColor-indicator-${COMP}`]: "$color-surface-
|
|
53
|
+
[`backgroundColor-indicator-${COMP}`]: "$color-surface-400",
|
|
54
|
+
[`backgroundColor-${COMP}-indicator--disabled`]: "$backgroundColor-primary",
|
|
54
55
|
[`backgroundColor-indicator-checked-${COMP}`]: "$backgroundColor-primary",
|
|
55
56
|
[`borderColor-checked-${COMP}`]: "$color-primary-500",
|
|
56
57
|
[`backgroundColor-checked-${COMP}`]: "$color-primary-500",
|
|
57
58
|
[`backgroundColor-${COMP}--disabled`]: "$color-surface-200",
|
|
59
|
+
dark: {
|
|
60
|
+
[`backgroundColor-indicator-${COMP}`]: "$color-surface-500",
|
|
61
|
+
}
|
|
58
62
|
},
|
|
59
63
|
});
|
|
60
64
|
exports.switchComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SwitchMd, ({ node, extractValue, layoutCss, updateState, state, lookupEventHandler, registerComponentApi, }) => {
|
|
@@ -106,6 +106,7 @@ exports.Table = (0, react_1.forwardRef)(({ data = exports.defaultProps.data, col
|
|
|
106
106
|
visibleItems,
|
|
107
107
|
rowsSelectable,
|
|
108
108
|
enableMultiRowSelection,
|
|
109
|
+
rowDisabledPredicate,
|
|
109
110
|
onSelectionDidChange,
|
|
110
111
|
});
|
|
111
112
|
// --- Create data with order information whenever the items in the table change
|
|
@@ -221,8 +222,11 @@ exports.Table = (0, react_1.forwardRef)(({ data = exports.defaultProps.data, col
|
|
|
221
222
|
}),
|
|
222
223
|
value: table.getIsAllRowsSelected(),
|
|
223
224
|
indeterminate: table.getIsSomeRowsSelected(),
|
|
224
|
-
onDidChange: (
|
|
225
|
-
|
|
225
|
+
onDidChange: () => {
|
|
226
|
+
const allSelected = table
|
|
227
|
+
.getRowModel()
|
|
228
|
+
.rows.every((row) => rowDisabledPredicate(row.original) || row.getIsSelected());
|
|
229
|
+
checkAllRows(!allSelected);
|
|
226
230
|
} })) : null,
|
|
227
231
|
cell: ({ row }) => ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { className: Table_module_scss_1.default.checkBoxWrapper,
|
|
228
232
|
value: row.getIsSelected(),
|
|
@@ -7,7 +7,7 @@ const misc_1 = require("../../components-core/utils/misc");
|
|
|
7
7
|
const constants_1 = require("../../components-core/constants");
|
|
8
8
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
9
9
|
const SelectionStoreNative_1 = require("../SelectionStore/SelectionStoreNative");
|
|
10
|
-
function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items, rowsSelectable, enableMultiRowSelection, onSelectionDidChange, }) {
|
|
10
|
+
function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items, rowsSelectable, enableMultiRowSelection, rowDisabledPredicate, onSelectionDidChange, }) {
|
|
11
11
|
// --- The focused index in the row source (if there is any)
|
|
12
12
|
const [focusedIndex, setFocusedIndex] = (0, react_1.useState)(-1);
|
|
13
13
|
// --- The current selection interval
|
|
@@ -187,7 +187,11 @@ function useRowSelection({ items = constants_1.EMPTY_ARRAY, visibleItems = items
|
|
|
187
187
|
if (!enableMultiRowSelection && checked) {
|
|
188
188
|
return;
|
|
189
189
|
}
|
|
190
|
-
setSelectedRowIds(checked
|
|
190
|
+
setSelectedRowIds(checked
|
|
191
|
+
? items
|
|
192
|
+
.filter((item) => (rowDisabledPredicate ? !rowDisabledPredicate(item) : true))
|
|
193
|
+
.map((item) => item[idKey])
|
|
194
|
+
: []);
|
|
191
195
|
});
|
|
192
196
|
/**
|
|
193
197
|
* This operation creates a hash object that indicates the selected status of selected row IDs
|
|
@@ -64,7 +64,7 @@ exports.TextBoxMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
64
64
|
"borderColor-Input-error": "$borderColor-Input-default--error",
|
|
65
65
|
"borderColor-Input-warning": "$borderColor-Input-default--warning",
|
|
66
66
|
"borderColor-Input-success": "$borderColor-Input-default--success",
|
|
67
|
-
"
|
|
67
|
+
"textColor-placeholder-Input": "$textColor-subtitle",
|
|
68
68
|
"color-adornment-Input": "$textColor-subtitle",
|
|
69
69
|
"outlineColor-Input--focus": "$outlineColor--focus",
|
|
70
70
|
"outlineWidth-Input--focus": "$outlineWidth--focus",
|
|
@@ -40,6 +40,8 @@ exports.TreeDisplayMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
40
40
|
[`fontFamily-${COMP}`]: "$fontFamily-monospace",
|
|
41
41
|
[`color-${COMP}`]: "$textColor-primary",
|
|
42
42
|
[`color-connect-${COMP}`]: "$color-surface-200",
|
|
43
|
+
[`boxShadow-${COMP}`]: "none",
|
|
44
|
+
[`border-${COMP}`]: "0.5px solid $borderColor",
|
|
43
45
|
},
|
|
44
46
|
});
|
|
45
47
|
exports.treeDisplayComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TreeDisplayMd, ({ node, extractValue, renderChild, layoutCss }) => {
|
|
@@ -10,6 +10,9 @@ exports.FragmentMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
10
10
|
description: "`Fragment` provides conditional rendering. You can use `when=` on any " +
|
|
11
11
|
"component to render it conditionally, use `Fragment` to apply `when` to a group of components.",
|
|
12
12
|
opaque: true,
|
|
13
|
+
props: {
|
|
14
|
+
// Note: 'when' is a universal property defined in ComponentDefCore, no need to redefine it here
|
|
15
|
+
},
|
|
13
16
|
});
|
|
14
17
|
exports.fragmentComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FragmentMd, ({ node, extractValue, renderChild, layoutContext }) => {
|
|
15
18
|
return ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: renderChild(node.children, layoutContext) }, extractValue(node.uid)));
|
|
@@ -48,7 +48,7 @@ const react_1 = require("react");
|
|
|
48
48
|
const misc_1 = require("../utils/misc");
|
|
49
49
|
const useApiInterceptorContext_1 = require("./useApiInterceptorContext");
|
|
50
50
|
// This React component injects the API interceptor into the application's context
|
|
51
|
-
function ApiInterceptorProvider({ interceptor, children, apiWorker, useHashBasedRouting, }) {
|
|
51
|
+
function ApiInterceptorProvider({ interceptor, children, apiWorker, useHashBasedRouting, waitForApiInterceptor = false }) {
|
|
52
52
|
const [initialized, setInitialized] = (0, react_1.useState)(!interceptor);
|
|
53
53
|
const [interceptorWorker, setInterceptorWorker] = (0, react_1.useState)(null);
|
|
54
54
|
// --- Whenever the interceptor changes, update the provider accordingly
|
|
@@ -94,5 +94,5 @@ function ApiInterceptorProvider({ interceptor, children, apiWorker, useHashBased
|
|
|
94
94
|
isMocked: (url) => interceptor !== undefined && !!process.env.VITE_MOCK_ENABLED,
|
|
95
95
|
};
|
|
96
96
|
}, [interceptorWorker, initialized, interceptor]);
|
|
97
|
-
return ((0, jsx_runtime_1.jsx)(useApiInterceptorContext_1.ApiInterceptorContext.Provider, { value: contextValue, children: children }));
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(useApiInterceptorContext_1.ApiInterceptorContext.Provider, { value: contextValue, children: waitForApiInterceptor && !initialized ? null : children }));
|
|
98
98
|
}
|
|
@@ -27,7 +27,7 @@ exports.queryClient = new react_query_1.QueryClient({
|
|
|
27
27
|
* from either code-behind files or inlined markup expressions) and executes
|
|
28
28
|
* the app accordingly.
|
|
29
29
|
*/
|
|
30
|
-
function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, children, projectCompilation, }) {
|
|
30
|
+
function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTestId, debugEnabled, defaultTheme, defaultTone, resources, globalProps, standalone, trackContainerHeight, routerBaseName, previewMode, resourceMap, sources, extensionManager, children, projectCompilation, isNested = false, }) {
|
|
31
31
|
// --- Make sure, the root node is wrapped in a `Theme` component. Also,
|
|
32
32
|
// --- the root node must be wrapped in a `Container` component managing
|
|
33
33
|
// --- the app's top-level state.
|
|
@@ -54,9 +54,11 @@ function AppRoot({ apiInterceptor, contributes, node, decorateComponentsWithTest
|
|
|
54
54
|
}
|
|
55
55
|
// --- Start with an error-free state
|
|
56
56
|
(0, reportEngineError_1.resetErrors)();
|
|
57
|
+
// --- Add isNested to global props so it can be accessed throughout the app
|
|
58
|
+
const enhancedGlobalProps = (0, react_1.useMemo)(() => (Object.assign(Object.assign({}, globalProps), { isNested })), [globalProps, isNested]);
|
|
57
59
|
// --- Render the app providing a component registry (in which the engine finds a
|
|
58
60
|
// --- component definition by its name). Ensure the app has a context for debugging.
|
|
59
|
-
return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, extensionManager: extensionManager, children: (0, jsx_runtime_1.jsx)(DebugViewProvider_1.DebugViewProvider, { debugConfig: globalProps === null || globalProps === void 0 ? void 0 : globalProps.debug, children: (0, jsx_runtime_1.jsx)(AppWrapper_1.AppWrapper, { projectCompilation: projectCompilation, resourceMap: resourceMap, apiInterceptor: apiInterceptor, node: rootNode, contributes: contributes, resources: resources, routerBaseName: routerBaseName, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, defaultTheme: defaultTheme, defaultTone: defaultTone, globalProps:
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(ComponentProvider_1.ComponentProvider, { contributes: contributes, extensionManager: extensionManager, children: (0, jsx_runtime_1.jsx)(DebugViewProvider_1.DebugViewProvider, { debugConfig: globalProps === null || globalProps === void 0 ? void 0 : globalProps.debug, children: (0, jsx_runtime_1.jsx)(AppWrapper_1.AppWrapper, { projectCompilation: projectCompilation, resourceMap: resourceMap, apiInterceptor: apiInterceptor, node: rootNode, contributes: contributes, resources: resources, routerBaseName: routerBaseName, decorateComponentsWithTestId: decorateComponentsWithTestId, debugEnabled: debugEnabled, defaultTheme: defaultTheme, defaultTone: defaultTone, globalProps: enhancedGlobalProps, standalone: standalone, trackContainerHeight: trackContainerHeight, previewMode: previewMode, sources: sources, children: children }) }) }));
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
64
|
*
|
|
@@ -37,6 +37,7 @@ const ParameterParser_1 = require("../script-runner/ParameterParser");
|
|
|
37
37
|
const eval_tree_sync_1 = require("../script-runner/eval-tree-sync");
|
|
38
38
|
const extractParam_1 = require("../utils/extractParam");
|
|
39
39
|
const misc_1 = require("../utils/misc");
|
|
40
|
+
const AppLayoutContext_1 = require("../../components/App/AppLayoutContext");
|
|
40
41
|
// A React component that wraps a view container into an error boundary
|
|
41
42
|
// (it's a named function inside the memo, this way it will be visible with that name in the react devtools)
|
|
42
43
|
exports.StateContainer = (0, react_1.memo)((0, react_1.forwardRef)(function StateContainer(_a, ref) {
|
|
@@ -145,6 +146,8 @@ exports.StateContainer = (0, react_1.memo)((0, react_1.forwardRef)(function Stat
|
|
|
145
146
|
const useRoutingParams = () => {
|
|
146
147
|
const [queryParams] = (0, react_2.useSearchParams)();
|
|
147
148
|
const routeParams = (0, react_2.useParams)();
|
|
149
|
+
const location = (0, react_2.useLocation)();
|
|
150
|
+
const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
148
151
|
const queryParamsMap = (0, react_1.useMemo)(() => {
|
|
149
152
|
const result = {};
|
|
150
153
|
for (const [key, value] of Array.from(queryParams.entries())) {
|
|
@@ -153,9 +156,12 @@ const useRoutingParams = () => {
|
|
|
153
156
|
return result;
|
|
154
157
|
}, [queryParams]);
|
|
155
158
|
return (0, react_1.useMemo)(() => {
|
|
159
|
+
var _a;
|
|
156
160
|
return {
|
|
161
|
+
$pathname: location.pathname,
|
|
157
162
|
$routeParams: routeParams,
|
|
158
163
|
$queryParams: queryParamsMap,
|
|
164
|
+
$linkInfo: ((_a = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.linkMap) === null || _a === void 0 ? void 0 : _a.get(location.pathname)) || {},
|
|
159
165
|
};
|
|
160
166
|
}, [queryParamsMap, routeParams]);
|
|
161
167
|
};
|
|
@@ -208,6 +208,9 @@ exports.RootThemeDefinition = {
|
|
|
208
208
|
"textColor-secondary": $colorSurface600,
|
|
209
209
|
// --- Input is an abstract component, so we define its default theme variables here
|
|
210
210
|
"backgroundColor-Input-default": $colorSurface0,
|
|
211
|
+
"backgroundColor-Input-success": $colorSurface0,
|
|
212
|
+
"backgroundColor-Input-warning": $colorSurface0,
|
|
213
|
+
"backgroundColor-Input-error": $colorSurface0,
|
|
211
214
|
"borderColor-Input-default": $colorSurface200,
|
|
212
215
|
"borderColor-Input-default--hover": $colorSurface600,
|
|
213
216
|
"borderColor-Input-default--focus": $colorSurface600,
|
|
@@ -13,6 +13,7 @@ exports.smartFormatDate = smartFormatDate;
|
|
|
13
13
|
exports.isDateToday = isDateToday;
|
|
14
14
|
exports.isDateYesterday = isDateYesterday;
|
|
15
15
|
exports.isDateTomorrow = isDateTomorrow;
|
|
16
|
+
exports.formatHumanElapsedTime = formatHumanElapsedTime;
|
|
16
17
|
const date_fns_1 = require("date-fns");
|
|
17
18
|
const misc_1 = require("../utils/misc");
|
|
18
19
|
function isoDateString(date) {
|
|
@@ -76,3 +77,62 @@ function isDateYesterday(date) {
|
|
|
76
77
|
function isDateTomorrow(date) {
|
|
77
78
|
return (0, date_fns_1.isTomorrow)(new Date(date));
|
|
78
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* Formats a date into a human-readable elapsed time string.
|
|
82
|
+
* Returns strings like "now", "12 seconds ago", "3 hours ago", "today", "yesterday", "3 weeks ago", etc.
|
|
83
|
+
*
|
|
84
|
+
* @param date The date to format
|
|
85
|
+
* @returns A human-readable elapsed time string
|
|
86
|
+
*/
|
|
87
|
+
function formatHumanElapsedTime(date) {
|
|
88
|
+
const now = new Date();
|
|
89
|
+
const inputDate = new Date(date);
|
|
90
|
+
// Calculate time difference in milliseconds
|
|
91
|
+
const diffMs = now.getTime() - inputDate.getTime();
|
|
92
|
+
// Handle future dates
|
|
93
|
+
if (diffMs < 0) {
|
|
94
|
+
return formatDate(date);
|
|
95
|
+
}
|
|
96
|
+
// Convert to seconds, minutes, hours, days, weeks
|
|
97
|
+
const diffSeconds = Math.floor(diffMs / 1000);
|
|
98
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
99
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
100
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
101
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
102
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
103
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
104
|
+
// Just now (within 10 seconds)
|
|
105
|
+
if (diffSeconds < 10) {
|
|
106
|
+
return "now";
|
|
107
|
+
}
|
|
108
|
+
// Seconds ago (up to 1 minute)
|
|
109
|
+
if (diffSeconds < 60) {
|
|
110
|
+
return `${diffSeconds} second${diffSeconds === 1 ? "" : "s"} ago`;
|
|
111
|
+
}
|
|
112
|
+
// Minutes ago (up to 1 hour)
|
|
113
|
+
if (diffMinutes < 60) {
|
|
114
|
+
return `${diffMinutes} minute${diffMinutes === 1 ? "" : "s"} ago`;
|
|
115
|
+
}
|
|
116
|
+
// Hours ago (up to today)
|
|
117
|
+
if ((0, date_fns_1.isToday)(inputDate)) {
|
|
118
|
+
return `${diffHours} hour${diffHours === 1 ? "" : "s"} ago`;
|
|
119
|
+
}
|
|
120
|
+
// Yesterday
|
|
121
|
+
if ((0, date_fns_1.isYesterday)(inputDate)) {
|
|
122
|
+
return "yesterday";
|
|
123
|
+
}
|
|
124
|
+
// Days ago (up to 1 week)
|
|
125
|
+
if (diffDays < 7) {
|
|
126
|
+
return `${diffDays} day${diffDays === 1 ? "" : "s"} ago`;
|
|
127
|
+
}
|
|
128
|
+
// Weeks ago (up to 4 weeks / 1 month)
|
|
129
|
+
if (diffWeeks < 4) {
|
|
130
|
+
return `${diffWeeks} week${diffWeeks === 1 ? "" : "s"} ago`;
|
|
131
|
+
}
|
|
132
|
+
// Months ago (up to 12 months / 1 year)
|
|
133
|
+
if (diffMonths < 12) {
|
|
134
|
+
return `${diffMonths} month${diffMonths === 1 ? "" : "s"} ago`;
|
|
135
|
+
}
|
|
136
|
+
// Years ago
|
|
137
|
+
return `${diffYears} year${diffYears === 1 ? "" : "s"} ago`;
|
|
138
|
+
}
|