@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
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createVariablesFromJson = createVariablesFromJson;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
|
+
var _variableRegistry = require("./variable-registry");
|
|
13
|
+
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; }
|
|
14
|
+
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; }
|
|
15
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Event handler wiring
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
var EVENT_HANDLER_REGEX = /^(\w+)\(([^)]*)\)$/;
|
|
23
|
+
var RETURN_VALUE_HANDLERS = new Set(["onBeforeUpdate", "onBeforeDatasetReady", "onOnline", "onOffline"]);
|
|
24
|
+
var EVENT_HANDLER_KEYS = new Set(["onSuccess", "onError", "onBeforeUpdate", "onCanUpdate", "onResult", "onBeforeDatasetReady", "onOnline", "onOffline", "onTimerFire"]);
|
|
25
|
+
function wireEventHandlers(config, scopeProxy) {
|
|
26
|
+
var _iterator = _createForOfIteratorHelper(EVENT_HANDLER_KEYS),
|
|
27
|
+
_step;
|
|
28
|
+
try {
|
|
29
|
+
var _loop = function _loop() {
|
|
30
|
+
var key = _step.value;
|
|
31
|
+
var value = config[key];
|
|
32
|
+
if (typeof value !== "string") return 0; // continue
|
|
33
|
+
var match = value.match(EVENT_HANDLER_REGEX);
|
|
34
|
+
if (!match) {
|
|
35
|
+
delete config[key];
|
|
36
|
+
return 0; // continue
|
|
37
|
+
}
|
|
38
|
+
var methodName = match[1];
|
|
39
|
+
var shouldReturn = RETURN_VALUE_HANDLERS.has(key);
|
|
40
|
+
config[key] = function () {
|
|
41
|
+
var fn = scopeProxy === null || scopeProxy === void 0 ? void 0 : scopeProxy[methodName];
|
|
42
|
+
if (typeof fn === "function") {
|
|
43
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
44
|
+
args[_key] = arguments[_key];
|
|
45
|
+
}
|
|
46
|
+
var result = fn.call.apply(fn, [scopeProxy].concat(args));
|
|
47
|
+
if (shouldReturn) return result;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
_ret;
|
|
52
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
53
|
+
_ret = _loop();
|
|
54
|
+
if (_ret === 0) continue;
|
|
55
|
+
}
|
|
56
|
+
} catch (err) {
|
|
57
|
+
_iterator.e(err);
|
|
58
|
+
} finally {
|
|
59
|
+
_iterator.f();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
// isStaticParams — mirrors codegen's isStaticParamsVariable
|
|
65
|
+
// ---------------------------------------------------------------------------
|
|
66
|
+
|
|
67
|
+
function isStaticParams(variable) {
|
|
68
|
+
var db = variable.dataBinding;
|
|
69
|
+
if (!db) return true;
|
|
70
|
+
var entryIsStatic = function entryIsStatic(entry) {
|
|
71
|
+
var v = Array.isArray(entry.value) ? entry.value[0] : entry.value;
|
|
72
|
+
return !v || !(typeof v === "string" && v.startsWith("bind:"));
|
|
73
|
+
};
|
|
74
|
+
if (Array.isArray(db)) return db.every(entryIsStatic);
|
|
75
|
+
if (db && (0, _typeof2["default"])(db) === "object") {
|
|
76
|
+
return Object.values(db).every(function (opBindings) {
|
|
77
|
+
return Array.isArray(opBindings) ? opBindings.every(entryIsStatic) : true;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ---------------------------------------------------------------------------
|
|
84
|
+
// paramProvider builder
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
|
|
87
|
+
function buildParamProvider(variable) {
|
|
88
|
+
var dataSet = variable.dataSet;
|
|
89
|
+
if (variable.isList && Array.isArray(dataSet)) {
|
|
90
|
+
return function () {
|
|
91
|
+
return (0, _toConsumableArray2["default"])(dataSet);
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
var params = {};
|
|
95
|
+
var dataBinding = variable.dataBinding;
|
|
96
|
+
if (Array.isArray(dataBinding)) {
|
|
97
|
+
var _iterator2 = _createForOfIteratorHelper(dataBinding),
|
|
98
|
+
_step2;
|
|
99
|
+
try {
|
|
100
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
101
|
+
var binding = _step2.value;
|
|
102
|
+
if (binding.target) params[binding.target] = binding.value;
|
|
103
|
+
}
|
|
104
|
+
} catch (err) {
|
|
105
|
+
_iterator2.e(err);
|
|
106
|
+
} finally {
|
|
107
|
+
_iterator2.f();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (dataSet && !Array.isArray(dataSet) && (0, _typeof2["default"])(dataSet) === "object") {
|
|
111
|
+
for (var _i = 0, _Object$entries = Object.entries(dataSet); _i < _Object$entries.length; _i++) {
|
|
112
|
+
var _Object$entries$_i = (0, _slicedToArray2["default"])(_Object$entries[_i], 2),
|
|
113
|
+
key = _Object$entries$_i[0],
|
|
114
|
+
value = _Object$entries$_i[1];
|
|
115
|
+
if (!(key in params)) params[key] = value;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (variable.pageName && !params["pageName"]) {
|
|
119
|
+
params["pageName"] = variable.pageName;
|
|
120
|
+
}
|
|
121
|
+
return function () {
|
|
122
|
+
return _objectSpread({}, params);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// ---------------------------------------------------------------------------
|
|
127
|
+
// Per-category config enhancers (DRY replacement for if-chains)
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
var NAVIGATION_CATEGORIES = new Set(["wm.NavigationAction", "wm.NavigationVariable"]);
|
|
131
|
+
var NOTIFICATION_CATEGORIES = new Set(["wm.NotificationAction", "wm.NotificationVariable"]);
|
|
132
|
+
var AUTH_CATEGORIES = new Set(["wm.LoginAction", "wm.LoginVariable", "wm.LogoutAction", "wm.LogoutVariable"]);
|
|
133
|
+
var enhanceNavigation = function enhanceNavigation(config, _variable, scopeProxy) {
|
|
134
|
+
config.appConfig = scopeProxy.appConfig;
|
|
135
|
+
};
|
|
136
|
+
var enhanceNotification = function enhanceNotification(config, variable, scopeProxy) {
|
|
137
|
+
config.toasterService = function () {
|
|
138
|
+
return scopeProxy.toaster;
|
|
139
|
+
};
|
|
140
|
+
config.onOk = config.onOk || function () {};
|
|
141
|
+
config.onClose = config.onClose || function () {};
|
|
142
|
+
var operation = variable.operation;
|
|
143
|
+
if (operation === "alert" || operation === "confirm") {
|
|
144
|
+
var widgetName = "Common".concat(operation.charAt(0).toUpperCase() + operation.slice(1), "Dialog");
|
|
145
|
+
config.showDialog = function (options) {
|
|
146
|
+
var _scopeProxy$App, _scopeProxy$App$openA;
|
|
147
|
+
scopeProxy === null || scopeProxy === void 0 || (_scopeProxy$App = scopeProxy.App) === null || _scopeProxy$App === void 0 || (_scopeProxy$App$openA = _scopeProxy$App.openActionDialog) === null || _scopeProxy$App$openA === void 0 || _scopeProxy$App$openA.call(_scopeProxy$App, options, widgetName);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
var dataBindings = variable.dataBinding;
|
|
151
|
+
var pageBinding = dataBindings === null || dataBindings === void 0 ? void 0 : dataBindings.find(function (b) {
|
|
152
|
+
return b.target === "page";
|
|
153
|
+
});
|
|
154
|
+
if (pageBinding !== null && pageBinding !== void 0 && pageBinding.value) {
|
|
155
|
+
var partialName = pageBinding.value.charAt(0).toUpperCase() + pageBinding.value.slice(1);
|
|
156
|
+
config.partialContent = {
|
|
157
|
+
component: (0, _variableRegistry.createLazyPartial)(partialName)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
var enhanceAuth = function enhanceAuth(config, variable, scopeProxy) {
|
|
162
|
+
var _scopeProxy$appConfig, _variable$useDefaultS;
|
|
163
|
+
config.baseURL = (_scopeProxy$appConfig = scopeProxy.appConfig) === null || _scopeProxy$appConfig === void 0 ? void 0 : _scopeProxy$appConfig.url;
|
|
164
|
+
config.securityService = function () {
|
|
165
|
+
var _scopeProxy$appConfig2;
|
|
166
|
+
return (_scopeProxy$appConfig2 = scopeProxy.appConfig) === null || _scopeProxy$appConfig2 === void 0 ? void 0 : _scopeProxy$appConfig2.SecurityService;
|
|
167
|
+
};
|
|
168
|
+
config.useDefaultSuccessHandler = (_variable$useDefaultS = variable.useDefaultSuccessHandler) !== null && _variable$useDefaultS !== void 0 ? _variable$useDefaultS : true;
|
|
169
|
+
};
|
|
170
|
+
var enhanceServiceVariable = function enhanceServiceVariable(config, variable, scopeProxy) {
|
|
171
|
+
var _config$isStaticParam;
|
|
172
|
+
config.baseUrl = scopeProxy.baseUrl + "/services";
|
|
173
|
+
config.getServiceInfo = function () {
|
|
174
|
+
var _scopeProxy$serviceDe;
|
|
175
|
+
return (_scopeProxy$serviceDe = scopeProxy.serviceDefinitions) === null || _scopeProxy$serviceDe === void 0 || (_scopeProxy$serviceDe = _scopeProxy$serviceDe[variable.operationId]) === null || _scopeProxy$serviceDe === void 0 ? void 0 : _scopeProxy$serviceDe.wmServiceOperationInfo;
|
|
176
|
+
};
|
|
177
|
+
(_config$isStaticParam = config.isStaticParams) !== null && _config$isStaticParam !== void 0 ? _config$isStaticParam : config.isStaticParams = isStaticParams(variable);
|
|
178
|
+
};
|
|
179
|
+
var enhanceLiveVariable = function enhanceLiveVariable(config, variable, scopeProxy) {
|
|
180
|
+
var _config$isStaticParam2;
|
|
181
|
+
if (!config.operation) config.operation = "read";
|
|
182
|
+
if (!config.propertiesMap) config.propertiesMap = {
|
|
183
|
+
columns: []
|
|
184
|
+
};
|
|
185
|
+
if (!config.relatedTables) config.relatedTables = [];
|
|
186
|
+
config.baseUrl = scopeProxy.baseUrl;
|
|
187
|
+
(_config$isStaticParam2 = config.isStaticParams) !== null && _config$isStaticParam2 !== void 0 ? _config$isStaticParam2 : config.isStaticParams = isStaticParams(variable);
|
|
188
|
+
};
|
|
189
|
+
var enhanceCrudVariable = function enhanceCrudVariable(config, variable, scopeProxy) {
|
|
190
|
+
var _config$isStaticParam3;
|
|
191
|
+
config.baseUrl = scopeProxy.baseUrl;
|
|
192
|
+
(_config$isStaticParam3 = config.isStaticParams) !== null && _config$isStaticParam3 !== void 0 ? _config$isStaticParam3 : config.isStaticParams = isStaticParams(variable);
|
|
193
|
+
};
|
|
194
|
+
function getEnhancer(category) {
|
|
195
|
+
if (NAVIGATION_CATEGORIES.has(category)) return enhanceNavigation;
|
|
196
|
+
if (NOTIFICATION_CATEGORIES.has(category)) return enhanceNotification;
|
|
197
|
+
if (AUTH_CATEGORIES.has(category)) return enhanceAuth;
|
|
198
|
+
switch (category) {
|
|
199
|
+
case "wm.ServiceVariable":
|
|
200
|
+
return enhanceServiceVariable;
|
|
201
|
+
case "wm.LiveVariable":
|
|
202
|
+
return enhanceLiveVariable;
|
|
203
|
+
case "wm.CrudVariable":
|
|
204
|
+
return enhanceCrudVariable;
|
|
205
|
+
default:
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// ---------------------------------------------------------------------------
|
|
211
|
+
// Config builder
|
|
212
|
+
// ---------------------------------------------------------------------------
|
|
213
|
+
|
|
214
|
+
function buildInstanceConfig(variable, scopeProxy) {
|
|
215
|
+
var config = _objectSpread(_objectSpread({}, variable), {}, {
|
|
216
|
+
_context: scopeProxy,
|
|
217
|
+
paramProvider: variable.name === "loggedInUser" ? function () {
|
|
218
|
+
var _scopeProxy$appConfig3;
|
|
219
|
+
return (_scopeProxy$appConfig3 = scopeProxy.appConfig) === null || _scopeProxy$appConfig3 === void 0 ? void 0 : _scopeProxy$appConfig3.loggedInUser;
|
|
220
|
+
} : buildParamProvider(variable)
|
|
221
|
+
});
|
|
222
|
+
wireEventHandlers(config, scopeProxy);
|
|
223
|
+
var enhancer = getEnhancer(variable.category);
|
|
224
|
+
if (enhancer) enhancer(config, variable, scopeProxy);
|
|
225
|
+
return config;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ---------------------------------------------------------------------------
|
|
229
|
+
// Public API
|
|
230
|
+
// ---------------------------------------------------------------------------
|
|
231
|
+
|
|
232
|
+
function createVariablesFromJson(rawVariables, scopeProxy) {
|
|
233
|
+
if (!rawVariables || Object.keys(rawVariables).length === 0) return _variableRegistry.EMPTY_RESULT;
|
|
234
|
+
var Variables = {};
|
|
235
|
+
var Actions = {};
|
|
236
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(rawVariables); _i2 < _Object$entries2.length; _i2++) {
|
|
237
|
+
var _Object$entries2$_i = (0, _slicedToArray2["default"])(_Object$entries2[_i2], 2),
|
|
238
|
+
key = _Object$entries2$_i[0],
|
|
239
|
+
value = _Object$entries2$_i[1];
|
|
240
|
+
var _variable2 = value;
|
|
241
|
+
var category = _variable2.category;
|
|
242
|
+
var Ctor = _variableRegistry.CATEGORY_TO_CONSTRUCTOR[category];
|
|
243
|
+
if (!Ctor) continue;
|
|
244
|
+
try {
|
|
245
|
+
var _config = buildInstanceConfig(_variable2, scopeProxy);
|
|
246
|
+
var instance = new Ctor(_config);
|
|
247
|
+
if (_variableRegistry.ACTION_CATEGORIES.has(category)) {
|
|
248
|
+
Actions[key] = instance;
|
|
249
|
+
} else {
|
|
250
|
+
Variables[key] = instance;
|
|
251
|
+
}
|
|
252
|
+
} catch (err) {
|
|
253
|
+
console.error("[variable-factory] Failed to create \"".concat(key, "\" (").concat(category, "):"), err);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
Variables: Variables,
|
|
258
|
+
Actions: Actions
|
|
259
|
+
};
|
|
260
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type ConstructorClass = new (config: any) => any;
|
|
3
|
+
export declare const CATEGORY_TO_CONSTRUCTOR: Record<string, ConstructorClass>;
|
|
4
|
+
export declare const ACTION_CATEGORIES: Set<string>;
|
|
5
|
+
export declare const SCOPE_MAP: Record<string, unknown>;
|
|
6
|
+
export interface VariablesResult {
|
|
7
|
+
Variables: Record<string, unknown>;
|
|
8
|
+
Actions: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export declare const EMPTY_RESULT: VariablesResult;
|
|
11
|
+
export declare function createLazyPartial(partialName: string): React.LazyExoticComponent<React.ComponentType<any>>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SCOPE_MAP = exports.EMPTY_RESULT = exports.CATEGORY_TO_CONSTRUCTOR = exports.ACTION_CATEGORIES = void 0;
|
|
9
|
+
exports.createLazyPartial = createLazyPartial;
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _modelVariable = require("@wavemaker-ai/react-runtime/variables/model-variable");
|
|
14
|
+
var _serviceVariable = require("@wavemaker-ai/react-runtime/variables/service-variable");
|
|
15
|
+
var _liveVariable = _interopRequireDefault(require("@wavemaker-ai/react-runtime/variables/live-variable"));
|
|
16
|
+
var _crudVariable = _interopRequireDefault(require("@wavemaker-ai/react-runtime/variables/crud-variable"));
|
|
17
|
+
var _navigationAction = require("@wavemaker-ai/react-runtime/actions/navigation-action");
|
|
18
|
+
var _notificationAction = require("@wavemaker-ai/react-runtime/actions/notification-action");
|
|
19
|
+
var _timerAction = require("@wavemaker-ai/react-runtime/actions/timer-action");
|
|
20
|
+
var _loginAction = require("@wavemaker-ai/react-runtime/actions/login-action");
|
|
21
|
+
var _logoutAction = require("@wavemaker-ai/react-runtime/actions/logout-action");
|
|
22
|
+
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); }
|
|
23
|
+
var CATEGORY_TO_CONSTRUCTOR = exports.CATEGORY_TO_CONSTRUCTOR = {
|
|
24
|
+
"wm.Variable": _modelVariable.ModelVariable,
|
|
25
|
+
"wm.ServiceVariable": _serviceVariable.ServiceVariable,
|
|
26
|
+
"wm.LiveVariable": _liveVariable["default"],
|
|
27
|
+
"wm.CrudVariable": _crudVariable["default"],
|
|
28
|
+
"wm.NavigationAction": _navigationAction.NavigationAction,
|
|
29
|
+
"wm.NavigationVariable": _navigationAction.NavigationAction,
|
|
30
|
+
"wm.NotificationAction": _notificationAction.NotificationAction,
|
|
31
|
+
"wm.NotificationVariable": _notificationAction.NotificationAction,
|
|
32
|
+
"wm.TimerAction": _timerAction.TimerAction,
|
|
33
|
+
"wm.TimerVariable": _timerAction.TimerAction,
|
|
34
|
+
"wm.LoginAction": _loginAction.LoginAction,
|
|
35
|
+
"wm.LoginVariable": _loginAction.LoginAction,
|
|
36
|
+
"wm.LogoutAction": _logoutAction.LogoutAction,
|
|
37
|
+
"wm.LogoutVariable": _logoutAction.LogoutAction
|
|
38
|
+
};
|
|
39
|
+
var ACTION_CATEGORIES = exports.ACTION_CATEGORIES = new Set(["wm.NavigationAction", "wm.NavigationVariable", "wm.NotificationAction", "wm.NotificationVariable", "wm.TimerAction", "wm.TimerVariable", "wm.LoginAction", "wm.LoginVariable", "wm.LogoutAction", "wm.LogoutVariable"]);
|
|
40
|
+
var SCOPE_MAP = exports.SCOPE_MAP = {
|
|
41
|
+
React: _react["default"],
|
|
42
|
+
ModelVariable: _modelVariable.ModelVariable,
|
|
43
|
+
ServiceVariable: _serviceVariable.ServiceVariable,
|
|
44
|
+
LiveVariable: _liveVariable["default"],
|
|
45
|
+
CrudVariable: _crudVariable["default"],
|
|
46
|
+
NavigationAction: _navigationAction.NavigationAction,
|
|
47
|
+
NotificationAction: _notificationAction.NotificationAction,
|
|
48
|
+
TimerAction: _timerAction.TimerAction,
|
|
49
|
+
LoginAction: _loginAction.LoginAction,
|
|
50
|
+
LogoutAction: _logoutAction.LogoutAction
|
|
51
|
+
};
|
|
52
|
+
var EMPTY_RESULT = exports.EMPTY_RESULT = {
|
|
53
|
+
Variables: {},
|
|
54
|
+
Actions: {}
|
|
55
|
+
};
|
|
56
|
+
function createLazyPartial(partialName) {
|
|
57
|
+
return /*#__PURE__*/(0, _react.lazy)(/*#__PURE__*/(0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
58
|
+
var _yield$import, getComponentFromCache, setComponentInCache, _yield$import2, FType, _yield$import3, getComponentRef, _yield$import4, buildBasePageLikeComponent, cached, fragment, Built;
|
|
59
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
60
|
+
while (1) switch (_context.prev = _context.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
_context.next = 2;
|
|
63
|
+
return Promise.resolve().then(function () {
|
|
64
|
+
return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/services/cache"));
|
|
65
|
+
});
|
|
66
|
+
case 2:
|
|
67
|
+
_yield$import = _context.sent;
|
|
68
|
+
getComponentFromCache = _yield$import.getComponentFromCache;
|
|
69
|
+
setComponentInCache = _yield$import.setComponentInCache;
|
|
70
|
+
_context.next = 7;
|
|
71
|
+
return Promise.resolve().then(function () {
|
|
72
|
+
return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/services/fragment-url"));
|
|
73
|
+
});
|
|
74
|
+
case 7:
|
|
75
|
+
_yield$import2 = _context.sent;
|
|
76
|
+
FType = _yield$import2.ComponentType;
|
|
77
|
+
_context.next = 11;
|
|
78
|
+
return Promise.resolve().then(function () {
|
|
79
|
+
return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/services/component-ref-provider"));
|
|
80
|
+
});
|
|
81
|
+
case 11:
|
|
82
|
+
_yield$import3 = _context.sent;
|
|
83
|
+
getComponentRef = _yield$import3.getComponentRef;
|
|
84
|
+
_context.next = 15;
|
|
85
|
+
return Promise.resolve().then(function () {
|
|
86
|
+
return _interopRequireWildcard(require("@wavemaker-ai/react-runtime/runtime-dynamic/factories/build-base-page-like-component"));
|
|
87
|
+
});
|
|
88
|
+
case 15:
|
|
89
|
+
_yield$import4 = _context.sent;
|
|
90
|
+
buildBasePageLikeComponent = _yield$import4.buildBasePageLikeComponent;
|
|
91
|
+
cached = getComponentFromCache(FType.PARTIAL, partialName);
|
|
92
|
+
if (!cached) {
|
|
93
|
+
_context.next = 20;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return _context.abrupt("return", {
|
|
97
|
+
"default": cached
|
|
98
|
+
});
|
|
99
|
+
case 20:
|
|
100
|
+
_context.next = 22;
|
|
101
|
+
return getComponentRef(partialName, FType.PARTIAL);
|
|
102
|
+
case 22:
|
|
103
|
+
fragment = _context.sent;
|
|
104
|
+
_context.next = 25;
|
|
105
|
+
return buildBasePageLikeComponent("partial", partialName, fragment);
|
|
106
|
+
case 25:
|
|
107
|
+
Built = _context.sent;
|
|
108
|
+
setComponentInCache(FType.PARTIAL, partialName, Built);
|
|
109
|
+
return _context.abrupt("return", {
|
|
110
|
+
"default": Built
|
|
111
|
+
});
|
|
112
|
+
case 28:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context.stop();
|
|
115
|
+
}
|
|
116
|
+
}, _callee);
|
|
117
|
+
})));
|
|
118
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type VariablesResult } from "./variable-registry";
|
|
2
|
+
type GetVariablesFn = (pageProxy: unknown) => VariablesResult;
|
|
3
|
+
export declare function clearVariablesCache(): void;
|
|
4
|
+
export declare function transpileAndBuildGetVariables(variablesCodeString: string, rawVariables: Record<string, unknown>): GetVariablesFn;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.clearVariablesCache = clearVariablesCache;
|
|
8
|
+
exports.transpileAndBuildGetVariables = transpileAndBuildGetVariables;
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
var _sucrase = require("sucrase");
|
|
14
|
+
var _variableRegistry = require("./variable-registry");
|
|
15
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
16
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
17
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Entity provider shims (injects getEntityPropertyMap / getEntityRelatedTables)
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
function buildEntityProviderShims(rawVariables) {
|
|
25
|
+
var entityMap = new Map();
|
|
26
|
+
for (var _i = 0, _Object$values = Object.values(rawVariables || {}); _i < _Object$values.length; _i++) {
|
|
27
|
+
var config = _Object$values[_i];
|
|
28
|
+
var v = config;
|
|
29
|
+
if (!v.liveSource || !v.type || !v.propertiesMap) continue;
|
|
30
|
+
var key = "".concat(v.liveSource, "::").concat(v.type);
|
|
31
|
+
if (!entityMap.has(key)) {
|
|
32
|
+
entityMap.set(key, {
|
|
33
|
+
propertiesMap: v.propertiesMap,
|
|
34
|
+
relatedTables: v.relatedTables || []
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
getEntityPropertyMap: function getEntityPropertyMap(liveSource, entityName) {
|
|
40
|
+
var _entityMap$get;
|
|
41
|
+
return (_entityMap$get = entityMap.get("".concat(liveSource, "::").concat(entityName))) === null || _entityMap$get === void 0 ? void 0 : _entityMap$get.propertiesMap;
|
|
42
|
+
},
|
|
43
|
+
getEntityRelatedTables: function getEntityRelatedTables(liveSource, entityName) {
|
|
44
|
+
var _entityMap$get2;
|
|
45
|
+
return (_entityMap$get2 = entityMap.get("".concat(liveSource, "::").concat(entityName))) === null || _entityMap$get2 === void 0 ? void 0 : _entityMap$get2.relatedTables;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Code preprocessing
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
var IMPORT_STATEMENT_REGEX = /import\s+[\s\S]*?\s+from\s+['"][^'"]+['"];?/g;
|
|
55
|
+
var EXPORT_DEFAULT_REGEX = /^\s*export\s+default\s+/m;
|
|
56
|
+
var PARTIAL_IMPORT_REGEX = /import\s+(\w+)\s+from\s+['"]@\/app\/components\/[^'"]+['"];?/g;
|
|
57
|
+
function extractPartialImports(code) {
|
|
58
|
+
var names = [];
|
|
59
|
+
var match;
|
|
60
|
+
while ((match = PARTIAL_IMPORT_REGEX.exec(code)) !== null) {
|
|
61
|
+
names.push(match[1]);
|
|
62
|
+
}
|
|
63
|
+
PARTIAL_IMPORT_REGEX.lastIndex = 0;
|
|
64
|
+
return names;
|
|
65
|
+
}
|
|
66
|
+
function preprocessVariablesCode(code) {
|
|
67
|
+
return code.replace(IMPORT_STATEMENT_REGEX, "").replace(EXPORT_DEFAULT_REGEX, "return ");
|
|
68
|
+
}
|
|
69
|
+
function compileTypeScript(code) {
|
|
70
|
+
var wrapped = "function __variableFactory__() {\n".concat(code, "\n}");
|
|
71
|
+
var result = (0, _sucrase.transform)(wrapped, {
|
|
72
|
+
transforms: ["typescript"]
|
|
73
|
+
});
|
|
74
|
+
return "".concat(result.code, "\nreturn __variableFactory__();");
|
|
75
|
+
}
|
|
76
|
+
function tryCompileVariableFactory(preprocessed) {
|
|
77
|
+
try {
|
|
78
|
+
return compileTypeScript(preprocessed);
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.error("[variable-transpiler] Compilation failed:", err);
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function tryConstructVariableFactory(scopeNames, compiled) {
|
|
85
|
+
try {
|
|
86
|
+
return (0, _construct2["default"])(Function, (0, _toConsumableArray2["default"])(scopeNames).concat([compiled]));
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.error("[variable-transpiler] Function construction failed:", err);
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
// Cache
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
var variablesCache = new Map();
|
|
98
|
+
function clearVariablesCache() {
|
|
99
|
+
variablesCache.clear();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ---------------------------------------------------------------------------
|
|
103
|
+
// Public API
|
|
104
|
+
// ---------------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
function transpileAndBuildGetVariables(variablesCodeString, rawVariables) {
|
|
107
|
+
if (!(variablesCodeString !== null && variablesCodeString !== void 0 && variablesCodeString.trim())) return function () {
|
|
108
|
+
return _variableRegistry.EMPTY_RESULT;
|
|
109
|
+
};
|
|
110
|
+
var cached = variablesCache.get(variablesCodeString);
|
|
111
|
+
if (cached) return cached;
|
|
112
|
+
var _buildEntityProviderS = buildEntityProviderShims(rawVariables),
|
|
113
|
+
getEntityPropertyMap = _buildEntityProviderS.getEntityPropertyMap,
|
|
114
|
+
getEntityRelatedTables = _buildEntityProviderS.getEntityRelatedTables;
|
|
115
|
+
var scopeWithShims = _objectSpread(_objectSpread({}, _variableRegistry.SCOPE_MAP), {}, {
|
|
116
|
+
getEntityPropertyMap: getEntityPropertyMap,
|
|
117
|
+
getEntityRelatedTables: getEntityRelatedTables
|
|
118
|
+
});
|
|
119
|
+
var _iterator = _createForOfIteratorHelper(extractPartialImports(variablesCodeString)),
|
|
120
|
+
_step;
|
|
121
|
+
try {
|
|
122
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
123
|
+
var name = _step.value;
|
|
124
|
+
scopeWithShims[name] = (0, _variableRegistry.createLazyPartial)(name);
|
|
125
|
+
}
|
|
126
|
+
} catch (err) {
|
|
127
|
+
_iterator.e(err);
|
|
128
|
+
} finally {
|
|
129
|
+
_iterator.f();
|
|
130
|
+
}
|
|
131
|
+
var scopeNames = Object.keys(scopeWithShims);
|
|
132
|
+
var scopeValues = Object.values(scopeWithShims);
|
|
133
|
+
var preprocessed = preprocessVariablesCode(variablesCodeString);
|
|
134
|
+
var compiled = tryCompileVariableFactory(preprocessed);
|
|
135
|
+
if (!compiled) return function () {
|
|
136
|
+
return _variableRegistry.EMPTY_RESULT;
|
|
137
|
+
};
|
|
138
|
+
var factoryBuilder = tryConstructVariableFactory(scopeNames, compiled);
|
|
139
|
+
if (!factoryBuilder) return function () {
|
|
140
|
+
return _variableRegistry.EMPTY_RESULT;
|
|
141
|
+
};
|
|
142
|
+
var getVariablesFn;
|
|
143
|
+
try {
|
|
144
|
+
getVariablesFn = factoryBuilder.apply(void 0, scopeValues);
|
|
145
|
+
} catch (err) {
|
|
146
|
+
console.error("[variable-transpiler] Factory execution failed:", err);
|
|
147
|
+
return function () {
|
|
148
|
+
return _variableRegistry.EMPTY_RESULT;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
if (typeof getVariablesFn !== "function") {
|
|
152
|
+
console.error("[variable-transpiler] Expected a function, got:", (0, _typeof2["default"])(getVariablesFn));
|
|
153
|
+
return function () {
|
|
154
|
+
return _variableRegistry.EMPTY_RESULT;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
variablesCache.set(variablesCodeString, getVariablesFn);
|
|
158
|
+
return getVariablesFn;
|
|
159
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shim for next/image in the dynamic preview runtime (non-Next.js).
|
|
3
|
+
* Renders a standard <img> element with the same props.
|
|
4
|
+
*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
interface ImageSrc {
|
|
7
|
+
src: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
}
|
|
11
|
+
interface ImageProps {
|
|
12
|
+
src: string | ImageSrc;
|
|
13
|
+
alt?: string;
|
|
14
|
+
width?: number | string;
|
|
15
|
+
height?: number | string;
|
|
16
|
+
fill?: boolean;
|
|
17
|
+
loader?: (params: {
|
|
18
|
+
src: string;
|
|
19
|
+
width: number;
|
|
20
|
+
quality?: number;
|
|
21
|
+
}) => string;
|
|
22
|
+
quality?: number;
|
|
23
|
+
priority?: boolean;
|
|
24
|
+
loading?: "lazy" | "eager";
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
blurDataURL?: string;
|
|
27
|
+
unoptimized?: boolean;
|
|
28
|
+
onLoad?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
|
|
29
|
+
onError?: (event: React.SyntheticEvent<HTMLImageElement>) => void;
|
|
30
|
+
style?: React.CSSProperties;
|
|
31
|
+
className?: string;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
declare function NextImage({ src, alt, width, height, fill, loader: _loader, quality: _quality, priority, loading, placeholder: _placeholder, blurDataURL: _blurDataURL, unoptimized: _unoptimized, ...rest }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
export default NextImage;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _excluded = ["src", "alt", "width", "height", "fill", "loader", "quality", "priority", "loading", "placeholder", "blurDataURL", "unoptimized"];
|
|
13
|
+
/**
|
|
14
|
+
* Shim for next/image in the dynamic preview runtime (non-Next.js).
|
|
15
|
+
* Renders a standard <img> element with the same props.
|
|
16
|
+
*/
|
|
17
|
+
var __jsx = _react["default"].createElement;
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
function NextImage(_ref) {
|
|
21
|
+
var src = _ref.src,
|
|
22
|
+
_ref$alt = _ref.alt,
|
|
23
|
+
alt = _ref$alt === void 0 ? "" : _ref$alt,
|
|
24
|
+
width = _ref.width,
|
|
25
|
+
height = _ref.height,
|
|
26
|
+
fill = _ref.fill,
|
|
27
|
+
_loader = _ref.loader,
|
|
28
|
+
_quality = _ref.quality,
|
|
29
|
+
priority = _ref.priority,
|
|
30
|
+
loading = _ref.loading,
|
|
31
|
+
_placeholder = _ref.placeholder,
|
|
32
|
+
_blurDataURL = _ref.blurDataURL,
|
|
33
|
+
_unoptimized = _ref.unoptimized,
|
|
34
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
35
|
+
var imgSrc = (0, _typeof2["default"])(src) === "object" ? src.src : src;
|
|
36
|
+
var imgWidth = width !== null && width !== void 0 ? width : (0, _typeof2["default"])(src) === "object" ? src.width : undefined;
|
|
37
|
+
var imgHeight = height !== null && height !== void 0 ? height : (0, _typeof2["default"])(src) === "object" ? src.height : undefined;
|
|
38
|
+
var resolvedStyle = _objectSpread({}, rest.style || {});
|
|
39
|
+
if (fill) {
|
|
40
|
+
resolvedStyle.position = "absolute";
|
|
41
|
+
resolvedStyle.width = "100%";
|
|
42
|
+
resolvedStyle.height = "100%";
|
|
43
|
+
resolvedStyle.objectFit = resolvedStyle.objectFit || "cover";
|
|
44
|
+
}
|
|
45
|
+
return (
|
|
46
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
47
|
+
__jsx("img", {
|
|
48
|
+
src: imgSrc,
|
|
49
|
+
alt: alt,
|
|
50
|
+
width: fill ? undefined : imgWidth,
|
|
51
|
+
height: fill ? undefined : imgHeight,
|
|
52
|
+
loading: priority ? "eager" : loading || "lazy",
|
|
53
|
+
style: resolvedStyle,
|
|
54
|
+
className: rest.className,
|
|
55
|
+
onLoad: rest.onLoad,
|
|
56
|
+
onError: rest.onError
|
|
57
|
+
})
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
var _default = exports["default"] = NextImage;
|