@nutui/nutui-react-taro 2.0.0-alpha.16 → 2.0.0-alpha.17
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/CHANGELOG.md +12 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/ActionSheet.js +2 -2
- package/dist/esm/Address.js +2 -2
- package/dist/esm/Avatar.js +2 -2
- package/dist/esm/Calendar.js +2 -2
- package/dist/esm/Cascader.js +2 -2
- package/dist/esm/DatePicker.js +3 -3
- package/dist/esm/Divider/style/style.css +1 -1
- package/dist/esm/Form/style/index.js +3 -1
- package/dist/esm/Form/style/style.css +1 -1
- package/dist/esm/Form.js +4 -4
- package/dist/esm/FormItem/style/index.js +1 -1
- package/dist/esm/FormItem/style/style.css +1 -1
- package/dist/esm/FormItem.js +1 -1
- package/dist/esm/ImagePreview.js +2 -2
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/NumberKeyboard.js +2 -2
- package/dist/esm/Pagination/style/style.css +1 -1
- package/dist/esm/Picker.js +2 -2
- package/dist/esm/Popover.js +3 -3
- package/dist/esm/Popup.js +1 -1
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword.js +2 -2
- package/dist/esm/SideNavBar.js +2 -2
- package/dist/esm/Skeleton.js +3 -3
- package/dist/esm/Swipe.js +2 -3
- package/dist/esm/TimeSelect.js +2 -2
- package/dist/esm/{actionsheet.taro-697a594b.js → actionsheet.taro-8e7cbd0f.js} +1 -1
- package/dist/esm/{address.taro-cc879a1d.js → address.taro-3cfe1767.js} +1 -1
- package/dist/esm/{calendar.taro-02195ddb.js → calendar.taro-3568a214.js} +1 -1
- package/dist/esm/{cascader.taro-fb7a0230.js → cascader.taro-91cf3ca6.js} +1 -1
- package/dist/esm/{datepicker.taro-b480d072.js → datepicker.taro-108eb7c8.js} +1 -1
- package/dist/esm/form.taro-a348734b.js +1274 -0
- package/dist/esm/formitem.taro-c9ded1ef.js +139 -0
- package/dist/esm/{imagepreview.taro-cfe0a4cc.js → imagepreview.taro-29717406.js} +1 -1
- package/dist/esm/{inputnumber.taro-6657d2c1.js → inputnumber.taro-788b1cd3.js} +5 -5
- package/dist/esm/{numberkeyboard.taro-18879f04.js → numberkeyboard.taro-ee984036.js} +1 -1
- package/dist/esm/nutui-react.es.js +20 -20
- package/dist/esm/{picker.taro-3781a455.js → picker.taro-9ca039c4.js} +54 -27
- package/dist/esm/{popover.taro-ba6c323a.js → popover.taro-52c02926.js} +12 -12
- package/dist/esm/{popup.taro-e756f3fc.js → popup.taro-687437a0.js} +1 -0
- package/dist/esm/{searchbar.taro-39351331.js → searchbar.taro-b2d6eff2.js} +2 -2
- package/dist/esm/{shortpassword.taro-cff61e4e.js → shortpassword.taro-4f714afb.js} +1 -1
- package/dist/esm/{sidenavbar.taro-1aefdd3c.js → sidenavbar.taro-03fb1fc6.js} +1 -1
- package/dist/esm/{skeleton.taro-ce714b06.js → skeleton.taro-e29f9f0c.js} +1 -1
- package/dist/esm/{swipe.taro-966af6d3.js → swipe.taro-4eb0cc9a.js} +6 -5
- package/dist/esm/{timeselect.taro-9e37e648.js → timeselect.taro-9de6ab39.js} +1 -1
- package/dist/esm/types/src/packages/button/button.d.ts +1 -0
- package/dist/esm/types/src/packages/elevator/elevator.d.ts +0 -1
- package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/form/__tests__/form.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/form/context.d.ts +4 -0
- package/dist/esm/types/src/packages/form/form.d.ts +11 -4
- package/dist/esm/types/src/packages/form/form.taro.d.ts +14 -4
- package/dist/esm/types/src/packages/form/index.d.ts +1 -0
- package/dist/esm/types/src/packages/form/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/form/types.d.ts +4 -52
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +16 -15
- package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +16 -12
- package/dist/esm/types/src/packages/formitem/index.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/types.d.ts +1 -31
- package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +1 -1
- package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +7 -2
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +7 -2
- package/dist/esm/types/src/packages/sticky/sticky.d.ts +0 -1
- package/dist/esm/types/src/packages/swipe/swipe.d.ts +2 -6
- package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/esm/types/src/utils/is-forward-ref-component.d.ts +1 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +1662 -496
- package/dist/nutui.react.umd.js +1646 -480
- package/dist/packages/actionsheet/actionsheet.scss +6 -6
- package/dist/packages/divider/divider.scss +8 -7
- package/dist/packages/formitem/formitem.scss +1 -13
- package/dist/packages/layout/layout.scss +0 -2
- package/dist/packages/pagination/pagination.scss +8 -30
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/animate/animate.taro.d.ts +3 -3
- package/dist/types/packages/audio/audio.taro.d.ts +28 -8
- package/dist/types/packages/avatar/avatar.taro.d.ts +4 -4
- package/dist/types/packages/avatargroup/avatargroup.taro.d.ts +5 -5
- package/dist/types/packages/button/button.taro.d.ts +4 -4
- package/dist/types/packages/cascader/cascader.taro.d.ts +4 -4
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -3
- package/dist/types/packages/datepicker/datepicker.taro.d.ts +75 -15
- package/dist/types/packages/divider/divider.taro.d.ts +2 -2
- package/dist/types/packages/drag/drag.taro.d.ts +1 -1
- package/dist/types/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/types/packages/empty/empty.taro.d.ts +3 -3
- package/dist/types/packages/fixednav/fixednav.taro.d.ts +3 -3
- package/dist/types/packages/form/context.d.ts +3 -0
- package/dist/types/packages/form/form.taro.d.ts +46 -4
- package/dist/types/packages/form/index.taro.d.ts +1 -0
- package/dist/types/packages/form/types.d.ts +4 -52
- package/dist/types/packages/formitem/formitem.taro.d.ts +45 -13
- package/dist/types/packages/formitem/index.taro.d.ts +1 -0
- package/dist/types/packages/formitem/types.d.ts +1 -31
- package/dist/types/packages/grid/grid.taro.d.ts +1 -1
- package/dist/types/packages/infiniteloading/infiniteloading.taro.d.ts +1 -1
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/types/packages/noticebar/noticebar.taro.d.ts +3 -3
- package/dist/types/packages/overlay/overlay.taro.d.ts +1 -1
- package/dist/types/packages/picker/picker.d.ts +7 -2
- package/dist/types/packages/picker/picker.taro.d.ts +7 -2
- package/dist/types/packages/popover/popover.taro.d.ts +5 -5
- package/dist/types/packages/popup/popup.taro.d.ts +2 -2
- package/dist/types/packages/radio/radio.taro.d.ts +2 -2
- package/dist/types/packages/range/range.taro.d.ts +3 -3
- package/dist/types/packages/searchbar/searchbar.taro.d.ts +5 -5
- package/dist/types/packages/step/step.taro.d.ts +3 -3
- package/dist/types/packages/steps/steps.taro.d.ts +1 -1
- package/dist/types/packages/sticky/sticky.taro.d.ts +1 -1
- package/dist/types/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/types/packages/swiper/swiper.taro.d.ts +1 -1
- package/dist/types/packages/tabs/tabs.taro.d.ts +1 -1
- package/dist/types/packages/tag/tag.taro.d.ts +1 -1
- package/dist/types/packages/timeselect/timeselect.taro.d.ts +2 -2
- package/dist/types/packages/toast/toast.taro.d.ts +4 -4
- package/dist/types/packages/uploader/uploader.taro.d.ts +18 -18
- package/dist/types/utils/is-forward-ref-component.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/form.taro-b06754e8.js +0 -182
- package/dist/esm/formitem.taro-b326809d.js +0 -108
- package/dist/esm/types/src/packages/formitem/formitemcontext.d.ts +0 -6
- package/dist/types/packages/formitem/formitemcontext.d.ts +0 -5
- package/dist/esm/{avatar.taro-8a26cd6c.js → avatar.taro-9ab097d0.js} +1 -1
- /package/dist/esm/types/src/packages/form/{useForm.d.ts → useform.d.ts} +0 -0
- /package/dist/esm/types/src/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
- /package/dist/types/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
package/dist/nutui.react.es.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
/*!
|
|
8
|
-
* @nutui/nutui-react-taro v2.0.0-alpha.
|
|
8
|
+
* @nutui/nutui-react-taro v2.0.0-alpha.17 Wed Jun 14 2023 16:32:58 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
@@ -1883,7 +1883,7 @@ const Button = React.forwardRef(
|
|
|
1883
1883
|
fill,
|
|
1884
1884
|
loading,
|
|
1885
1885
|
disabled,
|
|
1886
|
-
type,
|
|
1886
|
+
type: type4,
|
|
1887
1887
|
size,
|
|
1888
1888
|
block,
|
|
1889
1889
|
icon,
|
|
@@ -1929,7 +1929,7 @@ const Button = React.forwardRef(
|
|
|
1929
1929
|
className: classNames(
|
|
1930
1930
|
prefixCls,
|
|
1931
1931
|
className,
|
|
1932
|
-
props.type ? `${prefixCls}--${
|
|
1932
|
+
props.type ? `${prefixCls}--${type4}` : null,
|
|
1933
1933
|
props.fill ? `${prefixCls}--${fill}` : null,
|
|
1934
1934
|
{
|
|
1935
1935
|
[`${prefixCls}--${size}`]: size,
|
|
@@ -2243,30 +2243,30 @@ var deburredLetters = {
|
|
|
2243
2243
|
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
2244
2244
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
2245
2245
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
2246
|
-
function arrayReduce(
|
|
2247
|
-
var index = -1, length =
|
|
2246
|
+
function arrayReduce(array4, iteratee, accumulator, initAccum) {
|
|
2247
|
+
var index = -1, length = array4 ? array4.length : 0;
|
|
2248
2248
|
if (initAccum && length) {
|
|
2249
|
-
accumulator =
|
|
2249
|
+
accumulator = array4[++index];
|
|
2250
2250
|
}
|
|
2251
2251
|
while (++index < length) {
|
|
2252
|
-
accumulator = iteratee(accumulator,
|
|
2252
|
+
accumulator = iteratee(accumulator, array4[index], index, array4);
|
|
2253
2253
|
}
|
|
2254
2254
|
return accumulator;
|
|
2255
2255
|
}
|
|
2256
|
-
function asciiWords(
|
|
2257
|
-
return
|
|
2256
|
+
function asciiWords(string3) {
|
|
2257
|
+
return string3.match(reAsciiWord) || [];
|
|
2258
2258
|
}
|
|
2259
|
-
function basePropertyOf(
|
|
2259
|
+
function basePropertyOf(object4) {
|
|
2260
2260
|
return function(key) {
|
|
2261
|
-
return
|
|
2261
|
+
return object4 == null ? void 0 : object4[key];
|
|
2262
2262
|
};
|
|
2263
2263
|
}
|
|
2264
2264
|
var deburrLetter = basePropertyOf(deburredLetters);
|
|
2265
|
-
function hasUnicodeWord(
|
|
2266
|
-
return reHasUnicodeWord.test(
|
|
2265
|
+
function hasUnicodeWord(string3) {
|
|
2266
|
+
return reHasUnicodeWord.test(string3);
|
|
2267
2267
|
}
|
|
2268
|
-
function unicodeWords(
|
|
2269
|
-
return
|
|
2268
|
+
function unicodeWords(string3) {
|
|
2269
|
+
return string3.match(reUnicodeWord) || [];
|
|
2270
2270
|
}
|
|
2271
2271
|
var objectProto = Object.prototype;
|
|
2272
2272
|
var objectToString = objectProto.toString;
|
|
@@ -2283,8 +2283,8 @@ function baseToString(value) {
|
|
|
2283
2283
|
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
2284
2284
|
}
|
|
2285
2285
|
function createCompounder(callback) {
|
|
2286
|
-
return function(
|
|
2287
|
-
return arrayReduce(words(deburr(
|
|
2286
|
+
return function(string3) {
|
|
2287
|
+
return arrayReduce(words(deburr(string3).replace(reApos, "")), callback, "");
|
|
2288
2288
|
};
|
|
2289
2289
|
}
|
|
2290
2290
|
function isObjectLike(value) {
|
|
@@ -2296,20 +2296,20 @@ function isSymbol(value) {
|
|
|
2296
2296
|
function toString(value) {
|
|
2297
2297
|
return value == null ? "" : baseToString(value);
|
|
2298
2298
|
}
|
|
2299
|
-
function deburr(
|
|
2300
|
-
|
|
2301
|
-
return
|
|
2299
|
+
function deburr(string3) {
|
|
2300
|
+
string3 = toString(string3);
|
|
2301
|
+
return string3 && string3.replace(reLatin, deburrLetter).replace(reComboMark, "");
|
|
2302
2302
|
}
|
|
2303
2303
|
var kebabCase = createCompounder(function(result, word, index) {
|
|
2304
2304
|
return result + (index ? "-" : "") + word.toLowerCase();
|
|
2305
2305
|
});
|
|
2306
|
-
function words(
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
if (
|
|
2310
|
-
return hasUnicodeWord(
|
|
2306
|
+
function words(string3, pattern4, guard) {
|
|
2307
|
+
string3 = toString(string3);
|
|
2308
|
+
pattern4 = guard ? void 0 : pattern4;
|
|
2309
|
+
if (pattern4 === void 0) {
|
|
2310
|
+
return hasUnicodeWord(string3) ? unicodeWords(string3) : asciiWords(string3);
|
|
2311
2311
|
}
|
|
2312
|
-
return
|
|
2312
|
+
return string3.match(pattern4) || [];
|
|
2313
2313
|
}
|
|
2314
2314
|
var lodash_kebabcase = kebabCase;
|
|
2315
2315
|
const zhCN = {
|
|
@@ -2905,7 +2905,7 @@ const Row = (props) => {
|
|
|
2905
2905
|
className,
|
|
2906
2906
|
style,
|
|
2907
2907
|
children,
|
|
2908
|
-
type,
|
|
2908
|
+
type: type4,
|
|
2909
2909
|
justify,
|
|
2910
2910
|
align,
|
|
2911
2911
|
wrap,
|
|
@@ -2915,14 +2915,14 @@ const Row = (props) => {
|
|
|
2915
2915
|
...defaultProps$1j,
|
|
2916
2916
|
...props
|
|
2917
2917
|
};
|
|
2918
|
-
const getClass = (prefix,
|
|
2919
|
-
const classType =
|
|
2920
|
-
const className2 = prefix ? classType : `nut-row-${
|
|
2918
|
+
const getClass = (prefix, type22) => {
|
|
2919
|
+
const classType = type22 ? `nut-row-${prefix}-${type22}` : "";
|
|
2920
|
+
const className2 = prefix ? classType : `nut-row-${type22}`;
|
|
2921
2921
|
return className2;
|
|
2922
2922
|
};
|
|
2923
2923
|
const getClasses = () => {
|
|
2924
2924
|
return `
|
|
2925
|
-
${getClass("",
|
|
2925
|
+
${getClass("", type4)}
|
|
2926
2926
|
${getClass("justify", justify)}
|
|
2927
2927
|
${getClass("align", align)}
|
|
2928
2928
|
${getClass("flex", wrap)}
|
|
@@ -3464,7 +3464,7 @@ const FixedNav = (props) => {
|
|
|
3464
3464
|
position,
|
|
3465
3465
|
onChange,
|
|
3466
3466
|
onSelect,
|
|
3467
|
-
type,
|
|
3467
|
+
type: type4,
|
|
3468
3468
|
children,
|
|
3469
3469
|
style,
|
|
3470
3470
|
content,
|
|
@@ -3478,7 +3478,7 @@ const FixedNav = (props) => {
|
|
|
3478
3478
|
{
|
|
3479
3479
|
active: visible
|
|
3480
3480
|
},
|
|
3481
|
-
|
|
3481
|
+
type4,
|
|
3482
3482
|
className,
|
|
3483
3483
|
classPrefix2
|
|
3484
3484
|
);
|
|
@@ -3586,8 +3586,8 @@ const NavBar = (props) => {
|
|
|
3586
3586
|
};
|
|
3587
3587
|
NavBar.defaultProps = defaultProps$1e;
|
|
3588
3588
|
NavBar.displayName = "NutNavBar";
|
|
3589
|
-
function _extends() {
|
|
3590
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
3589
|
+
function _extends$1() {
|
|
3590
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function(target) {
|
|
3591
3591
|
for (var i = 1; i < arguments.length; i++) {
|
|
3592
3592
|
var source = arguments[i];
|
|
3593
3593
|
for (var key in source) {
|
|
@@ -3598,7 +3598,7 @@ function _extends() {
|
|
|
3598
3598
|
}
|
|
3599
3599
|
return target;
|
|
3600
3600
|
};
|
|
3601
|
-
return _extends.apply(this, arguments);
|
|
3601
|
+
return _extends$1.apply(this, arguments);
|
|
3602
3602
|
}
|
|
3603
3603
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3604
3604
|
if (source == null)
|
|
@@ -3614,17 +3614,17 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
3614
3614
|
}
|
|
3615
3615
|
return target;
|
|
3616
3616
|
}
|
|
3617
|
-
function _setPrototypeOf(o, p) {
|
|
3618
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
3617
|
+
function _setPrototypeOf$1(o, p) {
|
|
3618
|
+
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
3619
3619
|
o2.__proto__ = p2;
|
|
3620
3620
|
return o2;
|
|
3621
3621
|
};
|
|
3622
|
-
return _setPrototypeOf(o, p);
|
|
3622
|
+
return _setPrototypeOf$1(o, p);
|
|
3623
3623
|
}
|
|
3624
|
-
function _inheritsLoose(subClass, superClass) {
|
|
3624
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
3625
3625
|
subClass.prototype = Object.create(superClass.prototype);
|
|
3626
3626
|
subClass.prototype.constructor = subClass;
|
|
3627
|
-
_setPrototypeOf(subClass, superClass);
|
|
3627
|
+
_setPrototypeOf$1(subClass, superClass);
|
|
3628
3628
|
}
|
|
3629
3629
|
var propTypesExports = {};
|
|
3630
3630
|
var propTypes = {
|
|
@@ -3783,26 +3783,26 @@ function requireReactIs_development() {
|
|
|
3783
3783
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
3784
3784
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
3785
3785
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
3786
|
-
function isValidElementType(
|
|
3787
|
-
return typeof
|
|
3788
|
-
|
|
3786
|
+
function isValidElementType(type4) {
|
|
3787
|
+
return typeof type4 === "string" || typeof type4 === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
3788
|
+
type4 === REACT_FRAGMENT_TYPE || type4 === REACT_CONCURRENT_MODE_TYPE || type4 === REACT_PROFILER_TYPE || type4 === REACT_STRICT_MODE_TYPE || type4 === REACT_SUSPENSE_TYPE || type4 === REACT_SUSPENSE_LIST_TYPE || typeof type4 === "object" && type4 !== null && (type4.$$typeof === REACT_LAZY_TYPE || type4.$$typeof === REACT_MEMO_TYPE || type4.$$typeof === REACT_PROVIDER_TYPE || type4.$$typeof === REACT_CONTEXT_TYPE || type4.$$typeof === REACT_FORWARD_REF_TYPE || type4.$$typeof === REACT_FUNDAMENTAL_TYPE || type4.$$typeof === REACT_RESPONDER_TYPE || type4.$$typeof === REACT_SCOPE_TYPE || type4.$$typeof === REACT_BLOCK_TYPE);
|
|
3789
3789
|
}
|
|
3790
|
-
function typeOf(
|
|
3791
|
-
if (typeof
|
|
3792
|
-
var $$typeof =
|
|
3790
|
+
function typeOf(object4) {
|
|
3791
|
+
if (typeof object4 === "object" && object4 !== null) {
|
|
3792
|
+
var $$typeof = object4.$$typeof;
|
|
3793
3793
|
switch ($$typeof) {
|
|
3794
3794
|
case REACT_ELEMENT_TYPE:
|
|
3795
|
-
var
|
|
3796
|
-
switch (
|
|
3795
|
+
var type4 = object4.type;
|
|
3796
|
+
switch (type4) {
|
|
3797
3797
|
case REACT_ASYNC_MODE_TYPE:
|
|
3798
3798
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
3799
3799
|
case REACT_FRAGMENT_TYPE:
|
|
3800
3800
|
case REACT_PROFILER_TYPE:
|
|
3801
3801
|
case REACT_STRICT_MODE_TYPE:
|
|
3802
3802
|
case REACT_SUSPENSE_TYPE:
|
|
3803
|
-
return
|
|
3803
|
+
return type4;
|
|
3804
3804
|
default:
|
|
3805
|
-
var $$typeofType =
|
|
3805
|
+
var $$typeofType = type4 && type4.$$typeof;
|
|
3806
3806
|
switch ($$typeofType) {
|
|
3807
3807
|
case REACT_CONTEXT_TYPE:
|
|
3808
3808
|
case REACT_FORWARD_REF_TYPE:
|
|
@@ -3834,50 +3834,50 @@ function requireReactIs_development() {
|
|
|
3834
3834
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
3835
3835
|
var Suspense = REACT_SUSPENSE_TYPE;
|
|
3836
3836
|
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
3837
|
-
function isAsyncMode(
|
|
3837
|
+
function isAsyncMode(object4) {
|
|
3838
3838
|
{
|
|
3839
3839
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
3840
3840
|
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
3841
3841
|
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
3842
3842
|
}
|
|
3843
3843
|
}
|
|
3844
|
-
return isConcurrentMode(
|
|
3844
|
+
return isConcurrentMode(object4) || typeOf(object4) === REACT_ASYNC_MODE_TYPE;
|
|
3845
3845
|
}
|
|
3846
|
-
function isConcurrentMode(
|
|
3847
|
-
return typeOf(
|
|
3846
|
+
function isConcurrentMode(object4) {
|
|
3847
|
+
return typeOf(object4) === REACT_CONCURRENT_MODE_TYPE;
|
|
3848
3848
|
}
|
|
3849
|
-
function isContextConsumer(
|
|
3850
|
-
return typeOf(
|
|
3849
|
+
function isContextConsumer(object4) {
|
|
3850
|
+
return typeOf(object4) === REACT_CONTEXT_TYPE;
|
|
3851
3851
|
}
|
|
3852
|
-
function isContextProvider(
|
|
3853
|
-
return typeOf(
|
|
3852
|
+
function isContextProvider(object4) {
|
|
3853
|
+
return typeOf(object4) === REACT_PROVIDER_TYPE;
|
|
3854
3854
|
}
|
|
3855
|
-
function isElement2(
|
|
3856
|
-
return typeof
|
|
3855
|
+
function isElement2(object4) {
|
|
3856
|
+
return typeof object4 === "object" && object4 !== null && object4.$$typeof === REACT_ELEMENT_TYPE;
|
|
3857
3857
|
}
|
|
3858
|
-
function isForwardRef(
|
|
3859
|
-
return typeOf(
|
|
3858
|
+
function isForwardRef(object4) {
|
|
3859
|
+
return typeOf(object4) === REACT_FORWARD_REF_TYPE;
|
|
3860
3860
|
}
|
|
3861
|
-
function isFragment(
|
|
3862
|
-
return typeOf(
|
|
3861
|
+
function isFragment(object4) {
|
|
3862
|
+
return typeOf(object4) === REACT_FRAGMENT_TYPE;
|
|
3863
3863
|
}
|
|
3864
|
-
function isLazy(
|
|
3865
|
-
return typeOf(
|
|
3864
|
+
function isLazy(object4) {
|
|
3865
|
+
return typeOf(object4) === REACT_LAZY_TYPE;
|
|
3866
3866
|
}
|
|
3867
|
-
function isMemo(
|
|
3868
|
-
return typeOf(
|
|
3867
|
+
function isMemo(object4) {
|
|
3868
|
+
return typeOf(object4) === REACT_MEMO_TYPE;
|
|
3869
3869
|
}
|
|
3870
|
-
function isPortal(
|
|
3871
|
-
return typeOf(
|
|
3870
|
+
function isPortal(object4) {
|
|
3871
|
+
return typeOf(object4) === REACT_PORTAL_TYPE;
|
|
3872
3872
|
}
|
|
3873
|
-
function isProfiler(
|
|
3874
|
-
return typeOf(
|
|
3873
|
+
function isProfiler(object4) {
|
|
3874
|
+
return typeOf(object4) === REACT_PROFILER_TYPE;
|
|
3875
3875
|
}
|
|
3876
|
-
function isStrictMode(
|
|
3877
|
-
return typeOf(
|
|
3876
|
+
function isStrictMode(object4) {
|
|
3877
|
+
return typeOf(object4) === REACT_STRICT_MODE_TYPE;
|
|
3878
3878
|
}
|
|
3879
|
-
function isSuspense(
|
|
3880
|
-
return typeOf(
|
|
3879
|
+
function isSuspense(object4) {
|
|
3880
|
+
return typeOf(object4) === REACT_SUSPENSE_TYPE;
|
|
3881
3881
|
}
|
|
3882
3882
|
reactIs_development.AsyncMode = AsyncMode;
|
|
3883
3883
|
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
@@ -4291,8 +4291,8 @@ function requireFactoryWithTypeCheckers() {
|
|
|
4291
4291
|
}
|
|
4292
4292
|
}
|
|
4293
4293
|
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
4294
|
-
var
|
|
4295
|
-
if (
|
|
4294
|
+
var type4 = getPreciseType(value);
|
|
4295
|
+
if (type4 === "symbol") {
|
|
4296
4296
|
return String(value);
|
|
4297
4297
|
}
|
|
4298
4298
|
return value;
|
|
@@ -4363,9 +4363,9 @@ function requireFactoryWithTypeCheckers() {
|
|
|
4363
4363
|
}
|
|
4364
4364
|
return createChainableTypeChecker(validate);
|
|
4365
4365
|
}
|
|
4366
|
-
function invalidValidatorError(componentName, location, propFullName, key,
|
|
4366
|
+
function invalidValidatorError(componentName, location, propFullName, key, type4) {
|
|
4367
4367
|
return new PropTypeError(
|
|
4368
|
-
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" +
|
|
4368
|
+
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type4 + "`."
|
|
4369
4369
|
);
|
|
4370
4370
|
}
|
|
4371
4371
|
function createShapeTypeChecker(shapeTypes) {
|
|
@@ -4502,17 +4502,17 @@ function requireFactoryWithTypeCheckers() {
|
|
|
4502
4502
|
return propType;
|
|
4503
4503
|
}
|
|
4504
4504
|
function getPostfixForTypeWarning(value) {
|
|
4505
|
-
var
|
|
4506
|
-
switch (
|
|
4505
|
+
var type4 = getPreciseType(value);
|
|
4506
|
+
switch (type4) {
|
|
4507
4507
|
case "array":
|
|
4508
4508
|
case "object":
|
|
4509
|
-
return "an " +
|
|
4509
|
+
return "an " + type4;
|
|
4510
4510
|
case "boolean":
|
|
4511
4511
|
case "date":
|
|
4512
4512
|
case "regexp":
|
|
4513
|
-
return "a " +
|
|
4513
|
+
return "a " + type4;
|
|
4514
4514
|
default:
|
|
4515
|
-
return
|
|
4515
|
+
return type4;
|
|
4516
4516
|
}
|
|
4517
4517
|
}
|
|
4518
4518
|
function getClassName(propValue) {
|
|
@@ -4646,7 +4646,7 @@ var ENTERING = "entering";
|
|
|
4646
4646
|
var ENTERED = "entered";
|
|
4647
4647
|
var EXITING = "exiting";
|
|
4648
4648
|
var Transition = /* @__PURE__ */ function(_React$Component) {
|
|
4649
|
-
_inheritsLoose(Transition2, _React$Component);
|
|
4649
|
+
_inheritsLoose$1(Transition2, _React$Component);
|
|
4650
4650
|
function Transition2(props, context) {
|
|
4651
4651
|
var _this;
|
|
4652
4652
|
_this = _React$Component.call(this, props, context) || this;
|
|
@@ -5076,7 +5076,7 @@ var removeClass = function removeClass2(node, classes) {
|
|
|
5076
5076
|
});
|
|
5077
5077
|
};
|
|
5078
5078
|
var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
5079
|
-
_inheritsLoose(CSSTransition2, _React$Component);
|
|
5079
|
+
_inheritsLoose$1(CSSTransition2, _React$Component);
|
|
5080
5080
|
function CSSTransition2() {
|
|
5081
5081
|
var _this;
|
|
5082
5082
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -5098,17 +5098,17 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
5098
5098
|
};
|
|
5099
5099
|
_this.onEntering = function(maybeNode, maybeAppearing) {
|
|
5100
5100
|
var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument2[0], appearing = _this$resolveArgument2[1];
|
|
5101
|
-
var
|
|
5102
|
-
_this.addClass(node,
|
|
5101
|
+
var type4 = appearing ? "appear" : "enter";
|
|
5102
|
+
_this.addClass(node, type4, "active");
|
|
5103
5103
|
if (_this.props.onEntering) {
|
|
5104
5104
|
_this.props.onEntering(maybeNode, maybeAppearing);
|
|
5105
5105
|
}
|
|
5106
5106
|
};
|
|
5107
5107
|
_this.onEntered = function(maybeNode, maybeAppearing) {
|
|
5108
5108
|
var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument3[0], appearing = _this$resolveArgument3[1];
|
|
5109
|
-
var
|
|
5110
|
-
_this.removeClasses(node,
|
|
5111
|
-
_this.addClass(node,
|
|
5109
|
+
var type4 = appearing ? "appear" : "enter";
|
|
5110
|
+
_this.removeClasses(node, type4);
|
|
5111
|
+
_this.addClass(node, type4, "done");
|
|
5112
5112
|
if (_this.props.onEntered) {
|
|
5113
5113
|
_this.props.onEntered(maybeNode, maybeAppearing);
|
|
5114
5114
|
}
|
|
@@ -5140,13 +5140,13 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
5140
5140
|
_this.resolveArguments = function(maybeNode, maybeAppearing) {
|
|
5141
5141
|
return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] : [maybeNode, maybeAppearing];
|
|
5142
5142
|
};
|
|
5143
|
-
_this.getClassNames = function(
|
|
5143
|
+
_this.getClassNames = function(type4) {
|
|
5144
5144
|
var classNames2 = _this.props.classNames;
|
|
5145
5145
|
var isStringClassNames = typeof classNames2 === "string";
|
|
5146
5146
|
var prefix = isStringClassNames && classNames2 ? classNames2 + "-" : "";
|
|
5147
|
-
var baseClassName = isStringClassNames ? "" + prefix +
|
|
5148
|
-
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[
|
|
5149
|
-
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[
|
|
5147
|
+
var baseClassName = isStringClassNames ? "" + prefix + type4 : classNames2[type4];
|
|
5148
|
+
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[type4 + "Active"];
|
|
5149
|
+
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[type4 + "Done"];
|
|
5150
5150
|
return {
|
|
5151
5151
|
baseClassName,
|
|
5152
5152
|
activeClassName,
|
|
@@ -5156,10 +5156,10 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
5156
5156
|
return _this;
|
|
5157
5157
|
}
|
|
5158
5158
|
var _proto = CSSTransition2.prototype;
|
|
5159
|
-
_proto.addClass = function addClass2(node,
|
|
5160
|
-
var className = this.getClassNames(
|
|
5159
|
+
_proto.addClass = function addClass2(node, type4, phase) {
|
|
5160
|
+
var className = this.getClassNames(type4)[phase + "ClassName"];
|
|
5161
5161
|
var _this$getClassNames = this.getClassNames("enter"), doneClassName = _this$getClassNames.doneClassName;
|
|
5162
|
-
if (
|
|
5162
|
+
if (type4 === "appear" && phase === "done" && doneClassName) {
|
|
5163
5163
|
className += " " + doneClassName;
|
|
5164
5164
|
}
|
|
5165
5165
|
if (phase === "active") {
|
|
@@ -5167,13 +5167,13 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
5167
5167
|
forceReflow(node);
|
|
5168
5168
|
}
|
|
5169
5169
|
if (className) {
|
|
5170
|
-
this.appliedClasses[
|
|
5170
|
+
this.appliedClasses[type4][phase] = className;
|
|
5171
5171
|
_addClass(node, className);
|
|
5172
5172
|
}
|
|
5173
5173
|
};
|
|
5174
|
-
_proto.removeClasses = function removeClasses(node,
|
|
5175
|
-
var _this$appliedClasses$ = this.appliedClasses[
|
|
5176
|
-
this.appliedClasses[
|
|
5174
|
+
_proto.removeClasses = function removeClasses(node, type4) {
|
|
5175
|
+
var _this$appliedClasses$ = this.appliedClasses[type4], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done;
|
|
5176
|
+
this.appliedClasses[type4] = {};
|
|
5177
5177
|
if (baseClassName) {
|
|
5178
5178
|
removeClass(node, baseClassName);
|
|
5179
5179
|
}
|
|
@@ -5188,7 +5188,7 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
5188
5188
|
var _this$props = this.props;
|
|
5189
5189
|
_this$props.classNames;
|
|
5190
5190
|
var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
|
|
5191
|
-
return /* @__PURE__ */ React.createElement(Transition$1, _extends({}, props, {
|
|
5191
|
+
return /* @__PURE__ */ React.createElement(Transition$1, _extends$1({}, props, {
|
|
5192
5192
|
onEnter: this.onEnter,
|
|
5193
5193
|
onEntered: this.onEntered,
|
|
5194
5194
|
onEntering: this.onEntering,
|
|
@@ -5202,7 +5202,7 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
5202
5202
|
CSSTransition.defaultProps = {
|
|
5203
5203
|
classNames: ""
|
|
5204
5204
|
};
|
|
5205
|
-
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, Transition$1.propTypes, {
|
|
5205
|
+
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({}, Transition$1.propTypes, {
|
|
5206
5206
|
/**
|
|
5207
5207
|
* The animation classNames applied to the component as it appears, enters,
|
|
5208
5208
|
* exits or has finished the transition. A single name can be provided, which
|
|
@@ -5427,6 +5427,7 @@ const Popup = (props) => {
|
|
|
5427
5427
|
}
|
|
5428
5428
|
};
|
|
5429
5429
|
const onHandleClickOverlay = (e) => {
|
|
5430
|
+
e.stopPropagation();
|
|
5430
5431
|
if (closeOnOverlayClick) {
|
|
5431
5432
|
const closed = onClickOverlay && onClickOverlay(e);
|
|
5432
5433
|
closed && close();
|
|
@@ -6157,7 +6158,7 @@ const ExistRender = (props) => {
|
|
|
6157
6158
|
const { locale } = useConfig();
|
|
6158
6159
|
const {
|
|
6159
6160
|
children,
|
|
6160
|
-
type,
|
|
6161
|
+
type: type4,
|
|
6161
6162
|
existAddress,
|
|
6162
6163
|
selectedIcon,
|
|
6163
6164
|
defaultIcon,
|
|
@@ -6189,7 +6190,7 @@ const ExistRender = (props) => {
|
|
|
6189
6190
|
onSelected && onSelected(prevExistAdd, item, copyExistAdd);
|
|
6190
6191
|
};
|
|
6191
6192
|
const onSwitch = () => {
|
|
6192
|
-
onSwitchModule && onSwitchModule({ type:
|
|
6193
|
+
onSwitchModule && onSwitchModule({ type: type4 === "exist" ? "custom" : "exist" });
|
|
6193
6194
|
};
|
|
6194
6195
|
useEffect(() => {
|
|
6195
6196
|
}, [existAddress]);
|
|
@@ -6210,7 +6211,7 @@ const CustomRender = (props) => {
|
|
|
6210
6211
|
const { locale } = useConfig$1();
|
|
6211
6212
|
const {
|
|
6212
6213
|
children,
|
|
6213
|
-
type,
|
|
6214
|
+
type: type4,
|
|
6214
6215
|
modelValue,
|
|
6215
6216
|
height,
|
|
6216
6217
|
province,
|
|
@@ -6226,7 +6227,7 @@ const CustomRender = (props) => {
|
|
|
6226
6227
|
...props
|
|
6227
6228
|
};
|
|
6228
6229
|
const b2 = cn("address");
|
|
6229
|
-
const [privateType] = useState(
|
|
6230
|
+
const [privateType] = useState(type4);
|
|
6230
6231
|
const [tabIndex, setTabIndex] = useState(0);
|
|
6231
6232
|
const [tabName] = useState(["province", "city", "country", "town"]);
|
|
6232
6233
|
useRef(null);
|
|
@@ -6235,7 +6236,7 @@ const CustomRender = (props) => {
|
|
|
6235
6236
|
useRef(null);
|
|
6236
6237
|
const regionLine = useRef(null);
|
|
6237
6238
|
const isCustom2 = () => {
|
|
6238
|
-
return
|
|
6239
|
+
return type4 === "custom2";
|
|
6239
6240
|
};
|
|
6240
6241
|
const transformData = (data) => {
|
|
6241
6242
|
if (!Array.isArray(data))
|
|
@@ -6497,7 +6498,7 @@ const Address = (props) => {
|
|
|
6497
6498
|
modelValue,
|
|
6498
6499
|
modelSelect,
|
|
6499
6500
|
children,
|
|
6500
|
-
type,
|
|
6501
|
+
type: type4,
|
|
6501
6502
|
height,
|
|
6502
6503
|
customAddressTitle,
|
|
6503
6504
|
existAddress,
|
|
@@ -6526,7 +6527,7 @@ const Address = (props) => {
|
|
|
6526
6527
|
...props
|
|
6527
6528
|
};
|
|
6528
6529
|
const b2 = cn("address");
|
|
6529
|
-
const [privateType, setPrivateType] = useState(
|
|
6530
|
+
const [privateType, setPrivateType] = useState(type4);
|
|
6530
6531
|
const [tabName] = useState(["province", "city", "country", "town"]);
|
|
6531
6532
|
const [showPopup, setShowPopup] = useState(modelValue);
|
|
6532
6533
|
const [selectedRegion, setSelectedRegion] = useState({
|
|
@@ -6652,8 +6653,8 @@ const Address = (props) => {
|
|
|
6652
6653
|
onNextArea: (cal) => {
|
|
6653
6654
|
nextAreaList && nextAreaList(cal);
|
|
6654
6655
|
},
|
|
6655
|
-
onTabClick: (
|
|
6656
|
-
onTabChecked && onTabChecked(
|
|
6656
|
+
onTabClick: (type22) => {
|
|
6657
|
+
onTabChecked && onTabChecked(type22);
|
|
6657
6658
|
},
|
|
6658
6659
|
onClose: handClose
|
|
6659
6660
|
}
|
|
@@ -6689,8 +6690,8 @@ const Utils = {
|
|
|
6689
6690
|
* @return {String}
|
|
6690
6691
|
*/
|
|
6691
6692
|
getWhatDay(year, month, day) {
|
|
6692
|
-
const
|
|
6693
|
-
const index =
|
|
6693
|
+
const date4 = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
|
|
6694
|
+
const index = date4.getDay();
|
|
6694
6695
|
const dayNames = [
|
|
6695
6696
|
"星期日",
|
|
6696
6697
|
"星期一",
|
|
@@ -6707,8 +6708,8 @@ const Utils = {
|
|
|
6707
6708
|
* @return {Number}
|
|
6708
6709
|
*/
|
|
6709
6710
|
getMonthPreDay(year, month) {
|
|
6710
|
-
const
|
|
6711
|
-
let day =
|
|
6711
|
+
const date4 = /* @__PURE__ */ new Date(`${year}/${month}/01`);
|
|
6712
|
+
let day = date4.getDay();
|
|
6712
6713
|
if (day == 0) {
|
|
6713
6714
|
day = 7;
|
|
6714
6715
|
}
|
|
@@ -6750,11 +6751,11 @@ const Utils = {
|
|
|
6750
6751
|
* 日期对象转成字符串
|
|
6751
6752
|
* @return {string}
|
|
6752
6753
|
*/
|
|
6753
|
-
date2Str(
|
|
6754
|
+
date2Str(date4, split) {
|
|
6754
6755
|
split = split || "-";
|
|
6755
|
-
const y2 =
|
|
6756
|
-
const m = this.getNumTwoBit(
|
|
6757
|
-
const d = this.getNumTwoBit(
|
|
6756
|
+
const y2 = date4.getFullYear();
|
|
6757
|
+
const m = this.getNumTwoBit(date4.getMonth() + 1);
|
|
6758
|
+
const d = this.getNumTwoBit(date4.getDate());
|
|
6758
6759
|
return [y2, m, d].join(split);
|
|
6759
6760
|
},
|
|
6760
6761
|
/**
|
|
@@ -6764,18 +6765,18 @@ const Utils = {
|
|
|
6764
6765
|
*/
|
|
6765
6766
|
getDay(i) {
|
|
6766
6767
|
i = i || 0;
|
|
6767
|
-
let
|
|
6768
|
+
let date4 = /* @__PURE__ */ new Date();
|
|
6768
6769
|
const diff = i * (1e3 * 60 * 60 * 24);
|
|
6769
|
-
|
|
6770
|
-
return this.date2Str(
|
|
6770
|
+
date4 = new Date(date4.getTime() + diff);
|
|
6771
|
+
return this.date2Str(date4);
|
|
6771
6772
|
},
|
|
6772
6773
|
/**
|
|
6773
6774
|
* 时间比较
|
|
6774
6775
|
* @return {Boolean}
|
|
6775
6776
|
*/
|
|
6776
|
-
compareDate(date1,
|
|
6777
|
+
compareDate(date1, date22) {
|
|
6777
6778
|
const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
|
|
6778
|
-
const endTime = new Date(
|
|
6779
|
+
const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
|
|
6779
6780
|
if (startTime >= endTime) {
|
|
6780
6781
|
return false;
|
|
6781
6782
|
}
|
|
@@ -6785,9 +6786,9 @@ const Utils = {
|
|
|
6785
6786
|
* 时间是否相等
|
|
6786
6787
|
* @return {Boolean}
|
|
6787
6788
|
*/
|
|
6788
|
-
isEqual(date1,
|
|
6789
|
+
isEqual(date1, date22) {
|
|
6789
6790
|
const startTime = new Date(date1).getTime();
|
|
6790
|
-
const endTime = new Date(
|
|
6791
|
+
const endTime = new Date(date22).getTime();
|
|
6791
6792
|
if (startTime == endTime) {
|
|
6792
6793
|
return true;
|
|
6793
6794
|
}
|
|
@@ -6839,7 +6840,7 @@ const defaultProps$12 = {
|
|
|
6839
6840
|
const CalendarItem = React.forwardRef((props, ref) => {
|
|
6840
6841
|
const { locale } = useConfig$1();
|
|
6841
6842
|
const {
|
|
6842
|
-
type,
|
|
6843
|
+
type: type4,
|
|
6843
6844
|
isAutoBackFill,
|
|
6844
6845
|
poppable,
|
|
6845
6846
|
title,
|
|
@@ -6913,10 +6914,10 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
6913
6914
|
});
|
|
6914
6915
|
const monthitemclasses = classNames({
|
|
6915
6916
|
"calendar-month-item": true,
|
|
6916
|
-
[`${
|
|
6917
|
+
[`${type4 === "range" ? "month-item-range" : ""}`]: true
|
|
6917
6918
|
});
|
|
6918
|
-
const splitDate = (
|
|
6919
|
-
return
|
|
6919
|
+
const splitDate = (date4) => {
|
|
6920
|
+
return date4.split("-");
|
|
6920
6921
|
};
|
|
6921
6922
|
const isStart = (currDate) => {
|
|
6922
6923
|
return Utils.isEqual(state.currDate[0], currDate);
|
|
@@ -6940,13 +6941,13 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
6940
6941
|
const getClass = (day, month) => {
|
|
6941
6942
|
const currDate = getCurrDate(day, month);
|
|
6942
6943
|
if (day.type === "curr") {
|
|
6943
|
-
if (Utils.isEqual(state.currDate, currDate) ||
|
|
6944
|
+
if (Utils.isEqual(state.currDate, currDate) || type4 === "range" && (isStart(currDate) || isEnd(currDate)) || type4 === "multiple" && isMultiple(currDate)) {
|
|
6944
6945
|
return `${state.dayPrefix}-active`;
|
|
6945
6946
|
}
|
|
6946
6947
|
if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
6947
6948
|
return `${state.dayPrefix}-disabled`;
|
|
6948
6949
|
}
|
|
6949
|
-
if (
|
|
6950
|
+
if (type4 === "range" && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
|
|
6950
6951
|
return `${state.dayPrefix}-choose`;
|
|
6951
6952
|
}
|
|
6952
6953
|
return null;
|
|
@@ -6957,12 +6958,12 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
6957
6958
|
return state.isRange && day.type === "curr" && getClass(day, month) === "calendar-month-day-active";
|
|
6958
6959
|
};
|
|
6959
6960
|
const isCurrDay = (month, day) => {
|
|
6960
|
-
const
|
|
6961
|
-
return Utils.isEqual(
|
|
6961
|
+
const date4 = `${month.curData[0]}-${month.curData[1]}-${day}`;
|
|
6962
|
+
return Utils.isEqual(date4, Utils.date2Str(/* @__PURE__ */ new Date()));
|
|
6962
6963
|
};
|
|
6963
6964
|
const confirm = () => {
|
|
6964
|
-
const { type:
|
|
6965
|
-
if (
|
|
6965
|
+
const { type: type22 } = props;
|
|
6966
|
+
if (type22 === "range" && state.chooseData.length === 2 || type22 !== "range") {
|
|
6966
6967
|
const chooseData = state.chooseData.slice(0);
|
|
6967
6968
|
onChoose && onChoose(chooseData);
|
|
6968
6969
|
if (poppable) {
|
|
@@ -6972,12 +6973,12 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
6972
6973
|
};
|
|
6973
6974
|
const chooseDay = (day, month, isFirst) => {
|
|
6974
6975
|
if (getClass(day, month) !== `${state.dayPrefix}-disabled`) {
|
|
6975
|
-
const { type:
|
|
6976
|
+
const { type: type22 } = props;
|
|
6976
6977
|
const days = [...month.curData];
|
|
6977
6978
|
days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
6978
6979
|
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
6979
6980
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
6980
|
-
if (
|
|
6981
|
+
if (type22 === "multiple") {
|
|
6981
6982
|
if (state.currDate.length > 0) {
|
|
6982
6983
|
let hasIndex = "";
|
|
6983
6984
|
state.currDate.forEach((item, index) => {
|
|
@@ -6998,7 +6999,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
6998
6999
|
state.currDate = [days[3]];
|
|
6999
7000
|
state.chooseData = [[...days]];
|
|
7000
7001
|
}
|
|
7001
|
-
} else if (
|
|
7002
|
+
} else if (type22 === "range") {
|
|
7002
7003
|
const curDataLength = Object.values(state.currDate).length;
|
|
7003
7004
|
if (curDataLength === 2 || curDataLength === 0) {
|
|
7004
7005
|
state.currDate = [days[3]];
|
|
@@ -7042,11 +7043,11 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7042
7043
|
}
|
|
7043
7044
|
return false;
|
|
7044
7045
|
};
|
|
7045
|
-
const getCurrData = (
|
|
7046
|
-
const monthData =
|
|
7046
|
+
const getCurrData = (type22) => {
|
|
7047
|
+
const monthData = type22 === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
|
|
7047
7048
|
let year = parseInt(monthData.curData[0]);
|
|
7048
7049
|
let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
|
|
7049
|
-
switch (
|
|
7050
|
+
switch (type22) {
|
|
7050
7051
|
case "prev":
|
|
7051
7052
|
month === 1 && (year -= 1);
|
|
7052
7053
|
month = month === 1 ? 12 : --month;
|
|
@@ -7062,36 +7063,36 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7062
7063
|
Utils.getMonthDays(String(year), String(month))
|
|
7063
7064
|
];
|
|
7064
7065
|
};
|
|
7065
|
-
const getDaysStatus = (days,
|
|
7066
|
+
const getDaysStatus = (days, type22, dateInfo) => {
|
|
7066
7067
|
const { year, month } = dateInfo;
|
|
7067
|
-
if (
|
|
7068
|
+
if (type22 === "prev" && days >= 7) {
|
|
7068
7069
|
days -= 7;
|
|
7069
7070
|
}
|
|
7070
7071
|
return Array.from(Array(days), (v, k) => {
|
|
7071
7072
|
return {
|
|
7072
7073
|
day: k + 1,
|
|
7073
|
-
type:
|
|
7074
|
+
type: type22,
|
|
7074
7075
|
year,
|
|
7075
7076
|
month
|
|
7076
7077
|
};
|
|
7077
7078
|
});
|
|
7078
7079
|
};
|
|
7079
|
-
const getPreDaysStatus = (days,
|
|
7080
|
+
const getPreDaysStatus = (days, type22, dateInfo, preCurrMonthDays) => {
|
|
7080
7081
|
const { year, month } = dateInfo;
|
|
7081
|
-
if (
|
|
7082
|
+
if (type22 === "prev" && days >= 7) {
|
|
7082
7083
|
days -= 7;
|
|
7083
7084
|
}
|
|
7084
7085
|
const months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
|
|
7085
7086
|
return {
|
|
7086
7087
|
day: k + 1,
|
|
7087
|
-
type:
|
|
7088
|
+
type: type22,
|
|
7088
7089
|
year,
|
|
7089
7090
|
month
|
|
7090
7091
|
};
|
|
7091
7092
|
});
|
|
7092
7093
|
return months2.slice(preCurrMonthDays - days);
|
|
7093
7094
|
};
|
|
7094
|
-
const getMonth = (curData,
|
|
7095
|
+
const getMonth = (curData, type22) => {
|
|
7095
7096
|
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
7096
7097
|
let preMonth = +curData[1] - 1;
|
|
7097
7098
|
let preYear = curData[0];
|
|
@@ -7124,7 +7125,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7124
7125
|
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
7125
7126
|
}
|
|
7126
7127
|
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
7127
|
-
if (
|
|
7128
|
+
if (type22 === "next") {
|
|
7128
7129
|
if (!state.endData || !Utils.compareDate(
|
|
7129
7130
|
`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(
|
|
7130
7131
|
state.endData[0],
|
|
@@ -7238,7 +7239,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7238
7239
|
getMonth(getCurrData("next"), "next");
|
|
7239
7240
|
} while (i++ < monthsNum);
|
|
7240
7241
|
state.monthsNum = monthsNum;
|
|
7241
|
-
if (
|
|
7242
|
+
if (type4 === "range" && Array.isArray(state.currDate)) {
|
|
7242
7243
|
if (state.currDate.length > 0) {
|
|
7243
7244
|
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
7244
7245
|
state.currDate.splice(0, 1, propStartDate);
|
|
@@ -7307,7 +7308,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7307
7308
|
state.currentIndex = current;
|
|
7308
7309
|
setReachedYearMonthInfo();
|
|
7309
7310
|
if (state.defaultData.length > 0) {
|
|
7310
|
-
if (
|
|
7311
|
+
if (type4 === "range") {
|
|
7311
7312
|
chooseDay(
|
|
7312
7313
|
{ day: state.defaultData[2], type: "curr" },
|
|
7313
7314
|
state.monthsData[state.currentIndex],
|
|
@@ -7318,7 +7319,7 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7318
7319
|
state.monthsData[lastCurrent],
|
|
7319
7320
|
true
|
|
7320
7321
|
);
|
|
7321
|
-
} else if (
|
|
7322
|
+
} else if (type4 === "multiple") {
|
|
7322
7323
|
[...state.currDate].forEach((item) => {
|
|
7323
7324
|
const dateArr = splitDate(item);
|
|
7324
7325
|
let current2 = state.currentIndex;
|
|
@@ -7358,13 +7359,13 @@ const CalendarItem = React.forwardRef((props, ref) => {
|
|
|
7358
7359
|
state.monthsData.splice(0);
|
|
7359
7360
|
initData();
|
|
7360
7361
|
};
|
|
7361
|
-
const scrollToDate = (
|
|
7362
|
-
if (Utils.compareDate(
|
|
7363
|
-
|
|
7364
|
-
} else if (!Utils.compareDate(
|
|
7365
|
-
|
|
7362
|
+
const scrollToDate = (date4) => {
|
|
7363
|
+
if (Utils.compareDate(date4, state.propStartDate)) {
|
|
7364
|
+
date4 = state.propStartDate;
|
|
7365
|
+
} else if (!Utils.compareDate(date4, state.propEndDate)) {
|
|
7366
|
+
date4 = state.propEndDate;
|
|
7366
7367
|
}
|
|
7367
|
-
const dateArr = splitDate(
|
|
7368
|
+
const dateArr = splitDate(date4);
|
|
7368
7369
|
state.monthsData.forEach((item, index) => {
|
|
7369
7370
|
if (item.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
7370
7371
|
if (months.current) {
|
|
@@ -7487,7 +7488,7 @@ const Calendar = React.forwardRef((props, ref) => {
|
|
|
7487
7488
|
children,
|
|
7488
7489
|
poppable,
|
|
7489
7490
|
visible,
|
|
7490
|
-
type,
|
|
7491
|
+
type: type4,
|
|
7491
7492
|
isAutoBackFill,
|
|
7492
7493
|
title,
|
|
7493
7494
|
defaultValue,
|
|
@@ -7523,9 +7524,9 @@ const Calendar = React.forwardRef((props, ref) => {
|
|
|
7523
7524
|
const select = (param) => {
|
|
7524
7525
|
onSelected && onSelected(param);
|
|
7525
7526
|
};
|
|
7526
|
-
const scrollToDate = (
|
|
7527
|
+
const scrollToDate = (date4) => {
|
|
7527
7528
|
var _a;
|
|
7528
|
-
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(
|
|
7529
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date4);
|
|
7529
7530
|
};
|
|
7530
7531
|
const yearMonthChange = (param) => {
|
|
7531
7532
|
onYearMonthChange && onYearMonthChange(param);
|
|
@@ -7538,7 +7539,7 @@ const Calendar = React.forwardRef((props, ref) => {
|
|
|
7538
7539
|
CalendarItem,
|
|
7539
7540
|
{
|
|
7540
7541
|
ref: calendarRef,
|
|
7541
|
-
type,
|
|
7542
|
+
type: type4,
|
|
7542
7543
|
isAutoBackFill,
|
|
7543
7544
|
poppable,
|
|
7544
7545
|
title: title || locale.calendaritem.title,
|
|
@@ -7811,7 +7812,7 @@ const InternalCascader = (props, ref) => {
|
|
|
7811
7812
|
defaultValue,
|
|
7812
7813
|
title,
|
|
7813
7814
|
optionKey,
|
|
7814
|
-
format,
|
|
7815
|
+
format: format2,
|
|
7815
7816
|
closeable,
|
|
7816
7817
|
closeIconPosition,
|
|
7817
7818
|
closeIcon,
|
|
@@ -7851,7 +7852,7 @@ const InternalCascader = (props, ref) => {
|
|
|
7851
7852
|
lazy,
|
|
7852
7853
|
onLoad,
|
|
7853
7854
|
optionKey,
|
|
7854
|
-
format
|
|
7855
|
+
format: format2
|
|
7855
7856
|
},
|
|
7856
7857
|
lazyLoadMap: /* @__PURE__ */ new Map()
|
|
7857
7858
|
});
|
|
@@ -7861,7 +7862,7 @@ const InternalCascader = (props, ref) => {
|
|
|
7861
7862
|
});
|
|
7862
7863
|
useEffect(() => {
|
|
7863
7864
|
initData();
|
|
7864
|
-
}, [options,
|
|
7865
|
+
}, [options, format2]);
|
|
7865
7866
|
useEffect(() => {
|
|
7866
7867
|
if (defaultValue && defaultValue !== innerValue) {
|
|
7867
7868
|
setInnerValue(defaultValue);
|
|
@@ -7869,10 +7870,10 @@ const InternalCascader = (props, ref) => {
|
|
|
7869
7870
|
}, [defaultValue]);
|
|
7870
7871
|
const initData = async () => {
|
|
7871
7872
|
state.lazyLoadMap.clear();
|
|
7872
|
-
if (
|
|
7873
|
+
if (format2 && Object.keys(format2).length > 0) {
|
|
7873
7874
|
state.optionsData = convertListToOptions(
|
|
7874
7875
|
options,
|
|
7875
|
-
|
|
7876
|
+
format2
|
|
7876
7877
|
);
|
|
7877
7878
|
} else {
|
|
7878
7879
|
state.optionsData = options;
|
|
@@ -7978,15 +7979,15 @@ const InternalCascader = (props, ref) => {
|
|
|
7978
7979
|
const closePopup = () => {
|
|
7979
7980
|
close();
|
|
7980
7981
|
};
|
|
7981
|
-
const chooseItem = async (node,
|
|
7982
|
-
if (!
|
|
7982
|
+
const chooseItem = async (node, type4) => {
|
|
7983
|
+
if (!type4 && node.disabled || !state.panes[state.tabsCursor]) {
|
|
7983
7984
|
return;
|
|
7984
7985
|
}
|
|
7985
7986
|
if (state.tree.isLeaf(node, isLazy())) {
|
|
7986
7987
|
node.leaf = true;
|
|
7987
7988
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
7988
7989
|
state.panes = state.panes.slice(0, node.level + 1);
|
|
7989
|
-
if (!
|
|
7990
|
+
if (!type4) {
|
|
7990
7991
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
7991
7992
|
const optionParams = pathNodes.map((item) => item.value);
|
|
7992
7993
|
onChange(optionParams, pathNodes);
|
|
@@ -8009,7 +8010,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8009
8010
|
});
|
|
8010
8011
|
setOptionsData(state.panes);
|
|
8011
8012
|
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
8012
|
-
if (!
|
|
8013
|
+
if (!type4) {
|
|
8013
8014
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
8014
8015
|
const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
|
|
8015
8016
|
onPathChange(optionParams, pathNodes);
|
|
@@ -8023,7 +8024,7 @@ const InternalCascader = (props, ref) => {
|
|
|
8023
8024
|
await invokeLazyLoad(node);
|
|
8024
8025
|
if (state.currentProcessNode === node) {
|
|
8025
8026
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
8026
|
-
chooseItem(node,
|
|
8027
|
+
chooseItem(node, type4);
|
|
8027
8028
|
}
|
|
8028
8029
|
setOptionsData(state.panes);
|
|
8029
8030
|
};
|
|
@@ -8085,7 +8086,7 @@ const Cascader = React.forwardRef(InternalCascader);
|
|
|
8085
8086
|
Cascader.defaultProps = defaultProps$$;
|
|
8086
8087
|
Cascader.displayName = "NutCascader";
|
|
8087
8088
|
const CheckboxGroupContext = createContext(null);
|
|
8088
|
-
const Context = CheckboxGroupContext;
|
|
8089
|
+
const Context$1 = CheckboxGroupContext;
|
|
8089
8090
|
const defaultProps$_ = {
|
|
8090
8091
|
max: void 0,
|
|
8091
8092
|
labelPosition: "right",
|
|
@@ -8156,7 +8157,7 @@ const CheckboxGroup = React.forwardRef(
|
|
|
8156
8157
|
});
|
|
8157
8158
|
}, [options, max]);
|
|
8158
8159
|
return /* @__PURE__ */ React.createElement(
|
|
8159
|
-
Context.Provider,
|
|
8160
|
+
Context$1.Provider,
|
|
8160
8161
|
{
|
|
8161
8162
|
value: {
|
|
8162
8163
|
labelPosition: labelPosition || "right",
|
|
@@ -8219,7 +8220,7 @@ const Checkbox = (props) => {
|
|
|
8219
8220
|
...others
|
|
8220
8221
|
} = props;
|
|
8221
8222
|
let { labelPosition, ...rest } = others;
|
|
8222
|
-
const ctx = useContext(Context);
|
|
8223
|
+
const ctx = useContext(Context$1);
|
|
8223
8224
|
let [innerChecked, setChecked] = usePropsValue({
|
|
8224
8225
|
value: props.checked,
|
|
8225
8226
|
defaultValue: props.defaultChecked,
|
|
@@ -8419,18 +8420,18 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
8419
8420
|
}
|
|
8420
8421
|
return false;
|
|
8421
8422
|
};
|
|
8422
|
-
const setTransform = (translateY = 0,
|
|
8423
|
+
const setTransform = (translateY = 0, type4, time = DEFAULT_DURATION, deg) => {
|
|
8423
8424
|
let nTime = time;
|
|
8424
|
-
if (
|
|
8425
|
+
if (type4 !== "end") {
|
|
8425
8426
|
nTime = 0;
|
|
8426
8427
|
}
|
|
8427
8428
|
setTouchTime(nTime);
|
|
8428
8429
|
setTouchDeg(deg);
|
|
8429
8430
|
setScrollDistance(translateY);
|
|
8430
8431
|
};
|
|
8431
|
-
const setMove = (move,
|
|
8432
|
+
const setMove = (move, type4, time) => {
|
|
8432
8433
|
let updateMove = move + transformY.current;
|
|
8433
|
-
if (
|
|
8434
|
+
if (type4 === "end") {
|
|
8434
8435
|
if (updateMove > 0) {
|
|
8435
8436
|
updateMove = 0;
|
|
8436
8437
|
}
|
|
@@ -8439,7 +8440,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
8439
8440
|
}
|
|
8440
8441
|
const endMove = Math.round(updateMove / lineSpacing.current) * lineSpacing.current;
|
|
8441
8442
|
const deg = `${(Math.abs(Math.round(endMove / lineSpacing.current)) + 1) * rotation}deg`;
|
|
8442
|
-
setTransform(endMove,
|
|
8443
|
+
setTransform(endMove, type4, time, deg);
|
|
8443
8444
|
setCurrIndex(Math.abs(Math.round(endMove / lineSpacing.current)) + 1);
|
|
8444
8445
|
} else {
|
|
8445
8446
|
let deg = 0;
|
|
@@ -8492,7 +8493,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
8492
8493
|
nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
|
|
8493
8494
|
return nDistance;
|
|
8494
8495
|
};
|
|
8495
|
-
const modifyStatus = (
|
|
8496
|
+
const modifyStatus = (type4, val) => {
|
|
8496
8497
|
const value = val || defaultValue;
|
|
8497
8498
|
let index = -1;
|
|
8498
8499
|
if (value) {
|
|
@@ -8512,7 +8513,7 @@ const InternalPickerPanel = (props, ref) => {
|
|
|
8512
8513
|
}
|
|
8513
8514
|
setCurrIndex(index === -1 ? 1 : index + 1);
|
|
8514
8515
|
const move = index === -1 ? 0 : index * lineSpacing.current;
|
|
8515
|
-
|
|
8516
|
+
type4 && setChooseValue(-move);
|
|
8516
8517
|
setMove(-move);
|
|
8517
8518
|
};
|
|
8518
8519
|
const stopMomentum = () => {
|
|
@@ -8670,6 +8671,11 @@ const InternalPicker = (props, ref) => {
|
|
|
8670
8671
|
(_a = props.onConfirm) == null ? void 0 : _a.call(props, setSelectedOptions(), val);
|
|
8671
8672
|
}
|
|
8672
8673
|
});
|
|
8674
|
+
const [innerVisible, setInnerVisible] = usePropsValue({
|
|
8675
|
+
value: props.visible,
|
|
8676
|
+
defaultValue: false,
|
|
8677
|
+
finalValue: false
|
|
8678
|
+
});
|
|
8673
8679
|
const [innerValue, setInnerValue] = useState(selectedValue);
|
|
8674
8680
|
const [currentValue, setCurrentValue] = useState([]);
|
|
8675
8681
|
const [columnIndex, setColumnIndex] = useState(0);
|
|
@@ -8677,6 +8683,15 @@ const InternalPicker = (props, ref) => {
|
|
|
8677
8683
|
const [refs, setRefs] = useRefs();
|
|
8678
8684
|
const [columnsList, setColumnsList] = useState([]);
|
|
8679
8685
|
const isConfirmEvent = useRef(false);
|
|
8686
|
+
const actions = {
|
|
8687
|
+
open: () => {
|
|
8688
|
+
setInnerVisible(true);
|
|
8689
|
+
},
|
|
8690
|
+
close: () => {
|
|
8691
|
+
setInnerVisible(false);
|
|
8692
|
+
}
|
|
8693
|
+
};
|
|
8694
|
+
useImperativeHandle(ref, () => actions);
|
|
8680
8695
|
const formatCascade = (columns, values) => {
|
|
8681
8696
|
const formatted = [];
|
|
8682
8697
|
let columnOptions = {
|
|
@@ -8712,8 +8727,8 @@ const InternalPicker = (props, ref) => {
|
|
|
8712
8727
|
return "single";
|
|
8713
8728
|
};
|
|
8714
8729
|
const normalListData = (innerValue2) => {
|
|
8715
|
-
const
|
|
8716
|
-
switch (
|
|
8730
|
+
const type4 = columnsType();
|
|
8731
|
+
switch (type4) {
|
|
8717
8732
|
case "multiple":
|
|
8718
8733
|
return options;
|
|
8719
8734
|
case "cascade":
|
|
@@ -8738,19 +8753,19 @@ const InternalPicker = (props, ref) => {
|
|
|
8738
8753
|
};
|
|
8739
8754
|
useEffect(() => {
|
|
8740
8755
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
8741
|
-
}, [
|
|
8756
|
+
}, [innerVisible]);
|
|
8742
8757
|
useEffect(() => {
|
|
8743
|
-
if (
|
|
8758
|
+
if (innerVisible) {
|
|
8744
8759
|
init();
|
|
8745
8760
|
}
|
|
8746
|
-
}, [options,
|
|
8761
|
+
}, [options, innerVisible]);
|
|
8747
8762
|
useEffect(() => {
|
|
8748
|
-
if (!
|
|
8763
|
+
if (!innerVisible) {
|
|
8749
8764
|
return;
|
|
8750
8765
|
}
|
|
8751
8766
|
Taro.getEnv() !== "WEB" && setCurrentValue(defaultValuesConvert());
|
|
8752
8767
|
onChange && onChange(setSelectedOptions(), innerValue, columnIndex);
|
|
8753
|
-
}, [innerValue, columnsList,
|
|
8768
|
+
}, [innerValue, columnsList, innerVisible]);
|
|
8754
8769
|
const setSelectedOptions = () => {
|
|
8755
8770
|
const options2 = [];
|
|
8756
8771
|
let currOptions = [];
|
|
@@ -8832,6 +8847,7 @@ const InternalPicker = (props, ref) => {
|
|
|
8832
8847
|
if (moving) {
|
|
8833
8848
|
isConfirmEvent.current = true;
|
|
8834
8849
|
} else {
|
|
8850
|
+
console.log("picker confirmed", innerValue);
|
|
8835
8851
|
setSelectedValue(innerValue);
|
|
8836
8852
|
closePicker();
|
|
8837
8853
|
}
|
|
@@ -8840,6 +8856,7 @@ const InternalPicker = (props, ref) => {
|
|
|
8840
8856
|
}, 0);
|
|
8841
8857
|
};
|
|
8842
8858
|
const closePicker = () => {
|
|
8859
|
+
setInnerVisible(false);
|
|
8843
8860
|
onClose && onClose(setSelectedOptions(), innerValue);
|
|
8844
8861
|
afterClose && afterClose(setSelectedOptions(), innerValue, pickerRef);
|
|
8845
8862
|
};
|
|
@@ -8848,10 +8865,23 @@ const InternalPicker = (props, ref) => {
|
|
|
8848
8865
|
"span",
|
|
8849
8866
|
{
|
|
8850
8867
|
className: `${classPrefix2}__cancel-btn`,
|
|
8851
|
-
onClick: () =>
|
|
8868
|
+
onClick: (e) => {
|
|
8869
|
+
e.stopPropagation();
|
|
8870
|
+
closePicker();
|
|
8871
|
+
}
|
|
8852
8872
|
},
|
|
8853
8873
|
locale.cancel
|
|
8854
|
-
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
8874
|
+
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
8875
|
+
"span",
|
|
8876
|
+
{
|
|
8877
|
+
className: `${classPrefix2}__confirm-btn`,
|
|
8878
|
+
onClick: (e) => {
|
|
8879
|
+
e.stopPropagation();
|
|
8880
|
+
confirm();
|
|
8881
|
+
}
|
|
8882
|
+
},
|
|
8883
|
+
locale.confirm
|
|
8884
|
+
));
|
|
8855
8885
|
};
|
|
8856
8886
|
const [, setPickingStatus] = useState(false);
|
|
8857
8887
|
const pickerStart = () => {
|
|
@@ -8875,16 +8905,16 @@ const InternalPicker = (props, ref) => {
|
|
|
8875
8905
|
changeIndex
|
|
8876
8906
|
);
|
|
8877
8907
|
};
|
|
8878
|
-
return /* @__PURE__ */ React.createElement(
|
|
8908
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React.createElement(
|
|
8879
8909
|
Popup,
|
|
8880
8910
|
{
|
|
8881
|
-
visible,
|
|
8911
|
+
visible: innerVisible,
|
|
8882
8912
|
position: "bottom",
|
|
8883
8913
|
afterClose: () => {
|
|
8884
8914
|
closePicker();
|
|
8885
8915
|
}
|
|
8886
8916
|
},
|
|
8887
|
-
/* @__PURE__ */ React.createElement(View, { className: classes, style, ...rest, catchMove: true }, renderTitleBar(), children, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__panel`, ref: pickerRef }, Taro.getEnv() === "WEB" ? columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
8917
|
+
/* @__PURE__ */ React.createElement(View, { className: classes, style, ...rest, catchMove: true }, renderTitleBar(), typeof children !== "function" && children, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__panel`, ref: pickerRef }, Taro.getEnv() === "WEB" ? columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
8888
8918
|
return /* @__PURE__ */ React.createElement(
|
|
8889
8919
|
PickerPanel$1,
|
|
8890
8920
|
{
|
|
@@ -8923,7 +8953,7 @@ const InternalPicker = (props, ref) => {
|
|
|
8923
8953
|
}));
|
|
8924
8954
|
})
|
|
8925
8955
|
)))
|
|
8926
|
-
);
|
|
8956
|
+
));
|
|
8927
8957
|
};
|
|
8928
8958
|
const Picker = React.forwardRef(InternalPicker);
|
|
8929
8959
|
const Picker$1 = Picker;
|
|
@@ -8943,7 +8973,7 @@ const DatePicker = (props) => {
|
|
|
8943
8973
|
const {
|
|
8944
8974
|
startDate,
|
|
8945
8975
|
endDate,
|
|
8946
|
-
type,
|
|
8976
|
+
type: type4,
|
|
8947
8977
|
showChinese,
|
|
8948
8978
|
minuteStep,
|
|
8949
8979
|
visible,
|
|
@@ -8996,16 +9026,16 @@ const DatePicker = (props) => {
|
|
|
8996
9026
|
function getMonthEndDay(year, month) {
|
|
8997
9027
|
return new Date(year, month, 0).getDate();
|
|
8998
9028
|
}
|
|
8999
|
-
const getBoundary = (
|
|
9000
|
-
const boundary =
|
|
9029
|
+
const getBoundary = (type22, value) => {
|
|
9030
|
+
const boundary = type22 === "min" ? startDate : endDate;
|
|
9001
9031
|
const year = boundary.getFullYear();
|
|
9002
9032
|
let month = 1;
|
|
9003
|
-
let
|
|
9033
|
+
let date4 = 1;
|
|
9004
9034
|
let hour = 0;
|
|
9005
9035
|
let minute = 0;
|
|
9006
|
-
if (
|
|
9036
|
+
if (type22 === "max") {
|
|
9007
9037
|
month = 12;
|
|
9008
|
-
|
|
9038
|
+
date4 = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
9009
9039
|
hour = 23;
|
|
9010
9040
|
minute = 59;
|
|
9011
9041
|
}
|
|
@@ -9013,8 +9043,8 @@ const DatePicker = (props) => {
|
|
|
9013
9043
|
if (value.getFullYear() === year) {
|
|
9014
9044
|
month = boundary.getMonth() + 1;
|
|
9015
9045
|
if (value.getMonth() + 1 === month) {
|
|
9016
|
-
|
|
9017
|
-
if (value.getDate() ===
|
|
9046
|
+
date4 = boundary.getDate();
|
|
9047
|
+
if (value.getDate() === date4) {
|
|
9018
9048
|
hour = boundary.getHours();
|
|
9019
9049
|
if (value.getHours() === hour) {
|
|
9020
9050
|
minute = boundary.getMinutes();
|
|
@@ -9023,12 +9053,12 @@ const DatePicker = (props) => {
|
|
|
9023
9053
|
}
|
|
9024
9054
|
}
|
|
9025
9055
|
return {
|
|
9026
|
-
[`${
|
|
9027
|
-
[`${
|
|
9028
|
-
[`${
|
|
9029
|
-
[`${
|
|
9030
|
-
[`${
|
|
9031
|
-
[`${
|
|
9056
|
+
[`${type22}Year`]: year,
|
|
9057
|
+
[`${type22}Month`]: month,
|
|
9058
|
+
[`${type22}Date`]: date4,
|
|
9059
|
+
[`${type22}Hour`]: hour,
|
|
9060
|
+
[`${type22}Minute`]: minute,
|
|
9061
|
+
[`${type22}Seconds`]: seconds
|
|
9032
9062
|
};
|
|
9033
9063
|
};
|
|
9034
9064
|
const ranges = () => {
|
|
@@ -9063,7 +9093,7 @@ const DatePicker = (props) => {
|
|
|
9063
9093
|
range: [minSeconds, maxSeconds]
|
|
9064
9094
|
}
|
|
9065
9095
|
];
|
|
9066
|
-
switch (
|
|
9096
|
+
switch (type4.toLocaleLowerCase()) {
|
|
9067
9097
|
case "date":
|
|
9068
9098
|
result = result.slice(0, 3);
|
|
9069
9099
|
break;
|
|
@@ -9090,18 +9120,18 @@ const DatePicker = (props) => {
|
|
|
9090
9120
|
};
|
|
9091
9121
|
const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
|
|
9092
9122
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
9093
|
-
|
|
9123
|
+
type4.toLocaleLowerCase()
|
|
9094
9124
|
)) {
|
|
9095
9125
|
const formatDate = [];
|
|
9096
9126
|
selectedValue.forEach((item) => {
|
|
9097
9127
|
formatDate.push(item);
|
|
9098
9128
|
});
|
|
9099
|
-
if (
|
|
9129
|
+
if (type4.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
|
|
9100
9130
|
formatDate.unshift(
|
|
9101
9131
|
new Date(defaultValue || startDate || endDate).getFullYear()
|
|
9102
9132
|
);
|
|
9103
9133
|
}
|
|
9104
|
-
if (
|
|
9134
|
+
if (type4.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
|
|
9105
9135
|
formatDate.push(
|
|
9106
9136
|
new Date(defaultValue || startDate || endDate).getDate()
|
|
9107
9137
|
);
|
|
@@ -9112,22 +9142,22 @@ const DatePicker = (props) => {
|
|
|
9112
9142
|
Number(formatDate[2]),
|
|
9113
9143
|
getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
|
|
9114
9144
|
);
|
|
9115
|
-
let
|
|
9116
|
-
if (
|
|
9117
|
-
|
|
9118
|
-
} else if (
|
|
9119
|
-
|
|
9145
|
+
let date4 = null;
|
|
9146
|
+
if (type4.toLocaleLowerCase() === "date" || type4.toLocaleLowerCase() === "month-day" || type4.toLocaleLowerCase() === "year-month") {
|
|
9147
|
+
date4 = new Date(year, month, day);
|
|
9148
|
+
} else if (type4.toLocaleLowerCase() === "datetime") {
|
|
9149
|
+
date4 = new Date(
|
|
9120
9150
|
year,
|
|
9121
9151
|
month,
|
|
9122
9152
|
day,
|
|
9123
9153
|
Number(formatDate[3]),
|
|
9124
9154
|
Number(formatDate[4])
|
|
9125
9155
|
);
|
|
9126
|
-
} else if (
|
|
9127
|
-
|
|
9156
|
+
} else if (type4.toLocaleLowerCase() === "datehour") {
|
|
9157
|
+
date4 = new Date(year, month, day, Number(formatDate[3]));
|
|
9128
9158
|
}
|
|
9129
|
-
const isEqual = (currentDate == null ? void 0 : currentDate.getTime()) === (
|
|
9130
|
-
|
|
9159
|
+
const isEqual = (currentDate == null ? void 0 : currentDate.getTime()) === (date4 == null ? void 0 : date4.getTime());
|
|
9160
|
+
date4 && isDate(date4) && !isEqual && setCurrentDate(formatValue(date4));
|
|
9131
9161
|
}
|
|
9132
9162
|
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
9133
9163
|
};
|
|
@@ -9138,28 +9168,28 @@ const DatePicker = (props) => {
|
|
|
9138
9168
|
}
|
|
9139
9169
|
return str;
|
|
9140
9170
|
};
|
|
9141
|
-
const formatterOption = (
|
|
9171
|
+
const formatterOption = (type22, value) => {
|
|
9142
9172
|
let fOption = null;
|
|
9143
9173
|
if (formatter) {
|
|
9144
|
-
fOption = formatter(
|
|
9174
|
+
fOption = formatter(type22, {
|
|
9145
9175
|
text: padZero(value, 2),
|
|
9146
9176
|
value: padZero(value, 2)
|
|
9147
9177
|
});
|
|
9148
9178
|
} else {
|
|
9149
9179
|
const padMin = padZero(value, 2);
|
|
9150
|
-
const fatter = showChinese ? zhCNType[
|
|
9180
|
+
const fatter = showChinese ? zhCNType[type22] : "";
|
|
9151
9181
|
fOption = { text: padMin + fatter, value: padMin };
|
|
9152
9182
|
}
|
|
9153
9183
|
return fOption;
|
|
9154
9184
|
};
|
|
9155
|
-
const generateValue = (min, max, val,
|
|
9185
|
+
const generateValue = (min, max, val, type22, columnIndex) => {
|
|
9156
9186
|
var _a;
|
|
9157
9187
|
let cmin = min;
|
|
9158
9188
|
const arr = [];
|
|
9159
9189
|
let index = 0;
|
|
9160
9190
|
while (cmin <= max) {
|
|
9161
|
-
arr.push(formatterOption(
|
|
9162
|
-
if (
|
|
9191
|
+
arr.push(formatterOption(type22, cmin));
|
|
9192
|
+
if (type22 === "minute") {
|
|
9163
9193
|
cmin += minuteStep;
|
|
9164
9194
|
} else {
|
|
9165
9195
|
cmin++;
|
|
@@ -9170,26 +9200,26 @@ const DatePicker = (props) => {
|
|
|
9170
9200
|
}
|
|
9171
9201
|
defaultValueOfPicker[columnIndex] = (_a = arr[index]) == null ? void 0 : _a.value;
|
|
9172
9202
|
setDefaultValueOfPicker([...defaultValueOfPicker]);
|
|
9173
|
-
if (props.filter && props.filter(
|
|
9174
|
-
return props.filter(
|
|
9203
|
+
if (props.filter && props.filter(type22, arr)) {
|
|
9204
|
+
return props.filter(type22, arr);
|
|
9175
9205
|
}
|
|
9176
9206
|
return arr;
|
|
9177
9207
|
};
|
|
9178
|
-
const getDateIndex = (
|
|
9208
|
+
const getDateIndex = (type22) => {
|
|
9179
9209
|
if (!currentDate)
|
|
9180
9210
|
return 0;
|
|
9181
9211
|
let d = 0;
|
|
9182
|
-
if (
|
|
9212
|
+
if (type22 === "year") {
|
|
9183
9213
|
d = currentDate.getFullYear();
|
|
9184
|
-
} else if (
|
|
9214
|
+
} else if (type22 === "month") {
|
|
9185
9215
|
d = currentDate.getMonth() + 1;
|
|
9186
|
-
} else if (
|
|
9216
|
+
} else if (type22 === "day") {
|
|
9187
9217
|
d = currentDate.getDate();
|
|
9188
|
-
} else if (
|
|
9218
|
+
} else if (type22 === "hour") {
|
|
9189
9219
|
d = currentDate.getHours();
|
|
9190
|
-
} else if (
|
|
9220
|
+
} else if (type22 === "minute") {
|
|
9191
9221
|
d = currentDate.getMinutes();
|
|
9192
|
-
} else if (
|
|
9222
|
+
} else if (type22 === "seconds") {
|
|
9193
9223
|
d = currentDate.getSeconds();
|
|
9194
9224
|
}
|
|
9195
9225
|
return d;
|
|
@@ -9236,116 +9266,1071 @@ const DatePicker = (props) => {
|
|
|
9236
9266
|
};
|
|
9237
9267
|
DatePicker.defaultProps = defaultProps$X;
|
|
9238
9268
|
DatePicker.displayName = "NutDatePicker";
|
|
9239
|
-
const
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
labelWidth: 90,
|
|
9248
|
-
errorMessageAlign: "left",
|
|
9249
|
-
showErrorLine: true,
|
|
9250
|
-
showErrorMessage: true
|
|
9251
|
-
};
|
|
9252
|
-
class FormItem extends React.Component {
|
|
9253
|
-
constructor() {
|
|
9254
|
-
super(...arguments);
|
|
9255
|
-
__publicField(this, "cancelRegister");
|
|
9256
|
-
// children添加value属性和onChange事件
|
|
9257
|
-
__publicField(this, "getControlled", (children) => {
|
|
9258
|
-
const { getFieldValue, setFieldsValue } = this.context;
|
|
9259
|
-
const { name } = this.props;
|
|
9260
|
-
const type = children.type.NAME;
|
|
9261
|
-
return {
|
|
9262
|
-
value: getFieldValue(name),
|
|
9263
|
-
onChange: (event) => {
|
|
9264
|
-
let newValue = event;
|
|
9265
|
-
switch (type) {
|
|
9266
|
-
case "checkbox":
|
|
9267
|
-
newValue = event.target.value;
|
|
9268
|
-
break;
|
|
9269
|
-
}
|
|
9270
|
-
setFieldsValue({ [name]: newValue });
|
|
9269
|
+
const Context = createContext({});
|
|
9270
|
+
function _extends() {
|
|
9271
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
9272
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9273
|
+
var source = arguments[i];
|
|
9274
|
+
for (var key in source) {
|
|
9275
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9276
|
+
target[key] = source[key];
|
|
9271
9277
|
}
|
|
9272
|
-
}
|
|
9278
|
+
}
|
|
9279
|
+
}
|
|
9280
|
+
return target;
|
|
9281
|
+
};
|
|
9282
|
+
return _extends.apply(this, arguments);
|
|
9283
|
+
}
|
|
9284
|
+
function _inheritsLoose(subClass, superClass) {
|
|
9285
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
9286
|
+
subClass.prototype.constructor = subClass;
|
|
9287
|
+
_setPrototypeOf(subClass, superClass);
|
|
9288
|
+
}
|
|
9289
|
+
function _getPrototypeOf(o) {
|
|
9290
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
|
|
9291
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
9292
|
+
};
|
|
9293
|
+
return _getPrototypeOf(o);
|
|
9294
|
+
}
|
|
9295
|
+
function _setPrototypeOf(o, p) {
|
|
9296
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
9297
|
+
o2.__proto__ = p2;
|
|
9298
|
+
return o2;
|
|
9299
|
+
};
|
|
9300
|
+
return _setPrototypeOf(o, p);
|
|
9301
|
+
}
|
|
9302
|
+
function _isNativeReflectConstruct() {
|
|
9303
|
+
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
9304
|
+
return false;
|
|
9305
|
+
if (Reflect.construct.sham)
|
|
9306
|
+
return false;
|
|
9307
|
+
if (typeof Proxy === "function")
|
|
9308
|
+
return true;
|
|
9309
|
+
try {
|
|
9310
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
9311
|
+
}));
|
|
9312
|
+
return true;
|
|
9313
|
+
} catch (e) {
|
|
9314
|
+
return false;
|
|
9315
|
+
}
|
|
9316
|
+
}
|
|
9317
|
+
function _construct(Parent, args, Class) {
|
|
9318
|
+
if (_isNativeReflectConstruct()) {
|
|
9319
|
+
_construct = Reflect.construct.bind();
|
|
9320
|
+
} else {
|
|
9321
|
+
_construct = function _construct2(Parent2, args2, Class2) {
|
|
9322
|
+
var a2 = [null];
|
|
9323
|
+
a2.push.apply(a2, args2);
|
|
9324
|
+
var Constructor = Function.bind.apply(Parent2, a2);
|
|
9325
|
+
var instance = new Constructor();
|
|
9326
|
+
if (Class2)
|
|
9327
|
+
_setPrototypeOf(instance, Class2.prototype);
|
|
9328
|
+
return instance;
|
|
9329
|
+
};
|
|
9330
|
+
}
|
|
9331
|
+
return _construct.apply(null, arguments);
|
|
9332
|
+
}
|
|
9333
|
+
function _isNativeFunction(fn) {
|
|
9334
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
9335
|
+
}
|
|
9336
|
+
function _wrapNativeSuper(Class) {
|
|
9337
|
+
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
9338
|
+
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
|
|
9339
|
+
if (Class2 === null || !_isNativeFunction(Class2))
|
|
9340
|
+
return Class2;
|
|
9341
|
+
if (typeof Class2 !== "function") {
|
|
9342
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
9343
|
+
}
|
|
9344
|
+
if (typeof _cache !== "undefined") {
|
|
9345
|
+
if (_cache.has(Class2))
|
|
9346
|
+
return _cache.get(Class2);
|
|
9347
|
+
_cache.set(Class2, Wrapper);
|
|
9348
|
+
}
|
|
9349
|
+
function Wrapper() {
|
|
9350
|
+
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
|
|
9351
|
+
}
|
|
9352
|
+
Wrapper.prototype = Object.create(Class2.prototype, {
|
|
9353
|
+
constructor: {
|
|
9354
|
+
value: Wrapper,
|
|
9355
|
+
enumerable: false,
|
|
9356
|
+
writable: true,
|
|
9357
|
+
configurable: true
|
|
9358
|
+
}
|
|
9273
9359
|
});
|
|
9274
|
-
|
|
9275
|
-
|
|
9360
|
+
return _setPrototypeOf(Wrapper, Class2);
|
|
9361
|
+
};
|
|
9362
|
+
return _wrapNativeSuper(Class);
|
|
9363
|
+
}
|
|
9364
|
+
var formatRegExp = /%[sdj%]/g;
|
|
9365
|
+
var warning = function warning2() {
|
|
9366
|
+
};
|
|
9367
|
+
if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof window !== "undefined" && typeof document !== "undefined") {
|
|
9368
|
+
warning = function warning3(type4, errors) {
|
|
9369
|
+
if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
|
|
9370
|
+
if (errors.every(function(e) {
|
|
9371
|
+
return typeof e === "string";
|
|
9372
|
+
})) {
|
|
9373
|
+
console.warn(type4, errors);
|
|
9374
|
+
}
|
|
9375
|
+
}
|
|
9376
|
+
};
|
|
9377
|
+
}
|
|
9378
|
+
function convertFieldsError(errors) {
|
|
9379
|
+
if (!errors || !errors.length)
|
|
9380
|
+
return null;
|
|
9381
|
+
var fields = {};
|
|
9382
|
+
errors.forEach(function(error) {
|
|
9383
|
+
var field = error.field;
|
|
9384
|
+
fields[field] = fields[field] || [];
|
|
9385
|
+
fields[field].push(error);
|
|
9386
|
+
});
|
|
9387
|
+
return fields;
|
|
9388
|
+
}
|
|
9389
|
+
function format(template) {
|
|
9390
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
9391
|
+
args[_key - 1] = arguments[_key];
|
|
9392
|
+
}
|
|
9393
|
+
var i = 0;
|
|
9394
|
+
var len = args.length;
|
|
9395
|
+
if (typeof template === "function") {
|
|
9396
|
+
return template.apply(null, args);
|
|
9397
|
+
}
|
|
9398
|
+
if (typeof template === "string") {
|
|
9399
|
+
var str = template.replace(formatRegExp, function(x) {
|
|
9400
|
+
if (x === "%%") {
|
|
9401
|
+
return "%";
|
|
9402
|
+
}
|
|
9403
|
+
if (i >= len) {
|
|
9404
|
+
return x;
|
|
9405
|
+
}
|
|
9406
|
+
switch (x) {
|
|
9407
|
+
case "%s":
|
|
9408
|
+
return String(args[i++]);
|
|
9409
|
+
case "%d":
|
|
9410
|
+
return Number(args[i++]);
|
|
9411
|
+
case "%j":
|
|
9412
|
+
try {
|
|
9413
|
+
return JSON.stringify(args[i++]);
|
|
9414
|
+
} catch (_) {
|
|
9415
|
+
return "[Circular]";
|
|
9416
|
+
}
|
|
9417
|
+
break;
|
|
9418
|
+
default:
|
|
9419
|
+
return x;
|
|
9420
|
+
}
|
|
9276
9421
|
});
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9422
|
+
return str;
|
|
9423
|
+
}
|
|
9424
|
+
return template;
|
|
9425
|
+
}
|
|
9426
|
+
function isNativeStringType(type4) {
|
|
9427
|
+
return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
|
|
9428
|
+
}
|
|
9429
|
+
function isEmptyValue(value, type4) {
|
|
9430
|
+
if (value === void 0 || value === null) {
|
|
9431
|
+
return true;
|
|
9432
|
+
}
|
|
9433
|
+
if (type4 === "array" && Array.isArray(value) && !value.length) {
|
|
9434
|
+
return true;
|
|
9435
|
+
}
|
|
9436
|
+
if (isNativeStringType(type4) && typeof value === "string" && !value) {
|
|
9437
|
+
return true;
|
|
9438
|
+
}
|
|
9439
|
+
return false;
|
|
9440
|
+
}
|
|
9441
|
+
function asyncParallelArray(arr, func, callback) {
|
|
9442
|
+
var results = [];
|
|
9443
|
+
var total = 0;
|
|
9444
|
+
var arrLength = arr.length;
|
|
9445
|
+
function count(errors) {
|
|
9446
|
+
results.push.apply(results, errors || []);
|
|
9447
|
+
total++;
|
|
9448
|
+
if (total === arrLength) {
|
|
9449
|
+
callback(results);
|
|
9450
|
+
}
|
|
9451
|
+
}
|
|
9452
|
+
arr.forEach(function(a2) {
|
|
9453
|
+
func(a2, count);
|
|
9454
|
+
});
|
|
9455
|
+
}
|
|
9456
|
+
function asyncSerialArray(arr, func, callback) {
|
|
9457
|
+
var index = 0;
|
|
9458
|
+
var arrLength = arr.length;
|
|
9459
|
+
function next(errors) {
|
|
9460
|
+
if (errors && errors.length) {
|
|
9461
|
+
callback(errors);
|
|
9462
|
+
return;
|
|
9463
|
+
}
|
|
9464
|
+
var original = index;
|
|
9465
|
+
index = index + 1;
|
|
9466
|
+
if (original < arrLength) {
|
|
9467
|
+
func(arr[original], next);
|
|
9468
|
+
} else {
|
|
9469
|
+
callback([]);
|
|
9470
|
+
}
|
|
9471
|
+
}
|
|
9472
|
+
next([]);
|
|
9473
|
+
}
|
|
9474
|
+
function flattenObjArr(objArr) {
|
|
9475
|
+
var ret = [];
|
|
9476
|
+
Object.keys(objArr).forEach(function(k) {
|
|
9477
|
+
ret.push.apply(ret, objArr[k] || []);
|
|
9478
|
+
});
|
|
9479
|
+
return ret;
|
|
9480
|
+
}
|
|
9481
|
+
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
|
|
9482
|
+
_inheritsLoose(AsyncValidationError2, _Error);
|
|
9483
|
+
function AsyncValidationError2(errors, fields) {
|
|
9484
|
+
var _this;
|
|
9485
|
+
_this = _Error.call(this, "Async Validation Error") || this;
|
|
9486
|
+
_this.errors = errors;
|
|
9487
|
+
_this.fields = fields;
|
|
9488
|
+
return _this;
|
|
9489
|
+
}
|
|
9490
|
+
return AsyncValidationError2;
|
|
9491
|
+
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
9492
|
+
function asyncMap(objArr, option, func, callback, source) {
|
|
9493
|
+
if (option.first) {
|
|
9494
|
+
var _pending = new Promise(function(resolve, reject) {
|
|
9495
|
+
var next = function next2(errors) {
|
|
9496
|
+
callback(errors);
|
|
9497
|
+
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
|
|
9291
9498
|
};
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
}));
|
|
9295
|
-
const { starPositon } = this.context;
|
|
9296
|
-
const renderStar = rules.length > 0 && rules[0].required && /* @__PURE__ */ React.createElement("i", { className: "required" });
|
|
9297
|
-
const renderLabel = starPositon === "Right" ? /* @__PURE__ */ React.createElement(React.Fragment, null, label, renderStar) : /* @__PURE__ */ React.createElement(React.Fragment, null, renderStar, label);
|
|
9298
|
-
return /* @__PURE__ */ React.createElement(Cell, { className: `nut-form-item ${className}` }, label ? /* @__PURE__ */ React.createElement(
|
|
9299
|
-
"div",
|
|
9300
|
-
{
|
|
9301
|
-
className: "nut-cell__title nut-form-item__label",
|
|
9302
|
-
style: {
|
|
9303
|
-
width: this.pxCheck(labelWidth)
|
|
9304
|
-
}
|
|
9305
|
-
},
|
|
9306
|
-
renderLabel
|
|
9307
|
-
) : null, /* @__PURE__ */ React.createElement("div", { className: "nut-cell__value nut-form-item__body" }, /* @__PURE__ */ React.createElement("div", { className: "nut-form-item__body__slots" }, childNode), item.length > 0 && /* @__PURE__ */ React.createElement(
|
|
9308
|
-
"div",
|
|
9309
|
-
{
|
|
9310
|
-
className: "nut-form-item__body__tips",
|
|
9311
|
-
style: { textAlign: errorMessageAlign }
|
|
9312
|
-
},
|
|
9313
|
-
item[0].message
|
|
9314
|
-
)));
|
|
9499
|
+
var flattenArr = flattenObjArr(objArr);
|
|
9500
|
+
asyncSerialArray(flattenArr, func, next);
|
|
9315
9501
|
});
|
|
9316
|
-
|
|
9317
|
-
return
|
|
9502
|
+
_pending["catch"](function(e) {
|
|
9503
|
+
return e;
|
|
9318
9504
|
});
|
|
9505
|
+
return _pending;
|
|
9319
9506
|
}
|
|
9320
|
-
|
|
9321
|
-
|
|
9507
|
+
var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
|
|
9508
|
+
var objArrKeys = Object.keys(objArr);
|
|
9509
|
+
var objArrLength = objArrKeys.length;
|
|
9510
|
+
var total = 0;
|
|
9511
|
+
var results = [];
|
|
9512
|
+
var pending = new Promise(function(resolve, reject) {
|
|
9513
|
+
var next = function next2(errors) {
|
|
9514
|
+
results.push.apply(results, errors);
|
|
9515
|
+
total++;
|
|
9516
|
+
if (total === objArrLength) {
|
|
9517
|
+
callback(results);
|
|
9518
|
+
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
|
|
9519
|
+
}
|
|
9520
|
+
};
|
|
9521
|
+
if (!objArrKeys.length) {
|
|
9522
|
+
callback(results);
|
|
9523
|
+
resolve(source);
|
|
9524
|
+
}
|
|
9525
|
+
objArrKeys.forEach(function(key) {
|
|
9526
|
+
var arr = objArr[key];
|
|
9527
|
+
if (firstFields.indexOf(key) !== -1) {
|
|
9528
|
+
asyncSerialArray(arr, func, next);
|
|
9529
|
+
} else {
|
|
9530
|
+
asyncParallelArray(arr, func, next);
|
|
9531
|
+
}
|
|
9532
|
+
});
|
|
9533
|
+
});
|
|
9534
|
+
pending["catch"](function(e) {
|
|
9535
|
+
return e;
|
|
9536
|
+
});
|
|
9537
|
+
return pending;
|
|
9538
|
+
}
|
|
9539
|
+
function isErrorObj(obj) {
|
|
9540
|
+
return !!(obj && obj.message !== void 0);
|
|
9541
|
+
}
|
|
9542
|
+
function getValue(value, path) {
|
|
9543
|
+
var v = value;
|
|
9544
|
+
for (var i = 0; i < path.length; i++) {
|
|
9545
|
+
if (v == void 0) {
|
|
9546
|
+
return v;
|
|
9547
|
+
}
|
|
9548
|
+
v = v[path[i]];
|
|
9322
9549
|
}
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9550
|
+
return v;
|
|
9551
|
+
}
|
|
9552
|
+
function complementError(rule, source) {
|
|
9553
|
+
return function(oe) {
|
|
9554
|
+
var fieldValue;
|
|
9555
|
+
if (rule.fullFields) {
|
|
9556
|
+
fieldValue = getValue(source, rule.fullFields);
|
|
9557
|
+
} else {
|
|
9558
|
+
fieldValue = source[oe.field || rule.fullField];
|
|
9559
|
+
}
|
|
9560
|
+
if (isErrorObj(oe)) {
|
|
9561
|
+
oe.field = oe.field || rule.fullField;
|
|
9562
|
+
oe.fieldValue = fieldValue;
|
|
9563
|
+
return oe;
|
|
9564
|
+
}
|
|
9565
|
+
return {
|
|
9566
|
+
message: typeof oe === "function" ? oe() : oe,
|
|
9567
|
+
fieldValue,
|
|
9568
|
+
field: oe.field || rule.fullField
|
|
9569
|
+
};
|
|
9570
|
+
};
|
|
9571
|
+
}
|
|
9572
|
+
function deepMerge(target, source) {
|
|
9573
|
+
if (source) {
|
|
9574
|
+
for (var s in source) {
|
|
9575
|
+
if (source.hasOwnProperty(s)) {
|
|
9576
|
+
var value = source[s];
|
|
9577
|
+
if (typeof value === "object" && typeof target[s] === "object") {
|
|
9578
|
+
target[s] = _extends({}, target[s], value);
|
|
9579
|
+
} else {
|
|
9580
|
+
target[s] = value;
|
|
9581
|
+
}
|
|
9582
|
+
}
|
|
9326
9583
|
}
|
|
9327
9584
|
}
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9585
|
+
return target;
|
|
9586
|
+
}
|
|
9587
|
+
var required$1 = function required(rule, value, source, errors, options, type4) {
|
|
9588
|
+
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
|
|
9589
|
+
errors.push(format(options.messages.required, rule.fullField));
|
|
9590
|
+
}
|
|
9591
|
+
};
|
|
9592
|
+
var whitespace = function whitespace2(rule, value, source, errors, options) {
|
|
9593
|
+
if (/^\s+$/.test(value) || value === "") {
|
|
9594
|
+
errors.push(format(options.messages.whitespace, rule.fullField));
|
|
9595
|
+
}
|
|
9596
|
+
};
|
|
9597
|
+
var urlReg;
|
|
9598
|
+
var getUrlRegex = function() {
|
|
9599
|
+
if (urlReg) {
|
|
9600
|
+
return urlReg;
|
|
9601
|
+
}
|
|
9602
|
+
var word = "[a-fA-F\\d:]";
|
|
9603
|
+
var b2 = function b3(options) {
|
|
9604
|
+
return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
|
|
9605
|
+
};
|
|
9606
|
+
var v4 = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}";
|
|
9607
|
+
var v6seg = "[a-fA-F\\d]{1,4}";
|
|
9608
|
+
var v6 = ("\n(?:\n(?:" + v6seg + ":){7}(?:" + v6seg + "|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8\n(?:" + v6seg + ":){6}(?:" + v4 + "|:" + v6seg + "|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4\n(?:" + v6seg + ":){5}(?::" + v4 + "|(?::" + v6seg + "){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4\n(?:" + v6seg + ":){4}(?:(?::" + v6seg + "){0,1}:" + v4 + "|(?::" + v6seg + "){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4\n(?:" + v6seg + ":){3}(?:(?::" + v6seg + "){0,2}:" + v4 + "|(?::" + v6seg + "){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4\n(?:" + v6seg + ":){2}(?:(?::" + v6seg + "){0,3}:" + v4 + "|(?::" + v6seg + "){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4\n(?:" + v6seg + ":){1}(?:(?::" + v6seg + "){0,4}:" + v4 + "|(?::" + v6seg + "){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4\n(?::(?:(?::" + v6seg + "){0,5}:" + v4 + "|(?::" + v6seg + "){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4\n)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1\n").replace(/\s*\/\/.*$/gm, "").replace(/\n/g, "").trim();
|
|
9609
|
+
var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
|
|
9610
|
+
var v4exact = new RegExp("^" + v4 + "$");
|
|
9611
|
+
var v6exact = new RegExp("^" + v6 + "$");
|
|
9612
|
+
var ip = function ip2(options) {
|
|
9613
|
+
return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
|
|
9614
|
+
};
|
|
9615
|
+
ip.v4 = function(options) {
|
|
9616
|
+
return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
|
|
9617
|
+
};
|
|
9618
|
+
ip.v6 = function(options) {
|
|
9619
|
+
return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
|
|
9620
|
+
};
|
|
9621
|
+
var protocol = "(?:(?:[a-z]+:)?//)";
|
|
9622
|
+
var auth = "(?:\\S+(?::\\S*)?@)?";
|
|
9623
|
+
var ipv4 = ip.v4().source;
|
|
9624
|
+
var ipv6 = ip.v6().source;
|
|
9625
|
+
var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
|
|
9626
|
+
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
|
|
9627
|
+
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
|
|
9628
|
+
var port = "(?::\\d{2,5})?";
|
|
9629
|
+
var path = '(?:[/?#][^\\s"]*)?';
|
|
9630
|
+
var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
|
|
9631
|
+
urlReg = new RegExp("(?:^" + regex + "$)", "i");
|
|
9632
|
+
return urlReg;
|
|
9633
|
+
};
|
|
9634
|
+
var pattern$2 = {
|
|
9635
|
+
// http://emailregex.com/
|
|
9636
|
+
email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+\.)+[a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}))$/,
|
|
9637
|
+
// url: new RegExp(
|
|
9638
|
+
// '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
|
|
9639
|
+
// 'i',
|
|
9640
|
+
// ),
|
|
9641
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
9642
|
+
};
|
|
9643
|
+
var types = {
|
|
9644
|
+
integer: function integer(value) {
|
|
9645
|
+
return types.number(value) && parseInt(value, 10) === value;
|
|
9646
|
+
},
|
|
9647
|
+
"float": function float(value) {
|
|
9648
|
+
return types.number(value) && !types.integer(value);
|
|
9649
|
+
},
|
|
9650
|
+
array: function array(value) {
|
|
9651
|
+
return Array.isArray(value);
|
|
9652
|
+
},
|
|
9653
|
+
regexp: function regexp(value) {
|
|
9654
|
+
if (value instanceof RegExp) {
|
|
9655
|
+
return true;
|
|
9656
|
+
}
|
|
9657
|
+
try {
|
|
9658
|
+
return !!new RegExp(value);
|
|
9659
|
+
} catch (e) {
|
|
9660
|
+
return false;
|
|
9661
|
+
}
|
|
9662
|
+
},
|
|
9663
|
+
date: function date(value) {
|
|
9664
|
+
return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
|
|
9665
|
+
},
|
|
9666
|
+
number: function number(value) {
|
|
9667
|
+
if (isNaN(value)) {
|
|
9668
|
+
return false;
|
|
9669
|
+
}
|
|
9670
|
+
return typeof value === "number";
|
|
9671
|
+
},
|
|
9672
|
+
object: function object(value) {
|
|
9673
|
+
return typeof value === "object" && !types.array(value);
|
|
9674
|
+
},
|
|
9675
|
+
method: function method(value) {
|
|
9676
|
+
return typeof value === "function";
|
|
9677
|
+
},
|
|
9678
|
+
email: function email(value) {
|
|
9679
|
+
return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
|
|
9680
|
+
},
|
|
9681
|
+
url: function url(value) {
|
|
9682
|
+
return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
|
|
9683
|
+
},
|
|
9684
|
+
hex: function hex(value) {
|
|
9685
|
+
return typeof value === "string" && !!value.match(pattern$2.hex);
|
|
9686
|
+
}
|
|
9687
|
+
};
|
|
9688
|
+
var type$1 = function type(rule, value, source, errors, options) {
|
|
9689
|
+
if (rule.required && value === void 0) {
|
|
9690
|
+
required$1(rule, value, source, errors, options);
|
|
9691
|
+
return;
|
|
9692
|
+
}
|
|
9693
|
+
var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
|
|
9694
|
+
var ruleType = rule.type;
|
|
9695
|
+
if (custom.indexOf(ruleType) > -1) {
|
|
9696
|
+
if (!types[ruleType](value)) {
|
|
9697
|
+
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
9698
|
+
}
|
|
9699
|
+
} else if (ruleType && typeof value !== rule.type) {
|
|
9700
|
+
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
9701
|
+
}
|
|
9702
|
+
};
|
|
9703
|
+
var range = function range2(rule, value, source, errors, options) {
|
|
9704
|
+
var len = typeof rule.len === "number";
|
|
9705
|
+
var min = typeof rule.min === "number";
|
|
9706
|
+
var max = typeof rule.max === "number";
|
|
9707
|
+
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
9708
|
+
var val = value;
|
|
9709
|
+
var key = null;
|
|
9710
|
+
var num = typeof value === "number";
|
|
9711
|
+
var str = typeof value === "string";
|
|
9712
|
+
var arr = Array.isArray(value);
|
|
9713
|
+
if (num) {
|
|
9714
|
+
key = "number";
|
|
9715
|
+
} else if (str) {
|
|
9716
|
+
key = "string";
|
|
9717
|
+
} else if (arr) {
|
|
9718
|
+
key = "array";
|
|
9719
|
+
}
|
|
9720
|
+
if (!key) {
|
|
9721
|
+
return false;
|
|
9722
|
+
}
|
|
9723
|
+
if (arr) {
|
|
9724
|
+
val = value.length;
|
|
9725
|
+
}
|
|
9726
|
+
if (str) {
|
|
9727
|
+
val = value.replace(spRegexp, "_").length;
|
|
9728
|
+
}
|
|
9729
|
+
if (len) {
|
|
9730
|
+
if (val !== rule.len) {
|
|
9731
|
+
errors.push(format(options.messages[key].len, rule.fullField, rule.len));
|
|
9732
|
+
}
|
|
9733
|
+
} else if (min && !max && val < rule.min) {
|
|
9734
|
+
errors.push(format(options.messages[key].min, rule.fullField, rule.min));
|
|
9735
|
+
} else if (max && !min && val > rule.max) {
|
|
9736
|
+
errors.push(format(options.messages[key].max, rule.fullField, rule.max));
|
|
9737
|
+
} else if (min && max && (val < rule.min || val > rule.max)) {
|
|
9738
|
+
errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
|
|
9739
|
+
}
|
|
9740
|
+
};
|
|
9741
|
+
var ENUM$1 = "enum";
|
|
9742
|
+
var enumerable$1 = function enumerable(rule, value, source, errors, options) {
|
|
9743
|
+
rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
|
|
9744
|
+
if (rule[ENUM$1].indexOf(value) === -1) {
|
|
9745
|
+
errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
|
|
9746
|
+
}
|
|
9747
|
+
};
|
|
9748
|
+
var pattern$1 = function pattern(rule, value, source, errors, options) {
|
|
9749
|
+
if (rule.pattern) {
|
|
9750
|
+
if (rule.pattern instanceof RegExp) {
|
|
9751
|
+
rule.pattern.lastIndex = 0;
|
|
9752
|
+
if (!rule.pattern.test(value)) {
|
|
9753
|
+
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
9754
|
+
}
|
|
9755
|
+
} else if (typeof rule.pattern === "string") {
|
|
9756
|
+
var _pattern = new RegExp(rule.pattern);
|
|
9757
|
+
if (!_pattern.test(value)) {
|
|
9758
|
+
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
9759
|
+
}
|
|
9760
|
+
}
|
|
9761
|
+
}
|
|
9762
|
+
};
|
|
9763
|
+
var rules = {
|
|
9764
|
+
required: required$1,
|
|
9765
|
+
whitespace,
|
|
9766
|
+
type: type$1,
|
|
9767
|
+
range,
|
|
9768
|
+
"enum": enumerable$1,
|
|
9769
|
+
pattern: pattern$1
|
|
9770
|
+
};
|
|
9771
|
+
var string = function string2(rule, value, callback, source, options) {
|
|
9772
|
+
var errors = [];
|
|
9773
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9774
|
+
if (validate) {
|
|
9775
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
9776
|
+
return callback();
|
|
9777
|
+
}
|
|
9778
|
+
rules.required(rule, value, source, errors, options, "string");
|
|
9779
|
+
if (!isEmptyValue(value, "string")) {
|
|
9780
|
+
rules.type(rule, value, source, errors, options);
|
|
9781
|
+
rules.range(rule, value, source, errors, options);
|
|
9782
|
+
rules.pattern(rule, value, source, errors, options);
|
|
9783
|
+
if (rule.whitespace === true) {
|
|
9784
|
+
rules.whitespace(rule, value, source, errors, options);
|
|
9785
|
+
}
|
|
9786
|
+
}
|
|
9787
|
+
}
|
|
9788
|
+
callback(errors);
|
|
9789
|
+
};
|
|
9790
|
+
var method2 = function method3(rule, value, callback, source, options) {
|
|
9791
|
+
var errors = [];
|
|
9792
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9793
|
+
if (validate) {
|
|
9794
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9795
|
+
return callback();
|
|
9796
|
+
}
|
|
9797
|
+
rules.required(rule, value, source, errors, options);
|
|
9798
|
+
if (value !== void 0) {
|
|
9799
|
+
rules.type(rule, value, source, errors, options);
|
|
9800
|
+
}
|
|
9801
|
+
}
|
|
9802
|
+
callback(errors);
|
|
9803
|
+
};
|
|
9804
|
+
var number2 = function number3(rule, value, callback, source, options) {
|
|
9805
|
+
var errors = [];
|
|
9806
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9807
|
+
if (validate) {
|
|
9808
|
+
if (value === "") {
|
|
9809
|
+
value = void 0;
|
|
9810
|
+
}
|
|
9811
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9812
|
+
return callback();
|
|
9813
|
+
}
|
|
9814
|
+
rules.required(rule, value, source, errors, options);
|
|
9815
|
+
if (value !== void 0) {
|
|
9816
|
+
rules.type(rule, value, source, errors, options);
|
|
9817
|
+
rules.range(rule, value, source, errors, options);
|
|
9818
|
+
}
|
|
9819
|
+
}
|
|
9820
|
+
callback(errors);
|
|
9821
|
+
};
|
|
9822
|
+
var _boolean = function _boolean2(rule, value, callback, source, options) {
|
|
9823
|
+
var errors = [];
|
|
9824
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9825
|
+
if (validate) {
|
|
9826
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9827
|
+
return callback();
|
|
9828
|
+
}
|
|
9829
|
+
rules.required(rule, value, source, errors, options);
|
|
9830
|
+
if (value !== void 0) {
|
|
9831
|
+
rules.type(rule, value, source, errors, options);
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9834
|
+
callback(errors);
|
|
9835
|
+
};
|
|
9836
|
+
var regexp2 = function regexp3(rule, value, callback, source, options) {
|
|
9837
|
+
var errors = [];
|
|
9838
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9839
|
+
if (validate) {
|
|
9840
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9841
|
+
return callback();
|
|
9842
|
+
}
|
|
9843
|
+
rules.required(rule, value, source, errors, options);
|
|
9844
|
+
if (!isEmptyValue(value)) {
|
|
9845
|
+
rules.type(rule, value, source, errors, options);
|
|
9846
|
+
}
|
|
9847
|
+
}
|
|
9848
|
+
callback(errors);
|
|
9849
|
+
};
|
|
9850
|
+
var integer2 = function integer3(rule, value, callback, source, options) {
|
|
9851
|
+
var errors = [];
|
|
9852
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9853
|
+
if (validate) {
|
|
9854
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9855
|
+
return callback();
|
|
9856
|
+
}
|
|
9857
|
+
rules.required(rule, value, source, errors, options);
|
|
9858
|
+
if (value !== void 0) {
|
|
9859
|
+
rules.type(rule, value, source, errors, options);
|
|
9860
|
+
rules.range(rule, value, source, errors, options);
|
|
9861
|
+
}
|
|
9862
|
+
}
|
|
9863
|
+
callback(errors);
|
|
9864
|
+
};
|
|
9865
|
+
var floatFn = function floatFn2(rule, value, callback, source, options) {
|
|
9866
|
+
var errors = [];
|
|
9867
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9868
|
+
if (validate) {
|
|
9869
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9870
|
+
return callback();
|
|
9871
|
+
}
|
|
9872
|
+
rules.required(rule, value, source, errors, options);
|
|
9873
|
+
if (value !== void 0) {
|
|
9874
|
+
rules.type(rule, value, source, errors, options);
|
|
9875
|
+
rules.range(rule, value, source, errors, options);
|
|
9876
|
+
}
|
|
9877
|
+
}
|
|
9878
|
+
callback(errors);
|
|
9879
|
+
};
|
|
9880
|
+
var array2 = function array3(rule, value, callback, source, options) {
|
|
9881
|
+
var errors = [];
|
|
9882
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9883
|
+
if (validate) {
|
|
9884
|
+
if ((value === void 0 || value === null) && !rule.required) {
|
|
9885
|
+
return callback();
|
|
9886
|
+
}
|
|
9887
|
+
rules.required(rule, value, source, errors, options, "array");
|
|
9888
|
+
if (value !== void 0 && value !== null) {
|
|
9889
|
+
rules.type(rule, value, source, errors, options);
|
|
9890
|
+
rules.range(rule, value, source, errors, options);
|
|
9891
|
+
}
|
|
9892
|
+
}
|
|
9893
|
+
callback(errors);
|
|
9894
|
+
};
|
|
9895
|
+
var object2 = function object3(rule, value, callback, source, options) {
|
|
9896
|
+
var errors = [];
|
|
9897
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9898
|
+
if (validate) {
|
|
9899
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9900
|
+
return callback();
|
|
9901
|
+
}
|
|
9902
|
+
rules.required(rule, value, source, errors, options);
|
|
9903
|
+
if (value !== void 0) {
|
|
9904
|
+
rules.type(rule, value, source, errors, options);
|
|
9905
|
+
}
|
|
9906
|
+
}
|
|
9907
|
+
callback(errors);
|
|
9908
|
+
};
|
|
9909
|
+
var ENUM = "enum";
|
|
9910
|
+
var enumerable2 = function enumerable3(rule, value, callback, source, options) {
|
|
9911
|
+
var errors = [];
|
|
9912
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9913
|
+
if (validate) {
|
|
9914
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9915
|
+
return callback();
|
|
9916
|
+
}
|
|
9917
|
+
rules.required(rule, value, source, errors, options);
|
|
9918
|
+
if (value !== void 0) {
|
|
9919
|
+
rules[ENUM](rule, value, source, errors, options);
|
|
9920
|
+
}
|
|
9921
|
+
}
|
|
9922
|
+
callback(errors);
|
|
9923
|
+
};
|
|
9924
|
+
var pattern2 = function pattern3(rule, value, callback, source, options) {
|
|
9925
|
+
var errors = [];
|
|
9926
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9927
|
+
if (validate) {
|
|
9928
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
9929
|
+
return callback();
|
|
9930
|
+
}
|
|
9931
|
+
rules.required(rule, value, source, errors, options);
|
|
9932
|
+
if (!isEmptyValue(value, "string")) {
|
|
9933
|
+
rules.pattern(rule, value, source, errors, options);
|
|
9934
|
+
}
|
|
9935
|
+
}
|
|
9936
|
+
callback(errors);
|
|
9937
|
+
};
|
|
9938
|
+
var date2 = function date3(rule, value, callback, source, options) {
|
|
9939
|
+
var errors = [];
|
|
9940
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9941
|
+
if (validate) {
|
|
9942
|
+
if (isEmptyValue(value, "date") && !rule.required) {
|
|
9943
|
+
return callback();
|
|
9944
|
+
}
|
|
9945
|
+
rules.required(rule, value, source, errors, options);
|
|
9946
|
+
if (!isEmptyValue(value, "date")) {
|
|
9947
|
+
var dateObject;
|
|
9948
|
+
if (value instanceof Date) {
|
|
9949
|
+
dateObject = value;
|
|
9950
|
+
} else {
|
|
9951
|
+
dateObject = new Date(value);
|
|
9952
|
+
}
|
|
9953
|
+
rules.type(rule, dateObject, source, errors, options);
|
|
9954
|
+
if (dateObject) {
|
|
9955
|
+
rules.range(rule, dateObject.getTime(), source, errors, options);
|
|
9956
|
+
}
|
|
9957
|
+
}
|
|
9958
|
+
}
|
|
9959
|
+
callback(errors);
|
|
9960
|
+
};
|
|
9961
|
+
var required2 = function required3(rule, value, callback, source, options) {
|
|
9962
|
+
var errors = [];
|
|
9963
|
+
var type4 = Array.isArray(value) ? "array" : typeof value;
|
|
9964
|
+
rules.required(rule, value, source, errors, options, type4);
|
|
9965
|
+
callback(errors);
|
|
9966
|
+
};
|
|
9967
|
+
var type2 = function type3(rule, value, callback, source, options) {
|
|
9968
|
+
var ruleType = rule.type;
|
|
9969
|
+
var errors = [];
|
|
9970
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9971
|
+
if (validate) {
|
|
9972
|
+
if (isEmptyValue(value, ruleType) && !rule.required) {
|
|
9973
|
+
return callback();
|
|
9974
|
+
}
|
|
9975
|
+
rules.required(rule, value, source, errors, options, ruleType);
|
|
9976
|
+
if (!isEmptyValue(value, ruleType)) {
|
|
9977
|
+
rules.type(rule, value, source, errors, options);
|
|
9978
|
+
}
|
|
9979
|
+
}
|
|
9980
|
+
callback(errors);
|
|
9981
|
+
};
|
|
9982
|
+
var any = function any2(rule, value, callback, source, options) {
|
|
9983
|
+
var errors = [];
|
|
9984
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9985
|
+
if (validate) {
|
|
9986
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9987
|
+
return callback();
|
|
9988
|
+
}
|
|
9989
|
+
rules.required(rule, value, source, errors, options);
|
|
9336
9990
|
}
|
|
9991
|
+
callback(errors);
|
|
9992
|
+
};
|
|
9993
|
+
var validators = {
|
|
9994
|
+
string,
|
|
9995
|
+
method: method2,
|
|
9996
|
+
number: number2,
|
|
9997
|
+
"boolean": _boolean,
|
|
9998
|
+
regexp: regexp2,
|
|
9999
|
+
integer: integer2,
|
|
10000
|
+
"float": floatFn,
|
|
10001
|
+
array: array2,
|
|
10002
|
+
object: object2,
|
|
10003
|
+
"enum": enumerable2,
|
|
10004
|
+
pattern: pattern2,
|
|
10005
|
+
date: date2,
|
|
10006
|
+
url: type2,
|
|
10007
|
+
hex: type2,
|
|
10008
|
+
email: type2,
|
|
10009
|
+
required: required2,
|
|
10010
|
+
any
|
|
10011
|
+
};
|
|
10012
|
+
function newMessages() {
|
|
10013
|
+
return {
|
|
10014
|
+
"default": "Validation error on field %s",
|
|
10015
|
+
required: "%s is required",
|
|
10016
|
+
"enum": "%s must be one of %s",
|
|
10017
|
+
whitespace: "%s cannot be empty",
|
|
10018
|
+
date: {
|
|
10019
|
+
format: "%s date %s is invalid for format %s",
|
|
10020
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
10021
|
+
invalid: "%s date %s is invalid"
|
|
10022
|
+
},
|
|
10023
|
+
types: {
|
|
10024
|
+
string: "%s is not a %s",
|
|
10025
|
+
method: "%s is not a %s (function)",
|
|
10026
|
+
array: "%s is not an %s",
|
|
10027
|
+
object: "%s is not an %s",
|
|
10028
|
+
number: "%s is not a %s",
|
|
10029
|
+
date: "%s is not a %s",
|
|
10030
|
+
"boolean": "%s is not a %s",
|
|
10031
|
+
integer: "%s is not an %s",
|
|
10032
|
+
"float": "%s is not a %s",
|
|
10033
|
+
regexp: "%s is not a valid %s",
|
|
10034
|
+
email: "%s is not a valid %s",
|
|
10035
|
+
url: "%s is not a valid %s",
|
|
10036
|
+
hex: "%s is not a valid %s"
|
|
10037
|
+
},
|
|
10038
|
+
string: {
|
|
10039
|
+
len: "%s must be exactly %s characters",
|
|
10040
|
+
min: "%s must be at least %s characters",
|
|
10041
|
+
max: "%s cannot be longer than %s characters",
|
|
10042
|
+
range: "%s must be between %s and %s characters"
|
|
10043
|
+
},
|
|
10044
|
+
number: {
|
|
10045
|
+
len: "%s must equal %s",
|
|
10046
|
+
min: "%s cannot be less than %s",
|
|
10047
|
+
max: "%s cannot be greater than %s",
|
|
10048
|
+
range: "%s must be between %s and %s"
|
|
10049
|
+
},
|
|
10050
|
+
array: {
|
|
10051
|
+
len: "%s must be exactly %s in length",
|
|
10052
|
+
min: "%s cannot be less than %s in length",
|
|
10053
|
+
max: "%s cannot be greater than %s in length",
|
|
10054
|
+
range: "%s must be between %s and %s in length"
|
|
10055
|
+
},
|
|
10056
|
+
pattern: {
|
|
10057
|
+
mismatch: "%s value %s does not match pattern %s"
|
|
10058
|
+
},
|
|
10059
|
+
clone: function clone() {
|
|
10060
|
+
var cloned = JSON.parse(JSON.stringify(this));
|
|
10061
|
+
cloned.clone = this.clone;
|
|
10062
|
+
return cloned;
|
|
10063
|
+
}
|
|
10064
|
+
};
|
|
9337
10065
|
}
|
|
9338
|
-
|
|
9339
|
-
|
|
10066
|
+
var messages = newMessages();
|
|
10067
|
+
var Schema = /* @__PURE__ */ function() {
|
|
10068
|
+
function Schema2(descriptor) {
|
|
10069
|
+
this.rules = null;
|
|
10070
|
+
this._messages = messages;
|
|
10071
|
+
this.define(descriptor);
|
|
10072
|
+
}
|
|
10073
|
+
var _proto = Schema2.prototype;
|
|
10074
|
+
_proto.define = function define(rules2) {
|
|
10075
|
+
var _this = this;
|
|
10076
|
+
if (!rules2) {
|
|
10077
|
+
throw new Error("Cannot configure a schema with no rules");
|
|
10078
|
+
}
|
|
10079
|
+
if (typeof rules2 !== "object" || Array.isArray(rules2)) {
|
|
10080
|
+
throw new Error("Rules must be an object");
|
|
10081
|
+
}
|
|
10082
|
+
this.rules = {};
|
|
10083
|
+
Object.keys(rules2).forEach(function(name) {
|
|
10084
|
+
var item = rules2[name];
|
|
10085
|
+
_this.rules[name] = Array.isArray(item) ? item : [item];
|
|
10086
|
+
});
|
|
10087
|
+
};
|
|
10088
|
+
_proto.messages = function messages2(_messages) {
|
|
10089
|
+
if (_messages) {
|
|
10090
|
+
this._messages = deepMerge(newMessages(), _messages);
|
|
10091
|
+
}
|
|
10092
|
+
return this._messages;
|
|
10093
|
+
};
|
|
10094
|
+
_proto.validate = function validate(source_, o, oc) {
|
|
10095
|
+
var _this2 = this;
|
|
10096
|
+
if (o === void 0) {
|
|
10097
|
+
o = {};
|
|
10098
|
+
}
|
|
10099
|
+
if (oc === void 0) {
|
|
10100
|
+
oc = function oc2() {
|
|
10101
|
+
};
|
|
10102
|
+
}
|
|
10103
|
+
var source = source_;
|
|
10104
|
+
var options = o;
|
|
10105
|
+
var callback = oc;
|
|
10106
|
+
if (typeof options === "function") {
|
|
10107
|
+
callback = options;
|
|
10108
|
+
options = {};
|
|
10109
|
+
}
|
|
10110
|
+
if (!this.rules || Object.keys(this.rules).length === 0) {
|
|
10111
|
+
if (callback) {
|
|
10112
|
+
callback(null, source);
|
|
10113
|
+
}
|
|
10114
|
+
return Promise.resolve(source);
|
|
10115
|
+
}
|
|
10116
|
+
function complete(results) {
|
|
10117
|
+
var errors = [];
|
|
10118
|
+
var fields = {};
|
|
10119
|
+
function add(e) {
|
|
10120
|
+
if (Array.isArray(e)) {
|
|
10121
|
+
var _errors;
|
|
10122
|
+
errors = (_errors = errors).concat.apply(_errors, e);
|
|
10123
|
+
} else {
|
|
10124
|
+
errors.push(e);
|
|
10125
|
+
}
|
|
10126
|
+
}
|
|
10127
|
+
for (var i = 0; i < results.length; i++) {
|
|
10128
|
+
add(results[i]);
|
|
10129
|
+
}
|
|
10130
|
+
if (!errors.length) {
|
|
10131
|
+
callback(null, source);
|
|
10132
|
+
} else {
|
|
10133
|
+
fields = convertFieldsError(errors);
|
|
10134
|
+
callback(errors, fields);
|
|
10135
|
+
}
|
|
10136
|
+
}
|
|
10137
|
+
if (options.messages) {
|
|
10138
|
+
var messages$1 = this.messages();
|
|
10139
|
+
if (messages$1 === messages) {
|
|
10140
|
+
messages$1 = newMessages();
|
|
10141
|
+
}
|
|
10142
|
+
deepMerge(messages$1, options.messages);
|
|
10143
|
+
options.messages = messages$1;
|
|
10144
|
+
} else {
|
|
10145
|
+
options.messages = this.messages();
|
|
10146
|
+
}
|
|
10147
|
+
var series = {};
|
|
10148
|
+
var keys = options.keys || Object.keys(this.rules);
|
|
10149
|
+
keys.forEach(function(z) {
|
|
10150
|
+
var arr = _this2.rules[z];
|
|
10151
|
+
var value = source[z];
|
|
10152
|
+
arr.forEach(function(r2) {
|
|
10153
|
+
var rule = r2;
|
|
10154
|
+
if (typeof rule.transform === "function") {
|
|
10155
|
+
if (source === source_) {
|
|
10156
|
+
source = _extends({}, source);
|
|
10157
|
+
}
|
|
10158
|
+
value = source[z] = rule.transform(value);
|
|
10159
|
+
}
|
|
10160
|
+
if (typeof rule === "function") {
|
|
10161
|
+
rule = {
|
|
10162
|
+
validator: rule
|
|
10163
|
+
};
|
|
10164
|
+
} else {
|
|
10165
|
+
rule = _extends({}, rule);
|
|
10166
|
+
}
|
|
10167
|
+
rule.validator = _this2.getValidationMethod(rule);
|
|
10168
|
+
if (!rule.validator) {
|
|
10169
|
+
return;
|
|
10170
|
+
}
|
|
10171
|
+
rule.field = z;
|
|
10172
|
+
rule.fullField = rule.fullField || z;
|
|
10173
|
+
rule.type = _this2.getType(rule);
|
|
10174
|
+
series[z] = series[z] || [];
|
|
10175
|
+
series[z].push({
|
|
10176
|
+
rule,
|
|
10177
|
+
value,
|
|
10178
|
+
source,
|
|
10179
|
+
field: z
|
|
10180
|
+
});
|
|
10181
|
+
});
|
|
10182
|
+
});
|
|
10183
|
+
var errorFields = {};
|
|
10184
|
+
return asyncMap(series, options, function(data, doIt) {
|
|
10185
|
+
var rule = data.rule;
|
|
10186
|
+
var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
|
|
10187
|
+
deep = deep && (rule.required || !rule.required && data.value);
|
|
10188
|
+
rule.field = data.field;
|
|
10189
|
+
function addFullField(key, schema) {
|
|
10190
|
+
return _extends({}, schema, {
|
|
10191
|
+
fullField: rule.fullField + "." + key,
|
|
10192
|
+
fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
|
|
10193
|
+
});
|
|
10194
|
+
}
|
|
10195
|
+
function cb(e) {
|
|
10196
|
+
if (e === void 0) {
|
|
10197
|
+
e = [];
|
|
10198
|
+
}
|
|
10199
|
+
var errorList = Array.isArray(e) ? e : [e];
|
|
10200
|
+
if (!options.suppressWarning && errorList.length) {
|
|
10201
|
+
Schema2.warning("async-validator:", errorList);
|
|
10202
|
+
}
|
|
10203
|
+
if (errorList.length && rule.message !== void 0) {
|
|
10204
|
+
errorList = [].concat(rule.message);
|
|
10205
|
+
}
|
|
10206
|
+
var filledErrors = errorList.map(complementError(rule, source));
|
|
10207
|
+
if (options.first && filledErrors.length) {
|
|
10208
|
+
errorFields[rule.field] = 1;
|
|
10209
|
+
return doIt(filledErrors);
|
|
10210
|
+
}
|
|
10211
|
+
if (!deep) {
|
|
10212
|
+
doIt(filledErrors);
|
|
10213
|
+
} else {
|
|
10214
|
+
if (rule.required && !data.value) {
|
|
10215
|
+
if (rule.message !== void 0) {
|
|
10216
|
+
filledErrors = [].concat(rule.message).map(complementError(rule, source));
|
|
10217
|
+
} else if (options.error) {
|
|
10218
|
+
filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
|
|
10219
|
+
}
|
|
10220
|
+
return doIt(filledErrors);
|
|
10221
|
+
}
|
|
10222
|
+
var fieldsSchema = {};
|
|
10223
|
+
if (rule.defaultField) {
|
|
10224
|
+
Object.keys(data.value).map(function(key) {
|
|
10225
|
+
fieldsSchema[key] = rule.defaultField;
|
|
10226
|
+
});
|
|
10227
|
+
}
|
|
10228
|
+
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
|
|
10229
|
+
var paredFieldsSchema = {};
|
|
10230
|
+
Object.keys(fieldsSchema).forEach(function(field) {
|
|
10231
|
+
var fieldSchema = fieldsSchema[field];
|
|
10232
|
+
var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
|
|
10233
|
+
paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
|
|
10234
|
+
});
|
|
10235
|
+
var schema = new Schema2(paredFieldsSchema);
|
|
10236
|
+
schema.messages(options.messages);
|
|
10237
|
+
if (data.rule.options) {
|
|
10238
|
+
data.rule.options.messages = options.messages;
|
|
10239
|
+
data.rule.options.error = options.error;
|
|
10240
|
+
}
|
|
10241
|
+
schema.validate(data.value, data.rule.options || options, function(errs) {
|
|
10242
|
+
var finalErrors = [];
|
|
10243
|
+
if (filledErrors && filledErrors.length) {
|
|
10244
|
+
finalErrors.push.apply(finalErrors, filledErrors);
|
|
10245
|
+
}
|
|
10246
|
+
if (errs && errs.length) {
|
|
10247
|
+
finalErrors.push.apply(finalErrors, errs);
|
|
10248
|
+
}
|
|
10249
|
+
doIt(finalErrors.length ? finalErrors : null);
|
|
10250
|
+
});
|
|
10251
|
+
}
|
|
10252
|
+
}
|
|
10253
|
+
var res;
|
|
10254
|
+
if (rule.asyncValidator) {
|
|
10255
|
+
res = rule.asyncValidator(rule, data.value, cb, data.source, options);
|
|
10256
|
+
} else if (rule.validator) {
|
|
10257
|
+
try {
|
|
10258
|
+
res = rule.validator(rule, data.value, cb, data.source, options);
|
|
10259
|
+
} catch (error) {
|
|
10260
|
+
console.error == null ? void 0 : console.error(error);
|
|
10261
|
+
if (!options.suppressValidatorError) {
|
|
10262
|
+
setTimeout(function() {
|
|
10263
|
+
throw error;
|
|
10264
|
+
}, 0);
|
|
10265
|
+
}
|
|
10266
|
+
cb(error.message);
|
|
10267
|
+
}
|
|
10268
|
+
if (res === true) {
|
|
10269
|
+
cb();
|
|
10270
|
+
} else if (res === false) {
|
|
10271
|
+
cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
|
|
10272
|
+
} else if (res instanceof Array) {
|
|
10273
|
+
cb(res);
|
|
10274
|
+
} else if (res instanceof Error) {
|
|
10275
|
+
cb(res.message);
|
|
10276
|
+
}
|
|
10277
|
+
}
|
|
10278
|
+
if (res && res.then) {
|
|
10279
|
+
res.then(function() {
|
|
10280
|
+
return cb();
|
|
10281
|
+
}, function(e) {
|
|
10282
|
+
return cb(e);
|
|
10283
|
+
});
|
|
10284
|
+
}
|
|
10285
|
+
}, function(results) {
|
|
10286
|
+
complete(results);
|
|
10287
|
+
}, source);
|
|
10288
|
+
};
|
|
10289
|
+
_proto.getType = function getType(rule) {
|
|
10290
|
+
if (rule.type === void 0 && rule.pattern instanceof RegExp) {
|
|
10291
|
+
rule.type = "pattern";
|
|
10292
|
+
}
|
|
10293
|
+
if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
|
|
10294
|
+
throw new Error(format("Unknown rule type %s", rule.type));
|
|
10295
|
+
}
|
|
10296
|
+
return rule.type || "string";
|
|
10297
|
+
};
|
|
10298
|
+
_proto.getValidationMethod = function getValidationMethod(rule) {
|
|
10299
|
+
if (typeof rule.validator === "function") {
|
|
10300
|
+
return rule.validator;
|
|
10301
|
+
}
|
|
10302
|
+
var keys = Object.keys(rule);
|
|
10303
|
+
var messageIndex = keys.indexOf("message");
|
|
10304
|
+
if (messageIndex !== -1) {
|
|
10305
|
+
keys.splice(messageIndex, 1);
|
|
10306
|
+
}
|
|
10307
|
+
if (keys.length === 1 && keys[0] === "required") {
|
|
10308
|
+
return validators.required;
|
|
10309
|
+
}
|
|
10310
|
+
return validators[this.getType(rule)] || void 0;
|
|
10311
|
+
};
|
|
10312
|
+
return Schema2;
|
|
10313
|
+
}();
|
|
10314
|
+
Schema.register = function register(type4, validator) {
|
|
10315
|
+
if (typeof validator !== "function") {
|
|
10316
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
10317
|
+
}
|
|
10318
|
+
validators[type4] = validator;
|
|
10319
|
+
};
|
|
10320
|
+
Schema.warning = warning;
|
|
10321
|
+
Schema.messages = messages;
|
|
10322
|
+
Schema.validators = validators;
|
|
9340
10323
|
class FormStore {
|
|
9341
10324
|
constructor() {
|
|
9342
|
-
|
|
10325
|
+
// 初始化数据
|
|
10326
|
+
__publicField(this, "initialValues", {});
|
|
9343
10327
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
9344
|
-
__publicField(this, "
|
|
10328
|
+
__publicField(this, "store", {});
|
|
9345
10329
|
// 所有的组件实例
|
|
9346
|
-
|
|
10330
|
+
__publicField(this, "fieldEntities", []);
|
|
10331
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
9347
10332
|
__publicField(this, "callbacks", {});
|
|
9348
|
-
__publicField(this, "
|
|
10333
|
+
__publicField(this, "errors", []);
|
|
9349
10334
|
/**
|
|
9350
10335
|
* 注册组件实例
|
|
9351
10336
|
* @param field
|
|
@@ -9354,11 +10339,29 @@ class FormStore {
|
|
|
9354
10339
|
this.fieldEntities.push(field);
|
|
9355
10340
|
return () => {
|
|
9356
10341
|
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
9357
|
-
|
|
10342
|
+
if (this.store) {
|
|
10343
|
+
delete this.store[field.props.name];
|
|
10344
|
+
}
|
|
9358
10345
|
};
|
|
9359
10346
|
});
|
|
10347
|
+
/**
|
|
10348
|
+
* 获取 formItem 的值
|
|
10349
|
+
* @param name
|
|
10350
|
+
*/
|
|
9360
10351
|
__publicField(this, "getFieldValue", (name) => {
|
|
9361
|
-
|
|
10352
|
+
var _a;
|
|
10353
|
+
return (_a = this.store) == null ? void 0 : _a[name];
|
|
10354
|
+
});
|
|
10355
|
+
/**
|
|
10356
|
+
* 设置 form 的初始值,之后在 reset 的时候使用
|
|
10357
|
+
* @param values
|
|
10358
|
+
* @param init
|
|
10359
|
+
*/
|
|
10360
|
+
__publicField(this, "setInitialValues", (values, init) => {
|
|
10361
|
+
if (init) {
|
|
10362
|
+
this.initialValues = values;
|
|
10363
|
+
this.store = values;
|
|
10364
|
+
}
|
|
9362
10365
|
});
|
|
9363
10366
|
/**
|
|
9364
10367
|
* 存储组件数据
|
|
@@ -9373,74 +10376,78 @@ class FormStore {
|
|
|
9373
10376
|
const { name } = enetity.props;
|
|
9374
10377
|
Object.keys(newStore).forEach((key) => {
|
|
9375
10378
|
if (key === name) {
|
|
9376
|
-
enetity.onStoreChange();
|
|
10379
|
+
enetity.onStoreChange("update");
|
|
9377
10380
|
}
|
|
9378
10381
|
});
|
|
9379
10382
|
});
|
|
9380
10383
|
});
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
* required: true,
|
|
9388
|
-
* validator: (rule, value) => {
|
|
9389
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
9390
|
-
* },
|
|
9391
|
-
* },
|
|
9392
|
-
* }
|
|
9393
|
-
*/
|
|
10384
|
+
__publicField(this, "setCallback", (callback) => {
|
|
10385
|
+
this.callbacks = {
|
|
10386
|
+
...this.callbacks,
|
|
10387
|
+
...callback
|
|
10388
|
+
};
|
|
10389
|
+
});
|
|
9394
10390
|
__publicField(this, "validate", () => {
|
|
9395
10391
|
const err = [];
|
|
9396
|
-
this.
|
|
10392
|
+
this.errors.length = 0;
|
|
9397
10393
|
this.fieldEntities.forEach((entity) => {
|
|
9398
|
-
|
|
10394
|
+
var _a;
|
|
10395
|
+
const { name, rules: rules2 = [] } = entity.props;
|
|
9399
10396
|
const descriptor = {};
|
|
9400
|
-
if (
|
|
9401
|
-
if (
|
|
10397
|
+
if (rules2.length) {
|
|
10398
|
+
if (rules2.length > 1) {
|
|
9402
10399
|
descriptor[name] = [];
|
|
9403
|
-
|
|
10400
|
+
rules2.forEach((v) => {
|
|
9404
10401
|
descriptor[name].push(v);
|
|
9405
10402
|
});
|
|
9406
10403
|
} else {
|
|
9407
|
-
descriptor[name] =
|
|
10404
|
+
descriptor[name] = rules2[0];
|
|
9408
10405
|
}
|
|
9409
10406
|
}
|
|
10407
|
+
const validator = new Schema(descriptor);
|
|
10408
|
+
validator.messages();
|
|
10409
|
+
validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] }, (errors) => {
|
|
10410
|
+
if (errors) {
|
|
10411
|
+
err.push(...errors);
|
|
10412
|
+
this.errors.push(...errors);
|
|
10413
|
+
}
|
|
10414
|
+
entity.onStoreChange("validate");
|
|
10415
|
+
});
|
|
9410
10416
|
});
|
|
9411
10417
|
return err;
|
|
9412
10418
|
});
|
|
9413
|
-
__publicField(this, "setCallback", (callback) => {
|
|
9414
|
-
this.callbacks = {
|
|
9415
|
-
...this.callbacks,
|
|
9416
|
-
...callback
|
|
9417
|
-
};
|
|
9418
|
-
});
|
|
9419
10419
|
__publicField(this, "submit", () => {
|
|
9420
10420
|
var _a, _b, _c, _d;
|
|
9421
|
-
const
|
|
9422
|
-
if (
|
|
10421
|
+
const errors = this.validate();
|
|
10422
|
+
if (errors.length === 0) {
|
|
9423
10423
|
(_b = (_a = this.callbacks).onFinish) == null ? void 0 : _b.call(_a, this.store);
|
|
9424
|
-
} else if (
|
|
9425
|
-
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c,
|
|
10424
|
+
} else if (errors.length > 0) {
|
|
10425
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
|
|
9426
10426
|
}
|
|
9427
10427
|
});
|
|
9428
10428
|
__publicField(this, "resetFields", () => {
|
|
10429
|
+
this.errors.length = 0;
|
|
10430
|
+
this.store = this.initialValues;
|
|
10431
|
+
this.fieldEntities.forEach((entity) => {
|
|
10432
|
+
entity.onStoreChange("reset");
|
|
10433
|
+
});
|
|
9429
10434
|
});
|
|
9430
10435
|
__publicField(this, "getForm", () => {
|
|
9431
10436
|
return {
|
|
10437
|
+
setInitialValues: this.setInitialValues,
|
|
9432
10438
|
setCallback: this.setCallback,
|
|
9433
10439
|
registerField: this.registerField,
|
|
9434
10440
|
getFieldValue: this.getFieldValue,
|
|
9435
10441
|
setFieldsValue: this.setFieldsValue,
|
|
10442
|
+
resetFields: this.resetFields,
|
|
9436
10443
|
submit: this.submit,
|
|
9437
10444
|
store: this.store,
|
|
9438
|
-
|
|
10445
|
+
errors: this.errors,
|
|
9439
10446
|
fieldEntities: this.fieldEntities
|
|
9440
10447
|
};
|
|
9441
10448
|
});
|
|
9442
10449
|
this.callbacks = {
|
|
9443
|
-
onFinish: (
|
|
10450
|
+
onFinish: () => {
|
|
9444
10451
|
},
|
|
9445
10452
|
onFinishFailed: () => {
|
|
9446
10453
|
}
|
|
@@ -9459,60 +10466,209 @@ const useForm = (form) => {
|
|
|
9459
10466
|
}
|
|
9460
10467
|
return [formRef.current];
|
|
9461
10468
|
};
|
|
10469
|
+
function isForwardRefComponent(component) {
|
|
10470
|
+
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
10471
|
+
React.forwardRef(
|
|
10472
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10473
|
+
// @ts-ignore
|
|
10474
|
+
() => {
|
|
10475
|
+
}
|
|
10476
|
+
).$$typeof === component.type.$$typeof;
|
|
10477
|
+
}
|
|
10478
|
+
const defaultProps$W = {
|
|
10479
|
+
...ComponentDefaults,
|
|
10480
|
+
required: false,
|
|
10481
|
+
name: "",
|
|
10482
|
+
label: "",
|
|
10483
|
+
rules: [{ required: false, message: "" }],
|
|
10484
|
+
errorMessageAlign: "left"
|
|
10485
|
+
};
|
|
10486
|
+
class FormItem extends React.Component {
|
|
10487
|
+
constructor(props) {
|
|
10488
|
+
super(props);
|
|
10489
|
+
__publicField(this, "cancelRegister");
|
|
10490
|
+
__publicField(this, "componentRef");
|
|
10491
|
+
// children添加value属性和onChange事件
|
|
10492
|
+
__publicField(this, "getControlled", (children) => {
|
|
10493
|
+
var _a;
|
|
10494
|
+
const { setFieldsValue, getFieldValue } = this.context;
|
|
10495
|
+
const { name } = this.props;
|
|
10496
|
+
if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) {
|
|
10497
|
+
console.warn("通过 initialValue 设置初始值");
|
|
10498
|
+
}
|
|
10499
|
+
const controlled = {
|
|
10500
|
+
...children.props,
|
|
10501
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) || this.props.initialValue,
|
|
10502
|
+
[this.props.trigger || "onChange"]: (...args) => {
|
|
10503
|
+
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
10504
|
+
if (originOnChange) {
|
|
10505
|
+
originOnChange(...args);
|
|
10506
|
+
}
|
|
10507
|
+
let [next] = args;
|
|
10508
|
+
if (this.props.getValueFromEvent) {
|
|
10509
|
+
next = this.props.getValueFromEvent(...args);
|
|
10510
|
+
}
|
|
10511
|
+
setFieldsValue({ [name]: next });
|
|
10512
|
+
}
|
|
10513
|
+
};
|
|
10514
|
+
if (isForwardRefComponent(children)) {
|
|
10515
|
+
controlled.ref = (componentInstance) => {
|
|
10516
|
+
const originRef = children.ref;
|
|
10517
|
+
if (originRef) {
|
|
10518
|
+
if (typeof originRef === "function") {
|
|
10519
|
+
originRef(componentInstance);
|
|
10520
|
+
}
|
|
10521
|
+
if ("current" in originRef) {
|
|
10522
|
+
originRef.current = componentInstance;
|
|
10523
|
+
}
|
|
10524
|
+
}
|
|
10525
|
+
this.componentRef = componentInstance;
|
|
10526
|
+
};
|
|
10527
|
+
}
|
|
10528
|
+
return controlled;
|
|
10529
|
+
});
|
|
10530
|
+
__publicField(this, "refresh", () => {
|
|
10531
|
+
this.setState(({ resetCount }) => ({
|
|
10532
|
+
resetCount: resetCount + 1
|
|
10533
|
+
}));
|
|
10534
|
+
});
|
|
10535
|
+
__publicField(this, "onStoreChange", (type4) => {
|
|
10536
|
+
if (type4 === "reset") {
|
|
10537
|
+
this.refresh();
|
|
10538
|
+
} else {
|
|
10539
|
+
this.forceUpdate();
|
|
10540
|
+
}
|
|
10541
|
+
});
|
|
10542
|
+
__publicField(this, "renderLayout", (childNode) => {
|
|
10543
|
+
var _a, _b;
|
|
10544
|
+
const { label, name, required: required4, className, style, errorMessageAlign } = {
|
|
10545
|
+
...defaultProps$W,
|
|
10546
|
+
...this.props
|
|
10547
|
+
};
|
|
10548
|
+
const item = ((_a = this.context.errors) == null ? void 0 : _a.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
10549
|
+
return item2.field === name;
|
|
10550
|
+
}));
|
|
10551
|
+
const { starPosition } = this.context;
|
|
10552
|
+
const renderStar = required4 && /* @__PURE__ */ React.createElement("i", { className: "required" });
|
|
10553
|
+
const renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
|
|
10554
|
+
return /* @__PURE__ */ React.createElement(
|
|
10555
|
+
Cell,
|
|
10556
|
+
{
|
|
10557
|
+
className: `nut-form-item ${className}`,
|
|
10558
|
+
style,
|
|
10559
|
+
onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
|
|
10560
|
+
},
|
|
10561
|
+
label ? /* @__PURE__ */ React.createElement("div", { className: "nut-cell__title nut-form-item__label" }, renderLabel) : null,
|
|
10562
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-cell__value nut-form-item__body" }, /* @__PURE__ */ React.createElement("div", { className: "nut-form-item__body__slots" }, childNode), item.length > 0 && /* @__PURE__ */ React.createElement(
|
|
10563
|
+
"div",
|
|
10564
|
+
{
|
|
10565
|
+
className: "nut-form-item__body__tips",
|
|
10566
|
+
style: { textAlign: errorMessageAlign }
|
|
10567
|
+
},
|
|
10568
|
+
item[0].message
|
|
10569
|
+
))
|
|
10570
|
+
);
|
|
10571
|
+
});
|
|
10572
|
+
this.componentRef = React.createRef();
|
|
10573
|
+
this.state = {
|
|
10574
|
+
resetCount: 1
|
|
10575
|
+
};
|
|
10576
|
+
}
|
|
10577
|
+
componentDidMount() {
|
|
10578
|
+
this.cancelRegister = this.context.registerField(this);
|
|
10579
|
+
}
|
|
10580
|
+
componentWillUnmount() {
|
|
10581
|
+
if (this.cancelRegister) {
|
|
10582
|
+
this.cancelRegister();
|
|
10583
|
+
}
|
|
10584
|
+
}
|
|
10585
|
+
render() {
|
|
10586
|
+
const { children } = this.props;
|
|
10587
|
+
const child = Array.isArray(children) ? children[0] : children;
|
|
10588
|
+
const returnChildNode = React.cloneElement(
|
|
10589
|
+
child,
|
|
10590
|
+
this.getControlled(child)
|
|
10591
|
+
);
|
|
10592
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
10593
|
+
}
|
|
10594
|
+
}
|
|
10595
|
+
__publicField(FormItem, "defaultProps", defaultProps$W);
|
|
10596
|
+
__publicField(FormItem, "contextType", Context);
|
|
9462
10597
|
const defaultProps$V = {
|
|
9463
10598
|
...ComponentDefaults,
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
labelPosition: "Right",
|
|
9468
|
-
formGroupTitle: "",
|
|
9469
|
-
onFinish: (obj) => {
|
|
9470
|
-
},
|
|
9471
|
-
onFinishFailed: (value) => {
|
|
10599
|
+
labelPosition: "right",
|
|
10600
|
+
starPosition: "left",
|
|
10601
|
+
onFinish: (values) => {
|
|
9472
10602
|
},
|
|
9473
|
-
|
|
10603
|
+
onFinishFailed: (values, errorFields) => {
|
|
10604
|
+
}
|
|
9474
10605
|
};
|
|
9475
10606
|
const PositionInfo = {
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
10607
|
+
top: "form-layout-top",
|
|
10608
|
+
left: "form-layout-left",
|
|
10609
|
+
right: "form-layout-right"
|
|
9479
10610
|
};
|
|
9480
10611
|
const Form = (props) => {
|
|
10612
|
+
const classPrefix2 = "nut-form";
|
|
9481
10613
|
const {
|
|
10614
|
+
className,
|
|
10615
|
+
style,
|
|
10616
|
+
footer,
|
|
9482
10617
|
children,
|
|
10618
|
+
initialValues,
|
|
9483
10619
|
onFinish,
|
|
9484
10620
|
onFinishFailed,
|
|
9485
10621
|
labelPosition,
|
|
9486
|
-
|
|
9487
|
-
|
|
10622
|
+
starPosition,
|
|
10623
|
+
form
|
|
9488
10624
|
} = {
|
|
9489
10625
|
...defaultProps$V,
|
|
9490
10626
|
...props
|
|
9491
10627
|
};
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
10628
|
+
let formInstance;
|
|
10629
|
+
if (form !== void 0) {
|
|
10630
|
+
formInstance = form;
|
|
10631
|
+
} else {
|
|
10632
|
+
[formInstance] = useForm();
|
|
10633
|
+
}
|
|
10634
|
+
formInstance.starPosition = starPosition;
|
|
10635
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
9496
10636
|
setCallback({
|
|
9497
10637
|
onFinish,
|
|
9498
10638
|
onFinishFailed
|
|
9499
10639
|
});
|
|
10640
|
+
const mountRef = React.useRef(false);
|
|
10641
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
10642
|
+
if (!mountRef.current) {
|
|
10643
|
+
mountRef.current = true;
|
|
10644
|
+
}
|
|
9500
10645
|
return /* @__PURE__ */ React.createElement(
|
|
9501
10646
|
"form",
|
|
9502
10647
|
{
|
|
9503
|
-
className:
|
|
9504
|
-
|
|
10648
|
+
className: classNames(
|
|
10649
|
+
classPrefix2,
|
|
10650
|
+
className,
|
|
10651
|
+
PositionInfo[labelPosition]
|
|
10652
|
+
),
|
|
10653
|
+
style,
|
|
9505
10654
|
onSubmit: (e) => {
|
|
9506
10655
|
e.preventDefault();
|
|
10656
|
+
e.stopPropagation();
|
|
9507
10657
|
submit();
|
|
10658
|
+
},
|
|
10659
|
+
onReset: (e) => {
|
|
10660
|
+
e.preventDefault();
|
|
10661
|
+
e.stopPropagation();
|
|
10662
|
+
resetFields();
|
|
9508
10663
|
}
|
|
9509
10664
|
},
|
|
9510
|
-
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(
|
|
10665
|
+
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
9511
10666
|
);
|
|
9512
10667
|
};
|
|
9513
10668
|
Form.defaultProps = defaultProps$V;
|
|
9514
10669
|
Form.displayName = "NutForm";
|
|
9515
10670
|
Form.Item = FormItem;
|
|
10671
|
+
Form.useForm = useForm;
|
|
9516
10672
|
function trimExtraChar(value, char, regExp) {
|
|
9517
10673
|
const index = value.indexOf(char);
|
|
9518
10674
|
if (index === -1) {
|
|
@@ -9557,7 +10713,7 @@ const Input = forwardRef(
|
|
|
9557
10713
|
(props, ref) => {
|
|
9558
10714
|
const { locale } = useConfig$1();
|
|
9559
10715
|
const {
|
|
9560
|
-
type,
|
|
10716
|
+
type: type4,
|
|
9561
10717
|
name,
|
|
9562
10718
|
placeholder,
|
|
9563
10719
|
align,
|
|
@@ -9619,10 +10775,10 @@ const Input = forwardRef(
|
|
|
9619
10775
|
const updateValue = (value2, trigger = "onChange") => {
|
|
9620
10776
|
let val = value2;
|
|
9621
10777
|
if (getEnv() === ENV_TYPE.WEB) {
|
|
9622
|
-
if (
|
|
10778
|
+
if (type4 === "number") {
|
|
9623
10779
|
val = formatNumber(val, false, true);
|
|
9624
10780
|
}
|
|
9625
|
-
if (
|
|
10781
|
+
if (type4 === "digit") {
|
|
9626
10782
|
val = formatNumber(val, true, true);
|
|
9627
10783
|
}
|
|
9628
10784
|
}
|
|
@@ -9651,18 +10807,18 @@ const Input = forwardRef(
|
|
|
9651
10807
|
setActive(false);
|
|
9652
10808
|
}, 50);
|
|
9653
10809
|
};
|
|
9654
|
-
const inputType = (
|
|
10810
|
+
const inputType = (type22) => {
|
|
9655
10811
|
if (getEnv() === ENV_TYPE.WEB) {
|
|
9656
|
-
if (
|
|
10812
|
+
if (type22 === "digit") {
|
|
9657
10813
|
return "text";
|
|
9658
10814
|
}
|
|
9659
|
-
if (
|
|
10815
|
+
if (type22 === "number") {
|
|
9660
10816
|
return "tel";
|
|
9661
10817
|
}
|
|
9662
|
-
} else if (
|
|
10818
|
+
} else if (type22 === "password") {
|
|
9663
10819
|
return "text";
|
|
9664
10820
|
}
|
|
9665
|
-
return
|
|
10821
|
+
return type22;
|
|
9666
10822
|
};
|
|
9667
10823
|
return /* @__PURE__ */ React.createElement(
|
|
9668
10824
|
View,
|
|
@@ -9681,8 +10837,8 @@ const Input = forwardRef(
|
|
|
9681
10837
|
className: "nut-input-native",
|
|
9682
10838
|
ref: inputRef,
|
|
9683
10839
|
style: { textAlign: align },
|
|
9684
|
-
type: inputType(
|
|
9685
|
-
password:
|
|
10840
|
+
type: inputType(type4),
|
|
10841
|
+
password: type4 === "password",
|
|
9686
10842
|
maxlength: maxLength,
|
|
9687
10843
|
placeholder: placeholder || locale.placeholder,
|
|
9688
10844
|
disabled: disabled || readOnly,
|
|
@@ -9729,7 +10885,7 @@ const defaultProps$T = {
|
|
|
9729
10885
|
disabled: false,
|
|
9730
10886
|
min: 1,
|
|
9731
10887
|
max: 9999,
|
|
9732
|
-
|
|
10888
|
+
readOnly: false,
|
|
9733
10889
|
allowEmpty: false,
|
|
9734
10890
|
defaultValue: 0,
|
|
9735
10891
|
step: 1,
|
|
@@ -9743,7 +10899,7 @@ const InputNumber = (props) => {
|
|
|
9743
10899
|
disabled,
|
|
9744
10900
|
min,
|
|
9745
10901
|
max,
|
|
9746
|
-
|
|
10902
|
+
readOnly,
|
|
9747
10903
|
value,
|
|
9748
10904
|
defaultValue,
|
|
9749
10905
|
allowEmpty,
|
|
@@ -9898,14 +11054,14 @@ const InputNumber = (props) => {
|
|
|
9898
11054
|
const focusValue = (e) => {
|
|
9899
11055
|
if (disabled)
|
|
9900
11056
|
return;
|
|
9901
|
-
if (
|
|
11057
|
+
if (readOnly)
|
|
9902
11058
|
return;
|
|
9903
11059
|
onFocus && onFocus(e);
|
|
9904
11060
|
};
|
|
9905
11061
|
const burValue = (e) => {
|
|
9906
11062
|
if (disabled)
|
|
9907
11063
|
return;
|
|
9908
|
-
if (
|
|
11064
|
+
if (readOnly)
|
|
9909
11065
|
return;
|
|
9910
11066
|
const input = e.target;
|
|
9911
11067
|
let value2 = +input.value;
|
|
@@ -9927,7 +11083,7 @@ const InputNumber = (props) => {
|
|
|
9927
11083
|
min,
|
|
9928
11084
|
max,
|
|
9929
11085
|
disabled,
|
|
9930
|
-
readOnly
|
|
11086
|
+
readOnly,
|
|
9931
11087
|
value: _checked,
|
|
9932
11088
|
onInput: changeFormatValue,
|
|
9933
11089
|
onBlur: burFormatValue,
|
|
@@ -9940,7 +11096,7 @@ const InputNumber = (props) => {
|
|
|
9940
11096
|
min,
|
|
9941
11097
|
max,
|
|
9942
11098
|
disabled,
|
|
9943
|
-
readOnly
|
|
11099
|
+
readOnly,
|
|
9944
11100
|
value: _checked,
|
|
9945
11101
|
onInput: changeValue,
|
|
9946
11102
|
onBlur: burValue,
|
|
@@ -10298,7 +11454,7 @@ const NumberKeyboard = (props) => {
|
|
|
10298
11454
|
title,
|
|
10299
11455
|
confirmText,
|
|
10300
11456
|
visible,
|
|
10301
|
-
type,
|
|
11457
|
+
type: type4,
|
|
10302
11458
|
custom,
|
|
10303
11459
|
random,
|
|
10304
11460
|
style,
|
|
@@ -10337,7 +11493,7 @@ const NumberKeyboard = (props) => {
|
|
|
10337
11493
|
};
|
|
10338
11494
|
const keysList = useMemo(() => {
|
|
10339
11495
|
return [...getBasicKeys(), ...getCustomKeys()];
|
|
10340
|
-
}, [
|
|
11496
|
+
}, [type4, random, custom]);
|
|
10341
11497
|
const DeleteIcon = () => {
|
|
10342
11498
|
const style2 = {
|
|
10343
11499
|
background: `url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAnCAYAAABJ0cukAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozOUNBQTQ0MkY3RTMxMUVBQjIzNEJCQkYxNDZGQjg5OCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozOUNBQTQ0M0Y3RTMxMUVBQjIzNEJCQkYxNDZGQjg5OCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjM5Q0FBNDQwRjdFMzExRUFCMjM0QkJCRjE0NkZCODk4IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM5Q0FBNDQxRjdFMzExRUFCMjM0QkJCRjE0NkZCODk4Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+T12ahwAABClJREFUeNrUWVtIFFEY3pkdrbaCiAINK81VW3d2102pjKLtoXoJrNAswoeEXoyilx7sJXvIh6CHAoMg6yEfSpdECIqE0jCMbMm9qCVYUmR5S8huXmZO39nWOI7mzsy6uzqgM/vvzNnv+y/n/84ZjhBiWMwHF+kA+fn5y0ZHRzNwuTomgDnui9/vfzMvBJxWa7bE87W4tMbY8S8MhNz0BQLVugnY7fZdGORZPNNHJmSPUSf47QD/PN75z3NcpqD1IVEU8wC+dZojDIajyMu6WAG322zBmQf/7LzGnHeAdRtjmuAIKYoleMWxQnUEHA6HVZLldsb0m3oehdQQzzQSVILPJLIcYEw/4HkK/kG86yAsAZvNtgng3059hte/Gf56/uFCaGR8mIJdj3m2hzGNGAkpRM4vCPBzErBYLMko2A//DIQMoQ0WtgcCjWFnCVGswEzxCecqLc0y9Nyww2ariYhAbm7umgRB6GNM/QTgfT7fEzWD4t7dOK0D4TKAcrtcLkENeNx/gUoSpOnx4Gc9BHJyclZNjI8PMqY+judp2jSr1iuENDPi5fDX4WG32WxeogL81NGRIEk3NBNAh10uS9IIY/oIbxR6vd4WLXmJAq9Ayl1kTAUmk8mNyJrUgDfK8hFPV9dnTQSCHiLkO/Ndb8jzrXqKawYJQg4gsu6srKyV4cC/7ujo1CqneRSPxNh74PligPdE3PYVIDHuY6PRWCxPTp7VC35KSvwjwBpwdPP4gXYc86ZdZnr6Pf7S9HqexUs9z0qBLprz8wn+PzWRFknaKGsgjwlvCdLGH42GQ0lg+dqkMP+Enj+lF/yMWYgnJD1qEhhphOWgS2E2yQZDJWa/lEgIvGIa0D2HKJZGA7yiBgaZqO9AermdFstGXQR8fn+BootW4wfPRBE8zXmXoia2SYLgpsJRVwqBBJ2N+pnueRVhPR8l8MGCnaWw8wDCDSWQoasGQCKJnpjGcwkkKqMBfo7ZyQklQCOxWVcRg4QDXmhkSJRjsGvRAD8HCTuNhNPpXKtLzHn9/n0orBqm052GvL2lcfepTMs8PwsJqyRJRbrlNFpBCUBcYWaKE2h4tampqUtV6pP60HNtapuUksTY2NidiLcWUQPnMOhlxvQoITGxxOPxDIVdR2dnb/V2dr7Umn50/Q31261JC4UhUQYSVUxdtPCCUAK10RuvZeQ0LRQ2tD7fddxdyuT3TijJehATF/yinqmJ2wB+jCGRA11TH9xiXAwEQpG4i0gcZHLPjHSqF0Vx76IgEIpEA9a7+3H5K2RK4jnuPvTToXgR0LW9Htpap71iAzPVNsUIMH0XMdXkfLrfD9BdanifksiKW/5w3Emj3mcHBgb6kpKTn6KYzfBCehzg10H6lHPzMdIWq9U8znEpsXE6N4rTO9TjSGgPanG/pfwjwABn1PZcM5XI0AAAAABJRU5ErkJggg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTkwMjA5MzIyMjIxMzkzMzc2NzAwNjg0MC0tDQo=') no-repeat center`,
|
|
@@ -10398,7 +11554,7 @@ const NumberKeyboard = (props) => {
|
|
|
10398
11554
|
overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
|
|
10399
11555
|
...rest
|
|
10400
11556
|
},
|
|
10401
|
-
/* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix2, className), style }, title && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__header` }, /* @__PURE__ */ React.createElement("h3", { className: `${classPrefix2}__header__title` }, title),
|
|
11557
|
+
/* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix2, className), style }, title && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__header` }, /* @__PURE__ */ React.createElement("h3", { className: `${classPrefix2}__header__title` }, title), type4 === "default" && /* @__PURE__ */ React.createElement(
|
|
10402
11558
|
"span",
|
|
10403
11559
|
{
|
|
10404
11560
|
className: `${classPrefix2}__header__close`,
|
|
@@ -10407,7 +11563,7 @@ const NumberKeyboard = (props) => {
|
|
|
10407
11563
|
locale.done
|
|
10408
11564
|
)), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__body` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__body__keys` }, keysList == null ? void 0 : keysList.map((item) => {
|
|
10409
11565
|
return /* @__PURE__ */ React.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
10410
|
-
})),
|
|
11566
|
+
})), type4 === "rightColumn" && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__sidebar` }, /* @__PURE__ */ React.createElement(
|
|
10411
11567
|
NumberKeyboardKey,
|
|
10412
11568
|
{
|
|
10413
11569
|
key: "delete",
|
|
@@ -10643,7 +11799,7 @@ const defaultProps$N = {
|
|
|
10643
11799
|
const Range = (props) => {
|
|
10644
11800
|
const {
|
|
10645
11801
|
className,
|
|
10646
|
-
range,
|
|
11802
|
+
range: range3,
|
|
10647
11803
|
disabled,
|
|
10648
11804
|
button,
|
|
10649
11805
|
vertical,
|
|
@@ -10701,7 +11857,7 @@ const Range = (props) => {
|
|
|
10701
11857
|
const classPrefix22 = "nut-range-mark";
|
|
10702
11858
|
let lowerBound = min;
|
|
10703
11859
|
let upperBound = max;
|
|
10704
|
-
if (
|
|
11860
|
+
if (range3 && Array.isArray(current)) {
|
|
10705
11861
|
lowerBound = current[0];
|
|
10706
11862
|
upperBound = current[1];
|
|
10707
11863
|
} else {
|
|
@@ -10713,10 +11869,10 @@ const Range = (props) => {
|
|
|
10713
11869
|
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
10714
11870
|
].join(" ");
|
|
10715
11871
|
},
|
|
10716
|
-
[
|
|
11872
|
+
[range3, current, min, max]
|
|
10717
11873
|
);
|
|
10718
11874
|
const isRange = (val) => {
|
|
10719
|
-
return !!
|
|
11875
|
+
return !!range3 && Array.isArray(val);
|
|
10720
11876
|
};
|
|
10721
11877
|
const calcMainAxis = () => {
|
|
10722
11878
|
const modelVal = current;
|
|
@@ -10758,12 +11914,12 @@ const Range = (props) => {
|
|
|
10758
11914
|
return style;
|
|
10759
11915
|
};
|
|
10760
11916
|
const tickClass = (mark) => {
|
|
10761
|
-
if (
|
|
11917
|
+
if (range3 && Array.isArray(current)) {
|
|
10762
11918
|
return mark <= current[1] && mark >= current[0];
|
|
10763
11919
|
}
|
|
10764
11920
|
return mark <= current;
|
|
10765
11921
|
};
|
|
10766
|
-
const
|
|
11922
|
+
const format2 = (value2) => {
|
|
10767
11923
|
value2 = Math.max(+min, Math.min(value2, +max));
|
|
10768
11924
|
return Math.round(value2 / +step) * +step;
|
|
10769
11925
|
};
|
|
@@ -10778,9 +11934,9 @@ const Range = (props) => {
|
|
|
10778
11934
|
};
|
|
10779
11935
|
const updateValue = (value2, end) => {
|
|
10780
11936
|
if (isRange(value2)) {
|
|
10781
|
-
value2 = handleOverlap(value2).map(
|
|
11937
|
+
value2 = handleOverlap(value2).map(format2);
|
|
10782
11938
|
} else {
|
|
10783
|
-
value2 =
|
|
11939
|
+
value2 = format2(value2);
|
|
10784
11940
|
}
|
|
10785
11941
|
if (!isSameValue(value2, current)) {
|
|
10786
11942
|
setCurrent(value2);
|
|
@@ -10820,9 +11976,9 @@ const Range = (props) => {
|
|
|
10820
11976
|
touch.start(event);
|
|
10821
11977
|
setEaxctValue(current);
|
|
10822
11978
|
if (isRange(current)) {
|
|
10823
|
-
setStartValue(current.map(
|
|
11979
|
+
setStartValue(current.map(format2));
|
|
10824
11980
|
} else {
|
|
10825
|
-
setStartValue(
|
|
11981
|
+
setStartValue(format2(current));
|
|
10826
11982
|
}
|
|
10827
11983
|
setDragStatus("start");
|
|
10828
11984
|
};
|
|
@@ -10889,7 +12045,7 @@ const Range = (props) => {
|
|
|
10889
12045
|
}
|
|
10890
12046
|
)
|
|
10891
12047
|
);
|
|
10892
|
-
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() },
|
|
12048
|
+
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range3 ? [0, 1].map((item, index) => {
|
|
10893
12049
|
return /* @__PURE__ */ React.createElement(
|
|
10894
12050
|
"div",
|
|
10895
12051
|
{
|
|
@@ -11107,7 +12263,7 @@ const SearchBar = (props) => {
|
|
|
11107
12263
|
return /* @__PURE__ */ React.createElement(
|
|
11108
12264
|
"input",
|
|
11109
12265
|
{
|
|
11110
|
-
className: `${classPrefix2}__input ${
|
|
12266
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
11111
12267
|
ref: searchRef,
|
|
11112
12268
|
style: { ...props.style },
|
|
11113
12269
|
value: value || "",
|
|
@@ -11179,7 +12335,16 @@ const SearchBar = (props) => {
|
|
|
11179
12335
|
style: { ...props.style }
|
|
11180
12336
|
},
|
|
11181
12337
|
renderLeft(),
|
|
11182
|
-
/* @__PURE__ */ React.createElement(
|
|
12338
|
+
/* @__PURE__ */ React.createElement(
|
|
12339
|
+
"div",
|
|
12340
|
+
{
|
|
12341
|
+
className: `${classPrefix2}__content ${shape === "round" ? `${classPrefix2}__round` : ""}`
|
|
12342
|
+
},
|
|
12343
|
+
renderLeftIn(),
|
|
12344
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-searchbar__input-box" }, renderField()),
|
|
12345
|
+
renderRightIn(),
|
|
12346
|
+
clearable && value && handleClear()
|
|
12347
|
+
),
|
|
11183
12348
|
renderRight()
|
|
11184
12349
|
);
|
|
11185
12350
|
};
|
|
@@ -11229,7 +12394,7 @@ const ShortPassword = (props) => {
|
|
|
11229
12394
|
const comLen = useMemo(() => {
|
|
11230
12395
|
return Math.min(Math.max(4, length || 4), 6);
|
|
11231
12396
|
}, [length]);
|
|
11232
|
-
const
|
|
12397
|
+
const format2 = (val) => {
|
|
11233
12398
|
return val.slice(0, comLen);
|
|
11234
12399
|
};
|
|
11235
12400
|
const [inputValue, setInputValue] = usePropsValue({ value, onChange });
|
|
@@ -11239,11 +12404,11 @@ const ShortPassword = (props) => {
|
|
|
11239
12404
|
}
|
|
11240
12405
|
}, [visible]);
|
|
11241
12406
|
useEffect(() => {
|
|
11242
|
-
const val =
|
|
12407
|
+
const val = format2(value);
|
|
11243
12408
|
if (val.length >= comLen) {
|
|
11244
12409
|
onComplete && onComplete(val);
|
|
11245
12410
|
}
|
|
11246
|
-
setInputValue(
|
|
12411
|
+
setInputValue(format2(value));
|
|
11247
12412
|
}, [value]);
|
|
11248
12413
|
const sure = () => {
|
|
11249
12414
|
onConfirm && onConfirm(inputValue);
|
|
@@ -11291,7 +12456,7 @@ const defaultProps$J = {
|
|
|
11291
12456
|
const InternalSignature = (props, ref) => {
|
|
11292
12457
|
const {
|
|
11293
12458
|
canvasId,
|
|
11294
|
-
type,
|
|
12459
|
+
type: type4,
|
|
11295
12460
|
lineWidth,
|
|
11296
12461
|
strokeStyle,
|
|
11297
12462
|
className,
|
|
@@ -11519,7 +12684,7 @@ const TextArea = (props) => {
|
|
|
11519
12684
|
} = { ...defaultProps$H, ...props };
|
|
11520
12685
|
const classPrefix2 = "nut-textarea";
|
|
11521
12686
|
const compositionRef = useRef(false);
|
|
11522
|
-
const
|
|
12687
|
+
const format2 = (value2) => {
|
|
11523
12688
|
if (maxLength !== void 0 && value2.length > maxLength) {
|
|
11524
12689
|
return value2.substring(0, maxLength);
|
|
11525
12690
|
}
|
|
@@ -11528,14 +12693,14 @@ const TextArea = (props) => {
|
|
|
11528
12693
|
const [inputValue, setInputValue] = usePropsValue({
|
|
11529
12694
|
value,
|
|
11530
12695
|
defaultValue,
|
|
11531
|
-
finalValue:
|
|
12696
|
+
finalValue: format2(defaultValue),
|
|
11532
12697
|
onChange
|
|
11533
12698
|
});
|
|
11534
12699
|
const handleChange = (event) => {
|
|
11535
12700
|
var _a;
|
|
11536
12701
|
const text = (_a = event == null ? void 0 : event.detail) == null ? void 0 : _a.value;
|
|
11537
12702
|
if (text) {
|
|
11538
|
-
const value2 = compositionRef.current ? text :
|
|
12703
|
+
const value2 = compositionRef.current ? text : format2(text);
|
|
11539
12704
|
setInputValue(value2);
|
|
11540
12705
|
} else {
|
|
11541
12706
|
setInputValue("");
|
|
@@ -11878,11 +13043,11 @@ const InternalUploader = (props, ref) => {
|
|
|
11878
13043
|
imageFit,
|
|
11879
13044
|
disabled,
|
|
11880
13045
|
multiple,
|
|
11881
|
-
url,
|
|
13046
|
+
url: url2,
|
|
11882
13047
|
previewUrl,
|
|
11883
13048
|
headers,
|
|
11884
13049
|
timeout: timeout2,
|
|
11885
|
-
method,
|
|
13050
|
+
method: method4,
|
|
11886
13051
|
xhrState,
|
|
11887
13052
|
data,
|
|
11888
13053
|
preview,
|
|
@@ -11994,11 +13159,11 @@ const InternalUploader = (props, ref) => {
|
|
|
11994
13159
|
const executeUpload = (fileItem, index) => {
|
|
11995
13160
|
const uploadOption = new UploadOptions();
|
|
11996
13161
|
uploadOption.name = name;
|
|
11997
|
-
uploadOption.url =
|
|
13162
|
+
uploadOption.url = url2;
|
|
11998
13163
|
uploadOption.fileType = fileItem.type;
|
|
11999
13164
|
uploadOption.formData = fileItem.formData;
|
|
12000
13165
|
uploadOption.timeout = timeout2 * 1;
|
|
12001
|
-
uploadOption.method =
|
|
13166
|
+
uploadOption.method = method4;
|
|
12002
13167
|
uploadOption.xhrState = xhrState;
|
|
12003
13168
|
uploadOption.headers = headers;
|
|
12004
13169
|
uploadOption.taroFilePath = fileItem.path;
|
|
@@ -13103,7 +14268,7 @@ const NoticeBar = (props) => {
|
|
|
13103
14268
|
const getActive = (pace) => {
|
|
13104
14269
|
if (pace) {
|
|
13105
14270
|
const _active = active + pace;
|
|
13106
|
-
return
|
|
14271
|
+
return range3(_active, -1, childCount);
|
|
13107
14272
|
}
|
|
13108
14273
|
return active;
|
|
13109
14274
|
};
|
|
@@ -13115,7 +14280,7 @@ const NoticeBar = (props) => {
|
|
|
13115
14280
|
const requestFrame = (fn) => {
|
|
13116
14281
|
window.requestAnimationFrame.call(window, fn);
|
|
13117
14282
|
};
|
|
13118
|
-
const
|
|
14283
|
+
const range3 = (num, min, max) => {
|
|
13119
14284
|
return Math.min(Math.max(num, min), max);
|
|
13120
14285
|
};
|
|
13121
14286
|
const resettPosition = () => {
|
|
@@ -13220,7 +14385,7 @@ const Notify = (props) => {
|
|
|
13220
14385
|
id,
|
|
13221
14386
|
children,
|
|
13222
14387
|
style,
|
|
13223
|
-
type,
|
|
14388
|
+
type: type4,
|
|
13224
14389
|
className,
|
|
13225
14390
|
position,
|
|
13226
14391
|
visible,
|
|
@@ -13268,7 +14433,7 @@ const Notify = (props) => {
|
|
|
13268
14433
|
[`${classPrefix$b}--popup-top`]: position === "top",
|
|
13269
14434
|
[`${classPrefix$b}--popup-bottom`]: position === "bottom",
|
|
13270
14435
|
[`${classPrefix$b}`]: true,
|
|
13271
|
-
[`${classPrefix$b}--${
|
|
14436
|
+
[`${classPrefix$b}--${type4}`]: true
|
|
13272
14437
|
});
|
|
13273
14438
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
13274
14439
|
CSSTransition$1,
|
|
@@ -13367,7 +14532,7 @@ const Popover = (props) => {
|
|
|
13367
14532
|
const getContentWidth = async () => {
|
|
13368
14533
|
let rect;
|
|
13369
14534
|
if (targetId) {
|
|
13370
|
-
if (Taro.getEnv()
|
|
14535
|
+
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
13371
14536
|
rect = getRect(document.querySelector(`#${targetId}`));
|
|
13372
14537
|
} else {
|
|
13373
14538
|
rect = await getRectTaro(targetId);
|
|
@@ -13390,13 +14555,13 @@ const Popover = (props) => {
|
|
|
13390
14555
|
return new Promise((resolve) => {
|
|
13391
14556
|
const query = Taro.createSelectorQuery();
|
|
13392
14557
|
query.select(`#${targetId2}`) && query.select(`#${targetId2}`).boundingClientRect();
|
|
13393
|
-
query.exec(
|
|
14558
|
+
query.exec((res) => {
|
|
13394
14559
|
resolve(res[0]);
|
|
13395
14560
|
});
|
|
13396
14561
|
});
|
|
13397
14562
|
};
|
|
13398
14563
|
const getPopoverContentW = async () => {
|
|
13399
|
-
|
|
14564
|
+
const rectContent = await getRectByTaro(popoverContentRef.current);
|
|
13400
14565
|
setElWidth(rectContent.width);
|
|
13401
14566
|
setElHeight(rectContent.height);
|
|
13402
14567
|
};
|
|
@@ -13438,7 +14603,7 @@ const Popover = (props) => {
|
|
|
13438
14603
|
return styles;
|
|
13439
14604
|
};
|
|
13440
14605
|
const getRootPosition = () => {
|
|
13441
|
-
|
|
14606
|
+
const styles = {};
|
|
13442
14607
|
if (!rootPosition) {
|
|
13443
14608
|
styles.visibility = "hidden";
|
|
13444
14609
|
return styles;
|
|
@@ -13450,34 +14615,34 @@ const Popover = (props) => {
|
|
|
13450
14615
|
const skew = location.split("-")[1];
|
|
13451
14616
|
let cross = 0;
|
|
13452
14617
|
let parallel = 0;
|
|
13453
|
-
if (Array.isArray(offset) && offset.length
|
|
14618
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
13454
14619
|
cross += +offset[1];
|
|
13455
14620
|
parallel += +offset[0];
|
|
13456
14621
|
}
|
|
13457
14622
|
if (width) {
|
|
13458
14623
|
if (["bottom", "top"].includes(direction)) {
|
|
13459
|
-
const h = direction
|
|
14624
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
13460
14625
|
styles.top = `${top + h}px`;
|
|
13461
14626
|
if (!skew) {
|
|
13462
14627
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
13463
14628
|
}
|
|
13464
|
-
if (skew
|
|
14629
|
+
if (skew === "start") {
|
|
13465
14630
|
styles.left = `${left + parallel}px`;
|
|
13466
14631
|
}
|
|
13467
|
-
if (skew
|
|
14632
|
+
if (skew === "end") {
|
|
13468
14633
|
styles.left = `${right + parallel}px`;
|
|
13469
14634
|
}
|
|
13470
14635
|
}
|
|
13471
14636
|
if (["left", "right"].includes(direction)) {
|
|
13472
|
-
const contentW = direction
|
|
14637
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
13473
14638
|
styles.left = `${left + contentW}px`;
|
|
13474
14639
|
if (!skew) {
|
|
13475
14640
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
13476
14641
|
}
|
|
13477
|
-
if (skew
|
|
14642
|
+
if (skew === "start") {
|
|
13478
14643
|
styles.top = `${top + parallel}px`;
|
|
13479
14644
|
}
|
|
13480
|
-
if (skew
|
|
14645
|
+
if (skew === "end") {
|
|
13481
14646
|
styles.top = `${top + height + parallel}px`;
|
|
13482
14647
|
}
|
|
13483
14648
|
}
|
|
@@ -13885,10 +15050,11 @@ function preventDefault(event, isStopPropagation) {
|
|
|
13885
15050
|
}
|
|
13886
15051
|
}
|
|
13887
15052
|
const defaultProps$t = {
|
|
15053
|
+
...ComponentDefaults,
|
|
13888
15054
|
name: ""
|
|
13889
15055
|
};
|
|
13890
15056
|
const Swipe = forwardRef((props, instanceRef) => {
|
|
13891
|
-
const
|
|
15057
|
+
const classPrefix2 = "nut-swipe";
|
|
13892
15058
|
const touch = useTouch();
|
|
13893
15059
|
useReady(() => {
|
|
13894
15060
|
const getWidth = async () => {
|
|
@@ -14010,7 +15176,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
14010
15176
|
{
|
|
14011
15177
|
id: "left",
|
|
14012
15178
|
ref: side === "left" ? leftWrapper : rightWrapper,
|
|
14013
|
-
className: `${
|
|
15179
|
+
className: `${classPrefix2}__${side}`,
|
|
14014
15180
|
onClick: (e) => handleOperate(e, side)
|
|
14015
15181
|
},
|
|
14016
15182
|
props[`${side}Action`]
|
|
@@ -14050,13 +15216,13 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
14050
15216
|
"div",
|
|
14051
15217
|
{
|
|
14052
15218
|
ref: root2,
|
|
14053
|
-
className: classNames(
|
|
15219
|
+
className: classNames(classPrefix2, className),
|
|
14054
15220
|
onTouchStart: (e) => onTouchStart(e),
|
|
14055
15221
|
onTouchMove: (e) => onTouchMove(e),
|
|
14056
15222
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
14057
15223
|
style
|
|
14058
15224
|
},
|
|
14059
|
-
/* @__PURE__ */ React.createElement("div", { className: `${
|
|
15225
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left"), children, renderActionContent("right"))
|
|
14060
15226
|
);
|
|
14061
15227
|
});
|
|
14062
15228
|
Swipe.defaultProps = defaultProps$t;
|
|
@@ -14175,7 +15341,7 @@ const Toast = (props) => {
|
|
|
14175
15341
|
iconSize,
|
|
14176
15342
|
msg,
|
|
14177
15343
|
duration,
|
|
14178
|
-
type,
|
|
15344
|
+
type: type4,
|
|
14179
15345
|
title,
|
|
14180
15346
|
closeOnOverlayClick,
|
|
14181
15347
|
contentClassName,
|
|
@@ -14220,7 +15386,7 @@ const Toast = (props) => {
|
|
|
14220
15386
|
}
|
|
14221
15387
|
};
|
|
14222
15388
|
const hasIcon = () => {
|
|
14223
|
-
if (
|
|
15389
|
+
if (type4 !== "text") {
|
|
14224
15390
|
return true;
|
|
14225
15391
|
}
|
|
14226
15392
|
return !!icon;
|
|
@@ -14234,7 +15400,7 @@ const Toast = (props) => {
|
|
|
14234
15400
|
fail: /* @__PURE__ */ React.createElement(a$m, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
14235
15401
|
warn: /* @__PURE__ */ React.createElement(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
14236
15402
|
loading: /* @__PURE__ */ React.createElement(r$g, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
14237
|
-
}[
|
|
15403
|
+
}[type4];
|
|
14238
15404
|
};
|
|
14239
15405
|
const classes = classNames({
|
|
14240
15406
|
"nut-toast-has-icon": icon,
|
|
@@ -14275,14 +15441,14 @@ const defaultProps$r = {
|
|
|
14275
15441
|
};
|
|
14276
15442
|
const classPrefix$7 = `nut-animate`;
|
|
14277
15443
|
const Animate = (props) => {
|
|
14278
|
-
const { className, type, action, loop, onClick, children, ...rest } = {
|
|
15444
|
+
const { className, type: type4, action, loop, onClick, children, ...rest } = {
|
|
14279
15445
|
...defaultProps$r,
|
|
14280
15446
|
...props
|
|
14281
15447
|
};
|
|
14282
15448
|
const [clicked, setClicked] = useState(false);
|
|
14283
15449
|
const classes = classNames({
|
|
14284
15450
|
"nut-ani-container": true,
|
|
14285
|
-
[`${classPrefix$7}-${
|
|
15451
|
+
[`${classPrefix$7}-${type4}`]: action === "initial" || clicked ? type4 : false,
|
|
14286
15452
|
loop
|
|
14287
15453
|
});
|
|
14288
15454
|
const cls = classNames(classes, className);
|
|
@@ -14385,8 +15551,8 @@ const CountUp = (props) => {
|
|
|
14385
15551
|
className: `${classPrefix2}__number`,
|
|
14386
15552
|
style: numberEaseStyle(idx)
|
|
14387
15553
|
},
|
|
14388
|
-
[...numbers, ...numbers].map((
|
|
14389
|
-
return /* @__PURE__ */ React.createElement("span", { key: subidx },
|
|
15554
|
+
[...numbers, ...numbers].map((number4, subidx) => {
|
|
15555
|
+
return /* @__PURE__ */ React.createElement("span", { key: subidx }, number4);
|
|
14390
15556
|
})
|
|
14391
15557
|
) : /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}__separator` }, item)
|
|
14392
15558
|
);
|
|
@@ -14437,11 +15603,11 @@ const Audio = (props) => {
|
|
|
14437
15603
|
const { locale } = useConfig$1();
|
|
14438
15604
|
const {
|
|
14439
15605
|
className,
|
|
14440
|
-
url,
|
|
15606
|
+
url: url2,
|
|
14441
15607
|
style,
|
|
14442
15608
|
autoplay,
|
|
14443
15609
|
loop,
|
|
14444
|
-
type,
|
|
15610
|
+
type: type4,
|
|
14445
15611
|
onFastBack,
|
|
14446
15612
|
onForward,
|
|
14447
15613
|
onPause,
|
|
@@ -14468,7 +15634,7 @@ const Audio = (props) => {
|
|
|
14468
15634
|
});
|
|
14469
15635
|
const audioRef = useRef(createInnerAudioContext());
|
|
14470
15636
|
const audioCtx = audioRef.current;
|
|
14471
|
-
audioCtx.src =
|
|
15637
|
+
audioCtx.src = url2;
|
|
14472
15638
|
audioCtx.autoplay = autoplay || false;
|
|
14473
15639
|
audioCtx.loop = loop || false;
|
|
14474
15640
|
audioCtx.onPause(() => {
|
|
@@ -14597,7 +15763,7 @@ const Audio = (props) => {
|
|
|
14597
15763
|
return /* @__PURE__ */ React.createElement("div", { className: b("none-container"), onClick: handleStatusChange }, children);
|
|
14598
15764
|
};
|
|
14599
15765
|
const renderAudio = () => {
|
|
14600
|
-
switch (
|
|
15766
|
+
switch (type4) {
|
|
14601
15767
|
case "icon":
|
|
14602
15768
|
return renderIcon();
|
|
14603
15769
|
case "progress":
|
|
@@ -14711,7 +15877,7 @@ const CircleProgress = (props) => {
|
|
|
14711
15877
|
const transColor = (color2) => {
|
|
14712
15878
|
return color2 && color2.replace("#", "%23");
|
|
14713
15879
|
};
|
|
14714
|
-
const
|
|
15880
|
+
const format2 = (progress) => Math.min(Math.max(+progress, 0), 100);
|
|
14715
15881
|
const circleStyle = () => {
|
|
14716
15882
|
const stopArr = stop();
|
|
14717
15883
|
const stopDom = [];
|
|
@@ -14726,7 +15892,7 @@ const CircleProgress = (props) => {
|
|
|
14726
15892
|
}
|
|
14727
15893
|
const perimeter = 283;
|
|
14728
15894
|
const progress = +oldValue;
|
|
14729
|
-
const offset = perimeter * Number(
|
|
15895
|
+
const offset = perimeter * Number(format2(parseFloat(progress.toFixed(1)))) / 100;
|
|
14730
15896
|
const isWise = props.clockwise ? 1 : 0;
|
|
14731
15897
|
const color2 = isObject(props.color) ? `url(%23${refRandomId})` : transColor(props.color);
|
|
14732
15898
|
const d = `M 50 50 m 0 -45 a 45 45 0 1 ${isWise} 0 90 a 45 45 0 1, ${isWise} 0 -90`;
|
|
@@ -14985,7 +16151,7 @@ const InternalCountDown = (props, ref) => {
|
|
|
14985
16151
|
endTime,
|
|
14986
16152
|
remainingTime,
|
|
14987
16153
|
millisecond,
|
|
14988
|
-
format,
|
|
16154
|
+
format: format2,
|
|
14989
16155
|
autoStart,
|
|
14990
16156
|
time,
|
|
14991
16157
|
destroy,
|
|
@@ -15054,7 +16220,7 @@ const InternalCountDown = (props, ref) => {
|
|
|
15054
16220
|
}
|
|
15055
16221
|
});
|
|
15056
16222
|
};
|
|
15057
|
-
const formatRemainTime = (t,
|
|
16223
|
+
const formatRemainTime = (t, type4) => {
|
|
15058
16224
|
const ts = t;
|
|
15059
16225
|
const rest2 = {
|
|
15060
16226
|
d: 0,
|
|
@@ -15074,12 +16240,12 @@ const InternalCountDown = (props, ref) => {
|
|
|
15074
16240
|
rest2.s = Math.floor(ts % MINUTE / SECOND);
|
|
15075
16241
|
rest2.ms = Math.floor(ts % SECOND);
|
|
15076
16242
|
}
|
|
15077
|
-
return
|
|
16243
|
+
return type4 === "custom" ? rest2 : parseFormat({ ...rest2 });
|
|
15078
16244
|
};
|
|
15079
16245
|
const parseFormat = (time2) => {
|
|
15080
16246
|
const { d } = time2;
|
|
15081
16247
|
let { h, m, s, ms } = time2;
|
|
15082
|
-
let formatCache =
|
|
16248
|
+
let formatCache = format2;
|
|
15083
16249
|
if (formatCache.includes("DD")) {
|
|
15084
16250
|
formatCache = formatCache.replace("DD", padZero(d));
|
|
15085
16251
|
} else {
|
|
@@ -15385,9 +16551,9 @@ const Ellipsis = (props) => {
|
|
|
15385
16551
|
const newContent = `${((_a2 = ellipsis.current) == null ? void 0 : _a2.leading) || ""}${((_b2 = ellipsis.current) == null ? void 0 : _b2.leading) ? symbol : ""}${expandText || ""}${((_c2 = ellipsis.current) == null ? void 0 : _c2.tailing) ? symbol : ""}${((_d2 = ellipsis.current) == null ? void 0 : _d2.tailing) || ""}`;
|
|
15386
16552
|
setContentCopy(newContent);
|
|
15387
16553
|
};
|
|
15388
|
-
const tailorContent = (left, right,
|
|
16554
|
+
const tailorContent = (left, right, type4 = "") => {
|
|
15389
16555
|
const threeDotWidth = symbolTextWidth;
|
|
15390
|
-
const direc = direction === "middle" &&
|
|
16556
|
+
const direc = direction === "middle" && type4 ? type4 : direction;
|
|
15391
16557
|
setExceeded(true);
|
|
15392
16558
|
let widthPart = -1;
|
|
15393
16559
|
const start = left;
|
|
@@ -15430,8 +16596,8 @@ const Ellipsis = (props) => {
|
|
|
15430
16596
|
const match = value.match(/^\d*(\.\d*)?/);
|
|
15431
16597
|
return match ? Number(match[0]) : 0;
|
|
15432
16598
|
};
|
|
15433
|
-
const clickHandle = (
|
|
15434
|
-
if (
|
|
16599
|
+
const clickHandle = (type4) => {
|
|
16600
|
+
if (type4 === 1) {
|
|
15435
16601
|
setExpanded(true);
|
|
15436
16602
|
onChange && onChange("expand");
|
|
15437
16603
|
} else {
|
|
@@ -16281,14 +17447,14 @@ const Price = (props) => {
|
|
|
16281
17447
|
...props
|
|
16282
17448
|
};
|
|
16283
17449
|
const classPrefix2 = "nut-price";
|
|
16284
|
-
const replaceSpecialChar = (
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16289
|
-
|
|
16290
|
-
|
|
16291
|
-
return
|
|
17450
|
+
const replaceSpecialChar = (url2) => {
|
|
17451
|
+
url2 = url2.replace(/"/g, '"');
|
|
17452
|
+
url2 = url2.replace(/&/g, "&");
|
|
17453
|
+
url2 = url2.replace(/</g, "<");
|
|
17454
|
+
url2 = url2.replace(/>/g, ">");
|
|
17455
|
+
url2 = url2.replace(/ /g, " ");
|
|
17456
|
+
url2 = url2.replace(/¥/g, "¥");
|
|
17457
|
+
return url2;
|
|
16292
17458
|
};
|
|
16293
17459
|
const showSymbol = () => {
|
|
16294
17460
|
return { __html: symbol ? replaceSpecialChar(symbol) : "" };
|
|
@@ -16588,7 +17754,7 @@ const Tag = (props) => {
|
|
|
16588
17754
|
style,
|
|
16589
17755
|
background,
|
|
16590
17756
|
plain,
|
|
16591
|
-
type,
|
|
17757
|
+
type: type4,
|
|
16592
17758
|
round,
|
|
16593
17759
|
children,
|
|
16594
17760
|
mark,
|
|
@@ -16607,7 +17773,7 @@ const Tag = (props) => {
|
|
|
16607
17773
|
const classes = () => {
|
|
16608
17774
|
return classNames({
|
|
16609
17775
|
[classPrefix2]: true,
|
|
16610
|
-
[`${classPrefix2}--${
|
|
17776
|
+
[`${classPrefix2}--${type4}`]: type4,
|
|
16611
17777
|
[`${classPrefix2}--plain`]: plain,
|
|
16612
17778
|
[`${classPrefix2}--round`]: round,
|
|
16613
17779
|
[`${classPrefix2}--mark`]: mark,
|
|
@@ -16617,7 +17783,7 @@ const Tag = (props) => {
|
|
|
16617
17783
|
};
|
|
16618
17784
|
useEffect(() => {
|
|
16619
17785
|
setTagClass(classes());
|
|
16620
|
-
}, [
|
|
17786
|
+
}, [type4, background, color, plain, round, mark, closeable, className]);
|
|
16621
17787
|
const handleClick = (e) => {
|
|
16622
17788
|
onClick && onClick(e);
|
|
16623
17789
|
};
|
|
@@ -16895,11 +18061,11 @@ const TimeDetail = (props) => {
|
|
|
16895
18061
|
}, [options, optionKey, activeDate]);
|
|
16896
18062
|
const isActive = useCallback(
|
|
16897
18063
|
(timeKey) => {
|
|
16898
|
-
const
|
|
18064
|
+
const date4 = activeTime.find((item) => {
|
|
16899
18065
|
return item[optionKey.valueKey] === activeDate;
|
|
16900
18066
|
});
|
|
16901
|
-
if (
|
|
16902
|
-
const time =
|
|
18067
|
+
if (date4 == null ? void 0 : date4[optionKey.childrenKey]) {
|
|
18068
|
+
const time = date4 == null ? void 0 : date4[optionKey.childrenKey].find((time2) => {
|
|
16903
18069
|
return time2[optionKey.valueKey] === timeKey;
|
|
16904
18070
|
});
|
|
16905
18071
|
return time;
|
|
@@ -16971,23 +18137,23 @@ const TimeSelect = (props) => {
|
|
|
16971
18137
|
};
|
|
16972
18138
|
const handleSelectTime = (selectTime) => {
|
|
16973
18139
|
let newActiveTime = [...activeTime];
|
|
16974
|
-
const
|
|
18140
|
+
const date4 = newActiveTime.find((item) => {
|
|
16975
18141
|
return item[optionKey.valueKey] === activeDate;
|
|
16976
18142
|
});
|
|
16977
|
-
if (
|
|
16978
|
-
const timeIndex =
|
|
18143
|
+
if (date4) {
|
|
18144
|
+
const timeIndex = date4[optionKey.childrenKey].findIndex(
|
|
16979
18145
|
(time) => {
|
|
16980
18146
|
return time[optionKey.valueKey] === selectTime[optionKey.valueKey];
|
|
16981
18147
|
}
|
|
16982
18148
|
);
|
|
16983
18149
|
if (timeIndex > -1) {
|
|
16984
18150
|
if (multiple) {
|
|
16985
|
-
|
|
18151
|
+
date4[optionKey.childrenKey].splice(timeIndex, 1);
|
|
16986
18152
|
} else {
|
|
16987
18153
|
newActiveTime = [];
|
|
16988
18154
|
}
|
|
16989
18155
|
} else if (multiple) {
|
|
16990
|
-
|
|
18156
|
+
date4[optionKey.childrenKey].push({ ...selectTime });
|
|
16991
18157
|
} else {
|
|
16992
18158
|
newActiveTime = [
|
|
16993
18159
|
{
|
|
@@ -17016,9 +18182,9 @@ const TimeSelect = (props) => {
|
|
|
17016
18182
|
setActiveTime(newActiveTime);
|
|
17017
18183
|
onTimeChange && onTimeChange(selectTime, newActiveTime);
|
|
17018
18184
|
};
|
|
17019
|
-
const handleChange = (
|
|
17020
|
-
setActiveDate(
|
|
17021
|
-
onDateChange && onDateChange(
|
|
18185
|
+
const handleChange = (date4) => {
|
|
18186
|
+
setActiveDate(date4[optionKey.valueKey]);
|
|
18187
|
+
onDateChange && onDateChange(date4, activeTime);
|
|
17022
18188
|
};
|
|
17023
18189
|
return /* @__PURE__ */ React.createElement(
|
|
17024
18190
|
Popup,
|