@pdg/react-form 1.0.131 → 1.0.132
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.
|
@@ -12,6 +12,7 @@ export interface FormProps extends CommonSxProps, PartialPick<FormControlProps,
|
|
|
12
12
|
fullHeight?: boolean;
|
|
13
13
|
formColGap?: number;
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
submitWhenReturnKey?: boolean;
|
|
15
16
|
onSubmit?(data: FormValueMap): void;
|
|
16
17
|
onInvalid?(invalidItems: FormInvalidItems): void;
|
|
17
18
|
onValueChange?(name: string, value: any): void;
|
|
@@ -4,10 +4,12 @@ export interface FormContextValue<T = any, AllowUndefinedValue extends boolean =
|
|
|
4
4
|
id: string;
|
|
5
5
|
fullHeight?: boolean;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
submitWhenReturnKey?: boolean;
|
|
7
8
|
onAddValueItem(id: string, commands: FormValueItemCommands<T, AllowUndefinedValue>): void;
|
|
8
9
|
onRemoveValueItem(id: string): void;
|
|
9
10
|
onValueChange(name: string, value: T): void;
|
|
10
11
|
onValueChangeByUser(name: string, value: T): void;
|
|
12
|
+
onRequestSubmit(name: string, value: T): void;
|
|
11
13
|
onRequestSearchSubmit(name: string, value: T): void;
|
|
12
14
|
/** FormRow */
|
|
13
15
|
formColAutoXs?: number;
|
package/dist/index.esm.js
CHANGED
|
@@ -99,6 +99,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
99
99
|
// eslint-disable-next-line
|
|
100
100
|
onValueChangeByUser: function () { },
|
|
101
101
|
// eslint-disable-next-line
|
|
102
|
+
onRequestSubmit: function () { },
|
|
103
|
+
// eslint-disable-next-line
|
|
102
104
|
onRequestSearchSubmit: function () { },
|
|
103
105
|
};var FormContext = createContext(FormContextDefaultValue);function useFormState() {
|
|
104
106
|
var value = useContext(FormContext);
|
|
@@ -232,10 +234,10 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
232
234
|
//--------------------------------------------------------------------------------------------------------------------
|
|
233
235
|
_b = _a.variant,
|
|
234
236
|
//--------------------------------------------------------------------------------------------------------------------
|
|
235
|
-
initVariant = _b === void 0 ? 'outlined' : _b, _c = _a.size, initSize = _c === void 0 ? 'medium' : _c, _d = _a.color, initColor = _d === void 0 ? 'primary' : _d, _e = _a.spacing, initSpacing = _e === void 0 ? 2 : _e, _f = _a.formColGap, initFormColGap = _f === void 0 ? 1.5 : _f, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth, initFullHeight = _a.fullHeight, initDisabled = _a.disabled,
|
|
237
|
+
initVariant = _b === void 0 ? 'outlined' : _b, _c = _a.size, initSize = _c === void 0 ? 'medium' : _c, _d = _a.color, initColor = _d === void 0 ? 'primary' : _d, _e = _a.spacing, initSpacing = _e === void 0 ? 2 : _e, _f = _a.formColGap, initFormColGap = _f === void 0 ? 1.5 : _f, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth, initFullHeight = _a.fullHeight, initDisabled = _a.disabled, initSubmitWhenReturnKey = _a.submitWhenReturnKey,
|
|
236
238
|
//----------------------------------------------------------------------------------------------------------------
|
|
237
239
|
initOnSubmit = _a.onSubmit, initOnValid = _a.onInvalid, initOnValueChange = _a.onValueChange, initOnValueChangeByUser = _a.onValueChangeByUser;
|
|
238
|
-
var _g = useFormState(), formId = _g.id, formVariant = _g.variant, formSize = _g.size, formColor = _g.color, formDisabled = _g.disabled, formSpacing = _g.spacing, formFormColGap = _g.formColGap, formFocused = _g.focused, formLabelShrink = _g.labelShrink, formFullWidth = _g.fullWidth, formFullHeight = _g.fullHeight, formColAutoXs = _g.formColAutoXs, formColWidth = _g.formColWidth, onAddFormCol = _g.onAddFormCol, onRemoveFormCol = _g.onRemoveFormCol, formColXs = _g.formColXs, formColWithLabel = _g.formColWithLabel, formColWithHelperText = _g.formColWithHelperText, formAddValueItem = _g.onAddValueItem, formRemoveValueItem = _g.onRemoveValueItem, formValueChange = _g.onValueChange, formValueChangeByUser = _g.onValueChangeByUser, formRequestSearchSubmit = _g.onRequestSearchSubmit;
|
|
240
|
+
var _g = useFormState(), formId = _g.id, formVariant = _g.variant, formSize = _g.size, formColor = _g.color, formDisabled = _g.disabled, formSubmitWhenReturnKey = _g.submitWhenReturnKey, formSpacing = _g.spacing, formFormColGap = _g.formColGap, formFocused = _g.focused, formLabelShrink = _g.labelShrink, formFullWidth = _g.fullWidth, formFullHeight = _g.fullHeight, formColAutoXs = _g.formColAutoXs, formColWidth = _g.formColWidth, onAddFormCol = _g.onAddFormCol, onRemoveFormCol = _g.onRemoveFormCol, formColXs = _g.formColXs, formColWithLabel = _g.formColWithLabel, formColWithHelperText = _g.formColWithHelperText, formAddValueItem = _g.onAddValueItem, formRemoveValueItem = _g.onRemoveValueItem, formValueChange = _g.onValueChange, formValueChangeByUser = _g.onValueChangeByUser, formRequestSubmit = _g.onRequestSubmit, formRequestSearchSubmit = _g.onRequestSearchSubmit;
|
|
239
241
|
/********************************************************************************************************************
|
|
240
242
|
* Memo - FormState
|
|
241
243
|
* ******************************************************************************************************************/
|
|
@@ -249,6 +251,7 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
249
251
|
var fullWidth = ifUndefined(ifUndefined(initFullWidth, formFullWidth), true);
|
|
250
252
|
var fullHeight = ifUndefined(ifUndefined(initFullHeight, formFullHeight), false);
|
|
251
253
|
var disabled = ifUndefined(ifUndefined(initDisabled, formDisabled), false);
|
|
254
|
+
var submitWhenReturnKey = ifUndefined(ifUndefined(initSubmitWhenReturnKey, formSubmitWhenReturnKey), false);
|
|
252
255
|
/********************************************************************************************************************
|
|
253
256
|
* Ref
|
|
254
257
|
* ******************************************************************************************************************/
|
|
@@ -556,6 +559,7 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
556
559
|
fullWidth: fullWidth,
|
|
557
560
|
fullHeight: fullHeight,
|
|
558
561
|
disabled: disabled,
|
|
562
|
+
submitWhenReturnKey: submitWhenReturnKey,
|
|
559
563
|
onAddValueItem: function (id, item) {
|
|
560
564
|
valueItems.current[id] = item;
|
|
561
565
|
if (formAddValueItem)
|
|
@@ -578,6 +582,12 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
578
582
|
if (formValueChangeByUser)
|
|
579
583
|
formValueChangeByUser(name, value);
|
|
580
584
|
},
|
|
585
|
+
onRequestSubmit: function (name, value) {
|
|
586
|
+
if (!disabled)
|
|
587
|
+
submit();
|
|
588
|
+
if (formRequestSubmit)
|
|
589
|
+
formRequestSubmit(name, value);
|
|
590
|
+
},
|
|
581
591
|
onRequestSearchSubmit: formRequestSearchSubmit,
|
|
582
592
|
formColAutoXs: formColAutoXs,
|
|
583
593
|
formColWidth: formColWidth,
|
|
@@ -599,6 +609,7 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
599
609
|
fullWidth,
|
|
600
610
|
fullHeight,
|
|
601
611
|
disabled,
|
|
612
|
+
submitWhenReturnKey,
|
|
602
613
|
formRequestSearchSubmit,
|
|
603
614
|
formColAutoXs,
|
|
604
615
|
formColWidth,
|
|
@@ -613,6 +624,8 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
613
624
|
formValueChange,
|
|
614
625
|
onValueChangeByUserRef,
|
|
615
626
|
formValueChangeByUser,
|
|
627
|
+
submit,
|
|
628
|
+
formRequestSubmit,
|
|
616
629
|
]);
|
|
617
630
|
/********************************************************************************************************************
|
|
618
631
|
* Render
|
|
@@ -1026,7 +1039,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1026
1039
|
* ID
|
|
1027
1040
|
* ******************************************************************************************************************/
|
|
1028
1041
|
var _b, _c;
|
|
1029
|
-
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
|
|
1042
|
+
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth, initSubmitWhenReturnKey = _a.submitWhenReturnKey,
|
|
1030
1043
|
//----------------------------------------------------------------------------------------------------------------
|
|
1031
1044
|
name = _a.name, required = _a.required, initValue = _a.value, initData = _a.data, icon = _a.icon, labelIcon = _a.labelIcon, initLabel = _a.label, initError = _a.error, helperText = _a.helperText, exceptValue = _a.exceptValue, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initDisabled = _a.disabled, placeholder = _a.placeholder, maxLength = _a.maxLength, clear = _a.clear, width = _a.width, initMuiInputProps = _a.InputProps, initMuiInputLabelProps = _a.InputLabelProps, initInputProps = _a.inputProps, initInputRef = _a.inputRef, select = _a.select, SelectProps = _a.SelectProps, multiline = _a.multiline, validPattern = _a.validPattern, invalidPattern = _a.invalidPattern, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, noFormValueItem = _a.noFormValueItem, initHidden = _a.hidden, disableReturnKey = _a.disableReturnKey,
|
|
1032
1045
|
//----------------------------------------------------------------------------------------------------------------
|
|
@@ -1034,7 +1047,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1034
1047
|
//----------------------------------------------------------------------------------------------------------------
|
|
1035
1048
|
className = _a.className, initStyle = _a.style,
|
|
1036
1049
|
//----------------------------------------------------------------------------------------------------------------
|
|
1037
|
-
props = __rest(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "name", "required", "value", "data", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "disableReturnKey", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
|
|
1050
|
+
props = __rest(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "submitWhenReturnKey", "name", "required", "value", "data", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "disableReturnKey", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
|
|
1038
1051
|
var id = useId();
|
|
1039
1052
|
/********************************************************************************************************************
|
|
1040
1053
|
* Ref
|
|
@@ -1043,7 +1056,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1043
1056
|
/********************************************************************************************************************
|
|
1044
1057
|
* FormState
|
|
1045
1058
|
* ******************************************************************************************************************/
|
|
1046
|
-
var _d = useFormState(), formVariant = _d.variant, formSize = _d.size, formColor = _d.color, formFocused = _d.focused, formLabelShrink = _d.labelShrink, formFullWidth = _d.fullWidth, formDisabled = _d.disabled, formColWithHelperText = _d.formColWithHelperText, onAddValueItem = _d.onAddValueItem, onRemoveValueItem = _d.onRemoveValueItem, onValueChange = _d.onValueChange, onValueChangeByUser = _d.onValueChangeByUser, onRequestSearchSubmit = _d.onRequestSearchSubmit;
|
|
1059
|
+
var _d = useFormState(), formVariant = _d.variant, formSize = _d.size, formColor = _d.color, formFocused = _d.focused, formLabelShrink = _d.labelShrink, formFullWidth = _d.fullWidth, formDisabled = _d.disabled, formSubmitWhenReturnKey = _d.submitWhenReturnKey, formColWithHelperText = _d.formColWithHelperText, onAddValueItem = _d.onAddValueItem, onRemoveValueItem = _d.onRemoveValueItem, onValueChange = _d.onValueChange, onValueChangeByUser = _d.onValueChangeByUser, onRequestSubmit = _d.onRequestSubmit, onRequestSearchSubmit = _d.onRequestSearchSubmit;
|
|
1047
1060
|
/********************************************************************************************************************
|
|
1048
1061
|
* Memo - FormState
|
|
1049
1062
|
* ******************************************************************************************************************/
|
|
@@ -1053,6 +1066,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1053
1066
|
var focused = ifUndefined(initFocused, formFocused);
|
|
1054
1067
|
var labelShrink = ifUndefined(initLabelShrink, formLabelShrink);
|
|
1055
1068
|
var fullWidth = ifUndefined(initFullWidth, formFullWidth);
|
|
1069
|
+
var submitWhenReturnKey = ifUndefined(initSubmitWhenReturnKey, formSubmitWhenReturnKey);
|
|
1056
1070
|
/********************************************************************************************************************
|
|
1057
1071
|
* State
|
|
1058
1072
|
* ******************************************************************************************************************/
|
|
@@ -1274,11 +1288,25 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1274
1288
|
!noFormValueItem) {
|
|
1275
1289
|
e.preventDefault();
|
|
1276
1290
|
e.stopPropagation();
|
|
1291
|
+
if (submitWhenReturnKey) {
|
|
1292
|
+
onRequestSubmit(name, valueRef.current);
|
|
1293
|
+
}
|
|
1277
1294
|
onRequestSearchSubmit(name, valueRef.current);
|
|
1278
1295
|
}
|
|
1279
1296
|
if (onKeyDown)
|
|
1280
1297
|
onKeyDown(e);
|
|
1281
|
-
}, [
|
|
1298
|
+
}, [
|
|
1299
|
+
select,
|
|
1300
|
+
multiline,
|
|
1301
|
+
disableReturnKey,
|
|
1302
|
+
noFormValueItem,
|
|
1303
|
+
onKeyDown,
|
|
1304
|
+
submitWhenReturnKey,
|
|
1305
|
+
onRequestSearchSubmit,
|
|
1306
|
+
name,
|
|
1307
|
+
valueRef,
|
|
1308
|
+
onRequestSubmit,
|
|
1309
|
+
]);
|
|
1282
1310
|
/********************************************************************************************************************
|
|
1283
1311
|
* Variable
|
|
1284
1312
|
* ******************************************************************************************************************/
|
|
@@ -10230,6 +10258,10 @@ FormSwitch.displayName = 'FormSwitch';var SearchGroupRow = function (_a) {
|
|
|
10230
10258
|
onValueChange: function () { },
|
|
10231
10259
|
// eslint-disable-next-line
|
|
10232
10260
|
onValueChangeByUser: function () { },
|
|
10261
|
+
onRequestSubmit: function () {
|
|
10262
|
+
var _a;
|
|
10263
|
+
(_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit();
|
|
10264
|
+
},
|
|
10233
10265
|
onRequestSearchSubmit: function () {
|
|
10234
10266
|
var _a;
|
|
10235
10267
|
if (autoSubmit) {
|
package/dist/index.js
CHANGED
|
@@ -99,6 +99,8 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
99
99
|
// eslint-disable-next-line
|
|
100
100
|
onValueChangeByUser: function () { },
|
|
101
101
|
// eslint-disable-next-line
|
|
102
|
+
onRequestSubmit: function () { },
|
|
103
|
+
// eslint-disable-next-line
|
|
102
104
|
onRequestSearchSubmit: function () { },
|
|
103
105
|
};var FormContext = React.createContext(FormContextDefaultValue);function useFormState() {
|
|
104
106
|
var value = React.useContext(FormContext);
|
|
@@ -232,10 +234,10 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
232
234
|
//--------------------------------------------------------------------------------------------------------------------
|
|
233
235
|
_b = _a.variant,
|
|
234
236
|
//--------------------------------------------------------------------------------------------------------------------
|
|
235
|
-
initVariant = _b === void 0 ? 'outlined' : _b, _c = _a.size, initSize = _c === void 0 ? 'medium' : _c, _d = _a.color, initColor = _d === void 0 ? 'primary' : _d, _e = _a.spacing, initSpacing = _e === void 0 ? 2 : _e, _f = _a.formColGap, initFormColGap = _f === void 0 ? 1.5 : _f, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth, initFullHeight = _a.fullHeight, initDisabled = _a.disabled,
|
|
237
|
+
initVariant = _b === void 0 ? 'outlined' : _b, _c = _a.size, initSize = _c === void 0 ? 'medium' : _c, _d = _a.color, initColor = _d === void 0 ? 'primary' : _d, _e = _a.spacing, initSpacing = _e === void 0 ? 2 : _e, _f = _a.formColGap, initFormColGap = _f === void 0 ? 1.5 : _f, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth, initFullHeight = _a.fullHeight, initDisabled = _a.disabled, initSubmitWhenReturnKey = _a.submitWhenReturnKey,
|
|
236
238
|
//----------------------------------------------------------------------------------------------------------------
|
|
237
239
|
initOnSubmit = _a.onSubmit, initOnValid = _a.onInvalid, initOnValueChange = _a.onValueChange, initOnValueChangeByUser = _a.onValueChangeByUser;
|
|
238
|
-
var _g = useFormState(), formId = _g.id, formVariant = _g.variant, formSize = _g.size, formColor = _g.color, formDisabled = _g.disabled, formSpacing = _g.spacing, formFormColGap = _g.formColGap, formFocused = _g.focused, formLabelShrink = _g.labelShrink, formFullWidth = _g.fullWidth, formFullHeight = _g.fullHeight, formColAutoXs = _g.formColAutoXs, formColWidth = _g.formColWidth, onAddFormCol = _g.onAddFormCol, onRemoveFormCol = _g.onRemoveFormCol, formColXs = _g.formColXs, formColWithLabel = _g.formColWithLabel, formColWithHelperText = _g.formColWithHelperText, formAddValueItem = _g.onAddValueItem, formRemoveValueItem = _g.onRemoveValueItem, formValueChange = _g.onValueChange, formValueChangeByUser = _g.onValueChangeByUser, formRequestSearchSubmit = _g.onRequestSearchSubmit;
|
|
240
|
+
var _g = useFormState(), formId = _g.id, formVariant = _g.variant, formSize = _g.size, formColor = _g.color, formDisabled = _g.disabled, formSubmitWhenReturnKey = _g.submitWhenReturnKey, formSpacing = _g.spacing, formFormColGap = _g.formColGap, formFocused = _g.focused, formLabelShrink = _g.labelShrink, formFullWidth = _g.fullWidth, formFullHeight = _g.fullHeight, formColAutoXs = _g.formColAutoXs, formColWidth = _g.formColWidth, onAddFormCol = _g.onAddFormCol, onRemoveFormCol = _g.onRemoveFormCol, formColXs = _g.formColXs, formColWithLabel = _g.formColWithLabel, formColWithHelperText = _g.formColWithHelperText, formAddValueItem = _g.onAddValueItem, formRemoveValueItem = _g.onRemoveValueItem, formValueChange = _g.onValueChange, formValueChangeByUser = _g.onValueChangeByUser, formRequestSubmit = _g.onRequestSubmit, formRequestSearchSubmit = _g.onRequestSearchSubmit;
|
|
239
241
|
/********************************************************************************************************************
|
|
240
242
|
* Memo - FormState
|
|
241
243
|
* ******************************************************************************************************************/
|
|
@@ -249,6 +251,7 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
249
251
|
var fullWidth = util.ifUndefined(util.ifUndefined(initFullWidth, formFullWidth), true);
|
|
250
252
|
var fullHeight = util.ifUndefined(util.ifUndefined(initFullHeight, formFullHeight), false);
|
|
251
253
|
var disabled = util.ifUndefined(util.ifUndefined(initDisabled, formDisabled), false);
|
|
254
|
+
var submitWhenReturnKey = util.ifUndefined(util.ifUndefined(initSubmitWhenReturnKey, formSubmitWhenReturnKey), false);
|
|
252
255
|
/********************************************************************************************************************
|
|
253
256
|
* Ref
|
|
254
257
|
* ******************************************************************************************************************/
|
|
@@ -556,6 +559,7 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
556
559
|
fullWidth: fullWidth,
|
|
557
560
|
fullHeight: fullHeight,
|
|
558
561
|
disabled: disabled,
|
|
562
|
+
submitWhenReturnKey: submitWhenReturnKey,
|
|
559
563
|
onAddValueItem: function (id, item) {
|
|
560
564
|
valueItems.current[id] = item;
|
|
561
565
|
if (formAddValueItem)
|
|
@@ -578,6 +582,12 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
578
582
|
if (formValueChangeByUser)
|
|
579
583
|
formValueChangeByUser(name, value);
|
|
580
584
|
},
|
|
585
|
+
onRequestSubmit: function (name, value) {
|
|
586
|
+
if (!disabled)
|
|
587
|
+
submit();
|
|
588
|
+
if (formRequestSubmit)
|
|
589
|
+
formRequestSubmit(name, value);
|
|
590
|
+
},
|
|
581
591
|
onRequestSearchSubmit: formRequestSearchSubmit,
|
|
582
592
|
formColAutoXs: formColAutoXs,
|
|
583
593
|
formColWidth: formColWidth,
|
|
@@ -599,6 +609,7 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
599
609
|
fullWidth,
|
|
600
610
|
fullHeight,
|
|
601
611
|
disabled,
|
|
612
|
+
submitWhenReturnKey,
|
|
602
613
|
formRequestSearchSubmit,
|
|
603
614
|
formColAutoXs,
|
|
604
615
|
formColWidth,
|
|
@@ -613,6 +624,8 @@ var appendFormValueData = function (data, itemCommands) {
|
|
|
613
624
|
formValueChange,
|
|
614
625
|
onValueChangeByUserRef,
|
|
615
626
|
formValueChangeByUser,
|
|
627
|
+
submit,
|
|
628
|
+
formRequestSubmit,
|
|
616
629
|
]);
|
|
617
630
|
/********************************************************************************************************************
|
|
618
631
|
* Render
|
|
@@ -1026,7 +1039,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1026
1039
|
* ID
|
|
1027
1040
|
* ******************************************************************************************************************/
|
|
1028
1041
|
var _b, _c;
|
|
1029
|
-
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth,
|
|
1042
|
+
var initVariant = _a.variant, initSize = _a.size, initColor = _a.color, initFocused = _a.focused, initLabelShrink = _a.labelShrink, initFullWidth = _a.fullWidth, initSubmitWhenReturnKey = _a.submitWhenReturnKey,
|
|
1030
1043
|
//----------------------------------------------------------------------------------------------------------------
|
|
1031
1044
|
name = _a.name, required = _a.required, initValue = _a.value, initData = _a.data, icon = _a.icon, labelIcon = _a.labelIcon, initLabel = _a.label, initError = _a.error, helperText = _a.helperText, exceptValue = _a.exceptValue, readOnly = _a.readOnly, tabIndex = _a.tabIndex, initDisabled = _a.disabled, placeholder = _a.placeholder, maxLength = _a.maxLength, clear = _a.clear, width = _a.width, initMuiInputProps = _a.InputProps, initMuiInputLabelProps = _a.InputLabelProps, initInputProps = _a.inputProps, initInputRef = _a.inputRef, select = _a.select, SelectProps = _a.SelectProps, multiline = _a.multiline, validPattern = _a.validPattern, invalidPattern = _a.invalidPattern, startAdornment = _a.startAdornment, endAdornment = _a.endAdornment, noFormValueItem = _a.noFormValueItem, initHidden = _a.hidden, disableReturnKey = _a.disableReturnKey,
|
|
1032
1045
|
//----------------------------------------------------------------------------------------------------------------
|
|
@@ -1034,7 +1047,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1034
1047
|
//----------------------------------------------------------------------------------------------------------------
|
|
1035
1048
|
className = _a.className, initStyle = _a.style,
|
|
1036
1049
|
//----------------------------------------------------------------------------------------------------------------
|
|
1037
|
-
props = __rest(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "name", "required", "value", "data", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "disableReturnKey", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
|
|
1050
|
+
props = __rest(_a, ["variant", "size", "color", "focused", "labelShrink", "fullWidth", "submitWhenReturnKey", "name", "required", "value", "data", "icon", "labelIcon", "label", "error", "helperText", "exceptValue", "readOnly", "tabIndex", "disabled", "placeholder", "maxLength", "clear", "width", "InputProps", "InputLabelProps", "inputProps", "inputRef", "select", "SelectProps", "multiline", "validPattern", "invalidPattern", "startAdornment", "endAdornment", "noFormValueItem", "hidden", "disableReturnKey", "onChange", "onValue", "onValidate", "onBlur", "onKeyDown", "className", "style"]);
|
|
1038
1051
|
var id = React.useId();
|
|
1039
1052
|
/********************************************************************************************************************
|
|
1040
1053
|
* Ref
|
|
@@ -1043,7 +1056,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1043
1056
|
/********************************************************************************************************************
|
|
1044
1057
|
* FormState
|
|
1045
1058
|
* ******************************************************************************************************************/
|
|
1046
|
-
var _d = useFormState(), formVariant = _d.variant, formSize = _d.size, formColor = _d.color, formFocused = _d.focused, formLabelShrink = _d.labelShrink, formFullWidth = _d.fullWidth, formDisabled = _d.disabled, formColWithHelperText = _d.formColWithHelperText, onAddValueItem = _d.onAddValueItem, onRemoveValueItem = _d.onRemoveValueItem, onValueChange = _d.onValueChange, onValueChangeByUser = _d.onValueChangeByUser, onRequestSearchSubmit = _d.onRequestSearchSubmit;
|
|
1059
|
+
var _d = useFormState(), formVariant = _d.variant, formSize = _d.size, formColor = _d.color, formFocused = _d.focused, formLabelShrink = _d.labelShrink, formFullWidth = _d.fullWidth, formDisabled = _d.disabled, formSubmitWhenReturnKey = _d.submitWhenReturnKey, formColWithHelperText = _d.formColWithHelperText, onAddValueItem = _d.onAddValueItem, onRemoveValueItem = _d.onRemoveValueItem, onValueChange = _d.onValueChange, onValueChangeByUser = _d.onValueChangeByUser, onRequestSubmit = _d.onRequestSubmit, onRequestSearchSubmit = _d.onRequestSearchSubmit;
|
|
1047
1060
|
/********************************************************************************************************************
|
|
1048
1061
|
* Memo - FormState
|
|
1049
1062
|
* ******************************************************************************************************************/
|
|
@@ -1053,6 +1066,7 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1053
1066
|
var focused = util.ifUndefined(initFocused, formFocused);
|
|
1054
1067
|
var labelShrink = util.ifUndefined(initLabelShrink, formLabelShrink);
|
|
1055
1068
|
var fullWidth = util.ifUndefined(initFullWidth, formFullWidth);
|
|
1069
|
+
var submitWhenReturnKey = util.ifUndefined(initSubmitWhenReturnKey, formSubmitWhenReturnKey);
|
|
1056
1070
|
/********************************************************************************************************************
|
|
1057
1071
|
* State
|
|
1058
1072
|
* ******************************************************************************************************************/
|
|
@@ -1274,11 +1288,25 @@ styleInject(css_248z$l);var FormTextField = React.forwardRef(function (_a, ref)
|
|
|
1274
1288
|
!noFormValueItem) {
|
|
1275
1289
|
e.preventDefault();
|
|
1276
1290
|
e.stopPropagation();
|
|
1291
|
+
if (submitWhenReturnKey) {
|
|
1292
|
+
onRequestSubmit(name, valueRef.current);
|
|
1293
|
+
}
|
|
1277
1294
|
onRequestSearchSubmit(name, valueRef.current);
|
|
1278
1295
|
}
|
|
1279
1296
|
if (onKeyDown)
|
|
1280
1297
|
onKeyDown(e);
|
|
1281
|
-
}, [
|
|
1298
|
+
}, [
|
|
1299
|
+
select,
|
|
1300
|
+
multiline,
|
|
1301
|
+
disableReturnKey,
|
|
1302
|
+
noFormValueItem,
|
|
1303
|
+
onKeyDown,
|
|
1304
|
+
submitWhenReturnKey,
|
|
1305
|
+
onRequestSearchSubmit,
|
|
1306
|
+
name,
|
|
1307
|
+
valueRef,
|
|
1308
|
+
onRequestSubmit,
|
|
1309
|
+
]);
|
|
1282
1310
|
/********************************************************************************************************************
|
|
1283
1311
|
* Variable
|
|
1284
1312
|
* ******************************************************************************************************************/
|
|
@@ -10230,6 +10258,10 @@ FormSwitch.displayName = 'FormSwitch';var SearchGroupRow = function (_a) {
|
|
|
10230
10258
|
onValueChange: function () { },
|
|
10231
10259
|
// eslint-disable-next-line
|
|
10232
10260
|
onValueChangeByUser: function () { },
|
|
10261
|
+
onRequestSubmit: function () {
|
|
10262
|
+
var _a;
|
|
10263
|
+
(_a = formRef.current) === null || _a === void 0 ? void 0 : _a.submit();
|
|
10264
|
+
},
|
|
10233
10265
|
onRequestSearchSubmit: function () {
|
|
10234
10266
|
var _a;
|
|
10235
10267
|
if (autoSubmit) {
|