@sunggang/ui-lib 0.2.99 → 0.3.1
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/BaseCkeditor.esm.js +55998 -56018
- package/index.esm.js +1 -0
- package/index.esm2.js +916 -843
- package/index.esm3.js +1 -0
- package/package.json +1 -1
- package/src/lib/Ckeditor/BaseCkeditor.d.ts +5 -0
- package/src/lib/Ckeditor/index.d.ts +1 -1
- package/src/lib/Form/index.d.ts +5 -0
package/index.esm2.js
CHANGED
|
@@ -18,6 +18,7 @@ import * as locales from 'react-date-range/dist/locale/index.js';
|
|
|
18
18
|
import addDays from 'date-fns/addDays/index.js';
|
|
19
19
|
import format$1 from 'date-fns/format/index.js';
|
|
20
20
|
import { keyframes, jsx as jsx$1, css as css$2 } from '@emotion/react';
|
|
21
|
+
import { Checkbox, RadioGroup, FormControlLabel, Radio } from '@mui/material';
|
|
21
22
|
import { useReactTable, getCoreRowModel, getPaginationRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
|
|
22
23
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
23
24
|
import { ChevronRightIcon, CheckIcon, DotFilledIcon } from '@radix-ui/react-icons';
|
|
@@ -19579,7 +19580,6 @@ var set = function(object, path, value1) {
|
|
|
19579
19580
|
object[key] = newValue;
|
|
19580
19581
|
object = object[key];
|
|
19581
19582
|
}
|
|
19582
|
-
return object;
|
|
19583
19583
|
};
|
|
19584
19584
|
var EVENTS = {
|
|
19585
19585
|
BLUR: "blur",
|
|
@@ -19692,42 +19692,6 @@ var getProxyFormState = function(formState, control, localProxyFormState) {
|
|
|
19692
19692
|
for(var key in formState)_loop(key);
|
|
19693
19693
|
return result;
|
|
19694
19694
|
};
|
|
19695
|
-
var isEmptyObject = function(value1) {
|
|
19696
|
-
return isObject$a(value1) && !Object.keys(value1).length;
|
|
19697
|
-
};
|
|
19698
|
-
var shouldRenderFormState = function(formStateData, _proxyFormState, updateFormState, isRoot) {
|
|
19699
|
-
updateFormState(formStateData);
|
|
19700
|
-
formStateData.name; var formState = _object_without_properties$7(formStateData, [
|
|
19701
|
-
"name"
|
|
19702
|
-
]);
|
|
19703
|
-
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find(function(key) {
|
|
19704
|
-
return _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all);
|
|
19705
|
-
});
|
|
19706
|
-
};
|
|
19707
|
-
var convertToArrayPayload = function(value1) {
|
|
19708
|
-
return Array.isArray(value1) ? value1 : [
|
|
19709
|
-
value1
|
|
19710
|
-
];
|
|
19711
|
-
};
|
|
19712
|
-
var shouldSubscribeByName = function(name, signalName, exact) {
|
|
19713
|
-
return !name || !signalName || name === signalName || convertToArrayPayload(name).some(function(currentName) {
|
|
19714
|
-
return currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName));
|
|
19715
|
-
});
|
|
19716
|
-
};
|
|
19717
|
-
function useSubscribe(props) {
|
|
19718
|
-
var _props = React__default.useRef(props);
|
|
19719
|
-
_props.current = props;
|
|
19720
|
-
React__default.useEffect(function() {
|
|
19721
|
-
var subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
|
|
19722
|
-
next: _props.current.next
|
|
19723
|
-
});
|
|
19724
|
-
return function() {
|
|
19725
|
-
subscription && subscription.unsubscribe();
|
|
19726
|
-
};
|
|
19727
|
-
}, [
|
|
19728
|
-
props.disabled
|
|
19729
|
-
]);
|
|
19730
|
-
}
|
|
19731
19695
|
/**
|
|
19732
19696
|
* This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
|
|
19733
19697
|
*
|
|
@@ -19761,7 +19725,6 @@ function useSubscribe(props) {
|
|
|
19761
19725
|
var methods = useFormContext();
|
|
19762
19726
|
var _ref = props || {}, _ref_control = _ref.control, control = _ref_control === void 0 ? methods.control : _ref_control, disabled = _ref.disabled, name = _ref.name, exact = _ref.exact;
|
|
19763
19727
|
var _React_useState = _sliced_to_array$8(React__default.useState(control._formState), 2), formState = _React_useState[0], updateFormState = _React_useState[1];
|
|
19764
|
-
var _mounted = React__default.useRef(true);
|
|
19765
19728
|
var _localProxyFormState = React__default.useRef({
|
|
19766
19729
|
isDirty: false,
|
|
19767
19730
|
isLoading: false,
|
|
@@ -19774,19 +19737,22 @@ function useSubscribe(props) {
|
|
|
19774
19737
|
});
|
|
19775
19738
|
var _name = React__default.useRef(name);
|
|
19776
19739
|
_name.current = name;
|
|
19777
|
-
useSubscribe({
|
|
19778
|
-
disabled: disabled,
|
|
19779
|
-
next: function(value1) {
|
|
19780
|
-
return _mounted.current && shouldSubscribeByName(_name.current, value1.name, exact) && shouldRenderFormState(value1, _localProxyFormState.current, control._updateFormState) && updateFormState(_object_spread$e({}, control._formState, value1));
|
|
19781
|
-
},
|
|
19782
|
-
subject: control._subjects.state
|
|
19783
|
-
});
|
|
19784
19740
|
React__default.useEffect(function() {
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19741
|
+
return control._subscribe({
|
|
19742
|
+
name: _name.current,
|
|
19743
|
+
formState: _localProxyFormState.current,
|
|
19744
|
+
exact: exact,
|
|
19745
|
+
callback: function(formState) {
|
|
19746
|
+
!disabled && updateFormState(_object_spread$e({}, control._formState, formState));
|
|
19747
|
+
}
|
|
19748
|
+
});
|
|
19749
|
+
}, [
|
|
19750
|
+
control,
|
|
19751
|
+
disabled,
|
|
19752
|
+
exact
|
|
19753
|
+
]);
|
|
19754
|
+
React__default.useEffect(function() {
|
|
19755
|
+
_localProxyFormState.current.isValid && control._setValid(true);
|
|
19790
19756
|
}, [
|
|
19791
19757
|
control
|
|
19792
19758
|
]);
|
|
@@ -19832,16 +19798,24 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
|
|
|
19832
19798
|
var methods = useFormContext();
|
|
19833
19799
|
var _ref = props || {}, _ref_control = _ref.control, control = _ref_control === void 0 ? methods.control : _ref_control, name = _ref.name, defaultValue = _ref.defaultValue, disabled = _ref.disabled, exact = _ref.exact;
|
|
19834
19800
|
var _name = React__default.useRef(name);
|
|
19801
|
+
var _defaultValue = React__default.useRef(defaultValue);
|
|
19835
19802
|
_name.current = name;
|
|
19836
|
-
|
|
19837
|
-
|
|
19838
|
-
|
|
19839
|
-
|
|
19840
|
-
|
|
19841
|
-
|
|
19803
|
+
React__default.useEffect(function() {
|
|
19804
|
+
return control._subscribe({
|
|
19805
|
+
name: _name.current,
|
|
19806
|
+
formState: {
|
|
19807
|
+
values: true
|
|
19808
|
+
},
|
|
19809
|
+
exact: exact,
|
|
19810
|
+
callback: function(formState) {
|
|
19811
|
+
return !disabled && updateValue(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, _defaultValue.current));
|
|
19842
19812
|
}
|
|
19843
|
-
}
|
|
19844
|
-
}
|
|
19813
|
+
});
|
|
19814
|
+
}, [
|
|
19815
|
+
control,
|
|
19816
|
+
disabled,
|
|
19817
|
+
exact
|
|
19818
|
+
]);
|
|
19845
19819
|
var _React_useState = _sliced_to_array$8(React__default.useState(control._getWatch(name, defaultValue)), 2), value1 = _React_useState[0], updateValue = _React_useState[1];
|
|
19846
19820
|
React__default.useEffect(function() {
|
|
19847
19821
|
return control._removeUnmounted();
|
|
@@ -19886,6 +19860,7 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
|
|
|
19886
19860
|
name: name,
|
|
19887
19861
|
exact: true
|
|
19888
19862
|
});
|
|
19863
|
+
var _props = React__default.useRef(props);
|
|
19889
19864
|
var _registerProps = React__default.useRef(control.register(name, _object_spread$e(_object_spread_props$a(_object_spread$e({}, props.rules), {
|
|
19890
19865
|
value: value1
|
|
19891
19866
|
}), isBoolean(props.disabled) ? {
|
|
@@ -19928,6 +19903,51 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
|
|
|
19928
19903
|
formState,
|
|
19929
19904
|
name
|
|
19930
19905
|
]);
|
|
19906
|
+
var onChange = React__default.useCallback(function(event) {
|
|
19907
|
+
return _registerProps.current.onChange({
|
|
19908
|
+
target: {
|
|
19909
|
+
value: getEventValue(event),
|
|
19910
|
+
name: name
|
|
19911
|
+
},
|
|
19912
|
+
type: EVENTS.CHANGE
|
|
19913
|
+
});
|
|
19914
|
+
}, [
|
|
19915
|
+
name
|
|
19916
|
+
]);
|
|
19917
|
+
var onBlur = React__default.useCallback(function() {
|
|
19918
|
+
return _registerProps.current.onBlur({
|
|
19919
|
+
target: {
|
|
19920
|
+
value: get$2(control._formValues, name),
|
|
19921
|
+
name: name
|
|
19922
|
+
},
|
|
19923
|
+
type: EVENTS.BLUR
|
|
19924
|
+
});
|
|
19925
|
+
}, [
|
|
19926
|
+
name,
|
|
19927
|
+
control._formValues
|
|
19928
|
+
]);
|
|
19929
|
+
var ref = React__default.useCallback(function(elm) {
|
|
19930
|
+
var field = get$2(control._fields, name);
|
|
19931
|
+
if (field && elm) {
|
|
19932
|
+
field._f.ref = {
|
|
19933
|
+
focus: function() {
|
|
19934
|
+
return elm.focus();
|
|
19935
|
+
},
|
|
19936
|
+
select: function() {
|
|
19937
|
+
return elm.select();
|
|
19938
|
+
},
|
|
19939
|
+
setCustomValidity: function(message) {
|
|
19940
|
+
return elm.setCustomValidity(message);
|
|
19941
|
+
},
|
|
19942
|
+
reportValidity: function() {
|
|
19943
|
+
return elm.reportValidity();
|
|
19944
|
+
}
|
|
19945
|
+
};
|
|
19946
|
+
}
|
|
19947
|
+
}, [
|
|
19948
|
+
control._fields,
|
|
19949
|
+
name
|
|
19950
|
+
]);
|
|
19931
19951
|
var field = React__default.useMemo(function() {
|
|
19932
19952
|
return _object_spread_props$a(_object_spread$e({
|
|
19933
19953
|
name: name,
|
|
@@ -19935,54 +19955,24 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
|
|
|
19935
19955
|
}, isBoolean(disabled) || formState.disabled ? {
|
|
19936
19956
|
disabled: formState.disabled || disabled
|
|
19937
19957
|
} : {}), {
|
|
19938
|
-
onChange:
|
|
19939
|
-
|
|
19940
|
-
|
|
19941
|
-
value: getEventValue(event),
|
|
19942
|
-
name: name
|
|
19943
|
-
},
|
|
19944
|
-
type: EVENTS.CHANGE
|
|
19945
|
-
});
|
|
19946
|
-
},
|
|
19947
|
-
onBlur: function() {
|
|
19948
|
-
return _registerProps.current.onBlur({
|
|
19949
|
-
target: {
|
|
19950
|
-
value: get$2(control._formValues, name),
|
|
19951
|
-
name: name
|
|
19952
|
-
},
|
|
19953
|
-
type: EVENTS.BLUR
|
|
19954
|
-
});
|
|
19955
|
-
},
|
|
19956
|
-
ref: function(elm) {
|
|
19957
|
-
var field = get$2(control._fields, name);
|
|
19958
|
-
if (field && elm) {
|
|
19959
|
-
field._f.ref = {
|
|
19960
|
-
focus: function() {
|
|
19961
|
-
return elm.focus();
|
|
19962
|
-
},
|
|
19963
|
-
select: function() {
|
|
19964
|
-
return elm.select();
|
|
19965
|
-
},
|
|
19966
|
-
setCustomValidity: function(message) {
|
|
19967
|
-
return elm.setCustomValidity(message);
|
|
19968
|
-
},
|
|
19969
|
-
reportValidity: function() {
|
|
19970
|
-
return elm.reportValidity();
|
|
19971
|
-
}
|
|
19972
|
-
};
|
|
19973
|
-
}
|
|
19974
|
-
}
|
|
19958
|
+
onChange: onChange,
|
|
19959
|
+
onBlur: onBlur,
|
|
19960
|
+
ref: ref
|
|
19975
19961
|
});
|
|
19976
19962
|
}, [
|
|
19977
19963
|
name,
|
|
19978
|
-
control._formValues,
|
|
19979
19964
|
disabled,
|
|
19980
19965
|
formState.disabled,
|
|
19981
|
-
|
|
19982
|
-
|
|
19966
|
+
onChange,
|
|
19967
|
+
onBlur,
|
|
19968
|
+
ref,
|
|
19969
|
+
value1
|
|
19983
19970
|
]);
|
|
19984
19971
|
React__default.useEffect(function() {
|
|
19985
19972
|
var _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
|
|
19973
|
+
control.register(name, _object_spread$e({}, _props.current.rules, isBoolean(_props.current.disabled) ? {
|
|
19974
|
+
disabled: _props.current.disabled
|
|
19975
|
+
} : {}));
|
|
19986
19976
|
var updateMounted = function(name, value1) {
|
|
19987
19977
|
var field = get$2(control._fields, name);
|
|
19988
19978
|
if (field && field._f) {
|
|
@@ -20008,9 +19998,8 @@ var generateWatchOutput = function(names, _names, formValues, isGlobal, defaultV
|
|
|
20008
19998
|
shouldUnregister
|
|
20009
19999
|
]);
|
|
20010
20000
|
React__default.useEffect(function() {
|
|
20011
|
-
control.
|
|
20001
|
+
control._setDisabledField({
|
|
20012
20002
|
disabled: disabled,
|
|
20013
|
-
fields: control._fields,
|
|
20014
20003
|
name: name
|
|
20015
20004
|
});
|
|
20016
20005
|
}, [
|
|
@@ -20079,405 +20068,11 @@ var appendErrors = function(name, validateAllFieldCriteria, errors, type, messag
|
|
|
20079
20068
|
types: _object_spread_props$a(_object_spread$e({}, errors[name] && errors[name].types ? errors[name].types : {}), _define_property$e({}, type, message || true))
|
|
20080
20069
|
}) : {};
|
|
20081
20070
|
};
|
|
20082
|
-
var
|
|
20083
|
-
return
|
|
20084
|
-
|
|
20085
|
-
|
|
20086
|
-
isOnChange: mode === VALIDATION_MODE.onChange,
|
|
20087
|
-
isOnAll: mode === VALIDATION_MODE.all,
|
|
20088
|
-
isOnTouch: mode === VALIDATION_MODE.onTouched
|
|
20089
|
-
};
|
|
20090
|
-
};
|
|
20091
|
-
var isWatched = function(name, _names, isBlurEvent) {
|
|
20092
|
-
return !isBlurEvent && (_names.watchAll || _names.watch.has(name) || _to_consumable_array$3(_names.watch).some(function(watchName) {
|
|
20093
|
-
return name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length));
|
|
20094
|
-
}));
|
|
20095
|
-
};
|
|
20096
|
-
var iterateFieldsByAction = function(fields, action, fieldsNames, abortEarly) {
|
|
20097
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
20098
|
-
try {
|
|
20099
|
-
for(var _iterator = (fieldsNames || Object.keys(fields))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
20100
|
-
var _ref = _step.value;
|
|
20101
|
-
var key = _ref;
|
|
20102
|
-
var field = get$2(fields, key);
|
|
20103
|
-
if (field) {
|
|
20104
|
-
var _f = field._f, currentField = _object_without_properties$7(field, [
|
|
20105
|
-
"_f"
|
|
20106
|
-
]);
|
|
20107
|
-
if (_f) {
|
|
20108
|
-
if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
|
|
20109
|
-
return true;
|
|
20110
|
-
} else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
|
|
20111
|
-
return true;
|
|
20112
|
-
} else {
|
|
20113
|
-
if (iterateFieldsByAction(currentField, action)) {
|
|
20114
|
-
break;
|
|
20115
|
-
}
|
|
20116
|
-
}
|
|
20117
|
-
} else if (isObject$a(currentField)) {
|
|
20118
|
-
if (iterateFieldsByAction(currentField, action)) {
|
|
20119
|
-
break;
|
|
20120
|
-
}
|
|
20121
|
-
}
|
|
20122
|
-
}
|
|
20123
|
-
}
|
|
20124
|
-
} catch (err) {
|
|
20125
|
-
_didIteratorError = true;
|
|
20126
|
-
_iteratorError = err;
|
|
20127
|
-
} finally{
|
|
20128
|
-
try {
|
|
20129
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
20130
|
-
_iterator.return();
|
|
20131
|
-
}
|
|
20132
|
-
} finally{
|
|
20133
|
-
if (_didIteratorError) {
|
|
20134
|
-
throw _iteratorError;
|
|
20135
|
-
}
|
|
20136
|
-
}
|
|
20137
|
-
}
|
|
20138
|
-
return;
|
|
20139
|
-
};
|
|
20140
|
-
var updateFieldArrayRootError = function(errors, error, name) {
|
|
20141
|
-
var fieldArrayErrors = convertToArrayPayload(get$2(errors, name));
|
|
20142
|
-
set(fieldArrayErrors, "root", error[name]);
|
|
20143
|
-
set(errors, name, fieldArrayErrors);
|
|
20144
|
-
return errors;
|
|
20145
|
-
};
|
|
20146
|
-
var isFileInput = function(element) {
|
|
20147
|
-
return element.type === "file";
|
|
20148
|
-
};
|
|
20149
|
-
var isFunction$5 = function(value1) {
|
|
20150
|
-
return typeof value1 === "function";
|
|
20151
|
-
};
|
|
20152
|
-
var isHTMLElement$3 = function(value1) {
|
|
20153
|
-
if (!isWeb) {
|
|
20154
|
-
return false;
|
|
20155
|
-
}
|
|
20156
|
-
var owner = value1 ? value1.ownerDocument : 0;
|
|
20157
|
-
return _instanceof$8(value1, owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
|
|
20158
|
-
};
|
|
20159
|
-
var isMessage = function(value1) {
|
|
20160
|
-
return isString(value1);
|
|
20161
|
-
};
|
|
20162
|
-
var isRadioInput = function(element) {
|
|
20163
|
-
return element.type === "radio";
|
|
20164
|
-
};
|
|
20165
|
-
var isRegex = function(value1) {
|
|
20166
|
-
return _instanceof$8(value1, RegExp);
|
|
20167
|
-
};
|
|
20168
|
-
var defaultResult = {
|
|
20169
|
-
value: false,
|
|
20170
|
-
isValid: false
|
|
20171
|
-
};
|
|
20172
|
-
var validResult = {
|
|
20173
|
-
value: true,
|
|
20174
|
-
isValid: true
|
|
20175
|
-
};
|
|
20176
|
-
var getCheckboxValue = function(options) {
|
|
20177
|
-
if (Array.isArray(options)) {
|
|
20178
|
-
if (options.length > 1) {
|
|
20179
|
-
var values = options.filter(function(option) {
|
|
20180
|
-
return option && option.checked && !option.disabled;
|
|
20181
|
-
}).map(function(option) {
|
|
20182
|
-
return option.value;
|
|
20183
|
-
});
|
|
20184
|
-
return {
|
|
20185
|
-
value: values,
|
|
20186
|
-
isValid: !!values.length
|
|
20187
|
-
};
|
|
20188
|
-
}
|
|
20189
|
-
return options[0].checked && !options[0].disabled ? options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === "" ? validResult : {
|
|
20190
|
-
value: options[0].value,
|
|
20191
|
-
isValid: true
|
|
20192
|
-
} : validResult : defaultResult;
|
|
20193
|
-
}
|
|
20194
|
-
return defaultResult;
|
|
20195
|
-
};
|
|
20196
|
-
var defaultReturn = {
|
|
20197
|
-
isValid: false,
|
|
20198
|
-
value: null
|
|
20199
|
-
};
|
|
20200
|
-
var getRadioValue = function(options) {
|
|
20201
|
-
return Array.isArray(options) ? options.reduce(function(previous, option) {
|
|
20202
|
-
return option && option.checked && !option.disabled ? {
|
|
20203
|
-
isValid: true,
|
|
20204
|
-
value: option.value
|
|
20205
|
-
} : previous;
|
|
20206
|
-
}, defaultReturn) : defaultReturn;
|
|
20207
|
-
};
|
|
20208
|
-
function getValidateError(result, ref) {
|
|
20209
|
-
var type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "validate";
|
|
20210
|
-
if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {
|
|
20211
|
-
return {
|
|
20212
|
-
type: type,
|
|
20213
|
-
message: isMessage(result) ? result : "",
|
|
20214
|
-
ref: ref
|
|
20215
|
-
};
|
|
20216
|
-
}
|
|
20217
|
-
}
|
|
20218
|
-
var getValueAndMessage = function(validationData) {
|
|
20219
|
-
return isObject$a(validationData) && !isRegex(validationData) ? validationData : {
|
|
20220
|
-
value: validationData,
|
|
20221
|
-
message: ""
|
|
20222
|
-
};
|
|
20071
|
+
var convertToArrayPayload = function(value1) {
|
|
20072
|
+
return Array.isArray(value1) ? value1 : [
|
|
20073
|
+
value1
|
|
20074
|
+
];
|
|
20223
20075
|
};
|
|
20224
|
-
var validateField = function() {
|
|
20225
|
-
var _ref = _async_to_generator$2(function(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
|
|
20226
|
-
var _field__f, ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, inputValue, inputRef, setCustomValidity, error, isRadio, isCheckBox, isRadioOrCheckbox, isEmpty, appendErrorsCurry, getMinMaxMessage, _ref, value1, message, exceedMax, exceedMin, maxOutput, minOutput, valueNumber, valueDate, convertTimeToDate, isTime, isWeek, maxLengthOutput, minLengthOutput, exceedMax1, exceedMin1, _getValueAndMessage, patternValue, message1, result, validateError, validationResult, _tmp, _tmp1, _i, key, validateError1;
|
|
20227
|
-
return _ts_generator$2(this, function(_state) {
|
|
20228
|
-
switch(_state.label){
|
|
20229
|
-
case 0:
|
|
20230
|
-
_field__f = field._f, ref = _field__f.ref, refs = _field__f.refs, required = _field__f.required, maxLength = _field__f.maxLength, minLength = _field__f.minLength, min = _field__f.min, max = _field__f.max, pattern = _field__f.pattern, validate = _field__f.validate, name = _field__f.name, valueAsNumber = _field__f.valueAsNumber, mount = _field__f.mount;
|
|
20231
|
-
inputValue = get$2(formValues, name);
|
|
20232
|
-
if (!mount || disabledFieldNames.has(name)) {
|
|
20233
|
-
return [
|
|
20234
|
-
2,
|
|
20235
|
-
{}
|
|
20236
|
-
];
|
|
20237
|
-
}
|
|
20238
|
-
inputRef = refs ? refs[0] : ref;
|
|
20239
|
-
setCustomValidity = function(message) {
|
|
20240
|
-
if (shouldUseNativeValidation && inputRef.reportValidity) {
|
|
20241
|
-
inputRef.setCustomValidity(isBoolean(message) ? "" : message || "");
|
|
20242
|
-
inputRef.reportValidity();
|
|
20243
|
-
}
|
|
20244
|
-
};
|
|
20245
|
-
error = {};
|
|
20246
|
-
isRadio = isRadioInput(ref);
|
|
20247
|
-
isCheckBox = isCheckBoxInput(ref);
|
|
20248
|
-
isRadioOrCheckbox = isRadio || isCheckBox;
|
|
20249
|
-
isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement$3(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
20250
|
-
appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);
|
|
20251
|
-
getMinMaxMessage = function(exceedMax, maxLengthMessage, minLengthMessage) {
|
|
20252
|
-
var maxType = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : INPUT_VALIDATION_RULES.maxLength, minType = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : INPUT_VALIDATION_RULES.minLength;
|
|
20253
|
-
var message = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
20254
|
-
error[name] = _object_spread$e({
|
|
20255
|
-
type: exceedMax ? maxType : minType,
|
|
20256
|
-
message: message,
|
|
20257
|
-
ref: ref
|
|
20258
|
-
}, appendErrorsCurry(exceedMax ? maxType : minType, message));
|
|
20259
|
-
};
|
|
20260
|
-
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
20261
|
-
_ref = isMessage(required) ? {
|
|
20262
|
-
value: !!required,
|
|
20263
|
-
message: required
|
|
20264
|
-
} : getValueAndMessage(required), value1 = _ref.value, message = _ref.message;
|
|
20265
|
-
if (value1) {
|
|
20266
|
-
error[name] = _object_spread$e({
|
|
20267
|
-
type: INPUT_VALIDATION_RULES.required,
|
|
20268
|
-
message: message,
|
|
20269
|
-
ref: inputRef
|
|
20270
|
-
}, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));
|
|
20271
|
-
if (!validateAllFieldCriteria) {
|
|
20272
|
-
setCustomValidity(message);
|
|
20273
|
-
return [
|
|
20274
|
-
2,
|
|
20275
|
-
error
|
|
20276
|
-
];
|
|
20277
|
-
}
|
|
20278
|
-
}
|
|
20279
|
-
}
|
|
20280
|
-
if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {
|
|
20281
|
-
maxOutput = getValueAndMessage(max);
|
|
20282
|
-
minOutput = getValueAndMessage(min);
|
|
20283
|
-
if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {
|
|
20284
|
-
valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);
|
|
20285
|
-
if (!isNullOrUndefined(maxOutput.value)) {
|
|
20286
|
-
exceedMax = valueNumber > maxOutput.value;
|
|
20287
|
-
}
|
|
20288
|
-
if (!isNullOrUndefined(minOutput.value)) {
|
|
20289
|
-
exceedMin = valueNumber < minOutput.value;
|
|
20290
|
-
}
|
|
20291
|
-
} else {
|
|
20292
|
-
valueDate = ref.valueAsDate || new Date(inputValue);
|
|
20293
|
-
convertTimeToDate = function(time) {
|
|
20294
|
-
return new Date(new Date().toDateString() + " " + time);
|
|
20295
|
-
};
|
|
20296
|
-
isTime = ref.type == "time";
|
|
20297
|
-
isWeek = ref.type == "week";
|
|
20298
|
-
if (isString(maxOutput.value) && inputValue) {
|
|
20299
|
-
exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);
|
|
20300
|
-
}
|
|
20301
|
-
if (isString(minOutput.value) && inputValue) {
|
|
20302
|
-
exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);
|
|
20303
|
-
}
|
|
20304
|
-
}
|
|
20305
|
-
if (exceedMax || exceedMin) {
|
|
20306
|
-
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
20307
|
-
if (!validateAllFieldCriteria) {
|
|
20308
|
-
setCustomValidity(error[name].message);
|
|
20309
|
-
return [
|
|
20310
|
-
2,
|
|
20311
|
-
error
|
|
20312
|
-
];
|
|
20313
|
-
}
|
|
20314
|
-
}
|
|
20315
|
-
}
|
|
20316
|
-
if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
|
|
20317
|
-
maxLengthOutput = getValueAndMessage(maxLength);
|
|
20318
|
-
minLengthOutput = getValueAndMessage(minLength);
|
|
20319
|
-
exceedMax1 = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
|
|
20320
|
-
exceedMin1 = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
|
|
20321
|
-
if (exceedMax1 || exceedMin1) {
|
|
20322
|
-
getMinMaxMessage(exceedMax1, maxLengthOutput.message, minLengthOutput.message);
|
|
20323
|
-
if (!validateAllFieldCriteria) {
|
|
20324
|
-
setCustomValidity(error[name].message);
|
|
20325
|
-
return [
|
|
20326
|
-
2,
|
|
20327
|
-
error
|
|
20328
|
-
];
|
|
20329
|
-
}
|
|
20330
|
-
}
|
|
20331
|
-
}
|
|
20332
|
-
if (pattern && !isEmpty && isString(inputValue)) {
|
|
20333
|
-
_getValueAndMessage = getValueAndMessage(pattern), patternValue = _getValueAndMessage.value, message1 = _getValueAndMessage.message;
|
|
20334
|
-
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
20335
|
-
error[name] = _object_spread$e({
|
|
20336
|
-
type: INPUT_VALIDATION_RULES.pattern,
|
|
20337
|
-
message: message1,
|
|
20338
|
-
ref: ref
|
|
20339
|
-
}, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message1));
|
|
20340
|
-
if (!validateAllFieldCriteria) {
|
|
20341
|
-
setCustomValidity(message1);
|
|
20342
|
-
return [
|
|
20343
|
-
2,
|
|
20344
|
-
error
|
|
20345
|
-
];
|
|
20346
|
-
}
|
|
20347
|
-
}
|
|
20348
|
-
}
|
|
20349
|
-
if (!validate) return [
|
|
20350
|
-
3,
|
|
20351
|
-
7
|
|
20352
|
-
];
|
|
20353
|
-
if (!isFunction$5(validate)) return [
|
|
20354
|
-
3,
|
|
20355
|
-
2
|
|
20356
|
-
];
|
|
20357
|
-
return [
|
|
20358
|
-
4,
|
|
20359
|
-
validate(inputValue, formValues)
|
|
20360
|
-
];
|
|
20361
|
-
case 1:
|
|
20362
|
-
result = _state.sent();
|
|
20363
|
-
validateError = getValidateError(result, inputRef);
|
|
20364
|
-
if (validateError) {
|
|
20365
|
-
error[name] = _object_spread$e({}, validateError, appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));
|
|
20366
|
-
if (!validateAllFieldCriteria) {
|
|
20367
|
-
setCustomValidity(validateError.message);
|
|
20368
|
-
return [
|
|
20369
|
-
2,
|
|
20370
|
-
error
|
|
20371
|
-
];
|
|
20372
|
-
}
|
|
20373
|
-
}
|
|
20374
|
-
return [
|
|
20375
|
-
3,
|
|
20376
|
-
7
|
|
20377
|
-
];
|
|
20378
|
-
case 2:
|
|
20379
|
-
if (!isObject$a(validate)) return [
|
|
20380
|
-
3,
|
|
20381
|
-
7
|
|
20382
|
-
];
|
|
20383
|
-
validationResult = {};
|
|
20384
|
-
_tmp = [];
|
|
20385
|
-
for(_tmp1 in validate)_tmp.push(_tmp1);
|
|
20386
|
-
_i = 0;
|
|
20387
|
-
_state.label = 3;
|
|
20388
|
-
case 3:
|
|
20389
|
-
if (!(_i < _tmp.length)) return [
|
|
20390
|
-
3,
|
|
20391
|
-
6
|
|
20392
|
-
];
|
|
20393
|
-
key = _tmp[_i];
|
|
20394
|
-
if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
|
|
20395
|
-
return [
|
|
20396
|
-
3,
|
|
20397
|
-
6
|
|
20398
|
-
];
|
|
20399
|
-
}
|
|
20400
|
-
return [
|
|
20401
|
-
4,
|
|
20402
|
-
validate[key](inputValue, formValues)
|
|
20403
|
-
];
|
|
20404
|
-
case 4:
|
|
20405
|
-
validateError1 = getValidateError.apply(void 0, [
|
|
20406
|
-
_state.sent(),
|
|
20407
|
-
inputRef,
|
|
20408
|
-
key
|
|
20409
|
-
]);
|
|
20410
|
-
if (validateError1) {
|
|
20411
|
-
validationResult = _object_spread$e({}, validateError1, appendErrorsCurry(key, validateError1.message));
|
|
20412
|
-
setCustomValidity(validateError1.message);
|
|
20413
|
-
if (validateAllFieldCriteria) {
|
|
20414
|
-
error[name] = validationResult;
|
|
20415
|
-
}
|
|
20416
|
-
}
|
|
20417
|
-
_state.label = 5;
|
|
20418
|
-
case 5:
|
|
20419
|
-
_i++;
|
|
20420
|
-
return [
|
|
20421
|
-
3,
|
|
20422
|
-
3
|
|
20423
|
-
];
|
|
20424
|
-
case 6:
|
|
20425
|
-
if (!isEmptyObject(validationResult)) {
|
|
20426
|
-
error[name] = _object_spread$e({
|
|
20427
|
-
ref: inputRef
|
|
20428
|
-
}, validationResult);
|
|
20429
|
-
if (!validateAllFieldCriteria) {
|
|
20430
|
-
return [
|
|
20431
|
-
2,
|
|
20432
|
-
error
|
|
20433
|
-
];
|
|
20434
|
-
}
|
|
20435
|
-
}
|
|
20436
|
-
_state.label = 7;
|
|
20437
|
-
case 7:
|
|
20438
|
-
setCustomValidity(true);
|
|
20439
|
-
return [
|
|
20440
|
-
2,
|
|
20441
|
-
error
|
|
20442
|
-
];
|
|
20443
|
-
}
|
|
20444
|
-
});
|
|
20445
|
-
});
|
|
20446
|
-
return function validateField(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
|
|
20447
|
-
return _ref.apply(this, arguments);
|
|
20448
|
-
};
|
|
20449
|
-
}();
|
|
20450
|
-
function baseGet$5(object, updatePath) {
|
|
20451
|
-
var length = updatePath.slice(0, -1).length;
|
|
20452
|
-
var index = 0;
|
|
20453
|
-
while(index < length){
|
|
20454
|
-
object = isUndefined(object) ? index++ : object[updatePath[index++]];
|
|
20455
|
-
}
|
|
20456
|
-
return object;
|
|
20457
|
-
}
|
|
20458
|
-
function isEmptyArray(obj) {
|
|
20459
|
-
for(var key in obj){
|
|
20460
|
-
if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) {
|
|
20461
|
-
return false;
|
|
20462
|
-
}
|
|
20463
|
-
}
|
|
20464
|
-
return true;
|
|
20465
|
-
}
|
|
20466
|
-
function unset(object, path) {
|
|
20467
|
-
var paths = Array.isArray(path) ? path : isKey$4(path) ? [
|
|
20468
|
-
path
|
|
20469
|
-
] : stringToPath$2(path);
|
|
20470
|
-
var childObject = paths.length === 1 ? object : baseGet$5(object, paths);
|
|
20471
|
-
var index = paths.length - 1;
|
|
20472
|
-
var key = paths[index];
|
|
20473
|
-
if (childObject) {
|
|
20474
|
-
delete childObject[key];
|
|
20475
|
-
}
|
|
20476
|
-
if (index !== 0 && (isObject$a(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
|
|
20477
|
-
unset(object, paths.slice(0, -1));
|
|
20478
|
-
}
|
|
20479
|
-
return object;
|
|
20480
|
-
}
|
|
20481
20076
|
var createSubject = function() {
|
|
20482
20077
|
var _observers = [];
|
|
20483
20078
|
var next = function(value1) {
|
|
@@ -20570,15 +20165,65 @@ function deepEqual(object1, object2) {
|
|
|
20570
20165
|
}
|
|
20571
20166
|
return true;
|
|
20572
20167
|
}
|
|
20168
|
+
var isEmptyObject = function(value1) {
|
|
20169
|
+
return isObject$a(value1) && !Object.keys(value1).length;
|
|
20170
|
+
};
|
|
20171
|
+
var isFileInput = function(element) {
|
|
20172
|
+
return element.type === "file";
|
|
20173
|
+
};
|
|
20174
|
+
var isFunction$5 = function(value1) {
|
|
20175
|
+
return typeof value1 === "function";
|
|
20176
|
+
};
|
|
20177
|
+
var isHTMLElement$3 = function(value1) {
|
|
20178
|
+
if (!isWeb) {
|
|
20179
|
+
return false;
|
|
20180
|
+
}
|
|
20181
|
+
var owner = value1 ? value1.ownerDocument : 0;
|
|
20182
|
+
return _instanceof$8(value1, owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
|
|
20183
|
+
};
|
|
20573
20184
|
var isMultipleSelect = function(element) {
|
|
20574
20185
|
return element.type === "select-multiple";
|
|
20575
20186
|
};
|
|
20187
|
+
var isRadioInput = function(element) {
|
|
20188
|
+
return element.type === "radio";
|
|
20189
|
+
};
|
|
20576
20190
|
var isRadioOrCheckbox = function(ref) {
|
|
20577
20191
|
return isRadioInput(ref) || isCheckBoxInput(ref);
|
|
20578
20192
|
};
|
|
20579
20193
|
var live = function(ref) {
|
|
20580
20194
|
return isHTMLElement$3(ref) && ref.isConnected;
|
|
20581
20195
|
};
|
|
20196
|
+
function baseGet$5(object, updatePath) {
|
|
20197
|
+
var length = updatePath.slice(0, -1).length;
|
|
20198
|
+
var index = 0;
|
|
20199
|
+
while(index < length){
|
|
20200
|
+
object = isUndefined(object) ? index++ : object[updatePath[index++]];
|
|
20201
|
+
}
|
|
20202
|
+
return object;
|
|
20203
|
+
}
|
|
20204
|
+
function isEmptyArray(obj) {
|
|
20205
|
+
for(var key in obj){
|
|
20206
|
+
if (obj.hasOwnProperty(key) && !isUndefined(obj[key])) {
|
|
20207
|
+
return false;
|
|
20208
|
+
}
|
|
20209
|
+
}
|
|
20210
|
+
return true;
|
|
20211
|
+
}
|
|
20212
|
+
function unset(object, path) {
|
|
20213
|
+
var paths = Array.isArray(path) ? path : isKey$4(path) ? [
|
|
20214
|
+
path
|
|
20215
|
+
] : stringToPath$2(path);
|
|
20216
|
+
var childObject = paths.length === 1 ? object : baseGet$5(object, paths);
|
|
20217
|
+
var index = paths.length - 1;
|
|
20218
|
+
var key = paths[index];
|
|
20219
|
+
if (childObject) {
|
|
20220
|
+
delete childObject[key];
|
|
20221
|
+
}
|
|
20222
|
+
if (index !== 0 && (isObject$a(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
|
|
20223
|
+
unset(object, paths.slice(0, -1));
|
|
20224
|
+
}
|
|
20225
|
+
return object;
|
|
20226
|
+
}
|
|
20582
20227
|
var objectHasFunction = function(data) {
|
|
20583
20228
|
for(var key in data){
|
|
20584
20229
|
if (isFunction$5(data[key])) {
|
|
@@ -20622,10 +20267,50 @@ function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues
|
|
|
20622
20267
|
var getDirtyFields = function(defaultValues, formValues) {
|
|
20623
20268
|
return getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
|
|
20624
20269
|
};
|
|
20270
|
+
var defaultResult = {
|
|
20271
|
+
value: false,
|
|
20272
|
+
isValid: false
|
|
20273
|
+
};
|
|
20274
|
+
var validResult = {
|
|
20275
|
+
value: true,
|
|
20276
|
+
isValid: true
|
|
20277
|
+
};
|
|
20278
|
+
var getCheckboxValue = function(options) {
|
|
20279
|
+
if (Array.isArray(options)) {
|
|
20280
|
+
if (options.length > 1) {
|
|
20281
|
+
var values = options.filter(function(option) {
|
|
20282
|
+
return option && option.checked && !option.disabled;
|
|
20283
|
+
}).map(function(option) {
|
|
20284
|
+
return option.value;
|
|
20285
|
+
});
|
|
20286
|
+
return {
|
|
20287
|
+
value: values,
|
|
20288
|
+
isValid: !!values.length
|
|
20289
|
+
};
|
|
20290
|
+
}
|
|
20291
|
+
return options[0].checked && !options[0].disabled ? options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === "" ? validResult : {
|
|
20292
|
+
value: options[0].value,
|
|
20293
|
+
isValid: true
|
|
20294
|
+
} : validResult : defaultResult;
|
|
20295
|
+
}
|
|
20296
|
+
return defaultResult;
|
|
20297
|
+
};
|
|
20625
20298
|
var getFieldValueAs = function(value1, param) {
|
|
20626
20299
|
var valueAsNumber = param.valueAsNumber, valueAsDate = param.valueAsDate, setValueAs = param.setValueAs;
|
|
20627
20300
|
return isUndefined(value1) ? value1 : valueAsNumber ? value1 === "" ? NaN : value1 ? +value1 : value1 : valueAsDate && isString(value1) ? new Date(value1) : setValueAs ? setValueAs(value1) : value1;
|
|
20628
20301
|
};
|
|
20302
|
+
var defaultReturn = {
|
|
20303
|
+
isValid: false,
|
|
20304
|
+
value: null
|
|
20305
|
+
};
|
|
20306
|
+
var getRadioValue = function(options) {
|
|
20307
|
+
return Array.isArray(options) ? options.reduce(function(previous, option) {
|
|
20308
|
+
return option && option.checked && !option.disabled ? {
|
|
20309
|
+
isValid: true,
|
|
20310
|
+
value: option.value
|
|
20311
|
+
} : previous;
|
|
20312
|
+
}, defaultReturn) : defaultReturn;
|
|
20313
|
+
};
|
|
20629
20314
|
function getFieldValue(_f) {
|
|
20630
20315
|
var ref = _f.ref;
|
|
20631
20316
|
if (isFileInput(ref)) {
|
|
@@ -20675,9 +20360,21 @@ var getResolverOptions = function(fieldsNames, _fields, criteriaMode, shouldUseN
|
|
|
20675
20360
|
shouldUseNativeValidation: shouldUseNativeValidation
|
|
20676
20361
|
};
|
|
20677
20362
|
};
|
|
20363
|
+
var isRegex = function(value1) {
|
|
20364
|
+
return _instanceof$8(value1, RegExp);
|
|
20365
|
+
};
|
|
20678
20366
|
var getRuleValue = function(rule) {
|
|
20679
20367
|
return isUndefined(rule) ? rule : isRegex(rule) ? rule.source : isObject$a(rule) ? isRegex(rule.value) ? rule.value.source : rule.value : rule;
|
|
20680
20368
|
};
|
|
20369
|
+
var getValidationModes = function(mode) {
|
|
20370
|
+
return {
|
|
20371
|
+
isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
|
|
20372
|
+
isOnBlur: mode === VALIDATION_MODE.onBlur,
|
|
20373
|
+
isOnChange: mode === VALIDATION_MODE.onChange,
|
|
20374
|
+
isOnAll: mode === VALIDATION_MODE.all,
|
|
20375
|
+
isOnTouch: mode === VALIDATION_MODE.onTouched
|
|
20376
|
+
};
|
|
20377
|
+
};
|
|
20681
20378
|
var ASYNC_FUNCTION = "AsyncFunction";
|
|
20682
20379
|
var hasPromiseValidation = function(fieldReference) {
|
|
20683
20380
|
return !!fieldReference && !!fieldReference.validate && !!(isFunction$5(fieldReference.validate) && fieldReference.validate.constructor.name === ASYNC_FUNCTION || isObject$a(fieldReference.validate) && Object.values(fieldReference.validate).find(function(validateFunction) {
|
|
@@ -20687,6 +20384,55 @@ var hasPromiseValidation = function(fieldReference) {
|
|
|
20687
20384
|
var hasValidation = function(options) {
|
|
20688
20385
|
return options.mount && (options.required || options.min || options.max || options.maxLength || options.minLength || options.pattern || options.validate);
|
|
20689
20386
|
};
|
|
20387
|
+
var isWatched = function(name, _names, isBlurEvent) {
|
|
20388
|
+
return !isBlurEvent && (_names.watchAll || _names.watch.has(name) || _to_consumable_array$3(_names.watch).some(function(watchName) {
|
|
20389
|
+
return name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length));
|
|
20390
|
+
}));
|
|
20391
|
+
};
|
|
20392
|
+
var iterateFieldsByAction = function(fields, action, fieldsNames, abortEarly) {
|
|
20393
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
20394
|
+
try {
|
|
20395
|
+
for(var _iterator = (fieldsNames || Object.keys(fields))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
20396
|
+
var _ref = _step.value;
|
|
20397
|
+
var key = _ref;
|
|
20398
|
+
var field = get$2(fields, key);
|
|
20399
|
+
if (field) {
|
|
20400
|
+
var _f = field._f, currentField = _object_without_properties$7(field, [
|
|
20401
|
+
"_f"
|
|
20402
|
+
]);
|
|
20403
|
+
if (_f) {
|
|
20404
|
+
if (_f.refs && _f.refs[0] && action(_f.refs[0], key) && !abortEarly) {
|
|
20405
|
+
return true;
|
|
20406
|
+
} else if (_f.ref && action(_f.ref, _f.name) && !abortEarly) {
|
|
20407
|
+
return true;
|
|
20408
|
+
} else {
|
|
20409
|
+
if (iterateFieldsByAction(currentField, action)) {
|
|
20410
|
+
break;
|
|
20411
|
+
}
|
|
20412
|
+
}
|
|
20413
|
+
} else if (isObject$a(currentField)) {
|
|
20414
|
+
if (iterateFieldsByAction(currentField, action)) {
|
|
20415
|
+
break;
|
|
20416
|
+
}
|
|
20417
|
+
}
|
|
20418
|
+
}
|
|
20419
|
+
}
|
|
20420
|
+
} catch (err) {
|
|
20421
|
+
_didIteratorError = true;
|
|
20422
|
+
_iteratorError = err;
|
|
20423
|
+
} finally{
|
|
20424
|
+
try {
|
|
20425
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
20426
|
+
_iterator.return();
|
|
20427
|
+
}
|
|
20428
|
+
} finally{
|
|
20429
|
+
if (_didIteratorError) {
|
|
20430
|
+
throw _iteratorError;
|
|
20431
|
+
}
|
|
20432
|
+
}
|
|
20433
|
+
}
|
|
20434
|
+
return;
|
|
20435
|
+
};
|
|
20690
20436
|
function schemaErrorLookup(errors, _fields, name) {
|
|
20691
20437
|
var error = get$2(errors, name);
|
|
20692
20438
|
if (error || isKey$4(name)) {
|
|
@@ -20717,6 +20463,20 @@ function schemaErrorLookup(errors, _fields, name) {
|
|
|
20717
20463
|
name: name
|
|
20718
20464
|
};
|
|
20719
20465
|
}
|
|
20466
|
+
var shouldRenderFormState = function(formStateData, _proxyFormState, updateFormState, isRoot) {
|
|
20467
|
+
updateFormState(formStateData);
|
|
20468
|
+
formStateData.name; var formState = _object_without_properties$7(formStateData, [
|
|
20469
|
+
"name"
|
|
20470
|
+
]);
|
|
20471
|
+
return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find(function(key) {
|
|
20472
|
+
return _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all);
|
|
20473
|
+
});
|
|
20474
|
+
};
|
|
20475
|
+
var shouldSubscribeByName = function(name, signalName, exact) {
|
|
20476
|
+
return !name || !signalName || name === signalName || convertToArrayPayload(name).some(function(currentName) {
|
|
20477
|
+
return currentName && (exact ? currentName === signalName : currentName.startsWith(signalName) || signalName.startsWith(currentName));
|
|
20478
|
+
});
|
|
20479
|
+
};
|
|
20720
20480
|
var skipValidation = function(isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) {
|
|
20721
20481
|
if (mode.isOnAll) {
|
|
20722
20482
|
return false;
|
|
@@ -20732,6 +20492,257 @@ var skipValidation = function(isBlurEvent, isTouched, isSubmitted, reValidateMod
|
|
|
20732
20492
|
var unsetEmptyArray = function(ref, name) {
|
|
20733
20493
|
return !compact(get$2(ref, name)).length && unset(ref, name);
|
|
20734
20494
|
};
|
|
20495
|
+
var updateFieldArrayRootError = function(errors, error, name) {
|
|
20496
|
+
var fieldArrayErrors = convertToArrayPayload(get$2(errors, name));
|
|
20497
|
+
set(fieldArrayErrors, "root", error[name]);
|
|
20498
|
+
set(errors, name, fieldArrayErrors);
|
|
20499
|
+
return errors;
|
|
20500
|
+
};
|
|
20501
|
+
var isMessage = function(value1) {
|
|
20502
|
+
return isString(value1);
|
|
20503
|
+
};
|
|
20504
|
+
function getValidateError(result, ref) {
|
|
20505
|
+
var type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "validate";
|
|
20506
|
+
if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {
|
|
20507
|
+
return {
|
|
20508
|
+
type: type,
|
|
20509
|
+
message: isMessage(result) ? result : "",
|
|
20510
|
+
ref: ref
|
|
20511
|
+
};
|
|
20512
|
+
}
|
|
20513
|
+
}
|
|
20514
|
+
var getValueAndMessage = function(validationData) {
|
|
20515
|
+
return isObject$a(validationData) && !isRegex(validationData) ? validationData : {
|
|
20516
|
+
value: validationData,
|
|
20517
|
+
message: ""
|
|
20518
|
+
};
|
|
20519
|
+
};
|
|
20520
|
+
var validateField = function() {
|
|
20521
|
+
var _ref = _async_to_generator$2(function(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
|
|
20522
|
+
var _field__f, ref, refs, required, maxLength, minLength, min, max, pattern, validate, name, valueAsNumber, mount, inputValue, inputRef, setCustomValidity, error, isRadio, isCheckBox, isRadioOrCheckbox, isEmpty, appendErrorsCurry, getMinMaxMessage, _ref, value1, message, exceedMax, exceedMin, maxOutput, minOutput, valueNumber, valueDate, convertTimeToDate, isTime, isWeek, maxLengthOutput, minLengthOutput, exceedMax1, exceedMin1, _getValueAndMessage, patternValue, message1, result, validateError, validationResult, _tmp, _tmp1, _i, key, validateError1;
|
|
20523
|
+
return _ts_generator$2(this, function(_state) {
|
|
20524
|
+
switch(_state.label){
|
|
20525
|
+
case 0:
|
|
20526
|
+
_field__f = field._f, ref = _field__f.ref, refs = _field__f.refs, required = _field__f.required, maxLength = _field__f.maxLength, minLength = _field__f.minLength, min = _field__f.min, max = _field__f.max, pattern = _field__f.pattern, validate = _field__f.validate, name = _field__f.name, valueAsNumber = _field__f.valueAsNumber, mount = _field__f.mount;
|
|
20527
|
+
inputValue = get$2(formValues, name);
|
|
20528
|
+
if (!mount || disabledFieldNames.has(name)) {
|
|
20529
|
+
return [
|
|
20530
|
+
2,
|
|
20531
|
+
{}
|
|
20532
|
+
];
|
|
20533
|
+
}
|
|
20534
|
+
inputRef = refs ? refs[0] : ref;
|
|
20535
|
+
setCustomValidity = function(message) {
|
|
20536
|
+
if (shouldUseNativeValidation && inputRef.reportValidity) {
|
|
20537
|
+
inputRef.setCustomValidity(isBoolean(message) ? "" : message || "");
|
|
20538
|
+
inputRef.reportValidity();
|
|
20539
|
+
}
|
|
20540
|
+
};
|
|
20541
|
+
error = {};
|
|
20542
|
+
isRadio = isRadioInput(ref);
|
|
20543
|
+
isCheckBox = isCheckBoxInput(ref);
|
|
20544
|
+
isRadioOrCheckbox = isRadio || isCheckBox;
|
|
20545
|
+
isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement$3(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
|
|
20546
|
+
appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error);
|
|
20547
|
+
getMinMaxMessage = function(exceedMax, maxLengthMessage, minLengthMessage) {
|
|
20548
|
+
var maxType = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : INPUT_VALIDATION_RULES.maxLength, minType = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : INPUT_VALIDATION_RULES.minLength;
|
|
20549
|
+
var message = exceedMax ? maxLengthMessage : minLengthMessage;
|
|
20550
|
+
error[name] = _object_spread$e({
|
|
20551
|
+
type: exceedMax ? maxType : minType,
|
|
20552
|
+
message: message,
|
|
20553
|
+
ref: ref
|
|
20554
|
+
}, appendErrorsCurry(exceedMax ? maxType : minType, message));
|
|
20555
|
+
};
|
|
20556
|
+
if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox && (isEmpty || isNullOrUndefined(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue(refs).isValid || isRadio && !getRadioValue(refs).isValid)) {
|
|
20557
|
+
_ref = isMessage(required) ? {
|
|
20558
|
+
value: !!required,
|
|
20559
|
+
message: required
|
|
20560
|
+
} : getValueAndMessage(required), value1 = _ref.value, message = _ref.message;
|
|
20561
|
+
if (value1) {
|
|
20562
|
+
error[name] = _object_spread$e({
|
|
20563
|
+
type: INPUT_VALIDATION_RULES.required,
|
|
20564
|
+
message: message,
|
|
20565
|
+
ref: inputRef
|
|
20566
|
+
}, appendErrorsCurry(INPUT_VALIDATION_RULES.required, message));
|
|
20567
|
+
if (!validateAllFieldCriteria) {
|
|
20568
|
+
setCustomValidity(message);
|
|
20569
|
+
return [
|
|
20570
|
+
2,
|
|
20571
|
+
error
|
|
20572
|
+
];
|
|
20573
|
+
}
|
|
20574
|
+
}
|
|
20575
|
+
}
|
|
20576
|
+
if (!isEmpty && (!isNullOrUndefined(min) || !isNullOrUndefined(max))) {
|
|
20577
|
+
maxOutput = getValueAndMessage(max);
|
|
20578
|
+
minOutput = getValueAndMessage(min);
|
|
20579
|
+
if (!isNullOrUndefined(inputValue) && !isNaN(inputValue)) {
|
|
20580
|
+
valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);
|
|
20581
|
+
if (!isNullOrUndefined(maxOutput.value)) {
|
|
20582
|
+
exceedMax = valueNumber > maxOutput.value;
|
|
20583
|
+
}
|
|
20584
|
+
if (!isNullOrUndefined(minOutput.value)) {
|
|
20585
|
+
exceedMin = valueNumber < minOutput.value;
|
|
20586
|
+
}
|
|
20587
|
+
} else {
|
|
20588
|
+
valueDate = ref.valueAsDate || new Date(inputValue);
|
|
20589
|
+
convertTimeToDate = function(time) {
|
|
20590
|
+
return new Date(new Date().toDateString() + " " + time);
|
|
20591
|
+
};
|
|
20592
|
+
isTime = ref.type == "time";
|
|
20593
|
+
isWeek = ref.type == "week";
|
|
20594
|
+
if (isString(maxOutput.value) && inputValue) {
|
|
20595
|
+
exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);
|
|
20596
|
+
}
|
|
20597
|
+
if (isString(minOutput.value) && inputValue) {
|
|
20598
|
+
exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);
|
|
20599
|
+
}
|
|
20600
|
+
}
|
|
20601
|
+
if (exceedMax || exceedMin) {
|
|
20602
|
+
getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
|
|
20603
|
+
if (!validateAllFieldCriteria) {
|
|
20604
|
+
setCustomValidity(error[name].message);
|
|
20605
|
+
return [
|
|
20606
|
+
2,
|
|
20607
|
+
error
|
|
20608
|
+
];
|
|
20609
|
+
}
|
|
20610
|
+
}
|
|
20611
|
+
}
|
|
20612
|
+
if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
|
|
20613
|
+
maxLengthOutput = getValueAndMessage(maxLength);
|
|
20614
|
+
minLengthOutput = getValueAndMessage(minLength);
|
|
20615
|
+
exceedMax1 = !isNullOrUndefined(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
|
|
20616
|
+
exceedMin1 = !isNullOrUndefined(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
|
|
20617
|
+
if (exceedMax1 || exceedMin1) {
|
|
20618
|
+
getMinMaxMessage(exceedMax1, maxLengthOutput.message, minLengthOutput.message);
|
|
20619
|
+
if (!validateAllFieldCriteria) {
|
|
20620
|
+
setCustomValidity(error[name].message);
|
|
20621
|
+
return [
|
|
20622
|
+
2,
|
|
20623
|
+
error
|
|
20624
|
+
];
|
|
20625
|
+
}
|
|
20626
|
+
}
|
|
20627
|
+
}
|
|
20628
|
+
if (pattern && !isEmpty && isString(inputValue)) {
|
|
20629
|
+
_getValueAndMessage = getValueAndMessage(pattern), patternValue = _getValueAndMessage.value, message1 = _getValueAndMessage.message;
|
|
20630
|
+
if (isRegex(patternValue) && !inputValue.match(patternValue)) {
|
|
20631
|
+
error[name] = _object_spread$e({
|
|
20632
|
+
type: INPUT_VALIDATION_RULES.pattern,
|
|
20633
|
+
message: message1,
|
|
20634
|
+
ref: ref
|
|
20635
|
+
}, appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message1));
|
|
20636
|
+
if (!validateAllFieldCriteria) {
|
|
20637
|
+
setCustomValidity(message1);
|
|
20638
|
+
return [
|
|
20639
|
+
2,
|
|
20640
|
+
error
|
|
20641
|
+
];
|
|
20642
|
+
}
|
|
20643
|
+
}
|
|
20644
|
+
}
|
|
20645
|
+
if (!validate) return [
|
|
20646
|
+
3,
|
|
20647
|
+
7
|
|
20648
|
+
];
|
|
20649
|
+
if (!isFunction$5(validate)) return [
|
|
20650
|
+
3,
|
|
20651
|
+
2
|
|
20652
|
+
];
|
|
20653
|
+
return [
|
|
20654
|
+
4,
|
|
20655
|
+
validate(inputValue, formValues)
|
|
20656
|
+
];
|
|
20657
|
+
case 1:
|
|
20658
|
+
result = _state.sent();
|
|
20659
|
+
validateError = getValidateError(result, inputRef);
|
|
20660
|
+
if (validateError) {
|
|
20661
|
+
error[name] = _object_spread$e({}, validateError, appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message));
|
|
20662
|
+
if (!validateAllFieldCriteria) {
|
|
20663
|
+
setCustomValidity(validateError.message);
|
|
20664
|
+
return [
|
|
20665
|
+
2,
|
|
20666
|
+
error
|
|
20667
|
+
];
|
|
20668
|
+
}
|
|
20669
|
+
}
|
|
20670
|
+
return [
|
|
20671
|
+
3,
|
|
20672
|
+
7
|
|
20673
|
+
];
|
|
20674
|
+
case 2:
|
|
20675
|
+
if (!isObject$a(validate)) return [
|
|
20676
|
+
3,
|
|
20677
|
+
7
|
|
20678
|
+
];
|
|
20679
|
+
validationResult = {};
|
|
20680
|
+
_tmp = [];
|
|
20681
|
+
for(_tmp1 in validate)_tmp.push(_tmp1);
|
|
20682
|
+
_i = 0;
|
|
20683
|
+
_state.label = 3;
|
|
20684
|
+
case 3:
|
|
20685
|
+
if (!(_i < _tmp.length)) return [
|
|
20686
|
+
3,
|
|
20687
|
+
6
|
|
20688
|
+
];
|
|
20689
|
+
key = _tmp[_i];
|
|
20690
|
+
if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
|
|
20691
|
+
return [
|
|
20692
|
+
3,
|
|
20693
|
+
6
|
|
20694
|
+
];
|
|
20695
|
+
}
|
|
20696
|
+
return [
|
|
20697
|
+
4,
|
|
20698
|
+
validate[key](inputValue, formValues)
|
|
20699
|
+
];
|
|
20700
|
+
case 4:
|
|
20701
|
+
validateError1 = getValidateError.apply(void 0, [
|
|
20702
|
+
_state.sent(),
|
|
20703
|
+
inputRef,
|
|
20704
|
+
key
|
|
20705
|
+
]);
|
|
20706
|
+
if (validateError1) {
|
|
20707
|
+
validationResult = _object_spread$e({}, validateError1, appendErrorsCurry(key, validateError1.message));
|
|
20708
|
+
setCustomValidity(validateError1.message);
|
|
20709
|
+
if (validateAllFieldCriteria) {
|
|
20710
|
+
error[name] = validationResult;
|
|
20711
|
+
}
|
|
20712
|
+
}
|
|
20713
|
+
_state.label = 5;
|
|
20714
|
+
case 5:
|
|
20715
|
+
_i++;
|
|
20716
|
+
return [
|
|
20717
|
+
3,
|
|
20718
|
+
3
|
|
20719
|
+
];
|
|
20720
|
+
case 6:
|
|
20721
|
+
if (!isEmptyObject(validationResult)) {
|
|
20722
|
+
error[name] = _object_spread$e({
|
|
20723
|
+
ref: inputRef
|
|
20724
|
+
}, validationResult);
|
|
20725
|
+
if (!validateAllFieldCriteria) {
|
|
20726
|
+
return [
|
|
20727
|
+
2,
|
|
20728
|
+
error
|
|
20729
|
+
];
|
|
20730
|
+
}
|
|
20731
|
+
}
|
|
20732
|
+
_state.label = 7;
|
|
20733
|
+
case 7:
|
|
20734
|
+
setCustomValidity(true);
|
|
20735
|
+
return [
|
|
20736
|
+
2,
|
|
20737
|
+
error
|
|
20738
|
+
];
|
|
20739
|
+
}
|
|
20740
|
+
});
|
|
20741
|
+
});
|
|
20742
|
+
return function validateField(field, disabledFieldNames, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) {
|
|
20743
|
+
return _ref.apply(this, arguments);
|
|
20744
|
+
};
|
|
20745
|
+
}();
|
|
20735
20746
|
var defaultOptions = {
|
|
20736
20747
|
mode: VALIDATION_MODE.onSubmit,
|
|
20737
20748
|
reValidateMode: VALIDATION_MODE.onChange,
|
|
@@ -20756,7 +20767,7 @@ function createFormControl() {
|
|
|
20756
20767
|
disabled: _options.disabled || false
|
|
20757
20768
|
};
|
|
20758
20769
|
var _fields = {};
|
|
20759
|
-
var _defaultValues = isObject$a(_options.defaultValues) || isObject$a(_options.values) ? cloneObject(_options.
|
|
20770
|
+
var _defaultValues = isObject$a(_options.defaultValues) || isObject$a(_options.values) ? cloneObject(_options.values || _options.defaultValues) || {} : {};
|
|
20760
20771
|
var _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
|
|
20761
20772
|
var _state = {
|
|
20762
20773
|
action: false,
|
|
@@ -20781,8 +20792,8 @@ function createFormControl() {
|
|
|
20781
20792
|
isValid: false,
|
|
20782
20793
|
errors: false
|
|
20783
20794
|
};
|
|
20795
|
+
var _proxySubscribeFormState = _object_spread$e({}, _proxyFormState);
|
|
20784
20796
|
var _subjects = {
|
|
20785
|
-
values: createSubject(),
|
|
20786
20797
|
array: createSubject(),
|
|
20787
20798
|
state: createSubject()
|
|
20788
20799
|
};
|
|
@@ -20795,13 +20806,13 @@ function createFormControl() {
|
|
|
20795
20806
|
timer = setTimeout(callback, wait);
|
|
20796
20807
|
};
|
|
20797
20808
|
};
|
|
20798
|
-
var
|
|
20809
|
+
var _setValid = function() {
|
|
20799
20810
|
var _ref = _async_to_generator$2(function(shouldUpdateValid) {
|
|
20800
20811
|
var isValid, _tmp;
|
|
20801
20812
|
return _ts_generator$2(this, function(_state) {
|
|
20802
20813
|
switch(_state.label){
|
|
20803
20814
|
case 0:
|
|
20804
|
-
if (!(!_options.disabled && (_proxyFormState.isValid || shouldUpdateValid))) return [
|
|
20815
|
+
if (!(!_options.disabled && (_proxyFormState.isValid || _proxySubscribeFormState.isValid || shouldUpdateValid))) return [
|
|
20805
20816
|
3,
|
|
20806
20817
|
5
|
|
20807
20818
|
];
|
|
@@ -20811,7 +20822,7 @@ function createFormControl() {
|
|
|
20811
20822
|
];
|
|
20812
20823
|
return [
|
|
20813
20824
|
4,
|
|
20814
|
-
|
|
20825
|
+
_runSchema()
|
|
20815
20826
|
];
|
|
20816
20827
|
case 1:
|
|
20817
20828
|
_tmp = isEmptyObject.apply(void 0, [
|
|
@@ -20844,12 +20855,12 @@ function createFormControl() {
|
|
|
20844
20855
|
}
|
|
20845
20856
|
});
|
|
20846
20857
|
});
|
|
20847
|
-
return function
|
|
20858
|
+
return function _setValid(shouldUpdateValid) {
|
|
20848
20859
|
return _ref.apply(this, arguments);
|
|
20849
20860
|
};
|
|
20850
20861
|
}();
|
|
20851
20862
|
var _updateIsValidating = function(names, isValidating) {
|
|
20852
|
-
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields)) {
|
|
20863
|
+
if (!_options.disabled && (_proxyFormState.isValidating || _proxyFormState.validatingFields || _proxySubscribeFormState.isValidating || _proxySubscribeFormState.validatingFields)) {
|
|
20853
20864
|
(names || Array.from(_names.mount)).forEach(function(name) {
|
|
20854
20865
|
if (name) {
|
|
20855
20866
|
isValidating ? set(_formState.validatingFields, name, isValidating) : unset(_formState.validatingFields, name);
|
|
@@ -20861,7 +20872,7 @@ function createFormControl() {
|
|
|
20861
20872
|
});
|
|
20862
20873
|
}
|
|
20863
20874
|
};
|
|
20864
|
-
var
|
|
20875
|
+
var _setFieldArray = function(name) {
|
|
20865
20876
|
var values = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], method = arguments.length > 2 ? arguments[2] : void 0, args = arguments.length > 3 ? arguments[3] : void 0, shouldSetValues = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : true, shouldUpdateFieldsAndState = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : true;
|
|
20866
20877
|
if (args && method && !_options.disabled) {
|
|
20867
20878
|
_state.action = true;
|
|
@@ -20874,11 +20885,11 @@ function createFormControl() {
|
|
|
20874
20885
|
shouldSetValues && set(_formState.errors, name, errors);
|
|
20875
20886
|
unsetEmptyArray(_formState.errors, name);
|
|
20876
20887
|
}
|
|
20877
|
-
if (_proxyFormState.touchedFields && shouldUpdateFieldsAndState && Array.isArray(get$2(_formState.touchedFields, name))) {
|
|
20888
|
+
if ((_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && shouldUpdateFieldsAndState && Array.isArray(get$2(_formState.touchedFields, name))) {
|
|
20878
20889
|
var touchedFields = method(get$2(_formState.touchedFields, name), args.argA, args.argB);
|
|
20879
20890
|
shouldSetValues && set(_formState.touchedFields, name, touchedFields);
|
|
20880
20891
|
}
|
|
20881
|
-
if (_proxyFormState.dirtyFields) {
|
|
20892
|
+
if (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) {
|
|
20882
20893
|
_formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
|
|
20883
20894
|
}
|
|
20884
20895
|
_subjects.state.next({
|
|
@@ -20910,7 +20921,7 @@ function createFormControl() {
|
|
|
20910
20921
|
if (field) {
|
|
20911
20922
|
var defaultValue = get$2(_formValues, name, isUndefined(value1) ? get$2(_defaultValues, name) : value1);
|
|
20912
20923
|
isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
|
|
20913
|
-
_state.mount &&
|
|
20924
|
+
_state.mount && _setValid();
|
|
20914
20925
|
}
|
|
20915
20926
|
};
|
|
20916
20927
|
var updateTouchAndDirty = function(name, fieldValue, isBlurEvent, shouldDirty, shouldRender) {
|
|
@@ -20920,25 +20931,24 @@ function createFormControl() {
|
|
|
20920
20931
|
name: name
|
|
20921
20932
|
};
|
|
20922
20933
|
if (!_options.disabled) {
|
|
20923
|
-
var disabledField = !!(get$2(_fields, name) && get$2(_fields, name)._f && get$2(_fields, name)._f.disabled);
|
|
20924
20934
|
if (!isBlurEvent || shouldDirty) {
|
|
20925
|
-
if (_proxyFormState.isDirty) {
|
|
20935
|
+
if (_proxyFormState.isDirty || _proxySubscribeFormState.isDirty) {
|
|
20926
20936
|
isPreviousDirty = _formState.isDirty;
|
|
20927
20937
|
_formState.isDirty = output.isDirty = _getDirty();
|
|
20928
20938
|
shouldUpdateField = isPreviousDirty !== output.isDirty;
|
|
20929
20939
|
}
|
|
20930
|
-
var isCurrentFieldPristine =
|
|
20931
|
-
isPreviousDirty = !!
|
|
20932
|
-
isCurrentFieldPristine
|
|
20940
|
+
var isCurrentFieldPristine = deepEqual(get$2(_defaultValues, name), fieldValue);
|
|
20941
|
+
isPreviousDirty = !!get$2(_formState.dirtyFields, name);
|
|
20942
|
+
isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
|
|
20933
20943
|
output.dirtyFields = _formState.dirtyFields;
|
|
20934
|
-
shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
|
|
20944
|
+
shouldUpdateField = shouldUpdateField || (_proxyFormState.dirtyFields || _proxySubscribeFormState.dirtyFields) && isPreviousDirty !== !isCurrentFieldPristine;
|
|
20935
20945
|
}
|
|
20936
20946
|
if (isBlurEvent) {
|
|
20937
20947
|
var isPreviousFieldTouched = get$2(_formState.touchedFields, name);
|
|
20938
20948
|
if (!isPreviousFieldTouched) {
|
|
20939
20949
|
set(_formState.touchedFields, name, isBlurEvent);
|
|
20940
20950
|
output.touchedFields = _formState.touchedFields;
|
|
20941
|
-
shouldUpdateField = shouldUpdateField || _proxyFormState.touchedFields && isPreviousFieldTouched !== isBlurEvent;
|
|
20951
|
+
shouldUpdateField = shouldUpdateField || (_proxyFormState.touchedFields || _proxySubscribeFormState.touchedFields) && isPreviousFieldTouched !== isBlurEvent;
|
|
20942
20952
|
}
|
|
20943
20953
|
}
|
|
20944
20954
|
shouldUpdateField && shouldRender && _subjects.state.next(output);
|
|
@@ -20947,7 +20957,7 @@ function createFormControl() {
|
|
|
20947
20957
|
};
|
|
20948
20958
|
var shouldRenderByError = function(name, isValid, error, fieldState) {
|
|
20949
20959
|
var previousFieldError = get$2(_formState.errors, name);
|
|
20950
|
-
var shouldUpdateValid = _proxyFormState.isValid && isBoolean(isValid) && _formState.isValid !== isValid;
|
|
20960
|
+
var shouldUpdateValid = (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isBoolean(isValid) && _formState.isValid !== isValid;
|
|
20951
20961
|
if (_options.delayError && error) {
|
|
20952
20962
|
delayErrorCallback = debounce(function() {
|
|
20953
20963
|
return updateErrors(name, error);
|
|
@@ -20969,7 +20979,7 @@ function createFormControl() {
|
|
|
20969
20979
|
_subjects.state.next(updatedFormState);
|
|
20970
20980
|
}
|
|
20971
20981
|
};
|
|
20972
|
-
var
|
|
20982
|
+
var _runSchema = function() {
|
|
20973
20983
|
var _ref = _async_to_generator$2(function(name) {
|
|
20974
20984
|
var result;
|
|
20975
20985
|
return _ts_generator$2(this, function(_state) {
|
|
@@ -20990,7 +21000,7 @@ function createFormControl() {
|
|
|
20990
21000
|
}
|
|
20991
21001
|
});
|
|
20992
21002
|
});
|
|
20993
|
-
return function
|
|
21003
|
+
return function _runSchema(name) {
|
|
20994
21004
|
return _ref.apply(this, arguments);
|
|
20995
21005
|
};
|
|
20996
21006
|
}();
|
|
@@ -21002,7 +21012,7 @@ function createFormControl() {
|
|
|
21002
21012
|
case 0:
|
|
21003
21013
|
return [
|
|
21004
21014
|
4,
|
|
21005
|
-
|
|
21015
|
+
_runSchema(names)
|
|
21006
21016
|
];
|
|
21007
21017
|
case 1:
|
|
21008
21018
|
errors = _state.sent().errors;
|
|
@@ -21202,9 +21212,9 @@ function createFormControl() {
|
|
|
21202
21212
|
} else {
|
|
21203
21213
|
fieldReference.ref.value = fieldValue;
|
|
21204
21214
|
if (!fieldReference.ref.type) {
|
|
21205
|
-
_subjects.
|
|
21215
|
+
_subjects.state.next({
|
|
21206
21216
|
name: name,
|
|
21207
|
-
values:
|
|
21217
|
+
values: cloneObject(_formValues)
|
|
21208
21218
|
});
|
|
21209
21219
|
}
|
|
21210
21220
|
}
|
|
@@ -21230,9 +21240,9 @@ function createFormControl() {
|
|
|
21230
21240
|
if (isFieldArray) {
|
|
21231
21241
|
_subjects.array.next({
|
|
21232
21242
|
name: name,
|
|
21233
|
-
values:
|
|
21243
|
+
values: cloneObject(_formValues)
|
|
21234
21244
|
});
|
|
21235
|
-
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
|
|
21245
|
+
if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields || _proxySubscribeFormState.isDirty || _proxySubscribeFormState.dirtyFields) && options.shouldDirty) {
|
|
21236
21246
|
_subjects.state.next({
|
|
21237
21247
|
name: name,
|
|
21238
21248
|
dirtyFields: getDirtyFields(_defaultValues, _formValues),
|
|
@@ -21243,14 +21253,14 @@ function createFormControl() {
|
|
|
21243
21253
|
field && !field._f && !isNullOrUndefined(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
|
|
21244
21254
|
}
|
|
21245
21255
|
isWatched(name, _names) && _subjects.state.next(_object_spread$e({}, _formState));
|
|
21246
|
-
_subjects.
|
|
21256
|
+
_subjects.state.next({
|
|
21247
21257
|
name: _state.mount ? name : undefined,
|
|
21248
|
-
values:
|
|
21258
|
+
values: cloneObject(_formValues)
|
|
21249
21259
|
});
|
|
21250
21260
|
};
|
|
21251
21261
|
var onChange = function() {
|
|
21252
21262
|
var _ref = _async_to_generator$2(function(event) {
|
|
21253
|
-
var target, name, isFieldValueUpdated, field,
|
|
21263
|
+
var target, name, isFieldValueUpdated, field, _updateIsFieldValueUpdated, error, isValid, fieldValue, isBlurEvent, shouldSkipValidation, watched, fieldState, shouldRender, errors, previousErrorLookupResult, errorLookupResult;
|
|
21254
21264
|
return _ts_generator$2(this, function(_state1) {
|
|
21255
21265
|
switch(_state1.label){
|
|
21256
21266
|
case 0:
|
|
@@ -21259,9 +21269,6 @@ function createFormControl() {
|
|
|
21259
21269
|
name = target.name;
|
|
21260
21270
|
isFieldValueUpdated = true;
|
|
21261
21271
|
field = get$2(_fields, name);
|
|
21262
|
-
getCurrentFieldValue = function() {
|
|
21263
|
-
return target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
21264
|
-
};
|
|
21265
21272
|
_updateIsFieldValueUpdated = function(fieldValue) {
|
|
21266
21273
|
isFieldValueUpdated = Number.isNaN(fieldValue) || isDateObject(fieldValue) && isNaN(fieldValue.getTime()) || deepEqual(fieldValue, get$2(_formValues, name, fieldValue));
|
|
21267
21274
|
};
|
|
@@ -21269,7 +21276,7 @@ function createFormControl() {
|
|
|
21269
21276
|
3,
|
|
21270
21277
|
7
|
|
21271
21278
|
];
|
|
21272
|
-
fieldValue =
|
|
21279
|
+
fieldValue = target.type ? getFieldValue(field._f) : getEventValue(event);
|
|
21273
21280
|
isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
|
|
21274
21281
|
shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get$2(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get$2(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
|
|
21275
21282
|
watched = isWatched(name, _names, isBlurEvent);
|
|
@@ -21280,19 +21287,21 @@ function createFormControl() {
|
|
|
21280
21287
|
} else if (field._f.onChange) {
|
|
21281
21288
|
field._f.onChange(event);
|
|
21282
21289
|
}
|
|
21283
|
-
fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent
|
|
21290
|
+
fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent);
|
|
21284
21291
|
shouldRender = !isEmptyObject(fieldState) || watched;
|
|
21285
|
-
!isBlurEvent && _subjects.
|
|
21292
|
+
!isBlurEvent && _subjects.state.next({
|
|
21286
21293
|
name: name,
|
|
21287
21294
|
type: event.type,
|
|
21288
|
-
values:
|
|
21295
|
+
values: cloneObject(_formValues)
|
|
21289
21296
|
});
|
|
21290
21297
|
if (shouldSkipValidation) {
|
|
21291
|
-
if (_proxyFormState.isValid) {
|
|
21292
|
-
if (_options.mode === "onBlur"
|
|
21293
|
-
|
|
21298
|
+
if (_proxyFormState.isValid || _proxySubscribeFormState.isValid) {
|
|
21299
|
+
if (_options.mode === "onBlur") {
|
|
21300
|
+
if (isBlurEvent) {
|
|
21301
|
+
_setValid();
|
|
21302
|
+
}
|
|
21294
21303
|
} else if (!isBlurEvent) {
|
|
21295
|
-
|
|
21304
|
+
_setValid();
|
|
21296
21305
|
}
|
|
21297
21306
|
}
|
|
21298
21307
|
return [
|
|
@@ -21309,7 +21318,7 @@ function createFormControl() {
|
|
|
21309
21318
|
];
|
|
21310
21319
|
return [
|
|
21311
21320
|
4,
|
|
21312
|
-
|
|
21321
|
+
_runSchema([
|
|
21313
21322
|
name
|
|
21314
21323
|
])
|
|
21315
21324
|
];
|
|
@@ -21355,7 +21364,7 @@ function createFormControl() {
|
|
|
21355
21364
|
6
|
|
21356
21365
|
];
|
|
21357
21366
|
case 4:
|
|
21358
|
-
if (!_proxyFormState.isValid) return [
|
|
21367
|
+
if (!(_proxyFormState.isValid || _proxySubscribeFormState.isValid)) return [
|
|
21359
21368
|
3,
|
|
21360
21369
|
6
|
|
21361
21370
|
];
|
|
@@ -21450,7 +21459,7 @@ function createFormControl() {
|
|
|
21450
21459
|
];
|
|
21451
21460
|
case 3:
|
|
21452
21461
|
validationResult = _state.sent().every(Boolean);
|
|
21453
|
-
!(!validationResult && !_formState.isValid) &&
|
|
21462
|
+
!(!validationResult && !_formState.isValid) && _setValid();
|
|
21454
21463
|
return [
|
|
21455
21464
|
3,
|
|
21456
21465
|
6
|
|
@@ -21464,7 +21473,7 @@ function createFormControl() {
|
|
|
21464
21473
|
validationResult = isValid = _state.sent();
|
|
21465
21474
|
_state.label = 6;
|
|
21466
21475
|
case 6:
|
|
21467
|
-
_subjects.state.next(_object_spread_props$a(_object_spread$e({}, !isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : {
|
|
21476
|
+
_subjects.state.next(_object_spread_props$a(_object_spread$e({}, !isString(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid !== _formState.isValid ? {} : {
|
|
21468
21477
|
name: name
|
|
21469
21478
|
}, _options.resolver || !name ? {
|
|
21470
21479
|
isValid: isValid
|
|
@@ -21528,12 +21537,30 @@ function createFormControl() {
|
|
|
21528
21537
|
options && options.shouldFocus && ref && ref.focus && ref.focus();
|
|
21529
21538
|
};
|
|
21530
21539
|
var watch = function(name, defaultValue) {
|
|
21531
|
-
return isFunction$5(name) ? _subjects.
|
|
21540
|
+
return isFunction$5(name) ? _subjects.state.subscribe({
|
|
21532
21541
|
next: function(payload) {
|
|
21533
21542
|
return name(_getWatch(undefined, defaultValue), payload);
|
|
21534
21543
|
}
|
|
21535
21544
|
}) : _getWatch(name, defaultValue, true);
|
|
21536
21545
|
};
|
|
21546
|
+
var _subscribe = function(props) {
|
|
21547
|
+
return _subjects.state.subscribe({
|
|
21548
|
+
next: function(formState) {
|
|
21549
|
+
if (shouldSubscribeByName(props.name, formState.name, props.exact) && shouldRenderFormState(formState, props.formState || _proxyFormState, _setFormState, props.reRenderRoot)) {
|
|
21550
|
+
props.callback(_object_spread$e({
|
|
21551
|
+
values: _object_spread$e({}, _formValues)
|
|
21552
|
+
}, _formState, formState));
|
|
21553
|
+
}
|
|
21554
|
+
}
|
|
21555
|
+
}).unsubscribe;
|
|
21556
|
+
};
|
|
21557
|
+
var subscribe = function(props) {
|
|
21558
|
+
_state.mount = true;
|
|
21559
|
+
_proxySubscribeFormState = _object_spread$e({}, _proxySubscribeFormState, props.formState);
|
|
21560
|
+
return _subscribe(_object_spread_props$a(_object_spread$e({}, props), {
|
|
21561
|
+
formState: _proxySubscribeFormState
|
|
21562
|
+
}));
|
|
21563
|
+
};
|
|
21537
21564
|
var unregister = function(name) {
|
|
21538
21565
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
21539
21566
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -21566,19 +21593,18 @@ function createFormControl() {
|
|
|
21566
21593
|
}
|
|
21567
21594
|
}
|
|
21568
21595
|
}
|
|
21569
|
-
_subjects.
|
|
21570
|
-
values:
|
|
21596
|
+
_subjects.state.next({
|
|
21597
|
+
values: cloneObject(_formValues)
|
|
21571
21598
|
});
|
|
21572
21599
|
_subjects.state.next(_object_spread$e({}, _formState, !options.keepDirty ? {} : {
|
|
21573
21600
|
isDirty: _getDirty()
|
|
21574
21601
|
}));
|
|
21575
|
-
!options.keepIsValid &&
|
|
21602
|
+
!options.keepIsValid && _setValid();
|
|
21576
21603
|
};
|
|
21577
|
-
var
|
|
21578
|
-
var disabled = param.disabled, name = param.name
|
|
21604
|
+
var _setDisabledField = function(param) {
|
|
21605
|
+
var disabled = param.disabled, name = param.name;
|
|
21579
21606
|
if (isBoolean(disabled) && _state.mount || !!disabled || _names.disabled.has(name)) {
|
|
21580
21607
|
disabled ? _names.disabled.add(name) : _names.disabled.delete(name);
|
|
21581
|
-
updateTouchAndDirty(name, getFieldValue(field ? field._f : get$2(fields, name)._f), false, false, true);
|
|
21582
21608
|
}
|
|
21583
21609
|
};
|
|
21584
21610
|
var register = function(name) {
|
|
@@ -21597,8 +21623,7 @@ function createFormControl() {
|
|
|
21597
21623
|
}));
|
|
21598
21624
|
_names.mount.add(name);
|
|
21599
21625
|
if (field) {
|
|
21600
|
-
|
|
21601
|
-
field: field,
|
|
21626
|
+
_setDisabledField({
|
|
21602
21627
|
disabled: isBoolean(options.disabled) ? options.disabled : _options.disabled,
|
|
21603
21628
|
name: name
|
|
21604
21629
|
});
|
|
@@ -21680,7 +21705,7 @@ function createFormControl() {
|
|
|
21680
21705
|
var handleSubmit = function(onValid, onInvalid) {
|
|
21681
21706
|
return function() {
|
|
21682
21707
|
var _ref = _async_to_generator$2(function(e) {
|
|
21683
|
-
var onValidError, fieldValues, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, name,
|
|
21708
|
+
var onValidError, fieldValues, _ref, errors, values, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, name, error;
|
|
21684
21709
|
return _ts_generator$2(this, function(_state) {
|
|
21685
21710
|
switch(_state.label){
|
|
21686
21711
|
case 0:
|
|
@@ -21690,28 +21715,6 @@ function createFormControl() {
|
|
|
21690
21715
|
e.persist && e.persist();
|
|
21691
21716
|
}
|
|
21692
21717
|
fieldValues = cloneObject(_formValues);
|
|
21693
|
-
if (_names.disabled.size) {
|
|
21694
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
21695
|
-
try {
|
|
21696
|
-
for(_iterator = _names.disabled[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
21697
|
-
name = _step.value;
|
|
21698
|
-
set(fieldValues, name, undefined);
|
|
21699
|
-
}
|
|
21700
|
-
} catch (err) {
|
|
21701
|
-
_didIteratorError = true;
|
|
21702
|
-
_iteratorError = err;
|
|
21703
|
-
} finally{
|
|
21704
|
-
try {
|
|
21705
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
21706
|
-
_iterator.return();
|
|
21707
|
-
}
|
|
21708
|
-
} finally{
|
|
21709
|
-
if (_didIteratorError) {
|
|
21710
|
-
throw _iteratorError;
|
|
21711
|
-
}
|
|
21712
|
-
}
|
|
21713
|
-
}
|
|
21714
|
-
}
|
|
21715
21718
|
_subjects.state.next({
|
|
21716
21719
|
isSubmitting: true
|
|
21717
21720
|
});
|
|
@@ -21721,7 +21724,7 @@ function createFormControl() {
|
|
|
21721
21724
|
];
|
|
21722
21725
|
return [
|
|
21723
21726
|
4,
|
|
21724
|
-
|
|
21727
|
+
_runSchema()
|
|
21725
21728
|
];
|
|
21726
21729
|
case 1:
|
|
21727
21730
|
_ref = _state.sent(), errors = _ref.errors, values = _ref.values;
|
|
@@ -21740,6 +21743,28 @@ function createFormControl() {
|
|
|
21740
21743
|
_state.sent();
|
|
21741
21744
|
_state.label = 4;
|
|
21742
21745
|
case 4:
|
|
21746
|
+
if (_names.disabled.size) {
|
|
21747
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
21748
|
+
try {
|
|
21749
|
+
for(_iterator = _names.disabled[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
21750
|
+
name = _step.value;
|
|
21751
|
+
set(fieldValues, name, undefined);
|
|
21752
|
+
}
|
|
21753
|
+
} catch (err) {
|
|
21754
|
+
_didIteratorError = true;
|
|
21755
|
+
_iteratorError = err;
|
|
21756
|
+
} finally{
|
|
21757
|
+
try {
|
|
21758
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
21759
|
+
_iterator.return();
|
|
21760
|
+
}
|
|
21761
|
+
} finally{
|
|
21762
|
+
if (_didIteratorError) {
|
|
21763
|
+
throw _iteratorError;
|
|
21764
|
+
}
|
|
21765
|
+
}
|
|
21766
|
+
}
|
|
21767
|
+
}
|
|
21743
21768
|
unset(_formState.errors, "root");
|
|
21744
21769
|
if (!isEmptyObject(_formState.errors)) return [
|
|
21745
21770
|
3,
|
|
@@ -21834,7 +21859,7 @@ function createFormControl() {
|
|
|
21834
21859
|
}
|
|
21835
21860
|
if (!options.keepError) {
|
|
21836
21861
|
unset(_formState.errors, name);
|
|
21837
|
-
_proxyFormState.isValid &&
|
|
21862
|
+
_proxyFormState.isValid && _setValid();
|
|
21838
21863
|
}
|
|
21839
21864
|
_subjects.state.next(_object_spread$e({}, _formState));
|
|
21840
21865
|
}
|
|
@@ -21904,13 +21929,32 @@ function createFormControl() {
|
|
|
21904
21929
|
}
|
|
21905
21930
|
}
|
|
21906
21931
|
}
|
|
21907
|
-
|
|
21932
|
+
var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = undefined;
|
|
21933
|
+
try {
|
|
21934
|
+
for(var _iterator2 = _names.mount[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true){
|
|
21935
|
+
var fieldName1 = _step2.value;
|
|
21936
|
+
setValue(fieldName1, get$2(values, fieldName1));
|
|
21937
|
+
}
|
|
21938
|
+
} catch (err) {
|
|
21939
|
+
_didIteratorError2 = true;
|
|
21940
|
+
_iteratorError2 = err;
|
|
21941
|
+
} finally{
|
|
21942
|
+
try {
|
|
21943
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
21944
|
+
_iterator2.return();
|
|
21945
|
+
}
|
|
21946
|
+
} finally{
|
|
21947
|
+
if (_didIteratorError2) {
|
|
21948
|
+
throw _iteratorError2;
|
|
21949
|
+
}
|
|
21950
|
+
}
|
|
21951
|
+
}
|
|
21908
21952
|
}
|
|
21909
|
-
_formValues =
|
|
21953
|
+
_formValues = cloneObject(values);
|
|
21910
21954
|
_subjects.array.next({
|
|
21911
21955
|
values: _object_spread$e({}, values)
|
|
21912
21956
|
});
|
|
21913
|
-
_subjects.
|
|
21957
|
+
_subjects.state.next({
|
|
21914
21958
|
values: _object_spread$e({}, values)
|
|
21915
21959
|
});
|
|
21916
21960
|
}
|
|
@@ -21951,7 +21995,7 @@ function createFormControl() {
|
|
|
21951
21995
|
}
|
|
21952
21996
|
}
|
|
21953
21997
|
};
|
|
21954
|
-
var
|
|
21998
|
+
var _setFormState = function(updatedFormState) {
|
|
21955
21999
|
_formState = _object_spread$e({}, _formState, updatedFormState);
|
|
21956
22000
|
};
|
|
21957
22001
|
var _resetDefaultValues = function() {
|
|
@@ -21962,28 +22006,28 @@ function createFormControl() {
|
|
|
21962
22006
|
});
|
|
21963
22007
|
});
|
|
21964
22008
|
};
|
|
21965
|
-
|
|
22009
|
+
var methods = {
|
|
21966
22010
|
control: {
|
|
21967
22011
|
register: register,
|
|
21968
22012
|
unregister: unregister,
|
|
21969
22013
|
getFieldState: getFieldState,
|
|
21970
22014
|
handleSubmit: handleSubmit,
|
|
21971
22015
|
setError: setError,
|
|
21972
|
-
|
|
22016
|
+
_subscribe: _subscribe,
|
|
22017
|
+
_runSchema: _runSchema,
|
|
21973
22018
|
_getWatch: _getWatch,
|
|
21974
22019
|
_getDirty: _getDirty,
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
22020
|
+
_setValid: _setValid,
|
|
22021
|
+
_setFieldArray: _setFieldArray,
|
|
22022
|
+
_setDisabledField: _setDisabledField,
|
|
22023
|
+
_setErrors: _setErrors,
|
|
21979
22024
|
_getFieldArray: _getFieldArray,
|
|
21980
22025
|
_reset: _reset,
|
|
21981
22026
|
_resetDefaultValues: _resetDefaultValues,
|
|
21982
|
-
|
|
22027
|
+
_removeUnmounted: _removeUnmounted,
|
|
21983
22028
|
_disableForm: _disableForm,
|
|
21984
22029
|
_subjects: _subjects,
|
|
21985
22030
|
_proxyFormState: _proxyFormState,
|
|
21986
|
-
_setErrors: _setErrors,
|
|
21987
22031
|
get _fields () {
|
|
21988
22032
|
return _fields;
|
|
21989
22033
|
},
|
|
@@ -22008,9 +22052,6 @@ function createFormControl() {
|
|
|
22008
22052
|
get _formState () {
|
|
22009
22053
|
return _formState;
|
|
22010
22054
|
},
|
|
22011
|
-
set _formState (value){
|
|
22012
|
-
_formState = value;
|
|
22013
|
-
},
|
|
22014
22055
|
get _options () {
|
|
22015
22056
|
return _options;
|
|
22016
22057
|
},
|
|
@@ -22018,6 +22059,7 @@ function createFormControl() {
|
|
|
22018
22059
|
_options = _object_spread$e({}, _options, value);
|
|
22019
22060
|
}
|
|
22020
22061
|
},
|
|
22062
|
+
subscribe: subscribe,
|
|
22021
22063
|
trigger: trigger,
|
|
22022
22064
|
register: register,
|
|
22023
22065
|
handleSubmit: handleSubmit,
|
|
@@ -22032,6 +22074,9 @@ function createFormControl() {
|
|
|
22032
22074
|
setFocus: setFocus,
|
|
22033
22075
|
getFieldState: getFieldState
|
|
22034
22076
|
};
|
|
22077
|
+
return _object_spread_props$a(_object_spread$e({}, methods), {
|
|
22078
|
+
formControl: methods
|
|
22079
|
+
});
|
|
22035
22080
|
}
|
|
22036
22081
|
/**
|
|
22037
22082
|
* Custom hook to manage the entire form.
|
|
@@ -22082,20 +22127,26 @@ function createFormControl() {
|
|
|
22082
22127
|
defaultValues: isFunction$5(props.defaultValues) ? undefined : props.defaultValues
|
|
22083
22128
|
}), 2), formState = _React_useState[0], updateFormState = _React_useState[1];
|
|
22084
22129
|
if (!_formControl.current) {
|
|
22085
|
-
_formControl.current = _object_spread_props$a(_object_spread$e({}, createFormControl(props)), {
|
|
22130
|
+
_formControl.current = _object_spread_props$a(_object_spread$e({}, props.formControl ? props.formControl : createFormControl(props)), {
|
|
22086
22131
|
formState: formState
|
|
22087
22132
|
});
|
|
22133
|
+
if (props.formControl && props.defaultValues && !isFunction$5(props.defaultValues)) {
|
|
22134
|
+
props.formControl.reset(props.defaultValues, props.resetOptions);
|
|
22135
|
+
}
|
|
22088
22136
|
}
|
|
22089
22137
|
var control = _formControl.current.control;
|
|
22090
22138
|
control._options = props;
|
|
22091
|
-
|
|
22092
|
-
|
|
22093
|
-
|
|
22094
|
-
|
|
22095
|
-
updateFormState(_object_spread$e({}, control._formState));
|
|
22096
|
-
}
|
|
22097
|
-
|
|
22098
|
-
|
|
22139
|
+
React__default.useLayoutEffect(function() {
|
|
22140
|
+
return control._subscribe({
|
|
22141
|
+
formState: control._proxyFormState,
|
|
22142
|
+
callback: function() {
|
|
22143
|
+
return updateFormState(_object_spread$e({}, control._formState));
|
|
22144
|
+
},
|
|
22145
|
+
reRenderRoot: true
|
|
22146
|
+
});
|
|
22147
|
+
}, [
|
|
22148
|
+
control
|
|
22149
|
+
]);
|
|
22099
22150
|
React__default.useEffect(function() {
|
|
22100
22151
|
return control._disableForm(props.disabled);
|
|
22101
22152
|
}, [
|
|
@@ -22130,7 +22181,7 @@ function createFormControl() {
|
|
|
22130
22181
|
control
|
|
22131
22182
|
]);
|
|
22132
22183
|
React__default.useEffect(function() {
|
|
22133
|
-
if (props.errors) {
|
|
22184
|
+
if (props.errors && !isEmptyObject(props.errors)) {
|
|
22134
22185
|
control._setErrors(props.errors);
|
|
22135
22186
|
}
|
|
22136
22187
|
}, [
|
|
@@ -22139,7 +22190,7 @@ function createFormControl() {
|
|
|
22139
22190
|
]);
|
|
22140
22191
|
React__default.useEffect(function() {
|
|
22141
22192
|
if (!control._state.mount) {
|
|
22142
|
-
control.
|
|
22193
|
+
control._setValid();
|
|
22143
22194
|
control._state.mount = true;
|
|
22144
22195
|
}
|
|
22145
22196
|
if (control._state.watch) {
|
|
@@ -22149,7 +22200,7 @@ function createFormControl() {
|
|
|
22149
22200
|
control._removeUnmounted();
|
|
22150
22201
|
});
|
|
22151
22202
|
React__default.useEffect(function() {
|
|
22152
|
-
props.shouldUnregister && control._subjects.
|
|
22203
|
+
props.shouldUnregister && control._subjects.state.next({
|
|
22153
22204
|
values: control._getWatch()
|
|
22154
22205
|
});
|
|
22155
22206
|
}, [
|
|
@@ -30550,13 +30601,13 @@ function _instanceof$4(left, right) {
|
|
|
30550
30601
|
return left instanceof right;
|
|
30551
30602
|
}
|
|
30552
30603
|
}
|
|
30553
|
-
var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.
|
|
30604
|
+
var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled", m = "active", y = "data-styled-version", v = "6.1.17", g = "/*!sc*/\n", S = "undefined" != typeof window && "HTMLElement" in window, w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : "production" !== process.env.NODE_ENV), E = /invalid hook call/i, N = new Set, P = function P(t, n) {
|
|
30554
30605
|
if ("production" !== process.env.NODE_ENV) {
|
|
30555
|
-
var _$
|
|
30606
|
+
var _$o = n ? ' with the id of "'.concat(n, '"') : "", s = "The component ".concat(t).concat(_$o, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n", i = console.error;
|
|
30556
30607
|
try {
|
|
30557
30608
|
var a = !0;
|
|
30558
30609
|
console.error = function(t) {
|
|
30559
|
-
for(var _$n = [], _$
|
|
30610
|
+
for(var _$n = [], _$o = 1; _$o < arguments.length; _$o++)_$n[_$o - 1] = arguments[_$o];
|
|
30560
30611
|
E.test(t) ? (a = !1, N.delete(s)) : i.apply(void 0, __spreadArray([
|
|
30561
30612
|
t
|
|
30562
30613
|
], _$n, !1));
|
|
@@ -30771,16 +30822,16 @@ function X(e) {
|
|
|
30771
30822
|
var t;
|
|
30772
30823
|
}
|
|
30773
30824
|
var Z = Object.defineProperty, K = Object.getOwnPropertyNames, Q = Object.getOwnPropertySymbols, ee = Object.getOwnPropertyDescriptor, te = Object.getPrototypeOf, ne = Object.prototype;
|
|
30774
|
-
function
|
|
30825
|
+
function oe(e, t, n) {
|
|
30775
30826
|
if ("string" != typeof t) {
|
|
30776
30827
|
if (ne) {
|
|
30777
|
-
var _$
|
|
30778
|
-
_$
|
|
30828
|
+
var _$o = te(t);
|
|
30829
|
+
_$o && _$o !== ne && oe(e, _$o, n);
|
|
30779
30830
|
}
|
|
30780
|
-
var
|
|
30781
|
-
Q && (
|
|
30782
|
-
for(var s = X(e), i = X(t), a = 0; a <
|
|
30783
|
-
var c =
|
|
30831
|
+
var r = K(t);
|
|
30832
|
+
Q && (r = r.concat(Q(t)));
|
|
30833
|
+
for(var s = X(e), i = X(t), a = 0; a < r.length; ++a){
|
|
30834
|
+
var c = r[a];
|
|
30784
30835
|
if (!(c in H || n && n[c] || i && c in i || s && c in s)) {
|
|
30785
30836
|
var l = ee(t, c);
|
|
30786
30837
|
try {
|
|
@@ -30791,7 +30842,7 @@ function re(e, t, n) {
|
|
|
30791
30842
|
}
|
|
30792
30843
|
return e;
|
|
30793
30844
|
}
|
|
30794
|
-
function
|
|
30845
|
+
function re(e) {
|
|
30795
30846
|
return "function" == typeof e;
|
|
30796
30847
|
}
|
|
30797
30848
|
function se(e) {
|
|
@@ -30802,7 +30853,7 @@ function ie(e, t) {
|
|
|
30802
30853
|
}
|
|
30803
30854
|
function ae(e, t) {
|
|
30804
30855
|
if (0 === e.length) return "";
|
|
30805
|
-
for(var n = e[0], _$
|
|
30856
|
+
for(var n = e[0], _$o = 1; _$o < e.length; _$o++)n += t ? t + e[_$o] : e[_$o];
|
|
30806
30857
|
return n;
|
|
30807
30858
|
}
|
|
30808
30859
|
function ce(e) {
|
|
@@ -30810,8 +30861,8 @@ function ce(e) {
|
|
|
30810
30861
|
}
|
|
30811
30862
|
function le(e, t, n) {
|
|
30812
30863
|
if (void 0 === n && (n = !1), !n && !ce(e) && !Array.isArray(e)) return t;
|
|
30813
|
-
if (Array.isArray(t)) for(var _$
|
|
30814
|
-
else if (ce(t)) for(var _$
|
|
30864
|
+
if (Array.isArray(t)) for(var _$o = 0; _$o < t.length; _$o++)e[_$o] = le(e[_$o], t[_$o]);
|
|
30865
|
+
else if (ce(t)) for(var _$o in t)e[_$o] = le(e[_$o], t[_$o]);
|
|
30815
30866
|
return e;
|
|
30816
30867
|
}
|
|
30817
30868
|
function ue(e, t) {
|
|
@@ -30841,13 +30892,13 @@ var pe = "production" !== process.env.NODE_ENV ? {
|
|
|
30841
30892
|
} : {};
|
|
30842
30893
|
function de() {
|
|
30843
30894
|
for(var e = [], t = 0; t < arguments.length; t++)e[t] = arguments[t];
|
|
30844
|
-
for(var n = e[0], _$
|
|
30845
|
-
return _$
|
|
30895
|
+
for(var n = e[0], _$o = [], r = 1, s = e.length; r < s; r += 1)_$o.push(e[r]);
|
|
30896
|
+
return _$o.forEach(function(e) {
|
|
30846
30897
|
n = n.replace(/%[a-z]/, e);
|
|
30847
30898
|
}), n;
|
|
30848
30899
|
}
|
|
30849
30900
|
function he(t) {
|
|
30850
|
-
for(var n = [], _$
|
|
30901
|
+
for(var n = [], _$o = 1; _$o < arguments.length; _$o++)n[_$o - 1] = arguments[_$o];
|
|
30851
30902
|
return "production" === process.env.NODE_ENV ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t, " for more information.").concat(n.length > 0 ? " Args: ".concat(n.join(", ")) : "")) : new Error(de.apply(void 0, __spreadArray([
|
|
30852
30903
|
pe[t]
|
|
30853
30904
|
], n, !1)).trim());
|
|
@@ -30861,21 +30912,21 @@ var fe = function() {
|
|
|
30861
30912
|
return t;
|
|
30862
30913
|
}, e.prototype.insertRules = function(e, t) {
|
|
30863
30914
|
if (e >= this.groupSizes.length) {
|
|
30864
|
-
for(var n = this.groupSizes, _$
|
|
30865
|
-
this.groupSizes = new Uint32Array(
|
|
30866
|
-
for(var s = _$
|
|
30915
|
+
for(var n = this.groupSizes, _$o = n.length, r = _$o; e >= r;)if ((r <<= 1) < 0) throw he(16, "".concat(e));
|
|
30916
|
+
this.groupSizes = new Uint32Array(r), this.groupSizes.set(n), this.length = r;
|
|
30917
|
+
for(var s = _$o; s < r; s++)this.groupSizes[s] = 0;
|
|
30867
30918
|
}
|
|
30868
30919
|
for(var i = this.indexOfGroup(e + 1), a = (s = 0, t.length); s < a; s++)this.tag.insertRule(i, t[s]) && (this.groupSizes[e]++, i++);
|
|
30869
30920
|
}, e.prototype.clearGroup = function(e) {
|
|
30870
30921
|
if (e < this.length) {
|
|
30871
|
-
var t = this.groupSizes[e], n = this.indexOfGroup(e), _$
|
|
30922
|
+
var t = this.groupSizes[e], n = this.indexOfGroup(e), _$o = n + t;
|
|
30872
30923
|
this.groupSizes[e] = 0;
|
|
30873
|
-
for(var
|
|
30924
|
+
for(var r = n; r < _$o; r++)this.tag.deleteRule(n);
|
|
30874
30925
|
}
|
|
30875
30926
|
}, e.prototype.getGroup = function(e) {
|
|
30876
30927
|
var t = "";
|
|
30877
30928
|
if (e >= this.length || 0 === this.groupSizes[e]) return t;
|
|
30878
|
-
for(var n = this.groupSizes[e], _$
|
|
30929
|
+
for(var n = this.groupSizes[e], _$o = this.indexOfGroup(e), r = _$o + n, s = _$o; s < r; s++)t += "".concat(this.tag.getRule(s)).concat(g);
|
|
30879
30930
|
return t;
|
|
30880
30931
|
}, e;
|
|
30881
30932
|
}(), me = 1 << 30, ye = new Map, ve = new Map, ge = 1, Se = function Se(e) {
|
|
@@ -30887,42 +30938,42 @@ var fe = function() {
|
|
|
30887
30938
|
}, we = function we(e, t) {
|
|
30888
30939
|
ge = t + 1, ye.set(e, t), ve.set(t, e);
|
|
30889
30940
|
}, be = "style[".concat(f, "][").concat(y, '="').concat(v, '"]'), Ee = new RegExp("^".concat(f, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')), Ne = function Ne(e, t, n) {
|
|
30890
|
-
for(var _$
|
|
30941
|
+
for(var _$o, r = n.split(","), s = 0, i = r.length; s < i; s++)(_$o = r[s]) && e.registerName(t, _$o);
|
|
30891
30942
|
}, Pe = function Pe(e, t) {
|
|
30892
|
-
for(var n, _$
|
|
30893
|
-
var a = _$
|
|
30943
|
+
for(var n, _$o = (null !== (n = t.textContent) && void 0 !== n ? n : "").split(g), r = [], s = 0, i = _$o.length; s < i; s++){
|
|
30944
|
+
var a = _$o[s].trim();
|
|
30894
30945
|
if (a) {
|
|
30895
30946
|
var c = a.match(Ee);
|
|
30896
30947
|
if (c) {
|
|
30897
30948
|
var l = 0 | parseInt(c[1], 10), u = c[2];
|
|
30898
|
-
0 !== l && (we(u, l), Ne(e, u, c[3]), e.getTag().insertRules(l,
|
|
30899
|
-
} else
|
|
30949
|
+
0 !== l && (we(u, l), Ne(e, u, c[3]), e.getTag().insertRules(l, r)), r.length = 0;
|
|
30950
|
+
} else r.push(a);
|
|
30900
30951
|
}
|
|
30901
30952
|
}
|
|
30902
30953
|
}, _e = function _e(e) {
|
|
30903
|
-
for(var t = document.querySelectorAll(be), n = 0, _$
|
|
30904
|
-
var
|
|
30905
|
-
|
|
30954
|
+
for(var t = document.querySelectorAll(be), n = 0, _$o = t.length; n < _$o; n++){
|
|
30955
|
+
var r = t[n];
|
|
30956
|
+
r && r.getAttribute(f) !== m && (Pe(e, r), r.parentNode && r.parentNode.removeChild(r));
|
|
30906
30957
|
}
|
|
30907
30958
|
};
|
|
30908
30959
|
function Ce() {
|
|
30909
30960
|
return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : null;
|
|
30910
30961
|
}
|
|
30911
30962
|
var Ie = function Ie(e) {
|
|
30912
|
-
var t = document.head, n = e || t, _$
|
|
30963
|
+
var t = document.head, n = e || t, _$o = document.createElement("style"), r = function(e) {
|
|
30913
30964
|
var t = Array.from(e.querySelectorAll("style[".concat(f, "]")));
|
|
30914
30965
|
return t[t.length - 1];
|
|
30915
|
-
}(n), s = void 0 !==
|
|
30916
|
-
_$
|
|
30966
|
+
}(n), s = void 0 !== r ? r.nextSibling : null;
|
|
30967
|
+
_$o.setAttribute(f, m), _$o.setAttribute(y, v);
|
|
30917
30968
|
var i = Ce();
|
|
30918
|
-
return i && _$
|
|
30969
|
+
return i && _$o.setAttribute("nonce", i), n.insertBefore(_$o, s), _$o;
|
|
30919
30970
|
}, Ae = function() {
|
|
30920
30971
|
function e(e) {
|
|
30921
30972
|
this.element = Ie(e), this.element.appendChild(document.createTextNode("")), this.sheet = function(e) {
|
|
30922
30973
|
if (e.sheet) return e.sheet;
|
|
30923
|
-
for(var t = document.styleSheets, n = 0, _$
|
|
30924
|
-
var
|
|
30925
|
-
if (
|
|
30974
|
+
for(var t = document.styleSheets, n = 0, _$o = t.length; n < _$o; n++){
|
|
30975
|
+
var r = t[n];
|
|
30976
|
+
if (r.ownerNode === e) return r;
|
|
30926
30977
|
}
|
|
30927
30978
|
throw he(17);
|
|
30928
30979
|
}(this.element), this.length = 0;
|
|
@@ -30969,33 +31020,33 @@ var Ie = function Ie(e) {
|
|
|
30969
31020
|
isServer: !S,
|
|
30970
31021
|
useCSSOMInjection: !w
|
|
30971
31022
|
}, ke = function() {
|
|
30972
|
-
function e(e, n,
|
|
31023
|
+
function e(e, n, o) {
|
|
30973
31024
|
void 0 === e && (e = C), void 0 === n && (n = {});
|
|
30974
|
-
var
|
|
30975
|
-
this.options = __assign(__assign({}, Te), e), this.gs = n, this.names = new Map(
|
|
31025
|
+
var r = this;
|
|
31026
|
+
this.options = __assign(__assign({}, Te), e), this.gs = n, this.names = new Map(o), this.server = !!e.isServer, !this.server && S && Re && (Re = !1, _e(this)), ue(this, function() {
|
|
30976
31027
|
return function(e) {
|
|
30977
|
-
for(var _$t = e.getTag(), _$n = _$t.length, _$
|
|
30978
|
-
var
|
|
31028
|
+
for(var _$t = e.getTag(), _$n = _$t.length, _$o = "", r = function r(n) {
|
|
31029
|
+
var r = function(e) {
|
|
30979
31030
|
return ve.get(e);
|
|
30980
31031
|
}(n);
|
|
30981
|
-
if (void 0 ===
|
|
30982
|
-
var s = e.names.get(
|
|
31032
|
+
if (void 0 === r) return "continue";
|
|
31033
|
+
var s = e.names.get(r), i = _$t.getGroup(n);
|
|
30983
31034
|
if (void 0 === s || !s.size || 0 === i.length) return "continue";
|
|
30984
|
-
var a = "".concat(f, ".g").concat(n, '[id="').concat(
|
|
31035
|
+
var a = "".concat(f, ".g").concat(n, '[id="').concat(r, '"]'), c = "";
|
|
30985
31036
|
void 0 !== s && s.forEach(function(e) {
|
|
30986
31037
|
e.length > 0 && (c += "".concat(e, ","));
|
|
30987
|
-
}), _$
|
|
30988
|
-
}, s = 0; s < _$n; s++)
|
|
30989
|
-
return _$
|
|
30990
|
-
}(
|
|
31038
|
+
}), _$o += "".concat(i).concat(a, '{content:"').concat(c, '"}').concat(g);
|
|
31039
|
+
}, s = 0; s < _$n; s++)r(s);
|
|
31040
|
+
return _$o;
|
|
31041
|
+
}(r);
|
|
30991
31042
|
});
|
|
30992
31043
|
}
|
|
30993
31044
|
return e.registerId = function(e) {
|
|
30994
31045
|
return Se(e);
|
|
30995
31046
|
}, e.prototype.rehydrate = function() {
|
|
30996
31047
|
!this.server && S && _e(this);
|
|
30997
|
-
}, e.prototype.reconstructWithOptions = function(n,
|
|
30998
|
-
return void 0 ===
|
|
31048
|
+
}, e.prototype.reconstructWithOptions = function(n, o) {
|
|
31049
|
+
return void 0 === o && (o = !0), new e(__assign(__assign({}, this.options), n), this.gs, o && this.names || void 0);
|
|
30999
31050
|
}, e.prototype.allocateGSInstance = function(e) {
|
|
31000
31051
|
return this.gs[e] = (this.gs[e] || 0) + 1;
|
|
31001
31052
|
}, e.prototype.getTag = function() {
|
|
@@ -31030,15 +31081,15 @@ function Ve(e, t) {
|
|
|
31030
31081
|
});
|
|
31031
31082
|
}
|
|
31032
31083
|
function Fe(e) {
|
|
31033
|
-
var t, n, _$
|
|
31034
|
-
return
|
|
31084
|
+
var t, n, _$o, r = void 0 === e ? C : e, s = r.options, i = void 0 === s ? C : s, a = r.plugins, c = void 0 === a ? _$1 : a, l = function l(e, o, r) {
|
|
31085
|
+
return r.startsWith(n) && r.endsWith(n) && r.replaceAll(n, "").length > 0 ? ".".concat(t) : e;
|
|
31035
31086
|
}, u = c.slice();
|
|
31036
31087
|
u.push(function(e) {
|
|
31037
|
-
e.type === RULESET && e.value.includes("&") && (e.props[0] = e.props[0].replace(je, n).replace(_$
|
|
31088
|
+
e.type === RULESET && e.value.includes("&") && (e.props[0] = e.props[0].replace(je, n).replace(_$o, l));
|
|
31038
31089
|
}), i.prefix && u.push(prefixer), u.push(stringify);
|
|
31039
|
-
var p = function p(e,
|
|
31040
|
-
void 0 ===
|
|
31041
|
-
var c = e.replace(xe, ""), l = compile(s ||
|
|
31090
|
+
var p = function p(e, r, s, a) {
|
|
31091
|
+
void 0 === r && (r = ""), void 0 === s && (s = ""), void 0 === a && (a = "&"), t = a, n = r, _$o = new RegExp("\\".concat(n, "\\b"), "g");
|
|
31092
|
+
var c = e.replace(xe, ""), l = compile(s || r ? "".concat(s, " ").concat(r, " { ").concat(c, " }") : c);
|
|
31042
31093
|
i.namespace && (l = Ve(l, i.namespace));
|
|
31043
31094
|
var p = [];
|
|
31044
31095
|
return serialize(l, middleware(u.concat(rulesheet(function(e) {
|
|
@@ -31062,8 +31113,8 @@ var qe = function() {
|
|
|
31062
31113
|
var n = this;
|
|
31063
31114
|
this.inject = function(e, t) {
|
|
31064
31115
|
void 0 === t && (t = ze);
|
|
31065
|
-
var _$
|
|
31066
|
-
e.hasNameForId(n.id, _$
|
|
31116
|
+
var _$o = n.name + t.hash;
|
|
31117
|
+
e.hasNameForId(n.id, _$o) || e.insertRules(n.id, _$o, t(n.rules, _$o, "@keyframes"));
|
|
31067
31118
|
}, this.name = e, this.id = "sc-keyframes-".concat(e), this.rules = t, ue(this, function() {
|
|
31068
31119
|
throw he(12, String(n.name));
|
|
31069
31120
|
});
|
|
@@ -31076,45 +31127,45 @@ var qe = function() {
|
|
|
31076
31127
|
};
|
|
31077
31128
|
function He(e) {
|
|
31078
31129
|
for(var t = "", n = 0; n < e.length; n++){
|
|
31079
|
-
var _$
|
|
31080
|
-
if (1 === n && "-" === _$
|
|
31081
|
-
We(_$
|
|
31130
|
+
var _$o = e[n];
|
|
31131
|
+
if (1 === n && "-" === _$o && "-" === e[0]) return e;
|
|
31132
|
+
We(_$o) ? t += "-" + _$o.toLowerCase() : t += _$o;
|
|
31082
31133
|
}
|
|
31083
31134
|
return t.startsWith("ms-") ? "-" + t : t;
|
|
31084
31135
|
}
|
|
31085
31136
|
var Ue = function Ue(e) {
|
|
31086
31137
|
return null == e || !1 === e || "" === e;
|
|
31087
31138
|
}, Je = function Je1(t) {
|
|
31088
|
-
var n, _$
|
|
31139
|
+
var n, _$o, r = [];
|
|
31089
31140
|
for(var s in t){
|
|
31090
31141
|
var i = t[s];
|
|
31091
|
-
t.hasOwnProperty(s) && !Ue(i) && (Array.isArray(i) && i.isCss ||
|
|
31142
|
+
t.hasOwnProperty(s) && !Ue(i) && (Array.isArray(i) && i.isCss || re(i) ? r.push("".concat(He(s), ":"), i, ";") : ce(i) ? r.push.apply(r, __spreadArray(__spreadArray([
|
|
31092
31143
|
"".concat(s, " {")
|
|
31093
31144
|
], Je(i), !1), [
|
|
31094
31145
|
"}"
|
|
31095
|
-
], !1)) :
|
|
31146
|
+
], !1)) : r.push("".concat(He(s), ": ").concat((n = s, null == (_$o = i) || "boolean" == typeof _$o || "" === _$o ? "" : "number" != typeof _$o || 0 === _$o || n in unitlessKeys || n.startsWith("--") ? String(_$o).trim() : "".concat(_$o, "px")), ";")));
|
|
31096
31147
|
}
|
|
31097
|
-
return
|
|
31148
|
+
return r;
|
|
31098
31149
|
};
|
|
31099
|
-
function Xe(e, t, n,
|
|
31150
|
+
function Xe(e, t, n, o) {
|
|
31100
31151
|
if (Ue(e)) return [];
|
|
31101
31152
|
if (se(e)) return [
|
|
31102
31153
|
".".concat(e.styledComponentId)
|
|
31103
31154
|
];
|
|
31104
|
-
if (
|
|
31105
|
-
if (!
|
|
31155
|
+
if (re(e)) {
|
|
31156
|
+
if (!re(s = e) || s.prototype && s.prototype.isReactComponent || !t) return [
|
|
31106
31157
|
e
|
|
31107
31158
|
];
|
|
31108
|
-
var
|
|
31109
|
-
return "production" === process.env.NODE_ENV || "object" != typeof
|
|
31159
|
+
var r = e(t);
|
|
31160
|
+
return "production" === process.env.NODE_ENV || "object" != typeof r || Array.isArray(r) || _instanceof$4(r, qe) || ce(r) || null === r || console.error("".concat(B(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Xe(r, t, n, o);
|
|
31110
31161
|
}
|
|
31111
31162
|
var s;
|
|
31112
|
-
return _instanceof$4(e, qe) ? n ? (e.inject(n,
|
|
31113
|
-
e.getName(
|
|
31163
|
+
return _instanceof$4(e, qe) ? n ? (e.inject(n, o), [
|
|
31164
|
+
e.getName(o)
|
|
31114
31165
|
]) : [
|
|
31115
31166
|
e
|
|
31116
31167
|
] : ce(e) ? Je(e) : Array.isArray(e) ? Array.prototype.concat.apply(_$1, e.map(function(e) {
|
|
31117
|
-
return Xe(e, t, n,
|
|
31168
|
+
return Xe(e, t, n, o);
|
|
31118
31169
|
})) : [
|
|
31119
31170
|
e.toString()
|
|
31120
31171
|
];
|
|
@@ -31122,7 +31173,7 @@ function Xe(e, t, n, r) {
|
|
|
31122
31173
|
function Ze(e) {
|
|
31123
31174
|
for(var t = 0; t < e.length; t += 1){
|
|
31124
31175
|
var n = e[t];
|
|
31125
|
-
if (
|
|
31176
|
+
if (re(n) && !se(n)) return !1;
|
|
31126
31177
|
}
|
|
31127
31178
|
return !0;
|
|
31128
31179
|
}
|
|
@@ -31131,15 +31182,15 @@ var Ke = z(v), Qe = function() {
|
|
|
31131
31182
|
this.rules = e, this.staticRulesId = "", this.isStatic = "production" === process.env.NODE_ENV && (void 0 === n || n.isStatic) && Ze(e), this.componentId = t, this.baseHash = M(Ke, t), this.baseStyle = n, ke.registerId(t);
|
|
31132
31183
|
}
|
|
31133
31184
|
return e.prototype.generateAndInjectStyles = function(e, t, n) {
|
|
31134
|
-
var _$
|
|
31135
|
-
if (this.isStatic && !n.hash) if (this.staticRulesId && t.hasNameForId(this.componentId, this.staticRulesId)) _$
|
|
31185
|
+
var _$o = this.baseStyle ? this.baseStyle.generateAndInjectStyles(e, t, n) : "";
|
|
31186
|
+
if (this.isStatic && !n.hash) if (this.staticRulesId && t.hasNameForId(this.componentId, this.staticRulesId)) _$o = ie(_$o, this.staticRulesId);
|
|
31136
31187
|
else {
|
|
31137
|
-
var
|
|
31188
|
+
var r = ae(Xe(this.rules, e, t, n)), s = x(M(this.baseHash, r) >>> 0);
|
|
31138
31189
|
if (!t.hasNameForId(this.componentId, s)) {
|
|
31139
|
-
var i = n(
|
|
31190
|
+
var i = n(r, ".".concat(s), void 0, this.componentId);
|
|
31140
31191
|
t.insertRules(this.componentId, s, i);
|
|
31141
31192
|
}
|
|
31142
|
-
_$
|
|
31193
|
+
_$o = ie(_$o, s), this.staticRulesId = s;
|
|
31143
31194
|
}
|
|
31144
31195
|
else {
|
|
31145
31196
|
for(var a = M(this.baseHash, n.hash), c = "", l = 0; l < this.rules.length; l++){
|
|
@@ -31152,55 +31203,55 @@ var Ke = z(v), Qe = function() {
|
|
|
31152
31203
|
}
|
|
31153
31204
|
if (c) {
|
|
31154
31205
|
var d = x(a >>> 0);
|
|
31155
|
-
t.hasNameForId(this.componentId, d) || t.insertRules(this.componentId, d, n(c, ".".concat(d), void 0, this.componentId)), _$
|
|
31206
|
+
t.hasNameForId(this.componentId, d) || t.insertRules(this.componentId, d, n(c, ".".concat(d), void 0, this.componentId)), _$o = ie(_$o, d);
|
|
31156
31207
|
}
|
|
31157
31208
|
}
|
|
31158
|
-
return _$
|
|
31209
|
+
return _$o;
|
|
31159
31210
|
}, e;
|
|
31160
31211
|
}(), et = React__default.createContext(void 0); et.Consumer;
|
|
31161
|
-
var
|
|
31162
|
-
function it(e,
|
|
31163
|
-
var i = se(e), a = e, c = !L(e), p =
|
|
31212
|
+
var rt = {}, st = new Set;
|
|
31213
|
+
function it(e, r, s) {
|
|
31214
|
+
var i = se(e), a = e, c = !L(e), p = r.attrs, d = void 0 === p ? _$1 : p, h = r.componentId, f = void 0 === h ? function(e, t) {
|
|
31164
31215
|
var n = "string" != typeof e ? "sc" : R(e);
|
|
31165
|
-
|
|
31166
|
-
var _$
|
|
31167
|
-
return t ? "".concat(t, "-").concat(_$
|
|
31168
|
-
}(
|
|
31216
|
+
rt[n] = (rt[n] || 0) + 1;
|
|
31217
|
+
var _$o = "".concat(n, "-").concat($(v + n + rt[n]));
|
|
31218
|
+
return t ? "".concat(t, "-").concat(_$o) : _$o;
|
|
31219
|
+
}(r.displayName, r.parentComponentId) : h, m = r.displayName, y = void 0 === m ? function(e) {
|
|
31169
31220
|
return L(e) ? "styled.".concat(e) : "Styled(".concat(B(e), ")");
|
|
31170
|
-
}(e) : m, g =
|
|
31221
|
+
}(e) : m, g = r.displayName && r.componentId ? "".concat(R(r.displayName), "-").concat(r.componentId) : r.componentId || f, S = i && a.attrs ? a.attrs.concat(d).filter(Boolean) : d, w = r.shouldForwardProp;
|
|
31171
31222
|
if (i && a.shouldForwardProp) {
|
|
31172
31223
|
var b = a.shouldForwardProp;
|
|
31173
|
-
if (
|
|
31174
|
-
var E =
|
|
31224
|
+
if (r.shouldForwardProp) {
|
|
31225
|
+
var E = r.shouldForwardProp;
|
|
31175
31226
|
w = function w(e, t) {
|
|
31176
31227
|
return b(e, t) && E(e, t);
|
|
31177
31228
|
};
|
|
31178
31229
|
} else w = b;
|
|
31179
31230
|
}
|
|
31180
31231
|
var N = new Qe(s, g, i ? a.componentStyle : void 0);
|
|
31181
|
-
function O(e,
|
|
31182
|
-
return function(e,
|
|
31232
|
+
function O(e, r) {
|
|
31233
|
+
return function(e, r, s) {
|
|
31183
31234
|
var i = e.attrs, a = e.componentStyle, c = e.defaultProps, p = e.foldedComponentIds, d = e.styledComponentId, h = e.target, f = React__default.useContext(et), m = Ge(), y = e.shouldForwardProp || m.shouldForwardProp;
|
|
31184
31235
|
"production" !== process.env.NODE_ENV && useDebugValue(d);
|
|
31185
|
-
var v = I(
|
|
31186
|
-
for(var _$
|
|
31236
|
+
var v = I(r, f, c) || C, g = function(e, n, o) {
|
|
31237
|
+
for(var _$r, _$s = __assign(__assign({}, n), {
|
|
31187
31238
|
className: void 0,
|
|
31188
|
-
theme:
|
|
31239
|
+
theme: o
|
|
31189
31240
|
}), i = 0; i < e.length; i += 1){
|
|
31190
|
-
var a =
|
|
31241
|
+
var a = re(_$r = e[i]) ? _$r(_$s) : _$r;
|
|
31191
31242
|
for(var c in a)_$s[c] = "className" === c ? ie(_$s[c], a[c]) : "style" === c ? __assign(__assign({}, _$s[c]), a[c]) : a[c];
|
|
31192
31243
|
}
|
|
31193
31244
|
return n.className && (_$s.className = ie(_$s.className, n.className)), _$s;
|
|
31194
|
-
}(i,
|
|
31245
|
+
}(i, r, v), S = g.as || h, w = {};
|
|
31195
31246
|
for(var b in g)void 0 === g[b] || "$" === b[0] || "as" === b || "theme" === b && g.theme === v || ("forwardedAs" === b ? w.as = g.forwardedAs : y && !y(b, S) || (w[b] = g[b], y || "development" !== process.env.NODE_ENV || isPropValid(b) || st.has(b) || !A.has(S) || (st.add(b), console.warn('styled-components: it looks like an unknown prop "'.concat(b, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
|
|
31196
31247
|
var E = function(e, t) {
|
|
31197
|
-
var _$n = Ge(), _$
|
|
31198
|
-
return "production" !== process.env.NODE_ENV && useDebugValue(_$
|
|
31248
|
+
var _$n = Ge(), _$o = e.generateAndInjectStyles(t, _$n.styleSheet, _$n.stylis);
|
|
31249
|
+
return "production" !== process.env.NODE_ENV && useDebugValue(_$o), _$o;
|
|
31199
31250
|
}(a, g);
|
|
31200
31251
|
"production" !== process.env.NODE_ENV && e.warnTooManyClasses && e.warnTooManyClasses(E);
|
|
31201
31252
|
var N = ie(p, d);
|
|
31202
31253
|
return E && (N += " " + E), g.className && (N += " " + g.className), w[L(S) && !A.has(S) ? "class" : "className"] = N, s && (w.ref = s), createElement(S, w);
|
|
31203
|
-
}(D, e,
|
|
31254
|
+
}(D, e, r);
|
|
31204
31255
|
}
|
|
31205
31256
|
O.displayName = y;
|
|
31206
31257
|
var D = React__default.forwardRef(O);
|
|
@@ -31211,21 +31262,21 @@ function it(e, o, s) {
|
|
|
31211
31262
|
set: function set(e) {
|
|
31212
31263
|
this._foldedDefaultProps = i ? function(e) {
|
|
31213
31264
|
for(var t = [], n = 1; n < arguments.length; n++)t[n - 1] = arguments[n];
|
|
31214
|
-
for(var _$
|
|
31265
|
+
for(var _$o = 0, _$r = t; _$o < _$r.length; _$o++)le(e, _$r[_$o], !0);
|
|
31215
31266
|
return e;
|
|
31216
31267
|
}({}, a.defaultProps, e) : e;
|
|
31217
31268
|
}
|
|
31218
31269
|
}), "production" !== process.env.NODE_ENV && (P(y, g), D.warnTooManyClasses = function(e, t) {
|
|
31219
|
-
var n = {}, _$
|
|
31220
|
-
return function(
|
|
31221
|
-
if (!_$
|
|
31270
|
+
var n = {}, _$o = !1;
|
|
31271
|
+
return function(r) {
|
|
31272
|
+
if (!_$o && (n[r] = !0, Object.keys(n).length >= 200)) {
|
|
31222
31273
|
var _$s = t ? ' with the id of "'.concat(t, '"') : "";
|
|
31223
|
-
console.warn("Over ".concat(200, " classes were generated for component ").concat(e).concat(_$s, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), _$
|
|
31274
|
+
console.warn("Over ".concat(200, " classes were generated for component ").concat(e).concat(_$s, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), _$o = !0, n = {};
|
|
31224
31275
|
}
|
|
31225
31276
|
};
|
|
31226
31277
|
}(y, g)), ue(D, function() {
|
|
31227
31278
|
return ".".concat(D.styledComponentId);
|
|
31228
|
-
}), c &&
|
|
31279
|
+
}), c && oe(D, e, {
|
|
31229
31280
|
attrs: !0,
|
|
31230
31281
|
componentStyle: !0,
|
|
31231
31282
|
displayName: !0,
|
|
@@ -31238,7 +31289,7 @@ function it(e, o, s) {
|
|
|
31238
31289
|
function at(e, t) {
|
|
31239
31290
|
for(var n = [
|
|
31240
31291
|
e[0]
|
|
31241
|
-
], _$
|
|
31292
|
+
], _$o = 0, r = t.length; _$o < r; _$o += 1)n.push(t[_$o], e[_$o + 1]);
|
|
31242
31293
|
return n;
|
|
31243
31294
|
}
|
|
31244
31295
|
var ct = function ct(e) {
|
|
@@ -31247,27 +31298,27 @@ var ct = function ct(e) {
|
|
|
31247
31298
|
});
|
|
31248
31299
|
};
|
|
31249
31300
|
function lt$1(t) {
|
|
31250
|
-
for(var n = [], _$
|
|
31251
|
-
if (
|
|
31301
|
+
for(var n = [], _$o = 1; _$o < arguments.length; _$o++)n[_$o - 1] = arguments[_$o];
|
|
31302
|
+
if (re(t) || ce(t)) return ct(Xe(at(_$1, __spreadArray([
|
|
31252
31303
|
t
|
|
31253
31304
|
], n, !0))));
|
|
31254
|
-
var
|
|
31255
|
-
return 0 === n.length && 1 ===
|
|
31305
|
+
var r = t;
|
|
31306
|
+
return 0 === n.length && 1 === r.length && "string" == typeof r[0] ? Xe(r) : ct(Xe(at(r, n)));
|
|
31256
31307
|
}
|
|
31257
|
-
function ut(n,
|
|
31258
|
-
if (void 0 ===
|
|
31308
|
+
function ut(n, o, r) {
|
|
31309
|
+
if (void 0 === r && (r = C), !o) throw he(1, o);
|
|
31259
31310
|
var s = function s(t) {
|
|
31260
31311
|
for(var s = [], i = 1; i < arguments.length; i++)s[i - 1] = arguments[i];
|
|
31261
|
-
return n(
|
|
31312
|
+
return n(o, r, lt$1.apply(void 0, __spreadArray([
|
|
31262
31313
|
t
|
|
31263
31314
|
], s, !1)));
|
|
31264
31315
|
};
|
|
31265
31316
|
return s.attrs = function(e) {
|
|
31266
|
-
return ut(n,
|
|
31267
|
-
attrs: Array.prototype.concat(
|
|
31317
|
+
return ut(n, o, __assign(__assign({}, r), {
|
|
31318
|
+
attrs: Array.prototype.concat(r.attrs, e).filter(Boolean)
|
|
31268
31319
|
}));
|
|
31269
31320
|
}, s.withConfig = function(e) {
|
|
31270
|
-
return ut(n,
|
|
31321
|
+
return ut(n, o, __assign(__assign({}, r), e));
|
|
31271
31322
|
}, s;
|
|
31272
31323
|
}
|
|
31273
31324
|
var pt = function pt(e) {
|
|
@@ -46688,7 +46739,7 @@ var CityDistrict = function(param) {
|
|
|
46688
46739
|
};
|
|
46689
46740
|
return /*#__PURE__*/ jsxs("div", {
|
|
46690
46741
|
className: [
|
|
46691
|
-
"h-24
|
|
46742
|
+
"h-24 mx-0 sm:mx-4 w-full",
|
|
46692
46743
|
item === null || item === void 0 ? void 0 : item.className
|
|
46693
46744
|
].join(" "),
|
|
46694
46745
|
children: [
|
|
@@ -47209,119 +47260,138 @@ var City = function(param) {
|
|
|
47209
47260
|
})
|
|
47210
47261
|
}, item.name);
|
|
47211
47262
|
};
|
|
47212
|
-
|
|
47213
|
-
|
|
47214
|
-
|
|
47215
|
-
|
|
47216
|
-
|
|
47217
|
-
|
|
47218
|
-
|
|
47219
|
-
|
|
47220
|
-
|
|
47221
|
-
|
|
47222
|
-
|
|
47223
|
-
|
|
47224
|
-
|
|
47225
|
-
|
|
47226
|
-
|
|
47227
|
-
|
|
47228
|
-
|
|
47229
|
-
|
|
47230
|
-
|
|
47231
|
-
|
|
47232
|
-
|
|
47233
|
-
|
|
47234
|
-
|
|
47235
|
-
|
|
47236
|
-
|
|
47237
|
-
|
|
47238
|
-
|
|
47239
|
-
|
|
47240
|
-
|
|
47241
|
-
|
|
47242
|
-
|
|
47243
|
-
|
|
47244
|
-
|
|
47245
|
-
|
|
47246
|
-
|
|
47247
|
-
|
|
47248
|
-
|
|
47249
|
-
|
|
47250
|
-
|
|
47251
|
-
|
|
47252
|
-
|
|
47253
|
-
|
|
47254
|
-
|
|
47255
|
-
|
|
47256
|
-
|
|
47257
|
-
|
|
47258
|
-
|
|
47259
|
-
|
|
47260
|
-
|
|
47261
|
-
|
|
47262
|
-
|
|
47263
|
-
|
|
47264
|
-
|
|
47265
|
-
|
|
47266
|
-
|
|
47267
|
-
|
|
47268
|
-
|
|
47269
|
-
|
|
47270
|
-
|
|
47271
|
-
|
|
47272
|
-
|
|
47273
|
-
|
|
47274
|
-
|
|
47275
|
-
|
|
47276
|
-
|
|
47277
|
-
|
|
47278
|
-
|
|
47279
|
-
|
|
47280
|
-
|
|
47281
|
-
|
|
47282
|
-
|
|
47283
|
-
|
|
47284
|
-
|
|
47285
|
-
|
|
47286
|
-
|
|
47287
|
-
|
|
47288
|
-
|
|
47289
|
-
|
|
47290
|
-
|
|
47291
|
-
|
|
47292
|
-
|
|
47293
|
-
|
|
47294
|
-
|
|
47295
|
-
|
|
47296
|
-
|
|
47297
|
-
|
|
47298
|
-
|
|
47299
|
-
|
|
47300
|
-
|
|
47301
|
-
|
|
47302
|
-
|
|
47303
|
-
|
|
47304
|
-
|
|
47305
|
-
|
|
47306
|
-
|
|
47307
|
-
|
|
47308
|
-
|
|
47309
|
-
|
|
47310
|
-
|
|
47311
|
-
|
|
47312
|
-
|
|
47313
|
-
|
|
47314
|
-
|
|
47315
|
-
|
|
47316
|
-
|
|
47317
|
-
|
|
47318
|
-
|
|
47319
|
-
|
|
47320
|
-
|
|
47321
|
-
|
|
47322
|
-
|
|
47323
|
-
|
|
47324
|
-
|
|
47263
|
+
var CheckboxField = function(param) {
|
|
47264
|
+
var item = param.item;
|
|
47265
|
+
var _item_checkboxes, _item_checkboxes1, _item_validateOption;
|
|
47266
|
+
var _useFormContext = useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
|
|
47267
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
47268
|
+
className: [
|
|
47269
|
+
"w-full min-h-[6rem] h-fit",
|
|
47270
|
+
item === null || item === void 0 ? void 0 : item.className
|
|
47271
|
+
].join(" "),
|
|
47272
|
+
children: [
|
|
47273
|
+
/*#__PURE__*/ jsx(FieldLabel, {
|
|
47274
|
+
item: item
|
|
47275
|
+
}),
|
|
47276
|
+
(item === null || item === void 0 ? void 0 : (_item_checkboxes = item.checkboxes) === null || _item_checkboxes === void 0 ? void 0 : _item_checkboxes.length) ? /*#__PURE__*/ jsx("div", {
|
|
47277
|
+
className: [
|
|
47278
|
+
(item === null || item === void 0 ? void 0 : item.direction) === "horizontal" ? "flex gap-4" : ""
|
|
47279
|
+
].join(" "),
|
|
47280
|
+
children: item === null || item === void 0 ? void 0 : (_item_checkboxes1 = item.checkboxes) === null || _item_checkboxes1 === void 0 ? void 0 : _item_checkboxes1.map(function(checkbox, index) {
|
|
47281
|
+
var _checkbox_validateOption;
|
|
47282
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
47283
|
+
className: "flex items-center gap-1 my-2",
|
|
47284
|
+
children: [
|
|
47285
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
47286
|
+
name: checkbox === null || checkbox === void 0 ? void 0 : checkbox.name,
|
|
47287
|
+
control: control,
|
|
47288
|
+
rules: (checkbox === null || checkbox === void 0 ? void 0 : (_checkbox_validateOption = checkbox.validateOption) === null || _checkbox_validateOption === void 0 ? void 0 : _checkbox_validateOption.required) ? {
|
|
47289
|
+
required: checkbox === null || checkbox === void 0 ? void 0 : checkbox.errorText
|
|
47290
|
+
} : undefined,
|
|
47291
|
+
render: function(param) {
|
|
47292
|
+
var field = param.field;
|
|
47293
|
+
return /*#__PURE__*/ jsx(Checkbox, _object_spread_props$3(_object_spread$6({}, field, checkbox === null || checkbox === void 0 ? void 0 : checkbox.muiProps), {
|
|
47294
|
+
sx: {
|
|
47295
|
+
padding: 0
|
|
47296
|
+
}
|
|
47297
|
+
}));
|
|
47298
|
+
}
|
|
47299
|
+
}),
|
|
47300
|
+
/*#__PURE__*/ jsx("div", {
|
|
47301
|
+
className: checkbox === null || checkbox === void 0 ? void 0 : checkbox.checkboxLabelClass,
|
|
47302
|
+
children: checkbox === null || checkbox === void 0 ? void 0 : checkbox.checkboxLabel
|
|
47303
|
+
}),
|
|
47304
|
+
validateMsg(errors, checkbox) && /*#__PURE__*/ jsxs("div", {
|
|
47305
|
+
className: "pt-1 text-xs text-[#EF5533]",
|
|
47306
|
+
children: [
|
|
47307
|
+
"*",
|
|
47308
|
+
validateMsg(errors, checkbox)
|
|
47309
|
+
]
|
|
47310
|
+
})
|
|
47311
|
+
]
|
|
47312
|
+
}, index);
|
|
47313
|
+
})
|
|
47314
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
47315
|
+
className: "flex items-center gap-2",
|
|
47316
|
+
children: [
|
|
47317
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
47318
|
+
name: item === null || item === void 0 ? void 0 : item.name,
|
|
47319
|
+
control: control,
|
|
47320
|
+
rules: (item === null || item === void 0 ? void 0 : (_item_validateOption = item.validateOption) === null || _item_validateOption === void 0 ? void 0 : _item_validateOption.required) ? {
|
|
47321
|
+
required: item === null || item === void 0 ? void 0 : item.errorText
|
|
47322
|
+
} : undefined,
|
|
47323
|
+
render: function(param) {
|
|
47324
|
+
var field = param.field;
|
|
47325
|
+
return /*#__PURE__*/ jsx(Checkbox, _object_spread_props$3(_object_spread$6({}, field, item === null || item === void 0 ? void 0 : item.muiProps), {
|
|
47326
|
+
sx: {
|
|
47327
|
+
padding: 0
|
|
47328
|
+
}
|
|
47329
|
+
}));
|
|
47330
|
+
}
|
|
47331
|
+
}),
|
|
47332
|
+
/*#__PURE__*/ jsx("div", {
|
|
47333
|
+
className: item === null || item === void 0 ? void 0 : item.checkboxLabelClass,
|
|
47334
|
+
children: item === null || item === void 0 ? void 0 : item.checkboxLabel
|
|
47335
|
+
}),
|
|
47336
|
+
validateMsg(errors, item) && /*#__PURE__*/ jsxs("div", {
|
|
47337
|
+
className: "pt-1 text-xs text-[#EF5533]",
|
|
47338
|
+
children: [
|
|
47339
|
+
"*",
|
|
47340
|
+
validateMsg(errors, item)
|
|
47341
|
+
]
|
|
47342
|
+
})
|
|
47343
|
+
]
|
|
47344
|
+
})
|
|
47345
|
+
]
|
|
47346
|
+
});
|
|
47347
|
+
};
|
|
47348
|
+
var RadioField = function(param) {
|
|
47349
|
+
var item = param.item;
|
|
47350
|
+
var _item_validateOption;
|
|
47351
|
+
var _useFormContext = useFormContext(), control = _useFormContext.control, errors = _useFormContext.formState.errors;
|
|
47352
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
47353
|
+
className: [
|
|
47354
|
+
"w-full min-h-[6rem] h-fit",
|
|
47355
|
+
item === null || item === void 0 ? void 0 : item.className
|
|
47356
|
+
].join(" "),
|
|
47357
|
+
children: [
|
|
47358
|
+
(item === null || item === void 0 ? void 0 : item.label) && /*#__PURE__*/ jsx(FieldLabel, {
|
|
47359
|
+
item: item
|
|
47360
|
+
}),
|
|
47361
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
47362
|
+
name: item === null || item === void 0 ? void 0 : item.name,
|
|
47363
|
+
control: control,
|
|
47364
|
+
rules: (item === null || item === void 0 ? void 0 : (_item_validateOption = item.validateOption) === null || _item_validateOption === void 0 ? void 0 : _item_validateOption.required) ? {
|
|
47365
|
+
required: item === null || item === void 0 ? void 0 : item.errorText
|
|
47366
|
+
} : undefined,
|
|
47367
|
+
defaultValue: item === null || item === void 0 ? void 0 : item.defaultValue,
|
|
47368
|
+
render: function(param) {
|
|
47369
|
+
var field = param.field;
|
|
47370
|
+
var _item_radioOptions;
|
|
47371
|
+
return /*#__PURE__*/ jsx(RadioGroup, _object_spread_props$3(_object_spread$6({}, field), {
|
|
47372
|
+
row: (item === null || item === void 0 ? void 0 : item.direction) === "horizontal",
|
|
47373
|
+
"aria-labelledby": "".concat(item === null || item === void 0 ? void 0 : item.id, "-radio-group-label"),
|
|
47374
|
+
children: item === null || item === void 0 ? void 0 : (_item_radioOptions = item.radioOptions) === null || _item_radioOptions === void 0 ? void 0 : _item_radioOptions.map(function(option, index) {
|
|
47375
|
+
return /*#__PURE__*/ jsx(FormControlLabel, {
|
|
47376
|
+
value: option === null || option === void 0 ? void 0 : option.value,
|
|
47377
|
+
control: /*#__PURE__*/ jsx(Radio, _object_spread$6({}, item === null || item === void 0 ? void 0 : item.muiProps)),
|
|
47378
|
+
label: option === null || option === void 0 ? void 0 : option.label,
|
|
47379
|
+
disabled: (option === null || option === void 0 ? void 0 : option.disabled) || false
|
|
47380
|
+
}, index);
|
|
47381
|
+
})
|
|
47382
|
+
}));
|
|
47383
|
+
}
|
|
47384
|
+
}),
|
|
47385
|
+
validateMsg(errors, item) && /*#__PURE__*/ jsxs("div", {
|
|
47386
|
+
className: "pt-1 text-xs text-[#EF5533]",
|
|
47387
|
+
children: [
|
|
47388
|
+
"*",
|
|
47389
|
+
validateMsg(errors, item)
|
|
47390
|
+
]
|
|
47391
|
+
})
|
|
47392
|
+
]
|
|
47393
|
+
});
|
|
47394
|
+
};
|
|
47325
47395
|
var Textarea = function(param) {
|
|
47326
47396
|
var item = param.item;
|
|
47327
47397
|
var _useFormContext = useFormContext(), register = _useFormContext.register, errors = _useFormContext.formState.errors;
|
|
@@ -47418,11 +47488,11 @@ var Row = function(param) {
|
|
|
47418
47488
|
return /*#__PURE__*/ jsx(Time, _object_spread$6({}, baseConfig));
|
|
47419
47489
|
case "switch":
|
|
47420
47490
|
return /*#__PURE__*/ jsx(BaseSwitch, _object_spread$6({}, baseConfig));
|
|
47421
|
-
|
|
47422
|
-
|
|
47423
|
-
|
|
47424
|
-
|
|
47425
|
-
|
|
47491
|
+
case "checkbox":
|
|
47492
|
+
case "checkboxGroup":
|
|
47493
|
+
return /*#__PURE__*/ jsx(CheckboxField, _object_spread$6({}, baseConfig));
|
|
47494
|
+
case "radio":
|
|
47495
|
+
return /*#__PURE__*/ jsx(RadioField, _object_spread$6({}, baseConfig));
|
|
47426
47496
|
case "textarea":
|
|
47427
47497
|
return /*#__PURE__*/ jsx(Textarea, _object_spread$6({}, baseConfig));
|
|
47428
47498
|
case "cityOnly":
|
|
@@ -47443,10 +47513,13 @@ var Form = {
|
|
|
47443
47513
|
SingleSelect: SingleSelect,
|
|
47444
47514
|
MultipleSelect: MultipleSelect,
|
|
47445
47515
|
FieldLabel: FieldLabel,
|
|
47516
|
+
RadioField: RadioField,
|
|
47446
47517
|
Time: Time,
|
|
47447
47518
|
Textarea: Textarea,
|
|
47448
47519
|
City: City,
|
|
47449
|
-
CityDistrict: CityDistrict
|
|
47520
|
+
CityDistrict: CityDistrict,
|
|
47521
|
+
CheckboxField: CheckboxField,
|
|
47522
|
+
BaseCkeditor: BaseCkeditor
|
|
47450
47523
|
};
|
|
47451
47524
|
|
|
47452
47525
|
function _define_property$5(obj, key, value) {
|