@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
|
@@ -17,7 +17,8 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
17
17
|
var _validationContrustor = require("@wavemaker/react-runtime/components/data/form/form-controller/validation-contrustor");
|
|
18
18
|
var _WidgetProvider = require("@wavemaker/react-runtime/context/WidgetProvider");
|
|
19
19
|
var _formContext = require("@wavemaker/react-runtime/components/data/form/form-context");
|
|
20
|
-
var
|
|
20
|
+
var _utils = require("./utils");
|
|
21
|
+
var _excluded = ["formRef", "formKey", "name", "datavalue", "maxDataValue", "isMaxWidget", "defaultvalue", "validators", "asyncValidators", "required", "maxchars", "minvalue", "maxvalue", "regexp", "validationmessage", "hint", "type", "observe", "onBlur", "fieldName"];
|
|
21
22
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(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); }
|
|
22
23
|
var __jsx = _react["default"].createElement;
|
|
23
24
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -42,35 +43,71 @@ var useExternalDataSync = function useExternalDataSync(datavalue, fieldRef) {
|
|
|
42
43
|
}
|
|
43
44
|
}, [datavalue]);
|
|
44
45
|
};
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
combinedValidators.push({
|
|
60
|
-
type: "maxchars",
|
|
61
|
-
validator: maxchars,
|
|
62
|
-
errorMessage: "Maximum length is ".concat(maxchars, " characters.")
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (regexp) {
|
|
66
|
-
combinedValidators.push({
|
|
67
|
-
type: "regexp",
|
|
68
|
-
validator: regexp,
|
|
69
|
-
errorMessage: validationmessage || "Invalid format."
|
|
70
|
-
});
|
|
46
|
+
var useDefaultValueSync = function useDefaultValueSync(defaultvalue, datavalue, fieldRef) {
|
|
47
|
+
var hasInitializedRef = (0, _react.useRef)(false);
|
|
48
|
+
(0, _react.useEffect)(function () {
|
|
49
|
+
// Only sync defaultvalue if:
|
|
50
|
+
// 1. We haven't initialized yet
|
|
51
|
+
// 2. There's a defaultvalue provided
|
|
52
|
+
// 3. There's no datavalue (datavalue takes precedence)
|
|
53
|
+
// 4. The field is registered
|
|
54
|
+
if (!hasInitializedRef.current && defaultvalue !== undefined && datavalue === undefined && fieldRef.current) {
|
|
55
|
+
var currentValue = fieldRef.current.value;
|
|
56
|
+
if (currentValue === undefined || currentValue === null || currentValue === "") {
|
|
57
|
+
fieldRef.current.onChange(defaultvalue);
|
|
58
|
+
hasInitializedRef.current = true;
|
|
59
|
+
}
|
|
71
60
|
}
|
|
72
|
-
|
|
73
|
-
|
|
61
|
+
}, [defaultvalue, datavalue]);
|
|
62
|
+
};
|
|
63
|
+
var useValidationRules = function useValidationRules(validationType, validators, asyncValidators, required, maxchars, regexp, validationmessage, minvalue, maxvalue, form) {
|
|
64
|
+
if (validationType === "none") {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
var combinedValidators = [].concat((0, _toConsumableArray2["default"])(validators || []), (0, _toConsumableArray2["default"])(asyncValidators || []));
|
|
68
|
+
var hasValidatorType = function hasValidatorType(type) {
|
|
69
|
+
return validators === null || validators === void 0 ? void 0 : validators.some(function (v) {
|
|
70
|
+
return typeof v !== "function" && v.type === type;
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
if (required && !hasValidatorType("required")) {
|
|
74
|
+
combinedValidators.push({
|
|
75
|
+
type: "required",
|
|
76
|
+
validator: true,
|
|
77
|
+
errorMessage: validationmessage || "This field is required"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (maxchars !== undefined) {
|
|
81
|
+
combinedValidators.push({
|
|
82
|
+
type: "maxchars",
|
|
83
|
+
validator: maxchars,
|
|
84
|
+
errorMessage: validationmessage || "Maximum length is ".concat(maxchars, " characters.")
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
var normalizedMin = minvalue !== undefined && minvalue !== null && minvalue !== "" ? Number(minvalue) : undefined;
|
|
88
|
+
var normalizedMax = maxvalue !== undefined && maxvalue !== null && maxvalue !== "" ? Number(maxvalue) : undefined;
|
|
89
|
+
if (normalizedMin !== undefined && !Number.isNaN(normalizedMin)) {
|
|
90
|
+
combinedValidators.push({
|
|
91
|
+
type: "minvalue",
|
|
92
|
+
validator: normalizedMin,
|
|
93
|
+
errorMessage: validationmessage || "Value must be greater than or equal to ".concat(normalizedMin, ".")
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (normalizedMax !== undefined && !Number.isNaN(normalizedMax)) {
|
|
97
|
+
combinedValidators.push({
|
|
98
|
+
type: "maxvalue",
|
|
99
|
+
validator: normalizedMax,
|
|
100
|
+
errorMessage: validationmessage || "Value must be less than or equal to ".concat(normalizedMax, ".")
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (regexp) {
|
|
104
|
+
combinedValidators.push({
|
|
105
|
+
type: "regexp",
|
|
106
|
+
validator: regexp,
|
|
107
|
+
errorMessage: validationmessage || "Invalid format."
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return (0, _validationContrustor.createValidationRules)(combinedValidators, form);
|
|
74
111
|
};
|
|
75
112
|
var useHTMLValidationProps = function useHTMLValidationProps(validationType, required, maxchars, regexp) {
|
|
76
113
|
return (0, _react.useMemo)(function () {
|
|
@@ -95,7 +132,7 @@ var useHTMLValidationProps = function useHTMLValidationProps(validationType, req
|
|
|
95
132
|
var processFieldValue = function processFieldValue(fieldValue, type, datafield) {
|
|
96
133
|
// If fieldValue is an object and datafield is specified, extract the value
|
|
97
134
|
if (fieldValue && (0, _typeof2["default"])(fieldValue) === "object" && !Array.isArray(fieldValue) && datafield) {
|
|
98
|
-
fieldValue = fieldValue[datafield];
|
|
135
|
+
fieldValue = datafield === "All Fields" ? fieldValue : fieldValue[datafield];
|
|
99
136
|
}
|
|
100
137
|
if (type === "number") {
|
|
101
138
|
return fieldValue === "" || fieldValue === null || fieldValue === undefined ? "" : fieldValue;
|
|
@@ -133,7 +170,7 @@ var getErrorState = function getErrorState(fieldState, validationType, touched)
|
|
|
133
170
|
}
|
|
134
171
|
};
|
|
135
172
|
var shouldShowErrorMessage = function shouldShowErrorMessage(validationType, fieldState, touched) {
|
|
136
|
-
return validationType !== "none" && (validationType === "default" &&
|
|
173
|
+
return validationType !== "none" && (validationType === "default" && fieldState.error || validationType === "html" && fieldState.error);
|
|
137
174
|
};
|
|
138
175
|
|
|
139
176
|
// HOC function
|
|
@@ -143,11 +180,16 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
143
180
|
formKey = props.formKey,
|
|
144
181
|
name = props.name,
|
|
145
182
|
datavalue = props.datavalue,
|
|
183
|
+
maxDataValue = props.maxDataValue,
|
|
184
|
+
isMaxWidgetProp = props.isMaxWidget,
|
|
146
185
|
defaultvalue = props.defaultvalue,
|
|
147
|
-
validators = props.validators,
|
|
186
|
+
_props$validators = props.validators,
|
|
187
|
+
validators = _props$validators === void 0 ? [] : _props$validators,
|
|
148
188
|
asyncValidators = props.asyncValidators,
|
|
149
189
|
required = props.required,
|
|
150
190
|
maxchars = props.maxchars,
|
|
191
|
+
minvalue = props.minvalue,
|
|
192
|
+
maxvalue = props.maxvalue,
|
|
151
193
|
regexp = props.regexp,
|
|
152
194
|
validationmessage = props.validationmessage,
|
|
153
195
|
hint = props.hint,
|
|
@@ -163,6 +205,8 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
163
205
|
setTouched = _useState[1];
|
|
164
206
|
var fieldRef = (0, _react.useRef)(null);
|
|
165
207
|
var observeRef = (0, _react.useRef)(observe);
|
|
208
|
+
var isInitialMountRef = (0, _react.useRef)(true);
|
|
209
|
+
var hasEverBeenTouchedRef = (0, _react.useRef)(false);
|
|
166
210
|
|
|
167
211
|
// Context and proxy setup
|
|
168
212
|
var inputFieldName = fieldName || name;
|
|
@@ -171,14 +215,46 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
171
215
|
var fieldProxy = (0, _WidgetProvider.useWidgetProxy)(name);
|
|
172
216
|
var form = (0, _WidgetProvider.useWidgetProxy)(formRef === null || formRef === void 0 ? void 0 : formRef.name);
|
|
173
217
|
|
|
218
|
+
// Normalize isMaxWidget - handle string "true" from markup
|
|
219
|
+
var isMaxWidget = isMaxWidgetProp === true || isMaxWidgetProp === "true" || isMaxWidgetProp === "{true}";
|
|
220
|
+
|
|
221
|
+
// For max widgets, use a modified formKey to differentiate from min widget
|
|
222
|
+
// This allows both widgets to coexist in the form while maintaining the same base field name
|
|
223
|
+
var effectiveFormKey = isMaxWidget && formKey ? "".concat(formKey, "_maxWidget") : formKey || inputFieldName;
|
|
224
|
+
|
|
225
|
+
// Use maxdatavalue when isMaxWidget is true, otherwise use datavalue
|
|
226
|
+
var effectiveDataValue = isMaxWidget ? maxDataValue !== undefined ? maxDataValue : datavalue : datavalue;
|
|
227
|
+
|
|
174
228
|
// Form properties
|
|
175
229
|
var trigger = formRef === null || formRef === void 0 ? void 0 : formRef.trigger;
|
|
176
230
|
var validationType = (form === null || form === void 0 ? void 0 : form.validationtype) || (formRef === null || formRef === void 0 ? void 0 : formRef.validationtype) || "default";
|
|
177
231
|
|
|
178
232
|
// Custom hooks
|
|
179
233
|
useFormRegistration(name, fieldProxy, contextFormRef);
|
|
180
|
-
|
|
181
|
-
|
|
234
|
+
// For max widgets: only sync maxdatavalue (don't sync datavalue as it shouldn't change)
|
|
235
|
+
// For regular widgets: sync datavalue
|
|
236
|
+
var syncValue = isMaxWidget ? maxDataValue !== undefined ? maxDataValue : undefined // Only sync maxDataValue for max widgets
|
|
237
|
+
: datavalue !== undefined ? datavalue : undefined; // Sync datavalue for regular widgets
|
|
238
|
+
useExternalDataSync(syncValue, fieldRef);
|
|
239
|
+
useDefaultValueSync(defaultvalue, datavalue, fieldRef);
|
|
240
|
+
// ignoring min/max range validation for Radioset and Checkboxset widgets
|
|
241
|
+
var widget = WrappedComponent === null || WrappedComponent === void 0 ? void 0 : WrappedComponent.displayName;
|
|
242
|
+
var ignoreRange = ["WmRadioset", "WmCheckboxset"].includes(widget !== null && widget !== void 0 ? widget : "");
|
|
243
|
+
var validationRules = useValidationRules(validationType, validators, asyncValidators, required, maxchars, regexp, validationmessage, ignoreRange ? undefined : minvalue, ignoreRange ? undefined : maxvalue, form);
|
|
244
|
+
var rules = {
|
|
245
|
+
required: required,
|
|
246
|
+
maxchars: maxchars,
|
|
247
|
+
regexp: regexp,
|
|
248
|
+
minvalue: minvalue,
|
|
249
|
+
maxvalue: maxvalue,
|
|
250
|
+
excludedays: props.excludedays,
|
|
251
|
+
excludedates: props.excludedates,
|
|
252
|
+
mintime: props.mintime,
|
|
253
|
+
maxtime: props.maxtime,
|
|
254
|
+
mindate: props.mindate,
|
|
255
|
+
maxdate: props.maxdate
|
|
256
|
+
};
|
|
257
|
+
var extractedValidatorProps = (0, _utils.extractDynamicValidationProps)(validators || [], rules);
|
|
182
258
|
var htmlValidationProps = useHTMLValidationProps(validationType, required, maxchars, regexp);
|
|
183
259
|
|
|
184
260
|
// Update observeRef when observe changes
|
|
@@ -186,9 +262,35 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
186
262
|
observeRef.current = observe;
|
|
187
263
|
}, [observe]);
|
|
188
264
|
|
|
265
|
+
// Destroy widget when component unmounts
|
|
266
|
+
(0, _react.useEffect)(function () {
|
|
267
|
+
return function () {
|
|
268
|
+
if (props.destroy) {
|
|
269
|
+
props.destroy([props.name, effectiveFormKey, "".concat(effectiveFormKey, "_formWidget"), "".concat(effectiveFormKey, "_formLabel")]);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
}, [props.destroy, effectiveFormKey]);
|
|
273
|
+
|
|
274
|
+
// Track if field has ever been touched
|
|
275
|
+
(0, _react.useEffect)(function () {
|
|
276
|
+
if (touched && !hasEverBeenTouchedRef.current) {
|
|
277
|
+
hasEverBeenTouchedRef.current = true;
|
|
278
|
+
}
|
|
279
|
+
}, [touched]);
|
|
280
|
+
(0, _react.useEffect)(function () {
|
|
281
|
+
if (isInitialMountRef.current) {
|
|
282
|
+
isInitialMountRef.current = false;
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
var hasBeenTouchedOrSubmitted = hasEverBeenTouchedRef.current || (formRef === null || formRef === void 0 ? void 0 : formRef.submitCount) && formRef.submitCount > 0;
|
|
286
|
+
if (trigger && effectiveFormKey && hasBeenTouchedOrSubmitted) {
|
|
287
|
+
trigger(effectiveFormKey);
|
|
288
|
+
}
|
|
289
|
+
}, [validationmessage]);
|
|
290
|
+
|
|
189
291
|
// Event handlers
|
|
190
292
|
var createOnChangeHandler = (0, _react.useCallback)(function (field) {
|
|
191
|
-
return function (e, componentProps, newValue) {
|
|
293
|
+
return function (e, componentProps, newValue, oldValue, isValid) {
|
|
192
294
|
var _props$onChange;
|
|
193
295
|
var valueToSet;
|
|
194
296
|
if (newValue !== undefined) {
|
|
@@ -208,7 +310,10 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
208
310
|
} else {
|
|
209
311
|
field.onChange(valueToSet);
|
|
210
312
|
}
|
|
211
|
-
(
|
|
313
|
+
if (isValid === false) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, e, componentProps, newValue, oldValue);
|
|
212
317
|
};
|
|
213
318
|
}, [type, props.datafield]);
|
|
214
319
|
var createOnBlurHandler = (0, _react.useCallback)(function (field, fieldState) {
|
|
@@ -219,7 +324,7 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
219
324
|
var shouldTriggerValidation = validationType === "html" && trigger && !!fieldState.error || validationType !== "none" && ((_observeRef$current = observeRef.current) === null || _observeRef$current === void 0 ? void 0 : _observeRef$current.length) && trigger;
|
|
220
325
|
if (shouldTriggerValidation) {
|
|
221
326
|
setTimeout(function () {
|
|
222
|
-
trigger(
|
|
327
|
+
trigger(effectiveFormKey);
|
|
223
328
|
});
|
|
224
329
|
}
|
|
225
330
|
onBlur === null || onBlur === void 0 || onBlur(e);
|
|
@@ -227,16 +332,16 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
227
332
|
}, [trigger, formKey, inputFieldName, onBlur, validationType]);
|
|
228
333
|
|
|
229
334
|
// Render without Controller if no formRef
|
|
230
|
-
if (!(formRef !== null && formRef !== void 0 && formRef.control)) {
|
|
335
|
+
if (!(formRef !== null && formRef !== void 0 && formRef.control) || props.ignoreInForm) {
|
|
231
336
|
return __jsx(WrappedComponent, props);
|
|
232
337
|
}
|
|
233
338
|
return __jsx(_reactHookForm.Controller, {
|
|
234
339
|
control: formRef.control,
|
|
235
|
-
name:
|
|
340
|
+
name: effectiveFormKey,
|
|
236
341
|
rules: validationRules,
|
|
237
|
-
defaultValue:
|
|
342
|
+
defaultValue: effectiveDataValue !== undefined ? effectiveDataValue : defaultvalue,
|
|
238
343
|
render: function render(_ref) {
|
|
239
|
-
var _fieldState$error;
|
|
344
|
+
var _props$className, _fieldState$error;
|
|
240
345
|
var field = _ref.field,
|
|
241
346
|
fieldState = _ref.fieldState;
|
|
242
347
|
// Store field reference for external updates
|
|
@@ -246,30 +351,64 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
246
351
|
var processedValue = processFieldValue(field.value, type, props.datafield);
|
|
247
352
|
var errorState = getErrorState(fieldState, validationType, touched);
|
|
248
353
|
|
|
354
|
+
// Determine the value to use with proper fallback chain
|
|
355
|
+
// Priority: field.value (if not undefined) -> datavalue (if not undefined) -> defaultvalue
|
|
356
|
+
var valueToUse;
|
|
357
|
+
if (processedValue !== undefined) {
|
|
358
|
+
valueToUse = processedValue;
|
|
359
|
+
} else {
|
|
360
|
+
valueToUse = defaultvalue;
|
|
361
|
+
}
|
|
362
|
+
|
|
249
363
|
// Build controlled props
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
364
|
+
// For max widgets: use max-prefixed properties (maxdatavalue, maxvalue, maxdisplayValue)
|
|
365
|
+
// For regular widgets: use regular properties (datavalue, value, displayValue)
|
|
366
|
+
var effectiveValue = processedValue !== undefined ? processedValue : defaultvalue;
|
|
367
|
+
var displayValueStr = effectiveValue !== null && effectiveValue !== undefined ? effectiveValue.toString() : "";
|
|
368
|
+
|
|
369
|
+
// For max widgets: use max-prefixed properties, keep regular properties unchanged
|
|
370
|
+
// For regular widgets: use regular properties
|
|
371
|
+
var maxWidgetProps = isMaxWidget ? {
|
|
372
|
+
datavalue: props.datavalue !== undefined ? props.datavalue : undefined,
|
|
373
|
+
// Keep original, don't update
|
|
374
|
+
value: props.value !== undefined ? props.value : undefined,
|
|
375
|
+
// Keep original, don't update
|
|
376
|
+
displayValue: props.displayValue !== undefined ? props.displayValue : undefined,
|
|
377
|
+
// Keep original, don't update
|
|
378
|
+
maxDataValue: effectiveValue,
|
|
379
|
+
// Update max-prefixed properties
|
|
380
|
+
maxdisplayValue: displayValueStr
|
|
381
|
+
} : {
|
|
382
|
+
// For regular widgets: use regular properties
|
|
383
|
+
datavalue: valueToUse,
|
|
384
|
+
value: valueToUse,
|
|
385
|
+
displayValue: displayValueStr,
|
|
386
|
+
maxvalue: props.maxvalue !== undefined ? props.maxvalue : undefined // Keep original, don't update
|
|
387
|
+
};
|
|
388
|
+
var controlledProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, props), extractedValidatorProps), validationType === "html" ? htmlValidationProps : {}), maxWidgetProps), {}, {
|
|
389
|
+
isMaxWidget: isMaxWidget,
|
|
390
|
+
// Ensure isMaxWidget is passed through
|
|
253
391
|
onChange: createOnChangeHandler(field),
|
|
254
392
|
onBlur: createOnBlurHandler(field, fieldState),
|
|
255
393
|
ref: field.ref
|
|
256
394
|
}, errorState), {}, {
|
|
257
|
-
required: validationType === "html" || !propsFormRef ? required :
|
|
395
|
+
required: validationType === "html" || !propsFormRef ? required : extractedValidatorProps.required || required,
|
|
258
396
|
isControlled: true,
|
|
259
397
|
formfield: true,
|
|
260
398
|
fieldName: inputFieldName,
|
|
261
399
|
name: name,
|
|
262
|
-
isRequiredLabel: required,
|
|
263
|
-
maxchars: maxchars,
|
|
264
|
-
regexp: regexp,
|
|
400
|
+
isRequiredLabel: validationType === "html" || !propsFormRef ? required : extractedValidatorProps.required || required,
|
|
265
401
|
className: (0, _clsx["default"])(wrappedComponentProps.className, {
|
|
266
402
|
hidden: contextFormRef === null || contextFormRef === void 0 ? void 0 : contextFormRef.isViewMode
|
|
267
403
|
})
|
|
268
404
|
});
|
|
405
|
+
var wrapperStyle = props !== null && props !== void 0 && (_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes("w-100") ? {
|
|
406
|
+
width: "auto"
|
|
407
|
+
} : {
|
|
408
|
+
width: "100%"
|
|
409
|
+
};
|
|
269
410
|
return __jsx("div", {
|
|
270
|
-
style:
|
|
271
|
-
width: "100%"
|
|
272
|
-
}
|
|
411
|
+
style: wrapperStyle
|
|
273
412
|
}, __jsx(WrappedComponent, (0, _extends2["default"])({}, controlledProps, {
|
|
274
413
|
dataset: props.dataset,
|
|
275
414
|
displayfield: props.displayfield
|
|
@@ -294,7 +433,7 @@ var withFormController = function withFormController(WrappedComponent) {
|
|
|
294
433
|
"aria-hidden": "true",
|
|
295
434
|
role: "alert",
|
|
296
435
|
"aria-live": "polite",
|
|
297
|
-
|
|
436
|
+
style: {
|
|
298
437
|
textAlign: "start",
|
|
299
438
|
width: "100%"
|
|
300
439
|
}
|
|
@@ -9,19 +9,14 @@ exports["default"] = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
|
-
var _composite = require("@wavemaker/react-runtime/components/input/composite");
|
|
14
12
|
var _filterFieldUtil = require("../../utils/filter-field-util");
|
|
15
13
|
var _formContext = require("@wavemaker/react-runtime/components/data/form/form-context");
|
|
16
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
17
15
|
var __jsx = _react["default"].createElement;
|
|
18
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
-
var DEFAULT_CLASS = "ng-pristine ng-invalid ng-touched";
|
|
21
|
-
var DEFAULT_COMPOSITE_CLASS = "app-composite-widget caption-left clearfix form-group live-field";
|
|
22
18
|
var BaseField = function BaseField(WrappedComponent) {
|
|
23
19
|
var FormField = function FormField(props) {
|
|
24
|
-
var _props$required;
|
|
25
20
|
var fieldRef = (0, _react.useRef)(null);
|
|
26
21
|
var _useState = (0, _react.useState)(props.validators || []),
|
|
27
22
|
validators = _useState[0],
|
|
@@ -52,7 +47,8 @@ var BaseField = function BaseField(WrappedComponent) {
|
|
|
52
47
|
function updateFormWidgetDataset(dataset, displayField) {
|
|
53
48
|
setRelatedData({
|
|
54
49
|
dataset: dataset.data,
|
|
55
|
-
displayfield: displayField || props.displayfield
|
|
50
|
+
displayfield: displayField || props.displayfield,
|
|
51
|
+
datafield: "All Fields"
|
|
56
52
|
});
|
|
57
53
|
|
|
58
54
|
// After updating the dataset, we need to ensure the form field value is synced
|
|
@@ -75,16 +71,52 @@ var BaseField = function BaseField(WrappedComponent) {
|
|
|
75
71
|
}
|
|
76
72
|
|
|
77
73
|
// Check if there's a required validator and update the required prop
|
|
78
|
-
var hasRequiredValidator =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
74
|
+
var hasRequiredValidator = function hasRequiredValidator() {
|
|
75
|
+
var checkRequiredValidator = function checkRequiredValidator(validator) {
|
|
76
|
+
if (validator.type === "required") {
|
|
77
|
+
if (typeof validator.validator === "function") {
|
|
78
|
+
try {
|
|
79
|
+
return validator.validator() === true;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn("Error calling required validator function:", error);
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return validator.validator === true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
};
|
|
89
|
+
return validators.some(checkRequiredValidator) || asyncValidators.some(checkRequiredValidator);
|
|
90
|
+
};
|
|
85
91
|
|
|
86
92
|
// Use the required prop from validators if present, otherwise use the original required prop
|
|
87
|
-
|
|
93
|
+
// If validators indicate required, that takes precedence
|
|
94
|
+
var isRequired = hasRequiredValidator() || props.required || false;
|
|
95
|
+
|
|
96
|
+
// Transform formKey to match actual data keys
|
|
97
|
+
var transformedFormKey = (0, _react.useMemo)(function () {
|
|
98
|
+
// Check if this is a child form (has parentForm or formKey contains child form pattern)
|
|
99
|
+
var isChildForm = props.parentForm;
|
|
100
|
+
if (isChildForm) {
|
|
101
|
+
// For child forms, use searchkey directly as it contains the actual field name
|
|
102
|
+
if (props.searchkey) {
|
|
103
|
+
return props.searchkey;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// For any field where searchkey exists and differs from formKey, use searchkey
|
|
108
|
+
// This handles cases where searchkey contains the actual data key
|
|
109
|
+
if (props.searchkey && props.searchkey !== props.formKey) {
|
|
110
|
+
return props.searchkey;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// For parent forms or when no transformation needed, use original formKey
|
|
114
|
+
return props.formKey;
|
|
115
|
+
}, [props.formKey, props.searchkey, props.formName, props.name, props.parentForm]);
|
|
116
|
+
function resetField() {
|
|
117
|
+
var fieldName = props.formKey || props.name;
|
|
118
|
+
(formContext === null || formContext === void 0 ? void 0 : formContext.resetField) && (formContext === null || formContext === void 0 ? void 0 : formContext.resetField(fieldName));
|
|
119
|
+
}
|
|
88
120
|
var modifiedProps = (0, _react.useMemo)(function () {
|
|
89
121
|
var _relatedData$dataset;
|
|
90
122
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -98,40 +130,29 @@ var BaseField = function BaseField(WrappedComponent) {
|
|
|
98
130
|
widgetCls: widgetCls,
|
|
99
131
|
captionCls: captionCls,
|
|
100
132
|
fieldRef: fieldRef,
|
|
133
|
+
reset: resetField,
|
|
101
134
|
fieldName: props.name,
|
|
135
|
+
formKey: transformedFormKey,
|
|
136
|
+
// Use transformed formKey
|
|
102
137
|
setIsDataSetBound: setIsDataSetBound,
|
|
103
138
|
isDataSetBound: isDataSetBound,
|
|
104
139
|
updateFormWidgetDataset: updateFormWidgetDataset,
|
|
105
140
|
setFieldDataSet: setFieldDataSet,
|
|
106
|
-
required: isRequired
|
|
141
|
+
required: isRequired,
|
|
142
|
+
captionposition: captionposition
|
|
107
143
|
}, relatedData.dataset && ((_relatedData$dataset = relatedData.dataset) === null || _relatedData$dataset === void 0 ? void 0 : _relatedData$dataset.length) > 0 ? {
|
|
108
144
|
datafield: relatedData.datafield,
|
|
109
145
|
dataset: relatedData.dataset,
|
|
110
146
|
displayfield: relatedData.displayfield
|
|
111
147
|
} : {});
|
|
112
|
-
}, [props, validators, asyncValidators, observe, observeOn, relatedData, isRequired]);
|
|
113
|
-
return __jsx("
|
|
114
|
-
className: (0, _clsx["default"])(props.className, DEFAULT_CLASS),
|
|
115
|
-
id: props.id,
|
|
116
|
-
style: _objectSpread({}, props.conditionalstyle),
|
|
117
|
-
"data-displayname": props.displayname,
|
|
118
|
-
"data-name": props.name,
|
|
119
|
-
"data-placeholder": props.placeholder,
|
|
120
|
-
name: props.name,
|
|
121
|
-
displayname: props.displayname,
|
|
122
|
-
placeholder: props.placeholder
|
|
123
|
-
}, __jsx(_composite.WmComposite, {
|
|
124
|
-
captionposition: captionposition || "left",
|
|
125
|
-
listener: {},
|
|
126
|
-
name: "",
|
|
127
|
-
className: DEFAULT_COMPOSITE_CLASS
|
|
128
|
-
}, __jsx(WrappedComponent, (0, _extends2["default"])({}, modifiedProps, {
|
|
148
|
+
}, [props, validators, asyncValidators, observe, observeOn, relatedData, isRequired, transformedFormKey]);
|
|
149
|
+
return __jsx(WrappedComponent, (0, _extends2["default"])({}, modifiedProps, {
|
|
129
150
|
validators: validators,
|
|
130
151
|
asyncValidators: asyncValidators,
|
|
131
152
|
setValidators: setValidators,
|
|
132
153
|
datavalue: props.datavalue || props.defaultvalue,
|
|
133
154
|
key: "".concat(props.formKey, "-").concat(relatedData.displayfield || "initial")
|
|
134
|
-
}))
|
|
155
|
+
}));
|
|
135
156
|
};
|
|
136
157
|
return FormField;
|
|
137
158
|
};
|
|
@@ -8,27 +8,50 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
11
12
|
var _isEqual = _interopRequireDefault(require("lodash-es/isEqual"));
|
|
12
13
|
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
13
14
|
var _baseField = _interopRequireDefault(require("./base-field"));
|
|
15
|
+
var _composite = require("@wavemaker/react-runtime/components/input/composite");
|
|
14
16
|
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); }
|
|
15
17
|
var __jsx = _react["default"].createElement;
|
|
16
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; }
|
|
17
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
var DEFAULT_CLASS = "ng-pristine ng-invalid ng-touched";
|
|
21
|
+
var DEFAULT_COMPOSITE_CLASS = "app-composite-widget caption-left clearfix form-group live-field";
|
|
18
22
|
var WmFormField = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
23
|
+
var _props$formRef;
|
|
19
24
|
// Use renderFormFields prop to render the actual form field component
|
|
20
25
|
// This allows parent components to pass in form fields wrapped with withFormController
|
|
21
|
-
|
|
26
|
+
function renderFormFields() {
|
|
22
27
|
if (props.formRef) {
|
|
23
28
|
return __jsx(_react["default"].Fragment, null, props.renderFormFields(_objectSpread({}, props)));
|
|
24
29
|
} else {
|
|
25
30
|
return null;
|
|
26
31
|
}
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
var itemsPerRow = (props === null || props === void 0 || (_props$formRef = props.formRef) === null || _props$formRef === void 0 ? void 0 : _props$formRef.itemsPerRow) || "";
|
|
34
|
+
if (props.hidden) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return __jsx("div", {
|
|
38
|
+
className: (0, _clsx["default"])(props.className, itemsPerRow, DEFAULT_CLASS),
|
|
39
|
+
id: props.id,
|
|
40
|
+
style: _objectSpread({}, props.conditionalstyle),
|
|
41
|
+
"data-displayname": props.displayname,
|
|
42
|
+
"data-name": props.name,
|
|
43
|
+
"data-placeholder": props.placeholder,
|
|
44
|
+
name: props.name,
|
|
45
|
+
displayname: props.displayname,
|
|
46
|
+
placeholder: props.placeholder,
|
|
47
|
+
hidden: props.hidden,
|
|
48
|
+
"data-role": props.role || "form-field"
|
|
49
|
+
}, __jsx(_composite.WmComposite, {
|
|
50
|
+
captionposition: props.captionposition || "left",
|
|
51
|
+
listener: {},
|
|
52
|
+
name: "",
|
|
53
|
+
className: DEFAULT_COMPOSITE_CLASS
|
|
54
|
+
}, renderFormFields()));
|
|
32
55
|
}, function (prev, next) {
|
|
33
56
|
return (0, _isEqual["default"])(prev, next);
|
|
34
57
|
});
|
|
@@ -33,12 +33,11 @@ var WmFormHeader = function WmFormHeader(props) {
|
|
|
33
33
|
}, props.subheading)), __jsx("div", {
|
|
34
34
|
className: "form-action panel-actions basic-btn-grp"
|
|
35
35
|
}, (props === null || props === void 0 ? void 0 : props.headerActions) && ((_Object$keys = Object.keys(props === null || props === void 0 ? void 0 : props.headerActions)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(function (actionName, index) {
|
|
36
|
-
return __jsx("
|
|
37
|
-
className: "form-action panel-actions basic-btn-grp",
|
|
36
|
+
return __jsx(_formAction["default"], (0, _extends2["default"])({
|
|
38
37
|
key: index
|
|
39
|
-
},
|
|
38
|
+
}, props === null || props === void 0 ? void 0 : props.headerActions[actionName], {
|
|
40
39
|
headeraction: true
|
|
41
|
-
}))
|
|
40
|
+
}));
|
|
42
41
|
})), props.collapsible && __jsx("div", {
|
|
43
42
|
className: "form-action panel-actions basic-btn-grp"
|
|
44
43
|
}, __jsx(_button.WmButton, {
|
|
@@ -6,15 +6,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
11
|
var _withBaseWrapper = _interopRequireDefault(require("@wavemaker/react-runtime/higherOrder/withBaseWrapper"));
|
|
10
12
|
var _message = require("@wavemaker/react-runtime/components/basic/message");
|
|
11
13
|
var _baseForm = _interopRequireDefault(require("./base-form"));
|
|
12
14
|
var _formHeader = _interopRequireDefault(require("./form-header"));
|
|
15
|
+
var _attr = require("@wavemaker/react-runtime/utils/attr");
|
|
13
16
|
var __jsx = _react["default"].createElement;
|
|
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; }
|
|
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; }
|
|
14
19
|
var WmForm = function WmForm(props) {
|
|
15
20
|
var _props$headerActions, _props$statusMessage, _props$statusMessage2, _props$statusMessage3, _props$statusMessage4;
|
|
16
21
|
var shouldHideHeader = props.isLayoutDialog || props.isInsideWizard;
|
|
17
|
-
return __jsx(
|
|
22
|
+
return __jsx("form", (0, _extends2["default"])({}, (0, _attr.removeInvalidAttributes)(props), {
|
|
23
|
+
hidden: props.hidden || false,
|
|
24
|
+
name: props.name,
|
|
25
|
+
defaultmode: props.defaultmode,
|
|
26
|
+
captionposition: props.captionposition,
|
|
27
|
+
captionalign: props.captionalign,
|
|
28
|
+
numberoffields: props.numberoffields,
|
|
29
|
+
className: props.className,
|
|
30
|
+
id: props.id,
|
|
31
|
+
onSubmit: props.submit,
|
|
32
|
+
style: _objectSpread(_objectSpread({}, props.styles), props.conditionalstyle),
|
|
33
|
+
onReset: props.formreset,
|
|
34
|
+
ref: props.formElementRef,
|
|
35
|
+
noValidate: props.validationtype !== "html"
|
|
36
|
+
}), !shouldHideHeader && ((props === null || props === void 0 ? void 0 : props.title) || (props === null || props === void 0 ? void 0 : props.subheading) || (props === null || props === void 0 ? void 0 : props.iconclass) || (props === null || props === void 0 || (_props$headerActions = props.headerActions) === null || _props$headerActions === void 0 ? void 0 : _props$headerActions.length) > 0 || (props === null || props === void 0 ? void 0 : props.collapsible)) && __jsx(_formHeader["default"], {
|
|
18
37
|
title: props.title,
|
|
19
38
|
subheading: props.subheading,
|
|
20
39
|
iconclass: props.iconclass,
|
|
@@ -106,7 +106,8 @@ var SortableItem = exports.SortableItem = function SortableItem(_ref) {
|
|
|
106
106
|
cursor: enableReorder && !disableItem ? "grab" : undefined,
|
|
107
107
|
touchAction: "none",
|
|
108
108
|
position: "relative",
|
|
109
|
-
willChange: "transform"
|
|
109
|
+
willChange: "transform",
|
|
110
|
+
width: "100%"
|
|
110
111
|
};
|
|
111
112
|
return __jsx("div", (0, _extends2["default"])({
|
|
112
113
|
ref: setNodeRef,
|