@wavemaker/react-runtime 11.14.2-rc.6311 → 12.0.0-next.28533
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.js +5 -7
- package/actions/login-action.js +7 -8
- package/actions/logout-action.js +5 -7
- package/actions/navigation-action.js +32 -10
- package/actions/notification-action.js +22 -8
- package/actions/timer-action.js +13 -15
- package/actions/toast.js +4 -2
- package/actions/toast.service.js +1 -2
- package/components/advanced/carousel/index.js +1 -1
- package/components/advanced/carousel/template.js +1 -1
- package/components/basic/anchor/index.js +26 -9
- package/components/basic/html/index.js +115 -24
- package/components/basic/icon/index.js +2 -1
- package/components/basic/iframe/index.js +2 -1
- package/components/basic/label/index.js +12 -9
- package/components/basic/message/index.js +12 -3
- package/components/basic/picture/index.js +11 -4
- package/components/basic/progress-bar/index.js +1 -1
- package/components/basic/progress-circle/index.js +34 -28
- package/components/basic/progress-circle/props.js +10 -2
- package/components/basic/richtexteditor/index.js +95 -94
- package/components/basic/search/index.js +401 -156
- package/components/basic/search/providers.js +126 -61
- package/components/basic/spinner/index.js +2 -1
- package/components/basic/tree/index.js +34 -34
- package/components/basic/tree/utils.js +10 -4
- package/components/chart/components/barColumnChart/index.js +36 -33
- package/components/chart/components/bubbleChart/index.js +35 -25
- package/components/chart/components/chartLegend/utils.js +2 -1
- package/components/chart/components/cumulativeLineChart/index.js +30 -26
- package/components/chart/components/lineAreaChart/index.js +50 -32
- package/components/chart/components/pieDonutChart/index.js +13 -4
- package/components/chart/hooks/useXAxisConfig.js +15 -8
- package/components/chart/index.js +223 -53
- package/components/chart/utils.js +12 -1
- package/components/constants.js +5 -2
- package/components/container/accordion/accordion-pane/index.js +17 -12
- package/components/container/accordion/index.js +9 -4
- package/components/container/alignment-utils.js +56 -1
- package/components/container/index.js +49 -20
- package/components/container/panel/components/panel-header/index.js +3 -4
- package/components/container/panel/index.js +15 -10
- package/components/container/tabs/index.js +92 -14
- package/components/container/tabs/tab-pane/index.js +15 -8
- package/components/container/tabs/utils.js +51 -0
- package/components/container/wizard/components/StepComponents.js +2 -1
- package/components/container/wizard/components/WizardStep.js +2 -1
- package/components/container/wizard/index.js +64 -35
- package/components/container/wizard/utils.js +46 -1
- package/components/container/wizard/wizard-step/index.js +11 -1
- package/components/data/card/card-content/index.js +1 -1
- package/components/data/form/base-form/index.js +991 -180
- package/components/data/form/base-form/props.js +3 -1
- package/components/data/form/base-form/utils.js +159 -1
- package/components/data/form/dynamic-fields/constant.js +53 -0
- package/components/data/form/dynamic-fields/index.js +10 -45
- package/components/data/form/dynamic-fields/utils.js +37 -2
- package/components/data/form/form-action/index.js +5 -4
- package/components/data/form/form-context.js +5 -1
- package/components/data/form/form-controller/utils.js +84 -0
- package/components/data/form/form-controller/validation-contrustor.js +402 -189
- package/components/data/form/form-controller/withFormController.js +191 -52
- package/components/data/form/form-field/base-field.js +54 -33
- package/components/data/form/form-field/index.js +28 -5
- package/components/data/form/form-header/index.js +3 -4
- package/components/data/form/index.js +20 -1
- package/components/data/list/components/ListDND.js +2 -1
- package/components/data/list/components/ListItem.js +6 -2
- package/components/data/list/components/ListItemWithTemplate.js +46 -2
- package/components/data/list/components/ListItems.js +17 -26
- package/components/data/list/components/ListPagination.js +3 -3
- package/components/data/list/components/StandardListItems.js +3 -4
- package/components/data/list/hooks/useListEffects.js +55 -14
- package/components/data/list/hooks/useListEventHandlers.js +3 -1
- package/components/data/list/hooks/useListState.js +3 -1
- package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
- package/components/data/list/index.js +74 -55
- package/components/data/list/utils/list-helpers.js +73 -35
- package/components/data/list/utils/list-widget-methods.js +138 -95
- package/components/data/live-filter/index.js +26 -15
- package/components/data/live-form/index.js +23 -7
- package/components/data/live-form/props.js +1 -1
- package/components/data/pagination/components/BasicPagination.js +71 -16
- package/components/data/pagination/components/PageSizeSelector.js +8 -3
- package/components/data/pagination/components/TotalRecords.js +1 -5
- package/components/data/pagination/hooks/usePagination.js +349 -66
- package/components/data/pagination/index.js +137 -19
- package/components/data/table/components/AddNewRow.js +5 -1
- package/components/data/table/components/EditableCell.js +2 -2
- package/components/data/table/components/RowCells.js +64 -0
- package/components/data/table/components/RowExpansionButton.js +2 -2
- package/components/data/table/components/SummaryCell.js +111 -0
- package/components/data/table/components/SummaryRow.js +54 -0
- package/components/data/table/components/SummaryRowFooter.js +46 -0
- package/components/data/table/components/TableBody.js +61 -59
- package/components/data/table/components/TableDataRow.js +109 -0
- package/components/data/table/components/TableFilters.js +225 -121
- package/components/data/table/components/TableHeader.js +291 -23
- package/components/data/table/components/TablePanelHeading.js +139 -8
- package/components/data/table/components/index.js +22 -1
- package/components/data/table/hooks/use-edited-rows.js +141 -0
- package/components/data/table/hooks/useCellState.js +5 -12
- package/components/data/table/hooks/useFormWidget.js +58 -51
- package/components/data/table/hooks/usePaginationState.js +45 -24
- package/components/data/table/hooks/usePanelStructure.js +4 -4
- package/components/data/table/hooks/useRowHandlers.js +39 -5
- package/components/data/table/hooks/useRowSelection.js +244 -50
- package/components/data/table/hooks/useServerSideSorting.js +81 -37
- package/components/data/table/hooks/useTableColumns.js +211 -118
- package/components/data/table/hooks/useTableData.js +54 -9
- package/components/data/table/hooks/useTableEdit.js +272 -97
- package/components/data/table/hooks/useTableEffects.js +31 -13
- package/components/data/table/hooks/useTableFilter.js +1 -1
- package/components/data/table/hooks/useTableInitialization.js +23 -22
- package/components/data/table/hooks/useTableState.js +11 -5
- package/components/data/table/hooks/useTableStateManager.js +140 -65
- package/components/data/table/index.js +637 -274
- package/components/data/table/live-table/index.js +54 -22
- package/components/data/table/table-action/index.js +1 -1
- package/components/data/table/table-group/index.js +26 -0
- package/components/data/table/table-row-action/index.js +32 -18
- package/components/data/table/utils/buildSelectionColumns.js +12 -21
- package/components/data/table/utils/columnBuilder.js +29 -14
- package/components/data/table/utils/columnProxy.js +68 -1
- package/components/data/table/utils/constants.js +6 -2
- package/components/data/table/utils/crud-handlers.js +68 -63
- package/components/data/table/utils/groupHeaderUtils.js +102 -0
- package/components/data/table/utils/index.js +210 -21
- package/components/data/table/utils/renderDisplayCell.js +6 -6
- package/components/data/table/utils/selectionUtils.js +25 -26
- package/components/data/table/utils/validation.js +1 -0
- package/components/data/utils/filter-field-util.js +3 -3
- package/components/dialogs/alert-dialog/index.js +1 -1
- package/components/dialogs/confirm-dialog/index.js +1 -1
- package/components/dialogs/dialog/index.js +4 -1
- package/components/dialogs/dialog-content/index.js +3 -1
- package/components/dialogs/dialog-header/index.js +2 -2
- package/components/dialogs/iframe-dialog/index.js +11 -5
- package/components/dialogs/index.js +1 -1
- package/components/dialogs/login-dialog/index.js +1 -1
- package/components/dialogs/page-dialog/index.js +1 -1
- package/components/form/button/index.js +33 -7
- package/components/input/calendar/index.js +18 -6
- package/components/input/chips/index.js +99 -28
- package/components/input/chips/utils.js +34 -4
- package/components/input/color-picker/index.js +74 -25
- package/components/input/composite/index.js +3 -3
- package/components/input/currency/index.js +35 -49
- package/components/input/default/checkbox/index.js +23 -28
- package/components/input/default/checkboxset/index.js +38 -18
- package/components/input/default/checkboxset/utils.js +30 -0
- package/components/input/default/radioset/index.js +36 -39
- package/components/input/default/switch/index.js +30 -13
- package/components/input/epoch/date/index.js +130 -69
- package/components/input/epoch/date/utils.js +94 -1
- package/components/input/epoch/datetime/index.js +72 -22
- package/components/input/epoch/datetime/utils.js +49 -10
- package/components/input/epoch/time/index.js +68 -19
- package/components/input/epoch/time/utils.js +62 -14
- package/components/input/fileupload/Utils.js +12 -7
- package/components/input/fileupload/components/MultiUpload.js +2 -6
- package/components/input/fileupload/components/SingleUpload.js +3 -7
- package/components/input/fileupload/index.js +6 -10
- package/components/input/fileupload/useFileUpload.js +16 -5
- package/components/input/number/index.js +158 -43
- package/components/input/rating/index.js +90 -7
- package/components/input/select/index.js +147 -70
- package/components/input/slider/index.js +84 -26
- package/components/input/text/index.js +38 -18
- package/components/input/text/util.js +283 -130
- package/components/input/textarea/index.js +13 -10
- package/components/input/upload/index.js +124 -0
- package/components/input/upload/props.js +5 -0
- package/components/input/util/index.js +11 -0
- package/components/navbar/index.js +51 -3
- package/components/navbar/nav/index.js +46 -16
- package/components/navbar/nav-item/index.js +11 -5
- package/components/navigation/menu/components/ListItems.js +3 -0
- package/components/navigation/menu/constants.js +2 -1
- package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
- package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
- package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
- package/components/navigation/menu/index.js +326 -188
- package/components/navigation/menu/utils/action-task.js +14 -0
- package/components/navigation/menu/utils/role-filter.js +76 -0
- package/components/navigation/popover/index.js +99 -26
- package/components/page/partial-container/index.js +34 -5
- package/components/prefab/index.js +2 -4
- package/context/PrefabContext.js +10 -6
- package/context/WidgetProvider.js +30 -31
- package/core/app.service.js +1 -1
- package/core/constants/events.js +57 -1
- package/core/dialog.service.js +1 -2
- package/core/event-notifier.js +1 -2
- package/core/formatter/array-formatters.js +33 -0
- package/core/formatter/date-formatters.js +2 -4
- package/core/formatter/index.js +2 -1
- package/core/formatter/number-formatters.js +5 -10
- package/core/formatter/security-formatters.js +2 -4
- package/core/formatter/string-formatters.js +3 -6
- package/core/proxy-service.js +84 -13
- package/core/script-registry.js +108 -48
- package/core/util/common.js +4 -4
- package/core/util/compare.js +30 -0
- package/core/util/dom.js +8 -8
- package/core/util/index.js +16 -6
- package/core/util/safe-is-equal.js +156 -0
- package/core/util/security.js +1 -2
- package/core/util/utils.js +16 -7
- package/higherOrder/BaseApp.js +108 -65
- package/higherOrder/BaseDateTime.js +31 -13
- package/higherOrder/BasePage.js +268 -144
- package/higherOrder/BasePartial.js +1 -1
- package/higherOrder/BasePrefab.js +33 -15
- package/higherOrder/DataNav.js +99 -16
- package/higherOrder/helper.js +5 -0
- package/higherOrder/withBaseWrapper.js +41 -28
- package/hooks/useAuth.js +11 -5
- package/hooks/useHttp.js +280 -94
- package/mui-config/theme-provider.js +1 -1
- package/mui-config/theme.js +1 -1
- package/package-lock.json +824 -724
- package/package.json +8 -8
- package/store/bindActions/i18nActions.js +18 -0
- package/store/index.js +3 -1
- package/store/slices/appConfigSlice.js +2 -2
- package/store/slices/authSlice.js +31 -28
- package/store/slices/i18nSlice.js +2 -2
- package/store/slices/navigationSlice.js +35 -0
- package/store/viewport.service.js +255 -0
- package/utils/attr.js +35 -0
- package/utils/dataset-util.js +1 -2
- package/utils/form-state.util.js +43 -12
- package/utils/form-utils.js +47 -2
- package/utils/format-util.js +28 -13
- package/utils/page-params-util.js +33 -1
- package/utils/state-persistance.js +72 -13
- package/utils/transformedDataset-utils.js +35 -24
- package/variables/base-variable.js +12 -14
- package/variables/crud-variable.js +225 -0
- package/variables/live-variable.js +56 -20
- package/variables/metadata.service.js +123 -0
- package/variables/model-variable.js +21 -15
- package/variables/service-variable.js +88 -83
package/core/constants/events.js
CHANGED
|
@@ -8,9 +8,15 @@ exports.EVENTEMITTER_METHODS = void 0;
|
|
|
8
8
|
var _events = _interopRequireDefault(require("events"));
|
|
9
9
|
var partialStateSyncEmitter = new _events["default"]();
|
|
10
10
|
var prefabStateSyncEmitter = new _events["default"]();
|
|
11
|
+
var childFormEmitter = new _events["default"]();
|
|
11
12
|
var EVENTEMITTER = {
|
|
12
13
|
PARTIAL_STATE_SYNC: "partial-state-sync",
|
|
13
|
-
PREFAB_STATE_SYNC: "prefab-state-sync"
|
|
14
|
+
PREFAB_STATE_SYNC: "prefab-state-sync",
|
|
15
|
+
CHILD_FORM_RELATIONSHIP: "child-form-relationship",
|
|
16
|
+
CHILD_FORM_DATA_UPDATE: "child-form-data-update",
|
|
17
|
+
CHILD_FORM_UNREGISTER: "child-form-unregister",
|
|
18
|
+
PARENT_FORM_EXTERNAL_DATA_CHANGE: "parent-form-external-data-change",
|
|
19
|
+
CHILD_FORM_FIELD_REGISTER: "child-form-field-register"
|
|
14
20
|
};
|
|
15
21
|
var EVENTEMITTER_METHODS = exports.EVENTEMITTER_METHODS = {
|
|
16
22
|
PREFAB_STATE_SYNC_ON: function PREFAB_STATE_SYNC_ON() {
|
|
@@ -36,5 +42,55 @@ var EVENTEMITTER_METHODS = exports.EVENTEMITTER_METHODS = {
|
|
|
36
42
|
},
|
|
37
43
|
PARTIAL_STATE_SYNC_EMIT: function PARTIAL_STATE_SYNC_EMIT(data) {
|
|
38
44
|
return partialStateSyncEmitter.emit(EVENTEMITTER.PARTIAL_STATE_SYNC, data);
|
|
45
|
+
},
|
|
46
|
+
// Consolidated bidirectional relationship management
|
|
47
|
+
CHILD_FORM_RELATIONSHIP_ON: function CHILD_FORM_RELATIONSHIP_ON(formName, callback) {
|
|
48
|
+
var isParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
49
|
+
var widgetId = arguments.length > 3 ? arguments[3] : undefined;
|
|
50
|
+
var isRegistration = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
51
|
+
// For registration events, parent listens without widget ID, child listens with widget ID
|
|
52
|
+
var eventName = isParent ? isRegistration ? "".concat(EVENTEMITTER.CHILD_FORM_RELATIONSHIP, "_").concat(formName, "_parent") : "".concat(EVENTEMITTER.CHILD_FORM_RELATIONSHIP, "_").concat(formName).concat(widgetId ? "_".concat(widgetId) : "", "_parent") : "".concat(EVENTEMITTER.CHILD_FORM_RELATIONSHIP, "_").concat(formName).concat(widgetId ? "_".concat(widgetId) : "", "_child");
|
|
53
|
+
childFormEmitter.on(eventName, callback);
|
|
54
|
+
return function () {
|
|
55
|
+
return childFormEmitter.off(eventName, callback);
|
|
56
|
+
};
|
|
57
|
+
},
|
|
58
|
+
CHILD_FORM_RELATIONSHIP_EMIT: function CHILD_FORM_RELATIONSHIP_EMIT(formName, data) {
|
|
59
|
+
var isParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
60
|
+
var widgetId = arguments.length > 3 ? arguments[3] : undefined;
|
|
61
|
+
var isRegistration = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
62
|
+
// For registration events, child emits without widget ID, parent emits with child's widget ID
|
|
63
|
+
var eventName = isParent ? isRegistration ? "".concat(EVENTEMITTER.CHILD_FORM_RELATIONSHIP, "_").concat(formName, "_parent") : "".concat(EVENTEMITTER.CHILD_FORM_RELATIONSHIP, "_").concat(formName).concat(widgetId ? "_".concat(widgetId) : "", "_parent") : "".concat(EVENTEMITTER.CHILD_FORM_RELATIONSHIP, "_").concat(formName).concat(widgetId ? "_".concat(widgetId) : "", "_child");
|
|
64
|
+
return childFormEmitter.emit(eventName, data);
|
|
65
|
+
},
|
|
66
|
+
// Data update events (kept separate as they have different flow)
|
|
67
|
+
CHILD_FORM_DATA_UPDATE_ON: function CHILD_FORM_DATA_UPDATE_ON(parentFormName, callback) {
|
|
68
|
+
childFormEmitter.on("".concat(EVENTEMITTER.CHILD_FORM_DATA_UPDATE, "_").concat(parentFormName), callback);
|
|
69
|
+
return function () {
|
|
70
|
+
return childFormEmitter.off("".concat(EVENTEMITTER.CHILD_FORM_DATA_UPDATE, "_").concat(parentFormName), callback);
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
CHILD_FORM_DATA_UPDATE_EMIT: function CHILD_FORM_DATA_UPDATE_EMIT(parentFormName, data) {
|
|
74
|
+
return childFormEmitter.emit("".concat(EVENTEMITTER.CHILD_FORM_DATA_UPDATE, "_").concat(parentFormName), data);
|
|
75
|
+
},
|
|
76
|
+
// External data changes (kept separate as it's broadcast)
|
|
77
|
+
PARENT_FORM_EXTERNAL_DATA_CHANGE_ON: function PARENT_FORM_EXTERNAL_DATA_CHANGE_ON(callback) {
|
|
78
|
+
childFormEmitter.on(EVENTEMITTER.PARENT_FORM_EXTERNAL_DATA_CHANGE, callback);
|
|
79
|
+
return function () {
|
|
80
|
+
childFormEmitter.off(EVENTEMITTER.PARENT_FORM_EXTERNAL_DATA_CHANGE, callback);
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
PARENT_FORM_EXTERNAL_DATA_CHANGE_EMIT: function PARENT_FORM_EXTERNAL_DATA_CHANGE_EMIT(data) {
|
|
84
|
+
return childFormEmitter.emit(EVENTEMITTER.PARENT_FORM_EXTERNAL_DATA_CHANGE, data);
|
|
85
|
+
},
|
|
86
|
+
// Child form field registration events (for prefab forms with parent forms)
|
|
87
|
+
CHILD_FORM_FIELD_REGISTER_ON: function CHILD_FORM_FIELD_REGISTER_ON(parentFormName, callback) {
|
|
88
|
+
childFormEmitter.on("".concat(EVENTEMITTER.CHILD_FORM_FIELD_REGISTER, "_").concat(parentFormName), callback);
|
|
89
|
+
return function () {
|
|
90
|
+
return childFormEmitter.off("".concat(EVENTEMITTER.CHILD_FORM_FIELD_REGISTER, "_").concat(parentFormName), callback);
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
CHILD_FORM_FIELD_REGISTER_EMIT: function CHILD_FORM_FIELD_REGISTER_EMIT(parentFormName, data) {
|
|
94
|
+
return childFormEmitter.emit("".concat(EVENTEMITTER.CHILD_FORM_FIELD_REGISTER, "_").concat(parentFormName), data);
|
|
39
95
|
}
|
|
40
96
|
};
|
package/core/dialog.service.js
CHANGED
|
@@ -13,7 +13,7 @@ var DialogService = /*#__PURE__*/function () {
|
|
|
13
13
|
(0, _classCallCheck2["default"])(this, DialogService);
|
|
14
14
|
(0, _defineProperty2["default"])(this, "dialogs", new Map());
|
|
15
15
|
}
|
|
16
|
-
(0, _createClass2["default"])(DialogService, [{
|
|
16
|
+
return (0, _createClass2["default"])(DialogService, [{
|
|
17
17
|
key: "registerDialog",
|
|
18
18
|
value: function registerDialog(name, dialogInstance) {
|
|
19
19
|
this.dialogs.set(name, dialogInstance);
|
|
@@ -70,7 +70,6 @@ var DialogService = /*#__PURE__*/function () {
|
|
|
70
70
|
this.dialogs.clear();
|
|
71
71
|
}
|
|
72
72
|
}]);
|
|
73
|
-
return DialogService;
|
|
74
73
|
}(); // Create a singleton instance
|
|
75
74
|
var dialogService = new DialogService();
|
|
76
75
|
var _default = exports["default"] = dialogService;
|
package/core/event-notifier.js
CHANGED
|
@@ -20,7 +20,7 @@ var EventNotifier = exports["default"] = /*#__PURE__*/function () {
|
|
|
20
20
|
(0, _defineProperty2["default"])(this, "parent", EventNotifier.ROOT);
|
|
21
21
|
(0, _defineProperty2["default"])(this, "children", []);
|
|
22
22
|
}
|
|
23
|
-
(0, _createClass2["default"])(EventNotifier, [{
|
|
23
|
+
return (0, _createClass2["default"])(EventNotifier, [{
|
|
24
24
|
key: "setParent",
|
|
25
25
|
value: function setParent(parent) {
|
|
26
26
|
if (parent !== this.parent) {
|
|
@@ -122,7 +122,6 @@ var EventNotifier = exports["default"] = /*#__PURE__*/function () {
|
|
|
122
122
|
this.listeners = {};
|
|
123
123
|
}
|
|
124
124
|
}]);
|
|
125
|
-
return EventNotifier;
|
|
126
125
|
}();
|
|
127
126
|
_EventNotifier = EventNotifier;
|
|
128
127
|
(0, _defineProperty2["default"])(EventNotifier, "ROOT", new _EventNotifier());
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FilterFormatter = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _isObject = _interopRequireDefault(require("lodash-es/isObject"));
|
|
11
|
+
var _includes = _interopRequireDefault(require("lodash-es/includes"));
|
|
12
|
+
var _filter = _interopRequireDefault(require("lodash-es/filter"));
|
|
13
|
+
var FilterFormatter = exports.FilterFormatter = /*#__PURE__*/function () {
|
|
14
|
+
function FilterFormatter() {
|
|
15
|
+
(0, _classCallCheck2["default"])(this, FilterFormatter);
|
|
16
|
+
}
|
|
17
|
+
return (0, _createClass2["default"])(FilterFormatter, [{
|
|
18
|
+
key: "format",
|
|
19
|
+
value: function format(data, field, value) {
|
|
20
|
+
if (!data) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
// If object is passed as first parameter
|
|
24
|
+
if ((0, _isObject["default"])(field)) {
|
|
25
|
+
return (0, _filter["default"])(data, field);
|
|
26
|
+
}
|
|
27
|
+
// If key value pair is provided
|
|
28
|
+
return (0, _filter["default"])(data, function (item) {
|
|
29
|
+
return (0, _includes["default"])(item[field], value);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}]);
|
|
33
|
+
}();
|
|
@@ -18,7 +18,7 @@ var DateToStringFormatter = exports.DateToStringFormatter = /*#__PURE__*/functio
|
|
|
18
18
|
function DateToStringFormatter() {
|
|
19
19
|
(0, _classCallCheck2["default"])(this, DateToStringFormatter);
|
|
20
20
|
}
|
|
21
|
-
(0, _createClass2["default"])(DateToStringFormatter, [{
|
|
21
|
+
return (0, _createClass2["default"])(DateToStringFormatter, [{
|
|
22
22
|
key: "format",
|
|
23
23
|
value: function format(input, _format) {
|
|
24
24
|
if (!input && input !== 0) return "";
|
|
@@ -196,13 +196,12 @@ var DateToStringFormatter = exports.DateToStringFormatter = /*#__PURE__*/functio
|
|
|
196
196
|
return null; // Couldn't reconstruct a valid date
|
|
197
197
|
}
|
|
198
198
|
}]);
|
|
199
|
-
return DateToStringFormatter;
|
|
200
199
|
}();
|
|
201
200
|
var TimeFromNowFormatter = exports.TimeFromNowFormatter = /*#__PURE__*/function () {
|
|
202
201
|
function TimeFromNowFormatter() {
|
|
203
202
|
(0, _classCallCheck2["default"])(this, TimeFromNowFormatter);
|
|
204
203
|
}
|
|
205
|
-
(0, _createClass2["default"])(TimeFromNowFormatter, [{
|
|
204
|
+
return (0, _createClass2["default"])(TimeFromNowFormatter, [{
|
|
206
205
|
key: "format",
|
|
207
206
|
value: function format(timestamp) {
|
|
208
207
|
if (!timestamp && timestamp !== 0) return "";
|
|
@@ -218,5 +217,4 @@ var TimeFromNowFormatter = exports.TimeFromNowFormatter = /*#__PURE__*/function
|
|
|
218
217
|
return _moment.isValid() ? _moment.fromNow() : "";
|
|
219
218
|
}
|
|
220
219
|
}]);
|
|
221
|
-
return TimeFromNowFormatter;
|
|
222
220
|
}();
|
package/core/formatter/index.js
CHANGED
|
@@ -73,6 +73,7 @@ Object.keys(_securityFormatters).forEach(function (key) {
|
|
|
73
73
|
}
|
|
74
74
|
});
|
|
75
75
|
});
|
|
76
|
+
var _arrayFormatters = require("./array-formatters");
|
|
76
77
|
// Export all types
|
|
77
78
|
|
|
78
79
|
// Export all formatters
|
|
@@ -99,7 +100,7 @@ var formatters = new Map([
|
|
|
99
100
|
// String formatters
|
|
100
101
|
["prefix", createFormatter("prefix", new _stringFormatters.PrependFormatter())], ["suffix", createFormatter("suffix", new _stringFormatters.AppendFormatter())], ["templateReplace", createFormatter("templateReplace", new _stringFormatters.TemplateReplaceFormatter())],
|
|
101
102
|
// Security formatters
|
|
102
|
-
["trustAs", createFormatter("trustAs", new _securityFormatters.TrustAsFormatter())], ["sanitize", createFormatter("sanitize", new _securityFormatters.SanitizeFormatter())]]);
|
|
103
|
+
["trustAs", createFormatter("trustAs", new _securityFormatters.TrustAsFormatter())], ["sanitize", createFormatter("sanitize", new _securityFormatters.SanitizeFormatter())], ["filter", createFormatter("filter", new _arrayFormatters.FilterFormatter())]]);
|
|
103
104
|
|
|
104
105
|
// Export the formatters registry
|
|
105
106
|
var _default = exports["default"] = formatters; // Export utility functions
|
|
@@ -14,7 +14,7 @@ var NumberToStringFormatter = exports.NumberToStringFormatter = /*#__PURE__*/fun
|
|
|
14
14
|
function NumberToStringFormatter() {
|
|
15
15
|
(0, _classCallCheck2["default"])(this, NumberToStringFormatter);
|
|
16
16
|
}
|
|
17
|
-
(0, _createClass2["default"])(NumberToStringFormatter, [{
|
|
17
|
+
return (0, _createClass2["default"])(NumberToStringFormatter, [{
|
|
18
18
|
key: "format",
|
|
19
19
|
value: function format(input, fractionSize) {
|
|
20
20
|
var i18nService = _appstore["default"].I18nService.get();
|
|
@@ -26,13 +26,12 @@ var NumberToStringFormatter = exports.NumberToStringFormatter = /*#__PURE__*/fun
|
|
|
26
26
|
return isNaN(input) ? "" : formatCurrency.format(input);
|
|
27
27
|
}
|
|
28
28
|
}]);
|
|
29
|
-
return NumberToStringFormatter;
|
|
30
29
|
}();
|
|
31
30
|
var CurrencyFormatter = exports.CurrencyFormatter = /*#__PURE__*/function () {
|
|
32
31
|
function CurrencyFormatter() {
|
|
33
32
|
(0, _classCallCheck2["default"])(this, CurrencyFormatter);
|
|
34
33
|
}
|
|
35
|
-
(0, _createClass2["default"])(CurrencyFormatter, [{
|
|
34
|
+
return (0, _createClass2["default"])(CurrencyFormatter, [{
|
|
36
35
|
key: "format",
|
|
37
36
|
value: function format(data, currencySymbol, fracSize) {
|
|
38
37
|
var _currencySymbol = (_currencyConstant["default"][currencySymbol] || {}).symbol || currencySymbol || "";
|
|
@@ -44,25 +43,23 @@ var CurrencyFormatter = exports.CurrencyFormatter = /*#__PURE__*/function () {
|
|
|
44
43
|
return _val ? isNegativeNumber ? "-" + _currencySymbol + _val : _currencySymbol + _val : "";
|
|
45
44
|
}
|
|
46
45
|
}]);
|
|
47
|
-
return CurrencyFormatter;
|
|
48
46
|
}();
|
|
49
47
|
var StringToNumberFormatter = exports.StringToNumberFormatter = /*#__PURE__*/function () {
|
|
50
48
|
function StringToNumberFormatter() {
|
|
51
49
|
(0, _classCallCheck2["default"])(this, StringToNumberFormatter);
|
|
52
50
|
}
|
|
53
|
-
(0, _createClass2["default"])(StringToNumberFormatter, [{
|
|
51
|
+
return (0, _createClass2["default"])(StringToNumberFormatter, [{
|
|
54
52
|
key: "format",
|
|
55
53
|
value: function format(input) {
|
|
56
54
|
return (0, _parseInt["default"])(input);
|
|
57
55
|
}
|
|
58
56
|
}]);
|
|
59
|
-
return StringToNumberFormatter;
|
|
60
57
|
}();
|
|
61
58
|
var ToNumberFormatter = exports.ToNumberFormatter = /*#__PURE__*/function () {
|
|
62
59
|
function ToNumberFormatter() {
|
|
63
60
|
(0, _classCallCheck2["default"])(this, ToNumberFormatter);
|
|
64
61
|
}
|
|
65
|
-
(0, _createClass2["default"])(ToNumberFormatter, [{
|
|
62
|
+
return (0, _createClass2["default"])(ToNumberFormatter, [{
|
|
66
63
|
key: "format",
|
|
67
64
|
value: function format(data, fracSize) {
|
|
68
65
|
if (isNaN(+data)) {
|
|
@@ -104,13 +101,12 @@ var ToNumberFormatter = exports.ToNumberFormatter = /*#__PURE__*/function () {
|
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
}]);
|
|
107
|
-
return ToNumberFormatter;
|
|
108
104
|
}();
|
|
109
105
|
var TrailingZeroDecimalFormatter = exports.TrailingZeroDecimalFormatter = /*#__PURE__*/function () {
|
|
110
106
|
function TrailingZeroDecimalFormatter() {
|
|
111
107
|
(0, _classCallCheck2["default"])(this, TrailingZeroDecimalFormatter);
|
|
112
108
|
}
|
|
113
|
-
(0, _createClass2["default"])(TrailingZeroDecimalFormatter, [{
|
|
109
|
+
return (0, _createClass2["default"])(TrailingZeroDecimalFormatter, [{
|
|
114
110
|
key: "format",
|
|
115
111
|
value: function format(value, selectedLocale, numberFilter, localeFilter, trailingZero, decimalValue, skipTrailingZeroCheck, formattedLocale) {
|
|
116
112
|
var finalNumberFilter = trailingZero && !skipTrailingZeroCheck ? "1.".concat((decimalValue === null || decimalValue === void 0 ? void 0 : decimalValue.length) || 0, "-16") : numberFilter;
|
|
@@ -138,5 +134,4 @@ var TrailingZeroDecimalFormatter = exports.TrailingZeroDecimalFormatter = /*#__P
|
|
|
138
134
|
}
|
|
139
135
|
}
|
|
140
136
|
}]);
|
|
141
|
-
return TrailingZeroDecimalFormatter;
|
|
142
137
|
}();
|
|
@@ -18,7 +18,7 @@ var TrustAsFormatter = exports.TrustAsFormatter = /*#__PURE__*/function () {
|
|
|
18
18
|
function TrustAsFormatter() {
|
|
19
19
|
(0, _classCallCheck2["default"])(this, TrustAsFormatter);
|
|
20
20
|
}
|
|
21
|
-
(0, _createClass2["default"])(TrustAsFormatter, [{
|
|
21
|
+
return (0, _createClass2["default"])(TrustAsFormatter, [{
|
|
22
22
|
key: "format",
|
|
23
23
|
value: function format(content) {
|
|
24
24
|
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "html";
|
|
@@ -138,13 +138,12 @@ var TrustAsFormatter = exports.TrustAsFormatter = /*#__PURE__*/function () {
|
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
140
|
}]);
|
|
141
|
-
return TrustAsFormatter;
|
|
142
141
|
}();
|
|
143
142
|
var SanitizeFormatter = exports.SanitizeFormatter = /*#__PURE__*/function () {
|
|
144
143
|
function SanitizeFormatter() {
|
|
145
144
|
(0, _classCallCheck2["default"])(this, SanitizeFormatter);
|
|
146
145
|
}
|
|
147
|
-
(0, _createClass2["default"])(SanitizeFormatter, [{
|
|
146
|
+
return (0, _createClass2["default"])(SanitizeFormatter, [{
|
|
148
147
|
key: "format",
|
|
149
148
|
value: function format(input) {
|
|
150
149
|
var sanitizeType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "html";
|
|
@@ -287,7 +286,6 @@ var SanitizeFormatter = exports.SanitizeFormatter = /*#__PURE__*/function () {
|
|
|
287
286
|
}
|
|
288
287
|
}
|
|
289
288
|
}]);
|
|
290
|
-
return SanitizeFormatter;
|
|
291
289
|
}(); // React utility component to safely render trusted content
|
|
292
290
|
var TrustedContent = exports.TrustedContent = function TrustedContent(_ref) {
|
|
293
291
|
var value = _ref.value,
|
|
@@ -12,31 +12,29 @@ var PrependFormatter = exports.PrependFormatter = /*#__PURE__*/function () {
|
|
|
12
12
|
function PrependFormatter() {
|
|
13
13
|
(0, _classCallCheck2["default"])(this, PrependFormatter);
|
|
14
14
|
}
|
|
15
|
-
(0, _createClass2["default"])(PrependFormatter, [{
|
|
15
|
+
return (0, _createClass2["default"])(PrependFormatter, [{
|
|
16
16
|
key: "format",
|
|
17
17
|
value: function format(input, prefix) {
|
|
18
18
|
return (prefix || "") + (input !== null || input != undefined ? input : "");
|
|
19
19
|
}
|
|
20
20
|
}]);
|
|
21
|
-
return PrependFormatter;
|
|
22
21
|
}();
|
|
23
22
|
var AppendFormatter = exports.AppendFormatter = /*#__PURE__*/function () {
|
|
24
23
|
function AppendFormatter() {
|
|
25
24
|
(0, _classCallCheck2["default"])(this, AppendFormatter);
|
|
26
25
|
}
|
|
27
|
-
(0, _createClass2["default"])(AppendFormatter, [{
|
|
26
|
+
return (0, _createClass2["default"])(AppendFormatter, [{
|
|
28
27
|
key: "format",
|
|
29
28
|
value: function format(input, suffix) {
|
|
30
29
|
return (input !== null || input != undefined ? input : "") + (suffix || "");
|
|
31
30
|
}
|
|
32
31
|
}]);
|
|
33
|
-
return AppendFormatter;
|
|
34
32
|
}();
|
|
35
33
|
var TemplateReplaceFormatter = exports.TemplateReplaceFormatter = /*#__PURE__*/function () {
|
|
36
34
|
function TemplateReplaceFormatter() {
|
|
37
35
|
(0, _classCallCheck2["default"])(this, TemplateReplaceFormatter);
|
|
38
36
|
}
|
|
39
|
-
(0, _createClass2["default"])(TemplateReplaceFormatter, [{
|
|
37
|
+
return (0, _createClass2["default"])(TemplateReplaceFormatter, [{
|
|
40
38
|
key: "format",
|
|
41
39
|
value: function format(template, replacements) {
|
|
42
40
|
if (!template) return template;
|
|
@@ -48,5 +46,4 @@ var TemplateReplaceFormatter = exports.TemplateReplaceFormatter = /*#__PURE__*/f
|
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
}]);
|
|
51
|
-
return TemplateReplaceFormatter;
|
|
52
49
|
}();
|
package/core/proxy-service.js
CHANGED
|
@@ -8,9 +8,12 @@ exports.createWidgetProxy = exports.createStateProxy = exports.createPageProxy =
|
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _scriptRegistry = require("@wavemaker/react-runtime/core/script-registry");
|
|
12
11
|
var _dom = require("@wavemaker/react-runtime/core/util/dom");
|
|
13
12
|
var _widgetObserver = require("@wavemaker/react-runtime/core/widget-observer");
|
|
13
|
+
var _serviceVariable = require("../variables/service-variable");
|
|
14
|
+
var _events = require("../core/constants/events");
|
|
15
|
+
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
16
|
+
var _liveVariable = _interopRequireDefault(require("../variables/live-variable"));
|
|
14
17
|
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; }
|
|
15
18
|
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; }
|
|
16
19
|
// WeakMap to store proxy flags without exposing them as props
|
|
@@ -19,6 +22,9 @@ var proxyMap = new WeakMap();
|
|
|
19
22
|
// Store the original target for each proxy
|
|
20
23
|
var originalTargets = new WeakMap();
|
|
21
24
|
|
|
25
|
+
// Store previous formdata values to detect changes
|
|
26
|
+
var previousFormData = new WeakMap();
|
|
27
|
+
|
|
22
28
|
// Array methods that mutate the array and should trigger updates
|
|
23
29
|
var MUTATING_ARRAY_METHODS = ["push", "pop", "shift", "unshift", "splice", "sort", "reverse", "fill", "copyWithin", "put"];
|
|
24
30
|
|
|
@@ -129,7 +135,7 @@ var createStateArrayProxy = function createStateArrayProxy(array, path, propName
|
|
|
129
135
|
proxyMap.set(arrayProxy, true);
|
|
130
136
|
return arrayProxy;
|
|
131
137
|
};
|
|
132
|
-
var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(widget, widgetName, setPageContext) {
|
|
138
|
+
var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry) {
|
|
133
139
|
// If widget is already a proxy or is a DOM element, return it directly
|
|
134
140
|
if (proxyMap.has(widget) || (0, _dom.isDOMElement)(widget)) {
|
|
135
141
|
return widget;
|
|
@@ -147,10 +153,34 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
147
153
|
return true;
|
|
148
154
|
}
|
|
149
155
|
|
|
156
|
+
// Special handling for formdata changes - emit parent form change event
|
|
157
|
+
// Only emit for widgets that are likely forms and have meaningful data changes
|
|
158
|
+
if (prop === "formdata") {
|
|
159
|
+
var prevData = previousFormData.get(target);
|
|
160
|
+
var hasChanged = value && (!prevData || !(0, _isEqual["default"])(prevData, value));
|
|
161
|
+
|
|
162
|
+
// Only emit if there's a meaningful change (not null/undefined to null/undefined)
|
|
163
|
+
if (hasChanged && (value || prevData)) {
|
|
164
|
+
// Update stored previous value
|
|
165
|
+
previousFormData.set(target, value);
|
|
166
|
+
|
|
167
|
+
// Emit parent form external data change event
|
|
168
|
+
// This will be received by child forms listening for their parent changes
|
|
169
|
+
_events.EVENTEMITTER_METHODS.PARENT_FORM_EXTERNAL_DATA_CHANGE_EMIT({
|
|
170
|
+
parentFormName: widgetName,
|
|
171
|
+
formData: value,
|
|
172
|
+
timestamp: Date.now()
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
150
177
|
// track script-modified properties
|
|
151
178
|
if (typeof prop === "string") {
|
|
152
179
|
var widgetId = widget["data-widget-id"];
|
|
153
|
-
|
|
180
|
+
// Use page-specific registry if provided, otherwise fallback to global
|
|
181
|
+
if (overriddenPropsRegistry && typeof overriddenPropsRegistry.trackOverriddenProps === "function") {
|
|
182
|
+
overriddenPropsRegistry.trackOverriddenProps(widgetName, prop, value, widgetId);
|
|
183
|
+
}
|
|
154
184
|
}
|
|
155
185
|
Reflect.set(target, prop, value, receiver);
|
|
156
186
|
setPageContext(function (prevContext) {
|
|
@@ -167,6 +197,10 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
167
197
|
}
|
|
168
198
|
// If widget-id doesn't match, don't update context
|
|
169
199
|
return prevContext;
|
|
200
|
+
} else {
|
|
201
|
+
return _objectSpread(_objectSpread({}, prevContext), {}, {
|
|
202
|
+
Widgets: _objectSpread(_objectSpread({}, prevContext.Widgets), {}, (0, _defineProperty2["default"])({}, widgetName, _objectSpread(_objectSpread({}, prevContext.Widgets[widgetName]), {}, (0, _defineProperty2["default"])({}, prop, value))))
|
|
203
|
+
});
|
|
170
204
|
}
|
|
171
205
|
|
|
172
206
|
// No widget-id present, don't update
|
|
@@ -244,9 +278,17 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
244
278
|
return null;
|
|
245
279
|
}
|
|
246
280
|
var value = Reflect.get(target, prop, receiver);
|
|
281
|
+
|
|
282
|
+
// Check for non-configurable, non-writable properties - must return actual value
|
|
283
|
+
// to satisfy JavaScript Proxy invariants (prevents "get on proxy" errors)
|
|
284
|
+
var descriptor = Object.getOwnPropertyDescriptor(target, prop);
|
|
285
|
+
if (descriptor && !descriptor.configurable && !descriptor.writable) {
|
|
286
|
+
return value;
|
|
287
|
+
}
|
|
247
288
|
var widgetId = widget["data-widget-id"];
|
|
248
|
-
|
|
249
|
-
|
|
289
|
+
// Use page-specific registry if provided, otherwise fallback to global
|
|
290
|
+
var widgetOverrides = overriddenPropsRegistry === null || overriddenPropsRegistry === void 0 ? void 0 : overriddenPropsRegistry.getWidgetOverrides(widgetName, widgetId);
|
|
291
|
+
if (widgetOverrides && prop in widgetOverrides) {
|
|
250
292
|
return widgetOverrides[prop];
|
|
251
293
|
}
|
|
252
294
|
|
|
@@ -269,7 +311,7 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
269
311
|
originalTargets.set(proxy, widget);
|
|
270
312
|
return proxy;
|
|
271
313
|
};
|
|
272
|
-
var createPageProxy = exports.createPageProxy = function createPageProxy(target, setPageContext) {
|
|
314
|
+
var createPageProxy = exports.createPageProxy = function createPageProxy(target, setPageContext, overriddenPropsRegistry) {
|
|
273
315
|
// Cache for widget proxies
|
|
274
316
|
var widgetProxies = new Map();
|
|
275
317
|
return new Proxy(target, {
|
|
@@ -312,7 +354,7 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
312
354
|
}
|
|
313
355
|
|
|
314
356
|
// Create and cache a new proxy
|
|
315
|
-
var proxy = createWidgetProxy(widget, widgetName, setPageContext);
|
|
357
|
+
var proxy = createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry);
|
|
316
358
|
widgetProxies.set(widgetName, proxy);
|
|
317
359
|
return proxy;
|
|
318
360
|
},
|
|
@@ -347,21 +389,21 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
347
389
|
}
|
|
348
390
|
} else if (widgetValue && (0, _typeof2["default"])(widgetValue) === "object") {
|
|
349
391
|
// Create a new proxy
|
|
350
|
-
var _proxy2 = createWidgetProxy(widgetValue, widgetName, setPageContext);
|
|
392
|
+
var _proxy2 = createWidgetProxy(widgetValue, widgetName, setPageContext, overriddenPropsRegistry);
|
|
351
393
|
widgetProxies.set(widgetName, _proxy2);
|
|
352
394
|
}
|
|
353
395
|
return true;
|
|
354
396
|
}
|
|
355
397
|
});
|
|
356
398
|
};
|
|
357
|
-
var
|
|
399
|
+
var _createStateProxy = exports.createStateProxy = function createStateProxy(obj) {
|
|
358
400
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
359
401
|
var setPageContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
402
|
+
var overriddenPropsRegistry = arguments.length > 3 ? arguments[3] : undefined;
|
|
360
403
|
// Cache for nested proxies
|
|
361
404
|
var nestedProxies = new Map();
|
|
362
405
|
return new Proxy(obj, {
|
|
363
406
|
get: function get(target, prop, receiver) {
|
|
364
|
-
var _value$constructor;
|
|
365
407
|
if (prop === "eval") {
|
|
366
408
|
return function (fn) {
|
|
367
409
|
var failOnError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -375,10 +417,16 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
375
417
|
}
|
|
376
418
|
if (prop === "Widgets" && path.length === 0) {
|
|
377
419
|
if (!nestedProxies.has("Widgets")) {
|
|
378
|
-
nestedProxies.set("Widgets", createPageProxy(target.Widgets, setPageContext));
|
|
420
|
+
nestedProxies.set("Widgets", createPageProxy(target.Widgets, setPageContext, overriddenPropsRegistry));
|
|
379
421
|
}
|
|
380
422
|
return nestedProxies.get("Widgets");
|
|
381
423
|
}
|
|
424
|
+
if (prop === "Variables" && path.length === 0) {
|
|
425
|
+
if (!nestedProxies.has("Variables")) {
|
|
426
|
+
nestedProxies.set("Variables", _createStateProxy(target.Variables, ["Variables"], setPageContext, overriddenPropsRegistry));
|
|
427
|
+
}
|
|
428
|
+
return nestedProxies.get("Variables");
|
|
429
|
+
}
|
|
382
430
|
|
|
383
431
|
// Do not auto-create missing properties; just return undefined
|
|
384
432
|
if (!(prop in target)) {
|
|
@@ -390,7 +438,14 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
390
438
|
if ((0, _typeof2["default"])(value) !== "object" || value === null) {
|
|
391
439
|
return value;
|
|
392
440
|
}
|
|
393
|
-
|
|
441
|
+
|
|
442
|
+
// Check for non-configurable, non-writable properties - must return actual value
|
|
443
|
+
// to satisfy JavaScript Proxy invariants (prevents "get on proxy" errors)
|
|
444
|
+
var descriptor = Object.getOwnPropertyDescriptor(target, prop);
|
|
445
|
+
if (descriptor && !descriptor.configurable && !descriptor.writable) {
|
|
446
|
+
return value;
|
|
447
|
+
}
|
|
448
|
+
if (value instanceof _serviceVariable.ServiceVariable || value instanceof _liveVariable["default"]) {
|
|
394
449
|
return value;
|
|
395
450
|
}
|
|
396
451
|
|
|
@@ -398,6 +453,9 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
398
453
|
if ((0, _dom.isDOMElement)(value)) {
|
|
399
454
|
return value;
|
|
400
455
|
}
|
|
456
|
+
if (value instanceof Map) {
|
|
457
|
+
return value;
|
|
458
|
+
}
|
|
401
459
|
|
|
402
460
|
// Return array proxy to preserve native array behavior while enabling reactivity
|
|
403
461
|
if (Array.isArray(value)) {
|
|
@@ -408,9 +466,14 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
408
466
|
if (nestedProxies.has(prop)) {
|
|
409
467
|
return nestedProxies.get(prop);
|
|
410
468
|
}
|
|
469
|
+
if (target !== null && target !== void 0 && target.prefab) {
|
|
470
|
+
if (nestedProxies.has(target.name)) {
|
|
471
|
+
return nestedProxies.get(target.name)[prop];
|
|
472
|
+
}
|
|
473
|
+
}
|
|
411
474
|
|
|
412
475
|
// Create and cache a new nested proxy
|
|
413
|
-
var nestedProxy =
|
|
476
|
+
var nestedProxy = _createStateProxy(value, [].concat((0, _toConsumableArray2["default"])(path), [prop]), setPageContext, overriddenPropsRegistry);
|
|
414
477
|
nestedProxies.set(prop, nestedProxy);
|
|
415
478
|
return nestedProxy;
|
|
416
479
|
},
|
|
@@ -428,6 +491,14 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
428
491
|
if ((0, _typeof2["default"])(value) === "object" && value !== null && !Array.isArray(value) && nestedProxies.has(prop)) {
|
|
429
492
|
nestedProxies["delete"](prop);
|
|
430
493
|
}
|
|
494
|
+
if (target !== null && target !== void 0 && target.prefab) {
|
|
495
|
+
if (nestedProxies.has(target.name)) {
|
|
496
|
+
var existingProxy = nestedProxies.get(target.name);
|
|
497
|
+
existingProxy[prop] = value;
|
|
498
|
+
} else {
|
|
499
|
+
nestedProxies.set(target.name, createWidgetProxy(target, target.name, setPageContext));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
431
502
|
setPageContext(function (prev) {
|
|
432
503
|
// Create minimal copies along path
|
|
433
504
|
var newState = _objectSpread({}, prev);
|