@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
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports.isAndroid = exports.getFieldLayoutConfig = void 0;
|
|
7
|
+
exports.transformRangeFilterData = exports.isAndroid = exports.getFieldLayoutConfig = exports.focusOnFirstInvalidField = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _lodashEs = require("lodash-es");
|
|
8
10
|
var _constant = require("./constant");
|
|
11
|
+
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; }
|
|
12
|
+
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; }
|
|
13
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
9
16
|
var userAgent = "";
|
|
10
17
|
if (typeof window !== "undefined") {
|
|
11
18
|
userAgent = window.navigator.userAgent;
|
|
@@ -39,4 +46,155 @@ var getFieldLayoutConfig = exports.getFieldLayoutConfig = function getFieldLayou
|
|
|
39
46
|
captionCls: captionCls,
|
|
40
47
|
widgetCls: widgetCls
|
|
41
48
|
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Checks if an element is visible in the viewport
|
|
53
|
+
*/
|
|
54
|
+
var isElementInViewport = function isElementInViewport(el) {
|
|
55
|
+
if (!el) return false;
|
|
56
|
+
var rect = el.getBoundingClientRect();
|
|
57
|
+
return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Focuses on the first invalid field in a form
|
|
62
|
+
* Uses multiple DOM-based strategies to find invalid fields
|
|
63
|
+
*
|
|
64
|
+
* @param formElement - The form DOM element to search within
|
|
65
|
+
* @param errorFieldNames - Optional array of field names that have validation errors
|
|
66
|
+
*/
|
|
67
|
+
var focusOnFirstInvalidField = exports.focusOnFirstInvalidField = function focusOnFirstInvalidField(formElement, errorFieldNames) {
|
|
68
|
+
if (!formElement) return;
|
|
69
|
+
|
|
70
|
+
// Use setTimeout to ensure DOM has updated with error states after validation
|
|
71
|
+
setTimeout(function () {
|
|
72
|
+
if (!formElement) return;
|
|
73
|
+
var focusableElement = null;
|
|
74
|
+
|
|
75
|
+
// Strategy 1: Find by error field names if provided
|
|
76
|
+
if (errorFieldNames && errorFieldNames.length > 0) {
|
|
77
|
+
var _iterator = _createForOfIteratorHelper(errorFieldNames),
|
|
78
|
+
_step;
|
|
79
|
+
try {
|
|
80
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
81
|
+
var fieldName = _step.value;
|
|
82
|
+
// Direct lookup by name attribute on input elements (most reliable)
|
|
83
|
+
focusableElement = formElement.querySelector("input[name=\"".concat(fieldName, "\"]:not([type=\"hidden\"]), textarea[name=\"").concat(fieldName, "\"], select[name=\"").concat(fieldName, "\"]"));
|
|
84
|
+
if (focusableElement) break;
|
|
85
|
+
|
|
86
|
+
// Try by ID
|
|
87
|
+
var elementById = formElement.querySelector("#".concat(fieldName));
|
|
88
|
+
if (elementById) {
|
|
89
|
+
if (elementById.matches("input, textarea, select")) {
|
|
90
|
+
focusableElement = elementById;
|
|
91
|
+
} else {
|
|
92
|
+
focusableElement = elementById.querySelector('input:not([type="hidden"]), textarea, select');
|
|
93
|
+
}
|
|
94
|
+
if (focusableElement) break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Find the form field wrapper and get the input inside
|
|
98
|
+
var fieldWrapper = formElement.querySelector("[data-name=\"".concat(fieldName, "\"]")) || formElement.querySelector("div[name=\"".concat(fieldName, "\"]"));
|
|
99
|
+
if (fieldWrapper) {
|
|
100
|
+
focusableElement = fieldWrapper.querySelector('input:not([type="hidden"]), textarea, select, [contenteditable="true"]');
|
|
101
|
+
if (focusableElement) break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
} catch (err) {
|
|
105
|
+
_iterator.e(err);
|
|
106
|
+
} finally {
|
|
107
|
+
_iterator.f();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Strategy 2: Find actual INPUT/TEXTAREA/SELECT with ng-invalid class
|
|
112
|
+
if (!focusableElement) {
|
|
113
|
+
focusableElement = formElement.querySelector('input.ng-invalid:not([type="hidden"]), textarea.ng-invalid, select.ng-invalid');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Strategy 3: Find by Mui-error class on input wrapper, then get input inside
|
|
117
|
+
if (!focusableElement) {
|
|
118
|
+
var muiErrorWrapper = formElement.querySelector(".app-input-wrapper.ng-invalid, .MuiFormControl-root.Mui-error");
|
|
119
|
+
if (muiErrorWrapper) {
|
|
120
|
+
focusableElement = muiErrorWrapper.querySelector('input:not([type="hidden"]), textarea, select');
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Strategy 4: Find help-block with error message and go to its sibling input
|
|
125
|
+
if (!focusableElement) {
|
|
126
|
+
var errorHelpBlock = formElement.querySelector(".help-block.text-danger");
|
|
127
|
+
if (errorHelpBlock) {
|
|
128
|
+
var parent = errorHelpBlock.parentElement;
|
|
129
|
+
if (parent) {
|
|
130
|
+
focusableElement = parent.querySelector('input:not([type="hidden"]), textarea, select');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Strategy 5: Find by aria-invalid attribute
|
|
136
|
+
if (!focusableElement) {
|
|
137
|
+
focusableElement = formElement.querySelector('input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"]');
|
|
138
|
+
}
|
|
139
|
+
if (focusableElement) {
|
|
140
|
+
// Scroll into view if not visible
|
|
141
|
+
if (!isElementInViewport(focusableElement)) {
|
|
142
|
+
focusableElement.scrollIntoView({
|
|
143
|
+
behavior: "smooth",
|
|
144
|
+
block: "center"
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// Small delay to ensure scroll completes before focus
|
|
148
|
+
setTimeout(function () {
|
|
149
|
+
var _focusableElement;
|
|
150
|
+
(_focusableElement = focusableElement) === null || _focusableElement === void 0 || _focusableElement.focus({
|
|
151
|
+
preventScroll: true
|
|
152
|
+
});
|
|
153
|
+
}, 100);
|
|
154
|
+
}
|
|
155
|
+
}, 100); // Delay to let DOM update after validation
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Transform form data to combine min/max values for range filters
|
|
159
|
+
var transformRangeFilterData = exports.transformRangeFilterData = function transformRangeFilterData(data) {
|
|
160
|
+
var transformedData = _objectSpread({}, data);
|
|
161
|
+
var fieldsToRemove = [];
|
|
162
|
+
|
|
163
|
+
// Find all fields ending with _max and combine with their base field
|
|
164
|
+
Object.keys(transformedData).forEach(function (key) {
|
|
165
|
+
if (key.endsWith("_maxWidget")) {
|
|
166
|
+
var baseFieldKey = key.replace("_maxWidget", "");
|
|
167
|
+
var maxValue = transformedData[key];
|
|
168
|
+
var minValue = transformedData[baseFieldKey];
|
|
169
|
+
|
|
170
|
+
// Process min and max values - convert empty strings to undefined
|
|
171
|
+
var processedMinValue = minValue !== undefined && minValue !== "" && minValue !== null ? minValue : undefined;
|
|
172
|
+
var processedMaxValue = maxValue !== undefined && maxValue !== "" && maxValue !== null ? maxValue : undefined;
|
|
173
|
+
|
|
174
|
+
// Only create range object if at least one value exists
|
|
175
|
+
if (processedMinValue !== undefined || processedMaxValue !== undefined) {
|
|
176
|
+
transformedData[baseFieldKey] = {
|
|
177
|
+
minValue: processedMinValue,
|
|
178
|
+
maxValue: processedMaxValue,
|
|
179
|
+
min: processedMinValue,
|
|
180
|
+
max: processedMaxValue
|
|
181
|
+
};
|
|
182
|
+
} else {
|
|
183
|
+
// If both values are empty/undefined, remove the base field entry if it exists
|
|
184
|
+
// This ensures we don't send empty range filters
|
|
185
|
+
if (transformedData[baseFieldKey] !== undefined) {
|
|
186
|
+
delete transformedData[baseFieldKey];
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Mark the _max field for removal
|
|
191
|
+
fieldsToRemove.push(key);
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
// Remove the _max fields as they're now part of the base field object
|
|
196
|
+
fieldsToRemove.forEach(function (key) {
|
|
197
|
+
delete transformedData[key];
|
|
198
|
+
});
|
|
199
|
+
return transformedData;
|
|
42
200
|
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.COMPONENT_MAP = void 0;
|
|
8
|
+
var _text = _interopRequireDefault(require("../../../input/text"));
|
|
9
|
+
var _textarea = _interopRequireDefault(require("../../../input/textarea"));
|
|
10
|
+
var _number = _interopRequireDefault(require("../../../input/number"));
|
|
11
|
+
var _currency = _interopRequireDefault(require("../../../input/currency"));
|
|
12
|
+
var _select = _interopRequireDefault(require("../../../input/select"));
|
|
13
|
+
var _slider = _interopRequireDefault(require("../../../input/slider"));
|
|
14
|
+
var _rating = _interopRequireDefault(require("../../../input/rating"));
|
|
15
|
+
var _checkbox = _interopRequireDefault(require("../../../input/default/checkbox"));
|
|
16
|
+
var _checkboxset = _interopRequireDefault(require("../../../input/default/checkboxset"));
|
|
17
|
+
var _radioset = _interopRequireDefault(require("../../../input/default/radioset"));
|
|
18
|
+
var _switch = _interopRequireDefault(require("../../../input/default/switch"));
|
|
19
|
+
var _date = _interopRequireDefault(require("../../../input/epoch/date"));
|
|
20
|
+
var _datetime = _interopRequireDefault(require("../../../input/epoch/datetime"));
|
|
21
|
+
var _time = _interopRequireDefault(require("../../../input/epoch/time"));
|
|
22
|
+
var _chips = _interopRequireDefault(require("../../../input/chips"));
|
|
23
|
+
var _colorPicker = _interopRequireDefault(require("../../../input/color-picker"));
|
|
24
|
+
var _fileupload = _interopRequireDefault(require("../../../input/fileupload"));
|
|
25
|
+
var _upload = _interopRequireDefault(require("../../../input/upload"));
|
|
26
|
+
var _calendar = _interopRequireDefault(require("../../../input/calendar"));
|
|
27
|
+
// Default input components
|
|
28
|
+
|
|
29
|
+
// Date/Time components
|
|
30
|
+
|
|
31
|
+
// Other input components
|
|
32
|
+
|
|
33
|
+
var COMPONENT_MAP = exports.COMPONENT_MAP = {
|
|
34
|
+
text: _text["default"],
|
|
35
|
+
textarea: _textarea["default"],
|
|
36
|
+
number: _number["default"],
|
|
37
|
+
currency: _currency["default"],
|
|
38
|
+
select: _select["default"],
|
|
39
|
+
slider: _slider["default"],
|
|
40
|
+
rating: _rating["default"],
|
|
41
|
+
checkbox: _checkbox["default"],
|
|
42
|
+
checkboxset: _checkboxset["default"],
|
|
43
|
+
radioset: _radioset["default"],
|
|
44
|
+
"switch": _switch["default"],
|
|
45
|
+
date: _date["default"],
|
|
46
|
+
datetime: _datetime["default"],
|
|
47
|
+
time: _time["default"],
|
|
48
|
+
chips: _chips["default"],
|
|
49
|
+
colorpicker: _colorPicker["default"],
|
|
50
|
+
fileupload: _fileupload["default"],
|
|
51
|
+
upload: _upload["default"],
|
|
52
|
+
calendar: _calendar["default"]
|
|
53
|
+
};
|
|
@@ -13,63 +13,22 @@ var _isArray = _interopRequireDefault(require("lodash-es/isArray"));
|
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
14
|
var _formContext = require("../form-context");
|
|
15
15
|
var _text = _interopRequireDefault(require("../../../input/text"));
|
|
16
|
-
var _textarea = _interopRequireDefault(require("../../../input/textarea"));
|
|
17
|
-
var _number = _interopRequireDefault(require("../../../input/number"));
|
|
18
|
-
var _currency = _interopRequireDefault(require("../../../input/currency"));
|
|
19
|
-
var _select = _interopRequireDefault(require("../../../input/select"));
|
|
20
|
-
var _slider = _interopRequireDefault(require("../../../input/slider"));
|
|
21
|
-
var _rating = _interopRequireDefault(require("../../../input/rating"));
|
|
22
|
-
var _checkbox = _interopRequireDefault(require("../../../input/default/checkbox"));
|
|
23
|
-
var _checkboxset = _interopRequireDefault(require("../../../input/default/checkboxset"));
|
|
24
|
-
var _radioset = _interopRequireDefault(require("../../../input/default/radioset"));
|
|
25
|
-
var _switch = _interopRequireDefault(require("../../../input/default/switch"));
|
|
26
|
-
var _date = _interopRequireDefault(require("../../../input/epoch/date"));
|
|
27
|
-
var _datetime = _interopRequireDefault(require("../../../input/epoch/datetime"));
|
|
28
|
-
var _time = _interopRequireDefault(require("../../../input/epoch/time"));
|
|
29
|
-
var _chips = _interopRequireDefault(require("../../../input/chips"));
|
|
30
|
-
var _colorPicker = _interopRequireDefault(require("../../../input/color-picker"));
|
|
31
|
-
var _fileupload = _interopRequireDefault(require("../../../input/fileupload"));
|
|
32
|
-
var _calendar = _interopRequireDefault(require("../../../input/calendar"));
|
|
33
16
|
var _layoutGrid = _interopRequireDefault(require("../../../container/layout-grid"));
|
|
34
17
|
var _gridRow = _interopRequireDefault(require("../../../container/layout-grid/grid-row"));
|
|
35
18
|
var _gridColumn = _interopRequireDefault(require("../../../container/layout-grid/grid-column"));
|
|
36
19
|
var _label = _interopRequireDefault(require("../../../basic/label"));
|
|
37
20
|
var _formField = _interopRequireDefault(require("../form-field"));
|
|
21
|
+
var _utils = require("./utils");
|
|
22
|
+
var _constant = require("./constant");
|
|
38
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
39
24
|
var __jsx = _react["default"].createElement;
|
|
40
25
|
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; }
|
|
41
26
|
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; } // Form context
|
|
42
27
|
// Input components
|
|
43
|
-
// Default input components
|
|
44
|
-
// Date/Time components
|
|
45
|
-
// Other input components
|
|
46
28
|
// Layout components
|
|
47
29
|
// Basic components
|
|
48
30
|
// Form field wrapper
|
|
49
31
|
// Import types
|
|
50
|
-
|
|
51
|
-
// Component mapping for dynamic rendering
|
|
52
|
-
var COMPONENT_MAP = {
|
|
53
|
-
text: _text["default"],
|
|
54
|
-
textarea: _textarea["default"],
|
|
55
|
-
number: _number["default"],
|
|
56
|
-
currency: _currency["default"],
|
|
57
|
-
select: _select["default"],
|
|
58
|
-
slider: _slider["default"],
|
|
59
|
-
rating: _rating["default"],
|
|
60
|
-
checkbox: _checkbox["default"],
|
|
61
|
-
checkboxset: _checkboxset["default"],
|
|
62
|
-
radioset: _radioset["default"],
|
|
63
|
-
"switch": _switch["default"],
|
|
64
|
-
date: _date["default"],
|
|
65
|
-
datetime: _datetime["default"],
|
|
66
|
-
time: _time["default"],
|
|
67
|
-
chips: _chips["default"],
|
|
68
|
-
colorpicker: _colorPicker["default"],
|
|
69
|
-
fileupload: _fileupload["default"],
|
|
70
|
-
calendar: _calendar["default"]
|
|
71
|
-
};
|
|
72
|
-
|
|
73
32
|
// Default CSS classes
|
|
74
33
|
var DEFAULT_FIELD_CLASS = "app-dynamic-form-field";
|
|
75
34
|
function DynamicForm(props) {
|
|
@@ -90,7 +49,12 @@ function DynamicForm(props) {
|
|
|
90
49
|
captionposition = _ref.captionposition;
|
|
91
50
|
var metadataRef = (0, _react.useRef)(metadata);
|
|
92
51
|
(0, _react.useEffect)(function () {
|
|
93
|
-
if (onBeforeRender)
|
|
52
|
+
if (onBeforeRender) {
|
|
53
|
+
var data = onBeforeRender(metadata, props);
|
|
54
|
+
if (data) {
|
|
55
|
+
metadataRef.current = (0, _utils.updateMetadata)(data, listener) || metadata;
|
|
56
|
+
}
|
|
57
|
+
} else metadataRef.current = metadata;
|
|
94
58
|
}, [metadata, onBeforeRender]);
|
|
95
59
|
|
|
96
60
|
// Return null if fields is not an array or empty
|
|
@@ -109,7 +73,7 @@ function DynamicForm(props) {
|
|
|
109
73
|
|
|
110
74
|
// Render individual form field
|
|
111
75
|
var renderFormField = function renderFormField(field) {
|
|
112
|
-
var ComponentToRender = COMPONENT_MAP[field.widget] || _text["default"];
|
|
76
|
+
var ComponentToRender = _constant.COMPONENT_MAP[field.widget] || _text["default"];
|
|
113
77
|
|
|
114
78
|
// Prepare field props
|
|
115
79
|
var fieldProps = _objectSpread(_objectSpread({}, field), {}, {
|
|
@@ -146,6 +110,7 @@ function DynamicForm(props) {
|
|
|
146
110
|
className: (0, _clsx["default"])("app-label control-label formfield-label", (formRef === null || formRef === void 0 ? void 0 : formRef.captionCls) || ""),
|
|
147
111
|
htmlFor: $formField.name
|
|
148
112
|
}), renderFormField(_objectSpread(_objectSpread(_objectSpread({}, field), $formField), {}, {
|
|
113
|
+
datavalue: $formField.datavalue || $formField.defaultvalue,
|
|
149
114
|
name: $formField.name + "_formWidget",
|
|
150
115
|
className: (0, _clsx["default"])(field.className, (formRef === null || formRef === void 0 ? void 0 : formRef.widgetCls) || "")
|
|
151
116
|
})));
|
|
@@ -4,9 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.updateFieldValue = exports.transformSingleField = exports.transformAPIResponse = exports.sortFields = exports.hasFormErrors = exports.getFormData = exports.getFieldByName = exports.filterFieldsByWidget = exports.createDefaultField = void 0;
|
|
8
|
+
exports.updateMetadata = updateMetadata;
|
|
9
|
+
exports.validateForm = exports.validateField = void 0;
|
|
10
|
+
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
|
|
8
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _isString = _interopRequireDefault(require("lodash-es/isString"));
|
|
10
14
|
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; }
|
|
11
15
|
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; }
|
|
12
16
|
// Widget type mapping from API types to component types
|
|
@@ -234,4 +238,35 @@ var filterFieldsByWidget = exports.filterFieldsByWidget = function filterFieldsB
|
|
|
234
238
|
return fields.filter(function (field) {
|
|
235
239
|
return widgetTypes.includes(field.widget);
|
|
236
240
|
});
|
|
237
|
-
};
|
|
241
|
+
};
|
|
242
|
+
function evalExpression(str) {
|
|
243
|
+
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
244
|
+
try {
|
|
245
|
+
var argNames = Object.keys(context);
|
|
246
|
+
var argValues = Object.values(context);
|
|
247
|
+
|
|
248
|
+
// eslint-disable-next-line no-new-func
|
|
249
|
+
var fn = (0, _construct2["default"])(Function, argNames.concat(["return (".concat(str, ");")]));
|
|
250
|
+
return fn.apply(void 0, argValues);
|
|
251
|
+
} catch (error) {
|
|
252
|
+
console.error("Expression failed:", error);
|
|
253
|
+
return null; // or fallback
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function convertStringExpToJsx(expression, listener) {
|
|
257
|
+
if (!expression) return null;
|
|
258
|
+
if (typeof expression !== "string") return expression;
|
|
259
|
+
return evalExpression(expression.replace("bind:", "listener."), {
|
|
260
|
+
listener: listener // whatever your listener object is
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function updateMetadata(metadata, listener) {
|
|
264
|
+
return metadata.map(function (field) {
|
|
265
|
+
Object.keys(field).forEach(function (key) {
|
|
266
|
+
if ((0, _isString["default"])(field[key]) && field[key].startsWith("bind:")) {
|
|
267
|
+
field[key] = convertStringExpToJsx(field[key], listener);
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
return field;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
@@ -14,6 +14,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
14
14
|
var _button = require("@wavemaker/react-runtime/components/form/button");
|
|
15
15
|
var _anchor = require("@wavemaker/react-runtime/components/basic/anchor");
|
|
16
16
|
var _formContext = require("@wavemaker/react-runtime/components/data/form/form-context");
|
|
17
|
+
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
17
18
|
var _excluded = ["position", "btnClass", "updateMode", "displayName", "headeraction", "showViewMode"];
|
|
18
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
19
20
|
var __jsx = _react["default"].createElement;
|
|
@@ -35,7 +36,7 @@ var WmFormActions = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
35
36
|
|
|
36
37
|
// register header action
|
|
37
38
|
(0, _react.useEffect)(function () {
|
|
38
|
-
if (formRef &&
|
|
39
|
+
if (formRef && position.includes("header") && formRef.registerHeaderAction) {
|
|
39
40
|
formRef.registerHeaderAction(props.name, props);
|
|
40
41
|
}
|
|
41
42
|
}, [formRef, props]);
|
|
@@ -49,7 +50,7 @@ var WmFormActions = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
49
50
|
className: (0, _clsx["default"])(btnClass, rest.className)
|
|
50
51
|
}));
|
|
51
52
|
}
|
|
52
|
-
return __jsx(_button.WmButton, (0, _defineProperty2["default"])({
|
|
53
|
+
return __jsx(_button.WmButton, (0, _defineProperty2["default"])((0, _defineProperty2["default"])({
|
|
53
54
|
className: (0, _clsx["default"])(btnClass, rest.className),
|
|
54
55
|
caption: displayName,
|
|
55
56
|
title: displayName,
|
|
@@ -65,7 +66,7 @@ var WmFormActions = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
|
65
66
|
conditionalclass: props.conditionalclass,
|
|
66
67
|
animation: props.animation,
|
|
67
68
|
listener: props.listener
|
|
68
|
-
}, "title", props.title || props.displayName));
|
|
69
|
+
}, "title", props.title || props.displayName), "hidden", props.hidden));
|
|
69
70
|
});
|
|
70
71
|
WmFormActions.displayName = "WmFormActions";
|
|
71
|
-
var _default = exports["default"] = WmFormActions;
|
|
72
|
+
var _default = exports["default"] = (0, _withBaseWrapper["default"])(WmFormActions);
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useIsViewMode = exports.useFormContext = exports["default"] = exports.FormProvider = void 0;
|
|
8
|
+
exports.useIsViewMode = exports.useFormRef = exports.useFormContext = exports["default"] = exports.FormProvider = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
@@ -31,4 +31,8 @@ var useIsViewMode = exports.useIsViewMode = function useIsViewMode() {
|
|
|
31
31
|
var context = useFormContext();
|
|
32
32
|
return context === null || context === void 0 ? void 0 : context.isViewMode;
|
|
33
33
|
};
|
|
34
|
+
var useFormRef = exports.useFormRef = function useFormRef() {
|
|
35
|
+
var _useContext$ref, _useContext;
|
|
36
|
+
return (_useContext$ref = (_useContext = (0, _react.useContext)(FormContext)) === null || _useContext === void 0 ? void 0 : _useContext.ref) !== null && _useContext$ref !== void 0 ? _useContext$ref : null;
|
|
37
|
+
};
|
|
34
38
|
var _default = exports["default"] = FormContext;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractDynamicValidationProps = extractDynamicValidationProps;
|
|
7
|
+
function resolveValue(value) {
|
|
8
|
+
if (value === null || value === undefined) return undefined;
|
|
9
|
+
if (typeof value === "function") {
|
|
10
|
+
try {
|
|
11
|
+
var resolved = value();
|
|
12
|
+
return resolved === null ? undefined : resolved;
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.warn("Error resolving function value:", error);
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return value === null ? undefined : value;
|
|
19
|
+
}
|
|
20
|
+
function extractDynamicValidationProps(validators, rules) {
|
|
21
|
+
var result = {
|
|
22
|
+
required: rules.required,
|
|
23
|
+
maxchars: rules.maxchars,
|
|
24
|
+
regexp: rules.regexp,
|
|
25
|
+
minvalue: rules.minvalue,
|
|
26
|
+
maxvalue: rules.maxvalue,
|
|
27
|
+
excludedays: rules.excludedays,
|
|
28
|
+
excludedates: rules.excludedates,
|
|
29
|
+
mintime: rules.mintime,
|
|
30
|
+
maxtime: rules.maxtime,
|
|
31
|
+
mindate: rules.mindate,
|
|
32
|
+
maxdate: rules.maxdate
|
|
33
|
+
};
|
|
34
|
+
if (!(validators !== null && validators !== void 0 && validators.length)) return result;
|
|
35
|
+
validators.forEach(function (validator) {
|
|
36
|
+
if (typeof validator === "function") return;
|
|
37
|
+
switch (validator.type) {
|
|
38
|
+
case "required":
|
|
39
|
+
result.required = resolveValue(validator.validator);
|
|
40
|
+
break;
|
|
41
|
+
case "maxchars":
|
|
42
|
+
result.maxchars = resolveValue(validator.validator);
|
|
43
|
+
break;
|
|
44
|
+
case "regexp":
|
|
45
|
+
result.regexp = resolveValue(validator.validator);
|
|
46
|
+
break;
|
|
47
|
+
case "minvalue":
|
|
48
|
+
result.minvalue = resolveValue(validator.validator);
|
|
49
|
+
break;
|
|
50
|
+
case "maxvalue":
|
|
51
|
+
result.maxvalue = resolveValue(validator.validator);
|
|
52
|
+
break;
|
|
53
|
+
case "excludedays":
|
|
54
|
+
result.excludedays = resolveValue(validator.validator);
|
|
55
|
+
break;
|
|
56
|
+
case "excludedates":
|
|
57
|
+
// Extract excludedates from validators
|
|
58
|
+
result.excludedates = resolveValue(validator.validator);
|
|
59
|
+
break;
|
|
60
|
+
case "mintime":
|
|
61
|
+
// Extract mintime from validators
|
|
62
|
+
result.mintime = resolveValue(validator.validator);
|
|
63
|
+
break;
|
|
64
|
+
case "maxtime":
|
|
65
|
+
// Extract maxtime from validators
|
|
66
|
+
result.maxtime = resolveValue(validator.validator);
|
|
67
|
+
break;
|
|
68
|
+
case "mindate":
|
|
69
|
+
// Extract mindate from validators
|
|
70
|
+
result.mindate = resolveValue(validator.validator);
|
|
71
|
+
break;
|
|
72
|
+
case "maxdate":
|
|
73
|
+
// Extract maxdate from validators
|
|
74
|
+
result.maxdate = resolveValue(validator.validator);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Convert excludedays from array to string format if it's an array (for widgets that expect string)
|
|
80
|
+
if (result.excludedays !== undefined && Array.isArray(result.excludedays)) {
|
|
81
|
+
result.excludedays = result.excludedays.join(",");
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|