@wavemaker/react-runtime 11.14.2-rc.6311 → 11.15.0-1.246
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 +73 -18
- 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 +31 -11
- 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 +4 -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/repeat-template/index.js +33 -0
- package/components/container/tabs/index.js +83 -14
- package/components/container/tabs/tab-pane/index.js +33 -10
- 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 +985 -183
- 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 +67 -45
- 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 +51 -18
- 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 -52
- 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 +209 -72
- 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 +105 -32
- 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 +85 -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 +41 -3
- 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 +840 -740
- 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,13 @@ 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"));
|
|
17
|
+
var _modelVariable = require("../variables/model-variable");
|
|
14
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; }
|
|
15
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; }
|
|
16
20
|
// WeakMap to store proxy flags without exposing them as props
|
|
@@ -19,6 +23,9 @@ var proxyMap = new WeakMap();
|
|
|
19
23
|
// Store the original target for each proxy
|
|
20
24
|
var originalTargets = new WeakMap();
|
|
21
25
|
|
|
26
|
+
// Store previous formdata values to detect changes
|
|
27
|
+
var previousFormData = new WeakMap();
|
|
28
|
+
|
|
22
29
|
// Array methods that mutate the array and should trigger updates
|
|
23
30
|
var MUTATING_ARRAY_METHODS = ["push", "pop", "shift", "unshift", "splice", "sort", "reverse", "fill", "copyWithin", "put"];
|
|
24
31
|
|
|
@@ -129,7 +136,7 @@ var createStateArrayProxy = function createStateArrayProxy(array, path, propName
|
|
|
129
136
|
proxyMap.set(arrayProxy, true);
|
|
130
137
|
return arrayProxy;
|
|
131
138
|
};
|
|
132
|
-
var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(widget, widgetName, setPageContext) {
|
|
139
|
+
var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry) {
|
|
133
140
|
// If widget is already a proxy or is a DOM element, return it directly
|
|
134
141
|
if (proxyMap.has(widget) || (0, _dom.isDOMElement)(widget)) {
|
|
135
142
|
return widget;
|
|
@@ -147,10 +154,34 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
147
154
|
return true;
|
|
148
155
|
}
|
|
149
156
|
|
|
157
|
+
// Special handling for formdata changes - emit parent form change event
|
|
158
|
+
// Only emit for widgets that are likely forms and have meaningful data changes
|
|
159
|
+
if (prop === "formdata") {
|
|
160
|
+
var prevData = previousFormData.get(target);
|
|
161
|
+
var hasChanged = value && (!prevData || !(0, _isEqual["default"])(prevData, value));
|
|
162
|
+
|
|
163
|
+
// Only emit if there's a meaningful change (not null/undefined to null/undefined)
|
|
164
|
+
if (hasChanged && (value || prevData)) {
|
|
165
|
+
// Update stored previous value
|
|
166
|
+
previousFormData.set(target, value);
|
|
167
|
+
|
|
168
|
+
// Emit parent form external data change event
|
|
169
|
+
// This will be received by child forms listening for their parent changes
|
|
170
|
+
_events.EVENTEMITTER_METHODS.PARENT_FORM_EXTERNAL_DATA_CHANGE_EMIT({
|
|
171
|
+
parentFormName: widgetName,
|
|
172
|
+
formData: value,
|
|
173
|
+
timestamp: Date.now()
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
150
178
|
// track script-modified properties
|
|
151
179
|
if (typeof prop === "string") {
|
|
152
180
|
var widgetId = widget["data-widget-id"];
|
|
153
|
-
|
|
181
|
+
// Use page-specific registry if provided, otherwise fallback to global
|
|
182
|
+
if (overriddenPropsRegistry && typeof overriddenPropsRegistry.trackOverriddenProps === "function") {
|
|
183
|
+
overriddenPropsRegistry.trackOverriddenProps(widgetName, prop, value, widgetId);
|
|
184
|
+
}
|
|
154
185
|
}
|
|
155
186
|
Reflect.set(target, prop, value, receiver);
|
|
156
187
|
setPageContext(function (prevContext) {
|
|
@@ -167,6 +198,10 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
167
198
|
}
|
|
168
199
|
// If widget-id doesn't match, don't update context
|
|
169
200
|
return prevContext;
|
|
201
|
+
} else {
|
|
202
|
+
return _objectSpread(_objectSpread({}, prevContext), {}, {
|
|
203
|
+
Widgets: _objectSpread(_objectSpread({}, prevContext.Widgets), {}, (0, _defineProperty2["default"])({}, widgetName, _objectSpread(_objectSpread({}, prevContext.Widgets[widgetName]), {}, (0, _defineProperty2["default"])({}, prop, value))))
|
|
204
|
+
});
|
|
170
205
|
}
|
|
171
206
|
|
|
172
207
|
// No widget-id present, don't update
|
|
@@ -244,9 +279,17 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
244
279
|
return null;
|
|
245
280
|
}
|
|
246
281
|
var value = Reflect.get(target, prop, receiver);
|
|
282
|
+
|
|
283
|
+
// Check for non-configurable, non-writable properties - must return actual value
|
|
284
|
+
// to satisfy JavaScript Proxy invariants (prevents "get on proxy" errors)
|
|
285
|
+
var descriptor = Object.getOwnPropertyDescriptor(target, prop);
|
|
286
|
+
if (descriptor && !descriptor.configurable && !descriptor.writable) {
|
|
287
|
+
return value;
|
|
288
|
+
}
|
|
247
289
|
var widgetId = widget["data-widget-id"];
|
|
248
|
-
|
|
249
|
-
|
|
290
|
+
// Use page-specific registry if provided, otherwise fallback to global
|
|
291
|
+
var widgetOverrides = overriddenPropsRegistry === null || overriddenPropsRegistry === void 0 ? void 0 : overriddenPropsRegistry.getWidgetOverrides(widgetName, widgetId);
|
|
292
|
+
if (widgetOverrides && prop in widgetOverrides) {
|
|
250
293
|
return widgetOverrides[prop];
|
|
251
294
|
}
|
|
252
295
|
|
|
@@ -269,7 +312,7 @@ var createWidgetProxy = exports.createWidgetProxy = function createWidgetProxy(w
|
|
|
269
312
|
originalTargets.set(proxy, widget);
|
|
270
313
|
return proxy;
|
|
271
314
|
};
|
|
272
|
-
var createPageProxy = exports.createPageProxy = function createPageProxy(target, setPageContext) {
|
|
315
|
+
var createPageProxy = exports.createPageProxy = function createPageProxy(target, setPageContext, overriddenPropsRegistry) {
|
|
273
316
|
// Cache for widget proxies
|
|
274
317
|
var widgetProxies = new Map();
|
|
275
318
|
return new Proxy(target, {
|
|
@@ -312,7 +355,7 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
312
355
|
}
|
|
313
356
|
|
|
314
357
|
// Create and cache a new proxy
|
|
315
|
-
var proxy = createWidgetProxy(widget, widgetName, setPageContext);
|
|
358
|
+
var proxy = createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry);
|
|
316
359
|
widgetProxies.set(widgetName, proxy);
|
|
317
360
|
return proxy;
|
|
318
361
|
},
|
|
@@ -347,21 +390,21 @@ var createPageProxy = exports.createPageProxy = function createPageProxy(target,
|
|
|
347
390
|
}
|
|
348
391
|
} else if (widgetValue && (0, _typeof2["default"])(widgetValue) === "object") {
|
|
349
392
|
// Create a new proxy
|
|
350
|
-
var _proxy2 = createWidgetProxy(widgetValue, widgetName, setPageContext);
|
|
393
|
+
var _proxy2 = createWidgetProxy(widgetValue, widgetName, setPageContext, overriddenPropsRegistry);
|
|
351
394
|
widgetProxies.set(widgetName, _proxy2);
|
|
352
395
|
}
|
|
353
396
|
return true;
|
|
354
397
|
}
|
|
355
398
|
});
|
|
356
399
|
};
|
|
357
|
-
var
|
|
400
|
+
var _createStateProxy = exports.createStateProxy = function createStateProxy(obj) {
|
|
358
401
|
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
359
402
|
var setPageContext = arguments.length > 2 ? arguments[2] : undefined;
|
|
403
|
+
var overriddenPropsRegistry = arguments.length > 3 ? arguments[3] : undefined;
|
|
360
404
|
// Cache for nested proxies
|
|
361
405
|
var nestedProxies = new Map();
|
|
362
406
|
return new Proxy(obj, {
|
|
363
407
|
get: function get(target, prop, receiver) {
|
|
364
|
-
var _value$constructor;
|
|
365
408
|
if (prop === "eval") {
|
|
366
409
|
return function (fn) {
|
|
367
410
|
var failOnError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -375,10 +418,16 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
375
418
|
}
|
|
376
419
|
if (prop === "Widgets" && path.length === 0) {
|
|
377
420
|
if (!nestedProxies.has("Widgets")) {
|
|
378
|
-
nestedProxies.set("Widgets", createPageProxy(target.Widgets, setPageContext));
|
|
421
|
+
nestedProxies.set("Widgets", createPageProxy(target.Widgets, setPageContext, overriddenPropsRegistry));
|
|
379
422
|
}
|
|
380
423
|
return nestedProxies.get("Widgets");
|
|
381
424
|
}
|
|
425
|
+
if (prop === "Variables" && path.length === 0) {
|
|
426
|
+
if (!nestedProxies.has("Variables")) {
|
|
427
|
+
nestedProxies.set("Variables", _createStateProxy(target.Variables, ["Variables"], setPageContext, overriddenPropsRegistry));
|
|
428
|
+
}
|
|
429
|
+
return nestedProxies.get("Variables");
|
|
430
|
+
}
|
|
382
431
|
|
|
383
432
|
// Do not auto-create missing properties; just return undefined
|
|
384
433
|
if (!(prop in target)) {
|
|
@@ -390,7 +439,14 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
390
439
|
if ((0, _typeof2["default"])(value) !== "object" || value === null) {
|
|
391
440
|
return value;
|
|
392
441
|
}
|
|
393
|
-
|
|
442
|
+
|
|
443
|
+
// Check for non-configurable, non-writable properties - must return actual value
|
|
444
|
+
// to satisfy JavaScript Proxy invariants (prevents "get on proxy" errors)
|
|
445
|
+
var descriptor = Object.getOwnPropertyDescriptor(target, prop);
|
|
446
|
+
if (descriptor && !descriptor.configurable && !descriptor.writable) {
|
|
447
|
+
return value;
|
|
448
|
+
}
|
|
449
|
+
if (value instanceof _serviceVariable.ServiceVariable || value instanceof _liveVariable["default"] || value instanceof _modelVariable.ModelVariable) {
|
|
394
450
|
return value;
|
|
395
451
|
}
|
|
396
452
|
|
|
@@ -398,6 +454,9 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
398
454
|
if ((0, _dom.isDOMElement)(value)) {
|
|
399
455
|
return value;
|
|
400
456
|
}
|
|
457
|
+
if (value instanceof Map) {
|
|
458
|
+
return value;
|
|
459
|
+
}
|
|
401
460
|
|
|
402
461
|
// Return array proxy to preserve native array behavior while enabling reactivity
|
|
403
462
|
if (Array.isArray(value)) {
|
|
@@ -408,9 +467,14 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
408
467
|
if (nestedProxies.has(prop)) {
|
|
409
468
|
return nestedProxies.get(prop);
|
|
410
469
|
}
|
|
470
|
+
if (target !== null && target !== void 0 && target.prefab) {
|
|
471
|
+
if (nestedProxies.has(target.name)) {
|
|
472
|
+
return nestedProxies.get(target.name)[prop];
|
|
473
|
+
}
|
|
474
|
+
}
|
|
411
475
|
|
|
412
476
|
// Create and cache a new nested proxy
|
|
413
|
-
var nestedProxy =
|
|
477
|
+
var nestedProxy = _createStateProxy(value, [].concat((0, _toConsumableArray2["default"])(path), [prop]), setPageContext, overriddenPropsRegistry);
|
|
414
478
|
nestedProxies.set(prop, nestedProxy);
|
|
415
479
|
return nestedProxy;
|
|
416
480
|
},
|
|
@@ -428,6 +492,14 @@ var createStateProxy = exports.createStateProxy = function createStateProxy(obj)
|
|
|
428
492
|
if ((0, _typeof2["default"])(value) === "object" && value !== null && !Array.isArray(value) && nestedProxies.has(prop)) {
|
|
429
493
|
nestedProxies["delete"](prop);
|
|
430
494
|
}
|
|
495
|
+
if (target !== null && target !== void 0 && target.prefab) {
|
|
496
|
+
if (nestedProxies.has(target.name)) {
|
|
497
|
+
var existingProxy = nestedProxies.get(target.name);
|
|
498
|
+
existingProxy[prop] = value;
|
|
499
|
+
} else {
|
|
500
|
+
nestedProxies.set(target.name, createWidgetProxy(target, target.name, setPageContext));
|
|
501
|
+
}
|
|
502
|
+
}
|
|
431
503
|
setPageContext(function (prev) {
|
|
432
504
|
// Create minimal copies along path
|
|
433
505
|
var newState = _objectSpread({}, prev);
|