@wavemaker-ai/react-runtime 1.0.0-rc.322 → 1.0.0-rc.324
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/actions/login-action.js +1 -1
- package/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +16 -14
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/icon/index.js +13 -16
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/label/index.js +5 -3
- package/components/basic/label/props.d.ts +1 -1
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/picture/index.js +3 -2
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-circle/index.d.ts +1 -0
- package/components/basic/richtexteditor/index.d.ts +2 -0
- package/components/basic/search/index.d.ts +6 -0
- package/components/basic/search/index.js +69 -9
- package/components/basic/search/props.d.ts +4 -0
- package/components/basic/spinner/index.d.ts +2 -0
- package/components/basic/spinner/index.js +11 -9
- package/components/basic/spinner/props.d.ts +5 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/video/index.d.ts +1 -0
- package/components/chart/index.d.ts +2 -0
- package/components/chart/props.d.ts +1 -0
- package/components/chart/src/chart.js +12 -1
- package/components/chart/src/types.d.ts +2 -0
- package/components/common/WmAppIcon/index.d.ts +15 -0
- package/components/common/WmAppIcon/index.js +130 -0
- package/components/common/WmAppIcon/props.d.ts +17 -0
- package/components/common/WmAppIcon/props.js +0 -0
- package/components/common/index.d.ts +3 -1
- package/components/common/index.js +10 -2
- package/components/common/wm-skeleton.d.ts +7 -0
- package/components/common/wm-skeleton.js +11 -1
- package/components/container/accordion/accordion-pane/index.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.js +10 -1
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/accordion/index.js +2 -2
- package/components/container/index.d.ts +1 -0
- package/components/container/layout-grid/grid-column/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.d.ts +1 -0
- package/components/container/layout-grid/index.d.ts +1 -0
- package/components/container/linear-layout/index.d.ts +1 -0
- package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
- package/components/container/panel/components/panel-header/index.js +16 -16
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +18 -18
- package/components/container/tabs/props.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.d.ts +2 -0
- package/components/container/tabs/tab-pane/index.js +2 -0
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/components/StepComponents.js +14 -6
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +2 -2
- package/components/container/wizard/props.d.ts +4 -0
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/container/wizard/wizard-step/index.js +6 -0
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/index.d.ts +1 -0
- package/components/data/card/index.js +13 -6
- package/components/data/form/dynamic-fields/index.js +1 -0
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-action/index.js +6 -4
- package/components/data/form/form-field/index.js +5 -4
- package/components/data/form/form-header/index.d.ts +1 -1
- package/components/data/form/form-header/index.js +10 -1
- package/components/data/form/index.js +5 -3
- package/components/data/form/props.d.ts +1 -0
- package/components/data/list/components/ListHeader.js +19 -3
- package/components/data/list/components/ListItemWithTemplate.js +5 -1
- package/components/data/list/components/ListItems.d.ts +1 -1
- package/components/data/list/components/ListItems.js +5 -1
- package/components/data/list/components/LoadMoreButton.js +14 -2
- package/components/data/list/components/StandardListItems.js +1 -1
- package/components/data/list/components/props.d.ts +11 -5
- package/components/data/list/hooks/props.d.ts +2 -2
- package/components/data/list/hooks/useListEventHandlers.js +3 -2
- package/components/data/list/index.d.ts +5 -1
- package/components/data/list/index.js +17 -4
- package/components/data/list/props.d.ts +14 -2
- package/components/data/list/utils/list-helpers.d.ts +5 -1
- package/components/data/list/utils/list-helpers.js +10 -0
- package/components/data/pagination/components/PageSizeSelector.js +49 -155
- package/components/data/pagination/hooks/usePagination.js +24 -1
- package/components/data/table/components/RowCells.js +1 -1
- package/components/data/table/components/TableDataRow.js +16 -3
- package/components/data/table/components/TableHeader.js +1 -1
- package/components/data/table/components/TablePanelHeading.js +14 -2
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useTableColumns.js +2 -2
- package/components/data/table/hooks/useTableData.js +30 -1
- package/components/data/table/index.d.ts +4 -0
- package/components/data/table/index.js +47 -30
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +11 -2
- package/components/data/table/table-action/index.d.ts +1 -0
- package/components/data/table/table-column/index.d.ts +1 -0
- package/components/data/table/table-row/index.d.ts +1 -0
- package/components/data/table/table-row-action/index.d.ts +1 -0
- package/components/data/table/utils/buildSelectionColumns.d.ts +1 -1
- package/components/data/table/utils/buildSelectionColumns.js +97 -71
- package/components/data/table/utils/columnBuilder.d.ts +13 -0
- package/components/data/table/utils/columnBuilder.js +27 -18
- package/components/data/table/utils/columnWidthDistribution.d.ts +1 -1
- package/components/data/table/utils/columnWidthDistribution.js +4 -1
- package/components/data/table/utils/constants.d.ts +1 -1
- package/components/data/table/utils/constants.js +1 -1
- package/components/dialogs/alert-dialog/index.d.ts +2 -0
- package/components/dialogs/confirm-dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.d.ts +2 -0
- package/components/dialogs/dialog-actions/index.d.ts +1 -0
- package/components/dialogs/dialog-body/index.d.ts +1 -0
- package/components/dialogs/dialog-content/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.js +11 -12
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +4 -0
- package/components/dialogs/login-dialog/index.js +2 -1
- package/components/dialogs/login-dialog/props.d.ts +1 -0
- package/components/dialogs/page-dialog/index.d.ts +4 -0
- package/components/dialogs/page-dialog/index.js +2 -1
- package/components/dialogs/page-dialog/props.d.ts +1 -0
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button/index.js +29 -33
- package/components/form/button-group/index.d.ts +1 -0
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +2 -0
- package/components/input/chips/index.js +9 -3
- package/components/input/chips/utils.d.ts +5 -0
- package/components/input/chips/utils.js +29 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +1 -0
- package/components/input/currency/index.d.ts +2 -0
- package/components/input/default/checkbox/index.d.ts +6 -0
- package/components/input/default/checkbox/index.js +48 -18
- package/components/input/default/checkbox/props.d.ts +8 -0
- package/components/input/default/checkboxset/index.d.ts +2 -0
- package/components/input/default/radioset/index.d.ts +2 -0
- package/components/input/default/switch/index.d.ts +6 -0
- package/components/input/default/switch/index.js +36 -9
- package/components/input/default/switch/prop.d.ts +2 -0
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/fileupload/components/ListItems.d.ts +5 -1
- package/components/input/fileupload/components/ListItems.js +27 -5
- package/components/input/fileupload/components/MultiUpload.js +12 -1
- package/components/input/fileupload/components/SingleUpload.js +12 -1
- package/components/input/fileupload/index.d.ts +3 -0
- package/components/input/fileupload/index.js +11 -0
- package/components/input/fileupload/props.d.ts +10 -0
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +6 -0
- package/components/input/rating/index.js +10 -5
- package/components/input/rating/props.d.ts +8 -0
- package/components/input/select/index.d.ts +2 -0
- package/components/input/slider/index.d.ts +6 -0
- package/components/input/slider/index.js +19 -2
- package/components/input/slider/props.d.ts +2 -0
- package/components/input/text/index.d.ts +7 -1
- package/components/input/text/index.js +25 -6
- package/components/input/text/props.d.ts +8 -0
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/textarea/index.js +9 -4
- package/components/input/textarea/util.d.ts +1 -0
- package/components/input/textarea/util.js +17 -0
- package/components/input/upload/index.d.ts +2 -0
- package/components/navbar/index.d.ts +7 -0
- package/components/navbar/index.js +21 -7
- package/components/navbar/nav/index.d.ts +1 -0
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +3 -1
- package/components/navigation/menu/index.js +22 -4
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +1 -0
- package/components/navigation/popover/index.js +8 -2
- package/components/page/partial/index.d.ts +1 -0
- package/core/appstore.d.ts +10 -0
- package/core/appstore.js +9 -1
- package/core/constants/events.d.ts +3 -0
- package/core/constants/events.js +13 -1
- package/core/proxy-service.js +1 -1
- package/core/util/index.d.ts +2 -0
- package/core/util/index.js +29 -0
- package/higherOrder/BasePage.js +81 -26
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.d.ts +21 -0
- package/higherOrder/useActivePageReactivity.js +57 -0
- package/higherOrder/withBaseWrapper.js +2 -0
- package/higherOrder/withRenderLogger.d.ts +15 -0
- package/higherOrder/withRenderLogger.js +53 -0
- package/hooks/useAuth.js +7 -1
- package/package-lock.json +219 -198
- package/package.json +4 -3
- package/runtime-dynamic/factories/dynamic-component.js +18 -5
- package/runtime-dynamic/factories/utils.js +7 -1
- package/runtime-dynamic/services/compile-render.js +2 -1
- package/store/slices/i18nSlice.d.ts +2 -0
- package/store/slices/i18nSlice.js +3 -1
- package/types/index.d.ts +6 -0
- package/utils/attr.js +4 -1
- package/utils/svg-icon.d.ts +27 -0
- package/utils/svg-icon.js +75 -0
|
@@ -24,6 +24,7 @@ import Typography from "@mui/material/Typography";
|
|
|
24
24
|
import CircularProgress from "@mui/material/CircularProgress";
|
|
25
25
|
import clsx from "clsx";
|
|
26
26
|
import { withBaseWrapper } from "../../../higherOrder/withBaseWrapper";
|
|
27
|
+
import { WmAppIcon } from "../../common/WmAppIcon";
|
|
27
28
|
import { VariableEvents } from "./props";
|
|
28
29
|
const WmSpinner = memo(
|
|
29
30
|
(props) => {
|
|
@@ -33,6 +34,7 @@ const WmSpinner = memo(
|
|
|
33
34
|
name,
|
|
34
35
|
type = "icon",
|
|
35
36
|
iconclass = "fa fa-circle-o-notch fa-spin",
|
|
37
|
+
iconurl,
|
|
36
38
|
iconsize,
|
|
37
39
|
imagewidth = "20px",
|
|
38
40
|
imageheight,
|
|
@@ -145,18 +147,17 @@ const WmSpinner = memo(
|
|
|
145
147
|
}
|
|
146
148
|
if (type === "icon") {
|
|
147
149
|
return /* @__PURE__ */ jsx(
|
|
148
|
-
|
|
150
|
+
WmAppIcon,
|
|
149
151
|
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
iconclass,
|
|
153
|
+
iconurl,
|
|
154
|
+
prefabName: props.prefabName,
|
|
155
|
+
defaultClasses: clsx(
|
|
156
|
+
"spinner-image animated infinite ",
|
|
157
|
+
iconsize ? "wm-spinner-icon" : "",
|
|
154
158
|
animation === "spin" ? "fa-spin" : animation
|
|
155
159
|
),
|
|
156
|
-
"
|
|
157
|
-
style: {
|
|
158
|
-
"--wm-spinner-icon-size": iconsize
|
|
159
|
-
}
|
|
160
|
+
iconStyle: iconsize ? { "--wm-spinner-icon-size": iconsize } : void 0
|
|
160
161
|
}
|
|
161
162
|
);
|
|
162
163
|
}
|
|
@@ -198,6 +199,7 @@ const WmSpinner = memo(
|
|
|
198
199
|
"servicevariabletotrack",
|
|
199
200
|
"show",
|
|
200
201
|
"iconclass",
|
|
202
|
+
"iconurl",
|
|
201
203
|
"iconsize",
|
|
202
204
|
"image",
|
|
203
205
|
"imagewidth",
|
|
@@ -38,6 +38,11 @@ export interface SpinnerProps {
|
|
|
38
38
|
* @default "fa fa-circle-o-notch fa-spin"
|
|
39
39
|
*/
|
|
40
40
|
iconclass?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Icon URL for spinner (effective only when type is 'icon').
|
|
43
|
+
* `.svg` URLs render inline; other URLs render as images.
|
|
44
|
+
*/
|
|
45
|
+
iconurl?: string;
|
|
41
46
|
/**
|
|
42
47
|
* The font size for the icon (effective only when type is 'icon').
|
|
43
48
|
*/
|
|
@@ -30,6 +30,7 @@ declare const _default: React.ComponentType<{
|
|
|
30
30
|
yaxislabeldistance?: number;
|
|
31
31
|
yunits?: string;
|
|
32
32
|
iconclass?: string;
|
|
33
|
+
iconurl?: string;
|
|
33
34
|
nodatamessage?: string;
|
|
34
35
|
loadingdatamsg?: string;
|
|
35
36
|
tooltips?: boolean;
|
|
@@ -127,5 +128,6 @@ declare const _default: React.ComponentType<{
|
|
|
127
128
|
prefabName?: string;
|
|
128
129
|
loading?: boolean;
|
|
129
130
|
showSkeleton?: boolean;
|
|
131
|
+
widget?: string;
|
|
130
132
|
}>;
|
|
131
133
|
export default _default;
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
} from "./dataUtils";
|
|
46
46
|
import { AXIS_CHART_DEFAULT_OFFSETS, dateList, PIE_CHART_DEFAULT_OFFSETS } from "./constants";
|
|
47
47
|
import ChartRenderer from "./ChartRenderer";
|
|
48
|
+
import { WmAppIcon } from "../../common/WmAppIcon";
|
|
48
49
|
const WmChart = (props) => {
|
|
49
50
|
var _b, _c;
|
|
50
51
|
const _a = props, {
|
|
@@ -61,6 +62,7 @@ const WmChart = (props) => {
|
|
|
61
62
|
title,
|
|
62
63
|
subheading,
|
|
63
64
|
iconclass,
|
|
65
|
+
iconurl,
|
|
64
66
|
onSelect,
|
|
65
67
|
onTransform,
|
|
66
68
|
onBeforerender,
|
|
@@ -88,6 +90,7 @@ const WmChart = (props) => {
|
|
|
88
90
|
"title",
|
|
89
91
|
"subheading",
|
|
90
92
|
"iconclass",
|
|
93
|
+
"iconurl",
|
|
91
94
|
"onSelect",
|
|
92
95
|
"onTransform",
|
|
93
96
|
"onBeforerender",
|
|
@@ -428,7 +431,15 @@ const WmChart = (props) => {
|
|
|
428
431
|
name: props == null ? void 0 : props.name,
|
|
429
432
|
children: [
|
|
430
433
|
title && /* @__PURE__ */ jsxs("div", { className: "panel-heading", children: [
|
|
431
|
-
iconclass && /* @__PURE__ */ jsx(
|
|
434
|
+
(iconclass || iconurl) && /* @__PURE__ */ jsx(
|
|
435
|
+
WmAppIcon,
|
|
436
|
+
{
|
|
437
|
+
iconclass,
|
|
438
|
+
iconurl,
|
|
439
|
+
prefabName: props.prefabName,
|
|
440
|
+
defaultClasses: "panel-icon"
|
|
441
|
+
}
|
|
442
|
+
),
|
|
432
443
|
/* @__PURE__ */ jsx("span", { className: "chart-title", children: title }),
|
|
433
444
|
subheading && /* @__PURE__ */ jsx("span", { className: "chart-subheading", children: subheading })
|
|
434
445
|
] }),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { WmAppIconProps } from "./props";
|
|
3
|
+
/**
|
|
4
|
+
* Single, reusable renderer for the SVG / image / font 3-way icon branch.
|
|
5
|
+
*
|
|
6
|
+
* Decision order :
|
|
7
|
+
* 1. iconurl ending in `.svg` -> inline SVG via SvgIconInline
|
|
8
|
+
* 2. iconurl (anything else) -> `<img>`
|
|
9
|
+
* 3. iconclass / defaultIconClass -> `<i class="app-icon ...">`
|
|
10
|
+
*
|
|
11
|
+
* The host uses `display: contents` so existing CSS selectors targeting
|
|
12
|
+
* `.app-icon` directly inside the parent keep working.
|
|
13
|
+
*/
|
|
14
|
+
export declare const WmAppIcon: React.MemoExoticComponent<(props: WmAppIconProps) => import("react/jsx-runtime").JSX.Element>;
|
|
15
|
+
export default WmAppIcon;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useEffect, useMemo, useState } from "react";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import {
|
|
5
|
+
fetchSvgIcon,
|
|
6
|
+
getCachedSvgIcon,
|
|
7
|
+
isSvgIconUrl,
|
|
8
|
+
resolveIconUrl
|
|
9
|
+
} from "../../../utils/svg-icon";
|
|
10
|
+
function toExtraClasses(defaultClasses) {
|
|
11
|
+
if (!defaultClasses) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(defaultClasses)) {
|
|
15
|
+
return defaultClasses.filter(Boolean);
|
|
16
|
+
}
|
|
17
|
+
return defaultClasses.split(/\s+/).filter(Boolean);
|
|
18
|
+
}
|
|
19
|
+
function SvgIconInline({
|
|
20
|
+
resolvedUrl,
|
|
21
|
+
className,
|
|
22
|
+
style
|
|
23
|
+
}) {
|
|
24
|
+
const [svgHtml, setSvgHtml] = useState(
|
|
25
|
+
() => {
|
|
26
|
+
var _a;
|
|
27
|
+
return (_a = getCachedSvgIcon(resolvedUrl)) != null ? _a : null;
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const cached = getCachedSvgIcon(resolvedUrl);
|
|
32
|
+
if (cached !== void 0) {
|
|
33
|
+
setSvgHtml(cached);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let cancelled = false;
|
|
37
|
+
fetchSvgIcon(resolvedUrl).then((markup) => {
|
|
38
|
+
if (!cancelled) {
|
|
39
|
+
setSvgHtml(markup);
|
|
40
|
+
}
|
|
41
|
+
}).catch(() => {
|
|
42
|
+
if (!cancelled) {
|
|
43
|
+
setSvgHtml(null);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return () => {
|
|
47
|
+
cancelled = true;
|
|
48
|
+
};
|
|
49
|
+
}, [resolvedUrl]);
|
|
50
|
+
if (!svgHtml) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
"i",
|
|
55
|
+
{
|
|
56
|
+
className,
|
|
57
|
+
role: "img",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
"data-identifier": "svg",
|
|
60
|
+
style,
|
|
61
|
+
dangerouslySetInnerHTML: { __html: svgHtml }
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
const WmAppIcon = memo((props) => {
|
|
66
|
+
const {
|
|
67
|
+
iconclass,
|
|
68
|
+
iconurl,
|
|
69
|
+
defaultIconClass,
|
|
70
|
+
defaultClasses,
|
|
71
|
+
iconStyle,
|
|
72
|
+
alt,
|
|
73
|
+
prefabName
|
|
74
|
+
} = props;
|
|
75
|
+
const extras = useMemo(() => toExtraClasses(defaultClasses), [defaultClasses]);
|
|
76
|
+
const isSvg = isSvgIconUrl(iconurl);
|
|
77
|
+
const isImage = !!iconurl && !isSvg;
|
|
78
|
+
const fontClass = useMemo(
|
|
79
|
+
() => [defaultIconClass, iconclass].filter(Boolean).join(" "),
|
|
80
|
+
[defaultIconClass, iconclass]
|
|
81
|
+
);
|
|
82
|
+
const resolvedImageUrl = useMemo(
|
|
83
|
+
() => isImage ? resolveIconUrl(iconurl, prefabName) : null,
|
|
84
|
+
[isImage, iconurl, prefabName]
|
|
85
|
+
);
|
|
86
|
+
const resolvedSvgUrl = useMemo(
|
|
87
|
+
() => isSvg && iconurl ? resolveIconUrl(iconurl, prefabName) : null,
|
|
88
|
+
[isSvg, iconurl, prefabName]
|
|
89
|
+
);
|
|
90
|
+
if (isSvg && resolvedSvgUrl) {
|
|
91
|
+
return /* @__PURE__ */ jsx("span", { style: { display: "contents" }, children: /* @__PURE__ */ jsx(
|
|
92
|
+
SvgIconInline,
|
|
93
|
+
{
|
|
94
|
+
resolvedUrl: resolvedSvgUrl,
|
|
95
|
+
className: clsx("app-icon", "app-icon-svg", ...extras),
|
|
96
|
+
style: iconStyle || void 0
|
|
97
|
+
},
|
|
98
|
+
resolvedSvgUrl
|
|
99
|
+
) });
|
|
100
|
+
}
|
|
101
|
+
if (isImage && resolvedImageUrl) {
|
|
102
|
+
return /* @__PURE__ */ jsx("span", { style: { display: "contents" }, children: /* @__PURE__ */ jsx(
|
|
103
|
+
"img",
|
|
104
|
+
{
|
|
105
|
+
"data-identifier": "img",
|
|
106
|
+
alt: alt || "",
|
|
107
|
+
src: resolvedImageUrl,
|
|
108
|
+
className: clsx("app-icon", ...extras),
|
|
109
|
+
style: iconStyle || void 0
|
|
110
|
+
}
|
|
111
|
+
) });
|
|
112
|
+
}
|
|
113
|
+
if (fontClass) {
|
|
114
|
+
return /* @__PURE__ */ jsx("span", { style: { display: "contents" }, children: /* @__PURE__ */ jsx(
|
|
115
|
+
"i",
|
|
116
|
+
{
|
|
117
|
+
className: clsx("app-icon", ...extras, ...fontClass.split(/\s+/).filter(Boolean)),
|
|
118
|
+
"aria-hidden": "true",
|
|
119
|
+
style: iconStyle || void 0
|
|
120
|
+
}
|
|
121
|
+
) });
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
});
|
|
125
|
+
WmAppIcon.displayName = "WmAppIcon";
|
|
126
|
+
var WmAppIcon_default = WmAppIcon;
|
|
127
|
+
export {
|
|
128
|
+
WmAppIcon,
|
|
129
|
+
WmAppIcon_default as default
|
|
130
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
export interface WmAppIconProps {
|
|
3
|
+
/** Font-icon CSS class (e.g. `wi wi-user`). Lowest priority when iconurl is set. */
|
|
4
|
+
iconclass?: string | null;
|
|
5
|
+
/** Icon URL. `.svg` -> inline SVG, anything else -> `<img>`. Wins over iconclass. */
|
|
6
|
+
iconurl?: string | null;
|
|
7
|
+
/** Fallback font-icon class when both iconclass and iconurl are empty. */
|
|
8
|
+
defaultIconClass?: string | null;
|
|
9
|
+
/** Extra classes appended to the rendered icon element on every branch. */
|
|
10
|
+
defaultClasses?: string | string[] | null;
|
|
11
|
+
/** Inline styles forwarded to the rendered icon element. */
|
|
12
|
+
iconStyle?: CSSProperties | null;
|
|
13
|
+
/** Alt text for the `<img>` branch. */
|
|
14
|
+
alt?: string | null;
|
|
15
|
+
/** Prefab name for resolving relative `resources/` icon URLs. */
|
|
16
|
+
prefabName?: string;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { AppSpinner } from "./AppSpinner";
|
|
2
|
-
export { WmSkeleton, SKELETON_REGISTRY, shouldShowSkeleton } from "./wm-skeleton";
|
|
2
|
+
export { WmSkeleton, SKELETON_REGISTRY, shouldShowSkeleton, useShouldShowSkeleton, } from "./wm-skeleton";
|
|
3
3
|
export type { WmSkeletonProps, SkeletonConfig } from "./wm-skeleton";
|
|
4
|
+
export { WmAppIcon } from "./WmAppIcon";
|
|
5
|
+
export type { WmAppIconProps } from "./WmAppIcon/props";
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { AppSpinner } from "./AppSpinner";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
WmSkeleton,
|
|
4
|
+
SKELETON_REGISTRY,
|
|
5
|
+
shouldShowSkeleton,
|
|
6
|
+
useShouldShowSkeleton
|
|
7
|
+
} from "./wm-skeleton";
|
|
8
|
+
import { WmAppIcon } from "./WmAppIcon";
|
|
3
9
|
export {
|
|
4
10
|
AppSpinner,
|
|
5
11
|
SKELETON_REGISTRY,
|
|
12
|
+
WmAppIcon,
|
|
6
13
|
WmSkeleton,
|
|
7
|
-
shouldShowSkeleton
|
|
14
|
+
shouldShowSkeleton,
|
|
15
|
+
useShouldShowSkeleton
|
|
8
16
|
};
|
|
@@ -45,6 +45,13 @@ export declare const LAYOUT_DEFAULTS: {
|
|
|
45
45
|
};
|
|
46
46
|
/** Show skeleton while `loading` is true. Opt out only with explicit `showSkeleton={false}`. */
|
|
47
47
|
export declare const shouldShowSkeleton: (loading?: boolean | string, showSkeleton?: boolean) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Hook that returns true only during the initial load.
|
|
50
|
+
* Once loading completes for the first time, always returns false —
|
|
51
|
+
* preventing skeleton from replacing (and unmounting) a stateful component
|
|
52
|
+
* on subsequent data fetches (e.g. pagination, sorting, filtering).
|
|
53
|
+
*/
|
|
54
|
+
export declare const useShouldShowSkeleton: (loading?: boolean | string, showSkeleton?: boolean) => boolean;
|
|
48
55
|
export declare const SKELETON_REGISTRY: {
|
|
49
56
|
WmButton: {
|
|
50
57
|
variant: "rounded";
|
|
@@ -30,6 +30,7 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
return target;
|
|
31
31
|
};
|
|
32
32
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
33
|
+
import { useRef } from "react";
|
|
33
34
|
import Skeleton from "@mui/material/Skeleton";
|
|
34
35
|
import Box from "@mui/material/Box";
|
|
35
36
|
import Stack from "@mui/material/Stack";
|
|
@@ -50,6 +51,14 @@ const shouldShowSkeleton = (loading, showSkeleton) => {
|
|
|
50
51
|
if (showSkeleton === false) return false;
|
|
51
52
|
return Boolean(loading);
|
|
52
53
|
};
|
|
54
|
+
const useShouldShowSkeleton = (loading, showSkeleton) => {
|
|
55
|
+
const hasLoadedOnce = useRef(false);
|
|
56
|
+
if (!loading) {
|
|
57
|
+
hasLoadedOnce.current = true;
|
|
58
|
+
}
|
|
59
|
+
if (hasLoadedOnce.current) return false;
|
|
60
|
+
return shouldShowSkeleton(loading, showSkeleton);
|
|
61
|
+
};
|
|
53
62
|
const SKELETON_REGISTRY = {
|
|
54
63
|
WmButton: { variant: "rounded", height: 36, width: 100 },
|
|
55
64
|
WmLabel: { variant: "text", width: 160 },
|
|
@@ -342,5 +351,6 @@ export {
|
|
|
342
351
|
SKELETON_REGISTRY,
|
|
343
352
|
WmSkeleton,
|
|
344
353
|
wm_skeleton_default as default,
|
|
345
|
-
shouldShowSkeleton
|
|
354
|
+
shouldShowSkeleton,
|
|
355
|
+
useShouldShowSkeleton
|
|
346
356
|
};
|
|
@@ -15,6 +15,7 @@ declare const _default: React.ComponentType<{
|
|
|
15
15
|
title?: string;
|
|
16
16
|
subheading?: string;
|
|
17
17
|
iconclass?: string;
|
|
18
|
+
iconurl?: string;
|
|
18
19
|
badgevalue?: string | number;
|
|
19
20
|
badgetype?: import("./props").AccordionPaneBadgeType;
|
|
20
21
|
isdefaultpane?: boolean;
|
|
@@ -79,5 +80,6 @@ declare const _default: React.ComponentType<{
|
|
|
79
80
|
prefabName?: string;
|
|
80
81
|
loading?: boolean;
|
|
81
82
|
showSkeleton?: boolean;
|
|
83
|
+
widget?: string;
|
|
82
84
|
}>;
|
|
83
85
|
export default _default;
|
|
@@ -16,6 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
16
16
|
};
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
18
|
import clsx from "clsx";
|
|
19
|
+
import { WmAppIcon } from "../../../common/WmAppIcon";
|
|
19
20
|
import { memo, useCallback, useEffect, useRef } from "react";
|
|
20
21
|
import Typography from "@mui/material/Typography";
|
|
21
22
|
import AccordionDetails from "@mui/material/AccordionDetails";
|
|
@@ -77,7 +78,15 @@ const WmAccordionPane = memo((Props) => {
|
|
|
77
78
|
"aria-expanded": props.active,
|
|
78
79
|
component: "div",
|
|
79
80
|
children: /* @__PURE__ */ jsx(Typography, { className: "panel-title", variant: "h3", component: "h3", children: /* @__PURE__ */ jsxs(Typography, { className: "accordion-toggle clearfix", component: "a", children: [
|
|
80
|
-
props.iconclass && /* @__PURE__ */ jsx("div", { className: "pull-left", children: /* @__PURE__ */ jsx(
|
|
81
|
+
(props.iconclass || props.iconurl) && /* @__PURE__ */ jsx("div", { className: "pull-left", children: /* @__PURE__ */ jsx(
|
|
82
|
+
WmAppIcon,
|
|
83
|
+
{
|
|
84
|
+
iconclass: props.iconclass,
|
|
85
|
+
iconurl: props.iconurl,
|
|
86
|
+
prefabName: props.prefabName,
|
|
87
|
+
defaultClasses: "panel-icon"
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
81
90
|
/* @__PURE__ */ jsxs("div", { className: clsx("pull-left", "wm-accordion-pane-title-main"), children: [
|
|
82
91
|
/* @__PURE__ */ jsx(Typography, { className: "heading", variant: "h3", component: "h3", children: props.title }),
|
|
83
92
|
props.subheading && /* @__PURE__ */ jsx(Typography, { className: "description", variant: "body2", component: "div", children: props.subheading })
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
WmSkeleton,
|
|
33
33
|
SKELETON_REGISTRY,
|
|
34
|
-
|
|
34
|
+
useShouldShowSkeleton
|
|
35
35
|
} from "../../common/wm-skeleton";
|
|
36
36
|
const DEFAULT_CLASS = "app-accordion panel-group";
|
|
37
37
|
function isStaticAccordionPane(child) {
|
|
@@ -206,7 +206,7 @@ const WmAccordion = memo(
|
|
|
206
206
|
return child;
|
|
207
207
|
}) : null;
|
|
208
208
|
};
|
|
209
|
-
if (
|
|
209
|
+
if (useShouldShowSkeleton(props.loading, props.showSkeleton)) {
|
|
210
210
|
return /* @__PURE__ */ jsx(
|
|
211
211
|
WmSkeleton,
|
|
212
212
|
__spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmAccordion"]), {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import { Box, IconButton } from "@mui/material";
|
|
4
3
|
import DOMPurify from "dompurify";
|
|
5
4
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
@@ -9,6 +8,7 @@ import FullscreenExitIcon from "@mui/icons-material/FullscreenExit";
|
|
|
9
8
|
import CloseIcon from "@mui/icons-material/Close";
|
|
10
9
|
import HelpOutlineIcon from "@mui/icons-material/HelpOutline";
|
|
11
10
|
import WmMenu from "../../../../navigation/menu";
|
|
11
|
+
import { WmAppIcon } from "../../../../common/WmAppIcon";
|
|
12
12
|
import { toCssLength } from "../../../../../utils/style-utils";
|
|
13
13
|
const PanelHeader = ({
|
|
14
14
|
title = "Title",
|
|
@@ -56,21 +56,21 @@ const PanelHeader = ({
|
|
|
56
56
|
onClick: onToggleExpand,
|
|
57
57
|
"aria-expanded": isExpanded,
|
|
58
58
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
/* @__PURE__ */ jsx(Box, { className: "pull-left", children: /* @__PURE__ */ jsx(
|
|
60
|
+
WmAppIcon,
|
|
61
|
+
{
|
|
62
|
+
iconclass,
|
|
63
|
+
iconurl,
|
|
64
|
+
defaultClasses: iconurl ? "panel-image-icon wm-panel-header-icon-img" : "panel-icon",
|
|
65
|
+
iconStyle: panelIconImgStyle ? {
|
|
66
|
+
width: panelIconImgStyle["--wm-panel-icon-width"],
|
|
67
|
+
height: panelIconImgStyle["--wm-panel-icon-height"],
|
|
68
|
+
margin: panelIconImgStyle["--wm-panel-icon-margin"],
|
|
69
|
+
fontSize: iconwidth ? toCssLength(iconwidth) : void 0
|
|
70
|
+
} : iconwidth ? { fontSize: toCssLength(iconwidth) } : void 0,
|
|
71
|
+
alt: "Panel icon"
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
74
|
/* @__PURE__ */ jsxs(Box, { className: "pull-left", children: [
|
|
75
75
|
title && /* @__PURE__ */ jsx(
|
|
76
76
|
Box,
|