@wavemaker-ai/react-runtime 1.0.0-rc.647469 → 1.0.0-rc.647499
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/base-action.d.ts +7 -0
- package/actions/login-action.d.ts +11 -0
- package/actions/logout-action.d.ts +10 -0
- package/actions/navigation-action.d.ts +35 -0
- package/actions/navigation-action.js +23 -5
- package/actions/notification-action.d.ts +20 -0
- package/actions/timer-action.d.ts +27 -0
- package/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/index.js +2 -1
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/carousel/template.js +2 -1
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/advanced/marquee/index.js +2 -1
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +4 -3
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/audio/index.js +3 -2
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/icon/index.js +4 -7
- package/components/basic/iframe/iframe.utils.d.ts +1 -1
- package/components/basic/iframe/iframe.utils.js +8 -4
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/label/index.js +3 -2
- package/components/basic/message/index.js +1 -1
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/picture/index.js +3 -4
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-bar/index.js +2 -1
- 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 +3 -0
- package/components/basic/search/index.js +7 -4
- package/components/basic/search/props.d.ts +2 -0
- package/components/basic/spinner/index.d.ts +1 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tile/index.js +2 -1
- package/components/basic/tree/Components/TreeNodeComponent.js +9 -5
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/tree/index.js +14 -3
- package/components/basic/tree/utils.d.ts +2 -0
- package/components/basic/tree/utils.js +11 -1
- package/components/basic/video/index.d.ts +1 -0
- package/components/basic/video/index.js +40 -23
- package/components/chart/index.d.ts +1 -0
- package/components/common/AppSpinner.js +2 -5
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/accordion-pane/index.js +1 -4
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/index.d.ts +3 -0
- package/components/container/index.js +6 -1
- 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/layout-grid/index.js +4 -8
- 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 +11 -6
- package/components/container/panel/components/panel-header/props.d.ts +5 -0
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/panel/index.js +2 -1
- package/components/container/props.d.ts +2 -0
- package/components/container/repeat-template/index.d.ts +22 -1
- package/components/container/repeat-template/index.js +2 -1
- package/components/container/tabs/index.d.ts +3 -1
- package/components/container/tabs/index.js +102 -51
- package/components/container/tabs/props.d.ts +12 -0
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +28 -11
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/container/wizard/wizard-step/index.js +2 -2
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-actions/index.js +3 -5
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-content/index.js +3 -13
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/card-footer/index.js +3 -5
- package/components/data/card/index.d.ts +1 -0
- package/components/data/card/index.js +3 -14
- package/components/data/form/dynamic-fields/index.js +7 -1
- package/components/data/form/dynamic-fields/props.d.ts +1 -0
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-body/index.js +2 -1
- package/components/data/form/form-field/base-field.js +4 -3
- package/components/data/form/form-footer/index.js +2 -1
- package/components/data/list/components/ListItemWithTemplate.js +4 -2
- package/components/data/list/hooks/props.d.ts +2 -2
- package/components/data/list/hooks/useListEventHandlers.js +6 -6
- package/components/data/list/index.d.ts +2 -0
- package/components/data/list/index.js +3 -4
- package/components/data/list/props.d.ts +2 -1
- package/components/data/list/utils/list-widget-methods.d.ts +2 -1
- package/components/data/table/components/RowCells.d.ts +16 -2
- package/components/data/table/components/RowCells.js +38 -24
- package/components/data/table/components/TableBody.js +11 -3
- package/components/data/table/components/TableDataRow.d.ts +3 -0
- package/components/data/table/components/TableDataRow.js +11 -3
- package/components/data/table/components/TableHeader.js +1 -4
- package/components/data/table/hooks/index.d.ts +1 -0
- package/components/data/table/hooks/index.js +12 -0
- package/components/data/table/hooks/useCustomExpressionColumns.d.ts +16 -0
- package/components/data/table/hooks/useCustomExpressionColumns.js +88 -0
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowSelection.d.ts +1 -1
- package/components/data/table/hooks/useRowSelection.js +26 -5
- package/components/data/table/hooks/useTableInitialization.js +2 -1
- package/components/data/table/index.d.ts +4 -0
- package/components/data/table/index.js +77 -12
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +7 -0
- 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.js +7 -1
- package/components/data/table/utils/columnBuilder.js +1 -1
- package/components/data/table/utils/index.js +2 -2
- package/components/data/table/utils/renderDisplayCell.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/index.js +2 -4
- 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/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +2 -0
- package/components/dialogs/page-dialog/index.d.ts +2 -0
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button/index.js +4 -3
- package/components/form/button-group/index.d.ts +1 -0
- package/components/form/button-group/index.js +2 -1
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +2 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/currency/index.d.ts +2 -0
- package/components/input/default/checkbox/index.d.ts +2 -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 +2 -0
- package/components/input/epoch/date/components/DatePickerPopover.js +11 -29
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.js +10 -25
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/epoch/time/index.js +1 -1
- package/components/input/epoch/time/utils.d.ts +0 -17
- package/components/input/epoch/time/utils.js +1 -18
- package/components/input/fileupload/index.d.ts +1 -0
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +2 -0
- package/components/input/rating/index.js +14 -17
- package/components/input/select/index.d.ts +2 -0
- package/components/input/select/index.js +1 -4
- package/components/input/slider/index.d.ts +2 -0
- package/components/input/slider/index.js +13 -12
- package/components/input/text/index.d.ts +2 -0
- package/components/input/text/index.js +3 -14
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/textarea/index.js +7 -10
- package/components/input/upload/index.d.ts +2 -0
- package/components/input/upload/index.js +3 -5
- package/components/layout/footer/index.js +2 -1
- package/components/layout/footer/props.d.ts +1 -0
- package/components/layout/header/index.js +2 -1
- package/components/layout/header/props.d.ts +1 -0
- package/components/layout/leftnav/index.js +2 -1
- package/components/layout/leftnav/props.d.ts +1 -0
- package/components/layout/rightnav/index.js +2 -1
- package/components/layout/rightnav/props.d.ts +1 -0
- package/components/layout/topnav/index.js +2 -1
- package/components/layout/topnav/props.d.ts +1 -0
- package/components/navbar/index.d.ts +1 -0
- package/components/navbar/index.js +2 -1
- package/components/navbar/nav/index.d.ts +1 -0
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navbar/nav-item/index.js +2 -1
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +1 -0
- package/components/navigation/menu/index.js +5 -4
- package/components/navigation/popover/index.d.ts +2 -1
- package/components/navigation/popover/index.js +1 -1
- package/components/page/error-boundary/index.js +5 -5
- package/components/page/index.js +13 -9
- package/components/page/partial/index.d.ts +1 -0
- package/components/prefab/container/index.js +2 -1
- package/context/WidgetProvider.js +2 -2
- package/core/app.service.js +40 -35
- package/core/constants/events.js +6 -0
- package/core/constants/index.d.ts +9 -1
- package/core/constants/index.js +32 -5
- package/core/formatter/date-formatters.d.ts +1 -1
- package/core/formatter/date-formatters.js +38 -13
- package/core/formatter/types.d.ts +1 -1
- package/core/proxy-service.js +15 -5
- package/core/security.service.d.ts +12 -0
- package/core/util/index.js +3 -2
- package/higherOrder/BaseApp.js +2 -2
- package/higherOrder/BasePage.d.ts +0 -17
- package/higherOrder/BasePage.js +53 -104
- package/higherOrder/BasePrefab.js +69 -59
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/withBaseWrapper.js +3 -4
- package/hooks/useAccess.js +13 -0
- package/mui-config/theme-provider.d.ts +3 -0
- package/mui-config/theme.d.ts +2 -0
- package/mui-config/theme.js +1 -4
- package/package-lock.json +2640 -615
- package/package.json +23 -4
- package/runtime-dynamic/App.d.ts +7 -0
- package/runtime-dynamic/App.js +144 -0
- package/runtime-dynamic/app-initializer.d.ts +15 -0
- package/runtime-dynamic/app-initializer.js +447 -0
- package/runtime-dynamic/components/ErrorBoundary.d.ts +18 -0
- package/runtime-dynamic/components/ErrorBoundary.js +93 -0
- package/runtime-dynamic/components/PageWrapper.d.ts +1 -0
- package/runtime-dynamic/components/PageWrapper.js +43 -0
- package/runtime-dynamic/components/PrefabPreview.d.ts +1 -0
- package/runtime-dynamic/components/PrefabPreview.js +84 -0
- package/runtime-dynamic/components/partial-content.d.ts +15 -0
- package/runtime-dynamic/components/partial-content.js +50 -0
- package/runtime-dynamic/components/prefab-content.d.ts +10 -0
- package/runtime-dynamic/components/prefab-content.js +31 -0
- package/runtime-dynamic/components/use-dynamic-component.d.ts +10 -0
- package/runtime-dynamic/components/use-dynamic-component.js +165 -0
- package/runtime-dynamic/factories/build-base-page-like-component.d.ts +8 -0
- package/runtime-dynamic/factories/build-base-page-like-component.js +59 -0
- package/runtime-dynamic/factories/prefab-factory.d.ts +3 -0
- package/runtime-dynamic/factories/prefab-factory.js +82 -0
- package/runtime-dynamic/factories/startup-info.d.ts +6 -0
- package/runtime-dynamic/factories/startup-info.js +28 -0
- package/runtime-dynamic/factories/utils.d.ts +23 -0
- package/runtime-dynamic/factories/utils.js +131 -0
- package/runtime-dynamic/index.d.ts +14 -0
- package/runtime-dynamic/index.js +191 -0
- package/runtime-dynamic/main.d.ts +2 -0
- package/runtime-dynamic/main.js +84 -0
- package/runtime-dynamic/preview-mode.d.ts +15 -0
- package/runtime-dynamic/preview-mode.js +31 -0
- package/runtime-dynamic/preview-navigation.d.ts +6 -0
- package/runtime-dynamic/preview-navigation.js +38 -0
- package/runtime-dynamic/preview-resource-base.d.ts +12 -0
- package/runtime-dynamic/preview-resource-base.js +65 -0
- package/runtime-dynamic/registry/component-registry.d.ts +3 -0
- package/runtime-dynamic/registry/component-registry.js +353 -0
- package/runtime-dynamic/registry/custom-widget-registry.d.ts +7 -0
- package/runtime-dynamic/registry/custom-widget-registry.js +18 -0
- package/runtime-dynamic/registry/index.d.ts +2 -0
- package/runtime-dynamic/registry/index.js +63 -0
- package/runtime-dynamic/registry/store.d.ts +9 -0
- package/runtime-dynamic/registry/store.js +26 -0
- package/runtime-dynamic/routes.d.ts +2 -0
- package/runtime-dynamic/routes.js +107 -0
- package/runtime-dynamic/services/app-extension-provider.d.ts +1 -0
- package/runtime-dynamic/services/app-extension-provider.js +45 -0
- package/runtime-dynamic/services/cache.d.ts +29 -0
- package/runtime-dynamic/services/cache.js +57 -0
- package/runtime-dynamic/services/component-ref-provider.d.ts +12 -0
- package/runtime-dynamic/services/component-ref-provider.js +149 -0
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +53 -0
- package/runtime-dynamic/services/fragment-url.d.ts +16 -0
- package/runtime-dynamic/services/fragment-url.js +74 -0
- package/runtime-dynamic/services/index.d.ts +10 -0
- package/runtime-dynamic/services/index.js +152 -0
- package/runtime-dynamic/services/markup-transpiler.d.ts +12 -0
- package/runtime-dynamic/services/markup-transpiler.js +250 -0
- package/runtime-dynamic/services/prefab-resources.d.ts +18 -0
- package/runtime-dynamic/services/prefab-resources.js +159 -0
- package/runtime-dynamic/services/resource-manager.d.ts +2 -0
- package/runtime-dynamic/services/resource-manager.js +66 -0
- package/runtime-dynamic/services/script-executor.d.ts +8 -0
- package/runtime-dynamic/services/script-executor.js +90 -0
- package/runtime-dynamic/services/variable-factory.d.ts +2 -0
- package/runtime-dynamic/services/variable-factory.js +260 -0
- package/runtime-dynamic/services/variable-registry.d.ts +12 -0
- package/runtime-dynamic/services/variable-registry.js +118 -0
- package/runtime-dynamic/services/variable-transpiler.d.ts +5 -0
- package/runtime-dynamic/services/variable-transpiler.js +159 -0
- package/runtime-dynamic/shims/next-image.d.ts +35 -0
- package/runtime-dynamic/shims/next-image.js +60 -0
- package/runtime-dynamic/shims/next-link.d.ts +25 -0
- package/runtime-dynamic/shims/next-link.js +33 -0
- package/runtime-dynamic/shims/next-navigation.d.ts +16 -0
- package/runtime-dynamic/shims/next-navigation.js +52 -0
- package/runtime-dynamic/utils/index.d.ts +9 -0
- package/runtime-dynamic/utils/index.js +40 -0
- package/store/middleware/navigationMiddleware.js +1 -1
- package/store/slices/appConfigSlice.js +10 -8
- package/store/slices/authSlice.js +46 -32
- package/tsconfig.declaration.tsbuildinfo +1 -1
- package/types/index.d.ts +1 -0
- package/utils/attr.js +71 -14
- package/utils/custom-expression/index.d.ts +43 -0
- package/utils/custom-expression/index.js +161 -0
- package/utils/custom-expression/parser.d.ts +15 -0
- package/utils/custom-expression/parser.js +208 -0
- package/utils/layoutsize-util.d.ts +1 -0
- package/utils/layoutsize-util.js +57 -0
- package/utils/lib-error-skipper.d.ts +4 -26
- package/utils/lib-error-skipper.js +41 -165
- package/utils/style-utils.d.ts +6 -0
- package/utils/style-utils.js +10 -1
- package/variables/metadata.service.js +2 -3
- package/variables/model-variable.js +10 -7
- package/variables/service-variable.d.ts +1 -0
- package/variables/service-variable.js +26 -6
- package/components/input/epoch/datetime/styled.d.ts +0 -78
- package/components/input/epoch/datetime/styled.js +0 -90
|
@@ -7,13 +7,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _navigation = require("next/navigation");
|
|
11
10
|
var _button = require("../../form/button");
|
|
12
11
|
var _label = require("../../basic/label");
|
|
13
12
|
var _icon = require("../../basic/icon");
|
|
14
13
|
var _picture = require("../../basic/picture");
|
|
15
14
|
var _container = require("../../container");
|
|
16
15
|
var _store = require("../../../store");
|
|
16
|
+
var _navigationMiddleware = require("../../../store/middleware/navigationMiddleware");
|
|
17
17
|
var __jsx = _react["default"].createElement;
|
|
18
18
|
var ErrorFallback = function ErrorFallback(_ref) {
|
|
19
19
|
var _store$getState;
|
|
@@ -24,18 +24,18 @@ var ErrorFallback = function ErrorFallback(_ref) {
|
|
|
24
24
|
subtitle = _ref$subtitle === void 0 ? "Please try again." : _ref$subtitle,
|
|
25
25
|
_ref$imageSource = _ref.imageSource,
|
|
26
26
|
imageSource = _ref$imageSource === void 0 ? "/error-fallback.svg" : _ref$imageSource;
|
|
27
|
-
var router = (0, _navigation.useRouter)();
|
|
28
27
|
var homePage = (_store$getState = _store.store.getState()) === null || _store$getState === void 0 || (_store$getState = _store$getState.info) === null || _store$getState === void 0 || (_store$getState = _store$getState.appConfig) === null || _store$getState === void 0 || (_store$getState = _store$getState.appProperties) === null || _store$getState === void 0 ? void 0 : _store$getState.homePage;
|
|
29
28
|
var handleGoHome = function handleGoHome() {
|
|
30
|
-
|
|
29
|
+
var router = (0, _navigationMiddleware.getRouterInstance)();
|
|
30
|
+
if (router && homePage) {
|
|
31
31
|
router.push(homePage);
|
|
32
32
|
} else {
|
|
33
33
|
window.location.href = window.location.origin;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
var handleGoBack = function handleGoBack() {
|
|
37
|
-
var
|
|
38
|
-
if (
|
|
37
|
+
var router = (0, _navigationMiddleware.getRouterInstance)();
|
|
38
|
+
if (router && window.history.length > 1) {
|
|
39
39
|
router.back();
|
|
40
40
|
} else {
|
|
41
41
|
window.location.href = window.location.origin;
|
package/components/page/index.js
CHANGED
|
@@ -13,6 +13,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
13
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
14
14
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
15
|
var _Container = _interopRequireDefault(require("@mui/material/Container"));
|
|
16
|
+
var _attr = require("@wavemaker-ai/react-runtime/utils/attr");
|
|
16
17
|
var _excluded = ["className", "styles", "children"];
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
18
19
|
var __jsx = _react["default"].createElement;
|
|
@@ -119,6 +120,9 @@ function WmPage(props) {
|
|
|
119
120
|
var childrenWithCallback = (0, _react.useMemo)(function () {
|
|
120
121
|
return _react["default"].Children.map(children, function (child) {
|
|
121
122
|
if (/*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
123
|
+
if (typeof child.type === "string") {
|
|
124
|
+
return child;
|
|
125
|
+
}
|
|
122
126
|
return /*#__PURE__*/_react["default"].cloneElement(child, _objectSpread({
|
|
123
127
|
onNavHeightChange: handleNavHeightChange
|
|
124
128
|
}, child.props));
|
|
@@ -126,7 +130,7 @@ function WmPage(props) {
|
|
|
126
130
|
return child;
|
|
127
131
|
});
|
|
128
132
|
}, [children, handleNavHeightChange]);
|
|
129
|
-
return __jsx(_Container["default"], (0, _extends2["default"])({}, restProps, {
|
|
133
|
+
return __jsx(_Container["default"], (0, _extends2["default"])({}, (0, _attr.removeInvalidAttributes)(restProps), {
|
|
130
134
|
className: (0, _clsx["default"])(DEFAULT_CLASS, {
|
|
131
135
|
"app-nav-full": hasFullNavHeight
|
|
132
136
|
}, className),
|
|
@@ -135,13 +139,13 @@ function WmPage(props) {
|
|
|
135
139
|
}
|
|
136
140
|
WmPage.displayName = "WmPage";
|
|
137
141
|
|
|
138
|
-
/**
|
|
139
|
-
* The WmPage component is the root container for a WaveMaker page layout.
|
|
140
|
-
*
|
|
141
|
-
* - [Playground](https://react-components.wavemaker.ai/?path=/story/page--showcase)
|
|
142
|
-
*
|
|
143
|
-
* - [Docs](https://react-components.wavemaker.ai/?path=/story/page--docs#tab-overview)
|
|
144
|
-
*
|
|
145
|
-
* @param props - {@link WmPageProps}
|
|
142
|
+
/**
|
|
143
|
+
* The WmPage component is the root container for a WaveMaker page layout.
|
|
144
|
+
*
|
|
145
|
+
* - [Playground](https://react-components.wavemaker.ai/?path=/story/page--showcase)
|
|
146
|
+
*
|
|
147
|
+
* - [Docs](https://react-components.wavemaker.ai/?path=/story/page--docs#tab-overview)
|
|
148
|
+
*
|
|
149
|
+
* @param props - {@link WmPageProps}
|
|
146
150
|
*/
|
|
147
151
|
var _default = exports["default"] = WmPage;
|
|
@@ -34,6 +34,7 @@ declare const _default: import("react").ComponentType<{
|
|
|
34
34
|
eventCallback?: (eventName: string, data: any) => void;
|
|
35
35
|
forwardedRef?: React.ForwardedRef<any>;
|
|
36
36
|
viewParent?: any;
|
|
37
|
+
destroy?: ((names: string[]) => void) | ((formName?: string) => void);
|
|
37
38
|
hint?: string;
|
|
38
39
|
arialabel?: string;
|
|
39
40
|
tabindex?: number;
|
|
@@ -9,6 +9,7 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _attr = require("@wavemaker-ai/react-runtime/utils/attr");
|
|
12
13
|
var _excluded = ["styles", "onLoad", "onDestroy", "children", "className"];
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
15
|
var __jsx = _react["default"].createElement;
|
|
@@ -45,7 +46,7 @@ var WmPrefabContainer = function WmPrefabContainer(props) {
|
|
|
45
46
|
}, [onLoad, onDestroy]);
|
|
46
47
|
return __jsx("div", (0, _extends2["default"])({
|
|
47
48
|
style: styles
|
|
48
|
-
}, rest, {
|
|
49
|
+
}, (0, _attr.removeInvalidAttributes)(rest), {
|
|
49
50
|
ref: ref,
|
|
50
51
|
className: className || DEFAULT_CLASS
|
|
51
52
|
}), children);
|
|
@@ -228,6 +228,7 @@ var WidgetProvider = exports.WidgetProvider = function WidgetProvider(_ref) {
|
|
|
228
228
|
}, children));
|
|
229
229
|
};
|
|
230
230
|
var usePageContext = exports.usePageContext = function usePageContext(standalone) {
|
|
231
|
+
var context = (0, _react.useContext)(WidgetContext);
|
|
231
232
|
if (standalone) {
|
|
232
233
|
return {
|
|
233
234
|
pageContext: {},
|
|
@@ -236,17 +237,16 @@ var usePageContext = exports.usePageContext = function usePageContext(standalone
|
|
|
236
237
|
destroy: function destroy() {}
|
|
237
238
|
};
|
|
238
239
|
}
|
|
239
|
-
var context = (0, _react.useContext)(WidgetContext);
|
|
240
240
|
if (!context) {
|
|
241
241
|
throw new Error("useWidgetContext must be used within a WidgetProvider");
|
|
242
242
|
}
|
|
243
243
|
return context;
|
|
244
244
|
};
|
|
245
245
|
var useWidgetProxy = exports.useWidgetProxy = function useWidgetProxy(name, standalone) {
|
|
246
|
+
var context = (0, _react.useContext)(WidgetContext);
|
|
246
247
|
if (standalone) {
|
|
247
248
|
return {};
|
|
248
249
|
}
|
|
249
|
-
var context = (0, _react.useContext)(WidgetContext);
|
|
250
250
|
if (!context) {
|
|
251
251
|
throw new Error("useWidgetProxy must be used within a WidgetProvider");
|
|
252
252
|
}
|
package/core/app.service.js
CHANGED
|
@@ -20,6 +20,7 @@ var _authSlice = require("@wavemaker-ai/react-runtime/store/slices/authSlice");
|
|
|
20
20
|
var _get = _interopRequireDefault(require("lodash-es/get"));
|
|
21
21
|
var _isEmpty = _interopRequireDefault(require("lodash-es/isEmpty"));
|
|
22
22
|
var _appstore = _interopRequireDefault(require("./appstore"));
|
|
23
|
+
var _constants = require("@wavemaker-ai/react-runtime/core/constants");
|
|
23
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
25
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
25
26
|
function loadWmProperties(_x) {
|
|
@@ -123,7 +124,7 @@ var getRedirectPage = exports.getRedirectPage = function getRedirectPage(config,
|
|
|
123
124
|
};
|
|
124
125
|
var handle401 = exports.handle401 = /*#__PURE__*/function () {
|
|
125
126
|
var _ref5 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(page, options) {
|
|
126
|
-
var state, securityConfig, router, loginConfig, userInfo, loginMethod, sessionTimeoutConfig, sessionTimeoutMethod, sessionTimeoutQueryParams, queryString, loginQueryParams, _queryString,
|
|
127
|
+
var state, securityConfig, router, loginConfig, userInfo, loginMethod, basePath, getCurrentPageName, sessionTimeoutConfig, sessionTimeoutMethod, sessionTimeoutQueryParams, sessionTimeoutLoginPage, queryString, loginPath, loginPageName, _loginPath, loginQueryParams, _queryString, isOnLoginPage;
|
|
127
128
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
128
129
|
while (1) switch (_context.prev = _context.next) {
|
|
129
130
|
case 0:
|
|
@@ -152,8 +153,12 @@ var handle401 = exports.handle401 = /*#__PURE__*/function () {
|
|
|
152
153
|
loginConfig = securityConfig.loginConfig || {};
|
|
153
154
|
userInfo = securityConfig.userInfo;
|
|
154
155
|
loginMethod = ((loginConfig === null || loginConfig === void 0 ? void 0 : loginConfig.type) || LOGIN_METHOD.PAGE).toUpperCase();
|
|
156
|
+
basePath = (0, _constants.getActiveRoutingBasePath)();
|
|
157
|
+
getCurrentPageName = function getCurrentPageName() {
|
|
158
|
+
return window.location.pathname.split("/").filter(Boolean).pop() || "";
|
|
159
|
+
};
|
|
155
160
|
if (!(userInfo !== null && userInfo !== void 0 && userInfo.userName)) {
|
|
156
|
-
_context.next =
|
|
161
|
+
_context.next = 33;
|
|
157
162
|
break;
|
|
158
163
|
}
|
|
159
164
|
sessionTimeoutConfig = loginConfig.sessionTimeout || {
|
|
@@ -161,57 +166,57 @@ var handle401 = exports.handle401 = /*#__PURE__*/function () {
|
|
|
161
166
|
};
|
|
162
167
|
sessionTimeoutMethod = (sessionTimeoutConfig.type || LOGIN_METHOD.DIALOG).toUpperCase();
|
|
163
168
|
_context.t0 = sessionTimeoutMethod;
|
|
164
|
-
_context.next = _context.t0 === LOGIN_METHOD.DIALOG ?
|
|
169
|
+
_context.next = _context.t0 === LOGIN_METHOD.DIALOG ? 21 : _context.t0 === LOGIN_METHOD.PAGE ? 23 : _context.t0 === LOGIN_METHOD.SSO ? 28 : 31;
|
|
165
170
|
break;
|
|
166
|
-
case 19:
|
|
167
|
-
showLoginDialog();
|
|
168
|
-
return _context.abrupt("break", 28);
|
|
169
171
|
case 21:
|
|
170
|
-
|
|
172
|
+
showLoginDialog();
|
|
173
|
+
return _context.abrupt("break", 31);
|
|
174
|
+
case 23:
|
|
175
|
+
page = page || getCurrentPageName();
|
|
171
176
|
sessionTimeoutQueryParams = mergeQueryParams({
|
|
172
177
|
redirectTo: page
|
|
173
178
|
}, options === null || options === void 0 ? void 0 : options.queryParams);
|
|
174
|
-
|
|
179
|
+
sessionTimeoutLoginPage = sessionTimeoutConfig.pageName || "Login";
|
|
180
|
+
if (page !== sessionTimeoutLoginPage) {
|
|
175
181
|
queryString = createQueryString(sessionTimeoutQueryParams);
|
|
176
|
-
|
|
182
|
+
loginPath = "/".concat(basePath, "/").concat(sessionTimeoutLoginPage);
|
|
183
|
+
router.push("".concat(loginPath).concat(queryString ? "?".concat(queryString) : ""));
|
|
177
184
|
}
|
|
178
|
-
return _context.abrupt("break",
|
|
179
|
-
case 25:
|
|
180
|
-
_context.next = 27;
|
|
181
|
-
return handleSSOLogin(loginConfig, options);
|
|
182
|
-
case 27:
|
|
183
|
-
return _context.abrupt("break", 28);
|
|
185
|
+
return _context.abrupt("break", 31);
|
|
184
186
|
case 28:
|
|
185
|
-
_context.next =
|
|
186
|
-
|
|
187
|
+
_context.next = 30;
|
|
188
|
+
return handleSSOLogin(loginConfig, options);
|
|
187
189
|
case 30:
|
|
188
|
-
_context.
|
|
189
|
-
|
|
190
|
+
return _context.abrupt("break", 31);
|
|
191
|
+
case 31:
|
|
192
|
+
_context.next = 49;
|
|
190
193
|
break;
|
|
191
194
|
case 33:
|
|
195
|
+
_context.t1 = loginMethod;
|
|
196
|
+
_context.next = _context.t1 === LOGIN_METHOD.DIALOG ? 36 : _context.t1 === LOGIN_METHOD.PAGE ? 38 : _context.t1 === LOGIN_METHOD.SSO ? 46 : 49;
|
|
197
|
+
break;
|
|
198
|
+
case 36:
|
|
192
199
|
showLoginDialog(true);
|
|
193
|
-
return _context.abrupt("break",
|
|
194
|
-
case
|
|
195
|
-
page = page || getRedirectPage(securityConfig, page) ||
|
|
200
|
+
return _context.abrupt("break", 49);
|
|
201
|
+
case 38:
|
|
202
|
+
page = page || getRedirectPage(securityConfig, page) || getCurrentPageName();
|
|
203
|
+
loginPageName = loginConfig.pageName || "Login";
|
|
204
|
+
_loginPath = "/".concat(basePath, "/").concat(loginPageName);
|
|
196
205
|
loginQueryParams = mergeQueryParams({
|
|
197
206
|
redirectTo: page
|
|
198
207
|
}, options === null || options === void 0 ? void 0 : options.queryParams);
|
|
199
208
|
_queryString = createQueryString(loginQueryParams);
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
isNotOnLoginPage = window.location.pathname.endsWith(loginConfig.pageName);
|
|
204
|
-
hasQueryString = _queryString !== "";
|
|
205
|
-
if (!isNotOnLoginPage && hasQueryString) {
|
|
206
|
-
router.push("".concat(loginConfig.pageName).concat(_queryString ? "?".concat(_queryString) : ""));
|
|
209
|
+
isOnLoginPage = window.location.pathname.endsWith(loginPageName);
|
|
210
|
+
if (!isOnLoginPage && page) {
|
|
211
|
+
router.push("".concat(_loginPath).concat(_queryString ? "?".concat(_queryString) : ""));
|
|
207
212
|
}
|
|
208
|
-
return _context.abrupt("break",
|
|
209
|
-
case
|
|
210
|
-
_context.next =
|
|
213
|
+
return _context.abrupt("break", 49);
|
|
214
|
+
case 46:
|
|
215
|
+
_context.next = 48;
|
|
211
216
|
return handleSSOLogin(loginConfig, options);
|
|
212
|
-
case
|
|
213
|
-
return _context.abrupt("break",
|
|
214
|
-
case
|
|
217
|
+
case 48:
|
|
218
|
+
return _context.abrupt("break", 49);
|
|
219
|
+
case 49:
|
|
215
220
|
case "end":
|
|
216
221
|
return _context.stop();
|
|
217
222
|
}
|
package/core/constants/events.js
CHANGED
|
@@ -10,6 +10,12 @@ var partialStateSyncEmitter = new _events["default"]();
|
|
|
10
10
|
var prefabStateSyncEmitter = new _events["default"]();
|
|
11
11
|
var layoutSyncEmitter = new _events["default"]();
|
|
12
12
|
|
|
13
|
+
// Pages with many partials/prefabs legitimately register one listener each.
|
|
14
|
+
// The default limit of 10 is too low for widget-heavy WaveMaker pages.
|
|
15
|
+
partialStateSyncEmitter.setMaxListeners(50);
|
|
16
|
+
prefabStateSyncEmitter.setMaxListeners(50);
|
|
17
|
+
layoutSyncEmitter.setMaxListeners(50);
|
|
18
|
+
|
|
13
19
|
// NOTE: Form-related events (CHILD_FORM_DATA_UPDATE, CHILD_FORM_FIELD_REGISTER) have been removed.
|
|
14
20
|
// Form communication now uses context-based callbacks via ParentFormDataContext:
|
|
15
21
|
// - onChildDataChange: For child forms to send data UP to root parent
|
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/** Production / default SPA URL segment (embedded apps, classic deploy). */
|
|
2
|
+
export declare const ROUTING_BASEPATH_PRODUCTION = "react-pages";
|
|
3
|
+
/** Studio / dynamic preview uses this segment in the browser URL (runtime-dynamic). */
|
|
4
|
+
export declare const PREVIEW_ROUTING_BASEPATH = "react-preview";
|
|
5
|
+
/**
|
|
6
|
+
* SPA routing segment for the current window (`react-pages` vs `react-preview`).
|
|
7
|
+
* Call when building navigation targets — not a one-time module-load constant.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getActiveRoutingBasePath(): string;
|
|
2
10
|
export declare const hyperLinkMofify: (link: string) => string;
|
package/core/constants/index.js
CHANGED
|
@@ -3,17 +3,44 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.ROUTING_BASEPATH_PRODUCTION = exports.PREVIEW_ROUTING_BASEPATH = void 0;
|
|
7
|
+
exports.getActiveRoutingBasePath = getActiveRoutingBasePath;
|
|
8
|
+
exports.hyperLinkMofify = void 0;
|
|
9
|
+
/** Production / default SPA URL segment (embedded apps, classic deploy). */
|
|
10
|
+
var ROUTING_BASEPATH_PRODUCTION = exports.ROUTING_BASEPATH_PRODUCTION = "react-pages";
|
|
11
|
+
|
|
12
|
+
/** Studio / dynamic preview uses this segment in the browser URL (runtime-dynamic). */
|
|
13
|
+
var PREVIEW_ROUTING_BASEPATH = exports.PREVIEW_ROUTING_BASEPATH = "react-preview";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* SPA routing segment for the current window (`react-pages` vs `react-preview`).
|
|
17
|
+
* Call when building navigation targets — not a one-time module-load constant.
|
|
18
|
+
*/
|
|
19
|
+
function getActiveRoutingBasePath() {
|
|
20
|
+
if (typeof window === "undefined") {
|
|
21
|
+
return ROUTING_BASEPATH_PRODUCTION;
|
|
22
|
+
}
|
|
23
|
+
var pathname = window.location.pathname;
|
|
24
|
+
var preview = "/".concat(PREVIEW_ROUTING_BASEPATH);
|
|
25
|
+
var prod = "/".concat(ROUTING_BASEPATH_PRODUCTION);
|
|
26
|
+
if (pathname.includes("".concat(preview, "/")) || pathname.endsWith(preview)) {
|
|
27
|
+
return PREVIEW_ROUTING_BASEPATH;
|
|
28
|
+
}
|
|
29
|
+
if (pathname.includes("".concat(prod, "/")) || pathname.endsWith(prod)) {
|
|
30
|
+
return ROUTING_BASEPATH_PRODUCTION;
|
|
31
|
+
}
|
|
32
|
+
return ROUTING_BASEPATH_PRODUCTION;
|
|
33
|
+
}
|
|
8
34
|
var hyperLinkMofify = exports.hyperLinkMofify = function hyperLinkMofify(link) {
|
|
9
35
|
var hrefLink = "#";
|
|
10
36
|
if (link) {
|
|
11
|
-
var
|
|
37
|
+
var segment = getActiveRoutingBasePath();
|
|
12
38
|
if (/^#/.test(link)) {
|
|
13
39
|
var suffix = link.replace(/^#/, "");
|
|
14
|
-
hrefLink = /^\/.*/.test(suffix) ? "/".concat(
|
|
40
|
+
hrefLink = /^\/.*/.test(suffix) ? "/".concat(segment).concat(suffix) : "/".concat(segment, "/").concat(suffix);
|
|
15
41
|
} else if (/^\//.test(link)) {
|
|
16
|
-
|
|
42
|
+
var normalized = link.replace(new RegExp("^/".concat(ROUTING_BASEPATH_PRODUCTION, "(?=/|$)")), "/".concat(segment)).replace(new RegExp("^/".concat(PREVIEW_ROUTING_BASEPATH, "(?=/|$)")), "/".concat(segment));
|
|
43
|
+
hrefLink = normalized.match(new RegExp("^/".concat(segment, "(/|$)"))) ? normalized : "/".concat(segment).concat(link);
|
|
17
44
|
} else {
|
|
18
45
|
hrefLink = link;
|
|
19
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DateFormatter } from "@wavemaker-ai/variables/src/types/date-formatter";
|
|
2
2
|
import { Formatter } from "./types";
|
|
3
3
|
export declare class DateToStringFormatter implements DateFormatter {
|
|
4
|
-
format(input: Date | string | number | null | undefined, format
|
|
4
|
+
format(input: Date | string | number | null | undefined, format?: string | null): string;
|
|
5
5
|
private tryReconstructDateFromDecimal;
|
|
6
6
|
}
|
|
7
7
|
export declare class TimeFromNowFormatter implements Formatter {
|
|
@@ -9,11 +9,41 @@ exports.TimeFromNowFormatter = exports.DateToStringFormatter = void 0;
|
|
|
9
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var momentLib = _interopRequireWildcard(require("moment-timezone/moment-timezone"));
|
|
12
|
+
var _appstore = _interopRequireDefault(require("../appstore"));
|
|
12
13
|
var _store = require("../../store");
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
14
15
|
// @ts-ignore
|
|
15
16
|
|
|
16
17
|
var moment = momentLib["default"] || window["moment"];
|
|
18
|
+
function resolveDateFormattingLocale() {
|
|
19
|
+
try {
|
|
20
|
+
var _appstore$I18nService, _appstore$I18nService2;
|
|
21
|
+
var fromI18n = (_appstore$I18nService = _appstore["default"].I18nService.get()) === null || _appstore$I18nService === void 0 || (_appstore$I18nService2 = _appstore$I18nService.getSelectedLocale) === null || _appstore$I18nService2 === void 0 ? void 0 : _appstore$I18nService2.call(_appstore$I18nService);
|
|
22
|
+
if (fromI18n != null && String(fromI18n).trim() !== "") {
|
|
23
|
+
return String(fromI18n).replace(/_/g, "-");
|
|
24
|
+
}
|
|
25
|
+
} catch (_unused) {
|
|
26
|
+
/* ignore */
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
var _store$getState;
|
|
30
|
+
var lang = ((_store$getState = _store.store.getState()) === null || _store$getState === void 0 || (_store$getState = _store$getState.info) === null || _store$getState === void 0 || (_store$getState = _store$getState.appConfig) === null || _store$getState === void 0 || (_store$getState = _store$getState.appProperties) === null || _store$getState === void 0 ? void 0 : _store$getState.defaultLanguage) || "en";
|
|
31
|
+
return String(lang).replace(/_/g, "-");
|
|
32
|
+
} catch (_unused2) {
|
|
33
|
+
return "en";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Mirrors Angular DatePipe when format is omitted: default medium date (`DATE_PIPE_DEFAULT_OPTIONS` or `mediumDate`). */
|
|
38
|
+
function formatMediumDateDefault(_moment, localeTag) {
|
|
39
|
+
try {
|
|
40
|
+
return new Intl.DateTimeFormat(localeTag || "en", {
|
|
41
|
+
dateStyle: "medium"
|
|
42
|
+
}).format(_moment.toDate());
|
|
43
|
+
} catch (_unused3) {
|
|
44
|
+
return _moment.isValid() ? _moment.locale(localeTag.split("-")[0] || "en").format("LL") : "";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
17
47
|
var DateToStringFormatter = exports.DateToStringFormatter = /*#__PURE__*/function () {
|
|
18
48
|
function DateToStringFormatter() {
|
|
19
49
|
(0, _classCallCheck2["default"])(this, DateToStringFormatter);
|
|
@@ -22,9 +52,6 @@ var DateToStringFormatter = exports.DateToStringFormatter = /*#__PURE__*/functio
|
|
|
22
52
|
key: "format",
|
|
23
53
|
value: function format(input, _format) {
|
|
24
54
|
if (!input && input !== 0) return "";
|
|
25
|
-
|
|
26
|
-
// Normalize format string
|
|
27
|
-
_format = _format.replaceAll("y", "Y").replaceAll("d", "D").replaceAll("E", "d");
|
|
28
55
|
var _moment;
|
|
29
56
|
|
|
30
57
|
// Handle different input types
|
|
@@ -70,19 +97,17 @@ var DateToStringFormatter = exports.DateToStringFormatter = /*#__PURE__*/functio
|
|
|
70
97
|
if (_format === "UTC") {
|
|
71
98
|
return _moment.isValid() ? moment.utc(_moment).toString() : "";
|
|
72
99
|
}
|
|
100
|
+
var localeTag = resolveDateFormattingLocale();
|
|
73
101
|
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _store$getState;
|
|
78
|
-
defaultLanguage = ((_store$getState = _store.store.getState()) === null || _store$getState === void 0 || (_store$getState = _store$getState.info) === null || _store$getState === void 0 || (_store$getState = _store$getState.appConfig) === null || _store$getState === void 0 || (_store$getState = _store$getState.appProperties) === null || _store$getState === void 0 ? void 0 : _store$getState.defaultLanguage) || "en";
|
|
79
|
-
} catch (error) {
|
|
80
|
-
// Fallback to "en" if store is not available or not properly initialized
|
|
81
|
-
defaultLanguage = "en";
|
|
102
|
+
// Align with Angular ToDatePipe + DatePipe: omitted format → mediumDate-style output (no throw).
|
|
103
|
+
if (_format == null || String(_format).trim() === "") {
|
|
104
|
+
return _moment.isValid() ? formatMediumDateDefault(_moment, localeTag) : "";
|
|
82
105
|
}
|
|
83
106
|
|
|
84
|
-
//
|
|
85
|
-
|
|
107
|
+
// Normalize pattern tokens (moment + Angular-style lowercase tokens); match ng ToDatePipe `replace('a','A')` for am/pm.
|
|
108
|
+
var pattern = String(_format).replaceAll("y", "Y").replaceAll("d", "D").replaceAll("E", "d").replace("a", "A");
|
|
109
|
+
var primaryLang = localeTag.split("-")[0] || "en";
|
|
110
|
+
return _moment.isValid() ? _moment.locale(primaryLang).format(pattern) : "";
|
|
86
111
|
}
|
|
87
112
|
}, {
|
|
88
113
|
key: "tryReconstructDateFromDecimal",
|
|
@@ -29,5 +29,5 @@ export declare enum SecurityContext {
|
|
|
29
29
|
RESOURCE_URL = 5
|
|
30
30
|
}
|
|
31
31
|
export interface DateFormatter {
|
|
32
|
-
format: (input: Date | string | number | null | undefined, format
|
|
32
|
+
format: (input: Date | string | number | null | undefined, format?: string | null) => string;
|
|
33
33
|
}
|
package/core/proxy-service.js
CHANGED
|
@@ -219,6 +219,9 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
219
219
|
if (!(0, _isString["default"])(widgetName)) {
|
|
220
220
|
return widget;
|
|
221
221
|
}
|
|
222
|
+
if (widget == null) {
|
|
223
|
+
return widget;
|
|
224
|
+
}
|
|
222
225
|
var proxy = new Proxy(widget, {
|
|
223
226
|
set: function set(target, prop, value, receiver) {
|
|
224
227
|
// Ignore internal properties
|
|
@@ -374,19 +377,26 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
374
377
|
if (widgetProxies.has(widgetName)) {
|
|
375
378
|
var _proxy = widgetProxies.get(widgetName);
|
|
376
379
|
var originalTarget = originalTargets.get(_proxy);
|
|
380
|
+
var safeWidget = widget != null && (0, _typeof2["default"])(widget) === "object" ? widget : null;
|
|
381
|
+
var safeOriginal = originalTarget != null && (0, _typeof2["default"])(originalTarget) === "object" ? originalTarget : null;
|
|
377
382
|
|
|
378
383
|
// Always sync properties to ensure proxy has latest data
|
|
379
384
|
// This is important when widget was initially created with minimal data
|
|
380
|
-
if (widget !== originalTarget || Object.keys(
|
|
385
|
+
if (safeWidget && safeOriginal && (widget !== originalTarget || Object.keys(safeWidget).length > Object.keys(safeOriginal).length)) {
|
|
381
386
|
// Copy all properties from widget to originalTarget
|
|
382
|
-
for (var key in
|
|
383
|
-
Reflect.defineProperty(
|
|
384
|
-
value:
|
|
387
|
+
for (var key in safeWidget) {
|
|
388
|
+
Reflect.defineProperty(safeOriginal, key, {
|
|
389
|
+
value: safeWidget[key],
|
|
385
390
|
writable: true,
|
|
386
391
|
configurable: true,
|
|
387
392
|
enumerable: true
|
|
388
393
|
});
|
|
389
394
|
}
|
|
395
|
+
// Pin widgetsTarget back to originalTarget so that subsequent GETs within the
|
|
396
|
+
// same synchronous call stack see widget === originalTarget (no re-sync).
|
|
397
|
+
// This prevents the sync from overwriting proxy mutations (e.g. selectedItems
|
|
398
|
+
// set via createWidgetProxy.set) with stale values from widgetsTarget.
|
|
399
|
+
widgetsTarget[widgetName] = safeOriginal;
|
|
390
400
|
}
|
|
391
401
|
return _proxy;
|
|
392
402
|
}
|
|
@@ -491,7 +501,7 @@ var _createStateProxy = exports.createStateProxy = function createStateProxy(obj
|
|
|
491
501
|
if ((0, _dom.isDOMElement)(value)) {
|
|
492
502
|
return value;
|
|
493
503
|
}
|
|
494
|
-
if (value instanceof Map) {
|
|
504
|
+
if (value instanceof Map || value instanceof Date) {
|
|
495
505
|
return value;
|
|
496
506
|
}
|
|
497
507
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface SecurityOptions {
|
|
3
|
+
}
|
|
4
|
+
export interface SecurityService {
|
|
5
|
+
isLoggedIn: Boolean;
|
|
6
|
+
loggedInUser: any;
|
|
7
|
+
login: (options: SecurityOptions, success?: any, failure?: any) => any;
|
|
8
|
+
logout: (options: any, success?: any, failure?: any) => any;
|
|
9
|
+
navigateToLandingPage: (data: any) => any;
|
|
10
|
+
}
|
|
11
|
+
export declare const SecurityProvider: React.Provider<SecurityService>;
|
|
12
|
+
export declare const SecurityConsumer: React.Consumer<SecurityService>;
|
package/core/util/index.js
CHANGED
|
@@ -40,8 +40,9 @@ var MONTHNAMES = exports.MONTHNAMES = ["January", "February", "March", "April",
|
|
|
40
40
|
var checkPublicAccess = exports.checkPublicAccess = function checkPublicAccess(page) {
|
|
41
41
|
var _window$location$path, _store$getState$info$;
|
|
42
42
|
var pageName = page || ((_window$location$path = window.location.pathname) === null || _window$location$path === void 0 ? void 0 : _window$location$path.split("/").at(-1));
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if (!pageName) return false;
|
|
44
|
+
return ((_store$getState$info$ = _store.store.getState().info.appConfig) === null || _store$getState$info$ === void 0 || (_store$getState$info$ = _store$getState$info$.pages) === null || _store$getState$info$ === void 0 || (_store$getState$info$ = _store$getState$info$.find(function (p) {
|
|
45
|
+
return p.name === pageName;
|
|
45
46
|
})) === null || _store$getState$info$ === void 0 ? void 0 : _store$getState$info$.permission) === "PermitAll";
|
|
46
47
|
};
|
|
47
48
|
var setSessionStorageItem = exports.setSessionStorageItem = function setSessionStorageItem(key, value) {
|
package/higherOrder/BaseApp.js
CHANGED
|
@@ -216,8 +216,8 @@ var BaseApp = exports.BaseApp = function BaseApp(WrappedComponent, addAppScript,
|
|
|
216
216
|
function openActionDialog(notification, title) {
|
|
217
217
|
setAppContext(function (prev) {
|
|
218
218
|
if (title) {
|
|
219
|
-
var _prev$
|
|
220
|
-
|
|
219
|
+
var _prev$Widgets, _prev$Widgets$open;
|
|
220
|
+
prev === null || prev === void 0 || (_prev$Widgets = prev.Widgets) === null || _prev$Widgets === void 0 || (_prev$Widgets = _prev$Widgets[title]) === null || _prev$Widgets === void 0 || (_prev$Widgets$open = _prev$Widgets.open) === null || _prev$Widgets$open === void 0 || _prev$Widgets$open.call(_prev$Widgets);
|
|
221
221
|
}
|
|
222
222
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
223
223
|
notification: notification
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ProxyTarget, MockApp, WithPageContextProps, ComponentInfo } from "@wavemaker-ai/react-runtime/types";
|
|
3
|
-
/**
|
|
4
|
-
* Hook to signal that a page component has rendered and is ready.
|
|
5
|
-
* Call this at the top of your page component to trigger startup operations.
|
|
6
|
-
*
|
|
7
|
-
* This ensures widgets have mounted and subscribed before variables are invoked.
|
|
8
|
-
*
|
|
9
|
-
* @param componentName - The unique name of the component (e.g., "ChooseAPlansGrid")
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* import { usePageReady } from '@wavemaker-ai/react-runtime/higherOrder/BasePage';
|
|
13
|
-
*
|
|
14
|
-
* const ChooseAPlansGridComponent = () => {
|
|
15
|
-
* usePageReady("ChooseAPlansGrid"); // Signal ready on mount
|
|
16
|
-
* return <WmPage>...</WmPage>;
|
|
17
|
-
* };
|
|
18
|
-
*/
|
|
19
|
-
export declare const usePageReady: (componentName: string) => void;
|
|
20
3
|
export declare const withPageContext: <P extends object>(WrappedComponent: React.ComponentType<P>, addPageScript: (app: MockApp, pageProxy: ProxyTarget) => void, getVariables: (pageProxy: ProxyTarget) => {
|
|
21
4
|
Variables: Record<string, any>;
|
|
22
5
|
Actions: Record<string, any>;
|