@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.
Files changed (217) hide show
  1. package/actions/login-action.js +1 -1
  2. package/components/advanced/carousel/index.d.ts +1 -0
  3. package/components/advanced/carousel/template.d.ts +1 -0
  4. package/components/advanced/login/index.d.ts +1 -0
  5. package/components/advanced/marquee/index.d.ts +1 -0
  6. package/components/basic/anchor/index.d.ts +1 -0
  7. package/components/basic/anchor/index.js +16 -14
  8. package/components/basic/audio/index.d.ts +1 -0
  9. package/components/basic/html/index.d.ts +1 -0
  10. package/components/basic/icon/index.d.ts +1 -0
  11. package/components/basic/icon/index.js +13 -16
  12. package/components/basic/iframe/index.d.ts +1 -0
  13. package/components/basic/label/index.d.ts +1 -0
  14. package/components/basic/label/index.js +5 -3
  15. package/components/basic/label/props.d.ts +1 -1
  16. package/components/basic/picture/index.d.ts +1 -0
  17. package/components/basic/picture/index.js +3 -2
  18. package/components/basic/progress-bar/index.d.ts +1 -0
  19. package/components/basic/progress-circle/index.d.ts +1 -0
  20. package/components/basic/richtexteditor/index.d.ts +2 -0
  21. package/components/basic/search/index.d.ts +6 -0
  22. package/components/basic/search/index.js +69 -9
  23. package/components/basic/search/props.d.ts +4 -0
  24. package/components/basic/spinner/index.d.ts +2 -0
  25. package/components/basic/spinner/index.js +11 -9
  26. package/components/basic/spinner/props.d.ts +5 -0
  27. package/components/basic/tile/index.d.ts +1 -0
  28. package/components/basic/tree/index.d.ts +1 -0
  29. package/components/basic/video/index.d.ts +1 -0
  30. package/components/chart/index.d.ts +2 -0
  31. package/components/chart/props.d.ts +1 -0
  32. package/components/chart/src/chart.js +12 -1
  33. package/components/chart/src/types.d.ts +2 -0
  34. package/components/common/WmAppIcon/index.d.ts +15 -0
  35. package/components/common/WmAppIcon/index.js +130 -0
  36. package/components/common/WmAppIcon/props.d.ts +17 -0
  37. package/components/common/WmAppIcon/props.js +0 -0
  38. package/components/common/index.d.ts +3 -1
  39. package/components/common/index.js +10 -2
  40. package/components/common/wm-skeleton.d.ts +7 -0
  41. package/components/common/wm-skeleton.js +11 -1
  42. package/components/container/accordion/accordion-pane/index.d.ts +2 -0
  43. package/components/container/accordion/accordion-pane/index.js +10 -1
  44. package/components/container/accordion/accordion-pane/props.d.ts +1 -0
  45. package/components/container/accordion/index.d.ts +1 -0
  46. package/components/container/accordion/index.js +2 -2
  47. package/components/container/index.d.ts +1 -0
  48. package/components/container/layout-grid/grid-column/index.d.ts +1 -0
  49. package/components/container/layout-grid/grid-row/index.d.ts +1 -0
  50. package/components/container/layout-grid/index.d.ts +1 -0
  51. package/components/container/linear-layout/index.d.ts +1 -0
  52. package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
  53. package/components/container/panel/components/panel-header/index.js +16 -16
  54. package/components/container/panel/index.d.ts +1 -0
  55. package/components/container/repeat-template/index.d.ts +1 -0
  56. package/components/container/tabs/index.d.ts +1 -0
  57. package/components/container/tabs/index.js +18 -18
  58. package/components/container/tabs/props.d.ts +1 -0
  59. package/components/container/tabs/tab-pane/index.d.ts +2 -0
  60. package/components/container/tabs/tab-pane/index.js +2 -0
  61. package/components/container/tabs/tab-pane/props.d.ts +1 -0
  62. package/components/container/wizard/components/StepComponents.js +14 -6
  63. package/components/container/wizard/index.d.ts +2 -0
  64. package/components/container/wizard/index.js +2 -2
  65. package/components/container/wizard/props.d.ts +4 -0
  66. package/components/container/wizard/wizard-step/index.d.ts +1 -0
  67. package/components/container/wizard/wizard-step/index.js +6 -0
  68. package/components/data/card/card-actions/index.d.ts +1 -0
  69. package/components/data/card/card-content/index.d.ts +1 -0
  70. package/components/data/card/card-footer/index.d.ts +1 -0
  71. package/components/data/card/index.d.ts +1 -0
  72. package/components/data/card/index.js +13 -6
  73. package/components/data/form/dynamic-fields/index.js +1 -0
  74. package/components/data/form/form-action/index.d.ts +2 -0
  75. package/components/data/form/form-action/index.js +6 -4
  76. package/components/data/form/form-field/index.js +5 -4
  77. package/components/data/form/form-header/index.d.ts +1 -1
  78. package/components/data/form/form-header/index.js +10 -1
  79. package/components/data/form/index.js +5 -3
  80. package/components/data/form/props.d.ts +1 -0
  81. package/components/data/list/components/ListHeader.js +19 -3
  82. package/components/data/list/components/ListItemWithTemplate.js +5 -1
  83. package/components/data/list/components/ListItems.d.ts +1 -1
  84. package/components/data/list/components/ListItems.js +5 -1
  85. package/components/data/list/components/LoadMoreButton.js +14 -2
  86. package/components/data/list/components/StandardListItems.js +1 -1
  87. package/components/data/list/components/props.d.ts +11 -5
  88. package/components/data/list/hooks/props.d.ts +2 -2
  89. package/components/data/list/hooks/useListEventHandlers.js +3 -2
  90. package/components/data/list/index.d.ts +5 -1
  91. package/components/data/list/index.js +17 -4
  92. package/components/data/list/props.d.ts +14 -2
  93. package/components/data/list/utils/list-helpers.d.ts +5 -1
  94. package/components/data/list/utils/list-helpers.js +10 -0
  95. package/components/data/pagination/components/PageSizeSelector.js +49 -155
  96. package/components/data/pagination/hooks/usePagination.js +24 -1
  97. package/components/data/table/components/RowCells.js +1 -1
  98. package/components/data/table/components/TableDataRow.js +16 -3
  99. package/components/data/table/components/TableHeader.js +1 -1
  100. package/components/data/table/components/TablePanelHeading.js +14 -2
  101. package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
  102. package/components/data/table/hooks/useTableColumns.js +2 -2
  103. package/components/data/table/hooks/useTableData.js +30 -1
  104. package/components/data/table/index.d.ts +4 -0
  105. package/components/data/table/index.js +47 -30
  106. package/components/data/table/live-table/index.d.ts +1 -0
  107. package/components/data/table/props.d.ts +11 -2
  108. package/components/data/table/table-action/index.d.ts +1 -0
  109. package/components/data/table/table-column/index.d.ts +1 -0
  110. package/components/data/table/table-row/index.d.ts +1 -0
  111. package/components/data/table/table-row-action/index.d.ts +1 -0
  112. package/components/data/table/utils/buildSelectionColumns.d.ts +1 -1
  113. package/components/data/table/utils/buildSelectionColumns.js +97 -71
  114. package/components/data/table/utils/columnBuilder.d.ts +13 -0
  115. package/components/data/table/utils/columnBuilder.js +27 -18
  116. package/components/data/table/utils/columnWidthDistribution.d.ts +1 -1
  117. package/components/data/table/utils/columnWidthDistribution.js +4 -1
  118. package/components/data/table/utils/constants.d.ts +1 -1
  119. package/components/data/table/utils/constants.js +1 -1
  120. package/components/dialogs/alert-dialog/index.d.ts +2 -0
  121. package/components/dialogs/confirm-dialog/index.d.ts +2 -0
  122. package/components/dialogs/dialog/index.d.ts +2 -0
  123. package/components/dialogs/dialog-actions/index.d.ts +1 -0
  124. package/components/dialogs/dialog-body/index.d.ts +1 -0
  125. package/components/dialogs/dialog-content/index.d.ts +1 -0
  126. package/components/dialogs/dialog-header/index.d.ts +1 -0
  127. package/components/dialogs/dialog-header/index.js +11 -12
  128. package/components/dialogs/iframe-dialog/index.d.ts +2 -0
  129. package/components/dialogs/login-dialog/index.d.ts +4 -0
  130. package/components/dialogs/login-dialog/index.js +2 -1
  131. package/components/dialogs/login-dialog/props.d.ts +1 -0
  132. package/components/dialogs/page-dialog/index.d.ts +4 -0
  133. package/components/dialogs/page-dialog/index.js +2 -1
  134. package/components/dialogs/page-dialog/props.d.ts +1 -0
  135. package/components/form/button/index.d.ts +1 -0
  136. package/components/form/button/index.js +29 -33
  137. package/components/form/button-group/index.d.ts +1 -0
  138. package/components/input/calendar/index.d.ts +2 -0
  139. package/components/input/chips/index.d.ts +2 -0
  140. package/components/input/chips/index.js +9 -3
  141. package/components/input/chips/utils.d.ts +5 -0
  142. package/components/input/chips/utils.js +29 -0
  143. package/components/input/color-picker/index.d.ts +2 -0
  144. package/components/input/composite/index.d.ts +1 -0
  145. package/components/input/composite/index.js +1 -0
  146. package/components/input/currency/index.d.ts +2 -0
  147. package/components/input/default/checkbox/index.d.ts +6 -0
  148. package/components/input/default/checkbox/index.js +48 -18
  149. package/components/input/default/checkbox/props.d.ts +8 -0
  150. package/components/input/default/checkboxset/index.d.ts +2 -0
  151. package/components/input/default/radioset/index.d.ts +2 -0
  152. package/components/input/default/switch/index.d.ts +6 -0
  153. package/components/input/default/switch/index.js +36 -9
  154. package/components/input/default/switch/prop.d.ts +2 -0
  155. package/components/input/epoch/date/index.d.ts +1 -0
  156. package/components/input/epoch/datetime/index.d.ts +1 -0
  157. package/components/input/epoch/time/index.d.ts +1 -0
  158. package/components/input/fileupload/components/ListItems.d.ts +5 -1
  159. package/components/input/fileupload/components/ListItems.js +27 -5
  160. package/components/input/fileupload/components/MultiUpload.js +12 -1
  161. package/components/input/fileupload/components/SingleUpload.js +12 -1
  162. package/components/input/fileupload/index.d.ts +3 -0
  163. package/components/input/fileupload/index.js +11 -0
  164. package/components/input/fileupload/props.d.ts +10 -0
  165. package/components/input/number/index.d.ts +2 -0
  166. package/components/input/rating/index.d.ts +6 -0
  167. package/components/input/rating/index.js +10 -5
  168. package/components/input/rating/props.d.ts +8 -0
  169. package/components/input/select/index.d.ts +2 -0
  170. package/components/input/slider/index.d.ts +6 -0
  171. package/components/input/slider/index.js +19 -2
  172. package/components/input/slider/props.d.ts +2 -0
  173. package/components/input/text/index.d.ts +7 -1
  174. package/components/input/text/index.js +25 -6
  175. package/components/input/text/props.d.ts +8 -0
  176. package/components/input/textarea/index.d.ts +2 -0
  177. package/components/input/textarea/index.js +9 -4
  178. package/components/input/textarea/util.d.ts +1 -0
  179. package/components/input/textarea/util.js +17 -0
  180. package/components/input/upload/index.d.ts +2 -0
  181. package/components/navbar/index.d.ts +7 -0
  182. package/components/navbar/index.js +21 -7
  183. package/components/navbar/nav/index.d.ts +1 -0
  184. package/components/navbar/nav-item/index.d.ts +1 -0
  185. package/components/navigation/breadcrumb/index.d.ts +1 -0
  186. package/components/navigation/menu/index.d.ts +3 -1
  187. package/components/navigation/menu/index.js +22 -4
  188. package/components/navigation/menu/props.d.ts +1 -0
  189. package/components/navigation/popover/index.d.ts +1 -0
  190. package/components/navigation/popover/index.js +8 -2
  191. package/components/page/partial/index.d.ts +1 -0
  192. package/core/appstore.d.ts +10 -0
  193. package/core/appstore.js +9 -1
  194. package/core/constants/events.d.ts +3 -0
  195. package/core/constants/events.js +13 -1
  196. package/core/proxy-service.js +1 -1
  197. package/core/util/index.d.ts +2 -0
  198. package/core/util/index.js +29 -0
  199. package/higherOrder/BasePage.js +81 -26
  200. package/higherOrder/props.d.ts +1 -0
  201. package/higherOrder/useActivePageReactivity.d.ts +21 -0
  202. package/higherOrder/useActivePageReactivity.js +57 -0
  203. package/higherOrder/withBaseWrapper.js +2 -0
  204. package/higherOrder/withRenderLogger.d.ts +15 -0
  205. package/higherOrder/withRenderLogger.js +53 -0
  206. package/hooks/useAuth.js +7 -1
  207. package/package-lock.json +219 -198
  208. package/package.json +4 -3
  209. package/runtime-dynamic/factories/dynamic-component.js +18 -5
  210. package/runtime-dynamic/factories/utils.js +7 -1
  211. package/runtime-dynamic/services/compile-render.js +2 -1
  212. package/store/slices/i18nSlice.d.ts +2 -0
  213. package/store/slices/i18nSlice.js +3 -1
  214. package/types/index.d.ts +6 -0
  215. package/utils/attr.js +4 -1
  216. package/utils/svg-icon.d.ts +27 -0
  217. 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
- "i",
150
+ WmAppIcon,
149
151
  {
150
- className: clsx(
151
- "spinner-image animated infinite",
152
- "wm-spinner-icon",
153
- iconclass,
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
- "aria-hidden": "true",
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
  */
@@ -66,5 +66,6 @@ declare const _default: React.ComponentType<{
66
66
  prefabName?: string;
67
67
  loading?: boolean;
68
68
  showSkeleton?: boolean;
69
+ widget?: string;
69
70
  }>;
70
71
  export default _default;
@@ -82,5 +82,6 @@ declare const _default: React.ComponentType<{
82
82
  prefabName?: string;
83
83
  loading?: boolean;
84
84
  showSkeleton?: boolean;
85
+ widget?: string;
85
86
  }>;
86
87
  export default _default;
@@ -77,5 +77,6 @@ declare const _default: React.ComponentType<{
77
77
  dataset?: any;
78
78
  loading?: boolean;
79
79
  showSkeleton?: boolean;
80
+ widget?: string;
80
81
  }>;
81
82
  export default _default;
@@ -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;
@@ -75,6 +75,7 @@ export interface ChartProps {
75
75
  yunits?: string;
76
76
  /** Icon class for panel header */
77
77
  iconclass?: string;
78
+ iconurl?: string;
78
79
  /** Message when no data is available */
79
80
  nodatamessage?: string;
80
81
  /** Message shown during data loading */
@@ -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("i", { className: iconclass }),
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
  ] }),
@@ -44,6 +44,8 @@ export interface WmChartProps {
44
44
  title?: string;
45
45
  subheading?: string;
46
46
  iconclass?: string;
47
+ iconurl?: string;
48
+ prefabName?: string;
47
49
  nodatamessage?: string;
48
50
  loadingdatamsg?: string;
49
51
  tooltips?: boolean;
@@ -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 { WmSkeleton, SKELETON_REGISTRY, shouldShowSkeleton } from "./wm-skeleton";
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("i", { className: clsx("app-icon panel-icon", props.iconclass) }) }),
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 })
@@ -22,6 +22,7 @@ export interface AccordionPanePropsBase {
22
22
  * Icon class for the pane header (e.g., "wi wi-home").
23
23
  */
24
24
  iconclass?: string;
25
+ iconurl?: string;
25
26
  /**
26
27
  * Badge value displayed in the header.
27
28
  */
@@ -76,5 +76,6 @@ declare const _default: React.ComponentType<{
76
76
  prefabName?: string;
77
77
  loading?: boolean;
78
78
  showSkeleton?: boolean;
79
+ widget?: string;
79
80
  }>;
80
81
  export default _default;
@@ -31,7 +31,7 @@ import {
31
31
  import {
32
32
  WmSkeleton,
33
33
  SKELETON_REGISTRY,
34
- shouldShowSkeleton
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 (shouldShowSkeleton(props.loading, props.showSkeleton)) {
209
+ if (useShouldShowSkeleton(props.loading, props.showSkeleton)) {
210
210
  return /* @__PURE__ */ jsx(
211
211
  WmSkeleton,
212
212
  __spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmAccordion"]), {
@@ -82,5 +82,6 @@ declare const _default: React.ComponentType<{
82
82
  prefabName?: string;
83
83
  loading?: boolean;
84
84
  showSkeleton?: boolean;
85
+ widget?: string;
85
86
  }>;
86
87
  export default _default;
@@ -68,5 +68,6 @@ declare const _default: import("react").ComponentType<{
68
68
  prefabName?: string;
69
69
  loading?: boolean;
70
70
  showSkeleton?: boolean;
71
+ widget?: string;
71
72
  }>;
72
73
  export default _default;
@@ -64,5 +64,6 @@ declare const _default: import("react").ComponentType<{
64
64
  prefabName?: string;
65
65
  loading?: boolean;
66
66
  showSkeleton?: boolean;
67
+ widget?: string;
67
68
  }>;
68
69
  export default _default;
@@ -66,5 +66,6 @@ declare const _default: React.ComponentType<{
66
66
  prefabName?: string;
67
67
  loading?: boolean;
68
68
  showSkeleton?: boolean;
69
+ widget?: string;
69
70
  }>;
70
71
  export default _default;
@@ -65,5 +65,6 @@ declare const _default: React.ComponentType<{
65
65
  prefabName?: string;
66
66
  loading?: boolean;
67
67
  showSkeleton?: boolean;
68
+ widget?: string;
68
69
  }>;
69
70
  export default _default;
@@ -62,5 +62,6 @@ declare const _default: React.ComponentType<{
62
62
  prefabName?: string;
63
63
  loading?: boolean;
64
64
  showSkeleton?: boolean;
65
+ widget?: string;
65
66
  }>;
66
67
  export default _default;
@@ -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__ */ jsxs(Box, { className: "pull-left", children: [
60
- iconclass && !iconurl && /* @__PURE__ */ jsx(Box, { component: "i", className: `app-icon panel-icon ${iconclass}` }),
61
- iconurl && /* @__PURE__ */ jsx(
62
- Box,
63
- {
64
- component: "img",
65
- "data-identifier": "img",
66
- title: "iconurl",
67
- alt: "Panel icon",
68
- className: clsx("panel-image-icon", "wm-panel-header-icon-img"),
69
- src: iconurl,
70
- style: panelIconImgStyle
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,
@@ -116,5 +116,6 @@ declare const _default: React.ComponentType<{
116
116
  prefabName?: string;
117
117
  loading?: boolean;
118
118
  showSkeleton?: boolean;
119
+ widget?: string;
119
120
  }>;
120
121
  export default _default;
@@ -80,5 +80,6 @@ declare const _default: import("react").ComponentType<{
80
80
  prefabName?: string;
81
81
  loading?: boolean;
82
82
  showSkeleton?: boolean;
83
+ widget?: string;
83
84
  }>;
84
85
  export default _default;
@@ -84,5 +84,6 @@ declare const _default: React.ComponentType<{
84
84
  prefabName?: string;
85
85
  loading?: boolean;
86
86
  showSkeleton?: boolean;
87
+ widget?: string;
87
88
  }>;
88
89
  export default _default;