@nutui/nutui-react-taro 2.0.0-alpha.15 → 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 +26 -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/Dialog/style/index.js +1 -0
- package/dist/esm/Dialog/style/style.css +1 -1
- 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/Menu/style/style.css +1 -1
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +1 -1
- package/dist/esm/NoticeBar.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-8c9230b6.js → datepicker.taro-108eb7c8.js} +43 -45
- 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/{menuitem.taro-6aa35a00.js → menuitem.taro-7f8c12cf.js} +11 -8
- package/dist/esm/{noticebar.taro-8d496dd6.js → noticebar.taro-dc895cc5.js} +1 -1
- package/dist/esm/{numberkeyboard.taro-18879f04.js → numberkeyboard.taro-ee984036.js} +1 -1
- package/dist/esm/nutui-react.es.js +22 -22
- package/dist/esm/{picker.taro-6b672469.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/datepicker/datepicker.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/index.d.ts +1 -0
- package/dist/esm/types/src/packages/datepicker/index.taro.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/packages/toast/Notification.d.ts +4 -1
- 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 +1851 -676
- package/dist/nutui.react.umd.js +1832 -657
- 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/menuitem/menuitem.scss +1 -1
- package/dist/packages/noticebar/noticebar.scss +0 -3
- 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 +79 -25
- package/dist/types/packages/datepicker/index.taro.d.ts +1 -0
- 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/index.d.ts +4 -0
- package/dist/types/packages/picker/picker.d.ts +23 -0
- package/dist/types/packages/picker/picker.taro.d.ts +7 -2
- package/dist/types/packages/picker/pickerpanel.d.ts +15 -0
- package/dist/types/packages/popover/popover.taro.d.ts +5 -5
- package/dist/types/packages/popup/index.d.ts +3 -0
- package/dist/types/packages/popup/popup.d.ts +22 -0
- 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.umd.js
CHANGED
|
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
/*!
|
|
11
|
-
* @nutui/nutui-react-taro v2.0.0-alpha.
|
|
11
|
+
* @nutui/nutui-react-taro v2.0.0-alpha.17 Wed Jun 14 2023 16:32:58 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -1883,7 +1883,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1883
1883
|
fill,
|
|
1884
1884
|
loading,
|
|
1885
1885
|
disabled,
|
|
1886
|
-
type,
|
|
1886
|
+
type: type2,
|
|
1887
1887
|
size,
|
|
1888
1888
|
block,
|
|
1889
1889
|
icon,
|
|
@@ -1929,7 +1929,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1929
1929
|
className: classNames(
|
|
1930
1930
|
prefixCls,
|
|
1931
1931
|
className,
|
|
1932
|
-
props.type ? `${prefixCls}--${
|
|
1932
|
+
props.type ? `${prefixCls}--${type2}` : null,
|
|
1933
1933
|
props.fill ? `${prefixCls}--${fill}` : null,
|
|
1934
1934
|
{
|
|
1935
1935
|
[`${prefixCls}--${size}`]: size,
|
|
@@ -2243,30 +2243,30 @@ var __publicField = (obj, key, value) => {
|
|
|
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(array2, iteratee, accumulator, initAccum) {
|
|
2247
|
+
var index = -1, length = array2 ? array2.length : 0;
|
|
2248
2248
|
if (initAccum && length) {
|
|
2249
|
-
accumulator =
|
|
2249
|
+
accumulator = array2[++index];
|
|
2250
2250
|
}
|
|
2251
2251
|
while (++index < length) {
|
|
2252
|
-
accumulator = iteratee(accumulator,
|
|
2252
|
+
accumulator = iteratee(accumulator, array2[index], index, array2);
|
|
2253
2253
|
}
|
|
2254
2254
|
return accumulator;
|
|
2255
2255
|
}
|
|
2256
|
-
function asciiWords(
|
|
2257
|
-
return
|
|
2256
|
+
function asciiWords(string2) {
|
|
2257
|
+
return string2.match(reAsciiWord) || [];
|
|
2258
2258
|
}
|
|
2259
|
-
function basePropertyOf(
|
|
2259
|
+
function basePropertyOf(object2) {
|
|
2260
2260
|
return function(key) {
|
|
2261
|
-
return
|
|
2261
|
+
return object2 == null ? void 0 : object2[key];
|
|
2262
2262
|
};
|
|
2263
2263
|
}
|
|
2264
2264
|
var deburrLetter = basePropertyOf(deburredLetters);
|
|
2265
|
-
function hasUnicodeWord(
|
|
2266
|
-
return reHasUnicodeWord.test(
|
|
2265
|
+
function hasUnicodeWord(string2) {
|
|
2266
|
+
return reHasUnicodeWord.test(string2);
|
|
2267
2267
|
}
|
|
2268
|
-
function unicodeWords(
|
|
2269
|
-
return
|
|
2268
|
+
function unicodeWords(string2) {
|
|
2269
|
+
return string2.match(reUnicodeWord) || [];
|
|
2270
2270
|
}
|
|
2271
2271
|
var objectProto = Object.prototype;
|
|
2272
2272
|
var objectToString = objectProto.toString;
|
|
@@ -2283,8 +2283,8 @@ var __publicField = (obj, key, 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(string2) {
|
|
2287
|
+
return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, "");
|
|
2288
2288
|
};
|
|
2289
2289
|
}
|
|
2290
2290
|
function isObjectLike(value) {
|
|
@@ -2296,20 +2296,20 @@ var __publicField = (obj, key, value) => {
|
|
|
2296
2296
|
function toString(value) {
|
|
2297
2297
|
return value == null ? "" : baseToString(value);
|
|
2298
2298
|
}
|
|
2299
|
-
function deburr(
|
|
2300
|
-
|
|
2301
|
-
return
|
|
2299
|
+
function deburr(string2) {
|
|
2300
|
+
string2 = toString(string2);
|
|
2301
|
+
return string2 && string2.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(string2, pattern2, guard) {
|
|
2307
|
+
string2 = toString(string2);
|
|
2308
|
+
pattern2 = guard ? void 0 : pattern2;
|
|
2309
|
+
if (pattern2 === void 0) {
|
|
2310
|
+
return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2);
|
|
2311
2311
|
}
|
|
2312
|
-
return
|
|
2312
|
+
return string2.match(pattern2) || [];
|
|
2313
2313
|
}
|
|
2314
2314
|
var lodash_kebabcase = kebabCase;
|
|
2315
2315
|
const zhCN = {
|
|
@@ -2905,7 +2905,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2905
2905
|
className,
|
|
2906
2906
|
style,
|
|
2907
2907
|
children,
|
|
2908
|
-
type,
|
|
2908
|
+
type: type2,
|
|
2909
2909
|
justify,
|
|
2910
2910
|
align,
|
|
2911
2911
|
wrap,
|
|
@@ -2915,14 +2915,14 @@ var __publicField = (obj, key, value) => {
|
|
|
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("", type2)}
|
|
2926
2926
|
${getClass("justify", justify)}
|
|
2927
2927
|
${getClass("align", align)}
|
|
2928
2928
|
${getClass("flex", wrap)}
|
|
@@ -3464,7 +3464,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3464
3464
|
position,
|
|
3465
3465
|
onChange,
|
|
3466
3466
|
onSelect,
|
|
3467
|
-
type,
|
|
3467
|
+
type: type2,
|
|
3468
3468
|
children,
|
|
3469
3469
|
style,
|
|
3470
3470
|
content,
|
|
@@ -3478,7 +3478,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3478
3478
|
{
|
|
3479
3479
|
active: visible
|
|
3480
3480
|
},
|
|
3481
|
-
|
|
3481
|
+
type2,
|
|
3482
3482
|
className,
|
|
3483
3483
|
classPrefix2
|
|
3484
3484
|
);
|
|
@@ -3586,8 +3586,8 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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(type2) {
|
|
3787
|
+
return typeof type2 === "string" || typeof type2 === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
3788
|
+
type2 === REACT_FRAGMENT_TYPE || type2 === REACT_CONCURRENT_MODE_TYPE || type2 === REACT_PROFILER_TYPE || type2 === REACT_STRICT_MODE_TYPE || type2 === REACT_SUSPENSE_TYPE || type2 === REACT_SUSPENSE_LIST_TYPE || typeof type2 === "object" && type2 !== null && (type2.$$typeof === REACT_LAZY_TYPE || type2.$$typeof === REACT_MEMO_TYPE || type2.$$typeof === REACT_PROVIDER_TYPE || type2.$$typeof === REACT_CONTEXT_TYPE || type2.$$typeof === REACT_FORWARD_REF_TYPE || type2.$$typeof === REACT_FUNDAMENTAL_TYPE || type2.$$typeof === REACT_RESPONDER_TYPE || type2.$$typeof === REACT_SCOPE_TYPE || type2.$$typeof === REACT_BLOCK_TYPE);
|
|
3789
3789
|
}
|
|
3790
|
-
function typeOf(
|
|
3791
|
-
if (typeof
|
|
3792
|
-
var $$typeof =
|
|
3790
|
+
function typeOf(object2) {
|
|
3791
|
+
if (typeof object2 === "object" && object2 !== null) {
|
|
3792
|
+
var $$typeof = object2.$$typeof;
|
|
3793
3793
|
switch ($$typeof) {
|
|
3794
3794
|
case REACT_ELEMENT_TYPE:
|
|
3795
|
-
var
|
|
3796
|
-
switch (
|
|
3795
|
+
var type2 = object2.type;
|
|
3796
|
+
switch (type2) {
|
|
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 type2;
|
|
3804
3804
|
default:
|
|
3805
|
-
var $$typeofType =
|
|
3805
|
+
var $$typeofType = type2 && type2.$$typeof;
|
|
3806
3806
|
switch ($$typeofType) {
|
|
3807
3807
|
case REACT_CONTEXT_TYPE:
|
|
3808
3808
|
case REACT_FORWARD_REF_TYPE:
|
|
@@ -3834,50 +3834,50 @@ var __publicField = (obj, key, value) => {
|
|
|
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(object2) {
|
|
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(object2) || typeOf(object2) === REACT_ASYNC_MODE_TYPE;
|
|
3845
3845
|
}
|
|
3846
|
-
function isConcurrentMode(
|
|
3847
|
-
return typeOf(
|
|
3846
|
+
function isConcurrentMode(object2) {
|
|
3847
|
+
return typeOf(object2) === REACT_CONCURRENT_MODE_TYPE;
|
|
3848
3848
|
}
|
|
3849
|
-
function isContextConsumer(
|
|
3850
|
-
return typeOf(
|
|
3849
|
+
function isContextConsumer(object2) {
|
|
3850
|
+
return typeOf(object2) === REACT_CONTEXT_TYPE;
|
|
3851
3851
|
}
|
|
3852
|
-
function isContextProvider(
|
|
3853
|
-
return typeOf(
|
|
3852
|
+
function isContextProvider(object2) {
|
|
3853
|
+
return typeOf(object2) === REACT_PROVIDER_TYPE;
|
|
3854
3854
|
}
|
|
3855
|
-
function isElement2(
|
|
3856
|
-
return typeof
|
|
3855
|
+
function isElement2(object2) {
|
|
3856
|
+
return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
|
|
3857
3857
|
}
|
|
3858
|
-
function isForwardRef(
|
|
3859
|
-
return typeOf(
|
|
3858
|
+
function isForwardRef(object2) {
|
|
3859
|
+
return typeOf(object2) === REACT_FORWARD_REF_TYPE;
|
|
3860
3860
|
}
|
|
3861
|
-
function isFragment(
|
|
3862
|
-
return typeOf(
|
|
3861
|
+
function isFragment(object2) {
|
|
3862
|
+
return typeOf(object2) === REACT_FRAGMENT_TYPE;
|
|
3863
3863
|
}
|
|
3864
|
-
function isLazy(
|
|
3865
|
-
return typeOf(
|
|
3864
|
+
function isLazy(object2) {
|
|
3865
|
+
return typeOf(object2) === REACT_LAZY_TYPE;
|
|
3866
3866
|
}
|
|
3867
|
-
function isMemo(
|
|
3868
|
-
return typeOf(
|
|
3867
|
+
function isMemo(object2) {
|
|
3868
|
+
return typeOf(object2) === REACT_MEMO_TYPE;
|
|
3869
3869
|
}
|
|
3870
|
-
function isPortal(
|
|
3871
|
-
return typeOf(
|
|
3870
|
+
function isPortal(object2) {
|
|
3871
|
+
return typeOf(object2) === REACT_PORTAL_TYPE;
|
|
3872
3872
|
}
|
|
3873
|
-
function isProfiler(
|
|
3874
|
-
return typeOf(
|
|
3873
|
+
function isProfiler(object2) {
|
|
3874
|
+
return typeOf(object2) === REACT_PROFILER_TYPE;
|
|
3875
3875
|
}
|
|
3876
|
-
function isStrictMode(
|
|
3877
|
-
return typeOf(
|
|
3876
|
+
function isStrictMode(object2) {
|
|
3877
|
+
return typeOf(object2) === REACT_STRICT_MODE_TYPE;
|
|
3878
3878
|
}
|
|
3879
|
-
function isSuspense(
|
|
3880
|
-
return typeOf(
|
|
3879
|
+
function isSuspense(object2) {
|
|
3880
|
+
return typeOf(object2) === REACT_SUSPENSE_TYPE;
|
|
3881
3881
|
}
|
|
3882
3882
|
reactIs_development.AsyncMode = AsyncMode;
|
|
3883
3883
|
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
@@ -4291,8 +4291,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4291
4291
|
}
|
|
4292
4292
|
}
|
|
4293
4293
|
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
4294
|
-
var
|
|
4295
|
-
if (
|
|
4294
|
+
var type2 = getPreciseType(value);
|
|
4295
|
+
if (type2 === "symbol") {
|
|
4296
4296
|
return String(value);
|
|
4297
4297
|
}
|
|
4298
4298
|
return value;
|
|
@@ -4363,9 +4363,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4363
4363
|
}
|
|
4364
4364
|
return createChainableTypeChecker(validate);
|
|
4365
4365
|
}
|
|
4366
|
-
function invalidValidatorError(componentName, location, propFullName, key,
|
|
4366
|
+
function invalidValidatorError(componentName, location, propFullName, key, type2) {
|
|
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 `" + type2 + "`."
|
|
4369
4369
|
);
|
|
4370
4370
|
}
|
|
4371
4371
|
function createShapeTypeChecker(shapeTypes) {
|
|
@@ -4502,17 +4502,17 @@ var __publicField = (obj, key, value) => {
|
|
|
4502
4502
|
return propType;
|
|
4503
4503
|
}
|
|
4504
4504
|
function getPostfixForTypeWarning(value) {
|
|
4505
|
-
var
|
|
4506
|
-
switch (
|
|
4505
|
+
var type2 = getPreciseType(value);
|
|
4506
|
+
switch (type2) {
|
|
4507
4507
|
case "array":
|
|
4508
4508
|
case "object":
|
|
4509
|
-
return "an " +
|
|
4509
|
+
return "an " + type2;
|
|
4510
4510
|
case "boolean":
|
|
4511
4511
|
case "date":
|
|
4512
4512
|
case "regexp":
|
|
4513
|
-
return "a " +
|
|
4513
|
+
return "a " + type2;
|
|
4514
4514
|
default:
|
|
4515
|
-
return
|
|
4515
|
+
return type2;
|
|
4516
4516
|
}
|
|
4517
4517
|
}
|
|
4518
4518
|
function getClassName(propValue) {
|
|
@@ -4646,7 +4646,7 @@ var __publicField = (obj, key, value) => {
|
|
|
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 __publicField = (obj, key, value) => {
|
|
|
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 __publicField = (obj, key, value) => {
|
|
|
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 type2 = appearing ? "appear" : "enter";
|
|
5102
|
+
_this.addClass(node, type2, "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 type2 = appearing ? "appear" : "enter";
|
|
5110
|
+
_this.removeClasses(node, type2);
|
|
5111
|
+
_this.addClass(node, type2, "done");
|
|
5112
5112
|
if (_this.props.onEntered) {
|
|
5113
5113
|
_this.props.onEntered(maybeNode, maybeAppearing);
|
|
5114
5114
|
}
|
|
@@ -5140,13 +5140,13 @@ var __publicField = (obj, key, value) => {
|
|
|
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(type2) {
|
|
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 + type2 : classNames2[type2];
|
|
5148
|
+
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[type2 + "Active"];
|
|
5149
|
+
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[type2 + "Done"];
|
|
5150
5150
|
return {
|
|
5151
5151
|
baseClassName,
|
|
5152
5152
|
activeClassName,
|
|
@@ -5156,10 +5156,10 @@ var __publicField = (obj, key, value) => {
|
|
|
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, type2, phase) {
|
|
5160
|
+
var className = this.getClassNames(type2)[phase + "ClassName"];
|
|
5161
5161
|
var _this$getClassNames = this.getClassNames("enter"), doneClassName = _this$getClassNames.doneClassName;
|
|
5162
|
-
if (
|
|
5162
|
+
if (type2 === "appear" && phase === "done" && doneClassName) {
|
|
5163
5163
|
className += " " + doneClassName;
|
|
5164
5164
|
}
|
|
5165
5165
|
if (phase === "active") {
|
|
@@ -5167,13 +5167,13 @@ var __publicField = (obj, key, value) => {
|
|
|
5167
5167
|
forceReflow(node);
|
|
5168
5168
|
}
|
|
5169
5169
|
if (className) {
|
|
5170
|
-
this.appliedClasses[
|
|
5170
|
+
this.appliedClasses[type2][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, type2) {
|
|
5175
|
+
var _this$appliedClasses$ = this.appliedClasses[type2], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done;
|
|
5176
|
+
this.appliedClasses[type2] = {};
|
|
5177
5177
|
if (baseClassName) {
|
|
5178
5178
|
removeClass(node, baseClassName);
|
|
5179
5179
|
}
|
|
@@ -5188,7 +5188,7 @@ var __publicField = (obj, key, value) => {
|
|
|
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 __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
6157
6158
|
const { locale } = useConfig();
|
|
6158
6159
|
const {
|
|
6159
6160
|
children,
|
|
6160
|
-
type,
|
|
6161
|
+
type: type2,
|
|
6161
6162
|
existAddress,
|
|
6162
6163
|
selectedIcon,
|
|
6163
6164
|
defaultIcon,
|
|
@@ -6189,7 +6190,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6189
6190
|
onSelected && onSelected(prevExistAdd, item, copyExistAdd);
|
|
6190
6191
|
};
|
|
6191
6192
|
const onSwitch = () => {
|
|
6192
|
-
onSwitchModule && onSwitchModule({ type:
|
|
6193
|
+
onSwitchModule && onSwitchModule({ type: type2 === "exist" ? "custom" : "exist" });
|
|
6193
6194
|
};
|
|
6194
6195
|
React.useEffect(() => {
|
|
6195
6196
|
}, [existAddress]);
|
|
@@ -6210,7 +6211,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6210
6211
|
const { locale } = useConfig$1();
|
|
6211
6212
|
const {
|
|
6212
6213
|
children,
|
|
6213
|
-
type,
|
|
6214
|
+
type: type2,
|
|
6214
6215
|
modelValue,
|
|
6215
6216
|
height,
|
|
6216
6217
|
province,
|
|
@@ -6226,7 +6227,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6226
6227
|
...props
|
|
6227
6228
|
};
|
|
6228
6229
|
const b2 = cn("address");
|
|
6229
|
-
const [privateType] = React.useState(
|
|
6230
|
+
const [privateType] = React.useState(type2);
|
|
6230
6231
|
const [tabIndex, setTabIndex] = React.useState(0);
|
|
6231
6232
|
const [tabName] = React.useState(["province", "city", "country", "town"]);
|
|
6232
6233
|
React.useRef(null);
|
|
@@ -6235,7 +6236,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6235
6236
|
React.useRef(null);
|
|
6236
6237
|
const regionLine = React.useRef(null);
|
|
6237
6238
|
const isCustom2 = () => {
|
|
6238
|
-
return
|
|
6239
|
+
return type2 === "custom2";
|
|
6239
6240
|
};
|
|
6240
6241
|
const transformData = (data) => {
|
|
6241
6242
|
if (!Array.isArray(data))
|
|
@@ -6497,7 +6498,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6497
6498
|
modelValue,
|
|
6498
6499
|
modelSelect,
|
|
6499
6500
|
children,
|
|
6500
|
-
type,
|
|
6501
|
+
type: type2,
|
|
6501
6502
|
height,
|
|
6502
6503
|
customAddressTitle,
|
|
6503
6504
|
existAddress,
|
|
@@ -6526,7 +6527,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6526
6527
|
...props
|
|
6527
6528
|
};
|
|
6528
6529
|
const b2 = cn("address");
|
|
6529
|
-
const [privateType, setPrivateType] = React.useState(
|
|
6530
|
+
const [privateType, setPrivateType] = React.useState(type2);
|
|
6530
6531
|
const [tabName] = React.useState(["province", "city", "country", "town"]);
|
|
6531
6532
|
const [showPopup, setShowPopup] = React.useState(modelValue);
|
|
6532
6533
|
const [selectedRegion, setSelectedRegion] = React.useState({
|
|
@@ -6652,8 +6653,8 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
6689
6690
|
* @return {String}
|
|
6690
6691
|
*/
|
|
6691
6692
|
getWhatDay(year, month, day) {
|
|
6692
|
-
const
|
|
6693
|
-
const index =
|
|
6693
|
+
const date2 = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
|
|
6694
|
+
const index = date2.getDay();
|
|
6694
6695
|
const dayNames = [
|
|
6695
6696
|
"星期日",
|
|
6696
6697
|
"星期一",
|
|
@@ -6707,8 +6708,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6707
6708
|
* @return {Number}
|
|
6708
6709
|
*/
|
|
6709
6710
|
getMonthPreDay(year, month) {
|
|
6710
|
-
const
|
|
6711
|
-
let day =
|
|
6711
|
+
const date2 = /* @__PURE__ */ new Date(`${year}/${month}/01`);
|
|
6712
|
+
let day = date2.getDay();
|
|
6712
6713
|
if (day == 0) {
|
|
6713
6714
|
day = 7;
|
|
6714
6715
|
}
|
|
@@ -6750,11 +6751,11 @@ var __publicField = (obj, key, value) => {
|
|
|
6750
6751
|
* 日期对象转成字符串
|
|
6751
6752
|
* @return {string}
|
|
6752
6753
|
*/
|
|
6753
|
-
date2Str(
|
|
6754
|
+
date2Str(date2, split) {
|
|
6754
6755
|
split = split || "-";
|
|
6755
|
-
const y2 =
|
|
6756
|
-
const m = this.getNumTwoBit(
|
|
6757
|
-
const d = this.getNumTwoBit(
|
|
6756
|
+
const y2 = date2.getFullYear();
|
|
6757
|
+
const m = this.getNumTwoBit(date2.getMonth() + 1);
|
|
6758
|
+
const d = this.getNumTwoBit(date2.getDate());
|
|
6758
6759
|
return [y2, m, d].join(split);
|
|
6759
6760
|
},
|
|
6760
6761
|
/**
|
|
@@ -6764,10 +6765,10 @@ var __publicField = (obj, key, value) => {
|
|
|
6764
6765
|
*/
|
|
6765
6766
|
getDay(i) {
|
|
6766
6767
|
i = i || 0;
|
|
6767
|
-
let
|
|
6768
|
+
let date2 = /* @__PURE__ */ new Date();
|
|
6768
6769
|
const diff = i * (1e3 * 60 * 60 * 24);
|
|
6769
|
-
|
|
6770
|
-
return this.date2Str(
|
|
6770
|
+
date2 = new Date(date2.getTime() + diff);
|
|
6771
|
+
return this.date2Str(date2);
|
|
6771
6772
|
},
|
|
6772
6773
|
/**
|
|
6773
6774
|
* 时间比较
|
|
@@ -6839,7 +6840,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6839
6840
|
const CalendarItem = React.forwardRef((props, ref) => {
|
|
6840
6841
|
const { locale } = useConfig$1();
|
|
6841
6842
|
const {
|
|
6842
|
-
type,
|
|
6843
|
+
type: type2,
|
|
6843
6844
|
isAutoBackFill,
|
|
6844
6845
|
poppable,
|
|
6845
6846
|
title,
|
|
@@ -6913,10 +6914,10 @@ var __publicField = (obj, key, value) => {
|
|
|
6913
6914
|
});
|
|
6914
6915
|
const monthitemclasses = classNames({
|
|
6915
6916
|
"calendar-month-item": true,
|
|
6916
|
-
[`${
|
|
6917
|
+
[`${type2 === "range" ? "month-item-range" : ""}`]: true
|
|
6917
6918
|
});
|
|
6918
|
-
const splitDate = (
|
|
6919
|
-
return
|
|
6919
|
+
const splitDate = (date2) => {
|
|
6920
|
+
return date2.split("-");
|
|
6920
6921
|
};
|
|
6921
6922
|
const isStart = (currDate) => {
|
|
6922
6923
|
return Utils.isEqual(state.currDate[0], currDate);
|
|
@@ -6940,13 +6941,13 @@ var __publicField = (obj, key, value) => {
|
|
|
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) || type2 === "range" && (isStart(currDate) || isEnd(currDate)) || type2 === "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 (type2 === "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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 date2 = `${month.curData[0]}-${month.curData[1]}-${day}`;
|
|
6962
|
+
return Utils.isEqual(date2, 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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
7238
7239
|
getMonth(getCurrData("next"), "next");
|
|
7239
7240
|
} while (i++ < monthsNum);
|
|
7240
7241
|
state.monthsNum = monthsNum;
|
|
7241
|
-
if (
|
|
7242
|
+
if (type2 === "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 @@ var __publicField = (obj, key, value) => {
|
|
|
7307
7308
|
state.currentIndex = current;
|
|
7308
7309
|
setReachedYearMonthInfo();
|
|
7309
7310
|
if (state.defaultData.length > 0) {
|
|
7310
|
-
if (
|
|
7311
|
+
if (type2 === "range") {
|
|
7311
7312
|
chooseDay(
|
|
7312
7313
|
{ day: state.defaultData[2], type: "curr" },
|
|
7313
7314
|
state.monthsData[state.currentIndex],
|
|
@@ -7318,7 +7319,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7318
7319
|
state.monthsData[lastCurrent],
|
|
7319
7320
|
true
|
|
7320
7321
|
);
|
|
7321
|
-
} else if (
|
|
7322
|
+
} else if (type2 === "multiple") {
|
|
7322
7323
|
[...state.currDate].forEach((item) => {
|
|
7323
7324
|
const dateArr = splitDate(item);
|
|
7324
7325
|
let current2 = state.currentIndex;
|
|
@@ -7358,13 +7359,13 @@ var __publicField = (obj, key, value) => {
|
|
|
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 = (date2) => {
|
|
7363
|
+
if (Utils.compareDate(date2, state.propStartDate)) {
|
|
7364
|
+
date2 = state.propStartDate;
|
|
7365
|
+
} else if (!Utils.compareDate(date2, state.propEndDate)) {
|
|
7366
|
+
date2 = state.propEndDate;
|
|
7366
7367
|
}
|
|
7367
|
-
const dateArr = splitDate(
|
|
7368
|
+
const dateArr = splitDate(date2);
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
7487
7488
|
children,
|
|
7488
7489
|
poppable,
|
|
7489
7490
|
visible,
|
|
7490
|
-
type,
|
|
7491
|
+
type: type2,
|
|
7491
7492
|
isAutoBackFill,
|
|
7492
7493
|
title,
|
|
7493
7494
|
defaultValue,
|
|
@@ -7523,9 +7524,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7523
7524
|
const select = (param) => {
|
|
7524
7525
|
onSelected && onSelected(param);
|
|
7525
7526
|
};
|
|
7526
|
-
const scrollToDate = (
|
|
7527
|
+
const scrollToDate = (date2) => {
|
|
7527
7528
|
var _a;
|
|
7528
|
-
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(
|
|
7529
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date2);
|
|
7529
7530
|
};
|
|
7530
7531
|
const yearMonthChange = (param) => {
|
|
7531
7532
|
onYearMonthChange && onYearMonthChange(param);
|
|
@@ -7538,7 +7539,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7538
7539
|
CalendarItem,
|
|
7539
7540
|
{
|
|
7540
7541
|
ref: calendarRef,
|
|
7541
|
-
type,
|
|
7542
|
+
type: type2,
|
|
7542
7543
|
isAutoBackFill,
|
|
7543
7544
|
poppable,
|
|
7544
7545
|
title: title || locale.calendaritem.title,
|
|
@@ -7811,7 +7812,7 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
7861
7862
|
});
|
|
7862
7863
|
React.useEffect(() => {
|
|
7863
7864
|
initData();
|
|
7864
|
-
}, [options,
|
|
7865
|
+
}, [options, format2]);
|
|
7865
7866
|
React.useEffect(() => {
|
|
7866
7867
|
if (defaultValue && defaultValue !== innerValue) {
|
|
7867
7868
|
setInnerValue(defaultValue);
|
|
@@ -7869,10 +7870,10 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
7978
7979
|
const closePopup = () => {
|
|
7979
7980
|
close();
|
|
7980
7981
|
};
|
|
7981
|
-
const chooseItem = async (node,
|
|
7982
|
-
if (!
|
|
7982
|
+
const chooseItem = async (node, type2) => {
|
|
7983
|
+
if (!type2 && 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 (!type2) {
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
8009
8010
|
});
|
|
8010
8011
|
setOptionsData(state.panes);
|
|
8011
8012
|
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
8012
|
-
if (!
|
|
8013
|
+
if (!type2) {
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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, type2);
|
|
8027
8028
|
}
|
|
8028
8029
|
setOptionsData(state.panes);
|
|
8029
8030
|
};
|
|
@@ -8085,7 +8086,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8085
8086
|
Cascader.defaultProps = defaultProps$$;
|
|
8086
8087
|
Cascader.displayName = "NutCascader";
|
|
8087
8088
|
const CheckboxGroupContext = React.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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
8219
8220
|
...others
|
|
8220
8221
|
} = props;
|
|
8221
8222
|
let { labelPosition, ...rest } = others;
|
|
8222
|
-
const ctx = React.useContext(Context);
|
|
8223
|
+
const ctx = React.useContext(Context$1);
|
|
8223
8224
|
let [innerChecked, setChecked] = usePropsValue({
|
|
8224
8225
|
value: props.checked,
|
|
8225
8226
|
defaultValue: props.defaultChecked,
|
|
@@ -8419,18 +8420,18 @@ var __publicField = (obj, key, value) => {
|
|
|
8419
8420
|
}
|
|
8420
8421
|
return false;
|
|
8421
8422
|
};
|
|
8422
|
-
const setTransform = (translateY = 0,
|
|
8423
|
+
const setTransform = (translateY = 0, type2, time = DEFAULT_DURATION, deg) => {
|
|
8423
8424
|
let nTime = time;
|
|
8424
|
-
if (
|
|
8425
|
+
if (type2 !== "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, type2, time) => {
|
|
8432
8433
|
let updateMove = move + transformY.current;
|
|
8433
|
-
if (
|
|
8434
|
+
if (type2 === "end") {
|
|
8434
8435
|
if (updateMove > 0) {
|
|
8435
8436
|
updateMove = 0;
|
|
8436
8437
|
}
|
|
@@ -8439,7 +8440,7 @@ var __publicField = (obj, key, value) => {
|
|
|
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, type2, 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 @@ var __publicField = (obj, key, value) => {
|
|
|
8492
8493
|
nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
|
|
8493
8494
|
return nDistance;
|
|
8494
8495
|
};
|
|
8495
|
-
const modifyStatus = (
|
|
8496
|
+
const modifyStatus = (type2, val) => {
|
|
8496
8497
|
const value = val || defaultValue;
|
|
8497
8498
|
let index = -1;
|
|
8498
8499
|
if (value) {
|
|
@@ -8512,7 +8513,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8512
8513
|
}
|
|
8513
8514
|
setCurrIndex(index === -1 ? 1 : index + 1);
|
|
8514
8515
|
const move = index === -1 ? 0 : index * lineSpacing.current;
|
|
8515
|
-
|
|
8516
|
+
type2 && setChooseValue(-move);
|
|
8516
8517
|
setMove(-move);
|
|
8517
8518
|
};
|
|
8518
8519
|
const stopMomentum = () => {
|
|
@@ -8670,6 +8671,11 @@ var __publicField = (obj, key, value) => {
|
|
|
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] = React.useState(selectedValue);
|
|
8674
8680
|
const [currentValue, setCurrentValue] = React.useState([]);
|
|
8675
8681
|
const [columnIndex, setColumnIndex] = React.useState(0);
|
|
@@ -8677,6 +8683,15 @@ var __publicField = (obj, key, value) => {
|
|
|
8677
8683
|
const [refs, setRefs] = useRefs();
|
|
8678
8684
|
const [columnsList, setColumnsList] = React.useState([]);
|
|
8679
8685
|
const isConfirmEvent = React.useRef(false);
|
|
8686
|
+
const actions = {
|
|
8687
|
+
open: () => {
|
|
8688
|
+
setInnerVisible(true);
|
|
8689
|
+
},
|
|
8690
|
+
close: () => {
|
|
8691
|
+
setInnerVisible(false);
|
|
8692
|
+
}
|
|
8693
|
+
};
|
|
8694
|
+
React.useImperativeHandle(ref, () => actions);
|
|
8680
8695
|
const formatCascade = (columns, values) => {
|
|
8681
8696
|
const formatted = [];
|
|
8682
8697
|
let columnOptions = {
|
|
@@ -8712,8 +8727,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8712
8727
|
return "single";
|
|
8713
8728
|
};
|
|
8714
8729
|
const normalListData = (innerValue2) => {
|
|
8715
|
-
const
|
|
8716
|
-
switch (
|
|
8730
|
+
const type2 = columnsType();
|
|
8731
|
+
switch (type2) {
|
|
8717
8732
|
case "multiple":
|
|
8718
8733
|
return options;
|
|
8719
8734
|
case "cascade":
|
|
@@ -8738,19 +8753,19 @@ var __publicField = (obj, key, value) => {
|
|
|
8738
8753
|
};
|
|
8739
8754
|
React.useEffect(() => {
|
|
8740
8755
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
8741
|
-
}, [
|
|
8756
|
+
}, [innerVisible]);
|
|
8742
8757
|
React.useEffect(() => {
|
|
8743
|
-
if (
|
|
8758
|
+
if (innerVisible) {
|
|
8744
8759
|
init();
|
|
8745
8760
|
}
|
|
8746
|
-
}, [options,
|
|
8761
|
+
}, [options, innerVisible]);
|
|
8747
8762
|
React.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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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 @@ var __publicField = (obj, key, value) => {
|
|
|
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] = React.useState(false);
|
|
8857
8887
|
const pickerStart = () => {
|
|
@@ -8875,16 +8905,16 @@ var __publicField = (obj, key, value) => {
|
|
|
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(components.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(components.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,35 +8953,35 @@ var __publicField = (obj, key, value) => {
|
|
|
8923
8953
|
}));
|
|
8924
8954
|
})
|
|
8925
8955
|
)))
|
|
8926
|
-
);
|
|
8956
|
+
));
|
|
8927
8957
|
};
|
|
8928
8958
|
const Picker = React.forwardRef(InternalPicker);
|
|
8929
8959
|
const Picker$1 = Picker;
|
|
8930
8960
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
8931
8961
|
const defaultProps$X = {
|
|
8932
|
-
|
|
8962
|
+
...ComponentDefaults,
|
|
8933
8963
|
visible: false,
|
|
8934
8964
|
title: "",
|
|
8935
8965
|
type: "date",
|
|
8936
|
-
|
|
8966
|
+
showChinese: false,
|
|
8937
8967
|
threeDimensional: true,
|
|
8938
8968
|
minuteStep: 1,
|
|
8939
|
-
|
|
8940
|
-
|
|
8969
|
+
startDate: new Date(currentYear - 10, 0, 1),
|
|
8970
|
+
endDate: new Date(currentYear + 10, 11, 31)
|
|
8941
8971
|
};
|
|
8942
8972
|
const DatePicker = (props) => {
|
|
8943
8973
|
const {
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
type,
|
|
8947
|
-
|
|
8974
|
+
startDate,
|
|
8975
|
+
endDate,
|
|
8976
|
+
type: type2,
|
|
8977
|
+
showChinese,
|
|
8948
8978
|
minuteStep,
|
|
8949
|
-
modelValue,
|
|
8950
8979
|
visible,
|
|
8951
8980
|
title,
|
|
8981
|
+
defaultValue,
|
|
8952
8982
|
formatter,
|
|
8953
|
-
|
|
8954
|
-
|
|
8983
|
+
onClose,
|
|
8984
|
+
onConfirm,
|
|
8955
8985
|
filter,
|
|
8956
8986
|
onChange,
|
|
8957
8987
|
threeDimensional,
|
|
@@ -8963,14 +8993,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8963
8993
|
...props
|
|
8964
8994
|
};
|
|
8965
8995
|
const { locale } = useConfig$1();
|
|
8966
|
-
const [show, setShow] = React.useState(false);
|
|
8967
|
-
const [currentDate, setCurrentDate] = React.useState(modelValue);
|
|
8968
|
-
const [defaultValue, setDefaultValue] = React.useState([]);
|
|
8969
|
-
const [options, setListData] = React.useState([]);
|
|
8970
|
-
const pickerRef = React.useRef(null);
|
|
8971
|
-
const isDate = (val) => {
|
|
8972
|
-
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
8973
|
-
};
|
|
8974
8996
|
const datepickerLang = locale.datepicker;
|
|
8975
8997
|
const zhCNType = {
|
|
8976
8998
|
day: datepickerLang.day,
|
|
@@ -8980,28 +9002,40 @@ var __publicField = (obj, key, value) => {
|
|
|
8980
9002
|
minute: datepickerLang.min,
|
|
8981
9003
|
seconds: datepickerLang.seconds
|
|
8982
9004
|
};
|
|
9005
|
+
const [defaultValueOfPicker, setDefaultValueOfPicker] = React.useState([]);
|
|
9006
|
+
const [options, setOptions] = React.useState([]);
|
|
9007
|
+
const isDate = (val) => {
|
|
9008
|
+
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
9009
|
+
};
|
|
8983
9010
|
const formatValue = (value) => {
|
|
8984
9011
|
let cvalue = value;
|
|
8985
9012
|
if (!cvalue || cvalue && !isDate(cvalue)) {
|
|
8986
|
-
cvalue =
|
|
9013
|
+
cvalue = startDate;
|
|
8987
9014
|
}
|
|
8988
|
-
let timestmp = Math.max(cvalue.getTime(),
|
|
8989
|
-
timestmp = Math.min(timestmp,
|
|
9015
|
+
let timestmp = Math.max(cvalue.getTime(), startDate.getTime());
|
|
9016
|
+
timestmp = Math.min(timestmp, endDate.getTime());
|
|
8990
9017
|
return new Date(timestmp);
|
|
8991
9018
|
};
|
|
9019
|
+
const [currentDate, setCurrentDate] = usePropsValue({
|
|
9020
|
+
value: props.value && formatValue(props.value),
|
|
9021
|
+
defaultValue: formatValue(props.defaultValue || null),
|
|
9022
|
+
finalValue: null,
|
|
9023
|
+
onChange: (val) => {
|
|
9024
|
+
}
|
|
9025
|
+
});
|
|
8992
9026
|
function getMonthEndDay(year, month) {
|
|
8993
9027
|
return new Date(year, month, 0).getDate();
|
|
8994
9028
|
}
|
|
8995
|
-
const getBoundary = (
|
|
8996
|
-
const boundary =
|
|
9029
|
+
const getBoundary = (type22, value) => {
|
|
9030
|
+
const boundary = type22 === "min" ? startDate : endDate;
|
|
8997
9031
|
const year = boundary.getFullYear();
|
|
8998
9032
|
let month = 1;
|
|
8999
|
-
let
|
|
9033
|
+
let date2 = 1;
|
|
9000
9034
|
let hour = 0;
|
|
9001
9035
|
let minute = 0;
|
|
9002
|
-
if (
|
|
9036
|
+
if (type22 === "max") {
|
|
9003
9037
|
month = 12;
|
|
9004
|
-
|
|
9038
|
+
date2 = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
9005
9039
|
hour = 23;
|
|
9006
9040
|
minute = 59;
|
|
9007
9041
|
}
|
|
@@ -9009,8 +9043,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9009
9043
|
if (value.getFullYear() === year) {
|
|
9010
9044
|
month = boundary.getMonth() + 1;
|
|
9011
9045
|
if (value.getMonth() + 1 === month) {
|
|
9012
|
-
|
|
9013
|
-
if (value.getDate() ===
|
|
9046
|
+
date2 = boundary.getDate();
|
|
9047
|
+
if (value.getDate() === date2) {
|
|
9014
9048
|
hour = boundary.getHours();
|
|
9015
9049
|
if (value.getHours() === hour) {
|
|
9016
9050
|
minute = boundary.getMinutes();
|
|
@@ -9019,20 +9053,20 @@ var __publicField = (obj, key, value) => {
|
|
|
9019
9053
|
}
|
|
9020
9054
|
}
|
|
9021
9055
|
return {
|
|
9022
|
-
[`${
|
|
9023
|
-
[`${
|
|
9024
|
-
[`${
|
|
9025
|
-
[`${
|
|
9026
|
-
[`${
|
|
9027
|
-
[`${
|
|
9056
|
+
[`${type22}Year`]: year,
|
|
9057
|
+
[`${type22}Month`]: month,
|
|
9058
|
+
[`${type22}Date`]: date2,
|
|
9059
|
+
[`${type22}Hour`]: hour,
|
|
9060
|
+
[`${type22}Minute`]: minute,
|
|
9061
|
+
[`${type22}Seconds`]: seconds
|
|
9028
9062
|
};
|
|
9029
9063
|
};
|
|
9030
|
-
const ranges = (
|
|
9031
|
-
const curDate =
|
|
9064
|
+
const ranges = () => {
|
|
9065
|
+
const curDate = currentDate;
|
|
9032
9066
|
if (!curDate)
|
|
9033
9067
|
return [];
|
|
9034
|
-
const { maxYear, maxDate
|
|
9035
|
-
const { minYear, minDate
|
|
9068
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
|
|
9069
|
+
const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", curDate);
|
|
9036
9070
|
let result = [
|
|
9037
9071
|
{
|
|
9038
9072
|
type: "year",
|
|
@@ -9044,7 +9078,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9044
9078
|
},
|
|
9045
9079
|
{
|
|
9046
9080
|
type: "day",
|
|
9047
|
-
range: [
|
|
9081
|
+
range: [minDate, maxDate]
|
|
9048
9082
|
},
|
|
9049
9083
|
{
|
|
9050
9084
|
type: "hour",
|
|
@@ -9059,7 +9093,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9059
9093
|
range: [minSeconds, maxSeconds]
|
|
9060
9094
|
}
|
|
9061
9095
|
];
|
|
9062
|
-
switch (
|
|
9096
|
+
switch (type2.toLocaleLowerCase()) {
|
|
9063
9097
|
case "date":
|
|
9064
9098
|
result = result.slice(0, 3);
|
|
9065
9099
|
break;
|
|
@@ -9084,21 +9118,23 @@ var __publicField = (obj, key, value) => {
|
|
|
9084
9118
|
}
|
|
9085
9119
|
return result;
|
|
9086
9120
|
};
|
|
9087
|
-
const updateChooseValueCustmer = (
|
|
9121
|
+
const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
|
|
9088
9122
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
9089
|
-
|
|
9123
|
+
type2.toLocaleLowerCase()
|
|
9090
9124
|
)) {
|
|
9091
9125
|
const formatDate = [];
|
|
9092
9126
|
selectedValue.forEach((item) => {
|
|
9093
9127
|
formatDate.push(item);
|
|
9094
9128
|
});
|
|
9095
|
-
if (
|
|
9129
|
+
if (type2.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
|
|
9096
9130
|
formatDate.unshift(
|
|
9097
|
-
new Date(
|
|
9131
|
+
new Date(defaultValue || startDate || endDate).getFullYear()
|
|
9098
9132
|
);
|
|
9099
9133
|
}
|
|
9100
|
-
if (
|
|
9101
|
-
formatDate.push(
|
|
9134
|
+
if (type2.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
|
|
9135
|
+
formatDate.push(
|
|
9136
|
+
new Date(defaultValue || startDate || endDate).getDate()
|
|
9137
|
+
);
|
|
9102
9138
|
}
|
|
9103
9139
|
const year = Number(formatDate[0]);
|
|
9104
9140
|
const month = Number(formatDate[1]) - 1;
|
|
@@ -9106,24 +9142,24 @@ var __publicField = (obj, key, value) => {
|
|
|
9106
9142
|
Number(formatDate[2]),
|
|
9107
9143
|
getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
|
|
9108
9144
|
);
|
|
9109
|
-
let
|
|
9110
|
-
if (
|
|
9111
|
-
|
|
9112
|
-
} else if (
|
|
9113
|
-
|
|
9145
|
+
let date2 = null;
|
|
9146
|
+
if (type2.toLocaleLowerCase() === "date" || type2.toLocaleLowerCase() === "month-day" || type2.toLocaleLowerCase() === "year-month") {
|
|
9147
|
+
date2 = new Date(year, month, day);
|
|
9148
|
+
} else if (type2.toLocaleLowerCase() === "datetime") {
|
|
9149
|
+
date2 = new Date(
|
|
9114
9150
|
year,
|
|
9115
9151
|
month,
|
|
9116
9152
|
day,
|
|
9117
9153
|
Number(formatDate[3]),
|
|
9118
9154
|
Number(formatDate[4])
|
|
9119
9155
|
);
|
|
9120
|
-
} else if (
|
|
9121
|
-
|
|
9156
|
+
} else if (type2.toLocaleLowerCase() === "datehour") {
|
|
9157
|
+
date2 = new Date(year, month, day, Number(formatDate[3]));
|
|
9122
9158
|
}
|
|
9123
|
-
const isEqual = (currentDate == null ? void 0 : currentDate.getTime()) === (
|
|
9124
|
-
|
|
9159
|
+
const isEqual = (currentDate == null ? void 0 : currentDate.getTime()) === (date2 == null ? void 0 : date2.getTime());
|
|
9160
|
+
date2 && isDate(date2) && !isEqual && setCurrentDate(formatValue(date2));
|
|
9125
9161
|
}
|
|
9126
|
-
props.onChange && props.onChange(
|
|
9162
|
+
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
9127
9163
|
};
|
|
9128
9164
|
const padZero = (num, targetLength = 2) => {
|
|
9129
9165
|
let str = `${num}`;
|
|
@@ -9132,27 +9168,28 @@ var __publicField = (obj, key, value) => {
|
|
|
9132
9168
|
}
|
|
9133
9169
|
return str;
|
|
9134
9170
|
};
|
|
9135
|
-
const formatterOption = (
|
|
9171
|
+
const formatterOption = (type22, value) => {
|
|
9136
9172
|
let fOption = null;
|
|
9137
9173
|
if (formatter) {
|
|
9138
|
-
fOption = formatter(
|
|
9174
|
+
fOption = formatter(type22, {
|
|
9139
9175
|
text: padZero(value, 2),
|
|
9140
9176
|
value: padZero(value, 2)
|
|
9141
9177
|
});
|
|
9142
9178
|
} else {
|
|
9143
9179
|
const padMin = padZero(value, 2);
|
|
9144
|
-
const fatter =
|
|
9180
|
+
const fatter = showChinese ? zhCNType[type22] : "";
|
|
9145
9181
|
fOption = { text: padMin + fatter, value: padMin };
|
|
9146
9182
|
}
|
|
9147
9183
|
return fOption;
|
|
9148
9184
|
};
|
|
9149
|
-
const generateValue = (min, max, val,
|
|
9185
|
+
const generateValue = (min, max, val, type22, columnIndex) => {
|
|
9186
|
+
var _a;
|
|
9150
9187
|
let cmin = min;
|
|
9151
9188
|
const arr = [];
|
|
9152
9189
|
let index = 0;
|
|
9153
9190
|
while (cmin <= max) {
|
|
9154
|
-
arr.push(formatterOption(
|
|
9155
|
-
if (
|
|
9191
|
+
arr.push(formatterOption(type22, cmin));
|
|
9192
|
+
if (type22 === "minute") {
|
|
9156
9193
|
cmin += minuteStep;
|
|
9157
9194
|
} else {
|
|
9158
9195
|
cmin++;
|
|
@@ -9161,34 +9198,34 @@ var __publicField = (obj, key, value) => {
|
|
|
9161
9198
|
index++;
|
|
9162
9199
|
}
|
|
9163
9200
|
}
|
|
9164
|
-
|
|
9165
|
-
|
|
9166
|
-
if (props.filter && props.filter(
|
|
9167
|
-
return props.filter(
|
|
9201
|
+
defaultValueOfPicker[columnIndex] = (_a = arr[index]) == null ? void 0 : _a.value;
|
|
9202
|
+
setDefaultValueOfPicker([...defaultValueOfPicker]);
|
|
9203
|
+
if (props.filter && props.filter(type22, arr)) {
|
|
9204
|
+
return props.filter(type22, arr);
|
|
9168
9205
|
}
|
|
9169
9206
|
return arr;
|
|
9170
9207
|
};
|
|
9171
|
-
const getDateIndex = (
|
|
9208
|
+
const getDateIndex = (type22) => {
|
|
9172
9209
|
if (!currentDate)
|
|
9173
9210
|
return 0;
|
|
9174
9211
|
let d = 0;
|
|
9175
|
-
if (
|
|
9212
|
+
if (type22 === "year") {
|
|
9176
9213
|
d = currentDate.getFullYear();
|
|
9177
|
-
} else if (
|
|
9214
|
+
} else if (type22 === "month") {
|
|
9178
9215
|
d = currentDate.getMonth() + 1;
|
|
9179
|
-
} else if (
|
|
9216
|
+
} else if (type22 === "day") {
|
|
9180
9217
|
d = currentDate.getDate();
|
|
9181
|
-
} else if (
|
|
9218
|
+
} else if (type22 === "hour") {
|
|
9182
9219
|
d = currentDate.getHours();
|
|
9183
|
-
} else if (
|
|
9220
|
+
} else if (type22 === "minute") {
|
|
9184
9221
|
d = currentDate.getMinutes();
|
|
9185
|
-
} else if (
|
|
9222
|
+
} else if (type22 === "seconds") {
|
|
9186
9223
|
d = currentDate.getSeconds();
|
|
9187
9224
|
}
|
|
9188
9225
|
return d;
|
|
9189
9226
|
};
|
|
9190
|
-
const columns = (
|
|
9191
|
-
const val = ranges(
|
|
9227
|
+
const columns = () => {
|
|
9228
|
+
const val = ranges().map((res, columnIndex) => {
|
|
9192
9229
|
return generateValue(
|
|
9193
9230
|
res.range[0],
|
|
9194
9231
|
res.range[1],
|
|
@@ -9199,251 +9236,1218 @@ var __publicField = (obj, key, value) => {
|
|
|
9199
9236
|
});
|
|
9200
9237
|
return val || [];
|
|
9201
9238
|
};
|
|
9202
|
-
React.useEffect(() => {
|
|
9203
|
-
setCurrentDate(formatValue(modelValue));
|
|
9204
|
-
}, []);
|
|
9205
|
-
React.useEffect(() => {
|
|
9206
|
-
setCurrentDate(formatValue(modelValue));
|
|
9207
|
-
}, [modelValue]);
|
|
9208
|
-
React.useEffect(() => {
|
|
9209
|
-
setShow(visible);
|
|
9210
|
-
}, [visible]);
|
|
9211
9239
|
React.useEffect(() => {
|
|
9212
9240
|
if (currentDate) {
|
|
9213
|
-
|
|
9241
|
+
setOptions(columns());
|
|
9214
9242
|
}
|
|
9215
|
-
}, [
|
|
9243
|
+
}, []);
|
|
9216
9244
|
return /* @__PURE__ */ React.createElement(
|
|
9217
9245
|
components.View,
|
|
9218
9246
|
{
|
|
9219
|
-
className: `nut-datepicker ${className
|
|
9247
|
+
className: `nut-datepicker ${className}`,
|
|
9220
9248
|
style,
|
|
9221
9249
|
catchMove: true,
|
|
9222
9250
|
...rest
|
|
9223
9251
|
},
|
|
9224
|
-
options.length
|
|
9252
|
+
options.length && /* @__PURE__ */ React.createElement(
|
|
9225
9253
|
Picker$1,
|
|
9226
9254
|
{
|
|
9227
9255
|
title,
|
|
9228
|
-
visible
|
|
9256
|
+
visible,
|
|
9229
9257
|
options,
|
|
9230
|
-
onClose
|
|
9231
|
-
defaultValue,
|
|
9232
|
-
onConfirm: (options2,
|
|
9233
|
-
onChange: (
|
|
9234
|
-
threeDimensional
|
|
9235
|
-
ref: pickerRef
|
|
9258
|
+
onClose,
|
|
9259
|
+
defaultValue: defaultValueOfPicker,
|
|
9260
|
+
onConfirm: (options2, value) => onConfirm && onConfirm(options2, value),
|
|
9261
|
+
onChange: (options2, value, index) => updateChooseValueCustmer(options2, value, index),
|
|
9262
|
+
threeDimensional
|
|
9236
9263
|
}
|
|
9237
9264
|
)
|
|
9238
9265
|
);
|
|
9239
9266
|
};
|
|
9240
9267
|
DatePicker.defaultProps = defaultProps$X;
|
|
9241
9268
|
DatePicker.displayName = "NutDatePicker";
|
|
9242
|
-
const
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
labelWidth: 90,
|
|
9251
|
-
errorMessageAlign: "left",
|
|
9252
|
-
showErrorLine: true,
|
|
9253
|
-
showErrorMessage: true
|
|
9254
|
-
};
|
|
9255
|
-
class FormItem extends React.Component {
|
|
9256
|
-
constructor() {
|
|
9257
|
-
super(...arguments);
|
|
9258
|
-
__publicField(this, "cancelRegister");
|
|
9259
|
-
// children添加value属性和onChange事件
|
|
9260
|
-
__publicField(this, "getControlled", (children) => {
|
|
9261
|
-
const { getFieldValue, setFieldsValue } = this.context;
|
|
9262
|
-
const { name } = this.props;
|
|
9263
|
-
const type = children.type.NAME;
|
|
9264
|
-
return {
|
|
9265
|
-
value: getFieldValue(name),
|
|
9266
|
-
onChange: (event) => {
|
|
9267
|
-
let newValue = event;
|
|
9268
|
-
switch (type) {
|
|
9269
|
-
case "checkbox":
|
|
9270
|
-
newValue = event.target.value;
|
|
9271
|
-
break;
|
|
9272
|
-
}
|
|
9273
|
-
setFieldsValue({ [name]: newValue });
|
|
9269
|
+
const Context = React.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];
|
|
9274
9277
|
}
|
|
9275
|
-
}
|
|
9276
|
-
}
|
|
9277
|
-
|
|
9278
|
-
|
|
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
|
+
}
|
|
9279
9359
|
});
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
}
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
|
|
9305
|
-
|
|
9306
|
-
|
|
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 warning2(type2, 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(type2, 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]";
|
|
9307
9416
|
}
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
{
|
|
9313
|
-
className: "nut-form-item__body__tips",
|
|
9314
|
-
style: { textAlign: errorMessageAlign }
|
|
9315
|
-
},
|
|
9316
|
-
item[0].message
|
|
9317
|
-
)));
|
|
9318
|
-
});
|
|
9319
|
-
__publicField(this, "pxCheck", (value) => {
|
|
9320
|
-
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
9417
|
+
break;
|
|
9418
|
+
default:
|
|
9419
|
+
return x;
|
|
9420
|
+
}
|
|
9321
9421
|
});
|
|
9422
|
+
return str;
|
|
9322
9423
|
}
|
|
9323
|
-
|
|
9324
|
-
|
|
9424
|
+
return template;
|
|
9425
|
+
}
|
|
9426
|
+
function isNativeStringType(type2) {
|
|
9427
|
+
return type2 === "string" || type2 === "url" || type2 === "hex" || type2 === "email" || type2 === "date" || type2 === "pattern";
|
|
9428
|
+
}
|
|
9429
|
+
function isEmptyValue(value, type2) {
|
|
9430
|
+
if (value === void 0 || value === null) {
|
|
9431
|
+
return true;
|
|
9325
9432
|
}
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
|
|
9433
|
+
if (type2 === "array" && Array.isArray(value) && !value.length) {
|
|
9434
|
+
return true;
|
|
9435
|
+
}
|
|
9436
|
+
if (isNativeStringType(type2) && 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);
|
|
9329
9450
|
}
|
|
9330
9451
|
}
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
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
|
+
}
|
|
9339
9471
|
}
|
|
9472
|
+
next([]);
|
|
9340
9473
|
}
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
|
|
9365
|
-
});
|
|
9366
|
-
/**
|
|
9367
|
-
* 存储组件数据
|
|
9368
|
-
* @param newStore { [name]: newValue }
|
|
9369
|
-
*/
|
|
9370
|
-
__publicField(this, "setFieldsValue", (newStore) => {
|
|
9371
|
-
this.store = {
|
|
9372
|
-
...this.store,
|
|
9373
|
-
...newStore
|
|
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);
|
|
9374
9498
|
};
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
Object.keys(newStore).forEach((key) => {
|
|
9378
|
-
if (key === name) {
|
|
9379
|
-
enetity.onStoreChange();
|
|
9380
|
-
}
|
|
9381
|
-
});
|
|
9382
|
-
});
|
|
9383
|
-
});
|
|
9384
|
-
/**
|
|
9385
|
-
* 表单校验
|
|
9386
|
-
* rules: { required: true, message: '' }
|
|
9387
|
-
* descriptor: {
|
|
9388
|
-
* username: {
|
|
9389
|
-
* type: 'string',
|
|
9390
|
-
* required: true,
|
|
9391
|
-
* validator: (rule, value) => {
|
|
9392
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
9393
|
-
* },
|
|
9394
|
-
* },
|
|
9395
|
-
* }
|
|
9396
|
-
*/
|
|
9397
|
-
__publicField(this, "validate", () => {
|
|
9398
|
-
const err = [];
|
|
9399
|
-
this.errList.length = 0;
|
|
9400
|
-
this.fieldEntities.forEach((entity) => {
|
|
9401
|
-
const { name, rules = [] } = entity.props;
|
|
9402
|
-
const descriptor = {};
|
|
9403
|
-
if (rules.length) {
|
|
9404
|
-
if (rules.length > 1) {
|
|
9405
|
-
descriptor[name] = [];
|
|
9406
|
-
rules.map((v) => {
|
|
9407
|
-
descriptor[name].push(v);
|
|
9408
|
-
});
|
|
9409
|
-
} else {
|
|
9410
|
-
descriptor[name] = rules[0];
|
|
9411
|
-
}
|
|
9412
|
-
}
|
|
9413
|
-
});
|
|
9414
|
-
return err;
|
|
9499
|
+
var flattenArr = flattenObjArr(objArr);
|
|
9500
|
+
asyncSerialArray(flattenArr, func, next);
|
|
9415
9501
|
});
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
...this.callbacks,
|
|
9419
|
-
...callback
|
|
9420
|
-
};
|
|
9502
|
+
_pending["catch"](function(e) {
|
|
9503
|
+
return e;
|
|
9421
9504
|
});
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9505
|
+
return _pending;
|
|
9506
|
+
}
|
|
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);
|
|
9429
9519
|
}
|
|
9430
|
-
}
|
|
9431
|
-
|
|
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]];
|
|
9549
|
+
}
|
|
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
|
+
}
|
|
9583
|
+
}
|
|
9584
|
+
}
|
|
9585
|
+
return target;
|
|
9586
|
+
}
|
|
9587
|
+
var required$1 = function required2(rule, value, source, errors, options, type2) {
|
|
9588
|
+
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type2 || 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 integer2(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 array2(value) {
|
|
9651
|
+
return Array.isArray(value);
|
|
9652
|
+
},
|
|
9653
|
+
regexp: function regexp2(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 date2(value) {
|
|
9664
|
+
return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
|
|
9665
|
+
},
|
|
9666
|
+
number: function number2(value) {
|
|
9667
|
+
if (isNaN(value)) {
|
|
9668
|
+
return false;
|
|
9669
|
+
}
|
|
9670
|
+
return typeof value === "number";
|
|
9671
|
+
},
|
|
9672
|
+
object: function object2(value) {
|
|
9673
|
+
return typeof value === "object" && !types.array(value);
|
|
9674
|
+
},
|
|
9675
|
+
method: function method2(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 type2(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 enumerable2(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 pattern2(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 method = function method2(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 number = function number2(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 regexp = function regexp2(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 integer = function integer2(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 array = function array2(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 object = function object2(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 enumerable = function enumerable2(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 pattern = function pattern2(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 date = function date2(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 required = function required2(rule, value, callback, source, options) {
|
|
9962
|
+
var errors = [];
|
|
9963
|
+
var type2 = Array.isArray(value) ? "array" : typeof value;
|
|
9964
|
+
rules.required(rule, value, source, errors, options, type2);
|
|
9965
|
+
callback(errors);
|
|
9966
|
+
};
|
|
9967
|
+
var type = function type2(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);
|
|
9990
|
+
}
|
|
9991
|
+
callback(errors);
|
|
9992
|
+
};
|
|
9993
|
+
var validators = {
|
|
9994
|
+
string,
|
|
9995
|
+
method,
|
|
9996
|
+
number,
|
|
9997
|
+
"boolean": _boolean,
|
|
9998
|
+
regexp,
|
|
9999
|
+
integer,
|
|
10000
|
+
"float": floatFn,
|
|
10001
|
+
array,
|
|
10002
|
+
object,
|
|
10003
|
+
"enum": enumerable,
|
|
10004
|
+
pattern,
|
|
10005
|
+
date,
|
|
10006
|
+
url: type,
|
|
10007
|
+
hex: type,
|
|
10008
|
+
email: type,
|
|
10009
|
+
required,
|
|
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
|
+
};
|
|
10065
|
+
}
|
|
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 define2(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(type2, validator) {
|
|
10315
|
+
if (typeof validator !== "function") {
|
|
10316
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
10317
|
+
}
|
|
10318
|
+
validators[type2] = validator;
|
|
10319
|
+
};
|
|
10320
|
+
Schema.warning = warning;
|
|
10321
|
+
Schema.messages = messages;
|
|
10322
|
+
Schema.validators = validators;
|
|
10323
|
+
class FormStore {
|
|
10324
|
+
constructor() {
|
|
10325
|
+
// 初始化数据
|
|
10326
|
+
__publicField(this, "initialValues", {});
|
|
10327
|
+
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
10328
|
+
__publicField(this, "store", {});
|
|
10329
|
+
// 所有的组件实例
|
|
10330
|
+
__publicField(this, "fieldEntities", []);
|
|
10331
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
10332
|
+
__publicField(this, "callbacks", {});
|
|
10333
|
+
__publicField(this, "errors", []);
|
|
10334
|
+
/**
|
|
10335
|
+
* 注册组件实例
|
|
10336
|
+
* @param field
|
|
10337
|
+
*/
|
|
10338
|
+
__publicField(this, "registerField", (field) => {
|
|
10339
|
+
this.fieldEntities.push(field);
|
|
10340
|
+
return () => {
|
|
10341
|
+
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
10342
|
+
if (this.store) {
|
|
10343
|
+
delete this.store[field.props.name];
|
|
10344
|
+
}
|
|
10345
|
+
};
|
|
10346
|
+
});
|
|
10347
|
+
/**
|
|
10348
|
+
* 获取 formItem 的值
|
|
10349
|
+
* @param name
|
|
10350
|
+
*/
|
|
10351
|
+
__publicField(this, "getFieldValue", (name) => {
|
|
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
|
+
}
|
|
10365
|
+
});
|
|
10366
|
+
/**
|
|
10367
|
+
* 存储组件数据
|
|
10368
|
+
* @param newStore { [name]: newValue }
|
|
10369
|
+
*/
|
|
10370
|
+
__publicField(this, "setFieldsValue", (newStore) => {
|
|
10371
|
+
this.store = {
|
|
10372
|
+
...this.store,
|
|
10373
|
+
...newStore
|
|
10374
|
+
};
|
|
10375
|
+
this.fieldEntities.forEach((enetity) => {
|
|
10376
|
+
const { name } = enetity.props;
|
|
10377
|
+
Object.keys(newStore).forEach((key) => {
|
|
10378
|
+
if (key === name) {
|
|
10379
|
+
enetity.onStoreChange("update");
|
|
10380
|
+
}
|
|
10381
|
+
});
|
|
10382
|
+
});
|
|
10383
|
+
});
|
|
10384
|
+
__publicField(this, "setCallback", (callback) => {
|
|
10385
|
+
this.callbacks = {
|
|
10386
|
+
...this.callbacks,
|
|
10387
|
+
...callback
|
|
10388
|
+
};
|
|
10389
|
+
});
|
|
10390
|
+
__publicField(this, "validate", () => {
|
|
10391
|
+
const err = [];
|
|
10392
|
+
this.errors.length = 0;
|
|
10393
|
+
this.fieldEntities.forEach((entity) => {
|
|
10394
|
+
var _a;
|
|
10395
|
+
const { name, rules: rules2 = [] } = entity.props;
|
|
10396
|
+
const descriptor = {};
|
|
10397
|
+
if (rules2.length) {
|
|
10398
|
+
if (rules2.length > 1) {
|
|
10399
|
+
descriptor[name] = [];
|
|
10400
|
+
rules2.forEach((v) => {
|
|
10401
|
+
descriptor[name].push(v);
|
|
10402
|
+
});
|
|
10403
|
+
} else {
|
|
10404
|
+
descriptor[name] = rules2[0];
|
|
10405
|
+
}
|
|
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
|
+
});
|
|
10416
|
+
});
|
|
10417
|
+
return err;
|
|
10418
|
+
});
|
|
10419
|
+
__publicField(this, "submit", () => {
|
|
10420
|
+
var _a, _b, _c, _d;
|
|
10421
|
+
const errors = this.validate();
|
|
10422
|
+
if (errors.length === 0) {
|
|
10423
|
+
(_b = (_a = this.callbacks).onFinish) == null ? void 0 : _b.call(_a, this.store);
|
|
10424
|
+
} else if (errors.length > 0) {
|
|
10425
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
|
|
10426
|
+
}
|
|
10427
|
+
});
|
|
10428
|
+
__publicField(this, "resetFields", () => {
|
|
10429
|
+
this.errors.length = 0;
|
|
10430
|
+
this.store = this.initialValues;
|
|
10431
|
+
this.fieldEntities.forEach((entity) => {
|
|
10432
|
+
entity.onStoreChange("reset");
|
|
10433
|
+
});
|
|
9432
10434
|
});
|
|
9433
10435
|
__publicField(this, "getForm", () => {
|
|
9434
10436
|
return {
|
|
10437
|
+
setInitialValues: this.setInitialValues,
|
|
9435
10438
|
setCallback: this.setCallback,
|
|
9436
10439
|
registerField: this.registerField,
|
|
9437
10440
|
getFieldValue: this.getFieldValue,
|
|
9438
10441
|
setFieldsValue: this.setFieldsValue,
|
|
10442
|
+
resetFields: this.resetFields,
|
|
9439
10443
|
submit: this.submit,
|
|
9440
10444
|
store: this.store,
|
|
9441
|
-
|
|
10445
|
+
errors: this.errors,
|
|
9442
10446
|
fieldEntities: this.fieldEntities
|
|
9443
10447
|
};
|
|
9444
10448
|
});
|
|
9445
10449
|
this.callbacks = {
|
|
9446
|
-
onFinish: (
|
|
10450
|
+
onFinish: () => {
|
|
9447
10451
|
},
|
|
9448
10452
|
onFinishFailed: () => {
|
|
9449
10453
|
}
|
|
@@ -9462,60 +10466,209 @@ var __publicField = (obj, key, value) => {
|
|
|
9462
10466
|
}
|
|
9463
10467
|
return [formRef.current];
|
|
9464
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", (type2) => {
|
|
10536
|
+
if (type2 === "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: required2, 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 = required2 && /* @__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);
|
|
9465
10597
|
const defaultProps$V = {
|
|
9466
10598
|
...ComponentDefaults,
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
labelPosition: "Right",
|
|
9471
|
-
formGroupTitle: "",
|
|
9472
|
-
onFinish: (obj) => {
|
|
9473
|
-
},
|
|
9474
|
-
onFinishFailed: (value) => {
|
|
10599
|
+
labelPosition: "right",
|
|
10600
|
+
starPosition: "left",
|
|
10601
|
+
onFinish: (values) => {
|
|
9475
10602
|
},
|
|
9476
|
-
|
|
10603
|
+
onFinishFailed: (values, errorFields) => {
|
|
10604
|
+
}
|
|
9477
10605
|
};
|
|
9478
10606
|
const PositionInfo = {
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
10607
|
+
top: "form-layout-top",
|
|
10608
|
+
left: "form-layout-left",
|
|
10609
|
+
right: "form-layout-right"
|
|
9482
10610
|
};
|
|
9483
10611
|
const Form = (props) => {
|
|
10612
|
+
const classPrefix2 = "nut-form";
|
|
9484
10613
|
const {
|
|
10614
|
+
className,
|
|
10615
|
+
style,
|
|
10616
|
+
footer,
|
|
9485
10617
|
children,
|
|
10618
|
+
initialValues,
|
|
9486
10619
|
onFinish,
|
|
9487
10620
|
onFinishFailed,
|
|
9488
10621
|
labelPosition,
|
|
9489
|
-
|
|
9490
|
-
|
|
10622
|
+
starPosition,
|
|
10623
|
+
form
|
|
9491
10624
|
} = {
|
|
9492
10625
|
...defaultProps$V,
|
|
9493
10626
|
...props
|
|
9494
10627
|
};
|
|
9495
|
-
|
|
9496
|
-
|
|
9497
|
-
|
|
9498
|
-
|
|
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;
|
|
9499
10636
|
setCallback({
|
|
9500
10637
|
onFinish,
|
|
9501
10638
|
onFinishFailed
|
|
9502
10639
|
});
|
|
10640
|
+
const mountRef = React.useRef(false);
|
|
10641
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
10642
|
+
if (!mountRef.current) {
|
|
10643
|
+
mountRef.current = true;
|
|
10644
|
+
}
|
|
9503
10645
|
return /* @__PURE__ */ React.createElement(
|
|
9504
10646
|
"form",
|
|
9505
10647
|
{
|
|
9506
|
-
className:
|
|
9507
|
-
|
|
10648
|
+
className: classNames(
|
|
10649
|
+
classPrefix2,
|
|
10650
|
+
className,
|
|
10651
|
+
PositionInfo[labelPosition]
|
|
10652
|
+
),
|
|
10653
|
+
style,
|
|
9508
10654
|
onSubmit: (e) => {
|
|
9509
10655
|
e.preventDefault();
|
|
10656
|
+
e.stopPropagation();
|
|
9510
10657
|
submit();
|
|
10658
|
+
},
|
|
10659
|
+
onReset: (e) => {
|
|
10660
|
+
e.preventDefault();
|
|
10661
|
+
e.stopPropagation();
|
|
10662
|
+
resetFields();
|
|
9511
10663
|
}
|
|
9512
10664
|
},
|
|
9513
|
-
/* @__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)
|
|
9514
10666
|
);
|
|
9515
10667
|
};
|
|
9516
10668
|
Form.defaultProps = defaultProps$V;
|
|
9517
10669
|
Form.displayName = "NutForm";
|
|
9518
10670
|
Form.Item = FormItem;
|
|
10671
|
+
Form.useForm = useForm;
|
|
9519
10672
|
function trimExtraChar(value, char, regExp) {
|
|
9520
10673
|
const index = value.indexOf(char);
|
|
9521
10674
|
if (index === -1) {
|
|
@@ -9560,7 +10713,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9560
10713
|
(props, ref) => {
|
|
9561
10714
|
const { locale } = useConfig$1();
|
|
9562
10715
|
const {
|
|
9563
|
-
type,
|
|
10716
|
+
type: type2,
|
|
9564
10717
|
name,
|
|
9565
10718
|
placeholder,
|
|
9566
10719
|
align,
|
|
@@ -9622,10 +10775,10 @@ var __publicField = (obj, key, value) => {
|
|
|
9622
10775
|
const updateValue = (value2, trigger = "onChange") => {
|
|
9623
10776
|
let val = value2;
|
|
9624
10777
|
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
9625
|
-
if (
|
|
10778
|
+
if (type2 === "number") {
|
|
9626
10779
|
val = formatNumber(val, false, true);
|
|
9627
10780
|
}
|
|
9628
|
-
if (
|
|
10781
|
+
if (type2 === "digit") {
|
|
9629
10782
|
val = formatNumber(val, true, true);
|
|
9630
10783
|
}
|
|
9631
10784
|
}
|
|
@@ -9654,18 +10807,18 @@ var __publicField = (obj, key, value) => {
|
|
|
9654
10807
|
setActive(false);
|
|
9655
10808
|
}, 50);
|
|
9656
10809
|
};
|
|
9657
|
-
const inputType = (
|
|
10810
|
+
const inputType = (type22) => {
|
|
9658
10811
|
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
9659
|
-
if (
|
|
10812
|
+
if (type22 === "digit") {
|
|
9660
10813
|
return "text";
|
|
9661
10814
|
}
|
|
9662
|
-
if (
|
|
10815
|
+
if (type22 === "number") {
|
|
9663
10816
|
return "tel";
|
|
9664
10817
|
}
|
|
9665
|
-
} else if (
|
|
10818
|
+
} else if (type22 === "password") {
|
|
9666
10819
|
return "text";
|
|
9667
10820
|
}
|
|
9668
|
-
return
|
|
10821
|
+
return type22;
|
|
9669
10822
|
};
|
|
9670
10823
|
return /* @__PURE__ */ React.createElement(
|
|
9671
10824
|
components.View,
|
|
@@ -9684,8 +10837,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9684
10837
|
className: "nut-input-native",
|
|
9685
10838
|
ref: inputRef,
|
|
9686
10839
|
style: { textAlign: align },
|
|
9687
|
-
type: inputType(
|
|
9688
|
-
password:
|
|
10840
|
+
type: inputType(type2),
|
|
10841
|
+
password: type2 === "password",
|
|
9689
10842
|
maxlength: maxLength,
|
|
9690
10843
|
placeholder: placeholder || locale.placeholder,
|
|
9691
10844
|
disabled: disabled || readOnly,
|
|
@@ -9732,7 +10885,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9732
10885
|
disabled: false,
|
|
9733
10886
|
min: 1,
|
|
9734
10887
|
max: 9999,
|
|
9735
|
-
|
|
10888
|
+
readOnly: false,
|
|
9736
10889
|
allowEmpty: false,
|
|
9737
10890
|
defaultValue: 0,
|
|
9738
10891
|
step: 1,
|
|
@@ -9746,7 +10899,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9746
10899
|
disabled,
|
|
9747
10900
|
min,
|
|
9748
10901
|
max,
|
|
9749
|
-
|
|
10902
|
+
readOnly,
|
|
9750
10903
|
value,
|
|
9751
10904
|
defaultValue,
|
|
9752
10905
|
allowEmpty,
|
|
@@ -9901,14 +11054,14 @@ var __publicField = (obj, key, value) => {
|
|
|
9901
11054
|
const focusValue = (e) => {
|
|
9902
11055
|
if (disabled)
|
|
9903
11056
|
return;
|
|
9904
|
-
if (
|
|
11057
|
+
if (readOnly)
|
|
9905
11058
|
return;
|
|
9906
11059
|
onFocus && onFocus(e);
|
|
9907
11060
|
};
|
|
9908
11061
|
const burValue = (e) => {
|
|
9909
11062
|
if (disabled)
|
|
9910
11063
|
return;
|
|
9911
|
-
if (
|
|
11064
|
+
if (readOnly)
|
|
9912
11065
|
return;
|
|
9913
11066
|
const input = e.target;
|
|
9914
11067
|
let value2 = +input.value;
|
|
@@ -9930,7 +11083,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9930
11083
|
min,
|
|
9931
11084
|
max,
|
|
9932
11085
|
disabled,
|
|
9933
|
-
readOnly
|
|
11086
|
+
readOnly,
|
|
9934
11087
|
value: _checked,
|
|
9935
11088
|
onInput: changeFormatValue,
|
|
9936
11089
|
onBlur: burFormatValue,
|
|
@@ -9943,7 +11096,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9943
11096
|
min,
|
|
9944
11097
|
max,
|
|
9945
11098
|
disabled,
|
|
9946
|
-
readOnly
|
|
11099
|
+
readOnly,
|
|
9947
11100
|
value: _checked,
|
|
9948
11101
|
onInput: changeValue,
|
|
9949
11102
|
onBlur: burValue,
|
|
@@ -10174,103 +11327,115 @@ var __publicField = (obj, key, value) => {
|
|
|
10174
11327
|
return { display: "none" };
|
|
10175
11328
|
};
|
|
10176
11329
|
const getPosition = () => {
|
|
10177
|
-
return direction === "down" ? {
|
|
10178
|
-
|
|
10179
|
-
|
|
11330
|
+
return direction === "down" ? { position: "absolute", height: `${window.innerHeight}px` } : {
|
|
11331
|
+
position: "absolute",
|
|
11332
|
+
bottom: "100%",
|
|
11333
|
+
top: "auto",
|
|
11334
|
+
height: `${window.innerHeight}px`
|
|
10180
11335
|
};
|
|
10181
11336
|
};
|
|
10182
11337
|
const placeholderStyle = () => {
|
|
10183
11338
|
if (direction === "down") {
|
|
10184
11339
|
return {
|
|
10185
11340
|
height: `${position.top + position.height}px`,
|
|
10186
|
-
top:
|
|
11341
|
+
top: "auto",
|
|
11342
|
+
bottom: "-100%",
|
|
10187
11343
|
...isShow()
|
|
10188
11344
|
};
|
|
10189
11345
|
}
|
|
10190
11346
|
return {
|
|
10191
11347
|
height: `${Taro.getSystemInfoSync().windowHeight - position.top}px`,
|
|
10192
|
-
bottom: `
|
|
10193
|
-
top: "
|
|
11348
|
+
bottom: `auto`,
|
|
11349
|
+
top: "0",
|
|
10194
11350
|
...isShow()
|
|
10195
11351
|
};
|
|
10196
11352
|
};
|
|
10197
|
-
return /* @__PURE__ */ React.createElement(
|
|
11353
|
+
return /* @__PURE__ */ React.createElement(
|
|
10198
11354
|
"div",
|
|
10199
11355
|
{
|
|
10200
|
-
className:
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
lockScroll: parent.lockScroll,
|
|
10212
|
-
visible: _showPopup,
|
|
10213
|
-
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
10214
|
-
onClick: () => {
|
|
10215
|
-
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
11356
|
+
className: "nut-menu-item-container",
|
|
11357
|
+
style: { position: "absolute", left: 0, right: 0 }
|
|
11358
|
+
},
|
|
11359
|
+
closeOnClickAway ? /* @__PURE__ */ React.createElement(
|
|
11360
|
+
"div",
|
|
11361
|
+
{
|
|
11362
|
+
className: `placeholder-element ${classNames({
|
|
11363
|
+
up: direction === "up"
|
|
11364
|
+
})}`,
|
|
11365
|
+
style: placeholderStyle(),
|
|
11366
|
+
onClick: () => parent.toggleMenuItem(index)
|
|
10216
11367
|
}
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
11368
|
+
) : null,
|
|
11369
|
+
/* @__PURE__ */ React.createElement(
|
|
11370
|
+
Overlay$1,
|
|
11371
|
+
{
|
|
11372
|
+
className: "nut-menu__overlay",
|
|
11373
|
+
style: getPosition(),
|
|
11374
|
+
lockScroll: parent.lockScroll,
|
|
11375
|
+
visible: _showPopup,
|
|
11376
|
+
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
11377
|
+
onClick: () => {
|
|
11378
|
+
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
11379
|
+
}
|
|
10228
11380
|
}
|
|
10229
|
-
|
|
11381
|
+
),
|
|
10230
11382
|
/* @__PURE__ */ React.createElement(
|
|
10231
|
-
|
|
11383
|
+
"div",
|
|
10232
11384
|
{
|
|
10233
|
-
|
|
10234
|
-
|
|
10235
|
-
|
|
11385
|
+
className: classNames(className, {
|
|
11386
|
+
"nut-menu-item__wrap": direction === "down",
|
|
11387
|
+
"nut-menu-item__wrap-up": direction !== "down"
|
|
11388
|
+
}),
|
|
11389
|
+
style: {
|
|
11390
|
+
...style,
|
|
11391
|
+
...isShow()
|
|
11392
|
+
}
|
|
10236
11393
|
},
|
|
10237
|
-
/* @__PURE__ */ React.createElement(
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
flexBasis: `${100 / columns}%`
|
|
10247
|
-
},
|
|
10248
|
-
onClick: () => {
|
|
10249
|
-
handleClick(item);
|
|
10250
|
-
}
|
|
10251
|
-
},
|
|
10252
|
-
item.value === _value ? /* @__PURE__ */ React.createElement(React.Fragment, null, icon || /* @__PURE__ */ React.createElement(
|
|
10253
|
-
a$t,
|
|
10254
|
-
{
|
|
10255
|
-
color: activeColor,
|
|
10256
|
-
size: 10,
|
|
10257
|
-
className: getIconCName(item.value, value)
|
|
10258
|
-
}
|
|
10259
|
-
)) : null,
|
|
10260
|
-
/* @__PURE__ */ React.createElement(
|
|
11394
|
+
/* @__PURE__ */ React.createElement(
|
|
11395
|
+
CSSTransition$1,
|
|
11396
|
+
{
|
|
11397
|
+
in: _showPopup,
|
|
11398
|
+
timeout: 100,
|
|
11399
|
+
classNames: direction === "down" ? "menu-item" : "menu-item-up"
|
|
11400
|
+
},
|
|
11401
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-menu-item__content" }, options == null ? void 0 : options.map((item, index2) => {
|
|
11402
|
+
return /* @__PURE__ */ React.createElement(
|
|
10261
11403
|
"div",
|
|
10262
11404
|
{
|
|
10263
|
-
className:
|
|
11405
|
+
className: `nut-menu-item__option ${classNames({
|
|
11406
|
+
active: item.value === _value
|
|
11407
|
+
})}`,
|
|
11408
|
+
key: item.text,
|
|
10264
11409
|
style: {
|
|
10265
|
-
|
|
11410
|
+
flexBasis: `${100 / columns}%`
|
|
11411
|
+
},
|
|
11412
|
+
onClick: () => {
|
|
11413
|
+
handleClick(item);
|
|
10266
11414
|
}
|
|
10267
11415
|
},
|
|
10268
|
-
item.
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
11416
|
+
item.value === _value ? /* @__PURE__ */ React.createElement(React.Fragment, null, icon || /* @__PURE__ */ React.createElement(
|
|
11417
|
+
a$t,
|
|
11418
|
+
{
|
|
11419
|
+
color: activeColor,
|
|
11420
|
+
size: 10,
|
|
11421
|
+
className: getIconCName(item.value, value)
|
|
11422
|
+
}
|
|
11423
|
+
)) : null,
|
|
11424
|
+
/* @__PURE__ */ React.createElement(
|
|
11425
|
+
"div",
|
|
11426
|
+
{
|
|
11427
|
+
className: getIconCName(item.value, value),
|
|
11428
|
+
style: {
|
|
11429
|
+
color: `${item.value === _value ? activeColor : ""}`
|
|
11430
|
+
}
|
|
11431
|
+
},
|
|
11432
|
+
item.text
|
|
11433
|
+
)
|
|
11434
|
+
);
|
|
11435
|
+
}), children)
|
|
11436
|
+
)
|
|
10272
11437
|
)
|
|
10273
|
-
)
|
|
11438
|
+
);
|
|
10274
11439
|
});
|
|
10275
11440
|
MenuItem.defaultProps = defaultProps$R;
|
|
10276
11441
|
MenuItem.displayName = "NutMenuItem";
|
|
@@ -10289,7 +11454,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10289
11454
|
title,
|
|
10290
11455
|
confirmText,
|
|
10291
11456
|
visible,
|
|
10292
|
-
type,
|
|
11457
|
+
type: type2,
|
|
10293
11458
|
custom,
|
|
10294
11459
|
random,
|
|
10295
11460
|
style,
|
|
@@ -10328,7 +11493,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10328
11493
|
};
|
|
10329
11494
|
const keysList = React.useMemo(() => {
|
|
10330
11495
|
return [...getBasicKeys(), ...getCustomKeys()];
|
|
10331
|
-
}, [
|
|
11496
|
+
}, [type2, random, custom]);
|
|
10332
11497
|
const DeleteIcon = () => {
|
|
10333
11498
|
const style2 = {
|
|
10334
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`,
|
|
@@ -10389,7 +11554,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10389
11554
|
overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
|
|
10390
11555
|
...rest
|
|
10391
11556
|
},
|
|
10392
|
-
/* @__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), type2 === "default" && /* @__PURE__ */ React.createElement(
|
|
10393
11558
|
"span",
|
|
10394
11559
|
{
|
|
10395
11560
|
className: `${classPrefix2}__header__close`,
|
|
@@ -10398,7 +11563,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10398
11563
|
locale.done
|
|
10399
11564
|
)), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__body` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__body__keys` }, keysList == null ? void 0 : keysList.map((item) => {
|
|
10400
11565
|
return /* @__PURE__ */ React.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
10401
|
-
})),
|
|
11566
|
+
})), type2 === "rightColumn" && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__sidebar` }, /* @__PURE__ */ React.createElement(
|
|
10402
11567
|
NumberKeyboardKey,
|
|
10403
11568
|
{
|
|
10404
11569
|
key: "delete",
|
|
@@ -10634,7 +11799,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10634
11799
|
const Range = (props) => {
|
|
10635
11800
|
const {
|
|
10636
11801
|
className,
|
|
10637
|
-
range,
|
|
11802
|
+
range: range2,
|
|
10638
11803
|
disabled,
|
|
10639
11804
|
button,
|
|
10640
11805
|
vertical,
|
|
@@ -10692,7 +11857,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10692
11857
|
const classPrefix22 = "nut-range-mark";
|
|
10693
11858
|
let lowerBound = min;
|
|
10694
11859
|
let upperBound = max;
|
|
10695
|
-
if (
|
|
11860
|
+
if (range2 && Array.isArray(current)) {
|
|
10696
11861
|
lowerBound = current[0];
|
|
10697
11862
|
upperBound = current[1];
|
|
10698
11863
|
} else {
|
|
@@ -10704,10 +11869,10 @@ var __publicField = (obj, key, value) => {
|
|
|
10704
11869
|
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
10705
11870
|
].join(" ");
|
|
10706
11871
|
},
|
|
10707
|
-
[
|
|
11872
|
+
[range2, current, min, max]
|
|
10708
11873
|
);
|
|
10709
11874
|
const isRange = (val) => {
|
|
10710
|
-
return !!
|
|
11875
|
+
return !!range2 && Array.isArray(val);
|
|
10711
11876
|
};
|
|
10712
11877
|
const calcMainAxis = () => {
|
|
10713
11878
|
const modelVal = current;
|
|
@@ -10749,12 +11914,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10749
11914
|
return style;
|
|
10750
11915
|
};
|
|
10751
11916
|
const tickClass = (mark) => {
|
|
10752
|
-
if (
|
|
11917
|
+
if (range2 && Array.isArray(current)) {
|
|
10753
11918
|
return mark <= current[1] && mark >= current[0];
|
|
10754
11919
|
}
|
|
10755
11920
|
return mark <= current;
|
|
10756
11921
|
};
|
|
10757
|
-
const
|
|
11922
|
+
const format2 = (value2) => {
|
|
10758
11923
|
value2 = Math.max(+min, Math.min(value2, +max));
|
|
10759
11924
|
return Math.round(value2 / +step) * +step;
|
|
10760
11925
|
};
|
|
@@ -10769,9 +11934,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10769
11934
|
};
|
|
10770
11935
|
const updateValue = (value2, end) => {
|
|
10771
11936
|
if (isRange(value2)) {
|
|
10772
|
-
value2 = handleOverlap(value2).map(
|
|
11937
|
+
value2 = handleOverlap(value2).map(format2);
|
|
10773
11938
|
} else {
|
|
10774
|
-
value2 =
|
|
11939
|
+
value2 = format2(value2);
|
|
10775
11940
|
}
|
|
10776
11941
|
if (!isSameValue(value2, current)) {
|
|
10777
11942
|
setCurrent(value2);
|
|
@@ -10811,9 +11976,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10811
11976
|
touch.start(event);
|
|
10812
11977
|
setEaxctValue(current);
|
|
10813
11978
|
if (isRange(current)) {
|
|
10814
|
-
setStartValue(current.map(
|
|
11979
|
+
setStartValue(current.map(format2));
|
|
10815
11980
|
} else {
|
|
10816
|
-
setStartValue(
|
|
11981
|
+
setStartValue(format2(current));
|
|
10817
11982
|
}
|
|
10818
11983
|
setDragStatus("start");
|
|
10819
11984
|
};
|
|
@@ -10880,7 +12045,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10880
12045
|
}
|
|
10881
12046
|
)
|
|
10882
12047
|
);
|
|
10883
|
-
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() },
|
|
12048
|
+
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? [0, 1].map((item, index) => {
|
|
10884
12049
|
return /* @__PURE__ */ React.createElement(
|
|
10885
12050
|
"div",
|
|
10886
12051
|
{
|
|
@@ -11098,7 +12263,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11098
12263
|
return /* @__PURE__ */ React.createElement(
|
|
11099
12264
|
"input",
|
|
11100
12265
|
{
|
|
11101
|
-
className: `${classPrefix2}__input ${
|
|
12266
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
11102
12267
|
ref: searchRef,
|
|
11103
12268
|
style: { ...props.style },
|
|
11104
12269
|
value: value || "",
|
|
@@ -11170,7 +12335,16 @@ var __publicField = (obj, key, value) => {
|
|
|
11170
12335
|
style: { ...props.style }
|
|
11171
12336
|
},
|
|
11172
12337
|
renderLeft(),
|
|
11173
|
-
/* @__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
|
+
),
|
|
11174
12348
|
renderRight()
|
|
11175
12349
|
);
|
|
11176
12350
|
};
|
|
@@ -11220,7 +12394,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11220
12394
|
const comLen = React.useMemo(() => {
|
|
11221
12395
|
return Math.min(Math.max(4, length || 4), 6);
|
|
11222
12396
|
}, [length]);
|
|
11223
|
-
const
|
|
12397
|
+
const format2 = (val) => {
|
|
11224
12398
|
return val.slice(0, comLen);
|
|
11225
12399
|
};
|
|
11226
12400
|
const [inputValue, setInputValue] = usePropsValue({ value, onChange });
|
|
@@ -11230,11 +12404,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11230
12404
|
}
|
|
11231
12405
|
}, [visible]);
|
|
11232
12406
|
React.useEffect(() => {
|
|
11233
|
-
const val =
|
|
12407
|
+
const val = format2(value);
|
|
11234
12408
|
if (val.length >= comLen) {
|
|
11235
12409
|
onComplete && onComplete(val);
|
|
11236
12410
|
}
|
|
11237
|
-
setInputValue(
|
|
12411
|
+
setInputValue(format2(value));
|
|
11238
12412
|
}, [value]);
|
|
11239
12413
|
const sure = () => {
|
|
11240
12414
|
onConfirm && onConfirm(inputValue);
|
|
@@ -11282,7 +12456,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11282
12456
|
const InternalSignature = (props, ref) => {
|
|
11283
12457
|
const {
|
|
11284
12458
|
canvasId,
|
|
11285
|
-
type,
|
|
12459
|
+
type: type2,
|
|
11286
12460
|
lineWidth,
|
|
11287
12461
|
strokeStyle,
|
|
11288
12462
|
className,
|
|
@@ -11510,7 +12684,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11510
12684
|
} = { ...defaultProps$H, ...props };
|
|
11511
12685
|
const classPrefix2 = "nut-textarea";
|
|
11512
12686
|
const compositionRef = React.useRef(false);
|
|
11513
|
-
const
|
|
12687
|
+
const format2 = (value2) => {
|
|
11514
12688
|
if (maxLength !== void 0 && value2.length > maxLength) {
|
|
11515
12689
|
return value2.substring(0, maxLength);
|
|
11516
12690
|
}
|
|
@@ -11519,14 +12693,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11519
12693
|
const [inputValue, setInputValue] = usePropsValue({
|
|
11520
12694
|
value,
|
|
11521
12695
|
defaultValue,
|
|
11522
|
-
finalValue:
|
|
12696
|
+
finalValue: format2(defaultValue),
|
|
11523
12697
|
onChange
|
|
11524
12698
|
});
|
|
11525
12699
|
const handleChange = (event) => {
|
|
11526
12700
|
var _a;
|
|
11527
12701
|
const text = (_a = event == null ? void 0 : event.detail) == null ? void 0 : _a.value;
|
|
11528
12702
|
if (text) {
|
|
11529
|
-
const value2 = compositionRef.current ? text :
|
|
12703
|
+
const value2 = compositionRef.current ? text : format2(text);
|
|
11530
12704
|
setInputValue(value2);
|
|
11531
12705
|
} else {
|
|
11532
12706
|
setInputValue("");
|
|
@@ -11873,7 +13047,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11873
13047
|
previewUrl,
|
|
11874
13048
|
headers,
|
|
11875
13049
|
timeout,
|
|
11876
|
-
method,
|
|
13050
|
+
method: method2,
|
|
11877
13051
|
xhrState,
|
|
11878
13052
|
data,
|
|
11879
13053
|
preview,
|
|
@@ -11989,7 +13163,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11989
13163
|
uploadOption.fileType = fileItem.type;
|
|
11990
13164
|
uploadOption.formData = fileItem.formData;
|
|
11991
13165
|
uploadOption.timeout = timeout * 1;
|
|
11992
|
-
uploadOption.method =
|
|
13166
|
+
uploadOption.method = method2;
|
|
11993
13167
|
uploadOption.xhrState = xhrState;
|
|
11994
13168
|
uploadOption.headers = headers;
|
|
11995
13169
|
uploadOption.taroFilePath = fileItem.path;
|
|
@@ -13094,7 +14268,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13094
14268
|
const getActive = (pace) => {
|
|
13095
14269
|
if (pace) {
|
|
13096
14270
|
const _active = active + pace;
|
|
13097
|
-
return
|
|
14271
|
+
return range2(_active, -1, childCount);
|
|
13098
14272
|
}
|
|
13099
14273
|
return active;
|
|
13100
14274
|
};
|
|
@@ -13106,7 +14280,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13106
14280
|
const requestFrame = (fn) => {
|
|
13107
14281
|
window.requestAnimationFrame.call(window, fn);
|
|
13108
14282
|
};
|
|
13109
|
-
const
|
|
14283
|
+
const range2 = (num, min, max) => {
|
|
13110
14284
|
return Math.min(Math.max(num, min), max);
|
|
13111
14285
|
};
|
|
13112
14286
|
const resettPosition = () => {
|
|
@@ -13122,7 +14296,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13122
14296
|
"nut-noticebar-page": true,
|
|
13123
14297
|
withicon: closeable,
|
|
13124
14298
|
close: closeable,
|
|
13125
|
-
wrap
|
|
14299
|
+
wrapable: wrap
|
|
13126
14300
|
});
|
|
13127
14301
|
React.useEffect(() => {
|
|
13128
14302
|
return () => {
|
|
@@ -13211,7 +14385,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13211
14385
|
id,
|
|
13212
14386
|
children,
|
|
13213
14387
|
style,
|
|
13214
|
-
type,
|
|
14388
|
+
type: type2,
|
|
13215
14389
|
className,
|
|
13216
14390
|
position,
|
|
13217
14391
|
visible,
|
|
@@ -13259,7 +14433,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13259
14433
|
[`${classPrefix$b}--popup-top`]: position === "top",
|
|
13260
14434
|
[`${classPrefix$b}--popup-bottom`]: position === "bottom",
|
|
13261
14435
|
[`${classPrefix$b}`]: true,
|
|
13262
|
-
[`${classPrefix$b}--${
|
|
14436
|
+
[`${classPrefix$b}--${type2}`]: true
|
|
13263
14437
|
});
|
|
13264
14438
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
13265
14439
|
CSSTransition$1,
|
|
@@ -13358,7 +14532,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13358
14532
|
const getContentWidth = async () => {
|
|
13359
14533
|
let rect;
|
|
13360
14534
|
if (targetId) {
|
|
13361
|
-
if (Taro.getEnv()
|
|
14535
|
+
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
13362
14536
|
rect = getRect(document.querySelector(`#${targetId}`));
|
|
13363
14537
|
} else {
|
|
13364
14538
|
rect = await getRectTaro(targetId);
|
|
@@ -13381,13 +14555,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13381
14555
|
return new Promise((resolve) => {
|
|
13382
14556
|
const query = Taro.createSelectorQuery();
|
|
13383
14557
|
query.select(`#${targetId2}`) && query.select(`#${targetId2}`).boundingClientRect();
|
|
13384
|
-
query.exec(
|
|
14558
|
+
query.exec((res) => {
|
|
13385
14559
|
resolve(res[0]);
|
|
13386
14560
|
});
|
|
13387
14561
|
});
|
|
13388
14562
|
};
|
|
13389
14563
|
const getPopoverContentW = async () => {
|
|
13390
|
-
|
|
14564
|
+
const rectContent = await getRectByTaro(popoverContentRef.current);
|
|
13391
14565
|
setElWidth(rectContent.width);
|
|
13392
14566
|
setElHeight(rectContent.height);
|
|
13393
14567
|
};
|
|
@@ -13429,7 +14603,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13429
14603
|
return styles;
|
|
13430
14604
|
};
|
|
13431
14605
|
const getRootPosition = () => {
|
|
13432
|
-
|
|
14606
|
+
const styles = {};
|
|
13433
14607
|
if (!rootPosition) {
|
|
13434
14608
|
styles.visibility = "hidden";
|
|
13435
14609
|
return styles;
|
|
@@ -13441,34 +14615,34 @@ var __publicField = (obj, key, value) => {
|
|
|
13441
14615
|
const skew = location.split("-")[1];
|
|
13442
14616
|
let cross = 0;
|
|
13443
14617
|
let parallel = 0;
|
|
13444
|
-
if (Array.isArray(offset) && offset.length
|
|
14618
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
13445
14619
|
cross += +offset[1];
|
|
13446
14620
|
parallel += +offset[0];
|
|
13447
14621
|
}
|
|
13448
14622
|
if (width) {
|
|
13449
14623
|
if (["bottom", "top"].includes(direction)) {
|
|
13450
|
-
const h = direction
|
|
14624
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
13451
14625
|
styles.top = `${top + h}px`;
|
|
13452
14626
|
if (!skew) {
|
|
13453
14627
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
13454
14628
|
}
|
|
13455
|
-
if (skew
|
|
14629
|
+
if (skew === "start") {
|
|
13456
14630
|
styles.left = `${left + parallel}px`;
|
|
13457
14631
|
}
|
|
13458
|
-
if (skew
|
|
14632
|
+
if (skew === "end") {
|
|
13459
14633
|
styles.left = `${right + parallel}px`;
|
|
13460
14634
|
}
|
|
13461
14635
|
}
|
|
13462
14636
|
if (["left", "right"].includes(direction)) {
|
|
13463
|
-
const contentW = direction
|
|
14637
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
13464
14638
|
styles.left = `${left + contentW}px`;
|
|
13465
14639
|
if (!skew) {
|
|
13466
14640
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
13467
14641
|
}
|
|
13468
|
-
if (skew
|
|
14642
|
+
if (skew === "start") {
|
|
13469
14643
|
styles.top = `${top + parallel}px`;
|
|
13470
14644
|
}
|
|
13471
|
-
if (skew
|
|
14645
|
+
if (skew === "end") {
|
|
13472
14646
|
styles.top = `${top + height + parallel}px`;
|
|
13473
14647
|
}
|
|
13474
14648
|
}
|
|
@@ -13876,10 +15050,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13876
15050
|
}
|
|
13877
15051
|
}
|
|
13878
15052
|
const defaultProps$t = {
|
|
15053
|
+
...ComponentDefaults,
|
|
13879
15054
|
name: ""
|
|
13880
15055
|
};
|
|
13881
15056
|
const Swipe = React.forwardRef((props, instanceRef) => {
|
|
13882
|
-
const
|
|
15057
|
+
const classPrefix2 = "nut-swipe";
|
|
13883
15058
|
const touch = useTouch();
|
|
13884
15059
|
Taro.useReady(() => {
|
|
13885
15060
|
const getWidth = async () => {
|
|
@@ -14001,7 +15176,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14001
15176
|
{
|
|
14002
15177
|
id: "left",
|
|
14003
15178
|
ref: side === "left" ? leftWrapper : rightWrapper,
|
|
14004
|
-
className: `${
|
|
15179
|
+
className: `${classPrefix2}__${side}`,
|
|
14005
15180
|
onClick: (e) => handleOperate(e, side)
|
|
14006
15181
|
},
|
|
14007
15182
|
props[`${side}Action`]
|
|
@@ -14041,13 +15216,13 @@ var __publicField = (obj, key, value) => {
|
|
|
14041
15216
|
"div",
|
|
14042
15217
|
{
|
|
14043
15218
|
ref: root2,
|
|
14044
|
-
className: classNames(
|
|
15219
|
+
className: classNames(classPrefix2, className),
|
|
14045
15220
|
onTouchStart: (e) => onTouchStart(e),
|
|
14046
15221
|
onTouchMove: (e) => onTouchMove(e),
|
|
14047
15222
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
14048
15223
|
style
|
|
14049
15224
|
},
|
|
14050
|
-
/* @__PURE__ */ React.createElement("div", { className: `${
|
|
15225
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left"), children, renderActionContent("right"))
|
|
14051
15226
|
);
|
|
14052
15227
|
});
|
|
14053
15228
|
Swipe.defaultProps = defaultProps$t;
|
|
@@ -14166,7 +15341,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14166
15341
|
iconSize,
|
|
14167
15342
|
msg,
|
|
14168
15343
|
duration,
|
|
14169
|
-
type,
|
|
15344
|
+
type: type2,
|
|
14170
15345
|
title,
|
|
14171
15346
|
closeOnOverlayClick,
|
|
14172
15347
|
contentClassName,
|
|
@@ -14211,7 +15386,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14211
15386
|
}
|
|
14212
15387
|
};
|
|
14213
15388
|
const hasIcon = () => {
|
|
14214
|
-
if (
|
|
15389
|
+
if (type2 !== "text") {
|
|
14215
15390
|
return true;
|
|
14216
15391
|
}
|
|
14217
15392
|
return !!icon;
|
|
@@ -14225,7 +15400,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14225
15400
|
fail: /* @__PURE__ */ React.createElement(a$m, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
14226
15401
|
warn: /* @__PURE__ */ React.createElement(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
14227
15402
|
loading: /* @__PURE__ */ React.createElement(r$g, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
14228
|
-
}[
|
|
15403
|
+
}[type2];
|
|
14229
15404
|
};
|
|
14230
15405
|
const classes = classNames({
|
|
14231
15406
|
"nut-toast-has-icon": icon,
|
|
@@ -14266,14 +15441,14 @@ var __publicField = (obj, key, value) => {
|
|
|
14266
15441
|
};
|
|
14267
15442
|
const classPrefix$7 = `nut-animate`;
|
|
14268
15443
|
const Animate = (props) => {
|
|
14269
|
-
const { className, type, action, loop, onClick, children, ...rest } = {
|
|
15444
|
+
const { className, type: type2, action, loop, onClick, children, ...rest } = {
|
|
14270
15445
|
...defaultProps$r,
|
|
14271
15446
|
...props
|
|
14272
15447
|
};
|
|
14273
15448
|
const [clicked, setClicked] = React.useState(false);
|
|
14274
15449
|
const classes = classNames({
|
|
14275
15450
|
"nut-ani-container": true,
|
|
14276
|
-
[`${classPrefix$7}-${
|
|
15451
|
+
[`${classPrefix$7}-${type2}`]: action === "initial" || clicked ? type2 : false,
|
|
14277
15452
|
loop
|
|
14278
15453
|
});
|
|
14279
15454
|
const cls = classNames(classes, className);
|
|
@@ -14376,8 +15551,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14376
15551
|
className: `${classPrefix2}__number`,
|
|
14377
15552
|
style: numberEaseStyle(idx)
|
|
14378
15553
|
},
|
|
14379
|
-
[...numbers, ...numbers].map((
|
|
14380
|
-
return /* @__PURE__ */ React.createElement("span", { key: subidx },
|
|
15554
|
+
[...numbers, ...numbers].map((number2, subidx) => {
|
|
15555
|
+
return /* @__PURE__ */ React.createElement("span", { key: subidx }, number2);
|
|
14381
15556
|
})
|
|
14382
15557
|
) : /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}__separator` }, item)
|
|
14383
15558
|
);
|
|
@@ -14432,7 +15607,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14432
15607
|
style,
|
|
14433
15608
|
autoplay,
|
|
14434
15609
|
loop,
|
|
14435
|
-
type,
|
|
15610
|
+
type: type2,
|
|
14436
15611
|
onFastBack,
|
|
14437
15612
|
onForward,
|
|
14438
15613
|
onPause,
|
|
@@ -14588,7 +15763,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14588
15763
|
return /* @__PURE__ */ React.createElement("div", { className: b("none-container"), onClick: handleStatusChange }, children);
|
|
14589
15764
|
};
|
|
14590
15765
|
const renderAudio = () => {
|
|
14591
|
-
switch (
|
|
15766
|
+
switch (type2) {
|
|
14592
15767
|
case "icon":
|
|
14593
15768
|
return renderIcon();
|
|
14594
15769
|
case "progress":
|
|
@@ -14702,7 +15877,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14702
15877
|
const transColor = (color2) => {
|
|
14703
15878
|
return color2 && color2.replace("#", "%23");
|
|
14704
15879
|
};
|
|
14705
|
-
const
|
|
15880
|
+
const format2 = (progress) => Math.min(Math.max(+progress, 0), 100);
|
|
14706
15881
|
const circleStyle = () => {
|
|
14707
15882
|
const stopArr = stop();
|
|
14708
15883
|
const stopDom = [];
|
|
@@ -14717,7 +15892,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14717
15892
|
}
|
|
14718
15893
|
const perimeter = 283;
|
|
14719
15894
|
const progress = +oldValue;
|
|
14720
|
-
const offset = perimeter * Number(
|
|
15895
|
+
const offset = perimeter * Number(format2(parseFloat(progress.toFixed(1)))) / 100;
|
|
14721
15896
|
const isWise = props.clockwise ? 1 : 0;
|
|
14722
15897
|
const color2 = isObject(props.color) ? `url(%23${refRandomId})` : transColor(props.color);
|
|
14723
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`;
|
|
@@ -14976,7 +16151,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14976
16151
|
endTime,
|
|
14977
16152
|
remainingTime,
|
|
14978
16153
|
millisecond,
|
|
14979
|
-
format,
|
|
16154
|
+
format: format2,
|
|
14980
16155
|
autoStart,
|
|
14981
16156
|
time,
|
|
14982
16157
|
destroy,
|
|
@@ -15045,7 +16220,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15045
16220
|
}
|
|
15046
16221
|
});
|
|
15047
16222
|
};
|
|
15048
|
-
const formatRemainTime = (t,
|
|
16223
|
+
const formatRemainTime = (t, type2) => {
|
|
15049
16224
|
const ts = t;
|
|
15050
16225
|
const rest2 = {
|
|
15051
16226
|
d: 0,
|
|
@@ -15065,12 +16240,12 @@ var __publicField = (obj, key, value) => {
|
|
|
15065
16240
|
rest2.s = Math.floor(ts % MINUTE / SECOND);
|
|
15066
16241
|
rest2.ms = Math.floor(ts % SECOND);
|
|
15067
16242
|
}
|
|
15068
|
-
return
|
|
16243
|
+
return type2 === "custom" ? rest2 : parseFormat({ ...rest2 });
|
|
15069
16244
|
};
|
|
15070
16245
|
const parseFormat = (time2) => {
|
|
15071
16246
|
const { d } = time2;
|
|
15072
16247
|
let { h, m, s, ms } = time2;
|
|
15073
|
-
let formatCache =
|
|
16248
|
+
let formatCache = format2;
|
|
15074
16249
|
if (formatCache.includes("DD")) {
|
|
15075
16250
|
formatCache = formatCache.replace("DD", padZero(d));
|
|
15076
16251
|
} else {
|
|
@@ -15376,9 +16551,9 @@ var __publicField = (obj, key, value) => {
|
|
|
15376
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) || ""}`;
|
|
15377
16552
|
setContentCopy(newContent);
|
|
15378
16553
|
};
|
|
15379
|
-
const tailorContent = (left, right,
|
|
16554
|
+
const tailorContent = (left, right, type2 = "") => {
|
|
15380
16555
|
const threeDotWidth = symbolTextWidth;
|
|
15381
|
-
const direc = direction === "middle" &&
|
|
16556
|
+
const direc = direction === "middle" && type2 ? type2 : direction;
|
|
15382
16557
|
setExceeded(true);
|
|
15383
16558
|
let widthPart = -1;
|
|
15384
16559
|
const start = left;
|
|
@@ -15421,8 +16596,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15421
16596
|
const match = value.match(/^\d*(\.\d*)?/);
|
|
15422
16597
|
return match ? Number(match[0]) : 0;
|
|
15423
16598
|
};
|
|
15424
|
-
const clickHandle = (
|
|
15425
|
-
if (
|
|
16599
|
+
const clickHandle = (type2) => {
|
|
16600
|
+
if (type2 === 1) {
|
|
15426
16601
|
setExpanded(true);
|
|
15427
16602
|
onChange && onChange("expand");
|
|
15428
16603
|
} else {
|
|
@@ -16579,7 +17754,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16579
17754
|
style,
|
|
16580
17755
|
background,
|
|
16581
17756
|
plain,
|
|
16582
|
-
type,
|
|
17757
|
+
type: type2,
|
|
16583
17758
|
round,
|
|
16584
17759
|
children,
|
|
16585
17760
|
mark,
|
|
@@ -16598,7 +17773,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16598
17773
|
const classes = () => {
|
|
16599
17774
|
return classNames({
|
|
16600
17775
|
[classPrefix2]: true,
|
|
16601
|
-
[`${classPrefix2}--${
|
|
17776
|
+
[`${classPrefix2}--${type2}`]: type2,
|
|
16602
17777
|
[`${classPrefix2}--plain`]: plain,
|
|
16603
17778
|
[`${classPrefix2}--round`]: round,
|
|
16604
17779
|
[`${classPrefix2}--mark`]: mark,
|
|
@@ -16608,7 +17783,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16608
17783
|
};
|
|
16609
17784
|
React.useEffect(() => {
|
|
16610
17785
|
setTagClass(classes());
|
|
16611
|
-
}, [
|
|
17786
|
+
}, [type2, background, color, plain, round, mark, closeable, className]);
|
|
16612
17787
|
const handleClick = (e) => {
|
|
16613
17788
|
onClick && onClick(e);
|
|
16614
17789
|
};
|
|
@@ -16886,11 +18061,11 @@ var __publicField = (obj, key, value) => {
|
|
|
16886
18061
|
}, [options, optionKey, activeDate]);
|
|
16887
18062
|
const isActive = React.useCallback(
|
|
16888
18063
|
(timeKey) => {
|
|
16889
|
-
const
|
|
18064
|
+
const date2 = activeTime.find((item) => {
|
|
16890
18065
|
return item[optionKey.valueKey] === activeDate;
|
|
16891
18066
|
});
|
|
16892
|
-
if (
|
|
16893
|
-
const time =
|
|
18067
|
+
if (date2 == null ? void 0 : date2[optionKey.childrenKey]) {
|
|
18068
|
+
const time = date2 == null ? void 0 : date2[optionKey.childrenKey].find((time2) => {
|
|
16894
18069
|
return time2[optionKey.valueKey] === timeKey;
|
|
16895
18070
|
});
|
|
16896
18071
|
return time;
|
|
@@ -16962,23 +18137,23 @@ var __publicField = (obj, key, value) => {
|
|
|
16962
18137
|
};
|
|
16963
18138
|
const handleSelectTime = (selectTime) => {
|
|
16964
18139
|
let newActiveTime = [...activeTime];
|
|
16965
|
-
const
|
|
18140
|
+
const date2 = newActiveTime.find((item) => {
|
|
16966
18141
|
return item[optionKey.valueKey] === activeDate;
|
|
16967
18142
|
});
|
|
16968
|
-
if (
|
|
16969
|
-
const timeIndex =
|
|
18143
|
+
if (date2) {
|
|
18144
|
+
const timeIndex = date2[optionKey.childrenKey].findIndex(
|
|
16970
18145
|
(time) => {
|
|
16971
18146
|
return time[optionKey.valueKey] === selectTime[optionKey.valueKey];
|
|
16972
18147
|
}
|
|
16973
18148
|
);
|
|
16974
18149
|
if (timeIndex > -1) {
|
|
16975
18150
|
if (multiple) {
|
|
16976
|
-
|
|
18151
|
+
date2[optionKey.childrenKey].splice(timeIndex, 1);
|
|
16977
18152
|
} else {
|
|
16978
18153
|
newActiveTime = [];
|
|
16979
18154
|
}
|
|
16980
18155
|
} else if (multiple) {
|
|
16981
|
-
|
|
18156
|
+
date2[optionKey.childrenKey].push({ ...selectTime });
|
|
16982
18157
|
} else {
|
|
16983
18158
|
newActiveTime = [
|
|
16984
18159
|
{
|
|
@@ -17007,9 +18182,9 @@ var __publicField = (obj, key, value) => {
|
|
|
17007
18182
|
setActiveTime(newActiveTime);
|
|
17008
18183
|
onTimeChange && onTimeChange(selectTime, newActiveTime);
|
|
17009
18184
|
};
|
|
17010
|
-
const handleChange = (
|
|
17011
|
-
setActiveDate(
|
|
17012
|
-
onDateChange && onDateChange(
|
|
18185
|
+
const handleChange = (date2) => {
|
|
18186
|
+
setActiveDate(date2[optionKey.valueKey]);
|
|
18187
|
+
onDateChange && onDateChange(date2, activeTime);
|
|
17013
18188
|
};
|
|
17014
18189
|
return /* @__PURE__ */ React.createElement(
|
|
17015
18190
|
Popup,
|