@nutui/nutui-react-taro 2.0.0-alpha.16 → 2.0.0-alpha.18
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 +24 -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/Audio.js +2 -2
- package/dist/esm/Avatar.js +2 -2
- package/dist/esm/Button.js +2 -1
- 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.js +3 -2
- 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/style/style.css +1 -1
- package/dist/esm/InputNumber.js +1 -1
- package/dist/esm/NumberKeyboard.js +2 -2
- package/dist/esm/Pagination/style/style.css +1 -1
- package/dist/esm/Picker.js +2 -2
- package/dist/esm/Popover.js +3 -3
- package/dist/esm/Popup.js +1 -1
- package/dist/esm/SearchBar.js +1 -1
- package/dist/esm/ShortPassword.js +2 -2
- package/dist/esm/SideNavBar.js +2 -2
- package/dist/esm/Skeleton.js +3 -3
- package/dist/esm/Swipe.js +2 -3
- package/dist/esm/Tabbar/style/style.css +1 -1
- package/dist/esm/Tabbar.js +2 -2
- package/dist/esm/TabbarItem/style/index.js +1 -1
- package/dist/esm/TabbarItem/style/style.css +1 -1
- package/dist/esm/TabbarItem.js +1 -1
- package/dist/esm/TimeSelect.js +2 -2
- package/dist/esm/Uploader.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/{audio.taro-64b15071.js → audio.taro-09305bcb.js} +1 -1
- package/dist/esm/{button.taro-01eae688.js → button.taro-60dfd83e.js} +18 -7
- package/dist/esm/{calendar.taro-02195ddb.js → calendar.taro-3568a214.js} +1 -1
- package/dist/esm/{cascader.taro-fb7a0230.js → cascader.taro-91cf3ca6.js} +1 -1
- package/dist/esm/{datepicker.taro-b480d072.js → datepicker.taro-108eb7c8.js} +1 -1
- package/dist/esm/{dialog.taro-e5c2cb03.js → dialog.taro-2de109c0.js} +1 -1
- package/dist/esm/form.taro-33a19e85.js +1275 -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-c4c0cfb3.js} +5 -5
- package/dist/esm/{numberkeyboard.taro-18879f04.js → numberkeyboard.taro-ee984036.js} +1 -1
- package/dist/esm/nutui-react.es.js +27 -27
- package/dist/esm/{picker.taro-3781a455.js → picker.taro-9ca039c4.js} +54 -27
- package/dist/esm/{popover.taro-ba6c323a.js → popover.taro-52c02926.js} +12 -12
- package/dist/esm/{popup.taro-e756f3fc.js → popup.taro-687437a0.js} +1 -0
- package/dist/esm/{searchbar.taro-39351331.js → searchbar.taro-b2d6eff2.js} +2 -2
- package/dist/esm/{shortpassword.taro-cff61e4e.js → shortpassword.taro-4f714afb.js} +1 -1
- package/dist/esm/{sidenavbar.taro-1aefdd3c.js → sidenavbar.taro-03fb1fc6.js} +1 -1
- package/dist/esm/{skeleton.taro-ce714b06.js → skeleton.taro-e29f9f0c.js} +1 -1
- package/dist/esm/{swipe.taro-966af6d3.js → swipe.taro-4eb0cc9a.js} +6 -5
- package/dist/esm/{tabbar.taro-18eee41f.js → tabbar.taro-4f49ed90.js} +1 -1
- package/dist/esm/{tabbaritem.taro-89646ca1.js → tabbaritem.taro-16a380db.js} +16 -5
- package/dist/esm/{timeselect.taro-9e37e648.js → timeselect.taro-9de6ab39.js} +1 -1
- package/dist/esm/types/src/packages/button/button.d.ts +1 -0
- package/dist/esm/types/src/packages/elevator/elevator.d.ts +0 -1
- package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/form/__tests__/form.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/form/context.d.ts +4 -0
- package/dist/esm/types/src/packages/form/form.d.ts +11 -4
- package/dist/esm/types/src/packages/form/form.taro.d.ts +14 -4
- package/dist/esm/types/src/packages/form/index.d.ts +1 -0
- package/dist/esm/types/src/packages/form/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/form/types.d.ts +4 -52
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +16 -15
- package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +16 -12
- package/dist/esm/types/src/packages/formitem/index.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/types.d.ts +1 -31
- package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +1 -1
- package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +7 -2
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +7 -2
- package/dist/esm/types/src/packages/sticky/sticky.d.ts +0 -1
- package/dist/esm/types/src/packages/swipe/swipe.d.ts +2 -6
- package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.d.ts +7 -2
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.taro.d.ts +7 -2
- package/dist/esm/types/src/utils/is-forward-ref-component.d.ts +1 -0
- package/dist/esm/{uploader.taro-5ad88f83.js → uploader.taro-13591ac2.js} +1 -1
- 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 +1689 -502
- package/dist/nutui.react.umd.js +1734 -547
- 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/inputnumber/inputnumber.scss +4 -2
- package/dist/packages/layout/layout.scss +0 -2
- package/dist/packages/pagination/pagination.scss +8 -30
- package/dist/packages/tabbaritem/tabbaritem.scss +1 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/animate/animate.taro.d.ts +3 -3
- package/dist/types/packages/audio/audio.taro.d.ts +28 -8
- package/dist/types/packages/avatar/avatar.taro.d.ts +4 -4
- package/dist/types/packages/avatargroup/avatargroup.taro.d.ts +5 -5
- package/dist/types/packages/button/button.taro.d.ts +4 -4
- package/dist/types/packages/cascader/cascader.taro.d.ts +4 -4
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -3
- package/dist/types/packages/datepicker/datepicker.taro.d.ts +75 -15
- package/dist/types/packages/divider/divider.taro.d.ts +2 -2
- package/dist/types/packages/drag/drag.taro.d.ts +1 -1
- package/dist/types/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/types/packages/empty/empty.taro.d.ts +3 -3
- package/dist/types/packages/fixednav/fixednav.taro.d.ts +3 -3
- package/dist/types/packages/form/context.d.ts +3 -0
- package/dist/types/packages/form/form.taro.d.ts +46 -4
- package/dist/types/packages/form/index.taro.d.ts +1 -0
- package/dist/types/packages/form/types.d.ts +4 -52
- package/dist/types/packages/formitem/formitem.taro.d.ts +45 -13
- package/dist/types/packages/formitem/index.taro.d.ts +1 -0
- package/dist/types/packages/formitem/types.d.ts +1 -31
- package/dist/types/packages/grid/grid.taro.d.ts +1 -1
- package/dist/types/packages/infiniteloading/infiniteloading.taro.d.ts +1 -1
- package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/types/packages/noticebar/noticebar.taro.d.ts +3 -3
- package/dist/types/packages/overlay/overlay.taro.d.ts +1 -1
- package/dist/types/packages/picker/picker.d.ts +7 -2
- package/dist/types/packages/picker/picker.taro.d.ts +7 -2
- package/dist/types/packages/popover/popover.taro.d.ts +5 -5
- package/dist/types/packages/popup/popup.taro.d.ts +2 -2
- package/dist/types/packages/radio/radio.taro.d.ts +2 -2
- package/dist/types/packages/range/range.taro.d.ts +3 -3
- package/dist/types/packages/searchbar/searchbar.taro.d.ts +5 -5
- package/dist/types/packages/step/step.taro.d.ts +3 -3
- package/dist/types/packages/steps/steps.taro.d.ts +1 -1
- package/dist/types/packages/sticky/sticky.taro.d.ts +1 -1
- package/dist/types/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/types/packages/swiper/swiper.taro.d.ts +1 -1
- package/dist/types/packages/tabbaritem/tabbaritem.taro.d.ts +27 -2
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global2, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/
|
|
3
|
-
})(this, function(exports2, React,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("@tarojs/taro"), require("@tarojs/components"), require("react-dom")) : typeof define === "function" && define.amd ? define(["exports", "react", "@tarojs/taro", "@tarojs/components", "react-dom"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory((global2.nutui = global2.nutui || {}, global2.nutui.react = {}), global2.React, global2.Taro, global2.components, global2.ReactDOM));
|
|
3
|
+
})(this, function(exports2, React, Taro, components, ReactDOM) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -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.18 Fri Jun 16 2023 18:33:32 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,
|
|
@@ -1917,6 +1917,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1917
1917
|
onClick(e);
|
|
1918
1918
|
}
|
|
1919
1919
|
};
|
|
1920
|
+
if (Taro.getEnv() === "WEB") {
|
|
1921
|
+
rest.type = rest.formType;
|
|
1922
|
+
}
|
|
1920
1923
|
return (
|
|
1921
1924
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1922
1925
|
// @ts-ignore
|
|
@@ -1929,7 +1932,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1929
1932
|
className: classNames(
|
|
1930
1933
|
prefixCls,
|
|
1931
1934
|
className,
|
|
1932
|
-
props.type ? `${prefixCls}--${
|
|
1935
|
+
props.type ? `${prefixCls}--${type2}` : null,
|
|
1933
1936
|
props.fill ? `${prefixCls}--${fill}` : null,
|
|
1934
1937
|
{
|
|
1935
1938
|
[`${prefixCls}--${size}`]: size,
|
|
@@ -2243,30 +2246,30 @@ var __publicField = (obj, key, value) => {
|
|
|
2243
2246
|
var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
2244
2247
|
var freeSelf = typeof self == "object" && self && self.Object === Object && self;
|
|
2245
2248
|
var root = freeGlobal || freeSelf || Function("return this")();
|
|
2246
|
-
function arrayReduce(
|
|
2247
|
-
var index = -1, length =
|
|
2249
|
+
function arrayReduce(array2, iteratee, accumulator, initAccum) {
|
|
2250
|
+
var index = -1, length = array2 ? array2.length : 0;
|
|
2248
2251
|
if (initAccum && length) {
|
|
2249
|
-
accumulator =
|
|
2252
|
+
accumulator = array2[++index];
|
|
2250
2253
|
}
|
|
2251
2254
|
while (++index < length) {
|
|
2252
|
-
accumulator = iteratee(accumulator,
|
|
2255
|
+
accumulator = iteratee(accumulator, array2[index], index, array2);
|
|
2253
2256
|
}
|
|
2254
2257
|
return accumulator;
|
|
2255
2258
|
}
|
|
2256
|
-
function asciiWords(
|
|
2257
|
-
return
|
|
2259
|
+
function asciiWords(string2) {
|
|
2260
|
+
return string2.match(reAsciiWord) || [];
|
|
2258
2261
|
}
|
|
2259
|
-
function basePropertyOf(
|
|
2262
|
+
function basePropertyOf(object2) {
|
|
2260
2263
|
return function(key) {
|
|
2261
|
-
return
|
|
2264
|
+
return object2 == null ? void 0 : object2[key];
|
|
2262
2265
|
};
|
|
2263
2266
|
}
|
|
2264
2267
|
var deburrLetter = basePropertyOf(deburredLetters);
|
|
2265
|
-
function hasUnicodeWord(
|
|
2266
|
-
return reHasUnicodeWord.test(
|
|
2268
|
+
function hasUnicodeWord(string2) {
|
|
2269
|
+
return reHasUnicodeWord.test(string2);
|
|
2267
2270
|
}
|
|
2268
|
-
function unicodeWords(
|
|
2269
|
-
return
|
|
2271
|
+
function unicodeWords(string2) {
|
|
2272
|
+
return string2.match(reUnicodeWord) || [];
|
|
2270
2273
|
}
|
|
2271
2274
|
var objectProto = Object.prototype;
|
|
2272
2275
|
var objectToString = objectProto.toString;
|
|
@@ -2283,8 +2286,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2283
2286
|
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
2284
2287
|
}
|
|
2285
2288
|
function createCompounder(callback) {
|
|
2286
|
-
return function(
|
|
2287
|
-
return arrayReduce(words(deburr(
|
|
2289
|
+
return function(string2) {
|
|
2290
|
+
return arrayReduce(words(deburr(string2).replace(reApos, "")), callback, "");
|
|
2288
2291
|
};
|
|
2289
2292
|
}
|
|
2290
2293
|
function isObjectLike(value) {
|
|
@@ -2296,20 +2299,20 @@ var __publicField = (obj, key, value) => {
|
|
|
2296
2299
|
function toString(value) {
|
|
2297
2300
|
return value == null ? "" : baseToString(value);
|
|
2298
2301
|
}
|
|
2299
|
-
function deburr(
|
|
2300
|
-
|
|
2301
|
-
return
|
|
2302
|
+
function deburr(string2) {
|
|
2303
|
+
string2 = toString(string2);
|
|
2304
|
+
return string2 && string2.replace(reLatin, deburrLetter).replace(reComboMark, "");
|
|
2302
2305
|
}
|
|
2303
2306
|
var kebabCase = createCompounder(function(result, word, index) {
|
|
2304
2307
|
return result + (index ? "-" : "") + word.toLowerCase();
|
|
2305
2308
|
});
|
|
2306
|
-
function words(
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
if (
|
|
2310
|
-
return hasUnicodeWord(
|
|
2309
|
+
function words(string2, pattern2, guard) {
|
|
2310
|
+
string2 = toString(string2);
|
|
2311
|
+
pattern2 = guard ? void 0 : pattern2;
|
|
2312
|
+
if (pattern2 === void 0) {
|
|
2313
|
+
return hasUnicodeWord(string2) ? unicodeWords(string2) : asciiWords(string2);
|
|
2311
2314
|
}
|
|
2312
|
-
return
|
|
2315
|
+
return string2.match(pattern2) || [];
|
|
2313
2316
|
}
|
|
2314
2317
|
var lodash_kebabcase = kebabCase;
|
|
2315
2318
|
const zhCN = {
|
|
@@ -2905,7 +2908,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2905
2908
|
className,
|
|
2906
2909
|
style,
|
|
2907
2910
|
children,
|
|
2908
|
-
type,
|
|
2911
|
+
type: type2,
|
|
2909
2912
|
justify,
|
|
2910
2913
|
align,
|
|
2911
2914
|
wrap,
|
|
@@ -2915,14 +2918,14 @@ var __publicField = (obj, key, value) => {
|
|
|
2915
2918
|
...defaultProps$1j,
|
|
2916
2919
|
...props
|
|
2917
2920
|
};
|
|
2918
|
-
const getClass = (prefix,
|
|
2919
|
-
const classType =
|
|
2920
|
-
const className2 = prefix ? classType : `nut-row-${
|
|
2921
|
+
const getClass = (prefix, type22) => {
|
|
2922
|
+
const classType = type22 ? `nut-row-${prefix}-${type22}` : "";
|
|
2923
|
+
const className2 = prefix ? classType : `nut-row-${type22}`;
|
|
2921
2924
|
return className2;
|
|
2922
2925
|
};
|
|
2923
2926
|
const getClasses = () => {
|
|
2924
2927
|
return `
|
|
2925
|
-
${getClass("",
|
|
2928
|
+
${getClass("", type2)}
|
|
2926
2929
|
${getClass("justify", justify)}
|
|
2927
2930
|
${getClass("align", align)}
|
|
2928
2931
|
${getClass("flex", wrap)}
|
|
@@ -3464,7 +3467,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3464
3467
|
position,
|
|
3465
3468
|
onChange,
|
|
3466
3469
|
onSelect,
|
|
3467
|
-
type,
|
|
3470
|
+
type: type2,
|
|
3468
3471
|
children,
|
|
3469
3472
|
style,
|
|
3470
3473
|
content,
|
|
@@ -3478,7 +3481,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3478
3481
|
{
|
|
3479
3482
|
active: visible
|
|
3480
3483
|
},
|
|
3481
|
-
|
|
3484
|
+
type2,
|
|
3482
3485
|
className,
|
|
3483
3486
|
classPrefix2
|
|
3484
3487
|
);
|
|
@@ -3586,8 +3589,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3586
3589
|
};
|
|
3587
3590
|
NavBar.defaultProps = defaultProps$1e;
|
|
3588
3591
|
NavBar.displayName = "NutNavBar";
|
|
3589
|
-
function _extends() {
|
|
3590
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
3592
|
+
function _extends$1() {
|
|
3593
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function(target) {
|
|
3591
3594
|
for (var i = 1; i < arguments.length; i++) {
|
|
3592
3595
|
var source = arguments[i];
|
|
3593
3596
|
for (var key in source) {
|
|
@@ -3598,7 +3601,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3598
3601
|
}
|
|
3599
3602
|
return target;
|
|
3600
3603
|
};
|
|
3601
|
-
return _extends.apply(this, arguments);
|
|
3604
|
+
return _extends$1.apply(this, arguments);
|
|
3602
3605
|
}
|
|
3603
3606
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
3604
3607
|
if (source == null)
|
|
@@ -3614,17 +3617,17 @@ var __publicField = (obj, key, value) => {
|
|
|
3614
3617
|
}
|
|
3615
3618
|
return target;
|
|
3616
3619
|
}
|
|
3617
|
-
function _setPrototypeOf(o, p) {
|
|
3618
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
3620
|
+
function _setPrototypeOf$1(o, p) {
|
|
3621
|
+
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
3619
3622
|
o2.__proto__ = p2;
|
|
3620
3623
|
return o2;
|
|
3621
3624
|
};
|
|
3622
|
-
return _setPrototypeOf(o, p);
|
|
3625
|
+
return _setPrototypeOf$1(o, p);
|
|
3623
3626
|
}
|
|
3624
|
-
function _inheritsLoose(subClass, superClass) {
|
|
3627
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
3625
3628
|
subClass.prototype = Object.create(superClass.prototype);
|
|
3626
3629
|
subClass.prototype.constructor = subClass;
|
|
3627
|
-
_setPrototypeOf(subClass, superClass);
|
|
3630
|
+
_setPrototypeOf$1(subClass, superClass);
|
|
3628
3631
|
}
|
|
3629
3632
|
var propTypesExports = {};
|
|
3630
3633
|
var propTypes = {
|
|
@@ -3783,26 +3786,26 @@ var __publicField = (obj, key, value) => {
|
|
|
3783
3786
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
3784
3787
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
3785
3788
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
3786
|
-
function isValidElementType(
|
|
3787
|
-
return typeof
|
|
3788
|
-
|
|
3789
|
+
function isValidElementType(type2) {
|
|
3790
|
+
return typeof type2 === "string" || typeof type2 === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
3791
|
+
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
3792
|
}
|
|
3790
|
-
function typeOf(
|
|
3791
|
-
if (typeof
|
|
3792
|
-
var $$typeof =
|
|
3793
|
+
function typeOf(object2) {
|
|
3794
|
+
if (typeof object2 === "object" && object2 !== null) {
|
|
3795
|
+
var $$typeof = object2.$$typeof;
|
|
3793
3796
|
switch ($$typeof) {
|
|
3794
3797
|
case REACT_ELEMENT_TYPE:
|
|
3795
|
-
var
|
|
3796
|
-
switch (
|
|
3798
|
+
var type2 = object2.type;
|
|
3799
|
+
switch (type2) {
|
|
3797
3800
|
case REACT_ASYNC_MODE_TYPE:
|
|
3798
3801
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
3799
3802
|
case REACT_FRAGMENT_TYPE:
|
|
3800
3803
|
case REACT_PROFILER_TYPE:
|
|
3801
3804
|
case REACT_STRICT_MODE_TYPE:
|
|
3802
3805
|
case REACT_SUSPENSE_TYPE:
|
|
3803
|
-
return
|
|
3806
|
+
return type2;
|
|
3804
3807
|
default:
|
|
3805
|
-
var $$typeofType =
|
|
3808
|
+
var $$typeofType = type2 && type2.$$typeof;
|
|
3806
3809
|
switch ($$typeofType) {
|
|
3807
3810
|
case REACT_CONTEXT_TYPE:
|
|
3808
3811
|
case REACT_FORWARD_REF_TYPE:
|
|
@@ -3834,50 +3837,50 @@ var __publicField = (obj, key, value) => {
|
|
|
3834
3837
|
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
3835
3838
|
var Suspense = REACT_SUSPENSE_TYPE;
|
|
3836
3839
|
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
3837
|
-
function isAsyncMode(
|
|
3840
|
+
function isAsyncMode(object2) {
|
|
3838
3841
|
{
|
|
3839
3842
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
3840
3843
|
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
3841
3844
|
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
3845
|
}
|
|
3843
3846
|
}
|
|
3844
|
-
return isConcurrentMode(
|
|
3847
|
+
return isConcurrentMode(object2) || typeOf(object2) === REACT_ASYNC_MODE_TYPE;
|
|
3845
3848
|
}
|
|
3846
|
-
function isConcurrentMode(
|
|
3847
|
-
return typeOf(
|
|
3849
|
+
function isConcurrentMode(object2) {
|
|
3850
|
+
return typeOf(object2) === REACT_CONCURRENT_MODE_TYPE;
|
|
3848
3851
|
}
|
|
3849
|
-
function isContextConsumer(
|
|
3850
|
-
return typeOf(
|
|
3852
|
+
function isContextConsumer(object2) {
|
|
3853
|
+
return typeOf(object2) === REACT_CONTEXT_TYPE;
|
|
3851
3854
|
}
|
|
3852
|
-
function isContextProvider(
|
|
3853
|
-
return typeOf(
|
|
3855
|
+
function isContextProvider(object2) {
|
|
3856
|
+
return typeOf(object2) === REACT_PROVIDER_TYPE;
|
|
3854
3857
|
}
|
|
3855
|
-
function isElement2(
|
|
3856
|
-
return typeof
|
|
3858
|
+
function isElement2(object2) {
|
|
3859
|
+
return typeof object2 === "object" && object2 !== null && object2.$$typeof === REACT_ELEMENT_TYPE;
|
|
3857
3860
|
}
|
|
3858
|
-
function isForwardRef(
|
|
3859
|
-
return typeOf(
|
|
3861
|
+
function isForwardRef(object2) {
|
|
3862
|
+
return typeOf(object2) === REACT_FORWARD_REF_TYPE;
|
|
3860
3863
|
}
|
|
3861
|
-
function isFragment(
|
|
3862
|
-
return typeOf(
|
|
3864
|
+
function isFragment(object2) {
|
|
3865
|
+
return typeOf(object2) === REACT_FRAGMENT_TYPE;
|
|
3863
3866
|
}
|
|
3864
|
-
function isLazy(
|
|
3865
|
-
return typeOf(
|
|
3867
|
+
function isLazy(object2) {
|
|
3868
|
+
return typeOf(object2) === REACT_LAZY_TYPE;
|
|
3866
3869
|
}
|
|
3867
|
-
function isMemo(
|
|
3868
|
-
return typeOf(
|
|
3870
|
+
function isMemo(object2) {
|
|
3871
|
+
return typeOf(object2) === REACT_MEMO_TYPE;
|
|
3869
3872
|
}
|
|
3870
|
-
function isPortal(
|
|
3871
|
-
return typeOf(
|
|
3873
|
+
function isPortal(object2) {
|
|
3874
|
+
return typeOf(object2) === REACT_PORTAL_TYPE;
|
|
3872
3875
|
}
|
|
3873
|
-
function isProfiler(
|
|
3874
|
-
return typeOf(
|
|
3876
|
+
function isProfiler(object2) {
|
|
3877
|
+
return typeOf(object2) === REACT_PROFILER_TYPE;
|
|
3875
3878
|
}
|
|
3876
|
-
function isStrictMode(
|
|
3877
|
-
return typeOf(
|
|
3879
|
+
function isStrictMode(object2) {
|
|
3880
|
+
return typeOf(object2) === REACT_STRICT_MODE_TYPE;
|
|
3878
3881
|
}
|
|
3879
|
-
function isSuspense(
|
|
3880
|
-
return typeOf(
|
|
3882
|
+
function isSuspense(object2) {
|
|
3883
|
+
return typeOf(object2) === REACT_SUSPENSE_TYPE;
|
|
3881
3884
|
}
|
|
3882
3885
|
reactIs_development.AsyncMode = AsyncMode;
|
|
3883
3886
|
reactIs_development.ConcurrentMode = ConcurrentMode;
|
|
@@ -4291,8 +4294,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4291
4294
|
}
|
|
4292
4295
|
}
|
|
4293
4296
|
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
4294
|
-
var
|
|
4295
|
-
if (
|
|
4297
|
+
var type2 = getPreciseType(value);
|
|
4298
|
+
if (type2 === "symbol") {
|
|
4296
4299
|
return String(value);
|
|
4297
4300
|
}
|
|
4298
4301
|
return value;
|
|
@@ -4363,9 +4366,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4363
4366
|
}
|
|
4364
4367
|
return createChainableTypeChecker(validate);
|
|
4365
4368
|
}
|
|
4366
|
-
function invalidValidatorError(componentName, location, propFullName, key,
|
|
4369
|
+
function invalidValidatorError(componentName, location, propFullName, key, type2) {
|
|
4367
4370
|
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 `" +
|
|
4371
|
+
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type2 + "`."
|
|
4369
4372
|
);
|
|
4370
4373
|
}
|
|
4371
4374
|
function createShapeTypeChecker(shapeTypes) {
|
|
@@ -4502,17 +4505,17 @@ var __publicField = (obj, key, value) => {
|
|
|
4502
4505
|
return propType;
|
|
4503
4506
|
}
|
|
4504
4507
|
function getPostfixForTypeWarning(value) {
|
|
4505
|
-
var
|
|
4506
|
-
switch (
|
|
4508
|
+
var type2 = getPreciseType(value);
|
|
4509
|
+
switch (type2) {
|
|
4507
4510
|
case "array":
|
|
4508
4511
|
case "object":
|
|
4509
|
-
return "an " +
|
|
4512
|
+
return "an " + type2;
|
|
4510
4513
|
case "boolean":
|
|
4511
4514
|
case "date":
|
|
4512
4515
|
case "regexp":
|
|
4513
|
-
return "a " +
|
|
4516
|
+
return "a " + type2;
|
|
4514
4517
|
default:
|
|
4515
|
-
return
|
|
4518
|
+
return type2;
|
|
4516
4519
|
}
|
|
4517
4520
|
}
|
|
4518
4521
|
function getClassName(propValue) {
|
|
@@ -4646,7 +4649,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4646
4649
|
var ENTERED = "entered";
|
|
4647
4650
|
var EXITING = "exiting";
|
|
4648
4651
|
var Transition = /* @__PURE__ */ function(_React$Component) {
|
|
4649
|
-
_inheritsLoose(Transition2, _React$Component);
|
|
4652
|
+
_inheritsLoose$1(Transition2, _React$Component);
|
|
4650
4653
|
function Transition2(props, context) {
|
|
4651
4654
|
var _this;
|
|
4652
4655
|
_this = _React$Component.call(this, props, context) || this;
|
|
@@ -5076,7 +5079,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5076
5079
|
});
|
|
5077
5080
|
};
|
|
5078
5081
|
var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
5079
|
-
_inheritsLoose(CSSTransition2, _React$Component);
|
|
5082
|
+
_inheritsLoose$1(CSSTransition2, _React$Component);
|
|
5080
5083
|
function CSSTransition2() {
|
|
5081
5084
|
var _this;
|
|
5082
5085
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -5098,17 +5101,17 @@ var __publicField = (obj, key, value) => {
|
|
|
5098
5101
|
};
|
|
5099
5102
|
_this.onEntering = function(maybeNode, maybeAppearing) {
|
|
5100
5103
|
var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument2[0], appearing = _this$resolveArgument2[1];
|
|
5101
|
-
var
|
|
5102
|
-
_this.addClass(node,
|
|
5104
|
+
var type2 = appearing ? "appear" : "enter";
|
|
5105
|
+
_this.addClass(node, type2, "active");
|
|
5103
5106
|
if (_this.props.onEntering) {
|
|
5104
5107
|
_this.props.onEntering(maybeNode, maybeAppearing);
|
|
5105
5108
|
}
|
|
5106
5109
|
};
|
|
5107
5110
|
_this.onEntered = function(maybeNode, maybeAppearing) {
|
|
5108
5111
|
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,
|
|
5112
|
+
var type2 = appearing ? "appear" : "enter";
|
|
5113
|
+
_this.removeClasses(node, type2);
|
|
5114
|
+
_this.addClass(node, type2, "done");
|
|
5112
5115
|
if (_this.props.onEntered) {
|
|
5113
5116
|
_this.props.onEntered(maybeNode, maybeAppearing);
|
|
5114
5117
|
}
|
|
@@ -5140,13 +5143,13 @@ var __publicField = (obj, key, value) => {
|
|
|
5140
5143
|
_this.resolveArguments = function(maybeNode, maybeAppearing) {
|
|
5141
5144
|
return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] : [maybeNode, maybeAppearing];
|
|
5142
5145
|
};
|
|
5143
|
-
_this.getClassNames = function(
|
|
5146
|
+
_this.getClassNames = function(type2) {
|
|
5144
5147
|
var classNames2 = _this.props.classNames;
|
|
5145
5148
|
var isStringClassNames = typeof classNames2 === "string";
|
|
5146
5149
|
var prefix = isStringClassNames && classNames2 ? classNames2 + "-" : "";
|
|
5147
|
-
var baseClassName = isStringClassNames ? "" + prefix +
|
|
5148
|
-
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[
|
|
5149
|
-
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[
|
|
5150
|
+
var baseClassName = isStringClassNames ? "" + prefix + type2 : classNames2[type2];
|
|
5151
|
+
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[type2 + "Active"];
|
|
5152
|
+
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[type2 + "Done"];
|
|
5150
5153
|
return {
|
|
5151
5154
|
baseClassName,
|
|
5152
5155
|
activeClassName,
|
|
@@ -5156,10 +5159,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5156
5159
|
return _this;
|
|
5157
5160
|
}
|
|
5158
5161
|
var _proto = CSSTransition2.prototype;
|
|
5159
|
-
_proto.addClass = function addClass2(node,
|
|
5160
|
-
var className = this.getClassNames(
|
|
5162
|
+
_proto.addClass = function addClass2(node, type2, phase) {
|
|
5163
|
+
var className = this.getClassNames(type2)[phase + "ClassName"];
|
|
5161
5164
|
var _this$getClassNames = this.getClassNames("enter"), doneClassName = _this$getClassNames.doneClassName;
|
|
5162
|
-
if (
|
|
5165
|
+
if (type2 === "appear" && phase === "done" && doneClassName) {
|
|
5163
5166
|
className += " " + doneClassName;
|
|
5164
5167
|
}
|
|
5165
5168
|
if (phase === "active") {
|
|
@@ -5167,13 +5170,13 @@ var __publicField = (obj, key, value) => {
|
|
|
5167
5170
|
forceReflow(node);
|
|
5168
5171
|
}
|
|
5169
5172
|
if (className) {
|
|
5170
|
-
this.appliedClasses[
|
|
5173
|
+
this.appliedClasses[type2][phase] = className;
|
|
5171
5174
|
_addClass(node, className);
|
|
5172
5175
|
}
|
|
5173
5176
|
};
|
|
5174
|
-
_proto.removeClasses = function removeClasses(node,
|
|
5175
|
-
var _this$appliedClasses$ = this.appliedClasses[
|
|
5176
|
-
this.appliedClasses[
|
|
5177
|
+
_proto.removeClasses = function removeClasses(node, type2) {
|
|
5178
|
+
var _this$appliedClasses$ = this.appliedClasses[type2], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done;
|
|
5179
|
+
this.appliedClasses[type2] = {};
|
|
5177
5180
|
if (baseClassName) {
|
|
5178
5181
|
removeClass(node, baseClassName);
|
|
5179
5182
|
}
|
|
@@ -5188,7 +5191,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5188
5191
|
var _this$props = this.props;
|
|
5189
5192
|
_this$props.classNames;
|
|
5190
5193
|
var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
|
|
5191
|
-
return /* @__PURE__ */ React.createElement(Transition$1, _extends({}, props, {
|
|
5194
|
+
return /* @__PURE__ */ React.createElement(Transition$1, _extends$1({}, props, {
|
|
5192
5195
|
onEnter: this.onEnter,
|
|
5193
5196
|
onEntered: this.onEntered,
|
|
5194
5197
|
onEntering: this.onEntering,
|
|
@@ -5202,7 +5205,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5202
5205
|
CSSTransition.defaultProps = {
|
|
5203
5206
|
classNames: ""
|
|
5204
5207
|
};
|
|
5205
|
-
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends({}, Transition$1.propTypes, {
|
|
5208
|
+
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({}, Transition$1.propTypes, {
|
|
5206
5209
|
/**
|
|
5207
5210
|
* The animation classNames applied to the component as it appears, enters,
|
|
5208
5211
|
* exits or has finished the transition. A single name can be provided, which
|
|
@@ -5427,6 +5430,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5427
5430
|
}
|
|
5428
5431
|
};
|
|
5429
5432
|
const onHandleClickOverlay = (e) => {
|
|
5433
|
+
e.stopPropagation();
|
|
5430
5434
|
if (closeOnOverlayClick) {
|
|
5431
5435
|
const closed = onClickOverlay && onClickOverlay(e);
|
|
5432
5436
|
closed && close();
|
|
@@ -5707,8 +5711,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5707
5711
|
icon: null,
|
|
5708
5712
|
active: false,
|
|
5709
5713
|
index: 0,
|
|
5710
|
-
|
|
5711
|
-
|
|
5714
|
+
value: "",
|
|
5715
|
+
dot: false,
|
|
5716
|
+
max: 99,
|
|
5717
|
+
top: "0",
|
|
5718
|
+
right: "5"
|
|
5712
5719
|
};
|
|
5713
5720
|
const TabbarItem = (props) => {
|
|
5714
5721
|
const {
|
|
@@ -5720,8 +5727,12 @@ var __publicField = (obj, key, value) => {
|
|
|
5720
5727
|
activeColor,
|
|
5721
5728
|
inactiveColor,
|
|
5722
5729
|
index,
|
|
5723
|
-
|
|
5724
|
-
|
|
5730
|
+
value,
|
|
5731
|
+
dot,
|
|
5732
|
+
max,
|
|
5733
|
+
top,
|
|
5734
|
+
right,
|
|
5735
|
+
handleClick
|
|
5725
5736
|
} = {
|
|
5726
5737
|
...defaultProps$19,
|
|
5727
5738
|
...props
|
|
@@ -5734,6 +5745,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5734
5745
|
const titleClass = classNames(boxPrefix, `${boxPrefix}-nav`, {
|
|
5735
5746
|
[`${boxPrefix}-large`]: !icon
|
|
5736
5747
|
});
|
|
5748
|
+
const badgeProps = {
|
|
5749
|
+
value,
|
|
5750
|
+
dot,
|
|
5751
|
+
max,
|
|
5752
|
+
top,
|
|
5753
|
+
right,
|
|
5754
|
+
color: activeColor
|
|
5755
|
+
};
|
|
5737
5756
|
return /* @__PURE__ */ React.createElement(
|
|
5738
5757
|
"div",
|
|
5739
5758
|
{
|
|
@@ -5744,7 +5763,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5744
5763
|
},
|
|
5745
5764
|
onClick: () => handleClick(index)
|
|
5746
5765
|
},
|
|
5747
|
-
icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, { ...
|
|
5766
|
+
icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: titleClass }, title))
|
|
5748
5767
|
);
|
|
5749
5768
|
};
|
|
5750
5769
|
const defaultProps$18 = {
|
|
@@ -6157,7 +6176,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6157
6176
|
const { locale } = useConfig();
|
|
6158
6177
|
const {
|
|
6159
6178
|
children,
|
|
6160
|
-
type,
|
|
6179
|
+
type: type2,
|
|
6161
6180
|
existAddress,
|
|
6162
6181
|
selectedIcon,
|
|
6163
6182
|
defaultIcon,
|
|
@@ -6189,7 +6208,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6189
6208
|
onSelected && onSelected(prevExistAdd, item, copyExistAdd);
|
|
6190
6209
|
};
|
|
6191
6210
|
const onSwitch = () => {
|
|
6192
|
-
onSwitchModule && onSwitchModule({ type:
|
|
6211
|
+
onSwitchModule && onSwitchModule({ type: type2 === "exist" ? "custom" : "exist" });
|
|
6193
6212
|
};
|
|
6194
6213
|
React.useEffect(() => {
|
|
6195
6214
|
}, [existAddress]);
|
|
@@ -6210,7 +6229,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6210
6229
|
const { locale } = useConfig$1();
|
|
6211
6230
|
const {
|
|
6212
6231
|
children,
|
|
6213
|
-
type,
|
|
6232
|
+
type: type2,
|
|
6214
6233
|
modelValue,
|
|
6215
6234
|
height,
|
|
6216
6235
|
province,
|
|
@@ -6226,7 +6245,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6226
6245
|
...props
|
|
6227
6246
|
};
|
|
6228
6247
|
const b2 = cn("address");
|
|
6229
|
-
const [privateType] = React.useState(
|
|
6248
|
+
const [privateType] = React.useState(type2);
|
|
6230
6249
|
const [tabIndex, setTabIndex] = React.useState(0);
|
|
6231
6250
|
const [tabName] = React.useState(["province", "city", "country", "town"]);
|
|
6232
6251
|
React.useRef(null);
|
|
@@ -6235,7 +6254,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6235
6254
|
React.useRef(null);
|
|
6236
6255
|
const regionLine = React.useRef(null);
|
|
6237
6256
|
const isCustom2 = () => {
|
|
6238
|
-
return
|
|
6257
|
+
return type2 === "custom2";
|
|
6239
6258
|
};
|
|
6240
6259
|
const transformData = (data) => {
|
|
6241
6260
|
if (!Array.isArray(data))
|
|
@@ -6497,7 +6516,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6497
6516
|
modelValue,
|
|
6498
6517
|
modelSelect,
|
|
6499
6518
|
children,
|
|
6500
|
-
type,
|
|
6519
|
+
type: type2,
|
|
6501
6520
|
height,
|
|
6502
6521
|
customAddressTitle,
|
|
6503
6522
|
existAddress,
|
|
@@ -6526,7 +6545,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6526
6545
|
...props
|
|
6527
6546
|
};
|
|
6528
6547
|
const b2 = cn("address");
|
|
6529
|
-
const [privateType, setPrivateType] = React.useState(
|
|
6548
|
+
const [privateType, setPrivateType] = React.useState(type2);
|
|
6530
6549
|
const [tabName] = React.useState(["province", "city", "country", "town"]);
|
|
6531
6550
|
const [showPopup, setShowPopup] = React.useState(modelValue);
|
|
6532
6551
|
const [selectedRegion, setSelectedRegion] = React.useState({
|
|
@@ -6652,8 +6671,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6652
6671
|
onNextArea: (cal) => {
|
|
6653
6672
|
nextAreaList && nextAreaList(cal);
|
|
6654
6673
|
},
|
|
6655
|
-
onTabClick: (
|
|
6656
|
-
onTabChecked && onTabChecked(
|
|
6674
|
+
onTabClick: (type22) => {
|
|
6675
|
+
onTabChecked && onTabChecked(type22);
|
|
6657
6676
|
},
|
|
6658
6677
|
onClose: handClose
|
|
6659
6678
|
}
|
|
@@ -6689,8 +6708,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6689
6708
|
* @return {String}
|
|
6690
6709
|
*/
|
|
6691
6710
|
getWhatDay(year, month, day) {
|
|
6692
|
-
const
|
|
6693
|
-
const index =
|
|
6711
|
+
const date2 = /* @__PURE__ */ new Date(`${year}/${month}/${day}`);
|
|
6712
|
+
const index = date2.getDay();
|
|
6694
6713
|
const dayNames = [
|
|
6695
6714
|
"星期日",
|
|
6696
6715
|
"星期一",
|
|
@@ -6707,8 +6726,8 @@ var __publicField = (obj, key, value) => {
|
|
|
6707
6726
|
* @return {Number}
|
|
6708
6727
|
*/
|
|
6709
6728
|
getMonthPreDay(year, month) {
|
|
6710
|
-
const
|
|
6711
|
-
let day =
|
|
6729
|
+
const date2 = /* @__PURE__ */ new Date(`${year}/${month}/01`);
|
|
6730
|
+
let day = date2.getDay();
|
|
6712
6731
|
if (day == 0) {
|
|
6713
6732
|
day = 7;
|
|
6714
6733
|
}
|
|
@@ -6750,11 +6769,11 @@ var __publicField = (obj, key, value) => {
|
|
|
6750
6769
|
* 日期对象转成字符串
|
|
6751
6770
|
* @return {string}
|
|
6752
6771
|
*/
|
|
6753
|
-
date2Str(
|
|
6772
|
+
date2Str(date2, split) {
|
|
6754
6773
|
split = split || "-";
|
|
6755
|
-
const y2 =
|
|
6756
|
-
const m = this.getNumTwoBit(
|
|
6757
|
-
const d = this.getNumTwoBit(
|
|
6774
|
+
const y2 = date2.getFullYear();
|
|
6775
|
+
const m = this.getNumTwoBit(date2.getMonth() + 1);
|
|
6776
|
+
const d = this.getNumTwoBit(date2.getDate());
|
|
6758
6777
|
return [y2, m, d].join(split);
|
|
6759
6778
|
},
|
|
6760
6779
|
/**
|
|
@@ -6764,10 +6783,10 @@ var __publicField = (obj, key, value) => {
|
|
|
6764
6783
|
*/
|
|
6765
6784
|
getDay(i) {
|
|
6766
6785
|
i = i || 0;
|
|
6767
|
-
let
|
|
6786
|
+
let date2 = /* @__PURE__ */ new Date();
|
|
6768
6787
|
const diff = i * (1e3 * 60 * 60 * 24);
|
|
6769
|
-
|
|
6770
|
-
return this.date2Str(
|
|
6788
|
+
date2 = new Date(date2.getTime() + diff);
|
|
6789
|
+
return this.date2Str(date2);
|
|
6771
6790
|
},
|
|
6772
6791
|
/**
|
|
6773
6792
|
* 时间比较
|
|
@@ -6839,7 +6858,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6839
6858
|
const CalendarItem = React.forwardRef((props, ref) => {
|
|
6840
6859
|
const { locale } = useConfig$1();
|
|
6841
6860
|
const {
|
|
6842
|
-
type,
|
|
6861
|
+
type: type2,
|
|
6843
6862
|
isAutoBackFill,
|
|
6844
6863
|
poppable,
|
|
6845
6864
|
title,
|
|
@@ -6913,10 +6932,10 @@ var __publicField = (obj, key, value) => {
|
|
|
6913
6932
|
});
|
|
6914
6933
|
const monthitemclasses = classNames({
|
|
6915
6934
|
"calendar-month-item": true,
|
|
6916
|
-
[`${
|
|
6935
|
+
[`${type2 === "range" ? "month-item-range" : ""}`]: true
|
|
6917
6936
|
});
|
|
6918
|
-
const splitDate = (
|
|
6919
|
-
return
|
|
6937
|
+
const splitDate = (date2) => {
|
|
6938
|
+
return date2.split("-");
|
|
6920
6939
|
};
|
|
6921
6940
|
const isStart = (currDate) => {
|
|
6922
6941
|
return Utils.isEqual(state.currDate[0], currDate);
|
|
@@ -6940,13 +6959,13 @@ var __publicField = (obj, key, value) => {
|
|
|
6940
6959
|
const getClass = (day, month) => {
|
|
6941
6960
|
const currDate = getCurrDate(day, month);
|
|
6942
6961
|
if (day.type === "curr") {
|
|
6943
|
-
if (Utils.isEqual(state.currDate, currDate) ||
|
|
6962
|
+
if (Utils.isEqual(state.currDate, currDate) || type2 === "range" && (isStart(currDate) || isEnd(currDate)) || type2 === "multiple" && isMultiple(currDate)) {
|
|
6944
6963
|
return `${state.dayPrefix}-active`;
|
|
6945
6964
|
}
|
|
6946
6965
|
if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
6947
6966
|
return `${state.dayPrefix}-disabled`;
|
|
6948
6967
|
}
|
|
6949
|
-
if (
|
|
6968
|
+
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
6969
|
return `${state.dayPrefix}-choose`;
|
|
6951
6970
|
}
|
|
6952
6971
|
return null;
|
|
@@ -6957,12 +6976,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6957
6976
|
return state.isRange && day.type === "curr" && getClass(day, month) === "calendar-month-day-active";
|
|
6958
6977
|
};
|
|
6959
6978
|
const isCurrDay = (month, day) => {
|
|
6960
|
-
const
|
|
6961
|
-
return Utils.isEqual(
|
|
6979
|
+
const date2 = `${month.curData[0]}-${month.curData[1]}-${day}`;
|
|
6980
|
+
return Utils.isEqual(date2, Utils.date2Str(/* @__PURE__ */ new Date()));
|
|
6962
6981
|
};
|
|
6963
6982
|
const confirm = () => {
|
|
6964
|
-
const { type:
|
|
6965
|
-
if (
|
|
6983
|
+
const { type: type22 } = props;
|
|
6984
|
+
if (type22 === "range" && state.chooseData.length === 2 || type22 !== "range") {
|
|
6966
6985
|
const chooseData = state.chooseData.slice(0);
|
|
6967
6986
|
onChoose && onChoose(chooseData);
|
|
6968
6987
|
if (poppable) {
|
|
@@ -6972,12 +6991,12 @@ var __publicField = (obj, key, value) => {
|
|
|
6972
6991
|
};
|
|
6973
6992
|
const chooseDay = (day, month, isFirst) => {
|
|
6974
6993
|
if (getClass(day, month) !== `${state.dayPrefix}-disabled`) {
|
|
6975
|
-
const { type:
|
|
6994
|
+
const { type: type22 } = props;
|
|
6976
6995
|
const days = [...month.curData];
|
|
6977
6996
|
days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
6978
6997
|
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
6979
6998
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
6980
|
-
if (
|
|
6999
|
+
if (type22 === "multiple") {
|
|
6981
7000
|
if (state.currDate.length > 0) {
|
|
6982
7001
|
let hasIndex = "";
|
|
6983
7002
|
state.currDate.forEach((item, index) => {
|
|
@@ -6998,7 +7017,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6998
7017
|
state.currDate = [days[3]];
|
|
6999
7018
|
state.chooseData = [[...days]];
|
|
7000
7019
|
}
|
|
7001
|
-
} else if (
|
|
7020
|
+
} else if (type22 === "range") {
|
|
7002
7021
|
const curDataLength = Object.values(state.currDate).length;
|
|
7003
7022
|
if (curDataLength === 2 || curDataLength === 0) {
|
|
7004
7023
|
state.currDate = [days[3]];
|
|
@@ -7042,11 +7061,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7042
7061
|
}
|
|
7043
7062
|
return false;
|
|
7044
7063
|
};
|
|
7045
|
-
const getCurrData = (
|
|
7046
|
-
const monthData =
|
|
7064
|
+
const getCurrData = (type22) => {
|
|
7065
|
+
const monthData = type22 === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
|
|
7047
7066
|
let year = parseInt(monthData.curData[0]);
|
|
7048
7067
|
let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
|
|
7049
|
-
switch (
|
|
7068
|
+
switch (type22) {
|
|
7050
7069
|
case "prev":
|
|
7051
7070
|
month === 1 && (year -= 1);
|
|
7052
7071
|
month = month === 1 ? 12 : --month;
|
|
@@ -7062,36 +7081,36 @@ var __publicField = (obj, key, value) => {
|
|
|
7062
7081
|
Utils.getMonthDays(String(year), String(month))
|
|
7063
7082
|
];
|
|
7064
7083
|
};
|
|
7065
|
-
const getDaysStatus = (days,
|
|
7084
|
+
const getDaysStatus = (days, type22, dateInfo) => {
|
|
7066
7085
|
const { year, month } = dateInfo;
|
|
7067
|
-
if (
|
|
7086
|
+
if (type22 === "prev" && days >= 7) {
|
|
7068
7087
|
days -= 7;
|
|
7069
7088
|
}
|
|
7070
7089
|
return Array.from(Array(days), (v, k) => {
|
|
7071
7090
|
return {
|
|
7072
7091
|
day: k + 1,
|
|
7073
|
-
type:
|
|
7092
|
+
type: type22,
|
|
7074
7093
|
year,
|
|
7075
7094
|
month
|
|
7076
7095
|
};
|
|
7077
7096
|
});
|
|
7078
7097
|
};
|
|
7079
|
-
const getPreDaysStatus = (days,
|
|
7098
|
+
const getPreDaysStatus = (days, type22, dateInfo, preCurrMonthDays) => {
|
|
7080
7099
|
const { year, month } = dateInfo;
|
|
7081
|
-
if (
|
|
7100
|
+
if (type22 === "prev" && days >= 7) {
|
|
7082
7101
|
days -= 7;
|
|
7083
7102
|
}
|
|
7084
7103
|
const months2 = Array.from(Array(preCurrMonthDays), (v, k) => {
|
|
7085
7104
|
return {
|
|
7086
7105
|
day: k + 1,
|
|
7087
|
-
type:
|
|
7106
|
+
type: type22,
|
|
7088
7107
|
year,
|
|
7089
7108
|
month
|
|
7090
7109
|
};
|
|
7091
7110
|
});
|
|
7092
7111
|
return months2.slice(preCurrMonthDays - days);
|
|
7093
7112
|
};
|
|
7094
|
-
const getMonth = (curData,
|
|
7113
|
+
const getMonth = (curData, type22) => {
|
|
7095
7114
|
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
7096
7115
|
let preMonth = +curData[1] - 1;
|
|
7097
7116
|
let preYear = curData[0];
|
|
@@ -7124,7 +7143,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7124
7143
|
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
7125
7144
|
}
|
|
7126
7145
|
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
7127
|
-
if (
|
|
7146
|
+
if (type22 === "next") {
|
|
7128
7147
|
if (!state.endData || !Utils.compareDate(
|
|
7129
7148
|
`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(
|
|
7130
7149
|
state.endData[0],
|
|
@@ -7238,7 +7257,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7238
7257
|
getMonth(getCurrData("next"), "next");
|
|
7239
7258
|
} while (i++ < monthsNum);
|
|
7240
7259
|
state.monthsNum = monthsNum;
|
|
7241
|
-
if (
|
|
7260
|
+
if (type2 === "range" && Array.isArray(state.currDate)) {
|
|
7242
7261
|
if (state.currDate.length > 0) {
|
|
7243
7262
|
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
7244
7263
|
state.currDate.splice(0, 1, propStartDate);
|
|
@@ -7307,7 +7326,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7307
7326
|
state.currentIndex = current;
|
|
7308
7327
|
setReachedYearMonthInfo();
|
|
7309
7328
|
if (state.defaultData.length > 0) {
|
|
7310
|
-
if (
|
|
7329
|
+
if (type2 === "range") {
|
|
7311
7330
|
chooseDay(
|
|
7312
7331
|
{ day: state.defaultData[2], type: "curr" },
|
|
7313
7332
|
state.monthsData[state.currentIndex],
|
|
@@ -7318,7 +7337,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7318
7337
|
state.monthsData[lastCurrent],
|
|
7319
7338
|
true
|
|
7320
7339
|
);
|
|
7321
|
-
} else if (
|
|
7340
|
+
} else if (type2 === "multiple") {
|
|
7322
7341
|
[...state.currDate].forEach((item) => {
|
|
7323
7342
|
const dateArr = splitDate(item);
|
|
7324
7343
|
let current2 = state.currentIndex;
|
|
@@ -7358,13 +7377,13 @@ var __publicField = (obj, key, value) => {
|
|
|
7358
7377
|
state.monthsData.splice(0);
|
|
7359
7378
|
initData();
|
|
7360
7379
|
};
|
|
7361
|
-
const scrollToDate = (
|
|
7362
|
-
if (Utils.compareDate(
|
|
7363
|
-
|
|
7364
|
-
} else if (!Utils.compareDate(
|
|
7365
|
-
|
|
7380
|
+
const scrollToDate = (date2) => {
|
|
7381
|
+
if (Utils.compareDate(date2, state.propStartDate)) {
|
|
7382
|
+
date2 = state.propStartDate;
|
|
7383
|
+
} else if (!Utils.compareDate(date2, state.propEndDate)) {
|
|
7384
|
+
date2 = state.propEndDate;
|
|
7366
7385
|
}
|
|
7367
|
-
const dateArr = splitDate(
|
|
7386
|
+
const dateArr = splitDate(date2);
|
|
7368
7387
|
state.monthsData.forEach((item, index) => {
|
|
7369
7388
|
if (item.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
7370
7389
|
if (months.current) {
|
|
@@ -7487,7 +7506,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7487
7506
|
children,
|
|
7488
7507
|
poppable,
|
|
7489
7508
|
visible,
|
|
7490
|
-
type,
|
|
7509
|
+
type: type2,
|
|
7491
7510
|
isAutoBackFill,
|
|
7492
7511
|
title,
|
|
7493
7512
|
defaultValue,
|
|
@@ -7523,9 +7542,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7523
7542
|
const select = (param) => {
|
|
7524
7543
|
onSelected && onSelected(param);
|
|
7525
7544
|
};
|
|
7526
|
-
const scrollToDate = (
|
|
7545
|
+
const scrollToDate = (date2) => {
|
|
7527
7546
|
var _a;
|
|
7528
|
-
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(
|
|
7547
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date2);
|
|
7529
7548
|
};
|
|
7530
7549
|
const yearMonthChange = (param) => {
|
|
7531
7550
|
onYearMonthChange && onYearMonthChange(param);
|
|
@@ -7538,7 +7557,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7538
7557
|
CalendarItem,
|
|
7539
7558
|
{
|
|
7540
7559
|
ref: calendarRef,
|
|
7541
|
-
type,
|
|
7560
|
+
type: type2,
|
|
7542
7561
|
isAutoBackFill,
|
|
7543
7562
|
poppable,
|
|
7544
7563
|
title: title || locale.calendaritem.title,
|
|
@@ -7811,7 +7830,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7811
7830
|
defaultValue,
|
|
7812
7831
|
title,
|
|
7813
7832
|
optionKey,
|
|
7814
|
-
format,
|
|
7833
|
+
format: format2,
|
|
7815
7834
|
closeable,
|
|
7816
7835
|
closeIconPosition,
|
|
7817
7836
|
closeIcon,
|
|
@@ -7851,7 +7870,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7851
7870
|
lazy,
|
|
7852
7871
|
onLoad,
|
|
7853
7872
|
optionKey,
|
|
7854
|
-
format
|
|
7873
|
+
format: format2
|
|
7855
7874
|
},
|
|
7856
7875
|
lazyLoadMap: /* @__PURE__ */ new Map()
|
|
7857
7876
|
});
|
|
@@ -7861,7 +7880,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7861
7880
|
});
|
|
7862
7881
|
React.useEffect(() => {
|
|
7863
7882
|
initData();
|
|
7864
|
-
}, [options,
|
|
7883
|
+
}, [options, format2]);
|
|
7865
7884
|
React.useEffect(() => {
|
|
7866
7885
|
if (defaultValue && defaultValue !== innerValue) {
|
|
7867
7886
|
setInnerValue(defaultValue);
|
|
@@ -7869,10 +7888,10 @@ var __publicField = (obj, key, value) => {
|
|
|
7869
7888
|
}, [defaultValue]);
|
|
7870
7889
|
const initData = async () => {
|
|
7871
7890
|
state.lazyLoadMap.clear();
|
|
7872
|
-
if (
|
|
7891
|
+
if (format2 && Object.keys(format2).length > 0) {
|
|
7873
7892
|
state.optionsData = convertListToOptions(
|
|
7874
7893
|
options,
|
|
7875
|
-
|
|
7894
|
+
format2
|
|
7876
7895
|
);
|
|
7877
7896
|
} else {
|
|
7878
7897
|
state.optionsData = options;
|
|
@@ -7978,15 +7997,15 @@ var __publicField = (obj, key, value) => {
|
|
|
7978
7997
|
const closePopup = () => {
|
|
7979
7998
|
close();
|
|
7980
7999
|
};
|
|
7981
|
-
const chooseItem = async (node,
|
|
7982
|
-
if (!
|
|
8000
|
+
const chooseItem = async (node, type2) => {
|
|
8001
|
+
if (!type2 && node.disabled || !state.panes[state.tabsCursor]) {
|
|
7983
8002
|
return;
|
|
7984
8003
|
}
|
|
7985
8004
|
if (state.tree.isLeaf(node, isLazy())) {
|
|
7986
8005
|
node.leaf = true;
|
|
7987
8006
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
7988
8007
|
state.panes = state.panes.slice(0, node.level + 1);
|
|
7989
|
-
if (!
|
|
8008
|
+
if (!type2) {
|
|
7990
8009
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
7991
8010
|
const optionParams = pathNodes.map((item) => item.value);
|
|
7992
8011
|
onChange(optionParams, pathNodes);
|
|
@@ -8009,7 +8028,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8009
8028
|
});
|
|
8010
8029
|
setOptionsData(state.panes);
|
|
8011
8030
|
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
8012
|
-
if (!
|
|
8031
|
+
if (!type2) {
|
|
8013
8032
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
8014
8033
|
const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
|
|
8015
8034
|
onPathChange(optionParams, pathNodes);
|
|
@@ -8023,7 +8042,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8023
8042
|
await invokeLazyLoad(node);
|
|
8024
8043
|
if (state.currentProcessNode === node) {
|
|
8025
8044
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
8026
|
-
chooseItem(node,
|
|
8045
|
+
chooseItem(node, type2);
|
|
8027
8046
|
}
|
|
8028
8047
|
setOptionsData(state.panes);
|
|
8029
8048
|
};
|
|
@@ -8085,7 +8104,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8085
8104
|
Cascader.defaultProps = defaultProps$$;
|
|
8086
8105
|
Cascader.displayName = "NutCascader";
|
|
8087
8106
|
const CheckboxGroupContext = React.createContext(null);
|
|
8088
|
-
const Context = CheckboxGroupContext;
|
|
8107
|
+
const Context$1 = CheckboxGroupContext;
|
|
8089
8108
|
const defaultProps$_ = {
|
|
8090
8109
|
max: void 0,
|
|
8091
8110
|
labelPosition: "right",
|
|
@@ -8156,7 +8175,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8156
8175
|
});
|
|
8157
8176
|
}, [options, max]);
|
|
8158
8177
|
return /* @__PURE__ */ React.createElement(
|
|
8159
|
-
Context.Provider,
|
|
8178
|
+
Context$1.Provider,
|
|
8160
8179
|
{
|
|
8161
8180
|
value: {
|
|
8162
8181
|
labelPosition: labelPosition || "right",
|
|
@@ -8219,7 +8238,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8219
8238
|
...others
|
|
8220
8239
|
} = props;
|
|
8221
8240
|
let { labelPosition, ...rest } = others;
|
|
8222
|
-
const ctx = React.useContext(Context);
|
|
8241
|
+
const ctx = React.useContext(Context$1);
|
|
8223
8242
|
let [innerChecked, setChecked] = usePropsValue({
|
|
8224
8243
|
value: props.checked,
|
|
8225
8244
|
defaultValue: props.defaultChecked,
|
|
@@ -8419,18 +8438,18 @@ var __publicField = (obj, key, value) => {
|
|
|
8419
8438
|
}
|
|
8420
8439
|
return false;
|
|
8421
8440
|
};
|
|
8422
|
-
const setTransform = (translateY = 0,
|
|
8441
|
+
const setTransform = (translateY = 0, type2, time = DEFAULT_DURATION, deg) => {
|
|
8423
8442
|
let nTime = time;
|
|
8424
|
-
if (
|
|
8443
|
+
if (type2 !== "end") {
|
|
8425
8444
|
nTime = 0;
|
|
8426
8445
|
}
|
|
8427
8446
|
setTouchTime(nTime);
|
|
8428
8447
|
setTouchDeg(deg);
|
|
8429
8448
|
setScrollDistance(translateY);
|
|
8430
8449
|
};
|
|
8431
|
-
const setMove = (move,
|
|
8450
|
+
const setMove = (move, type2, time) => {
|
|
8432
8451
|
let updateMove = move + transformY.current;
|
|
8433
|
-
if (
|
|
8452
|
+
if (type2 === "end") {
|
|
8434
8453
|
if (updateMove > 0) {
|
|
8435
8454
|
updateMove = 0;
|
|
8436
8455
|
}
|
|
@@ -8439,7 +8458,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8439
8458
|
}
|
|
8440
8459
|
const endMove = Math.round(updateMove / lineSpacing.current) * lineSpacing.current;
|
|
8441
8460
|
const deg = `${(Math.abs(Math.round(endMove / lineSpacing.current)) + 1) * rotation}deg`;
|
|
8442
|
-
setTransform(endMove,
|
|
8461
|
+
setTransform(endMove, type2, time, deg);
|
|
8443
8462
|
setCurrIndex(Math.abs(Math.round(endMove / lineSpacing.current)) + 1);
|
|
8444
8463
|
} else {
|
|
8445
8464
|
let deg = 0;
|
|
@@ -8492,7 +8511,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8492
8511
|
nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
|
|
8493
8512
|
return nDistance;
|
|
8494
8513
|
};
|
|
8495
|
-
const modifyStatus = (
|
|
8514
|
+
const modifyStatus = (type2, val) => {
|
|
8496
8515
|
const value = val || defaultValue;
|
|
8497
8516
|
let index = -1;
|
|
8498
8517
|
if (value) {
|
|
@@ -8512,7 +8531,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8512
8531
|
}
|
|
8513
8532
|
setCurrIndex(index === -1 ? 1 : index + 1);
|
|
8514
8533
|
const move = index === -1 ? 0 : index * lineSpacing.current;
|
|
8515
|
-
|
|
8534
|
+
type2 && setChooseValue(-move);
|
|
8516
8535
|
setMove(-move);
|
|
8517
8536
|
};
|
|
8518
8537
|
const stopMomentum = () => {
|
|
@@ -8670,6 +8689,11 @@ var __publicField = (obj, key, value) => {
|
|
|
8670
8689
|
(_a = props.onConfirm) == null ? void 0 : _a.call(props, setSelectedOptions(), val);
|
|
8671
8690
|
}
|
|
8672
8691
|
});
|
|
8692
|
+
const [innerVisible, setInnerVisible] = usePropsValue({
|
|
8693
|
+
value: props.visible,
|
|
8694
|
+
defaultValue: false,
|
|
8695
|
+
finalValue: false
|
|
8696
|
+
});
|
|
8673
8697
|
const [innerValue, setInnerValue] = React.useState(selectedValue);
|
|
8674
8698
|
const [currentValue, setCurrentValue] = React.useState([]);
|
|
8675
8699
|
const [columnIndex, setColumnIndex] = React.useState(0);
|
|
@@ -8677,6 +8701,15 @@ var __publicField = (obj, key, value) => {
|
|
|
8677
8701
|
const [refs, setRefs] = useRefs();
|
|
8678
8702
|
const [columnsList, setColumnsList] = React.useState([]);
|
|
8679
8703
|
const isConfirmEvent = React.useRef(false);
|
|
8704
|
+
const actions = {
|
|
8705
|
+
open: () => {
|
|
8706
|
+
setInnerVisible(true);
|
|
8707
|
+
},
|
|
8708
|
+
close: () => {
|
|
8709
|
+
setInnerVisible(false);
|
|
8710
|
+
}
|
|
8711
|
+
};
|
|
8712
|
+
React.useImperativeHandle(ref, () => actions);
|
|
8680
8713
|
const formatCascade = (columns, values) => {
|
|
8681
8714
|
const formatted = [];
|
|
8682
8715
|
let columnOptions = {
|
|
@@ -8712,8 +8745,8 @@ var __publicField = (obj, key, value) => {
|
|
|
8712
8745
|
return "single";
|
|
8713
8746
|
};
|
|
8714
8747
|
const normalListData = (innerValue2) => {
|
|
8715
|
-
const
|
|
8716
|
-
switch (
|
|
8748
|
+
const type2 = columnsType();
|
|
8749
|
+
switch (type2) {
|
|
8717
8750
|
case "multiple":
|
|
8718
8751
|
return options;
|
|
8719
8752
|
case "cascade":
|
|
@@ -8738,19 +8771,19 @@ var __publicField = (obj, key, value) => {
|
|
|
8738
8771
|
};
|
|
8739
8772
|
React.useEffect(() => {
|
|
8740
8773
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
8741
|
-
}, [
|
|
8774
|
+
}, [innerVisible]);
|
|
8742
8775
|
React.useEffect(() => {
|
|
8743
|
-
if (
|
|
8776
|
+
if (innerVisible) {
|
|
8744
8777
|
init();
|
|
8745
8778
|
}
|
|
8746
|
-
}, [options,
|
|
8779
|
+
}, [options, innerVisible]);
|
|
8747
8780
|
React.useEffect(() => {
|
|
8748
|
-
if (!
|
|
8781
|
+
if (!innerVisible) {
|
|
8749
8782
|
return;
|
|
8750
8783
|
}
|
|
8751
8784
|
Taro.getEnv() !== "WEB" && setCurrentValue(defaultValuesConvert());
|
|
8752
8785
|
onChange && onChange(setSelectedOptions(), innerValue, columnIndex);
|
|
8753
|
-
}, [innerValue, columnsList,
|
|
8786
|
+
}, [innerValue, columnsList, innerVisible]);
|
|
8754
8787
|
const setSelectedOptions = () => {
|
|
8755
8788
|
const options2 = [];
|
|
8756
8789
|
let currOptions = [];
|
|
@@ -8832,6 +8865,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8832
8865
|
if (moving) {
|
|
8833
8866
|
isConfirmEvent.current = true;
|
|
8834
8867
|
} else {
|
|
8868
|
+
console.log("picker confirmed", innerValue);
|
|
8835
8869
|
setSelectedValue(innerValue);
|
|
8836
8870
|
closePicker();
|
|
8837
8871
|
}
|
|
@@ -8840,6 +8874,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8840
8874
|
}, 0);
|
|
8841
8875
|
};
|
|
8842
8876
|
const closePicker = () => {
|
|
8877
|
+
setInnerVisible(false);
|
|
8843
8878
|
onClose && onClose(setSelectedOptions(), innerValue);
|
|
8844
8879
|
afterClose && afterClose(setSelectedOptions(), innerValue, pickerRef);
|
|
8845
8880
|
};
|
|
@@ -8848,10 +8883,23 @@ var __publicField = (obj, key, value) => {
|
|
|
8848
8883
|
"span",
|
|
8849
8884
|
{
|
|
8850
8885
|
className: `${classPrefix2}__cancel-btn`,
|
|
8851
|
-
onClick: () =>
|
|
8886
|
+
onClick: (e) => {
|
|
8887
|
+
e.stopPropagation();
|
|
8888
|
+
closePicker();
|
|
8889
|
+
}
|
|
8852
8890
|
},
|
|
8853
8891
|
locale.cancel
|
|
8854
|
-
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
8892
|
+
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
8893
|
+
"span",
|
|
8894
|
+
{
|
|
8895
|
+
className: `${classPrefix2}__confirm-btn`,
|
|
8896
|
+
onClick: (e) => {
|
|
8897
|
+
e.stopPropagation();
|
|
8898
|
+
confirm();
|
|
8899
|
+
}
|
|
8900
|
+
},
|
|
8901
|
+
locale.confirm
|
|
8902
|
+
));
|
|
8855
8903
|
};
|
|
8856
8904
|
const [, setPickingStatus] = React.useState(false);
|
|
8857
8905
|
const pickerStart = () => {
|
|
@@ -8875,16 +8923,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8875
8923
|
changeIndex
|
|
8876
8924
|
);
|
|
8877
8925
|
};
|
|
8878
|
-
return /* @__PURE__ */ React.createElement(
|
|
8926
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React.createElement(
|
|
8879
8927
|
Popup,
|
|
8880
8928
|
{
|
|
8881
|
-
visible,
|
|
8929
|
+
visible: innerVisible,
|
|
8882
8930
|
position: "bottom",
|
|
8883
8931
|
afterClose: () => {
|
|
8884
8932
|
closePicker();
|
|
8885
8933
|
}
|
|
8886
8934
|
},
|
|
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) => {
|
|
8935
|
+
/* @__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
8936
|
return /* @__PURE__ */ React.createElement(
|
|
8889
8937
|
PickerPanel$1,
|
|
8890
8938
|
{
|
|
@@ -8923,7 +8971,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8923
8971
|
}));
|
|
8924
8972
|
})
|
|
8925
8973
|
)))
|
|
8926
|
-
);
|
|
8974
|
+
));
|
|
8927
8975
|
};
|
|
8928
8976
|
const Picker = React.forwardRef(InternalPicker);
|
|
8929
8977
|
const Picker$1 = Picker;
|
|
@@ -8943,7 +8991,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8943
8991
|
const {
|
|
8944
8992
|
startDate,
|
|
8945
8993
|
endDate,
|
|
8946
|
-
type,
|
|
8994
|
+
type: type2,
|
|
8947
8995
|
showChinese,
|
|
8948
8996
|
minuteStep,
|
|
8949
8997
|
visible,
|
|
@@ -8996,16 +9044,16 @@ var __publicField = (obj, key, value) => {
|
|
|
8996
9044
|
function getMonthEndDay(year, month) {
|
|
8997
9045
|
return new Date(year, month, 0).getDate();
|
|
8998
9046
|
}
|
|
8999
|
-
const getBoundary = (
|
|
9000
|
-
const boundary =
|
|
9047
|
+
const getBoundary = (type22, value) => {
|
|
9048
|
+
const boundary = type22 === "min" ? startDate : endDate;
|
|
9001
9049
|
const year = boundary.getFullYear();
|
|
9002
9050
|
let month = 1;
|
|
9003
|
-
let
|
|
9051
|
+
let date2 = 1;
|
|
9004
9052
|
let hour = 0;
|
|
9005
9053
|
let minute = 0;
|
|
9006
|
-
if (
|
|
9054
|
+
if (type22 === "max") {
|
|
9007
9055
|
month = 12;
|
|
9008
|
-
|
|
9056
|
+
date2 = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
9009
9057
|
hour = 23;
|
|
9010
9058
|
minute = 59;
|
|
9011
9059
|
}
|
|
@@ -9013,8 +9061,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9013
9061
|
if (value.getFullYear() === year) {
|
|
9014
9062
|
month = boundary.getMonth() + 1;
|
|
9015
9063
|
if (value.getMonth() + 1 === month) {
|
|
9016
|
-
|
|
9017
|
-
if (value.getDate() ===
|
|
9064
|
+
date2 = boundary.getDate();
|
|
9065
|
+
if (value.getDate() === date2) {
|
|
9018
9066
|
hour = boundary.getHours();
|
|
9019
9067
|
if (value.getHours() === hour) {
|
|
9020
9068
|
minute = boundary.getMinutes();
|
|
@@ -9023,12 +9071,12 @@ var __publicField = (obj, key, value) => {
|
|
|
9023
9071
|
}
|
|
9024
9072
|
}
|
|
9025
9073
|
return {
|
|
9026
|
-
[`${
|
|
9027
|
-
[`${
|
|
9028
|
-
[`${
|
|
9029
|
-
[`${
|
|
9030
|
-
[`${
|
|
9031
|
-
[`${
|
|
9074
|
+
[`${type22}Year`]: year,
|
|
9075
|
+
[`${type22}Month`]: month,
|
|
9076
|
+
[`${type22}Date`]: date2,
|
|
9077
|
+
[`${type22}Hour`]: hour,
|
|
9078
|
+
[`${type22}Minute`]: minute,
|
|
9079
|
+
[`${type22}Seconds`]: seconds
|
|
9032
9080
|
};
|
|
9033
9081
|
};
|
|
9034
9082
|
const ranges = () => {
|
|
@@ -9063,7 +9111,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9063
9111
|
range: [minSeconds, maxSeconds]
|
|
9064
9112
|
}
|
|
9065
9113
|
];
|
|
9066
|
-
switch (
|
|
9114
|
+
switch (type2.toLocaleLowerCase()) {
|
|
9067
9115
|
case "date":
|
|
9068
9116
|
result = result.slice(0, 3);
|
|
9069
9117
|
break;
|
|
@@ -9090,18 +9138,18 @@ var __publicField = (obj, key, value) => {
|
|
|
9090
9138
|
};
|
|
9091
9139
|
const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
|
|
9092
9140
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
9093
|
-
|
|
9141
|
+
type2.toLocaleLowerCase()
|
|
9094
9142
|
)) {
|
|
9095
9143
|
const formatDate = [];
|
|
9096
9144
|
selectedValue.forEach((item) => {
|
|
9097
9145
|
formatDate.push(item);
|
|
9098
9146
|
});
|
|
9099
|
-
if (
|
|
9147
|
+
if (type2.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
|
|
9100
9148
|
formatDate.unshift(
|
|
9101
9149
|
new Date(defaultValue || startDate || endDate).getFullYear()
|
|
9102
9150
|
);
|
|
9103
9151
|
}
|
|
9104
|
-
if (
|
|
9152
|
+
if (type2.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
|
|
9105
9153
|
formatDate.push(
|
|
9106
9154
|
new Date(defaultValue || startDate || endDate).getDate()
|
|
9107
9155
|
);
|
|
@@ -9112,22 +9160,22 @@ var __publicField = (obj, key, value) => {
|
|
|
9112
9160
|
Number(formatDate[2]),
|
|
9113
9161
|
getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
|
|
9114
9162
|
);
|
|
9115
|
-
let
|
|
9116
|
-
if (
|
|
9117
|
-
|
|
9118
|
-
} else if (
|
|
9119
|
-
|
|
9163
|
+
let date2 = null;
|
|
9164
|
+
if (type2.toLocaleLowerCase() === "date" || type2.toLocaleLowerCase() === "month-day" || type2.toLocaleLowerCase() === "year-month") {
|
|
9165
|
+
date2 = new Date(year, month, day);
|
|
9166
|
+
} else if (type2.toLocaleLowerCase() === "datetime") {
|
|
9167
|
+
date2 = new Date(
|
|
9120
9168
|
year,
|
|
9121
9169
|
month,
|
|
9122
9170
|
day,
|
|
9123
9171
|
Number(formatDate[3]),
|
|
9124
9172
|
Number(formatDate[4])
|
|
9125
9173
|
);
|
|
9126
|
-
} else if (
|
|
9127
|
-
|
|
9174
|
+
} else if (type2.toLocaleLowerCase() === "datehour") {
|
|
9175
|
+
date2 = new Date(year, month, day, Number(formatDate[3]));
|
|
9128
9176
|
}
|
|
9129
|
-
const isEqual = (currentDate == null ? void 0 : currentDate.getTime()) === (
|
|
9130
|
-
|
|
9177
|
+
const isEqual = (currentDate == null ? void 0 : currentDate.getTime()) === (date2 == null ? void 0 : date2.getTime());
|
|
9178
|
+
date2 && isDate(date2) && !isEqual && setCurrentDate(formatValue(date2));
|
|
9131
9179
|
}
|
|
9132
9180
|
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
9133
9181
|
};
|
|
@@ -9138,28 +9186,28 @@ var __publicField = (obj, key, value) => {
|
|
|
9138
9186
|
}
|
|
9139
9187
|
return str;
|
|
9140
9188
|
};
|
|
9141
|
-
const formatterOption = (
|
|
9189
|
+
const formatterOption = (type22, value) => {
|
|
9142
9190
|
let fOption = null;
|
|
9143
9191
|
if (formatter) {
|
|
9144
|
-
fOption = formatter(
|
|
9192
|
+
fOption = formatter(type22, {
|
|
9145
9193
|
text: padZero(value, 2),
|
|
9146
9194
|
value: padZero(value, 2)
|
|
9147
9195
|
});
|
|
9148
9196
|
} else {
|
|
9149
9197
|
const padMin = padZero(value, 2);
|
|
9150
|
-
const fatter = showChinese ? zhCNType[
|
|
9198
|
+
const fatter = showChinese ? zhCNType[type22] : "";
|
|
9151
9199
|
fOption = { text: padMin + fatter, value: padMin };
|
|
9152
9200
|
}
|
|
9153
9201
|
return fOption;
|
|
9154
9202
|
};
|
|
9155
|
-
const generateValue = (min, max, val,
|
|
9203
|
+
const generateValue = (min, max, val, type22, columnIndex) => {
|
|
9156
9204
|
var _a;
|
|
9157
9205
|
let cmin = min;
|
|
9158
9206
|
const arr = [];
|
|
9159
9207
|
let index = 0;
|
|
9160
9208
|
while (cmin <= max) {
|
|
9161
|
-
arr.push(formatterOption(
|
|
9162
|
-
if (
|
|
9209
|
+
arr.push(formatterOption(type22, cmin));
|
|
9210
|
+
if (type22 === "minute") {
|
|
9163
9211
|
cmin += minuteStep;
|
|
9164
9212
|
} else {
|
|
9165
9213
|
cmin++;
|
|
@@ -9170,26 +9218,26 @@ var __publicField = (obj, key, value) => {
|
|
|
9170
9218
|
}
|
|
9171
9219
|
defaultValueOfPicker[columnIndex] = (_a = arr[index]) == null ? void 0 : _a.value;
|
|
9172
9220
|
setDefaultValueOfPicker([...defaultValueOfPicker]);
|
|
9173
|
-
if (props.filter && props.filter(
|
|
9174
|
-
return props.filter(
|
|
9221
|
+
if (props.filter && props.filter(type22, arr)) {
|
|
9222
|
+
return props.filter(type22, arr);
|
|
9175
9223
|
}
|
|
9176
9224
|
return arr;
|
|
9177
9225
|
};
|
|
9178
|
-
const getDateIndex = (
|
|
9226
|
+
const getDateIndex = (type22) => {
|
|
9179
9227
|
if (!currentDate)
|
|
9180
9228
|
return 0;
|
|
9181
9229
|
let d = 0;
|
|
9182
|
-
if (
|
|
9230
|
+
if (type22 === "year") {
|
|
9183
9231
|
d = currentDate.getFullYear();
|
|
9184
|
-
} else if (
|
|
9232
|
+
} else if (type22 === "month") {
|
|
9185
9233
|
d = currentDate.getMonth() + 1;
|
|
9186
|
-
} else if (
|
|
9234
|
+
} else if (type22 === "day") {
|
|
9187
9235
|
d = currentDate.getDate();
|
|
9188
|
-
} else if (
|
|
9236
|
+
} else if (type22 === "hour") {
|
|
9189
9237
|
d = currentDate.getHours();
|
|
9190
|
-
} else if (
|
|
9238
|
+
} else if (type22 === "minute") {
|
|
9191
9239
|
d = currentDate.getMinutes();
|
|
9192
|
-
} else if (
|
|
9240
|
+
} else if (type22 === "seconds") {
|
|
9193
9241
|
d = currentDate.getSeconds();
|
|
9194
9242
|
}
|
|
9195
9243
|
return d;
|
|
@@ -9236,211 +9284,1189 @@ var __publicField = (obj, key, value) => {
|
|
|
9236
9284
|
};
|
|
9237
9285
|
DatePicker.defaultProps = defaultProps$X;
|
|
9238
9286
|
DatePicker.displayName = "NutDatePicker";
|
|
9239
|
-
const
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
labelWidth: 90,
|
|
9248
|
-
errorMessageAlign: "left",
|
|
9249
|
-
showErrorLine: true,
|
|
9250
|
-
showErrorMessage: true
|
|
9251
|
-
};
|
|
9252
|
-
class FormItem extends React.Component {
|
|
9253
|
-
constructor() {
|
|
9254
|
-
super(...arguments);
|
|
9255
|
-
__publicField(this, "cancelRegister");
|
|
9256
|
-
// children添加value属性和onChange事件
|
|
9257
|
-
__publicField(this, "getControlled", (children) => {
|
|
9258
|
-
const { getFieldValue, setFieldsValue } = this.context;
|
|
9259
|
-
const { name } = this.props;
|
|
9260
|
-
const type = children.type.NAME;
|
|
9261
|
-
return {
|
|
9262
|
-
value: getFieldValue(name),
|
|
9263
|
-
onChange: (event) => {
|
|
9264
|
-
let newValue = event;
|
|
9265
|
-
switch (type) {
|
|
9266
|
-
case "checkbox":
|
|
9267
|
-
newValue = event.target.value;
|
|
9268
|
-
break;
|
|
9269
|
-
}
|
|
9270
|
-
setFieldsValue({ [name]: newValue });
|
|
9287
|
+
const Context = React.createContext({});
|
|
9288
|
+
function _extends() {
|
|
9289
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
9290
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
9291
|
+
var source = arguments[i];
|
|
9292
|
+
for (var key in source) {
|
|
9293
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
9294
|
+
target[key] = source[key];
|
|
9271
9295
|
}
|
|
9272
|
-
}
|
|
9273
|
-
}
|
|
9274
|
-
|
|
9275
|
-
|
|
9296
|
+
}
|
|
9297
|
+
}
|
|
9298
|
+
return target;
|
|
9299
|
+
};
|
|
9300
|
+
return _extends.apply(this, arguments);
|
|
9301
|
+
}
|
|
9302
|
+
function _inheritsLoose(subClass, superClass) {
|
|
9303
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
9304
|
+
subClass.prototype.constructor = subClass;
|
|
9305
|
+
_setPrototypeOf(subClass, superClass);
|
|
9306
|
+
}
|
|
9307
|
+
function _getPrototypeOf(o) {
|
|
9308
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
|
|
9309
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
9310
|
+
};
|
|
9311
|
+
return _getPrototypeOf(o);
|
|
9312
|
+
}
|
|
9313
|
+
function _setPrototypeOf(o, p) {
|
|
9314
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
|
|
9315
|
+
o2.__proto__ = p2;
|
|
9316
|
+
return o2;
|
|
9317
|
+
};
|
|
9318
|
+
return _setPrototypeOf(o, p);
|
|
9319
|
+
}
|
|
9320
|
+
function _isNativeReflectConstruct() {
|
|
9321
|
+
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
9322
|
+
return false;
|
|
9323
|
+
if (Reflect.construct.sham)
|
|
9324
|
+
return false;
|
|
9325
|
+
if (typeof Proxy === "function")
|
|
9326
|
+
return true;
|
|
9327
|
+
try {
|
|
9328
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
9329
|
+
}));
|
|
9330
|
+
return true;
|
|
9331
|
+
} catch (e) {
|
|
9332
|
+
return false;
|
|
9333
|
+
}
|
|
9334
|
+
}
|
|
9335
|
+
function _construct(Parent, args, Class) {
|
|
9336
|
+
if (_isNativeReflectConstruct()) {
|
|
9337
|
+
_construct = Reflect.construct.bind();
|
|
9338
|
+
} else {
|
|
9339
|
+
_construct = function _construct2(Parent2, args2, Class2) {
|
|
9340
|
+
var a2 = [null];
|
|
9341
|
+
a2.push.apply(a2, args2);
|
|
9342
|
+
var Constructor = Function.bind.apply(Parent2, a2);
|
|
9343
|
+
var instance = new Constructor();
|
|
9344
|
+
if (Class2)
|
|
9345
|
+
_setPrototypeOf(instance, Class2.prototype);
|
|
9346
|
+
return instance;
|
|
9347
|
+
};
|
|
9348
|
+
}
|
|
9349
|
+
return _construct.apply(null, arguments);
|
|
9350
|
+
}
|
|
9351
|
+
function _isNativeFunction(fn) {
|
|
9352
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
9353
|
+
}
|
|
9354
|
+
function _wrapNativeSuper(Class) {
|
|
9355
|
+
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
9356
|
+
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
|
|
9357
|
+
if (Class2 === null || !_isNativeFunction(Class2))
|
|
9358
|
+
return Class2;
|
|
9359
|
+
if (typeof Class2 !== "function") {
|
|
9360
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
9361
|
+
}
|
|
9362
|
+
if (typeof _cache !== "undefined") {
|
|
9363
|
+
if (_cache.has(Class2))
|
|
9364
|
+
return _cache.get(Class2);
|
|
9365
|
+
_cache.set(Class2, Wrapper);
|
|
9366
|
+
}
|
|
9367
|
+
function Wrapper() {
|
|
9368
|
+
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
|
|
9369
|
+
}
|
|
9370
|
+
Wrapper.prototype = Object.create(Class2.prototype, {
|
|
9371
|
+
constructor: {
|
|
9372
|
+
value: Wrapper,
|
|
9373
|
+
enumerable: false,
|
|
9374
|
+
writable: true,
|
|
9375
|
+
configurable: true
|
|
9376
|
+
}
|
|
9276
9377
|
});
|
|
9277
|
-
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
|
|
9282
|
-
|
|
9283
|
-
|
|
9284
|
-
|
|
9285
|
-
|
|
9286
|
-
|
|
9287
|
-
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
}
|
|
9292
|
-
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
|
|
9297
|
-
|
|
9298
|
-
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9378
|
+
return _setPrototypeOf(Wrapper, Class2);
|
|
9379
|
+
};
|
|
9380
|
+
return _wrapNativeSuper(Class);
|
|
9381
|
+
}
|
|
9382
|
+
var formatRegExp = /%[sdj%]/g;
|
|
9383
|
+
var warning = function warning2() {
|
|
9384
|
+
};
|
|
9385
|
+
if (typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" && typeof window !== "undefined" && typeof document !== "undefined") {
|
|
9386
|
+
warning = function warning2(type2, errors) {
|
|
9387
|
+
if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
|
|
9388
|
+
if (errors.every(function(e) {
|
|
9389
|
+
return typeof e === "string";
|
|
9390
|
+
})) {
|
|
9391
|
+
console.warn(type2, errors);
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
};
|
|
9395
|
+
}
|
|
9396
|
+
function convertFieldsError(errors) {
|
|
9397
|
+
if (!errors || !errors.length)
|
|
9398
|
+
return null;
|
|
9399
|
+
var fields = {};
|
|
9400
|
+
errors.forEach(function(error) {
|
|
9401
|
+
var field = error.field;
|
|
9402
|
+
fields[field] = fields[field] || [];
|
|
9403
|
+
fields[field].push(error);
|
|
9404
|
+
});
|
|
9405
|
+
return fields;
|
|
9406
|
+
}
|
|
9407
|
+
function format(template) {
|
|
9408
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
9409
|
+
args[_key - 1] = arguments[_key];
|
|
9410
|
+
}
|
|
9411
|
+
var i = 0;
|
|
9412
|
+
var len = args.length;
|
|
9413
|
+
if (typeof template === "function") {
|
|
9414
|
+
return template.apply(null, args);
|
|
9415
|
+
}
|
|
9416
|
+
if (typeof template === "string") {
|
|
9417
|
+
var str = template.replace(formatRegExp, function(x) {
|
|
9418
|
+
if (x === "%%") {
|
|
9419
|
+
return "%";
|
|
9420
|
+
}
|
|
9421
|
+
if (i >= len) {
|
|
9422
|
+
return x;
|
|
9423
|
+
}
|
|
9424
|
+
switch (x) {
|
|
9425
|
+
case "%s":
|
|
9426
|
+
return String(args[i++]);
|
|
9427
|
+
case "%d":
|
|
9428
|
+
return Number(args[i++]);
|
|
9429
|
+
case "%j":
|
|
9430
|
+
try {
|
|
9431
|
+
return JSON.stringify(args[i++]);
|
|
9432
|
+
} catch (_) {
|
|
9433
|
+
return "[Circular]";
|
|
9304
9434
|
}
|
|
9305
|
-
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
{
|
|
9310
|
-
className: "nut-form-item__body__tips",
|
|
9311
|
-
style: { textAlign: errorMessageAlign }
|
|
9312
|
-
},
|
|
9313
|
-
item[0].message
|
|
9314
|
-
)));
|
|
9315
|
-
});
|
|
9316
|
-
__publicField(this, "pxCheck", (value) => {
|
|
9317
|
-
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
9435
|
+
break;
|
|
9436
|
+
default:
|
|
9437
|
+
return x;
|
|
9438
|
+
}
|
|
9318
9439
|
});
|
|
9440
|
+
return str;
|
|
9319
9441
|
}
|
|
9320
|
-
|
|
9321
|
-
|
|
9442
|
+
return template;
|
|
9443
|
+
}
|
|
9444
|
+
function isNativeStringType(type2) {
|
|
9445
|
+
return type2 === "string" || type2 === "url" || type2 === "hex" || type2 === "email" || type2 === "date" || type2 === "pattern";
|
|
9446
|
+
}
|
|
9447
|
+
function isEmptyValue(value, type2) {
|
|
9448
|
+
if (value === void 0 || value === null) {
|
|
9449
|
+
return true;
|
|
9322
9450
|
}
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
|
|
9451
|
+
if (type2 === "array" && Array.isArray(value) && !value.length) {
|
|
9452
|
+
return true;
|
|
9453
|
+
}
|
|
9454
|
+
if (isNativeStringType(type2) && typeof value === "string" && !value) {
|
|
9455
|
+
return true;
|
|
9456
|
+
}
|
|
9457
|
+
return false;
|
|
9458
|
+
}
|
|
9459
|
+
function asyncParallelArray(arr, func, callback) {
|
|
9460
|
+
var results = [];
|
|
9461
|
+
var total = 0;
|
|
9462
|
+
var arrLength = arr.length;
|
|
9463
|
+
function count(errors) {
|
|
9464
|
+
results.push.apply(results, errors || []);
|
|
9465
|
+
total++;
|
|
9466
|
+
if (total === arrLength) {
|
|
9467
|
+
callback(results);
|
|
9326
9468
|
}
|
|
9327
9469
|
}
|
|
9328
|
-
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9470
|
+
arr.forEach(function(a2) {
|
|
9471
|
+
func(a2, count);
|
|
9472
|
+
});
|
|
9473
|
+
}
|
|
9474
|
+
function asyncSerialArray(arr, func, callback) {
|
|
9475
|
+
var index = 0;
|
|
9476
|
+
var arrLength = arr.length;
|
|
9477
|
+
function next(errors) {
|
|
9478
|
+
if (errors && errors.length) {
|
|
9479
|
+
callback(errors);
|
|
9480
|
+
return;
|
|
9481
|
+
}
|
|
9482
|
+
var original = index;
|
|
9483
|
+
index = index + 1;
|
|
9484
|
+
if (original < arrLength) {
|
|
9485
|
+
func(arr[original], next);
|
|
9486
|
+
} else {
|
|
9487
|
+
callback([]);
|
|
9488
|
+
}
|
|
9336
9489
|
}
|
|
9490
|
+
next([]);
|
|
9337
9491
|
}
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
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
|
-
* @param newStore { [name]: newValue }
|
|
9366
|
-
*/
|
|
9367
|
-
__publicField(this, "setFieldsValue", (newStore) => {
|
|
9368
|
-
this.store = {
|
|
9369
|
-
...this.store,
|
|
9370
|
-
...newStore
|
|
9492
|
+
function flattenObjArr(objArr) {
|
|
9493
|
+
var ret = [];
|
|
9494
|
+
Object.keys(objArr).forEach(function(k) {
|
|
9495
|
+
ret.push.apply(ret, objArr[k] || []);
|
|
9496
|
+
});
|
|
9497
|
+
return ret;
|
|
9498
|
+
}
|
|
9499
|
+
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
|
|
9500
|
+
_inheritsLoose(AsyncValidationError2, _Error);
|
|
9501
|
+
function AsyncValidationError2(errors, fields) {
|
|
9502
|
+
var _this;
|
|
9503
|
+
_this = _Error.call(this, "Async Validation Error") || this;
|
|
9504
|
+
_this.errors = errors;
|
|
9505
|
+
_this.fields = fields;
|
|
9506
|
+
return _this;
|
|
9507
|
+
}
|
|
9508
|
+
return AsyncValidationError2;
|
|
9509
|
+
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
9510
|
+
function asyncMap(objArr, option, func, callback, source) {
|
|
9511
|
+
if (option.first) {
|
|
9512
|
+
var _pending = new Promise(function(resolve, reject) {
|
|
9513
|
+
var next = function next2(errors) {
|
|
9514
|
+
callback(errors);
|
|
9515
|
+
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
|
|
9371
9516
|
};
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
Object.keys(newStore).forEach((key) => {
|
|
9375
|
-
if (key === name) {
|
|
9376
|
-
enetity.onStoreChange();
|
|
9377
|
-
}
|
|
9378
|
-
});
|
|
9379
|
-
});
|
|
9380
|
-
});
|
|
9381
|
-
/**
|
|
9382
|
-
* 表单校验
|
|
9383
|
-
* rules: { required: true, message: '' }
|
|
9384
|
-
* descriptor: {
|
|
9385
|
-
* username: {
|
|
9386
|
-
* type: 'string',
|
|
9387
|
-
* required: true,
|
|
9388
|
-
* validator: (rule, value) => {
|
|
9389
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
9390
|
-
* },
|
|
9391
|
-
* },
|
|
9392
|
-
* }
|
|
9393
|
-
*/
|
|
9394
|
-
__publicField(this, "validate", () => {
|
|
9395
|
-
const err = [];
|
|
9396
|
-
this.errList.length = 0;
|
|
9397
|
-
this.fieldEntities.forEach((entity) => {
|
|
9398
|
-
const { name, rules = [] } = entity.props;
|
|
9399
|
-
const descriptor = {};
|
|
9400
|
-
if (rules.length) {
|
|
9401
|
-
if (rules.length > 1) {
|
|
9402
|
-
descriptor[name] = [];
|
|
9403
|
-
rules.map((v) => {
|
|
9404
|
-
descriptor[name].push(v);
|
|
9405
|
-
});
|
|
9406
|
-
} else {
|
|
9407
|
-
descriptor[name] = rules[0];
|
|
9408
|
-
}
|
|
9409
|
-
}
|
|
9410
|
-
});
|
|
9411
|
-
return err;
|
|
9517
|
+
var flattenArr = flattenObjArr(objArr);
|
|
9518
|
+
asyncSerialArray(flattenArr, func, next);
|
|
9412
9519
|
});
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
...this.callbacks,
|
|
9416
|
-
...callback
|
|
9417
|
-
};
|
|
9520
|
+
_pending["catch"](function(e) {
|
|
9521
|
+
return e;
|
|
9418
9522
|
});
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9523
|
+
return _pending;
|
|
9524
|
+
}
|
|
9525
|
+
var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
|
|
9526
|
+
var objArrKeys = Object.keys(objArr);
|
|
9527
|
+
var objArrLength = objArrKeys.length;
|
|
9528
|
+
var total = 0;
|
|
9529
|
+
var results = [];
|
|
9530
|
+
var pending = new Promise(function(resolve, reject) {
|
|
9531
|
+
var next = function next2(errors) {
|
|
9532
|
+
results.push.apply(results, errors);
|
|
9533
|
+
total++;
|
|
9534
|
+
if (total === objArrLength) {
|
|
9535
|
+
callback(results);
|
|
9536
|
+
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
|
|
9537
|
+
}
|
|
9538
|
+
};
|
|
9539
|
+
if (!objArrKeys.length) {
|
|
9540
|
+
callback(results);
|
|
9541
|
+
resolve(source);
|
|
9542
|
+
}
|
|
9543
|
+
objArrKeys.forEach(function(key) {
|
|
9544
|
+
var arr = objArr[key];
|
|
9545
|
+
if (firstFields.indexOf(key) !== -1) {
|
|
9546
|
+
asyncSerialArray(arr, func, next);
|
|
9547
|
+
} else {
|
|
9548
|
+
asyncParallelArray(arr, func, next);
|
|
9426
9549
|
}
|
|
9427
9550
|
});
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9551
|
+
});
|
|
9552
|
+
pending["catch"](function(e) {
|
|
9553
|
+
return e;
|
|
9554
|
+
});
|
|
9555
|
+
return pending;
|
|
9556
|
+
}
|
|
9557
|
+
function isErrorObj(obj) {
|
|
9558
|
+
return !!(obj && obj.message !== void 0);
|
|
9559
|
+
}
|
|
9560
|
+
function getValue(value, path) {
|
|
9561
|
+
var v = value;
|
|
9562
|
+
for (var i = 0; i < path.length; i++) {
|
|
9563
|
+
if (v == void 0) {
|
|
9564
|
+
return v;
|
|
9565
|
+
}
|
|
9566
|
+
v = v[path[i]];
|
|
9567
|
+
}
|
|
9568
|
+
return v;
|
|
9569
|
+
}
|
|
9570
|
+
function complementError(rule, source) {
|
|
9571
|
+
return function(oe) {
|
|
9572
|
+
var fieldValue;
|
|
9573
|
+
if (rule.fullFields) {
|
|
9574
|
+
fieldValue = getValue(source, rule.fullFields);
|
|
9575
|
+
} else {
|
|
9576
|
+
fieldValue = source[oe.field || rule.fullField];
|
|
9577
|
+
}
|
|
9578
|
+
if (isErrorObj(oe)) {
|
|
9579
|
+
oe.field = oe.field || rule.fullField;
|
|
9580
|
+
oe.fieldValue = fieldValue;
|
|
9581
|
+
return oe;
|
|
9582
|
+
}
|
|
9583
|
+
return {
|
|
9584
|
+
message: typeof oe === "function" ? oe() : oe,
|
|
9585
|
+
fieldValue,
|
|
9586
|
+
field: oe.field || rule.fullField
|
|
9587
|
+
};
|
|
9588
|
+
};
|
|
9589
|
+
}
|
|
9590
|
+
function deepMerge(target, source) {
|
|
9591
|
+
if (source) {
|
|
9592
|
+
for (var s in source) {
|
|
9593
|
+
if (source.hasOwnProperty(s)) {
|
|
9594
|
+
var value = source[s];
|
|
9595
|
+
if (typeof value === "object" && typeof target[s] === "object") {
|
|
9596
|
+
target[s] = _extends({}, target[s], value);
|
|
9597
|
+
} else {
|
|
9598
|
+
target[s] = value;
|
|
9599
|
+
}
|
|
9600
|
+
}
|
|
9601
|
+
}
|
|
9602
|
+
}
|
|
9603
|
+
return target;
|
|
9604
|
+
}
|
|
9605
|
+
var required$1 = function required2(rule, value, source, errors, options, type2) {
|
|
9606
|
+
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type2 || rule.type))) {
|
|
9607
|
+
errors.push(format(options.messages.required, rule.fullField));
|
|
9608
|
+
}
|
|
9609
|
+
};
|
|
9610
|
+
var whitespace = function whitespace2(rule, value, source, errors, options) {
|
|
9611
|
+
if (/^\s+$/.test(value) || value === "") {
|
|
9612
|
+
errors.push(format(options.messages.whitespace, rule.fullField));
|
|
9613
|
+
}
|
|
9614
|
+
};
|
|
9615
|
+
var urlReg;
|
|
9616
|
+
var getUrlRegex = function() {
|
|
9617
|
+
if (urlReg) {
|
|
9618
|
+
return urlReg;
|
|
9619
|
+
}
|
|
9620
|
+
var word = "[a-fA-F\\d:]";
|
|
9621
|
+
var b2 = function b3(options) {
|
|
9622
|
+
return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
|
|
9623
|
+
};
|
|
9624
|
+
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}";
|
|
9625
|
+
var v6seg = "[a-fA-F\\d]{1,4}";
|
|
9626
|
+
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();
|
|
9627
|
+
var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
|
|
9628
|
+
var v4exact = new RegExp("^" + v4 + "$");
|
|
9629
|
+
var v6exact = new RegExp("^" + v6 + "$");
|
|
9630
|
+
var ip = function ip2(options) {
|
|
9631
|
+
return options && options.exact ? v46Exact : new RegExp("(?:" + b2(options) + v4 + b2(options) + ")|(?:" + b2(options) + v6 + b2(options) + ")", "g");
|
|
9632
|
+
};
|
|
9633
|
+
ip.v4 = function(options) {
|
|
9634
|
+
return options && options.exact ? v4exact : new RegExp("" + b2(options) + v4 + b2(options), "g");
|
|
9635
|
+
};
|
|
9636
|
+
ip.v6 = function(options) {
|
|
9637
|
+
return options && options.exact ? v6exact : new RegExp("" + b2(options) + v6 + b2(options), "g");
|
|
9638
|
+
};
|
|
9639
|
+
var protocol = "(?:(?:[a-z]+:)?//)";
|
|
9640
|
+
var auth = "(?:\\S+(?::\\S*)?@)?";
|
|
9641
|
+
var ipv4 = ip.v4().source;
|
|
9642
|
+
var ipv6 = ip.v6().source;
|
|
9643
|
+
var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
|
|
9644
|
+
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
|
|
9645
|
+
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
|
|
9646
|
+
var port = "(?::\\d{2,5})?";
|
|
9647
|
+
var path = '(?:[/?#][^\\s"]*)?';
|
|
9648
|
+
var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
|
|
9649
|
+
urlReg = new RegExp("(?:^" + regex + "$)", "i");
|
|
9650
|
+
return urlReg;
|
|
9651
|
+
};
|
|
9652
|
+
var pattern$2 = {
|
|
9653
|
+
// http://emailregex.com/
|
|
9654
|
+
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,}))$/,
|
|
9655
|
+
// url: new RegExp(
|
|
9656
|
+
// '^(?!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]*)?$',
|
|
9657
|
+
// 'i',
|
|
9658
|
+
// ),
|
|
9659
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
9660
|
+
};
|
|
9661
|
+
var types = {
|
|
9662
|
+
integer: function integer2(value) {
|
|
9663
|
+
return types.number(value) && parseInt(value, 10) === value;
|
|
9664
|
+
},
|
|
9665
|
+
"float": function float(value) {
|
|
9666
|
+
return types.number(value) && !types.integer(value);
|
|
9667
|
+
},
|
|
9668
|
+
array: function array2(value) {
|
|
9669
|
+
return Array.isArray(value);
|
|
9670
|
+
},
|
|
9671
|
+
regexp: function regexp2(value) {
|
|
9672
|
+
if (value instanceof RegExp) {
|
|
9673
|
+
return true;
|
|
9674
|
+
}
|
|
9675
|
+
try {
|
|
9676
|
+
return !!new RegExp(value);
|
|
9677
|
+
} catch (e) {
|
|
9678
|
+
return false;
|
|
9679
|
+
}
|
|
9680
|
+
},
|
|
9681
|
+
date: function date2(value) {
|
|
9682
|
+
return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
|
|
9683
|
+
},
|
|
9684
|
+
number: function number2(value) {
|
|
9685
|
+
if (isNaN(value)) {
|
|
9686
|
+
return false;
|
|
9687
|
+
}
|
|
9688
|
+
return typeof value === "number";
|
|
9689
|
+
},
|
|
9690
|
+
object: function object2(value) {
|
|
9691
|
+
return typeof value === "object" && !types.array(value);
|
|
9692
|
+
},
|
|
9693
|
+
method: function method2(value) {
|
|
9694
|
+
return typeof value === "function";
|
|
9695
|
+
},
|
|
9696
|
+
email: function email(value) {
|
|
9697
|
+
return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
|
|
9698
|
+
},
|
|
9699
|
+
url: function url(value) {
|
|
9700
|
+
return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
|
|
9701
|
+
},
|
|
9702
|
+
hex: function hex(value) {
|
|
9703
|
+
return typeof value === "string" && !!value.match(pattern$2.hex);
|
|
9704
|
+
}
|
|
9705
|
+
};
|
|
9706
|
+
var type$1 = function type2(rule, value, source, errors, options) {
|
|
9707
|
+
if (rule.required && value === void 0) {
|
|
9708
|
+
required$1(rule, value, source, errors, options);
|
|
9709
|
+
return;
|
|
9710
|
+
}
|
|
9711
|
+
var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
|
|
9712
|
+
var ruleType = rule.type;
|
|
9713
|
+
if (custom.indexOf(ruleType) > -1) {
|
|
9714
|
+
if (!types[ruleType](value)) {
|
|
9715
|
+
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
9716
|
+
}
|
|
9717
|
+
} else if (ruleType && typeof value !== rule.type) {
|
|
9718
|
+
errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
|
|
9719
|
+
}
|
|
9720
|
+
};
|
|
9721
|
+
var range = function range2(rule, value, source, errors, options) {
|
|
9722
|
+
var len = typeof rule.len === "number";
|
|
9723
|
+
var min = typeof rule.min === "number";
|
|
9724
|
+
var max = typeof rule.max === "number";
|
|
9725
|
+
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
9726
|
+
var val = value;
|
|
9727
|
+
var key = null;
|
|
9728
|
+
var num = typeof value === "number";
|
|
9729
|
+
var str = typeof value === "string";
|
|
9730
|
+
var arr = Array.isArray(value);
|
|
9731
|
+
if (num) {
|
|
9732
|
+
key = "number";
|
|
9733
|
+
} else if (str) {
|
|
9734
|
+
key = "string";
|
|
9735
|
+
} else if (arr) {
|
|
9736
|
+
key = "array";
|
|
9737
|
+
}
|
|
9738
|
+
if (!key) {
|
|
9739
|
+
return false;
|
|
9740
|
+
}
|
|
9741
|
+
if (arr) {
|
|
9742
|
+
val = value.length;
|
|
9743
|
+
}
|
|
9744
|
+
if (str) {
|
|
9745
|
+
val = value.replace(spRegexp, "_").length;
|
|
9746
|
+
}
|
|
9747
|
+
if (len) {
|
|
9748
|
+
if (val !== rule.len) {
|
|
9749
|
+
errors.push(format(options.messages[key].len, rule.fullField, rule.len));
|
|
9750
|
+
}
|
|
9751
|
+
} else if (min && !max && val < rule.min) {
|
|
9752
|
+
errors.push(format(options.messages[key].min, rule.fullField, rule.min));
|
|
9753
|
+
} else if (max && !min && val > rule.max) {
|
|
9754
|
+
errors.push(format(options.messages[key].max, rule.fullField, rule.max));
|
|
9755
|
+
} else if (min && max && (val < rule.min || val > rule.max)) {
|
|
9756
|
+
errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
|
|
9757
|
+
}
|
|
9758
|
+
};
|
|
9759
|
+
var ENUM$1 = "enum";
|
|
9760
|
+
var enumerable$1 = function enumerable2(rule, value, source, errors, options) {
|
|
9761
|
+
rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
|
|
9762
|
+
if (rule[ENUM$1].indexOf(value) === -1) {
|
|
9763
|
+
errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
|
|
9764
|
+
}
|
|
9765
|
+
};
|
|
9766
|
+
var pattern$1 = function pattern2(rule, value, source, errors, options) {
|
|
9767
|
+
if (rule.pattern) {
|
|
9768
|
+
if (rule.pattern instanceof RegExp) {
|
|
9769
|
+
rule.pattern.lastIndex = 0;
|
|
9770
|
+
if (!rule.pattern.test(value)) {
|
|
9771
|
+
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
9772
|
+
}
|
|
9773
|
+
} else if (typeof rule.pattern === "string") {
|
|
9774
|
+
var _pattern = new RegExp(rule.pattern);
|
|
9775
|
+
if (!_pattern.test(value)) {
|
|
9776
|
+
errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
9777
|
+
}
|
|
9778
|
+
}
|
|
9779
|
+
}
|
|
9780
|
+
};
|
|
9781
|
+
var rules = {
|
|
9782
|
+
required: required$1,
|
|
9783
|
+
whitespace,
|
|
9784
|
+
type: type$1,
|
|
9785
|
+
range,
|
|
9786
|
+
"enum": enumerable$1,
|
|
9787
|
+
pattern: pattern$1
|
|
9788
|
+
};
|
|
9789
|
+
var string = function string2(rule, value, callback, source, options) {
|
|
9790
|
+
var errors = [];
|
|
9791
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9792
|
+
if (validate) {
|
|
9793
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
9794
|
+
return callback();
|
|
9795
|
+
}
|
|
9796
|
+
rules.required(rule, value, source, errors, options, "string");
|
|
9797
|
+
if (!isEmptyValue(value, "string")) {
|
|
9798
|
+
rules.type(rule, value, source, errors, options);
|
|
9799
|
+
rules.range(rule, value, source, errors, options);
|
|
9800
|
+
rules.pattern(rule, value, source, errors, options);
|
|
9801
|
+
if (rule.whitespace === true) {
|
|
9802
|
+
rules.whitespace(rule, value, source, errors, options);
|
|
9803
|
+
}
|
|
9804
|
+
}
|
|
9805
|
+
}
|
|
9806
|
+
callback(errors);
|
|
9807
|
+
};
|
|
9808
|
+
var method = function method2(rule, value, callback, source, options) {
|
|
9809
|
+
var errors = [];
|
|
9810
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9811
|
+
if (validate) {
|
|
9812
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9813
|
+
return callback();
|
|
9814
|
+
}
|
|
9815
|
+
rules.required(rule, value, source, errors, options);
|
|
9816
|
+
if (value !== void 0) {
|
|
9817
|
+
rules.type(rule, value, source, errors, options);
|
|
9818
|
+
}
|
|
9819
|
+
}
|
|
9820
|
+
callback(errors);
|
|
9821
|
+
};
|
|
9822
|
+
var number = function number2(rule, value, callback, source, options) {
|
|
9823
|
+
var errors = [];
|
|
9824
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9825
|
+
if (validate) {
|
|
9826
|
+
if (value === "") {
|
|
9827
|
+
value = void 0;
|
|
9828
|
+
}
|
|
9829
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9830
|
+
return callback();
|
|
9831
|
+
}
|
|
9832
|
+
rules.required(rule, value, source, errors, options);
|
|
9833
|
+
if (value !== void 0) {
|
|
9834
|
+
rules.type(rule, value, source, errors, options);
|
|
9835
|
+
rules.range(rule, value, source, errors, options);
|
|
9836
|
+
}
|
|
9837
|
+
}
|
|
9838
|
+
callback(errors);
|
|
9839
|
+
};
|
|
9840
|
+
var _boolean = function _boolean2(rule, value, callback, source, options) {
|
|
9841
|
+
var errors = [];
|
|
9842
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9843
|
+
if (validate) {
|
|
9844
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9845
|
+
return callback();
|
|
9846
|
+
}
|
|
9847
|
+
rules.required(rule, value, source, errors, options);
|
|
9848
|
+
if (value !== void 0) {
|
|
9849
|
+
rules.type(rule, value, source, errors, options);
|
|
9850
|
+
}
|
|
9851
|
+
}
|
|
9852
|
+
callback(errors);
|
|
9853
|
+
};
|
|
9854
|
+
var regexp = function regexp2(rule, value, callback, source, options) {
|
|
9855
|
+
var errors = [];
|
|
9856
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9857
|
+
if (validate) {
|
|
9858
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9859
|
+
return callback();
|
|
9860
|
+
}
|
|
9861
|
+
rules.required(rule, value, source, errors, options);
|
|
9862
|
+
if (!isEmptyValue(value)) {
|
|
9863
|
+
rules.type(rule, value, source, errors, options);
|
|
9864
|
+
}
|
|
9865
|
+
}
|
|
9866
|
+
callback(errors);
|
|
9867
|
+
};
|
|
9868
|
+
var integer = function integer2(rule, value, callback, source, options) {
|
|
9869
|
+
var errors = [];
|
|
9870
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9871
|
+
if (validate) {
|
|
9872
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9873
|
+
return callback();
|
|
9874
|
+
}
|
|
9875
|
+
rules.required(rule, value, source, errors, options);
|
|
9876
|
+
if (value !== void 0) {
|
|
9877
|
+
rules.type(rule, value, source, errors, options);
|
|
9878
|
+
rules.range(rule, value, source, errors, options);
|
|
9879
|
+
}
|
|
9880
|
+
}
|
|
9881
|
+
callback(errors);
|
|
9882
|
+
};
|
|
9883
|
+
var floatFn = function floatFn2(rule, value, callback, source, options) {
|
|
9884
|
+
var errors = [];
|
|
9885
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9886
|
+
if (validate) {
|
|
9887
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9888
|
+
return callback();
|
|
9889
|
+
}
|
|
9890
|
+
rules.required(rule, value, source, errors, options);
|
|
9891
|
+
if (value !== void 0) {
|
|
9892
|
+
rules.type(rule, value, source, errors, options);
|
|
9893
|
+
rules.range(rule, value, source, errors, options);
|
|
9894
|
+
}
|
|
9895
|
+
}
|
|
9896
|
+
callback(errors);
|
|
9897
|
+
};
|
|
9898
|
+
var array = function array2(rule, value, callback, source, options) {
|
|
9899
|
+
var errors = [];
|
|
9900
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9901
|
+
if (validate) {
|
|
9902
|
+
if ((value === void 0 || value === null) && !rule.required) {
|
|
9903
|
+
return callback();
|
|
9904
|
+
}
|
|
9905
|
+
rules.required(rule, value, source, errors, options, "array");
|
|
9906
|
+
if (value !== void 0 && value !== null) {
|
|
9907
|
+
rules.type(rule, value, source, errors, options);
|
|
9908
|
+
rules.range(rule, value, source, errors, options);
|
|
9909
|
+
}
|
|
9910
|
+
}
|
|
9911
|
+
callback(errors);
|
|
9912
|
+
};
|
|
9913
|
+
var object = function object2(rule, value, callback, source, options) {
|
|
9914
|
+
var errors = [];
|
|
9915
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9916
|
+
if (validate) {
|
|
9917
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9918
|
+
return callback();
|
|
9919
|
+
}
|
|
9920
|
+
rules.required(rule, value, source, errors, options);
|
|
9921
|
+
if (value !== void 0) {
|
|
9922
|
+
rules.type(rule, value, source, errors, options);
|
|
9923
|
+
}
|
|
9924
|
+
}
|
|
9925
|
+
callback(errors);
|
|
9926
|
+
};
|
|
9927
|
+
var ENUM = "enum";
|
|
9928
|
+
var enumerable = function enumerable2(rule, value, callback, source, options) {
|
|
9929
|
+
var errors = [];
|
|
9930
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9931
|
+
if (validate) {
|
|
9932
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
9933
|
+
return callback();
|
|
9934
|
+
}
|
|
9935
|
+
rules.required(rule, value, source, errors, options);
|
|
9936
|
+
if (value !== void 0) {
|
|
9937
|
+
rules[ENUM](rule, value, source, errors, options);
|
|
9938
|
+
}
|
|
9939
|
+
}
|
|
9940
|
+
callback(errors);
|
|
9941
|
+
};
|
|
9942
|
+
var pattern = function pattern2(rule, value, callback, source, options) {
|
|
9943
|
+
var errors = [];
|
|
9944
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9945
|
+
if (validate) {
|
|
9946
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
9947
|
+
return callback();
|
|
9948
|
+
}
|
|
9949
|
+
rules.required(rule, value, source, errors, options);
|
|
9950
|
+
if (!isEmptyValue(value, "string")) {
|
|
9951
|
+
rules.pattern(rule, value, source, errors, options);
|
|
9952
|
+
}
|
|
9953
|
+
}
|
|
9954
|
+
callback(errors);
|
|
9955
|
+
};
|
|
9956
|
+
var date = function date2(rule, value, callback, source, options) {
|
|
9957
|
+
var errors = [];
|
|
9958
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9959
|
+
if (validate) {
|
|
9960
|
+
if (isEmptyValue(value, "date") && !rule.required) {
|
|
9961
|
+
return callback();
|
|
9962
|
+
}
|
|
9963
|
+
rules.required(rule, value, source, errors, options);
|
|
9964
|
+
if (!isEmptyValue(value, "date")) {
|
|
9965
|
+
var dateObject;
|
|
9966
|
+
if (value instanceof Date) {
|
|
9967
|
+
dateObject = value;
|
|
9968
|
+
} else {
|
|
9969
|
+
dateObject = new Date(value);
|
|
9970
|
+
}
|
|
9971
|
+
rules.type(rule, dateObject, source, errors, options);
|
|
9972
|
+
if (dateObject) {
|
|
9973
|
+
rules.range(rule, dateObject.getTime(), source, errors, options);
|
|
9974
|
+
}
|
|
9975
|
+
}
|
|
9976
|
+
}
|
|
9977
|
+
callback(errors);
|
|
9978
|
+
};
|
|
9979
|
+
var required = function required2(rule, value, callback, source, options) {
|
|
9980
|
+
var errors = [];
|
|
9981
|
+
var type2 = Array.isArray(value) ? "array" : typeof value;
|
|
9982
|
+
rules.required(rule, value, source, errors, options, type2);
|
|
9983
|
+
callback(errors);
|
|
9984
|
+
};
|
|
9985
|
+
var type = function type2(rule, value, callback, source, options) {
|
|
9986
|
+
var ruleType = rule.type;
|
|
9987
|
+
var errors = [];
|
|
9988
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
9989
|
+
if (validate) {
|
|
9990
|
+
if (isEmptyValue(value, ruleType) && !rule.required) {
|
|
9991
|
+
return callback();
|
|
9992
|
+
}
|
|
9993
|
+
rules.required(rule, value, source, errors, options, ruleType);
|
|
9994
|
+
if (!isEmptyValue(value, ruleType)) {
|
|
9995
|
+
rules.type(rule, value, source, errors, options);
|
|
9996
|
+
}
|
|
9997
|
+
}
|
|
9998
|
+
callback(errors);
|
|
9999
|
+
};
|
|
10000
|
+
var any = function any2(rule, value, callback, source, options) {
|
|
10001
|
+
var errors = [];
|
|
10002
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
10003
|
+
if (validate) {
|
|
10004
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
10005
|
+
return callback();
|
|
10006
|
+
}
|
|
10007
|
+
rules.required(rule, value, source, errors, options);
|
|
10008
|
+
}
|
|
10009
|
+
callback(errors);
|
|
10010
|
+
};
|
|
10011
|
+
var validators = {
|
|
10012
|
+
string,
|
|
10013
|
+
method,
|
|
10014
|
+
number,
|
|
10015
|
+
"boolean": _boolean,
|
|
10016
|
+
regexp,
|
|
10017
|
+
integer,
|
|
10018
|
+
"float": floatFn,
|
|
10019
|
+
array,
|
|
10020
|
+
object,
|
|
10021
|
+
"enum": enumerable,
|
|
10022
|
+
pattern,
|
|
10023
|
+
date,
|
|
10024
|
+
url: type,
|
|
10025
|
+
hex: type,
|
|
10026
|
+
email: type,
|
|
10027
|
+
required,
|
|
10028
|
+
any
|
|
10029
|
+
};
|
|
10030
|
+
function newMessages() {
|
|
10031
|
+
return {
|
|
10032
|
+
"default": "Validation error on field %s",
|
|
10033
|
+
required: "%s is required",
|
|
10034
|
+
"enum": "%s must be one of %s",
|
|
10035
|
+
whitespace: "%s cannot be empty",
|
|
10036
|
+
date: {
|
|
10037
|
+
format: "%s date %s is invalid for format %s",
|
|
10038
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
10039
|
+
invalid: "%s date %s is invalid"
|
|
10040
|
+
},
|
|
10041
|
+
types: {
|
|
10042
|
+
string: "%s is not a %s",
|
|
10043
|
+
method: "%s is not a %s (function)",
|
|
10044
|
+
array: "%s is not an %s",
|
|
10045
|
+
object: "%s is not an %s",
|
|
10046
|
+
number: "%s is not a %s",
|
|
10047
|
+
date: "%s is not a %s",
|
|
10048
|
+
"boolean": "%s is not a %s",
|
|
10049
|
+
integer: "%s is not an %s",
|
|
10050
|
+
"float": "%s is not a %s",
|
|
10051
|
+
regexp: "%s is not a valid %s",
|
|
10052
|
+
email: "%s is not a valid %s",
|
|
10053
|
+
url: "%s is not a valid %s",
|
|
10054
|
+
hex: "%s is not a valid %s"
|
|
10055
|
+
},
|
|
10056
|
+
string: {
|
|
10057
|
+
len: "%s must be exactly %s characters",
|
|
10058
|
+
min: "%s must be at least %s characters",
|
|
10059
|
+
max: "%s cannot be longer than %s characters",
|
|
10060
|
+
range: "%s must be between %s and %s characters"
|
|
10061
|
+
},
|
|
10062
|
+
number: {
|
|
10063
|
+
len: "%s must equal %s",
|
|
10064
|
+
min: "%s cannot be less than %s",
|
|
10065
|
+
max: "%s cannot be greater than %s",
|
|
10066
|
+
range: "%s must be between %s and %s"
|
|
10067
|
+
},
|
|
10068
|
+
array: {
|
|
10069
|
+
len: "%s must be exactly %s in length",
|
|
10070
|
+
min: "%s cannot be less than %s in length",
|
|
10071
|
+
max: "%s cannot be greater than %s in length",
|
|
10072
|
+
range: "%s must be between %s and %s in length"
|
|
10073
|
+
},
|
|
10074
|
+
pattern: {
|
|
10075
|
+
mismatch: "%s value %s does not match pattern %s"
|
|
10076
|
+
},
|
|
10077
|
+
clone: function clone() {
|
|
10078
|
+
var cloned = JSON.parse(JSON.stringify(this));
|
|
10079
|
+
cloned.clone = this.clone;
|
|
10080
|
+
return cloned;
|
|
10081
|
+
}
|
|
10082
|
+
};
|
|
10083
|
+
}
|
|
10084
|
+
var messages = newMessages();
|
|
10085
|
+
var Schema = /* @__PURE__ */ function() {
|
|
10086
|
+
function Schema2(descriptor) {
|
|
10087
|
+
this.rules = null;
|
|
10088
|
+
this._messages = messages;
|
|
10089
|
+
this.define(descriptor);
|
|
10090
|
+
}
|
|
10091
|
+
var _proto = Schema2.prototype;
|
|
10092
|
+
_proto.define = function define2(rules2) {
|
|
10093
|
+
var _this = this;
|
|
10094
|
+
if (!rules2) {
|
|
10095
|
+
throw new Error("Cannot configure a schema with no rules");
|
|
10096
|
+
}
|
|
10097
|
+
if (typeof rules2 !== "object" || Array.isArray(rules2)) {
|
|
10098
|
+
throw new Error("Rules must be an object");
|
|
10099
|
+
}
|
|
10100
|
+
this.rules = {};
|
|
10101
|
+
Object.keys(rules2).forEach(function(name) {
|
|
10102
|
+
var item = rules2[name];
|
|
10103
|
+
_this.rules[name] = Array.isArray(item) ? item : [item];
|
|
10104
|
+
});
|
|
10105
|
+
};
|
|
10106
|
+
_proto.messages = function messages2(_messages) {
|
|
10107
|
+
if (_messages) {
|
|
10108
|
+
this._messages = deepMerge(newMessages(), _messages);
|
|
10109
|
+
}
|
|
10110
|
+
return this._messages;
|
|
10111
|
+
};
|
|
10112
|
+
_proto.validate = function validate(source_, o, oc) {
|
|
10113
|
+
var _this2 = this;
|
|
10114
|
+
if (o === void 0) {
|
|
10115
|
+
o = {};
|
|
10116
|
+
}
|
|
10117
|
+
if (oc === void 0) {
|
|
10118
|
+
oc = function oc2() {
|
|
10119
|
+
};
|
|
10120
|
+
}
|
|
10121
|
+
var source = source_;
|
|
10122
|
+
var options = o;
|
|
10123
|
+
var callback = oc;
|
|
10124
|
+
if (typeof options === "function") {
|
|
10125
|
+
callback = options;
|
|
10126
|
+
options = {};
|
|
10127
|
+
}
|
|
10128
|
+
if (!this.rules || Object.keys(this.rules).length === 0) {
|
|
10129
|
+
if (callback) {
|
|
10130
|
+
callback(null, source);
|
|
10131
|
+
}
|
|
10132
|
+
return Promise.resolve(source);
|
|
10133
|
+
}
|
|
10134
|
+
function complete(results) {
|
|
10135
|
+
var errors = [];
|
|
10136
|
+
var fields = {};
|
|
10137
|
+
function add(e) {
|
|
10138
|
+
if (Array.isArray(e)) {
|
|
10139
|
+
var _errors;
|
|
10140
|
+
errors = (_errors = errors).concat.apply(_errors, e);
|
|
10141
|
+
} else {
|
|
10142
|
+
errors.push(e);
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
10145
|
+
for (var i = 0; i < results.length; i++) {
|
|
10146
|
+
add(results[i]);
|
|
10147
|
+
}
|
|
10148
|
+
if (!errors.length) {
|
|
10149
|
+
callback(null, source);
|
|
10150
|
+
} else {
|
|
10151
|
+
fields = convertFieldsError(errors);
|
|
10152
|
+
callback(errors, fields);
|
|
10153
|
+
}
|
|
10154
|
+
}
|
|
10155
|
+
if (options.messages) {
|
|
10156
|
+
var messages$1 = this.messages();
|
|
10157
|
+
if (messages$1 === messages) {
|
|
10158
|
+
messages$1 = newMessages();
|
|
10159
|
+
}
|
|
10160
|
+
deepMerge(messages$1, options.messages);
|
|
10161
|
+
options.messages = messages$1;
|
|
10162
|
+
} else {
|
|
10163
|
+
options.messages = this.messages();
|
|
10164
|
+
}
|
|
10165
|
+
var series = {};
|
|
10166
|
+
var keys = options.keys || Object.keys(this.rules);
|
|
10167
|
+
keys.forEach(function(z) {
|
|
10168
|
+
var arr = _this2.rules[z];
|
|
10169
|
+
var value = source[z];
|
|
10170
|
+
arr.forEach(function(r2) {
|
|
10171
|
+
var rule = r2;
|
|
10172
|
+
if (typeof rule.transform === "function") {
|
|
10173
|
+
if (source === source_) {
|
|
10174
|
+
source = _extends({}, source);
|
|
10175
|
+
}
|
|
10176
|
+
value = source[z] = rule.transform(value);
|
|
10177
|
+
}
|
|
10178
|
+
if (typeof rule === "function") {
|
|
10179
|
+
rule = {
|
|
10180
|
+
validator: rule
|
|
10181
|
+
};
|
|
10182
|
+
} else {
|
|
10183
|
+
rule = _extends({}, rule);
|
|
10184
|
+
}
|
|
10185
|
+
rule.validator = _this2.getValidationMethod(rule);
|
|
10186
|
+
if (!rule.validator) {
|
|
10187
|
+
return;
|
|
10188
|
+
}
|
|
10189
|
+
rule.field = z;
|
|
10190
|
+
rule.fullField = rule.fullField || z;
|
|
10191
|
+
rule.type = _this2.getType(rule);
|
|
10192
|
+
series[z] = series[z] || [];
|
|
10193
|
+
series[z].push({
|
|
10194
|
+
rule,
|
|
10195
|
+
value,
|
|
10196
|
+
source,
|
|
10197
|
+
field: z
|
|
10198
|
+
});
|
|
10199
|
+
});
|
|
10200
|
+
});
|
|
10201
|
+
var errorFields = {};
|
|
10202
|
+
return asyncMap(series, options, function(data, doIt) {
|
|
10203
|
+
var rule = data.rule;
|
|
10204
|
+
var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
|
|
10205
|
+
deep = deep && (rule.required || !rule.required && data.value);
|
|
10206
|
+
rule.field = data.field;
|
|
10207
|
+
function addFullField(key, schema) {
|
|
10208
|
+
return _extends({}, schema, {
|
|
10209
|
+
fullField: rule.fullField + "." + key,
|
|
10210
|
+
fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
|
|
10211
|
+
});
|
|
10212
|
+
}
|
|
10213
|
+
function cb(e) {
|
|
10214
|
+
if (e === void 0) {
|
|
10215
|
+
e = [];
|
|
10216
|
+
}
|
|
10217
|
+
var errorList = Array.isArray(e) ? e : [e];
|
|
10218
|
+
if (!options.suppressWarning && errorList.length) {
|
|
10219
|
+
Schema2.warning("async-validator:", errorList);
|
|
10220
|
+
}
|
|
10221
|
+
if (errorList.length && rule.message !== void 0) {
|
|
10222
|
+
errorList = [].concat(rule.message);
|
|
10223
|
+
}
|
|
10224
|
+
var filledErrors = errorList.map(complementError(rule, source));
|
|
10225
|
+
if (options.first && filledErrors.length) {
|
|
10226
|
+
errorFields[rule.field] = 1;
|
|
10227
|
+
return doIt(filledErrors);
|
|
10228
|
+
}
|
|
10229
|
+
if (!deep) {
|
|
10230
|
+
doIt(filledErrors);
|
|
10231
|
+
} else {
|
|
10232
|
+
if (rule.required && !data.value) {
|
|
10233
|
+
if (rule.message !== void 0) {
|
|
10234
|
+
filledErrors = [].concat(rule.message).map(complementError(rule, source));
|
|
10235
|
+
} else if (options.error) {
|
|
10236
|
+
filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
|
|
10237
|
+
}
|
|
10238
|
+
return doIt(filledErrors);
|
|
10239
|
+
}
|
|
10240
|
+
var fieldsSchema = {};
|
|
10241
|
+
if (rule.defaultField) {
|
|
10242
|
+
Object.keys(data.value).map(function(key) {
|
|
10243
|
+
fieldsSchema[key] = rule.defaultField;
|
|
10244
|
+
});
|
|
10245
|
+
}
|
|
10246
|
+
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
|
|
10247
|
+
var paredFieldsSchema = {};
|
|
10248
|
+
Object.keys(fieldsSchema).forEach(function(field) {
|
|
10249
|
+
var fieldSchema = fieldsSchema[field];
|
|
10250
|
+
var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
|
|
10251
|
+
paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
|
|
10252
|
+
});
|
|
10253
|
+
var schema = new Schema2(paredFieldsSchema);
|
|
10254
|
+
schema.messages(options.messages);
|
|
10255
|
+
if (data.rule.options) {
|
|
10256
|
+
data.rule.options.messages = options.messages;
|
|
10257
|
+
data.rule.options.error = options.error;
|
|
10258
|
+
}
|
|
10259
|
+
schema.validate(data.value, data.rule.options || options, function(errs) {
|
|
10260
|
+
var finalErrors = [];
|
|
10261
|
+
if (filledErrors && filledErrors.length) {
|
|
10262
|
+
finalErrors.push.apply(finalErrors, filledErrors);
|
|
10263
|
+
}
|
|
10264
|
+
if (errs && errs.length) {
|
|
10265
|
+
finalErrors.push.apply(finalErrors, errs);
|
|
10266
|
+
}
|
|
10267
|
+
doIt(finalErrors.length ? finalErrors : null);
|
|
10268
|
+
});
|
|
10269
|
+
}
|
|
10270
|
+
}
|
|
10271
|
+
var res;
|
|
10272
|
+
if (rule.asyncValidator) {
|
|
10273
|
+
res = rule.asyncValidator(rule, data.value, cb, data.source, options);
|
|
10274
|
+
} else if (rule.validator) {
|
|
10275
|
+
try {
|
|
10276
|
+
res = rule.validator(rule, data.value, cb, data.source, options);
|
|
10277
|
+
} catch (error) {
|
|
10278
|
+
console.error == null ? void 0 : console.error(error);
|
|
10279
|
+
if (!options.suppressValidatorError) {
|
|
10280
|
+
setTimeout(function() {
|
|
10281
|
+
throw error;
|
|
10282
|
+
}, 0);
|
|
10283
|
+
}
|
|
10284
|
+
cb(error.message);
|
|
10285
|
+
}
|
|
10286
|
+
if (res === true) {
|
|
10287
|
+
cb();
|
|
10288
|
+
} else if (res === false) {
|
|
10289
|
+
cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
|
|
10290
|
+
} else if (res instanceof Array) {
|
|
10291
|
+
cb(res);
|
|
10292
|
+
} else if (res instanceof Error) {
|
|
10293
|
+
cb(res.message);
|
|
10294
|
+
}
|
|
10295
|
+
}
|
|
10296
|
+
if (res && res.then) {
|
|
10297
|
+
res.then(function() {
|
|
10298
|
+
return cb();
|
|
10299
|
+
}, function(e) {
|
|
10300
|
+
return cb(e);
|
|
10301
|
+
});
|
|
10302
|
+
}
|
|
10303
|
+
}, function(results) {
|
|
10304
|
+
complete(results);
|
|
10305
|
+
}, source);
|
|
10306
|
+
};
|
|
10307
|
+
_proto.getType = function getType(rule) {
|
|
10308
|
+
if (rule.type === void 0 && rule.pattern instanceof RegExp) {
|
|
10309
|
+
rule.type = "pattern";
|
|
10310
|
+
}
|
|
10311
|
+
if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
|
|
10312
|
+
throw new Error(format("Unknown rule type %s", rule.type));
|
|
10313
|
+
}
|
|
10314
|
+
return rule.type || "string";
|
|
10315
|
+
};
|
|
10316
|
+
_proto.getValidationMethod = function getValidationMethod(rule) {
|
|
10317
|
+
if (typeof rule.validator === "function") {
|
|
10318
|
+
return rule.validator;
|
|
10319
|
+
}
|
|
10320
|
+
var keys = Object.keys(rule);
|
|
10321
|
+
var messageIndex = keys.indexOf("message");
|
|
10322
|
+
if (messageIndex !== -1) {
|
|
10323
|
+
keys.splice(messageIndex, 1);
|
|
10324
|
+
}
|
|
10325
|
+
if (keys.length === 1 && keys[0] === "required") {
|
|
10326
|
+
return validators.required;
|
|
10327
|
+
}
|
|
10328
|
+
return validators[this.getType(rule)] || void 0;
|
|
10329
|
+
};
|
|
10330
|
+
return Schema2;
|
|
10331
|
+
}();
|
|
10332
|
+
Schema.register = function register(type2, validator) {
|
|
10333
|
+
if (typeof validator !== "function") {
|
|
10334
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
10335
|
+
}
|
|
10336
|
+
validators[type2] = validator;
|
|
10337
|
+
};
|
|
10338
|
+
Schema.warning = warning;
|
|
10339
|
+
Schema.messages = messages;
|
|
10340
|
+
Schema.validators = validators;
|
|
10341
|
+
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
|
10342
|
+
class FormStore {
|
|
10343
|
+
constructor() {
|
|
10344
|
+
// 初始化数据
|
|
10345
|
+
__publicField(this, "initialValues", {});
|
|
10346
|
+
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
10347
|
+
__publicField(this, "store", {});
|
|
10348
|
+
// 所有的组件实例
|
|
10349
|
+
__publicField(this, "fieldEntities", []);
|
|
10350
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
10351
|
+
__publicField(this, "callbacks", {});
|
|
10352
|
+
__publicField(this, "errors", []);
|
|
10353
|
+
/**
|
|
10354
|
+
* 注册组件实例
|
|
10355
|
+
* @param field
|
|
10356
|
+
*/
|
|
10357
|
+
__publicField(this, "registerField", (field) => {
|
|
10358
|
+
this.fieldEntities.push(field);
|
|
10359
|
+
return () => {
|
|
10360
|
+
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
10361
|
+
if (this.store) {
|
|
10362
|
+
delete this.store[field.props.name];
|
|
10363
|
+
}
|
|
10364
|
+
};
|
|
10365
|
+
});
|
|
10366
|
+
/**
|
|
10367
|
+
* 获取 formItem 的值
|
|
10368
|
+
* @param name
|
|
10369
|
+
*/
|
|
10370
|
+
__publicField(this, "getFieldValue", (name) => {
|
|
10371
|
+
var _a;
|
|
10372
|
+
return (_a = this.store) == null ? void 0 : _a[name];
|
|
10373
|
+
});
|
|
10374
|
+
/**
|
|
10375
|
+
* 设置 form 的初始值,之后在 reset 的时候使用
|
|
10376
|
+
* @param values
|
|
10377
|
+
* @param init
|
|
10378
|
+
*/
|
|
10379
|
+
__publicField(this, "setInitialValues", (values, init) => {
|
|
10380
|
+
if (init) {
|
|
10381
|
+
this.initialValues = values;
|
|
10382
|
+
this.store = values;
|
|
10383
|
+
}
|
|
10384
|
+
});
|
|
10385
|
+
/**
|
|
10386
|
+
* 存储组件数据
|
|
10387
|
+
* @param newStore { [name]: newValue }
|
|
10388
|
+
*/
|
|
10389
|
+
__publicField(this, "setFieldsValue", (newStore) => {
|
|
10390
|
+
this.store = {
|
|
10391
|
+
...this.store,
|
|
10392
|
+
...newStore
|
|
10393
|
+
};
|
|
10394
|
+
this.fieldEntities.forEach((enetity) => {
|
|
10395
|
+
const { name } = enetity.props;
|
|
10396
|
+
Object.keys(newStore).forEach((key) => {
|
|
10397
|
+
if (key === name) {
|
|
10398
|
+
enetity.onStoreChange("update");
|
|
10399
|
+
}
|
|
10400
|
+
});
|
|
10401
|
+
});
|
|
10402
|
+
});
|
|
10403
|
+
__publicField(this, "setCallback", (callback) => {
|
|
10404
|
+
this.callbacks = {
|
|
10405
|
+
...this.callbacks,
|
|
10406
|
+
...callback
|
|
10407
|
+
};
|
|
10408
|
+
});
|
|
10409
|
+
__publicField(this, "validate", () => {
|
|
10410
|
+
const err = [];
|
|
10411
|
+
this.errors.length = 0;
|
|
10412
|
+
this.fieldEntities.forEach((entity) => {
|
|
10413
|
+
var _a;
|
|
10414
|
+
const { name, rules: rules2 = [] } = entity.props;
|
|
10415
|
+
const descriptor = {};
|
|
10416
|
+
if (rules2.length) {
|
|
10417
|
+
if (rules2.length > 1) {
|
|
10418
|
+
descriptor[name] = [];
|
|
10419
|
+
rules2.forEach((v) => {
|
|
10420
|
+
descriptor[name].push(v);
|
|
10421
|
+
});
|
|
10422
|
+
} else {
|
|
10423
|
+
descriptor[name] = rules2[0];
|
|
10424
|
+
}
|
|
10425
|
+
}
|
|
10426
|
+
const validator = new Schema(descriptor);
|
|
10427
|
+
validator.messages();
|
|
10428
|
+
validator.validate({ [name]: (_a = this.store) == null ? void 0 : _a[name] }, (errors) => {
|
|
10429
|
+
if (errors) {
|
|
10430
|
+
err.push(...errors);
|
|
10431
|
+
this.errors.push(...errors);
|
|
10432
|
+
}
|
|
10433
|
+
entity.onStoreChange("validate");
|
|
10434
|
+
});
|
|
10435
|
+
});
|
|
10436
|
+
return err;
|
|
10437
|
+
});
|
|
10438
|
+
__publicField(this, "submit", () => {
|
|
10439
|
+
var _a, _b, _c, _d;
|
|
10440
|
+
const errors = this.validate();
|
|
10441
|
+
if (errors.length === 0) {
|
|
10442
|
+
(_b = (_a = this.callbacks).onFinish) == null ? void 0 : _b.call(_a, this.store);
|
|
10443
|
+
} else if (errors.length > 0) {
|
|
10444
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
|
|
10445
|
+
}
|
|
10446
|
+
});
|
|
10447
|
+
__publicField(this, "resetFields", () => {
|
|
10448
|
+
this.errors.length = 0;
|
|
10449
|
+
this.store = this.initialValues;
|
|
10450
|
+
this.fieldEntities.forEach((entity) => {
|
|
10451
|
+
entity.onStoreChange("reset");
|
|
10452
|
+
});
|
|
10453
|
+
});
|
|
10454
|
+
__publicField(this, "getForm", () => {
|
|
10455
|
+
return {
|
|
10456
|
+
setInitialValues: this.setInitialValues,
|
|
10457
|
+
setCallback: this.setCallback,
|
|
10458
|
+
registerField: this.registerField,
|
|
10459
|
+
getFieldValue: this.getFieldValue,
|
|
10460
|
+
setFieldsValue: this.setFieldsValue,
|
|
10461
|
+
resetFields: this.resetFields,
|
|
10462
|
+
submit: this.submit,
|
|
10463
|
+
store: this.store,
|
|
10464
|
+
errors: this.errors,
|
|
10465
|
+
fieldEntities: this.fieldEntities
|
|
9440
10466
|
};
|
|
9441
10467
|
});
|
|
9442
10468
|
this.callbacks = {
|
|
9443
|
-
onFinish: (
|
|
10469
|
+
onFinish: () => {
|
|
9444
10470
|
},
|
|
9445
10471
|
onFinishFailed: () => {
|
|
9446
10472
|
}
|
|
@@ -9459,60 +10485,209 @@ var __publicField = (obj, key, value) => {
|
|
|
9459
10485
|
}
|
|
9460
10486
|
return [formRef.current];
|
|
9461
10487
|
};
|
|
10488
|
+
function isForwardRefComponent(component) {
|
|
10489
|
+
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
10490
|
+
React.forwardRef(
|
|
10491
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10492
|
+
// @ts-ignore
|
|
10493
|
+
() => {
|
|
10494
|
+
}
|
|
10495
|
+
).$$typeof === component.type.$$typeof;
|
|
10496
|
+
}
|
|
10497
|
+
const defaultProps$W = {
|
|
10498
|
+
...ComponentDefaults,
|
|
10499
|
+
required: false,
|
|
10500
|
+
name: "",
|
|
10501
|
+
label: "",
|
|
10502
|
+
rules: [{ required: false, message: "" }],
|
|
10503
|
+
errorMessageAlign: "left"
|
|
10504
|
+
};
|
|
10505
|
+
class FormItem extends React.Component {
|
|
10506
|
+
constructor(props) {
|
|
10507
|
+
super(props);
|
|
10508
|
+
__publicField(this, "cancelRegister");
|
|
10509
|
+
__publicField(this, "componentRef");
|
|
10510
|
+
// children添加value属性和onChange事件
|
|
10511
|
+
__publicField(this, "getControlled", (children) => {
|
|
10512
|
+
var _a;
|
|
10513
|
+
const { setFieldsValue, getFieldValue } = this.context;
|
|
10514
|
+
const { name } = this.props;
|
|
10515
|
+
if ((_a = children == null ? void 0 : children.props) == null ? void 0 : _a.defaultValue) {
|
|
10516
|
+
console.warn("通过 initialValue 设置初始值");
|
|
10517
|
+
}
|
|
10518
|
+
const controlled = {
|
|
10519
|
+
...children.props,
|
|
10520
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) || this.props.initialValue,
|
|
10521
|
+
[this.props.trigger || "onChange"]: (...args) => {
|
|
10522
|
+
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
10523
|
+
if (originOnChange) {
|
|
10524
|
+
originOnChange(...args);
|
|
10525
|
+
}
|
|
10526
|
+
let [next] = args;
|
|
10527
|
+
if (this.props.getValueFromEvent) {
|
|
10528
|
+
next = this.props.getValueFromEvent(...args);
|
|
10529
|
+
}
|
|
10530
|
+
setFieldsValue({ [name]: next });
|
|
10531
|
+
}
|
|
10532
|
+
};
|
|
10533
|
+
if (isForwardRefComponent(children)) {
|
|
10534
|
+
controlled.ref = (componentInstance) => {
|
|
10535
|
+
const originRef = children.ref;
|
|
10536
|
+
if (originRef) {
|
|
10537
|
+
if (typeof originRef === "function") {
|
|
10538
|
+
originRef(componentInstance);
|
|
10539
|
+
}
|
|
10540
|
+
if ("current" in originRef) {
|
|
10541
|
+
originRef.current = componentInstance;
|
|
10542
|
+
}
|
|
10543
|
+
}
|
|
10544
|
+
this.componentRef = componentInstance;
|
|
10545
|
+
};
|
|
10546
|
+
}
|
|
10547
|
+
return controlled;
|
|
10548
|
+
});
|
|
10549
|
+
__publicField(this, "refresh", () => {
|
|
10550
|
+
this.setState(({ resetCount }) => ({
|
|
10551
|
+
resetCount: resetCount + 1
|
|
10552
|
+
}));
|
|
10553
|
+
});
|
|
10554
|
+
__publicField(this, "onStoreChange", (type2) => {
|
|
10555
|
+
if (type2 === "reset") {
|
|
10556
|
+
this.refresh();
|
|
10557
|
+
} else {
|
|
10558
|
+
this.forceUpdate();
|
|
10559
|
+
}
|
|
10560
|
+
});
|
|
10561
|
+
__publicField(this, "renderLayout", (childNode) => {
|
|
10562
|
+
var _a, _b;
|
|
10563
|
+
const { label, name, required: required2, className, style, errorMessageAlign } = {
|
|
10564
|
+
...defaultProps$W,
|
|
10565
|
+
...this.props
|
|
10566
|
+
};
|
|
10567
|
+
const item = ((_a = this.context.errors) == null ? void 0 : _a.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
10568
|
+
return item2.field === name;
|
|
10569
|
+
}));
|
|
10570
|
+
const { starPosition } = this.context;
|
|
10571
|
+
const renderStar = required2 && /* @__PURE__ */ React.createElement("i", { className: "required" });
|
|
10572
|
+
const renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
|
|
10573
|
+
return /* @__PURE__ */ React.createElement(
|
|
10574
|
+
Cell,
|
|
10575
|
+
{
|
|
10576
|
+
className: `nut-form-item ${className}`,
|
|
10577
|
+
style,
|
|
10578
|
+
onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
|
|
10579
|
+
},
|
|
10580
|
+
label ? /* @__PURE__ */ React.createElement("div", { className: "nut-cell__title nut-form-item__label" }, renderLabel) : null,
|
|
10581
|
+
/* @__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(
|
|
10582
|
+
"div",
|
|
10583
|
+
{
|
|
10584
|
+
className: "nut-form-item__body__tips",
|
|
10585
|
+
style: { textAlign: errorMessageAlign }
|
|
10586
|
+
},
|
|
10587
|
+
item[0].message
|
|
10588
|
+
))
|
|
10589
|
+
);
|
|
10590
|
+
});
|
|
10591
|
+
this.componentRef = React.createRef();
|
|
10592
|
+
this.state = {
|
|
10593
|
+
resetCount: 1
|
|
10594
|
+
};
|
|
10595
|
+
}
|
|
10596
|
+
componentDidMount() {
|
|
10597
|
+
this.cancelRegister = this.context.registerField(this);
|
|
10598
|
+
}
|
|
10599
|
+
componentWillUnmount() {
|
|
10600
|
+
if (this.cancelRegister) {
|
|
10601
|
+
this.cancelRegister();
|
|
10602
|
+
}
|
|
10603
|
+
}
|
|
10604
|
+
render() {
|
|
10605
|
+
const { children } = this.props;
|
|
10606
|
+
const child = Array.isArray(children) ? children[0] : children;
|
|
10607
|
+
const returnChildNode = React.cloneElement(
|
|
10608
|
+
child,
|
|
10609
|
+
this.getControlled(child)
|
|
10610
|
+
);
|
|
10611
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
10612
|
+
}
|
|
10613
|
+
}
|
|
10614
|
+
__publicField(FormItem, "defaultProps", defaultProps$W);
|
|
10615
|
+
__publicField(FormItem, "contextType", Context);
|
|
9462
10616
|
const defaultProps$V = {
|
|
9463
10617
|
...ComponentDefaults,
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
labelPosition: "Right",
|
|
9468
|
-
formGroupTitle: "",
|
|
9469
|
-
onFinish: (obj) => {
|
|
9470
|
-
},
|
|
9471
|
-
onFinishFailed: (value) => {
|
|
10618
|
+
labelPosition: "right",
|
|
10619
|
+
starPosition: "left",
|
|
10620
|
+
onFinish: (values) => {
|
|
9472
10621
|
},
|
|
9473
|
-
|
|
10622
|
+
onFinishFailed: (values, errorFields) => {
|
|
10623
|
+
}
|
|
9474
10624
|
};
|
|
9475
10625
|
const PositionInfo = {
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
10626
|
+
top: "form-layout-top",
|
|
10627
|
+
left: "form-layout-left",
|
|
10628
|
+
right: "form-layout-right"
|
|
9479
10629
|
};
|
|
9480
10630
|
const Form = (props) => {
|
|
10631
|
+
const classPrefix2 = "nut-form";
|
|
9481
10632
|
const {
|
|
10633
|
+
className,
|
|
10634
|
+
style,
|
|
10635
|
+
footer,
|
|
9482
10636
|
children,
|
|
10637
|
+
initialValues,
|
|
9483
10638
|
onFinish,
|
|
9484
10639
|
onFinishFailed,
|
|
9485
10640
|
labelPosition,
|
|
9486
|
-
|
|
9487
|
-
|
|
10641
|
+
starPosition,
|
|
10642
|
+
form
|
|
9488
10643
|
} = {
|
|
9489
10644
|
...defaultProps$V,
|
|
9490
10645
|
...props
|
|
9491
10646
|
};
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9495
|
-
|
|
10647
|
+
let formInstance;
|
|
10648
|
+
if (form !== void 0) {
|
|
10649
|
+
formInstance = form;
|
|
10650
|
+
} else {
|
|
10651
|
+
[formInstance] = useForm();
|
|
10652
|
+
}
|
|
10653
|
+
formInstance.starPosition = starPosition;
|
|
10654
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
9496
10655
|
setCallback({
|
|
9497
10656
|
onFinish,
|
|
9498
10657
|
onFinishFailed
|
|
9499
10658
|
});
|
|
10659
|
+
const mountRef = React.useRef(false);
|
|
10660
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
10661
|
+
if (!mountRef.current) {
|
|
10662
|
+
mountRef.current = true;
|
|
10663
|
+
}
|
|
9500
10664
|
return /* @__PURE__ */ React.createElement(
|
|
9501
10665
|
"form",
|
|
9502
10666
|
{
|
|
9503
|
-
className:
|
|
9504
|
-
|
|
10667
|
+
className: classNames(
|
|
10668
|
+
classPrefix2,
|
|
10669
|
+
className,
|
|
10670
|
+
PositionInfo[labelPosition]
|
|
10671
|
+
),
|
|
10672
|
+
style,
|
|
9505
10673
|
onSubmit: (e) => {
|
|
9506
10674
|
e.preventDefault();
|
|
10675
|
+
e.stopPropagation();
|
|
9507
10676
|
submit();
|
|
10677
|
+
},
|
|
10678
|
+
onReset: (e) => {
|
|
10679
|
+
e.preventDefault();
|
|
10680
|
+
e.stopPropagation();
|
|
10681
|
+
resetFields();
|
|
9508
10682
|
}
|
|
9509
10683
|
},
|
|
9510
|
-
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(
|
|
10684
|
+
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
9511
10685
|
);
|
|
9512
10686
|
};
|
|
9513
10687
|
Form.defaultProps = defaultProps$V;
|
|
9514
10688
|
Form.displayName = "NutForm";
|
|
9515
10689
|
Form.Item = FormItem;
|
|
10690
|
+
Form.useForm = useForm;
|
|
9516
10691
|
function trimExtraChar(value, char, regExp) {
|
|
9517
10692
|
const index = value.indexOf(char);
|
|
9518
10693
|
if (index === -1) {
|
|
@@ -9557,7 +10732,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9557
10732
|
(props, ref) => {
|
|
9558
10733
|
const { locale } = useConfig$1();
|
|
9559
10734
|
const {
|
|
9560
|
-
type,
|
|
10735
|
+
type: type2,
|
|
9561
10736
|
name,
|
|
9562
10737
|
placeholder,
|
|
9563
10738
|
align,
|
|
@@ -9619,10 +10794,10 @@ var __publicField = (obj, key, value) => {
|
|
|
9619
10794
|
const updateValue = (value2, trigger = "onChange") => {
|
|
9620
10795
|
let val = value2;
|
|
9621
10796
|
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
9622
|
-
if (
|
|
10797
|
+
if (type2 === "number") {
|
|
9623
10798
|
val = formatNumber(val, false, true);
|
|
9624
10799
|
}
|
|
9625
|
-
if (
|
|
10800
|
+
if (type2 === "digit") {
|
|
9626
10801
|
val = formatNumber(val, true, true);
|
|
9627
10802
|
}
|
|
9628
10803
|
}
|
|
@@ -9651,18 +10826,18 @@ var __publicField = (obj, key, value) => {
|
|
|
9651
10826
|
setActive(false);
|
|
9652
10827
|
}, 50);
|
|
9653
10828
|
};
|
|
9654
|
-
const inputType = (
|
|
10829
|
+
const inputType = (type22) => {
|
|
9655
10830
|
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
9656
|
-
if (
|
|
10831
|
+
if (type22 === "digit") {
|
|
9657
10832
|
return "text";
|
|
9658
10833
|
}
|
|
9659
|
-
if (
|
|
10834
|
+
if (type22 === "number") {
|
|
9660
10835
|
return "tel";
|
|
9661
10836
|
}
|
|
9662
|
-
} else if (
|
|
10837
|
+
} else if (type22 === "password") {
|
|
9663
10838
|
return "text";
|
|
9664
10839
|
}
|
|
9665
|
-
return
|
|
10840
|
+
return type22;
|
|
9666
10841
|
};
|
|
9667
10842
|
return /* @__PURE__ */ React.createElement(
|
|
9668
10843
|
components.View,
|
|
@@ -9681,8 +10856,8 @@ var __publicField = (obj, key, value) => {
|
|
|
9681
10856
|
className: "nut-input-native",
|
|
9682
10857
|
ref: inputRef,
|
|
9683
10858
|
style: { textAlign: align },
|
|
9684
|
-
type: inputType(
|
|
9685
|
-
password:
|
|
10859
|
+
type: inputType(type2),
|
|
10860
|
+
password: type2 === "password",
|
|
9686
10861
|
maxlength: maxLength,
|
|
9687
10862
|
placeholder: placeholder || locale.placeholder,
|
|
9688
10863
|
disabled: disabled || readOnly,
|
|
@@ -9729,7 +10904,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9729
10904
|
disabled: false,
|
|
9730
10905
|
min: 1,
|
|
9731
10906
|
max: 9999,
|
|
9732
|
-
|
|
10907
|
+
readOnly: false,
|
|
9733
10908
|
allowEmpty: false,
|
|
9734
10909
|
defaultValue: 0,
|
|
9735
10910
|
step: 1,
|
|
@@ -9743,7 +10918,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9743
10918
|
disabled,
|
|
9744
10919
|
min,
|
|
9745
10920
|
max,
|
|
9746
|
-
|
|
10921
|
+
readOnly,
|
|
9747
10922
|
value,
|
|
9748
10923
|
defaultValue,
|
|
9749
10924
|
allowEmpty,
|
|
@@ -9898,14 +11073,14 @@ var __publicField = (obj, key, value) => {
|
|
|
9898
11073
|
const focusValue = (e) => {
|
|
9899
11074
|
if (disabled)
|
|
9900
11075
|
return;
|
|
9901
|
-
if (
|
|
11076
|
+
if (readOnly)
|
|
9902
11077
|
return;
|
|
9903
11078
|
onFocus && onFocus(e);
|
|
9904
11079
|
};
|
|
9905
11080
|
const burValue = (e) => {
|
|
9906
11081
|
if (disabled)
|
|
9907
11082
|
return;
|
|
9908
|
-
if (
|
|
11083
|
+
if (readOnly)
|
|
9909
11084
|
return;
|
|
9910
11085
|
const input = e.target;
|
|
9911
11086
|
let value2 = +input.value;
|
|
@@ -9923,11 +11098,12 @@ var __publicField = (obj, key, value) => {
|
|
|
9923
11098
|
return /* @__PURE__ */ React.createElement("div", { className: classes, style: styles, ...restProps }, /* @__PURE__ */ React.createElement("div", { className: "nut-input-minus" }, /* @__PURE__ */ React.createElement(a$d, { className: iconMinusClasses, onClick: reduceNumber })), /* @__PURE__ */ React.createElement(React.Fragment, null, formatter ? /* @__PURE__ */ React.createElement(
|
|
9924
11099
|
"input",
|
|
9925
11100
|
{
|
|
11101
|
+
className: "nut-number-input",
|
|
9926
11102
|
type: "text",
|
|
9927
11103
|
min,
|
|
9928
11104
|
max,
|
|
9929
11105
|
disabled,
|
|
9930
|
-
readOnly
|
|
11106
|
+
readOnly,
|
|
9931
11107
|
value: _checked,
|
|
9932
11108
|
onInput: changeFormatValue,
|
|
9933
11109
|
onBlur: burFormatValue,
|
|
@@ -9936,11 +11112,12 @@ var __publicField = (obj, key, value) => {
|
|
|
9936
11112
|
) : /* @__PURE__ */ React.createElement(
|
|
9937
11113
|
"input",
|
|
9938
11114
|
{
|
|
11115
|
+
className: "nut-number-input",
|
|
9939
11116
|
type: "digit",
|
|
9940
11117
|
min,
|
|
9941
11118
|
max,
|
|
9942
11119
|
disabled,
|
|
9943
|
-
readOnly
|
|
11120
|
+
readOnly,
|
|
9944
11121
|
value: _checked,
|
|
9945
11122
|
onInput: changeValue,
|
|
9946
11123
|
onBlur: burValue,
|
|
@@ -10298,7 +11475,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10298
11475
|
title,
|
|
10299
11476
|
confirmText,
|
|
10300
11477
|
visible,
|
|
10301
|
-
type,
|
|
11478
|
+
type: type2,
|
|
10302
11479
|
custom,
|
|
10303
11480
|
random,
|
|
10304
11481
|
style,
|
|
@@ -10337,7 +11514,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10337
11514
|
};
|
|
10338
11515
|
const keysList = React.useMemo(() => {
|
|
10339
11516
|
return [...getBasicKeys(), ...getCustomKeys()];
|
|
10340
|
-
}, [
|
|
11517
|
+
}, [type2, random, custom]);
|
|
10341
11518
|
const DeleteIcon = () => {
|
|
10342
11519
|
const style2 = {
|
|
10343
11520
|
background: `url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAnCAYAAABJ0cukAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyFpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIChXaW5kb3dzKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozOUNBQTQ0MkY3RTMxMUVBQjIzNEJCQkYxNDZGQjg5OCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozOUNBQTQ0M0Y3RTMxMUVBQjIzNEJCQkYxNDZGQjg5OCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjM5Q0FBNDQwRjdFMzExRUFCMjM0QkJCRjE0NkZCODk4IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM5Q0FBNDQxRjdFMzExRUFCMjM0QkJCRjE0NkZCODk4Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+T12ahwAABClJREFUeNrUWVtIFFEY3pkdrbaCiAINK81VW3d2102pjKLtoXoJrNAswoeEXoyilx7sJXvIh6CHAoMg6yEfSpdECIqE0jCMbMm9qCVYUmR5S8huXmZO39nWOI7mzsy6uzqgM/vvzNnv+y/n/84ZjhBiWMwHF+kA+fn5y0ZHRzNwuTomgDnui9/vfzMvBJxWa7bE87W4tMbY8S8MhNz0BQLVugnY7fZdGORZPNNHJmSPUSf47QD/PN75z3NcpqD1IVEU8wC+dZojDIajyMu6WAG322zBmQf/7LzGnHeAdRtjmuAIKYoleMWxQnUEHA6HVZLldsb0m3oehdQQzzQSVILPJLIcYEw/4HkK/kG86yAsAZvNtgng3059hte/Gf56/uFCaGR8mIJdj3m2hzGNGAkpRM4vCPBzErBYLMko2A//DIQMoQ0WtgcCjWFnCVGswEzxCecqLc0y9Nyww2ariYhAbm7umgRB6GNM/QTgfT7fEzWD4t7dOK0D4TKAcrtcLkENeNx/gUoSpOnx4Gc9BHJyclZNjI8PMqY+judp2jSr1iuENDPi5fDX4WG32WxeogL81NGRIEk3NBNAh10uS9IIY/oIbxR6vd4WLXmJAq9Ayl1kTAUmk8mNyJrUgDfK8hFPV9dnTQSCHiLkO/Ndb8jzrXqKawYJQg4gsu6srKyV4cC/7ujo1CqneRSPxNh74PligPdE3PYVIDHuY6PRWCxPTp7VC35KSvwjwBpwdPP4gXYc86ZdZnr6Pf7S9HqexUs9z0qBLprz8wn+PzWRFknaKGsgjwlvCdLGH42GQ0lg+dqkMP+Enj+lF/yMWYgnJD1qEhhphOWgS2E2yQZDJWa/lEgIvGIa0D2HKJZGA7yiBgaZqO9AermdFstGXQR8fn+BootW4wfPRBE8zXmXoia2SYLgpsJRVwqBBJ2N+pnueRVhPR8l8MGCnaWw8wDCDSWQoasGQCKJnpjGcwkkKqMBfo7ZyQklQCOxWVcRg4QDXmhkSJRjsGvRAD8HCTuNhNPpXKtLzHn9/n0orBqm052GvL2lcfepTMs8PwsJqyRJRbrlNFpBCUBcYWaKE2h4tampqUtV6pP60HNtapuUksTY2NidiLcWUQPnMOhlxvQoITGxxOPxDIVdR2dnb/V2dr7Umn50/Q31261JC4UhUQYSVUxdtPCCUAK10RuvZeQ0LRQ2tD7fddxdyuT3TijJehATF/yinqmJ2wB+jCGRA11TH9xiXAwEQpG4i0gcZHLPjHSqF0Vx76IgEIpEA9a7+3H5K2RK4jnuPvTToXgR0LW9Htpap71iAzPVNsUIMH0XMdXkfLrfD9BdanifksiKW/5w3Emj3mcHBgb6kpKTn6KYzfBCehzg10H6lHPzMdIWq9U8znEpsXE6N4rTO9TjSGgPanG/pfwjwABn1PZcM5XI0AAAAABJRU5ErkJggg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLTkwMjA5MzIyMjIxMzkzMzc2NzAwNjg0MC0tDQo=') no-repeat center`,
|
|
@@ -10398,7 +11575,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10398
11575
|
overlayStyle: { backgroundColor: "rgba(0, 0, 0, 0)" },
|
|
10399
11576
|
...rest
|
|
10400
11577
|
},
|
|
10401
|
-
/* @__PURE__ */ React.createElement("div", { className: classNames(classPrefix2, className), style }, title && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__header` }, /* @__PURE__ */ React.createElement("h3", { className: `${classPrefix2}__header__title` }, title),
|
|
11578
|
+
/* @__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(
|
|
10402
11579
|
"span",
|
|
10403
11580
|
{
|
|
10404
11581
|
className: `${classPrefix2}__header__close`,
|
|
@@ -10407,7 +11584,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10407
11584
|
locale.done
|
|
10408
11585
|
)), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__body` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__body__keys` }, keysList == null ? void 0 : keysList.map((item) => {
|
|
10409
11586
|
return /* @__PURE__ */ React.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
10410
|
-
})),
|
|
11587
|
+
})), type2 === "rightColumn" && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__sidebar` }, /* @__PURE__ */ React.createElement(
|
|
10411
11588
|
NumberKeyboardKey,
|
|
10412
11589
|
{
|
|
10413
11590
|
key: "delete",
|
|
@@ -10643,7 +11820,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10643
11820
|
const Range = (props) => {
|
|
10644
11821
|
const {
|
|
10645
11822
|
className,
|
|
10646
|
-
range,
|
|
11823
|
+
range: range2,
|
|
10647
11824
|
disabled,
|
|
10648
11825
|
button,
|
|
10649
11826
|
vertical,
|
|
@@ -10701,7 +11878,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10701
11878
|
const classPrefix22 = "nut-range-mark";
|
|
10702
11879
|
let lowerBound = min;
|
|
10703
11880
|
let upperBound = max;
|
|
10704
|
-
if (
|
|
11881
|
+
if (range2 && Array.isArray(current)) {
|
|
10705
11882
|
lowerBound = current[0];
|
|
10706
11883
|
upperBound = current[1];
|
|
10707
11884
|
} else {
|
|
@@ -10713,10 +11890,10 @@ var __publicField = (obj, key, value) => {
|
|
|
10713
11890
|
`${isActive ? `${classPrefix22}-text-active` : ""}`
|
|
10714
11891
|
].join(" ");
|
|
10715
11892
|
},
|
|
10716
|
-
[
|
|
11893
|
+
[range2, current, min, max]
|
|
10717
11894
|
);
|
|
10718
11895
|
const isRange = (val) => {
|
|
10719
|
-
return !!
|
|
11896
|
+
return !!range2 && Array.isArray(val);
|
|
10720
11897
|
};
|
|
10721
11898
|
const calcMainAxis = () => {
|
|
10722
11899
|
const modelVal = current;
|
|
@@ -10758,12 +11935,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10758
11935
|
return style;
|
|
10759
11936
|
};
|
|
10760
11937
|
const tickClass = (mark) => {
|
|
10761
|
-
if (
|
|
11938
|
+
if (range2 && Array.isArray(current)) {
|
|
10762
11939
|
return mark <= current[1] && mark >= current[0];
|
|
10763
11940
|
}
|
|
10764
11941
|
return mark <= current;
|
|
10765
11942
|
};
|
|
10766
|
-
const
|
|
11943
|
+
const format2 = (value2) => {
|
|
10767
11944
|
value2 = Math.max(+min, Math.min(value2, +max));
|
|
10768
11945
|
return Math.round(value2 / +step) * +step;
|
|
10769
11946
|
};
|
|
@@ -10778,9 +11955,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10778
11955
|
};
|
|
10779
11956
|
const updateValue = (value2, end) => {
|
|
10780
11957
|
if (isRange(value2)) {
|
|
10781
|
-
value2 = handleOverlap(value2).map(
|
|
11958
|
+
value2 = handleOverlap(value2).map(format2);
|
|
10782
11959
|
} else {
|
|
10783
|
-
value2 =
|
|
11960
|
+
value2 = format2(value2);
|
|
10784
11961
|
}
|
|
10785
11962
|
if (!isSameValue(value2, current)) {
|
|
10786
11963
|
setCurrent(value2);
|
|
@@ -10820,9 +11997,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10820
11997
|
touch.start(event);
|
|
10821
11998
|
setEaxctValue(current);
|
|
10822
11999
|
if (isRange(current)) {
|
|
10823
|
-
setStartValue(current.map(
|
|
12000
|
+
setStartValue(current.map(format2));
|
|
10824
12001
|
} else {
|
|
10825
|
-
setStartValue(
|
|
12002
|
+
setStartValue(format2(current));
|
|
10826
12003
|
}
|
|
10827
12004
|
setDragStatus("start");
|
|
10828
12005
|
};
|
|
@@ -10889,7 +12066,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10889
12066
|
}
|
|
10890
12067
|
)
|
|
10891
12068
|
);
|
|
10892
|
-
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() },
|
|
12069
|
+
})), /* @__PURE__ */ React.createElement("div", { className: "nut-range-bar", style: barStyle() }, range2 ? [0, 1].map((item, index) => {
|
|
10893
12070
|
return /* @__PURE__ */ React.createElement(
|
|
10894
12071
|
"div",
|
|
10895
12072
|
{
|
|
@@ -11107,7 +12284,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11107
12284
|
return /* @__PURE__ */ React.createElement(
|
|
11108
12285
|
"input",
|
|
11109
12286
|
{
|
|
11110
|
-
className: `${classPrefix2}__input ${
|
|
12287
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
11111
12288
|
ref: searchRef,
|
|
11112
12289
|
style: { ...props.style },
|
|
11113
12290
|
value: value || "",
|
|
@@ -11179,7 +12356,16 @@ var __publicField = (obj, key, value) => {
|
|
|
11179
12356
|
style: { ...props.style }
|
|
11180
12357
|
},
|
|
11181
12358
|
renderLeft(),
|
|
11182
|
-
/* @__PURE__ */ React.createElement(
|
|
12359
|
+
/* @__PURE__ */ React.createElement(
|
|
12360
|
+
"div",
|
|
12361
|
+
{
|
|
12362
|
+
className: `${classPrefix2}__content ${shape === "round" ? `${classPrefix2}__round` : ""}`
|
|
12363
|
+
},
|
|
12364
|
+
renderLeftIn(),
|
|
12365
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-searchbar__input-box" }, renderField()),
|
|
12366
|
+
renderRightIn(),
|
|
12367
|
+
clearable && value && handleClear()
|
|
12368
|
+
),
|
|
11183
12369
|
renderRight()
|
|
11184
12370
|
);
|
|
11185
12371
|
};
|
|
@@ -11229,7 +12415,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11229
12415
|
const comLen = React.useMemo(() => {
|
|
11230
12416
|
return Math.min(Math.max(4, length || 4), 6);
|
|
11231
12417
|
}, [length]);
|
|
11232
|
-
const
|
|
12418
|
+
const format2 = (val) => {
|
|
11233
12419
|
return val.slice(0, comLen);
|
|
11234
12420
|
};
|
|
11235
12421
|
const [inputValue, setInputValue] = usePropsValue({ value, onChange });
|
|
@@ -11239,11 +12425,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11239
12425
|
}
|
|
11240
12426
|
}, [visible]);
|
|
11241
12427
|
React.useEffect(() => {
|
|
11242
|
-
const val =
|
|
12428
|
+
const val = format2(value);
|
|
11243
12429
|
if (val.length >= comLen) {
|
|
11244
12430
|
onComplete && onComplete(val);
|
|
11245
12431
|
}
|
|
11246
|
-
setInputValue(
|
|
12432
|
+
setInputValue(format2(value));
|
|
11247
12433
|
}, [value]);
|
|
11248
12434
|
const sure = () => {
|
|
11249
12435
|
onConfirm && onConfirm(inputValue);
|
|
@@ -11291,7 +12477,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11291
12477
|
const InternalSignature = (props, ref) => {
|
|
11292
12478
|
const {
|
|
11293
12479
|
canvasId,
|
|
11294
|
-
type,
|
|
12480
|
+
type: type2,
|
|
11295
12481
|
lineWidth,
|
|
11296
12482
|
strokeStyle,
|
|
11297
12483
|
className,
|
|
@@ -11519,7 +12705,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11519
12705
|
} = { ...defaultProps$H, ...props };
|
|
11520
12706
|
const classPrefix2 = "nut-textarea";
|
|
11521
12707
|
const compositionRef = React.useRef(false);
|
|
11522
|
-
const
|
|
12708
|
+
const format2 = (value2) => {
|
|
11523
12709
|
if (maxLength !== void 0 && value2.length > maxLength) {
|
|
11524
12710
|
return value2.substring(0, maxLength);
|
|
11525
12711
|
}
|
|
@@ -11528,14 +12714,14 @@ var __publicField = (obj, key, value) => {
|
|
|
11528
12714
|
const [inputValue, setInputValue] = usePropsValue({
|
|
11529
12715
|
value,
|
|
11530
12716
|
defaultValue,
|
|
11531
|
-
finalValue:
|
|
12717
|
+
finalValue: format2(defaultValue),
|
|
11532
12718
|
onChange
|
|
11533
12719
|
});
|
|
11534
12720
|
const handleChange = (event) => {
|
|
11535
12721
|
var _a;
|
|
11536
12722
|
const text = (_a = event == null ? void 0 : event.detail) == null ? void 0 : _a.value;
|
|
11537
12723
|
if (text) {
|
|
11538
|
-
const value2 = compositionRef.current ? text :
|
|
12724
|
+
const value2 = compositionRef.current ? text : format2(text);
|
|
11539
12725
|
setInputValue(value2);
|
|
11540
12726
|
} else {
|
|
11541
12727
|
setInputValue("");
|
|
@@ -11882,7 +13068,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11882
13068
|
previewUrl,
|
|
11883
13069
|
headers,
|
|
11884
13070
|
timeout,
|
|
11885
|
-
method,
|
|
13071
|
+
method: method2,
|
|
11886
13072
|
xhrState,
|
|
11887
13073
|
data,
|
|
11888
13074
|
preview,
|
|
@@ -11998,7 +13184,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11998
13184
|
uploadOption.fileType = fileItem.type;
|
|
11999
13185
|
uploadOption.formData = fileItem.formData;
|
|
12000
13186
|
uploadOption.timeout = timeout * 1;
|
|
12001
|
-
uploadOption.method =
|
|
13187
|
+
uploadOption.method = method2;
|
|
12002
13188
|
uploadOption.xhrState = xhrState;
|
|
12003
13189
|
uploadOption.headers = headers;
|
|
12004
13190
|
uploadOption.taroFilePath = fileItem.path;
|
|
@@ -13103,7 +14289,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13103
14289
|
const getActive = (pace) => {
|
|
13104
14290
|
if (pace) {
|
|
13105
14291
|
const _active = active + pace;
|
|
13106
|
-
return
|
|
14292
|
+
return range2(_active, -1, childCount);
|
|
13107
14293
|
}
|
|
13108
14294
|
return active;
|
|
13109
14295
|
};
|
|
@@ -13115,7 +14301,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13115
14301
|
const requestFrame = (fn) => {
|
|
13116
14302
|
window.requestAnimationFrame.call(window, fn);
|
|
13117
14303
|
};
|
|
13118
|
-
const
|
|
14304
|
+
const range2 = (num, min, max) => {
|
|
13119
14305
|
return Math.min(Math.max(num, min), max);
|
|
13120
14306
|
};
|
|
13121
14307
|
const resettPosition = () => {
|
|
@@ -13220,7 +14406,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13220
14406
|
id,
|
|
13221
14407
|
children,
|
|
13222
14408
|
style,
|
|
13223
|
-
type,
|
|
14409
|
+
type: type2,
|
|
13224
14410
|
className,
|
|
13225
14411
|
position,
|
|
13226
14412
|
visible,
|
|
@@ -13268,7 +14454,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13268
14454
|
[`${classPrefix$b}--popup-top`]: position === "top",
|
|
13269
14455
|
[`${classPrefix$b}--popup-bottom`]: position === "bottom",
|
|
13270
14456
|
[`${classPrefix$b}`]: true,
|
|
13271
|
-
[`${classPrefix$b}--${
|
|
14457
|
+
[`${classPrefix$b}--${type2}`]: true
|
|
13272
14458
|
});
|
|
13273
14459
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
13274
14460
|
CSSTransition$1,
|
|
@@ -13367,7 +14553,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13367
14553
|
const getContentWidth = async () => {
|
|
13368
14554
|
let rect;
|
|
13369
14555
|
if (targetId) {
|
|
13370
|
-
if (Taro.getEnv()
|
|
14556
|
+
if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
|
|
13371
14557
|
rect = getRect(document.querySelector(`#${targetId}`));
|
|
13372
14558
|
} else {
|
|
13373
14559
|
rect = await getRectTaro(targetId);
|
|
@@ -13390,13 +14576,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13390
14576
|
return new Promise((resolve) => {
|
|
13391
14577
|
const query = Taro.createSelectorQuery();
|
|
13392
14578
|
query.select(`#${targetId2}`) && query.select(`#${targetId2}`).boundingClientRect();
|
|
13393
|
-
query.exec(
|
|
14579
|
+
query.exec((res) => {
|
|
13394
14580
|
resolve(res[0]);
|
|
13395
14581
|
});
|
|
13396
14582
|
});
|
|
13397
14583
|
};
|
|
13398
14584
|
const getPopoverContentW = async () => {
|
|
13399
|
-
|
|
14585
|
+
const rectContent = await getRectByTaro(popoverContentRef.current);
|
|
13400
14586
|
setElWidth(rectContent.width);
|
|
13401
14587
|
setElHeight(rectContent.height);
|
|
13402
14588
|
};
|
|
@@ -13438,7 +14624,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13438
14624
|
return styles;
|
|
13439
14625
|
};
|
|
13440
14626
|
const getRootPosition = () => {
|
|
13441
|
-
|
|
14627
|
+
const styles = {};
|
|
13442
14628
|
if (!rootPosition) {
|
|
13443
14629
|
styles.visibility = "hidden";
|
|
13444
14630
|
return styles;
|
|
@@ -13450,34 +14636,34 @@ var __publicField = (obj, key, value) => {
|
|
|
13450
14636
|
const skew = location.split("-")[1];
|
|
13451
14637
|
let cross = 0;
|
|
13452
14638
|
let parallel = 0;
|
|
13453
|
-
if (Array.isArray(offset) && offset.length
|
|
14639
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
13454
14640
|
cross += +offset[1];
|
|
13455
14641
|
parallel += +offset[0];
|
|
13456
14642
|
}
|
|
13457
14643
|
if (width) {
|
|
13458
14644
|
if (["bottom", "top"].includes(direction)) {
|
|
13459
|
-
const h = direction
|
|
14645
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
13460
14646
|
styles.top = `${top + h}px`;
|
|
13461
14647
|
if (!skew) {
|
|
13462
14648
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
13463
14649
|
}
|
|
13464
|
-
if (skew
|
|
14650
|
+
if (skew === "start") {
|
|
13465
14651
|
styles.left = `${left + parallel}px`;
|
|
13466
14652
|
}
|
|
13467
|
-
if (skew
|
|
14653
|
+
if (skew === "end") {
|
|
13468
14654
|
styles.left = `${right + parallel}px`;
|
|
13469
14655
|
}
|
|
13470
14656
|
}
|
|
13471
14657
|
if (["left", "right"].includes(direction)) {
|
|
13472
|
-
const contentW = direction
|
|
14658
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
13473
14659
|
styles.left = `${left + contentW}px`;
|
|
13474
14660
|
if (!skew) {
|
|
13475
14661
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
13476
14662
|
}
|
|
13477
|
-
if (skew
|
|
14663
|
+
if (skew === "start") {
|
|
13478
14664
|
styles.top = `${top + parallel}px`;
|
|
13479
14665
|
}
|
|
13480
|
-
if (skew
|
|
14666
|
+
if (skew === "end") {
|
|
13481
14667
|
styles.top = `${top + height + parallel}px`;
|
|
13482
14668
|
}
|
|
13483
14669
|
}
|
|
@@ -13885,10 +15071,11 @@ var __publicField = (obj, key, value) => {
|
|
|
13885
15071
|
}
|
|
13886
15072
|
}
|
|
13887
15073
|
const defaultProps$t = {
|
|
15074
|
+
...ComponentDefaults,
|
|
13888
15075
|
name: ""
|
|
13889
15076
|
};
|
|
13890
15077
|
const Swipe = React.forwardRef((props, instanceRef) => {
|
|
13891
|
-
const
|
|
15078
|
+
const classPrefix2 = "nut-swipe";
|
|
13892
15079
|
const touch = useTouch();
|
|
13893
15080
|
Taro.useReady(() => {
|
|
13894
15081
|
const getWidth = async () => {
|
|
@@ -14010,7 +15197,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14010
15197
|
{
|
|
14011
15198
|
id: "left",
|
|
14012
15199
|
ref: side === "left" ? leftWrapper : rightWrapper,
|
|
14013
|
-
className: `${
|
|
15200
|
+
className: `${classPrefix2}__${side}`,
|
|
14014
15201
|
onClick: (e) => handleOperate(e, side)
|
|
14015
15202
|
},
|
|
14016
15203
|
props[`${side}Action`]
|
|
@@ -14050,13 +15237,13 @@ var __publicField = (obj, key, value) => {
|
|
|
14050
15237
|
"div",
|
|
14051
15238
|
{
|
|
14052
15239
|
ref: root2,
|
|
14053
|
-
className: classNames(
|
|
15240
|
+
className: classNames(classPrefix2, className),
|
|
14054
15241
|
onTouchStart: (e) => onTouchStart(e),
|
|
14055
15242
|
onTouchMove: (e) => onTouchMove(e),
|
|
14056
15243
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
14057
15244
|
style
|
|
14058
15245
|
},
|
|
14059
|
-
/* @__PURE__ */ React.createElement("div", { className: `${
|
|
15246
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left"), children, renderActionContent("right"))
|
|
14060
15247
|
);
|
|
14061
15248
|
});
|
|
14062
15249
|
Swipe.defaultProps = defaultProps$t;
|
|
@@ -14175,7 +15362,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14175
15362
|
iconSize,
|
|
14176
15363
|
msg,
|
|
14177
15364
|
duration,
|
|
14178
|
-
type,
|
|
15365
|
+
type: type2,
|
|
14179
15366
|
title,
|
|
14180
15367
|
closeOnOverlayClick,
|
|
14181
15368
|
contentClassName,
|
|
@@ -14220,7 +15407,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14220
15407
|
}
|
|
14221
15408
|
};
|
|
14222
15409
|
const hasIcon = () => {
|
|
14223
|
-
if (
|
|
15410
|
+
if (type2 !== "text") {
|
|
14224
15411
|
return true;
|
|
14225
15412
|
}
|
|
14226
15413
|
return !!icon;
|
|
@@ -14234,7 +15421,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14234
15421
|
fail: /* @__PURE__ */ React.createElement(a$m, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
14235
15422
|
warn: /* @__PURE__ */ React.createElement(a$3, { color: "#ffffff", width: iconSize, height: iconSize }),
|
|
14236
15423
|
loading: /* @__PURE__ */ React.createElement(r$g, { color: "#ffffff", width: iconSize, height: iconSize })
|
|
14237
|
-
}[
|
|
15424
|
+
}[type2];
|
|
14238
15425
|
};
|
|
14239
15426
|
const classes = classNames({
|
|
14240
15427
|
"nut-toast-has-icon": icon,
|
|
@@ -14275,14 +15462,14 @@ var __publicField = (obj, key, value) => {
|
|
|
14275
15462
|
};
|
|
14276
15463
|
const classPrefix$7 = `nut-animate`;
|
|
14277
15464
|
const Animate = (props) => {
|
|
14278
|
-
const { className, type, action, loop, onClick, children, ...rest } = {
|
|
15465
|
+
const { className, type: type2, action, loop, onClick, children, ...rest } = {
|
|
14279
15466
|
...defaultProps$r,
|
|
14280
15467
|
...props
|
|
14281
15468
|
};
|
|
14282
15469
|
const [clicked, setClicked] = React.useState(false);
|
|
14283
15470
|
const classes = classNames({
|
|
14284
15471
|
"nut-ani-container": true,
|
|
14285
|
-
[`${classPrefix$7}-${
|
|
15472
|
+
[`${classPrefix$7}-${type2}`]: action === "initial" || clicked ? type2 : false,
|
|
14286
15473
|
loop
|
|
14287
15474
|
});
|
|
14288
15475
|
const cls = classNames(classes, className);
|
|
@@ -14385,8 +15572,8 @@ var __publicField = (obj, key, value) => {
|
|
|
14385
15572
|
className: `${classPrefix2}__number`,
|
|
14386
15573
|
style: numberEaseStyle(idx)
|
|
14387
15574
|
},
|
|
14388
|
-
[...numbers, ...numbers].map((
|
|
14389
|
-
return /* @__PURE__ */ React.createElement("span", { key: subidx },
|
|
15575
|
+
[...numbers, ...numbers].map((number2, subidx) => {
|
|
15576
|
+
return /* @__PURE__ */ React.createElement("span", { key: subidx }, number2);
|
|
14390
15577
|
})
|
|
14391
15578
|
) : /* @__PURE__ */ React.createElement("span", { className: `${classPrefix2}__separator` }, item)
|
|
14392
15579
|
);
|
|
@@ -14441,7 +15628,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14441
15628
|
style,
|
|
14442
15629
|
autoplay,
|
|
14443
15630
|
loop,
|
|
14444
|
-
type,
|
|
15631
|
+
type: type2,
|
|
14445
15632
|
onFastBack,
|
|
14446
15633
|
onForward,
|
|
14447
15634
|
onPause,
|
|
@@ -14597,7 +15784,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14597
15784
|
return /* @__PURE__ */ React.createElement("div", { className: b("none-container"), onClick: handleStatusChange }, children);
|
|
14598
15785
|
};
|
|
14599
15786
|
const renderAudio = () => {
|
|
14600
|
-
switch (
|
|
15787
|
+
switch (type2) {
|
|
14601
15788
|
case "icon":
|
|
14602
15789
|
return renderIcon();
|
|
14603
15790
|
case "progress":
|
|
@@ -14711,7 +15898,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14711
15898
|
const transColor = (color2) => {
|
|
14712
15899
|
return color2 && color2.replace("#", "%23");
|
|
14713
15900
|
};
|
|
14714
|
-
const
|
|
15901
|
+
const format2 = (progress) => Math.min(Math.max(+progress, 0), 100);
|
|
14715
15902
|
const circleStyle = () => {
|
|
14716
15903
|
const stopArr = stop();
|
|
14717
15904
|
const stopDom = [];
|
|
@@ -14726,7 +15913,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14726
15913
|
}
|
|
14727
15914
|
const perimeter = 283;
|
|
14728
15915
|
const progress = +oldValue;
|
|
14729
|
-
const offset = perimeter * Number(
|
|
15916
|
+
const offset = perimeter * Number(format2(parseFloat(progress.toFixed(1)))) / 100;
|
|
14730
15917
|
const isWise = props.clockwise ? 1 : 0;
|
|
14731
15918
|
const color2 = isObject(props.color) ? `url(%23${refRandomId})` : transColor(props.color);
|
|
14732
15919
|
const d = `M 50 50 m 0 -45 a 45 45 0 1 ${isWise} 0 90 a 45 45 0 1, ${isWise} 0 -90`;
|
|
@@ -14985,7 +16172,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14985
16172
|
endTime,
|
|
14986
16173
|
remainingTime,
|
|
14987
16174
|
millisecond,
|
|
14988
|
-
format,
|
|
16175
|
+
format: format2,
|
|
14989
16176
|
autoStart,
|
|
14990
16177
|
time,
|
|
14991
16178
|
destroy,
|
|
@@ -15054,7 +16241,7 @@ var __publicField = (obj, key, value) => {
|
|
|
15054
16241
|
}
|
|
15055
16242
|
});
|
|
15056
16243
|
};
|
|
15057
|
-
const formatRemainTime = (t,
|
|
16244
|
+
const formatRemainTime = (t, type2) => {
|
|
15058
16245
|
const ts = t;
|
|
15059
16246
|
const rest2 = {
|
|
15060
16247
|
d: 0,
|
|
@@ -15074,12 +16261,12 @@ var __publicField = (obj, key, value) => {
|
|
|
15074
16261
|
rest2.s = Math.floor(ts % MINUTE / SECOND);
|
|
15075
16262
|
rest2.ms = Math.floor(ts % SECOND);
|
|
15076
16263
|
}
|
|
15077
|
-
return
|
|
16264
|
+
return type2 === "custom" ? rest2 : parseFormat({ ...rest2 });
|
|
15078
16265
|
};
|
|
15079
16266
|
const parseFormat = (time2) => {
|
|
15080
16267
|
const { d } = time2;
|
|
15081
16268
|
let { h, m, s, ms } = time2;
|
|
15082
|
-
let formatCache =
|
|
16269
|
+
let formatCache = format2;
|
|
15083
16270
|
if (formatCache.includes("DD")) {
|
|
15084
16271
|
formatCache = formatCache.replace("DD", padZero(d));
|
|
15085
16272
|
} else {
|
|
@@ -15385,9 +16572,9 @@ var __publicField = (obj, key, value) => {
|
|
|
15385
16572
|
const newContent = `${((_a2 = ellipsis.current) == null ? void 0 : _a2.leading) || ""}${((_b2 = ellipsis.current) == null ? void 0 : _b2.leading) ? symbol : ""}${expandText || ""}${((_c2 = ellipsis.current) == null ? void 0 : _c2.tailing) ? symbol : ""}${((_d2 = ellipsis.current) == null ? void 0 : _d2.tailing) || ""}`;
|
|
15386
16573
|
setContentCopy(newContent);
|
|
15387
16574
|
};
|
|
15388
|
-
const tailorContent = (left, right,
|
|
16575
|
+
const tailorContent = (left, right, type2 = "") => {
|
|
15389
16576
|
const threeDotWidth = symbolTextWidth;
|
|
15390
|
-
const direc = direction === "middle" &&
|
|
16577
|
+
const direc = direction === "middle" && type2 ? type2 : direction;
|
|
15391
16578
|
setExceeded(true);
|
|
15392
16579
|
let widthPart = -1;
|
|
15393
16580
|
const start = left;
|
|
@@ -15430,8 +16617,8 @@ var __publicField = (obj, key, value) => {
|
|
|
15430
16617
|
const match = value.match(/^\d*(\.\d*)?/);
|
|
15431
16618
|
return match ? Number(match[0]) : 0;
|
|
15432
16619
|
};
|
|
15433
|
-
const clickHandle = (
|
|
15434
|
-
if (
|
|
16620
|
+
const clickHandle = (type2) => {
|
|
16621
|
+
if (type2 === 1) {
|
|
15435
16622
|
setExpanded(true);
|
|
15436
16623
|
onChange && onChange("expand");
|
|
15437
16624
|
} else {
|
|
@@ -16588,7 +17775,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16588
17775
|
style,
|
|
16589
17776
|
background,
|
|
16590
17777
|
plain,
|
|
16591
|
-
type,
|
|
17778
|
+
type: type2,
|
|
16592
17779
|
round,
|
|
16593
17780
|
children,
|
|
16594
17781
|
mark,
|
|
@@ -16607,7 +17794,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16607
17794
|
const classes = () => {
|
|
16608
17795
|
return classNames({
|
|
16609
17796
|
[classPrefix2]: true,
|
|
16610
|
-
[`${classPrefix2}--${
|
|
17797
|
+
[`${classPrefix2}--${type2}`]: type2,
|
|
16611
17798
|
[`${classPrefix2}--plain`]: plain,
|
|
16612
17799
|
[`${classPrefix2}--round`]: round,
|
|
16613
17800
|
[`${classPrefix2}--mark`]: mark,
|
|
@@ -16617,7 +17804,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16617
17804
|
};
|
|
16618
17805
|
React.useEffect(() => {
|
|
16619
17806
|
setTagClass(classes());
|
|
16620
|
-
}, [
|
|
17807
|
+
}, [type2, background, color, plain, round, mark, closeable, className]);
|
|
16621
17808
|
const handleClick = (e) => {
|
|
16622
17809
|
onClick && onClick(e);
|
|
16623
17810
|
};
|
|
@@ -16895,11 +18082,11 @@ var __publicField = (obj, key, value) => {
|
|
|
16895
18082
|
}, [options, optionKey, activeDate]);
|
|
16896
18083
|
const isActive = React.useCallback(
|
|
16897
18084
|
(timeKey) => {
|
|
16898
|
-
const
|
|
18085
|
+
const date2 = activeTime.find((item) => {
|
|
16899
18086
|
return item[optionKey.valueKey] === activeDate;
|
|
16900
18087
|
});
|
|
16901
|
-
if (
|
|
16902
|
-
const time =
|
|
18088
|
+
if (date2 == null ? void 0 : date2[optionKey.childrenKey]) {
|
|
18089
|
+
const time = date2 == null ? void 0 : date2[optionKey.childrenKey].find((time2) => {
|
|
16903
18090
|
return time2[optionKey.valueKey] === timeKey;
|
|
16904
18091
|
});
|
|
16905
18092
|
return time;
|
|
@@ -16971,23 +18158,23 @@ var __publicField = (obj, key, value) => {
|
|
|
16971
18158
|
};
|
|
16972
18159
|
const handleSelectTime = (selectTime) => {
|
|
16973
18160
|
let newActiveTime = [...activeTime];
|
|
16974
|
-
const
|
|
18161
|
+
const date2 = newActiveTime.find((item) => {
|
|
16975
18162
|
return item[optionKey.valueKey] === activeDate;
|
|
16976
18163
|
});
|
|
16977
|
-
if (
|
|
16978
|
-
const timeIndex =
|
|
18164
|
+
if (date2) {
|
|
18165
|
+
const timeIndex = date2[optionKey.childrenKey].findIndex(
|
|
16979
18166
|
(time) => {
|
|
16980
18167
|
return time[optionKey.valueKey] === selectTime[optionKey.valueKey];
|
|
16981
18168
|
}
|
|
16982
18169
|
);
|
|
16983
18170
|
if (timeIndex > -1) {
|
|
16984
18171
|
if (multiple) {
|
|
16985
|
-
|
|
18172
|
+
date2[optionKey.childrenKey].splice(timeIndex, 1);
|
|
16986
18173
|
} else {
|
|
16987
18174
|
newActiveTime = [];
|
|
16988
18175
|
}
|
|
16989
18176
|
} else if (multiple) {
|
|
16990
|
-
|
|
18177
|
+
date2[optionKey.childrenKey].push({ ...selectTime });
|
|
16991
18178
|
} else {
|
|
16992
18179
|
newActiveTime = [
|
|
16993
18180
|
{
|
|
@@ -17016,9 +18203,9 @@ var __publicField = (obj, key, value) => {
|
|
|
17016
18203
|
setActiveTime(newActiveTime);
|
|
17017
18204
|
onTimeChange && onTimeChange(selectTime, newActiveTime);
|
|
17018
18205
|
};
|
|
17019
|
-
const handleChange = (
|
|
17020
|
-
setActiveDate(
|
|
17021
|
-
onDateChange && onDateChange(
|
|
18206
|
+
const handleChange = (date2) => {
|
|
18207
|
+
setActiveDate(date2[optionKey.valueKey]);
|
|
18208
|
+
onDateChange && onDateChange(date2, activeTime);
|
|
17022
18209
|
};
|
|
17023
18210
|
return /* @__PURE__ */ React.createElement(
|
|
17024
18211
|
Popup,
|