@nutui/nutui-react 1.3.11 → 1.3.12-beta.0
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 +13 -0
- package/dist/esm/Cell.js +7 -108
- package/dist/esm/CellGroup.js +4 -34
- package/dist/esm/Form/style/index.js +2 -0
- package/dist/esm/Form.js +188 -0
- package/dist/esm/FormItem/style/index.js +2 -0
- package/dist/esm/FormItem.js +9 -0
- package/dist/esm/Range.js +8 -5
- package/dist/esm/TextArea.js +7 -8
- package/dist/esm/cell-c8781626.js +108 -0
- package/dist/esm/cellgroup-3402f96c.js +34 -0
- package/dist/esm/formitem-46d4aca3.js +136 -0
- package/dist/esm/nutui-react.es.js +2 -0
- package/dist/esm/types/src/packages/form/demo.d.ts +3 -0
- package/dist/esm/types/src/packages/form/form.d.ts +9 -0
- package/dist/esm/types/src/packages/form/index.d.ts +2 -0
- package/dist/esm/types/src/packages/form/index.taro.d.ts +2 -0
- package/dist/esm/types/src/packages/form/types.d.ts +82 -0
- package/dist/esm/types/src/packages/form/useForm.d.ts +2 -0
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +30 -0
- package/dist/esm/types/src/packages/formitem/formitemcontext.d.ts +6 -0
- package/dist/esm/types/src/packages/formitem/index.d.ts +2 -0
- package/dist/esm/types/src/packages/formitem/types.d.ts +82 -0
- package/dist/esm/types/src/packages/formitem/useForm.d.ts +2 -0
- package/dist/esm/types/src/packages/nutui.react.build.d.ts +3 -1
- package/dist/esm/types/src/packages/nutui.react.d.ts +5 -1
- package/dist/esm/types/src/packages/nutui.react.scss.d.ts +2 -0
- package/dist/esm/types/src/packages/range/range.d.ts +3 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/nutui.react.es.js +1785 -480
- package/dist/nutui.react.umd.js +1821 -514
- package/dist/packages/checkbox/checkbox.scss +1 -1
- package/dist/packages/form/form.scss +27 -0
- package/dist/packages/formitem/formitem.scss +87 -0
- package/dist/style.css +1 -1
- package/dist/style.es.js +1 -1
- package/dist/styles/themes/default.scss +2 -0
- package/dist/styles/variables.scss +77 -26
- package/dist/types/index.d.ts +94 -1
- package/dist/types/nutui.react.build.ts +5 -1
- package/package.json +6 -4
package/dist/nutui.react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @nutui/nutui-react v1.3.
|
|
2
|
+
* @nutui/nutui-react v1.3.12-beta.0 Wed Nov 23 2022 14:51:03 GMT+0800 (China Standard Time)
|
|
3
3
|
* (c) 2022 @jdf2e.
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -45,7 +45,7 @@ classname_production_min.cn = e$1, classname_production_min.withNaming = r$1;
|
|
|
45
45
|
classname.exports = classname_production_min;
|
|
46
46
|
}
|
|
47
47
|
const cn = classname.exports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
|
|
48
|
-
const defaultProps$
|
|
48
|
+
const defaultProps$1n = {
|
|
49
49
|
name: "",
|
|
50
50
|
size: "",
|
|
51
51
|
classPrefix: "nut-icon",
|
|
@@ -73,11 +73,11 @@ function Icon$1(props) {
|
|
|
73
73
|
onClick,
|
|
74
74
|
...rest
|
|
75
75
|
} = {
|
|
76
|
-
...defaultProps$
|
|
76
|
+
...defaultProps$1n,
|
|
77
77
|
...props
|
|
78
78
|
};
|
|
79
79
|
const isImage = name ? name.indexOf("/") !== -1 : false;
|
|
80
|
-
const
|
|
80
|
+
const type4 = isImage ? "img" : tag;
|
|
81
81
|
const b2 = cn("icon");
|
|
82
82
|
const handleClick2 = (e2) => {
|
|
83
83
|
if (onClick) {
|
|
@@ -90,7 +90,7 @@ function Icon$1(props) {
|
|
|
90
90
|
return {};
|
|
91
91
|
};
|
|
92
92
|
return React__default.createElement(
|
|
93
|
-
|
|
93
|
+
type4,
|
|
94
94
|
{
|
|
95
95
|
className: isImage ? `${b2("img")} ${className || ""} ` : `${fontClassName} ${b2(null)} ${classPrefix}-${name} ${className || ""}`,
|
|
96
96
|
style: {
|
|
@@ -107,13 +107,13 @@ function Icon$1(props) {
|
|
|
107
107
|
children
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
|
-
Icon$1.defaultProps = defaultProps$
|
|
110
|
+
Icon$1.defaultProps = defaultProps$1n;
|
|
111
111
|
Icon$1.displayName = "NutIcon";
|
|
112
112
|
const ComponentDefaults = {
|
|
113
113
|
iconClassPrefix: "nut-icon",
|
|
114
114
|
iconFontClassName: "nutui-iconfont"
|
|
115
115
|
};
|
|
116
|
-
const defaultProps$
|
|
116
|
+
const defaultProps$1m = {
|
|
117
117
|
...ComponentDefaults,
|
|
118
118
|
className: "",
|
|
119
119
|
color: "",
|
|
@@ -137,7 +137,7 @@ const Button = (props) => {
|
|
|
137
137
|
plain,
|
|
138
138
|
loading,
|
|
139
139
|
disabled,
|
|
140
|
-
type,
|
|
140
|
+
type: type4,
|
|
141
141
|
size,
|
|
142
142
|
block,
|
|
143
143
|
icon,
|
|
@@ -149,7 +149,7 @@ const Button = (props) => {
|
|
|
149
149
|
iconFontClassName,
|
|
150
150
|
...rest
|
|
151
151
|
} = {
|
|
152
|
-
...defaultProps$
|
|
152
|
+
...defaultProps$1m,
|
|
153
153
|
...props
|
|
154
154
|
};
|
|
155
155
|
const getStyle = useCallback(() => {
|
|
@@ -172,7 +172,7 @@ const Button = (props) => {
|
|
|
172
172
|
const prefixCls = "nut-button";
|
|
173
173
|
return [
|
|
174
174
|
prefixCls,
|
|
175
|
-
`${
|
|
175
|
+
`${type4 ? `${prefixCls}--${type4}` : ""}`,
|
|
176
176
|
`${size ? `${prefixCls}--${size}` : ""}`,
|
|
177
177
|
`${shape ? `${prefixCls}--${shape}` : ""}`,
|
|
178
178
|
`${plain ? `${prefixCls}--plain` : ""}`,
|
|
@@ -180,7 +180,7 @@ const Button = (props) => {
|
|
|
180
180
|
`${disabled ? `${prefixCls}--disabled` : ""}`,
|
|
181
181
|
`${loading ? `${prefixCls}--loading` : ""}`
|
|
182
182
|
].filter(Boolean).join(" ");
|
|
183
|
-
}, [block, disabled, loading, plain, shape, size,
|
|
183
|
+
}, [block, disabled, loading, plain, shape, size, type4]);
|
|
184
184
|
const [btnName, setBtnName] = useState(classes());
|
|
185
185
|
const [btnStyle, setBtnStyle] = useState(getStyle());
|
|
186
186
|
useEffect(() => {
|
|
@@ -194,7 +194,7 @@ const Button = (props) => {
|
|
|
194
194
|
loading,
|
|
195
195
|
disabled,
|
|
196
196
|
style,
|
|
197
|
-
|
|
197
|
+
type4,
|
|
198
198
|
size,
|
|
199
199
|
block,
|
|
200
200
|
icon,
|
|
@@ -227,19 +227,19 @@ const Button = (props) => {
|
|
|
227
227
|
className: icon || loading ? "text" : ""
|
|
228
228
|
}, children)));
|
|
229
229
|
};
|
|
230
|
-
Button.defaultProps = defaultProps$
|
|
230
|
+
Button.defaultProps = defaultProps$1m;
|
|
231
231
|
Button.displayName = "NutButton";
|
|
232
|
-
function _setPrototypeOf(o, p2) {
|
|
233
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
|
|
232
|
+
function _setPrototypeOf$1(o, p2) {
|
|
233
|
+
_setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
|
|
234
234
|
o2.__proto__ = p3;
|
|
235
235
|
return o2;
|
|
236
236
|
};
|
|
237
|
-
return _setPrototypeOf(o, p2);
|
|
237
|
+
return _setPrototypeOf$1(o, p2);
|
|
238
238
|
}
|
|
239
|
-
function _inheritsLoose(subClass, superClass) {
|
|
239
|
+
function _inheritsLoose$1(subClass, superClass) {
|
|
240
240
|
subClass.prototype = Object.create(superClass.prototype);
|
|
241
241
|
subClass.prototype.constructor = subClass;
|
|
242
|
-
_setPrototypeOf(subClass, superClass);
|
|
242
|
+
_setPrototypeOf$1(subClass, superClass);
|
|
243
243
|
}
|
|
244
244
|
var propTypes = { exports: {} };
|
|
245
245
|
var ReactPropTypesSecret$1 = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
@@ -295,8 +295,8 @@ var factoryWithThrowingShims = function() {
|
|
|
295
295
|
propTypes.exports = factoryWithThrowingShims();
|
|
296
296
|
}
|
|
297
297
|
var PropTypes = propTypes.exports;
|
|
298
|
-
function _extends$
|
|
299
|
-
_extends$
|
|
298
|
+
function _extends$4() {
|
|
299
|
+
_extends$4 = Object.assign ? Object.assign.bind() : function(target) {
|
|
300
300
|
for (var i = 1; i < arguments.length; i++) {
|
|
301
301
|
var source = arguments[i];
|
|
302
302
|
for (var key in source) {
|
|
@@ -307,7 +307,7 @@ function _extends$3() {
|
|
|
307
307
|
}
|
|
308
308
|
return target;
|
|
309
309
|
};
|
|
310
|
-
return _extends$
|
|
310
|
+
return _extends$4.apply(this, arguments);
|
|
311
311
|
}
|
|
312
312
|
function isAbsolute(pathname) {
|
|
313
313
|
return pathname.charAt(0) === "/";
|
|
@@ -412,7 +412,7 @@ function createLocation(path, state, key, currentLocation) {
|
|
|
412
412
|
location = parsePath(path);
|
|
413
413
|
location.state = state;
|
|
414
414
|
} else {
|
|
415
|
-
location = _extends$
|
|
415
|
+
location = _extends$4({}, path);
|
|
416
416
|
if (location.pathname === void 0)
|
|
417
417
|
location.pathname = "";
|
|
418
418
|
if (location.search) {
|
|
@@ -519,7 +519,7 @@ function createMemoryHistory(props) {
|
|
|
519
519
|
var _props = props, getUserConfirmation = _props.getUserConfirmation, _props$initialEntries = _props.initialEntries, initialEntries = _props$initialEntries === void 0 ? ["/"] : _props$initialEntries, _props$initialIndex = _props.initialIndex, initialIndex = _props$initialIndex === void 0 ? 0 : _props$initialIndex, _props$keyLength = _props.keyLength, keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
|
|
520
520
|
var transitionManager = createTransitionManager();
|
|
521
521
|
function setState(nextState) {
|
|
522
|
-
_extends$
|
|
522
|
+
_extends$4(history, nextState);
|
|
523
523
|
history.length = history.entries.length;
|
|
524
524
|
transitionManager.notifyListeners(history.location, history.action);
|
|
525
525
|
}
|
|
@@ -665,7 +665,7 @@ function parse$1(str, options2) {
|
|
|
665
665
|
var repeat = modifier === "+" || modifier === "*";
|
|
666
666
|
var optional = modifier === "?" || modifier === "*";
|
|
667
667
|
var delimiter = res[2] || defaultDelimiter;
|
|
668
|
-
var
|
|
668
|
+
var pattern4 = capture || group;
|
|
669
669
|
tokens.push({
|
|
670
670
|
name: name || key++,
|
|
671
671
|
prefix: prefix2 || "",
|
|
@@ -674,7 +674,7 @@ function parse$1(str, options2) {
|
|
|
674
674
|
repeat,
|
|
675
675
|
partial,
|
|
676
676
|
asterisk: !!asterisk,
|
|
677
|
-
pattern:
|
|
677
|
+
pattern: pattern4 ? escapeGroup(pattern4) : asterisk ? ".*" : "[^" + escapeString(delimiter) + "]+?"
|
|
678
678
|
});
|
|
679
679
|
}
|
|
680
680
|
if (index < str.length) {
|
|
@@ -793,8 +793,8 @@ function arrayToRegexp(path, keys, options2) {
|
|
|
793
793
|
for (var i = 0; i < path.length; i++) {
|
|
794
794
|
parts.push(pathToRegexp(path[i], keys, options2).source);
|
|
795
795
|
}
|
|
796
|
-
var
|
|
797
|
-
return attachKeys(
|
|
796
|
+
var regexp4 = new RegExp("(?:" + parts.join("|") + ")", flags(options2));
|
|
797
|
+
return attachKeys(regexp4, keys);
|
|
798
798
|
}
|
|
799
799
|
function stringToRegexp(path, keys, options2) {
|
|
800
800
|
return tokensToRegExp(parse$1(path, options2), keys, options2);
|
|
@@ -1034,7 +1034,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
1034
1034
|
var _Provider$childContex, _Consumer$contextType;
|
|
1035
1035
|
var contextProp = "__create-react-context-" + getUniqueId() + "__";
|
|
1036
1036
|
var Provider = /* @__PURE__ */ function(_React$Component) {
|
|
1037
|
-
_inheritsLoose(Provider2, _React$Component);
|
|
1037
|
+
_inheritsLoose$1(Provider2, _React$Component);
|
|
1038
1038
|
function Provider2() {
|
|
1039
1039
|
var _this;
|
|
1040
1040
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1072,7 +1072,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
1072
1072
|
}(React__default.Component);
|
|
1073
1073
|
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = PropTypes.object.isRequired, _Provider$childContex);
|
|
1074
1074
|
var Consumer = /* @__PURE__ */ function(_React$Component2) {
|
|
1075
|
-
_inheritsLoose(Consumer2, _React$Component2);
|
|
1075
|
+
_inheritsLoose$1(Consumer2, _React$Component2);
|
|
1076
1076
|
function Consumer2() {
|
|
1077
1077
|
var _this2;
|
|
1078
1078
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
@@ -1110,7 +1110,7 @@ function createReactContext(defaultValue, calculateChangedBits) {
|
|
|
1110
1110
|
this.context[contextProp].off(this.onUpdate);
|
|
1111
1111
|
}
|
|
1112
1112
|
};
|
|
1113
|
-
_proto2.getValue = function
|
|
1113
|
+
_proto2.getValue = function getValue2() {
|
|
1114
1114
|
if (this.context[contextProp]) {
|
|
1115
1115
|
return this.context[contextProp].get();
|
|
1116
1116
|
} else {
|
|
@@ -1137,7 +1137,7 @@ var createNamedContext = function createNamedContext2(name) {
|
|
|
1137
1137
|
var historyContext = /* @__PURE__ */ createNamedContext("Router-History");
|
|
1138
1138
|
var context = /* @__PURE__ */ createNamedContext("Router");
|
|
1139
1139
|
var Router = /* @__PURE__ */ function(_React$Component) {
|
|
1140
|
-
_inheritsLoose(Router2, _React$Component);
|
|
1140
|
+
_inheritsLoose$1(Router2, _React$Component);
|
|
1141
1141
|
Router2.computeRootMatch = function computeRootMatch(pathname) {
|
|
1142
1142
|
return {
|
|
1143
1143
|
path: "/",
|
|
@@ -1206,7 +1206,7 @@ var Router = /* @__PURE__ */ function(_React$Component) {
|
|
|
1206
1206
|
return Router2;
|
|
1207
1207
|
}(React__default.Component);
|
|
1208
1208
|
/* @__PURE__ */ (function(_React$Component) {
|
|
1209
|
-
_inheritsLoose(MemoryRouter, _React$Component);
|
|
1209
|
+
_inheritsLoose$1(MemoryRouter, _React$Component);
|
|
1210
1210
|
function MemoryRouter() {
|
|
1211
1211
|
var _this;
|
|
1212
1212
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1226,7 +1226,7 @@ var Router = /* @__PURE__ */ function(_React$Component) {
|
|
|
1226
1226
|
return MemoryRouter;
|
|
1227
1227
|
})(React__default.Component);
|
|
1228
1228
|
/* @__PURE__ */ (function(_React$Component) {
|
|
1229
|
-
_inheritsLoose(Lifecycle, _React$Component);
|
|
1229
|
+
_inheritsLoose$1(Lifecycle, _React$Component);
|
|
1230
1230
|
function Lifecycle() {
|
|
1231
1231
|
return _React$Component.apply(this, arguments) || this;
|
|
1232
1232
|
}
|
|
@@ -1257,9 +1257,9 @@ function compilePath$1(path, options2) {
|
|
|
1257
1257
|
if (pathCache[path])
|
|
1258
1258
|
return pathCache[path];
|
|
1259
1259
|
var keys = [];
|
|
1260
|
-
var
|
|
1260
|
+
var regexp4 = pathToRegexp$1(path, keys, options2);
|
|
1261
1261
|
var result = {
|
|
1262
|
-
regexp,
|
|
1262
|
+
regexp: regexp4,
|
|
1263
1263
|
keys
|
|
1264
1264
|
};
|
|
1265
1265
|
if (cacheCount$1 < cacheLimit$1) {
|
|
@@ -1288,17 +1288,17 @@ function matchPath(pathname, options2) {
|
|
|
1288
1288
|
end: exact,
|
|
1289
1289
|
strict,
|
|
1290
1290
|
sensitive
|
|
1291
|
-
}),
|
|
1292
|
-
var match =
|
|
1291
|
+
}), regexp4 = _compilePath.regexp, keys = _compilePath.keys;
|
|
1292
|
+
var match = regexp4.exec(pathname);
|
|
1293
1293
|
if (!match)
|
|
1294
1294
|
return null;
|
|
1295
|
-
var
|
|
1296
|
-
var isExact = pathname ===
|
|
1295
|
+
var url2 = match[0], values = match.slice(1);
|
|
1296
|
+
var isExact = pathname === url2;
|
|
1297
1297
|
if (exact && !isExact)
|
|
1298
1298
|
return null;
|
|
1299
1299
|
return {
|
|
1300
1300
|
path: path2,
|
|
1301
|
-
url: path2 === "/" &&
|
|
1301
|
+
url: path2 === "/" && url2 === "" ? "/" : url2,
|
|
1302
1302
|
isExact,
|
|
1303
1303
|
params: keys.reduce(function(memo2, key, index) {
|
|
1304
1304
|
memo2[key.name] = values[index];
|
|
@@ -1311,7 +1311,7 @@ function isEmptyChildren(children) {
|
|
|
1311
1311
|
return React__default.Children.count(children) === 0;
|
|
1312
1312
|
}
|
|
1313
1313
|
/* @__PURE__ */ (function(_React$Component) {
|
|
1314
|
-
_inheritsLoose(Route, _React$Component);
|
|
1314
|
+
_inheritsLoose$1(Route, _React$Component);
|
|
1315
1315
|
function Route() {
|
|
1316
1316
|
return _React$Component.apply(this, arguments) || this;
|
|
1317
1317
|
}
|
|
@@ -1322,7 +1322,7 @@ function isEmptyChildren(children) {
|
|
|
1322
1322
|
!context$1 ? invariant(false) : void 0;
|
|
1323
1323
|
var location = _this.props.location || context$1.location;
|
|
1324
1324
|
var match = _this.props.computedMatch ? _this.props.computedMatch : _this.props.path ? matchPath(location.pathname, _this.props) : context$1.match;
|
|
1325
|
-
var props = _extends$
|
|
1325
|
+
var props = _extends$4({}, context$1, {
|
|
1326
1326
|
location,
|
|
1327
1327
|
match
|
|
1328
1328
|
});
|
|
@@ -1343,7 +1343,7 @@ function addLeadingSlash(path) {
|
|
|
1343
1343
|
function addBasename(basename, location) {
|
|
1344
1344
|
if (!basename)
|
|
1345
1345
|
return location;
|
|
1346
|
-
return _extends$
|
|
1346
|
+
return _extends$4({}, location, {
|
|
1347
1347
|
pathname: addLeadingSlash(basename) + location.pathname
|
|
1348
1348
|
});
|
|
1349
1349
|
}
|
|
@@ -1353,7 +1353,7 @@ function stripBasename(basename, location) {
|
|
|
1353
1353
|
var base = addLeadingSlash(basename);
|
|
1354
1354
|
if (location.pathname.indexOf(base) !== 0)
|
|
1355
1355
|
return location;
|
|
1356
|
-
return _extends$
|
|
1356
|
+
return _extends$4({}, location, {
|
|
1357
1357
|
pathname: location.pathname.substr(base.length)
|
|
1358
1358
|
});
|
|
1359
1359
|
}
|
|
@@ -1368,7 +1368,7 @@ function staticHandler(methodName) {
|
|
|
1368
1368
|
function noop$3() {
|
|
1369
1369
|
}
|
|
1370
1370
|
/* @__PURE__ */ (function(_React$Component) {
|
|
1371
|
-
_inheritsLoose(StaticRouter, _React$Component);
|
|
1371
|
+
_inheritsLoose$1(StaticRouter, _React$Component);
|
|
1372
1372
|
function StaticRouter() {
|
|
1373
1373
|
var _this;
|
|
1374
1374
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -1412,7 +1412,7 @@ function noop$3() {
|
|
|
1412
1412
|
listen: this.handleListen,
|
|
1413
1413
|
block: this.handleBlock
|
|
1414
1414
|
};
|
|
1415
|
-
return /* @__PURE__ */ React__default.createElement(Router, _extends$
|
|
1415
|
+
return /* @__PURE__ */ React__default.createElement(Router, _extends$4({}, rest, {
|
|
1416
1416
|
history,
|
|
1417
1417
|
staticContext: context2
|
|
1418
1418
|
}));
|
|
@@ -1420,7 +1420,7 @@ function noop$3() {
|
|
|
1420
1420
|
return StaticRouter;
|
|
1421
1421
|
})(React__default.Component);
|
|
1422
1422
|
/* @__PURE__ */ (function(_React$Component) {
|
|
1423
|
-
_inheritsLoose(Switch2, _React$Component);
|
|
1423
|
+
_inheritsLoose$1(Switch2, _React$Component);
|
|
1424
1424
|
function Switch2() {
|
|
1425
1425
|
return _React$Component.apply(this, arguments) || this;
|
|
1426
1426
|
}
|
|
@@ -1435,7 +1435,7 @@ function noop$3() {
|
|
|
1435
1435
|
if (match == null && /* @__PURE__ */ React__default.isValidElement(child)) {
|
|
1436
1436
|
element = child;
|
|
1437
1437
|
var path = child.props.path || child.props.from;
|
|
1438
|
-
match = path ? matchPath(location.pathname, _extends$
|
|
1438
|
+
match = path ? matchPath(location.pathname, _extends$4({}, child.props, {
|
|
1439
1439
|
path
|
|
1440
1440
|
})) : context2.match;
|
|
1441
1441
|
}
|
|
@@ -1452,7 +1452,7 @@ var useContext = React__default.useContext;
|
|
|
1452
1452
|
function useHistory() {
|
|
1453
1453
|
return useContext(historyContext);
|
|
1454
1454
|
}
|
|
1455
|
-
const defaultProps$
|
|
1455
|
+
const defaultProps$1l = {
|
|
1456
1456
|
...ComponentDefaults,
|
|
1457
1457
|
title: null,
|
|
1458
1458
|
subTitle: null,
|
|
@@ -1486,7 +1486,7 @@ const Cell = (props) => {
|
|
|
1486
1486
|
isLink,
|
|
1487
1487
|
icon,
|
|
1488
1488
|
roundRadius,
|
|
1489
|
-
url,
|
|
1489
|
+
url: url2,
|
|
1490
1490
|
to: to2,
|
|
1491
1491
|
replace,
|
|
1492
1492
|
center,
|
|
@@ -1498,7 +1498,7 @@ const Cell = (props) => {
|
|
|
1498
1498
|
iconFontClassName,
|
|
1499
1499
|
...rest
|
|
1500
1500
|
} = {
|
|
1501
|
-
...defaultProps$
|
|
1501
|
+
...defaultProps$1l,
|
|
1502
1502
|
...props
|
|
1503
1503
|
};
|
|
1504
1504
|
const b2 = cn("cell");
|
|
@@ -1508,8 +1508,8 @@ const Cell = (props) => {
|
|
|
1508
1508
|
onClick(event);
|
|
1509
1509
|
if (to2 && history) {
|
|
1510
1510
|
history[replace ? "replace" : "push"](to2);
|
|
1511
|
-
} else if (
|
|
1512
|
-
replace ? window.location.replace(
|
|
1511
|
+
} else if (url2) {
|
|
1512
|
+
replace ? window.location.replace(url2) : window.location.href = url2;
|
|
1513
1513
|
}
|
|
1514
1514
|
};
|
|
1515
1515
|
const baseStyle = {
|
|
@@ -1552,9 +1552,9 @@ const Cell = (props) => {
|
|
|
1552
1552
|
className: b2("link")
|
|
1553
1553
|
}) : linkSlot));
|
|
1554
1554
|
};
|
|
1555
|
-
Cell.defaultProps = defaultProps$
|
|
1555
|
+
Cell.defaultProps = defaultProps$1l;
|
|
1556
1556
|
Cell.displayName = "NutCell";
|
|
1557
|
-
const defaultProps$
|
|
1557
|
+
const defaultProps$1k = {
|
|
1558
1558
|
title: "",
|
|
1559
1559
|
desc: "",
|
|
1560
1560
|
className: "",
|
|
@@ -1563,7 +1563,7 @@ const defaultProps$1i = {
|
|
|
1563
1563
|
};
|
|
1564
1564
|
const CellGroup = (props) => {
|
|
1565
1565
|
const { children, className, title, desc, titleSlot, descSlot } = {
|
|
1566
|
-
...defaultProps$
|
|
1566
|
+
...defaultProps$1k,
|
|
1567
1567
|
...props
|
|
1568
1568
|
};
|
|
1569
1569
|
const b2 = cn("cell-group");
|
|
@@ -1577,7 +1577,7 @@ const CellGroup = (props) => {
|
|
|
1577
1577
|
className: b2("wrap")
|
|
1578
1578
|
}, children));
|
|
1579
1579
|
};
|
|
1580
|
-
CellGroup.defaultProps = defaultProps$
|
|
1580
|
+
CellGroup.defaultProps = defaultProps$1k;
|
|
1581
1581
|
CellGroup.displayName = "NutCellGroup";
|
|
1582
1582
|
var classnames = { exports: {} };
|
|
1583
1583
|
/*!
|
|
@@ -1745,7 +1745,7 @@ var ENTERING = "entering";
|
|
|
1745
1745
|
var ENTERED = "entered";
|
|
1746
1746
|
var EXITING = "exiting";
|
|
1747
1747
|
var Transition = /* @__PURE__ */ function(_React$Component) {
|
|
1748
|
-
_inheritsLoose(Transition2, _React$Component);
|
|
1748
|
+
_inheritsLoose$1(Transition2, _React$Component);
|
|
1749
1749
|
function Transition2(props, context2) {
|
|
1750
1750
|
var _this;
|
|
1751
1751
|
_this = _React$Component.call(this, props, context2) || this;
|
|
@@ -2002,7 +2002,7 @@ var removeClass = function removeClass2(node, classes) {
|
|
|
2002
2002
|
});
|
|
2003
2003
|
};
|
|
2004
2004
|
var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
2005
|
-
_inheritsLoose(CSSTransition2, _React$Component);
|
|
2005
|
+
_inheritsLoose$1(CSSTransition2, _React$Component);
|
|
2006
2006
|
function CSSTransition2() {
|
|
2007
2007
|
var _this;
|
|
2008
2008
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2024,17 +2024,17 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
2024
2024
|
};
|
|
2025
2025
|
_this.onEntering = function(maybeNode, maybeAppearing) {
|
|
2026
2026
|
var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument2[0], appearing = _this$resolveArgument2[1];
|
|
2027
|
-
var
|
|
2028
|
-
_this.addClass(node,
|
|
2027
|
+
var type4 = appearing ? "appear" : "enter";
|
|
2028
|
+
_this.addClass(node, type4, "active");
|
|
2029
2029
|
if (_this.props.onEntering) {
|
|
2030
2030
|
_this.props.onEntering(maybeNode, maybeAppearing);
|
|
2031
2031
|
}
|
|
2032
2032
|
};
|
|
2033
2033
|
_this.onEntered = function(maybeNode, maybeAppearing) {
|
|
2034
2034
|
var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing), node = _this$resolveArgument3[0], appearing = _this$resolveArgument3[1];
|
|
2035
|
-
var
|
|
2036
|
-
_this.removeClasses(node,
|
|
2037
|
-
_this.addClass(node,
|
|
2035
|
+
var type4 = appearing ? "appear" : "enter";
|
|
2036
|
+
_this.removeClasses(node, type4);
|
|
2037
|
+
_this.addClass(node, type4, "done");
|
|
2038
2038
|
if (_this.props.onEntered) {
|
|
2039
2039
|
_this.props.onEntered(maybeNode, maybeAppearing);
|
|
2040
2040
|
}
|
|
@@ -2066,13 +2066,13 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
2066
2066
|
_this.resolveArguments = function(maybeNode, maybeAppearing) {
|
|
2067
2067
|
return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] : [maybeNode, maybeAppearing];
|
|
2068
2068
|
};
|
|
2069
|
-
_this.getClassNames = function(
|
|
2069
|
+
_this.getClassNames = function(type4) {
|
|
2070
2070
|
var classNames2 = _this.props.classNames;
|
|
2071
2071
|
var isStringClassNames = typeof classNames2 === "string";
|
|
2072
2072
|
var prefix2 = isStringClassNames && classNames2 ? classNames2 + "-" : "";
|
|
2073
|
-
var baseClassName = isStringClassNames ? "" + prefix2 +
|
|
2074
|
-
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[
|
|
2075
|
-
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[
|
|
2073
|
+
var baseClassName = isStringClassNames ? "" + prefix2 + type4 : classNames2[type4];
|
|
2074
|
+
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames2[type4 + "Active"];
|
|
2075
|
+
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames2[type4 + "Done"];
|
|
2076
2076
|
return {
|
|
2077
2077
|
baseClassName,
|
|
2078
2078
|
activeClassName,
|
|
@@ -2082,10 +2082,10 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
2082
2082
|
return _this;
|
|
2083
2083
|
}
|
|
2084
2084
|
var _proto = CSSTransition2.prototype;
|
|
2085
|
-
_proto.addClass = function addClass2(node,
|
|
2086
|
-
var className = this.getClassNames(
|
|
2085
|
+
_proto.addClass = function addClass2(node, type4, phase) {
|
|
2086
|
+
var className = this.getClassNames(type4)[phase + "ClassName"];
|
|
2087
2087
|
var _this$getClassNames = this.getClassNames("enter"), doneClassName = _this$getClassNames.doneClassName;
|
|
2088
|
-
if (
|
|
2088
|
+
if (type4 === "appear" && phase === "done" && doneClassName) {
|
|
2089
2089
|
className += " " + doneClassName;
|
|
2090
2090
|
}
|
|
2091
2091
|
if (phase === "active") {
|
|
@@ -2093,13 +2093,13 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
2093
2093
|
forceReflow(node);
|
|
2094
2094
|
}
|
|
2095
2095
|
if (className) {
|
|
2096
|
-
this.appliedClasses[
|
|
2096
|
+
this.appliedClasses[type4][phase] = className;
|
|
2097
2097
|
_addClass(node, className);
|
|
2098
2098
|
}
|
|
2099
2099
|
};
|
|
2100
|
-
_proto.removeClasses = function removeClasses(node,
|
|
2101
|
-
var _this$appliedClasses$ = this.appliedClasses[
|
|
2102
|
-
this.appliedClasses[
|
|
2100
|
+
_proto.removeClasses = function removeClasses(node, type4) {
|
|
2101
|
+
var _this$appliedClasses$ = this.appliedClasses[type4], baseClassName = _this$appliedClasses$.base, activeClassName = _this$appliedClasses$.active, doneClassName = _this$appliedClasses$.done;
|
|
2102
|
+
this.appliedClasses[type4] = {};
|
|
2103
2103
|
if (baseClassName) {
|
|
2104
2104
|
removeClass(node, baseClassName);
|
|
2105
2105
|
}
|
|
@@ -2114,7 +2114,7 @@ var CSSTransition = /* @__PURE__ */ function(_React$Component) {
|
|
|
2114
2114
|
var _this$props = this.props;
|
|
2115
2115
|
_this$props.classNames;
|
|
2116
2116
|
var props = _objectWithoutPropertiesLoose$3(_this$props, ["classNames"]);
|
|
2117
|
-
return /* @__PURE__ */ React__default.createElement(Transition$1, _extends$
|
|
2117
|
+
return /* @__PURE__ */ React__default.createElement(Transition$1, _extends$4({}, props, {
|
|
2118
2118
|
onEnter: this.onEnter,
|
|
2119
2119
|
onEntered: this.onEntered,
|
|
2120
2120
|
onEntering: this.onEntering,
|
|
@@ -2130,7 +2130,7 @@ CSSTransition.defaultProps = {
|
|
|
2130
2130
|
};
|
|
2131
2131
|
CSSTransition.propTypes = {};
|
|
2132
2132
|
var CSSTransition$1 = CSSTransition;
|
|
2133
|
-
const defaultProps$
|
|
2133
|
+
const defaultProps$1j = {
|
|
2134
2134
|
...ComponentDefaults,
|
|
2135
2135
|
position: "center",
|
|
2136
2136
|
transition: "",
|
|
@@ -2316,7 +2316,7 @@ const Popup = (props) => {
|
|
|
2316
2316
|
}, [position]);
|
|
2317
2317
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderToContainer(teleport, renderNode()));
|
|
2318
2318
|
};
|
|
2319
|
-
Popup.defaultProps = defaultProps$
|
|
2319
|
+
Popup.defaultProps = defaultProps$1j;
|
|
2320
2320
|
Popup.displayName = "NutPopup";
|
|
2321
2321
|
const zhCN = {
|
|
2322
2322
|
save: "\u4FDD\u5B58",
|
|
@@ -2443,7 +2443,7 @@ const zhCN = {
|
|
|
2443
2443
|
completeText: "\u5237\u65B0\u6210\u529F"
|
|
2444
2444
|
}
|
|
2445
2445
|
};
|
|
2446
|
-
const defaultProps$
|
|
2446
|
+
const defaultProps$1i = {
|
|
2447
2447
|
locale: zhCN
|
|
2448
2448
|
};
|
|
2449
2449
|
const defaultConfigRef = {
|
|
@@ -2460,7 +2460,7 @@ const useConfig = () => {
|
|
|
2460
2460
|
};
|
|
2461
2461
|
const ConfigContext = createContext$1(null);
|
|
2462
2462
|
const ConfigProvider = (props) => {
|
|
2463
|
-
const { children, ...config2 } = { ...defaultProps$
|
|
2463
|
+
const { children, ...config2 } = { ...defaultProps$1i, ...props };
|
|
2464
2464
|
const parentConfig = useConfig();
|
|
2465
2465
|
return /* @__PURE__ */ React__default.createElement(ConfigContext.Provider, {
|
|
2466
2466
|
value: {
|
|
@@ -2469,19 +2469,19 @@ const ConfigProvider = (props) => {
|
|
|
2469
2469
|
}
|
|
2470
2470
|
}, children);
|
|
2471
2471
|
};
|
|
2472
|
-
ConfigProvider.defaultProps = defaultProps$
|
|
2472
|
+
ConfigProvider.defaultProps = defaultProps$1i;
|
|
2473
2473
|
ConfigProvider.displayName = "NutConfigProvider";
|
|
2474
|
-
const defaultProps$
|
|
2474
|
+
const defaultProps$1h = {};
|
|
2475
2475
|
const Layout = (props) => {
|
|
2476
|
-
({ ...defaultProps$
|
|
2476
|
+
({ ...defaultProps$1h, ...props });
|
|
2477
2477
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
2478
2478
|
className: "nut-layout"
|
|
2479
2479
|
}, "Layout");
|
|
2480
2480
|
};
|
|
2481
|
-
Layout.defaultProps = defaultProps$
|
|
2481
|
+
Layout.defaultProps = defaultProps$1h;
|
|
2482
2482
|
Layout.displayName = "NutLayout";
|
|
2483
2483
|
const DataContext$2 = createContext$1({});
|
|
2484
|
-
const defaultProps$
|
|
2484
|
+
const defaultProps$1g = {
|
|
2485
2485
|
span: "24",
|
|
2486
2486
|
offset: "0",
|
|
2487
2487
|
gutter: "0"
|
|
@@ -2494,7 +2494,7 @@ const Col = (props) => {
|
|
|
2494
2494
|
offset,
|
|
2495
2495
|
children,
|
|
2496
2496
|
onClick
|
|
2497
|
-
} = { ...defaultProps$
|
|
2497
|
+
} = { ...defaultProps$1g, ...props };
|
|
2498
2498
|
const [colName, setColName] = useState("");
|
|
2499
2499
|
const [colStyle, setColStyle] = useState({});
|
|
2500
2500
|
const { gutter } = useContext$1(DataContext$2);
|
|
@@ -2520,9 +2520,9 @@ const Col = (props) => {
|
|
|
2520
2520
|
}
|
|
2521
2521
|
}, children);
|
|
2522
2522
|
};
|
|
2523
|
-
Col.defaultProps = defaultProps$
|
|
2523
|
+
Col.defaultProps = defaultProps$1g;
|
|
2524
2524
|
Col.displayName = "NutCol";
|
|
2525
|
-
const defaultProps$
|
|
2525
|
+
const defaultProps$1f = {
|
|
2526
2526
|
type: "",
|
|
2527
2527
|
justify: "start",
|
|
2528
2528
|
align: "flex-start",
|
|
@@ -2534,25 +2534,25 @@ const Row = (props) => {
|
|
|
2534
2534
|
className,
|
|
2535
2535
|
style = {},
|
|
2536
2536
|
children,
|
|
2537
|
-
type,
|
|
2537
|
+
type: type4,
|
|
2538
2538
|
justify,
|
|
2539
2539
|
align,
|
|
2540
2540
|
wrap,
|
|
2541
2541
|
gutter,
|
|
2542
2542
|
onClick
|
|
2543
2543
|
} = {
|
|
2544
|
-
...defaultProps$
|
|
2544
|
+
...defaultProps$1f,
|
|
2545
2545
|
...props
|
|
2546
2546
|
};
|
|
2547
2547
|
const prefixCls = "nut-row";
|
|
2548
|
-
const getClass = (prefix2,
|
|
2549
|
-
const classType =
|
|
2550
|
-
const className2 = prefix2 ? classType : `nut-row-${
|
|
2548
|
+
const getClass = (prefix2, type22) => {
|
|
2549
|
+
const classType = type22 ? `nut-row-${prefix2}-${type22}` : "";
|
|
2550
|
+
const className2 = prefix2 ? classType : `nut-row-${type22}`;
|
|
2551
2551
|
return className2;
|
|
2552
2552
|
};
|
|
2553
2553
|
const getClasses = () => {
|
|
2554
2554
|
return `
|
|
2555
|
-
${getClass("",
|
|
2555
|
+
${getClass("", type4)}
|
|
2556
2556
|
${getClass("justify", justify)}
|
|
2557
2557
|
${getClass("align", align)}
|
|
2558
2558
|
${getClass("flex", wrap)}
|
|
@@ -2576,9 +2576,9 @@ const Row = (props) => {
|
|
|
2576
2576
|
children
|
|
2577
2577
|
));
|
|
2578
2578
|
};
|
|
2579
|
-
Row.defaultProps = defaultProps$
|
|
2579
|
+
Row.defaultProps = defaultProps$1f;
|
|
2580
2580
|
Row.displayName = "NutRow";
|
|
2581
|
-
const defaultProps$
|
|
2581
|
+
const defaultProps$1e = {
|
|
2582
2582
|
contentPosition: "center",
|
|
2583
2583
|
dashed: false,
|
|
2584
2584
|
hairline: true,
|
|
@@ -2595,7 +2595,7 @@ const Divider = (props) => {
|
|
|
2595
2595
|
direction,
|
|
2596
2596
|
...rest
|
|
2597
2597
|
} = {
|
|
2598
|
-
...defaultProps$
|
|
2598
|
+
...defaultProps$1e,
|
|
2599
2599
|
...props
|
|
2600
2600
|
};
|
|
2601
2601
|
const dividerBem = cn("divider");
|
|
@@ -2616,9 +2616,9 @@ const Divider = (props) => {
|
|
|
2616
2616
|
...rest
|
|
2617
2617
|
}, children);
|
|
2618
2618
|
};
|
|
2619
|
-
Divider.defaultProps = defaultProps$
|
|
2619
|
+
Divider.defaultProps = defaultProps$1e;
|
|
2620
2620
|
Divider.displayName = "NutDivider";
|
|
2621
|
-
const defaultProps$
|
|
2621
|
+
const defaultProps$1d = {
|
|
2622
2622
|
columnNum: 4,
|
|
2623
2623
|
border: true,
|
|
2624
2624
|
gutter: 0,
|
|
@@ -2645,7 +2645,7 @@ const Grid = (props) => {
|
|
|
2645
2645
|
iconColor,
|
|
2646
2646
|
className,
|
|
2647
2647
|
...rest
|
|
2648
|
-
} = { ...defaultProps$
|
|
2648
|
+
} = { ...defaultProps$1d, ...props };
|
|
2649
2649
|
const childrenDom = React__default.Children.toArray(children);
|
|
2650
2650
|
const pxCheck2 = (value) => {
|
|
2651
2651
|
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
@@ -2684,9 +2684,9 @@ const Grid = (props) => {
|
|
|
2684
2684
|
});
|
|
2685
2685
|
}));
|
|
2686
2686
|
};
|
|
2687
|
-
Grid.defaultProps = defaultProps$
|
|
2687
|
+
Grid.defaultProps = defaultProps$1d;
|
|
2688
2688
|
Grid.displayName = "NutGrid";
|
|
2689
|
-
const defaultProps$
|
|
2689
|
+
const defaultProps$1c = {
|
|
2690
2690
|
...ComponentDefaults,
|
|
2691
2691
|
text: "",
|
|
2692
2692
|
icon: "",
|
|
@@ -2725,7 +2725,7 @@ const GridItem = (props) => {
|
|
|
2725
2725
|
onClick,
|
|
2726
2726
|
...rest
|
|
2727
2727
|
} = {
|
|
2728
|
-
...defaultProps$
|
|
2728
|
+
...defaultProps$1c,
|
|
2729
2729
|
...props
|
|
2730
2730
|
};
|
|
2731
2731
|
const b2 = cn("grid-item");
|
|
@@ -2773,7 +2773,7 @@ const GridItem = (props) => {
|
|
|
2773
2773
|
className: "nut-grid-item__text"
|
|
2774
2774
|
}, text), children && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children)));
|
|
2775
2775
|
};
|
|
2776
|
-
GridItem.defaultProps = defaultProps$
|
|
2776
|
+
GridItem.defaultProps = defaultProps$1c;
|
|
2777
2777
|
GridItem.displayName = "NutGridItem";
|
|
2778
2778
|
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
2779
2779
|
const defaultRoot = canUseDom ? window : void 0;
|
|
@@ -2987,7 +2987,7 @@ const Sticky = (props) => {
|
|
|
2987
2987
|
}, children));
|
|
2988
2988
|
};
|
|
2989
2989
|
Sticky.displayName = "NutSticky";
|
|
2990
|
-
const defaultProps$
|
|
2990
|
+
const defaultProps$1b = {
|
|
2991
2991
|
...ComponentDefaults,
|
|
2992
2992
|
title: "",
|
|
2993
2993
|
desc: "",
|
|
@@ -3023,7 +3023,7 @@ const NavBar = (props) => {
|
|
|
3023
3023
|
iconClassPrefix,
|
|
3024
3024
|
iconFontClassName
|
|
3025
3025
|
} = {
|
|
3026
|
-
...defaultProps$
|
|
3026
|
+
...defaultProps$1b,
|
|
3027
3027
|
...props
|
|
3028
3028
|
};
|
|
3029
3029
|
const b2 = cn("navbar");
|
|
@@ -3092,9 +3092,9 @@ const NavBar = (props) => {
|
|
|
3092
3092
|
className: `${b2("")}--placeholder`
|
|
3093
3093
|
}, renderWrapper()) : renderWrapper());
|
|
3094
3094
|
};
|
|
3095
|
-
NavBar.defaultProps = defaultProps$
|
|
3095
|
+
NavBar.defaultProps = defaultProps$1b;
|
|
3096
3096
|
NavBar.displayName = "NutNavBar";
|
|
3097
|
-
const defaultProps$
|
|
3097
|
+
const defaultProps$1a = {
|
|
3098
3098
|
...ComponentDefaults,
|
|
3099
3099
|
fixednavClass: "nut-fixednav",
|
|
3100
3100
|
activeText: "",
|
|
@@ -3117,14 +3117,14 @@ const FixedNav = (props) => {
|
|
|
3117
3117
|
position,
|
|
3118
3118
|
onChange,
|
|
3119
3119
|
onSelected,
|
|
3120
|
-
type,
|
|
3120
|
+
type: type4,
|
|
3121
3121
|
slotList,
|
|
3122
3122
|
slotBtn,
|
|
3123
3123
|
iconClassPrefix,
|
|
3124
3124
|
iconFontClassName,
|
|
3125
3125
|
...rest
|
|
3126
3126
|
} = {
|
|
3127
|
-
...defaultProps$
|
|
3127
|
+
...defaultProps$1a,
|
|
3128
3128
|
...props
|
|
3129
3129
|
};
|
|
3130
3130
|
const b2 = cn("fixednav");
|
|
@@ -3132,7 +3132,7 @@ const FixedNav = (props) => {
|
|
|
3132
3132
|
{
|
|
3133
3133
|
active: visible
|
|
3134
3134
|
},
|
|
3135
|
-
|
|
3135
|
+
type4,
|
|
3136
3136
|
fixednavClass,
|
|
3137
3137
|
b2("")
|
|
3138
3138
|
);
|
|
@@ -3179,9 +3179,9 @@ const FixedNav = (props) => {
|
|
|
3179
3179
|
className: "text"
|
|
3180
3180
|
}, visible ? activeText || locale.fixednav.activeText : unActiveText || locale.fixednav.unActiveText))));
|
|
3181
3181
|
};
|
|
3182
|
-
FixedNav.defaultProps = defaultProps$
|
|
3182
|
+
FixedNav.defaultProps = defaultProps$1a;
|
|
3183
3183
|
FixedNav.displayName = "NutFixedNav";
|
|
3184
|
-
const defaultProps$
|
|
3184
|
+
const defaultProps$19 = {
|
|
3185
3185
|
visible: 0,
|
|
3186
3186
|
bottom: false,
|
|
3187
3187
|
size: 20,
|
|
@@ -3209,7 +3209,7 @@ const Tabbar = (props) => {
|
|
|
3209
3209
|
tabSwitch,
|
|
3210
3210
|
onSwitch
|
|
3211
3211
|
} = {
|
|
3212
|
-
...defaultProps$
|
|
3212
|
+
...defaultProps$19,
|
|
3213
3213
|
...props
|
|
3214
3214
|
};
|
|
3215
3215
|
const b2 = cn("tabbar");
|
|
@@ -3245,9 +3245,9 @@ const Tabbar = (props) => {
|
|
|
3245
3245
|
return React__default.cloneElement(child, childProps);
|
|
3246
3246
|
}));
|
|
3247
3247
|
};
|
|
3248
|
-
Tabbar.defaultProps = defaultProps$
|
|
3248
|
+
Tabbar.defaultProps = defaultProps$19;
|
|
3249
3249
|
Tabbar.displayName = "NutTabbar";
|
|
3250
|
-
const defaultProps$
|
|
3250
|
+
const defaultProps$18 = {
|
|
3251
3251
|
...ComponentDefaults,
|
|
3252
3252
|
dot: false,
|
|
3253
3253
|
size: "",
|
|
@@ -3283,7 +3283,7 @@ const TabbarItem = (props) => {
|
|
|
3283
3283
|
iconClassPrefix,
|
|
3284
3284
|
iconFontClassName
|
|
3285
3285
|
} = {
|
|
3286
|
-
...defaultProps$
|
|
3286
|
+
...defaultProps$18,
|
|
3287
3287
|
...props
|
|
3288
3288
|
};
|
|
3289
3289
|
const b2 = cn("tabbar-item");
|
|
@@ -3381,12 +3381,12 @@ function _defineProperty(obj, key, value) {
|
|
|
3381
3381
|
}
|
|
3382
3382
|
return obj;
|
|
3383
3383
|
}
|
|
3384
|
-
function ownKeys(
|
|
3385
|
-
var keys = Object.keys(
|
|
3384
|
+
function ownKeys(object4, enumerableOnly) {
|
|
3385
|
+
var keys = Object.keys(object4);
|
|
3386
3386
|
if (Object.getOwnPropertySymbols) {
|
|
3387
|
-
var symbols = Object.getOwnPropertySymbols(
|
|
3387
|
+
var symbols = Object.getOwnPropertySymbols(object4);
|
|
3388
3388
|
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
3389
|
-
return Object.getOwnPropertyDescriptor(
|
|
3389
|
+
return Object.getOwnPropertyDescriptor(object4, sym).enumerable;
|
|
3390
3390
|
})), keys.push.apply(keys, symbols);
|
|
3391
3391
|
}
|
|
3392
3392
|
return keys;
|
|
@@ -3424,10 +3424,10 @@ const EVENT_TYPE_MAP = {
|
|
|
3424
3424
|
end: "end"
|
|
3425
3425
|
}
|
|
3426
3426
|
};
|
|
3427
|
-
function capitalize(
|
|
3428
|
-
if (!
|
|
3427
|
+
function capitalize(string3) {
|
|
3428
|
+
if (!string3)
|
|
3429
3429
|
return "";
|
|
3430
|
-
return
|
|
3430
|
+
return string3[0].toUpperCase() + string3.slice(1);
|
|
3431
3431
|
}
|
|
3432
3432
|
const actionsWithoutCaptureSupported = ["enter", "leave"];
|
|
3433
3433
|
function hasCapture(capture = false, actionKey) {
|
|
@@ -4326,11 +4326,11 @@ class PinchEngine extends Engine {
|
|
|
4326
4326
|
}
|
|
4327
4327
|
computeOffset() {
|
|
4328
4328
|
const {
|
|
4329
|
-
type,
|
|
4329
|
+
type: type4,
|
|
4330
4330
|
movement,
|
|
4331
4331
|
lastOffset
|
|
4332
4332
|
} = this.state;
|
|
4333
|
-
if (
|
|
4333
|
+
if (type4 === "wheel") {
|
|
4334
4334
|
this.state.offset = V.add(movement, lastOffset);
|
|
4335
4335
|
} else {
|
|
4336
4336
|
this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
|
|
@@ -4916,12 +4916,12 @@ class EventStore {
|
|
|
4916
4916
|
}
|
|
4917
4917
|
add(element, device, action, handler, options2) {
|
|
4918
4918
|
const listeners = this._listeners;
|
|
4919
|
-
const
|
|
4919
|
+
const type4 = toDomEventType(device, action);
|
|
4920
4920
|
const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {};
|
|
4921
4921
|
const eventOptions = _objectSpread2(_objectSpread2({}, _options), options2);
|
|
4922
|
-
element.addEventListener(
|
|
4922
|
+
element.addEventListener(type4, handler, eventOptions);
|
|
4923
4923
|
const remove = () => {
|
|
4924
|
-
element.removeEventListener(
|
|
4924
|
+
element.removeEventListener(type4, handler, eventOptions);
|
|
4925
4925
|
listeners.delete(remove);
|
|
4926
4926
|
};
|
|
4927
4927
|
listeners.add(remove);
|
|
@@ -5741,29 +5741,29 @@ function colorToRgba(input) {
|
|
|
5741
5741
|
let a = (int32Color & 255) / 255;
|
|
5742
5742
|
return `rgba(${r2}, ${g2}, ${b2}, ${a})`;
|
|
5743
5743
|
}
|
|
5744
|
-
const createInterpolator = (
|
|
5745
|
-
if (is.fun(
|
|
5746
|
-
return
|
|
5744
|
+
const createInterpolator = (range3, output, extrapolate) => {
|
|
5745
|
+
if (is.fun(range3)) {
|
|
5746
|
+
return range3;
|
|
5747
5747
|
}
|
|
5748
|
-
if (is.arr(
|
|
5748
|
+
if (is.arr(range3)) {
|
|
5749
5749
|
return createInterpolator({
|
|
5750
|
-
range,
|
|
5750
|
+
range: range3,
|
|
5751
5751
|
output,
|
|
5752
5752
|
extrapolate
|
|
5753
5753
|
});
|
|
5754
5754
|
}
|
|
5755
|
-
if (is.str(
|
|
5756
|
-
return createStringInterpolator$1(
|
|
5755
|
+
if (is.str(range3.output[0])) {
|
|
5756
|
+
return createStringInterpolator$1(range3);
|
|
5757
5757
|
}
|
|
5758
|
-
const config2 =
|
|
5758
|
+
const config2 = range3;
|
|
5759
5759
|
const outputRange = config2.output;
|
|
5760
5760
|
const inputRange = config2.range || [0, 1];
|
|
5761
5761
|
const extrapolateLeft = config2.extrapolateLeft || config2.extrapolate || "extend";
|
|
5762
5762
|
const extrapolateRight = config2.extrapolateRight || config2.extrapolate || "extend";
|
|
5763
5763
|
const easing = config2.easing || ((t2) => t2);
|
|
5764
5764
|
return (input) => {
|
|
5765
|
-
const
|
|
5766
|
-
return interpolate(input, inputRange[
|
|
5765
|
+
const range4 = findRange(input, inputRange);
|
|
5766
|
+
return interpolate(input, inputRange[range4], inputRange[range4 + 1], outputRange[range4], outputRange[range4 + 1], easing, extrapolateLeft, extrapolateRight, config2.map);
|
|
5767
5767
|
};
|
|
5768
5768
|
};
|
|
5769
5769
|
function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
|
|
@@ -5805,8 +5805,8 @@ function findRange(input, inputRange) {
|
|
|
5805
5805
|
break;
|
|
5806
5806
|
return i - 1;
|
|
5807
5807
|
}
|
|
5808
|
-
function _extends$
|
|
5809
|
-
_extends$
|
|
5808
|
+
function _extends$3() {
|
|
5809
|
+
_extends$3 = Object.assign ? Object.assign.bind() : function(target) {
|
|
5810
5810
|
for (var i = 1; i < arguments.length; i++) {
|
|
5811
5811
|
var source = arguments[i];
|
|
5812
5812
|
for (var key in source) {
|
|
@@ -5817,7 +5817,7 @@ function _extends$2() {
|
|
|
5817
5817
|
}
|
|
5818
5818
|
return target;
|
|
5819
5819
|
};
|
|
5820
|
-
return _extends$
|
|
5820
|
+
return _extends$3.apply(this, arguments);
|
|
5821
5821
|
}
|
|
5822
5822
|
const $get = Symbol.for("FluidValue.get");
|
|
5823
5823
|
const $observers = Symbol.for("FluidValue.observers");
|
|
@@ -5933,7 +5933,7 @@ const createStringInterpolator = (config2) => {
|
|
|
5933
5933
|
}
|
|
5934
5934
|
return values[i];
|
|
5935
5935
|
}));
|
|
5936
|
-
const interpolators = outputRanges.map((output2) => createInterpolator(_extends$
|
|
5936
|
+
const interpolators = outputRanges.map((output2) => createInterpolator(_extends$3({}, config2, {
|
|
5937
5937
|
output: output2
|
|
5938
5938
|
})));
|
|
5939
5939
|
return (input) => {
|
|
@@ -6218,8 +6218,8 @@ function getAnimatedType(value) {
|
|
|
6218
6218
|
const parentNode = getAnimated(value);
|
|
6219
6219
|
return parentNode ? parentNode.constructor : is.arr(value) ? AnimatedArray : isAnimatedString(value) ? AnimatedString : AnimatedValue;
|
|
6220
6220
|
}
|
|
6221
|
-
function _extends$
|
|
6222
|
-
_extends$
|
|
6221
|
+
function _extends$2() {
|
|
6222
|
+
_extends$2 = Object.assign ? Object.assign.bind() : function(target) {
|
|
6223
6223
|
for (var i = 1; i < arguments.length; i++) {
|
|
6224
6224
|
var source = arguments[i];
|
|
6225
6225
|
for (var key in source) {
|
|
@@ -6230,7 +6230,7 @@ function _extends$1() {
|
|
|
6230
6230
|
}
|
|
6231
6231
|
return target;
|
|
6232
6232
|
};
|
|
6233
|
-
return _extends$
|
|
6233
|
+
return _extends$2.apply(this, arguments);
|
|
6234
6234
|
}
|
|
6235
6235
|
const withAnimated = (Component2, host2) => {
|
|
6236
6236
|
const hasInstance = !is.fun(Component2) || Component2.prototype && Component2.prototype.isReactComponent;
|
|
@@ -6269,7 +6269,7 @@ const withAnimated = (Component2, host2) => {
|
|
|
6269
6269
|
each(observer2.deps, (dep) => removeFluidObserver(dep, observer2));
|
|
6270
6270
|
});
|
|
6271
6271
|
const usedProps = host2.getComponentProps(props.getValue());
|
|
6272
|
-
return React.createElement(Component2, _extends$
|
|
6272
|
+
return React.createElement(Component2, _extends$2({}, usedProps, {
|
|
6273
6273
|
ref
|
|
6274
6274
|
}));
|
|
6275
6275
|
});
|
|
@@ -6289,7 +6289,7 @@ function getAnimatedState(props, host2) {
|
|
|
6289
6289
|
const dependencies = /* @__PURE__ */ new Set();
|
|
6290
6290
|
TreeContext.dependencies = dependencies;
|
|
6291
6291
|
if (props.style)
|
|
6292
|
-
props = _extends$
|
|
6292
|
+
props = _extends$2({}, props, {
|
|
6293
6293
|
style: host2.createAnimatedStyle(props.style)
|
|
6294
6294
|
});
|
|
6295
6295
|
props = new AnimatedObject(props);
|
|
@@ -6337,8 +6337,8 @@ const createHost = (components, {
|
|
|
6337
6337
|
};
|
|
6338
6338
|
};
|
|
6339
6339
|
const getDisplayName = (arg) => is.str(arg) ? arg : arg && is.str(arg.displayName) ? arg.displayName : is.fun(arg) && arg.name || null;
|
|
6340
|
-
function _extends() {
|
|
6341
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
6340
|
+
function _extends$1() {
|
|
6341
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function(target) {
|
|
6342
6342
|
for (var i = 1; i < arguments.length; i++) {
|
|
6343
6343
|
var source = arguments[i];
|
|
6344
6344
|
for (var key in source) {
|
|
@@ -6349,7 +6349,7 @@ function _extends() {
|
|
|
6349
6349
|
}
|
|
6350
6350
|
return target;
|
|
6351
6351
|
};
|
|
6352
|
-
return _extends.apply(this, arguments);
|
|
6352
|
+
return _extends$1.apply(this, arguments);
|
|
6353
6353
|
}
|
|
6354
6354
|
function callProp(value, ...args) {
|
|
6355
6355
|
return is.fun(value) ? value(...args) : value;
|
|
@@ -6430,7 +6430,7 @@ function inferTo(props) {
|
|
|
6430
6430
|
eachProp(props, (val, key) => key in to2 || (out[key] = val));
|
|
6431
6431
|
return out;
|
|
6432
6432
|
}
|
|
6433
|
-
return _extends({}, props);
|
|
6433
|
+
return _extends$1({}, props);
|
|
6434
6434
|
}
|
|
6435
6435
|
function computeGoal(value) {
|
|
6436
6436
|
value = getFluidValue(value);
|
|
@@ -6537,7 +6537,7 @@ const easings = {
|
|
|
6537
6537
|
easeOutBounce: bounceOut,
|
|
6538
6538
|
easeInOutBounce: (x2) => x2 < 0.5 ? (1 - bounceOut(1 - 2 * x2)) / 2 : (1 + bounceOut(2 * x2 - 1)) / 2
|
|
6539
6539
|
};
|
|
6540
|
-
const defaults = _extends({}, config.default, {
|
|
6540
|
+
const defaults = _extends$1({}, config.default, {
|
|
6541
6541
|
mass: 1,
|
|
6542
6542
|
damping: 1,
|
|
6543
6543
|
easing: easings.linear,
|
|
@@ -6565,9 +6565,9 @@ class AnimationConfig {
|
|
|
6565
6565
|
}
|
|
6566
6566
|
function mergeConfig(config2, newConfig, defaultConfig) {
|
|
6567
6567
|
if (defaultConfig) {
|
|
6568
|
-
defaultConfig = _extends({}, defaultConfig);
|
|
6568
|
+
defaultConfig = _extends$1({}, defaultConfig);
|
|
6569
6569
|
sanitizeConfig(defaultConfig, newConfig);
|
|
6570
|
-
newConfig = _extends({}, defaultConfig, newConfig);
|
|
6570
|
+
newConfig = _extends$1({}, defaultConfig, newConfig);
|
|
6571
6571
|
}
|
|
6572
6572
|
sanitizeConfig(config2, newConfig);
|
|
6573
6573
|
Object.assign(config2, newConfig);
|
|
@@ -6675,7 +6675,7 @@ function scheduleProps(callId, {
|
|
|
6675
6675
|
cancel = true;
|
|
6676
6676
|
}
|
|
6677
6677
|
try {
|
|
6678
|
-
actions.start(_extends({}, props, {
|
|
6678
|
+
actions.start(_extends$1({}, props, {
|
|
6679
6679
|
callId,
|
|
6680
6680
|
cancel
|
|
6681
6681
|
}), resolve);
|
|
@@ -6741,7 +6741,7 @@ function runAsync(to2, props, state, target) {
|
|
|
6741
6741
|
throw skipAnimationSignal;
|
|
6742
6742
|
}
|
|
6743
6743
|
bailIfEnded(bailSignal);
|
|
6744
|
-
const props2 = is.obj(arg1) ? _extends({}, arg1) : _extends({}, arg2, {
|
|
6744
|
+
const props2 = is.obj(arg1) ? _extends$1({}, arg1) : _extends$1({}, arg2, {
|
|
6745
6745
|
to: arg1
|
|
6746
6746
|
});
|
|
6747
6747
|
props2.parentId = callId;
|
|
@@ -6912,7 +6912,7 @@ class SpringValue extends FrameValue {
|
|
|
6912
6912
|
this._lastToId = 0;
|
|
6913
6913
|
this._memoizedDuration = 0;
|
|
6914
6914
|
if (!is.und(arg1) || !is.und(arg2)) {
|
|
6915
|
-
const props = is.obj(arg1) ? _extends({}, arg1) : _extends({}, arg2, {
|
|
6915
|
+
const props = is.obj(arg1) ? _extends$1({}, arg1) : _extends$1({}, arg2, {
|
|
6916
6916
|
from: arg1
|
|
6917
6917
|
});
|
|
6918
6918
|
if (is.und(props.default)) {
|
|
@@ -7102,7 +7102,7 @@ class SpringValue extends FrameValue {
|
|
|
7102
7102
|
start(to2, arg2) {
|
|
7103
7103
|
let queue;
|
|
7104
7104
|
if (!is.und(to2)) {
|
|
7105
|
-
queue = [is.obj(to2) ? to2 : _extends({}, arg2, {
|
|
7105
|
+
queue = [is.obj(to2) ? to2 : _extends$1({}, arg2, {
|
|
7106
7106
|
to: to2
|
|
7107
7107
|
})];
|
|
7108
7108
|
} else {
|
|
@@ -7149,7 +7149,7 @@ class SpringValue extends FrameValue {
|
|
|
7149
7149
|
if (from == null) {
|
|
7150
7150
|
from = void 0;
|
|
7151
7151
|
}
|
|
7152
|
-
const
|
|
7152
|
+
const range3 = {
|
|
7153
7153
|
to: to2,
|
|
7154
7154
|
from
|
|
7155
7155
|
};
|
|
@@ -7163,10 +7163,10 @@ class SpringValue extends FrameValue {
|
|
|
7163
7163
|
this._set(to2);
|
|
7164
7164
|
}
|
|
7165
7165
|
}
|
|
7166
|
-
return
|
|
7166
|
+
return range3;
|
|
7167
7167
|
}
|
|
7168
7168
|
_update(_ref, isLoop) {
|
|
7169
|
-
let props = _extends({}, _ref);
|
|
7169
|
+
let props = _extends$1({}, _ref);
|
|
7170
7170
|
const {
|
|
7171
7171
|
key,
|
|
7172
7172
|
defaultProps: defaultProps2
|
|
@@ -7175,7 +7175,7 @@ class SpringValue extends FrameValue {
|
|
|
7175
7175
|
Object.assign(defaultProps2, getDefaultProps(props, (value, prop) => /^on/.test(prop) ? resolveProp(value, key) : value));
|
|
7176
7176
|
mergeActiveFn(this, props, "onProps");
|
|
7177
7177
|
sendEvent(this, "onProps", props, this);
|
|
7178
|
-
const
|
|
7178
|
+
const range3 = this._prepareNode(props);
|
|
7179
7179
|
if (Object.isFrozen(this)) {
|
|
7180
7180
|
throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");
|
|
7181
7181
|
}
|
|
@@ -7203,7 +7203,7 @@ class SpringValue extends FrameValue {
|
|
|
7203
7203
|
sendEvent(this, "onResume", getFinishedResult(this, checkFinished(this, this.animation.to)), this);
|
|
7204
7204
|
}
|
|
7205
7205
|
},
|
|
7206
|
-
start: this._merge.bind(this,
|
|
7206
|
+
start: this._merge.bind(this, range3)
|
|
7207
7207
|
}
|
|
7208
7208
|
}).then((result) => {
|
|
7209
7209
|
if (props.loop && result.finished && !(isLoop && result.noop)) {
|
|
@@ -7215,13 +7215,13 @@ class SpringValue extends FrameValue {
|
|
|
7215
7215
|
return result;
|
|
7216
7216
|
});
|
|
7217
7217
|
}
|
|
7218
|
-
_merge(
|
|
7218
|
+
_merge(range3, props, resolve) {
|
|
7219
7219
|
if (props.cancel) {
|
|
7220
7220
|
this.stop(true);
|
|
7221
7221
|
return resolve(getCancelledResult(this));
|
|
7222
7222
|
}
|
|
7223
|
-
const hasToProp = !is.und(
|
|
7224
|
-
const hasFromProp = !is.und(
|
|
7223
|
+
const hasToProp = !is.und(range3.to);
|
|
7224
|
+
const hasFromProp = !is.und(range3.from);
|
|
7225
7225
|
if (hasToProp || hasFromProp) {
|
|
7226
7226
|
if (props.callId > this._lastToId) {
|
|
7227
7227
|
this._lastToId = props.callId;
|
|
@@ -7241,7 +7241,7 @@ class SpringValue extends FrameValue {
|
|
|
7241
7241
|
let {
|
|
7242
7242
|
to: to2 = prevTo,
|
|
7243
7243
|
from = prevFrom
|
|
7244
|
-
} =
|
|
7244
|
+
} = range3;
|
|
7245
7245
|
if (hasFromProp && !hasToProp && (!props.default || is.und(to2))) {
|
|
7246
7246
|
to2 = from;
|
|
7247
7247
|
}
|
|
@@ -7323,7 +7323,7 @@ class SpringValue extends FrameValue {
|
|
|
7323
7323
|
const {
|
|
7324
7324
|
onRest
|
|
7325
7325
|
} = anim;
|
|
7326
|
-
each(ACTIVE_EVENTS, (
|
|
7326
|
+
each(ACTIVE_EVENTS, (type4) => mergeActiveFn(this, props, type4));
|
|
7327
7327
|
const result = getFinishedResult(this, checkFinished(this, prevTo));
|
|
7328
7328
|
flushCalls(this._pendingCalls, result);
|
|
7329
7329
|
this._pendingCalls.add(resolve);
|
|
@@ -7474,7 +7474,7 @@ function createLoopUpdate(props, loop2 = props.loop, to2 = props.to) {
|
|
|
7474
7474
|
const overrides = loopRet !== true && inferTo(loopRet);
|
|
7475
7475
|
const reverse = (overrides || props).reverse;
|
|
7476
7476
|
const reset = !overrides || overrides.reset;
|
|
7477
|
-
return createUpdate(_extends({}, props, {
|
|
7477
|
+
return createUpdate(_extends$1({}, props, {
|
|
7478
7478
|
loop: loop2,
|
|
7479
7479
|
default: false,
|
|
7480
7480
|
pause: void 0,
|
|
@@ -7508,13 +7508,13 @@ function findDefined(values, keys) {
|
|
|
7508
7508
|
eachProp(values, (value, key) => value != null && keys.add(key));
|
|
7509
7509
|
}
|
|
7510
7510
|
const ACTIVE_EVENTS = ["onStart", "onRest", "onChange", "onPause", "onResume"];
|
|
7511
|
-
function mergeActiveFn(target, props,
|
|
7512
|
-
target.animation[
|
|
7511
|
+
function mergeActiveFn(target, props, type4) {
|
|
7512
|
+
target.animation[type4] = props[type4] !== getDefaultProp(props, type4) ? resolveProp(props[type4], target.key) : void 0;
|
|
7513
7513
|
}
|
|
7514
|
-
function sendEvent(target,
|
|
7514
|
+
function sendEvent(target, type4, ...args) {
|
|
7515
7515
|
var _target$animation$typ, _target$animation, _target$defaultProps$, _target$defaultProps;
|
|
7516
|
-
(_target$animation$typ = (_target$animation = target.animation)[
|
|
7517
|
-
(_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[
|
|
7516
|
+
(_target$animation$typ = (_target$animation = target.animation)[type4]) == null ? void 0 : _target$animation$typ.call(_target$animation, ...args);
|
|
7517
|
+
(_target$defaultProps$ = (_target$defaultProps = target.defaultProps)[type4]) == null ? void 0 : _target$defaultProps$.call(_target$defaultProps, ...args);
|
|
7518
7518
|
}
|
|
7519
7519
|
const BATCHED_EVENTS = ["onStart", "onChange", "onRest"];
|
|
7520
7520
|
let nextId = 1;
|
|
@@ -7547,7 +7547,7 @@ class Controller {
|
|
|
7547
7547
|
this._flush = flush2;
|
|
7548
7548
|
}
|
|
7549
7549
|
if (props) {
|
|
7550
|
-
this.start(_extends({
|
|
7550
|
+
this.start(_extends$1({
|
|
7551
7551
|
default: true
|
|
7552
7552
|
}, props));
|
|
7553
7553
|
}
|
|
@@ -7782,14 +7782,14 @@ async function flushUpdate(ctrl, props, isLoop) {
|
|
|
7782
7782
|
return result;
|
|
7783
7783
|
}
|
|
7784
7784
|
function getSprings(ctrl, props) {
|
|
7785
|
-
const springs = _extends({}, ctrl.springs);
|
|
7785
|
+
const springs = _extends$1({}, ctrl.springs);
|
|
7786
7786
|
if (props) {
|
|
7787
7787
|
each(toArray(props), (props2) => {
|
|
7788
7788
|
if (is.und(props2.keys)) {
|
|
7789
7789
|
props2 = createUpdate(props2);
|
|
7790
7790
|
}
|
|
7791
7791
|
if (!is.obj(props2.to)) {
|
|
7792
|
-
props2 = _extends({}, props2, {
|
|
7792
|
+
props2 = _extends$1({}, props2, {
|
|
7793
7793
|
to: void 0
|
|
7794
7794
|
});
|
|
7795
7795
|
}
|
|
@@ -8020,7 +8020,7 @@ function useSprings(length, props, deps) {
|
|
|
8020
8020
|
useOnce(() => () => {
|
|
8021
8021
|
each(state.ctrls, (ctrl) => ctrl.stop(true));
|
|
8022
8022
|
});
|
|
8023
|
-
const values = springs.map((x2) => _extends({}, x2));
|
|
8023
|
+
const values = springs.map((x2) => _extends$1({}, x2));
|
|
8024
8024
|
return ref ? [values, ref] : values;
|
|
8025
8025
|
}
|
|
8026
8026
|
function useSpring(props, deps) {
|
|
@@ -8339,7 +8339,7 @@ const host = createHost(primitives, {
|
|
|
8339
8339
|
});
|
|
8340
8340
|
const animated = host.animated;
|
|
8341
8341
|
const elevatorContext = createContext$1({});
|
|
8342
|
-
const defaultProps$
|
|
8342
|
+
const defaultProps$17 = {
|
|
8343
8343
|
height: "200px",
|
|
8344
8344
|
acceptKey: "title",
|
|
8345
8345
|
indexList: [],
|
|
@@ -8362,7 +8362,7 @@ const Elevator = (props) => {
|
|
|
8362
8362
|
children,
|
|
8363
8363
|
...rest
|
|
8364
8364
|
} = {
|
|
8365
|
-
...defaultProps$
|
|
8365
|
+
...defaultProps$17,
|
|
8366
8366
|
...props
|
|
8367
8367
|
};
|
|
8368
8368
|
const b2 = cn("elevator");
|
|
@@ -8549,9 +8549,9 @@ const Elevator = (props) => {
|
|
|
8549
8549
|
}, item[acceptKey]);
|
|
8550
8550
|
}))));
|
|
8551
8551
|
};
|
|
8552
|
-
Elevator.defaultProps = defaultProps$
|
|
8552
|
+
Elevator.defaultProps = defaultProps$17;
|
|
8553
8553
|
Elevator.displayName = "NutElevator";
|
|
8554
|
-
const defaultProps$
|
|
8554
|
+
const defaultProps$16 = {
|
|
8555
8555
|
defaultValue: 1,
|
|
8556
8556
|
mode: "multi",
|
|
8557
8557
|
prevText: "",
|
|
@@ -8568,7 +8568,7 @@ const defaultProps$14 = {
|
|
|
8568
8568
|
};
|
|
8569
8569
|
const Pagination = (props) => {
|
|
8570
8570
|
const { locale } = useConfig();
|
|
8571
|
-
({ ...defaultProps$
|
|
8571
|
+
({ ...defaultProps$16, ...props });
|
|
8572
8572
|
const {
|
|
8573
8573
|
modelValue,
|
|
8574
8574
|
mode,
|
|
@@ -8643,8 +8643,8 @@ const Pagination = (props) => {
|
|
|
8643
8643
|
if (isSelect)
|
|
8644
8644
|
onChange && onChange(curPage);
|
|
8645
8645
|
};
|
|
8646
|
-
const setPage = (
|
|
8647
|
-
return { number, text, active };
|
|
8646
|
+
const setPage = (number4, text, active) => {
|
|
8647
|
+
return { number: number4, text, active };
|
|
8648
8648
|
};
|
|
8649
8649
|
useEffect(() => {
|
|
8650
8650
|
let currentValue2 = props.defaultValue || 1;
|
|
@@ -8685,7 +8685,7 @@ const Pagination = (props) => {
|
|
|
8685
8685
|
onClick: (e2) => selectPage(Number(currentPage) + 1, true)
|
|
8686
8686
|
}, nextText || locale.pagination.next));
|
|
8687
8687
|
};
|
|
8688
|
-
Pagination.defaultProps = defaultProps$
|
|
8688
|
+
Pagination.defaultProps = defaultProps$16;
|
|
8689
8689
|
Pagination.displayName = "NutPagination";
|
|
8690
8690
|
class Title {
|
|
8691
8691
|
constructor() {
|
|
@@ -8695,7 +8695,7 @@ class Title {
|
|
|
8695
8695
|
this.index = 0;
|
|
8696
8696
|
}
|
|
8697
8697
|
}
|
|
8698
|
-
const defaultProps$
|
|
8698
|
+
const defaultProps$15 = {
|
|
8699
8699
|
...ComponentDefaults,
|
|
8700
8700
|
tabStyle: {},
|
|
8701
8701
|
value: 0,
|
|
@@ -8720,7 +8720,7 @@ const Tabs = (props) => {
|
|
|
8720
8720
|
tabStyle,
|
|
8721
8721
|
background,
|
|
8722
8722
|
direction,
|
|
8723
|
-
type,
|
|
8723
|
+
type: type4,
|
|
8724
8724
|
titleScroll,
|
|
8725
8725
|
ellipsis,
|
|
8726
8726
|
animatedTime,
|
|
@@ -8736,7 +8736,7 @@ const Tabs = (props) => {
|
|
|
8736
8736
|
iconFontClassName,
|
|
8737
8737
|
...rest
|
|
8738
8738
|
} = {
|
|
8739
|
-
...defaultProps$
|
|
8739
|
+
...defaultProps$15,
|
|
8740
8740
|
...props
|
|
8741
8741
|
};
|
|
8742
8742
|
const [currentItem, setCurrentItem] = useState({ index: 0 });
|
|
@@ -8767,7 +8767,7 @@ const Tabs = (props) => {
|
|
|
8767
8767
|
const classes = classNames(direction, b2(""), className);
|
|
8768
8768
|
const classesTitle = classNames(
|
|
8769
8769
|
{
|
|
8770
|
-
[
|
|
8770
|
+
[type4]: type4,
|
|
8771
8771
|
scrollable: titleScroll,
|
|
8772
8772
|
[size]: size
|
|
8773
8773
|
},
|
|
@@ -8778,8 +8778,8 @@ const Tabs = (props) => {
|
|
|
8778
8778
|
marginRight: pxCheck$2(titleGutter)
|
|
8779
8779
|
};
|
|
8780
8780
|
const tabsActiveStyle = {
|
|
8781
|
-
color:
|
|
8782
|
-
background:
|
|
8781
|
+
color: type4 === "smile" ? color : "",
|
|
8782
|
+
background: type4 === "line" ? color : ""
|
|
8783
8783
|
};
|
|
8784
8784
|
const index = titles.current.findIndex((t2) => t2.paneKey === value);
|
|
8785
8785
|
const contentStyle = {
|
|
@@ -8812,10 +8812,10 @@ const Tabs = (props) => {
|
|
|
8812
8812
|
`${b2("")}__titles-item`
|
|
8813
8813
|
),
|
|
8814
8814
|
key: item.paneKey
|
|
8815
|
-
},
|
|
8815
|
+
}, type4 === "line" && /* @__PURE__ */ React__default.createElement("div", {
|
|
8816
8816
|
className: `${b2("")}__titles-item__line`,
|
|
8817
8817
|
style: tabsActiveStyle
|
|
8818
|
-
}),
|
|
8818
|
+
}), type4 === "smile" && /* @__PURE__ */ React__default.createElement("div", {
|
|
8819
8819
|
className: `${b2("")}__titles-item__smile`,
|
|
8820
8820
|
style: tabsActiveStyle
|
|
8821
8821
|
}, /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
@@ -8854,9 +8854,9 @@ const Tabs = (props) => {
|
|
|
8854
8854
|
return React__default.cloneElement(child, childProps);
|
|
8855
8855
|
}))));
|
|
8856
8856
|
};
|
|
8857
|
-
Tabs.defaultProps = defaultProps$
|
|
8857
|
+
Tabs.defaultProps = defaultProps$15;
|
|
8858
8858
|
Tabs.displayName = "NutTabs";
|
|
8859
|
-
const defaultProps$
|
|
8859
|
+
const defaultProps$14 = {
|
|
8860
8860
|
title: "",
|
|
8861
8861
|
paneKey: "",
|
|
8862
8862
|
activeKey: "",
|
|
@@ -8864,7 +8864,7 @@ const defaultProps$12 = {
|
|
|
8864
8864
|
};
|
|
8865
8865
|
const TabPane = (props) => {
|
|
8866
8866
|
const { children, paneKey, activeKey, autoHeightClassName, className } = {
|
|
8867
|
-
...defaultProps$
|
|
8867
|
+
...defaultProps$14,
|
|
8868
8868
|
...props
|
|
8869
8869
|
};
|
|
8870
8870
|
const b2 = cn("tabpane");
|
|
@@ -8880,7 +8880,7 @@ const TabPane = (props) => {
|
|
|
8880
8880
|
className: classes
|
|
8881
8881
|
}, children);
|
|
8882
8882
|
};
|
|
8883
|
-
const defaultProps$
|
|
8883
|
+
const defaultProps$13 = {
|
|
8884
8884
|
size: 3,
|
|
8885
8885
|
current: 1,
|
|
8886
8886
|
block: false,
|
|
@@ -8900,7 +8900,7 @@ const Indicator = (props) => {
|
|
|
8900
8900
|
vertical,
|
|
8901
8901
|
...rest
|
|
8902
8902
|
} = {
|
|
8903
|
-
...defaultProps$
|
|
8903
|
+
...defaultProps$13,
|
|
8904
8904
|
...props
|
|
8905
8905
|
};
|
|
8906
8906
|
const b2 = cn("indicator");
|
|
@@ -8934,7 +8934,7 @@ const Indicator = (props) => {
|
|
|
8934
8934
|
...rest
|
|
8935
8935
|
}, renderEles());
|
|
8936
8936
|
};
|
|
8937
|
-
Indicator.defaultProps = defaultProps$
|
|
8937
|
+
Indicator.defaultProps = defaultProps$13;
|
|
8938
8938
|
Indicator.displayName = "NutIndicator";
|
|
8939
8939
|
const handleClick = (e2) => {
|
|
8940
8940
|
e2.stopPropagation();
|
|
@@ -8950,7 +8950,7 @@ const handleClick = (e2) => {
|
|
|
8950
8950
|
}
|
|
8951
8951
|
};
|
|
8952
8952
|
const OffsetContext = createContext$1(20);
|
|
8953
|
-
const defaultProps$
|
|
8953
|
+
const defaultProps$12 = {
|
|
8954
8954
|
showhead: false,
|
|
8955
8955
|
position: "left",
|
|
8956
8956
|
width: "80%"
|
|
@@ -8968,7 +8968,7 @@ const SideNavBar = (props) => {
|
|
|
8968
8968
|
onClose,
|
|
8969
8969
|
...rest
|
|
8970
8970
|
} = {
|
|
8971
|
-
...defaultProps$
|
|
8971
|
+
...defaultProps$12,
|
|
8972
8972
|
...props
|
|
8973
8973
|
};
|
|
8974
8974
|
const offset = props.offset ? Number(props.offset) : 20;
|
|
@@ -8996,14 +8996,14 @@ const SideNavBar = (props) => {
|
|
|
8996
8996
|
className: "nut-sidenavbar__content"
|
|
8997
8997
|
}, children))))));
|
|
8998
8998
|
};
|
|
8999
|
-
SideNavBar.defaultProps = defaultProps$
|
|
8999
|
+
SideNavBar.defaultProps = defaultProps$12;
|
|
9000
9000
|
SideNavBar.displayName = "NutSideNavBar";
|
|
9001
|
-
const defaultProps
|
|
9001
|
+
const defaultProps$11 = {
|
|
9002
9002
|
open: true
|
|
9003
9003
|
};
|
|
9004
9004
|
const SubSideNavBar = (props) => {
|
|
9005
9005
|
const { title, ikey, children, onClick, open, ...rest } = {
|
|
9006
|
-
...defaultProps
|
|
9006
|
+
...defaultProps$11,
|
|
9007
9007
|
...props
|
|
9008
9008
|
};
|
|
9009
9009
|
const offset = useContext$1(OffsetContext);
|
|
@@ -9074,7 +9074,7 @@ const SideNavBarItem = (props) => {
|
|
|
9074
9074
|
...rest
|
|
9075
9075
|
}, title);
|
|
9076
9076
|
};
|
|
9077
|
-
const defaultProps$
|
|
9077
|
+
const defaultProps$10 = {
|
|
9078
9078
|
...ComponentDefaults,
|
|
9079
9079
|
className: "",
|
|
9080
9080
|
style: {},
|
|
@@ -9097,7 +9097,7 @@ const Menu = (props) => {
|
|
|
9097
9097
|
iconFontClassName,
|
|
9098
9098
|
...rest
|
|
9099
9099
|
} = {
|
|
9100
|
-
...defaultProps$
|
|
9100
|
+
...defaultProps$10,
|
|
9101
9101
|
...props
|
|
9102
9102
|
};
|
|
9103
9103
|
const parentRef = useRef(null);
|
|
@@ -9202,9 +9202,9 @@ const Menu = (props) => {
|
|
|
9202
9202
|
})));
|
|
9203
9203
|
})), cloneChildren()));
|
|
9204
9204
|
};
|
|
9205
|
-
Menu.defaultProps = defaultProps$
|
|
9205
|
+
Menu.defaultProps = defaultProps$10;
|
|
9206
9206
|
Menu.displayName = "NutMenu";
|
|
9207
|
-
const defaultProps
|
|
9207
|
+
const defaultProps$$ = {
|
|
9208
9208
|
...ComponentDefaults,
|
|
9209
9209
|
className: "",
|
|
9210
9210
|
style: {},
|
|
@@ -9219,7 +9219,7 @@ const defaultProps$Z = {
|
|
|
9219
9219
|
};
|
|
9220
9220
|
const MenuItem = forwardRef((props, ref) => {
|
|
9221
9221
|
useConfig();
|
|
9222
|
-
const mergedProps = { ...defaultProps
|
|
9222
|
+
const mergedProps = { ...defaultProps$$, ...props };
|
|
9223
9223
|
const {
|
|
9224
9224
|
style,
|
|
9225
9225
|
options: options2,
|
|
@@ -9235,7 +9235,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
9235
9235
|
iconClassPrefix,
|
|
9236
9236
|
iconFontClassName
|
|
9237
9237
|
} = {
|
|
9238
|
-
...defaultProps
|
|
9238
|
+
...defaultProps$$,
|
|
9239
9239
|
...props
|
|
9240
9240
|
};
|
|
9241
9241
|
const { activeColor, showPopup, parent, orderKey } = mergedProps;
|
|
@@ -9356,7 +9356,7 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
9356
9356
|
}, item.text));
|
|
9357
9357
|
}), children))));
|
|
9358
9358
|
});
|
|
9359
|
-
MenuItem.defaultProps = defaultProps
|
|
9359
|
+
MenuItem.defaultProps = defaultProps$$;
|
|
9360
9360
|
MenuItem.displayName = "NutMenuItem";
|
|
9361
9361
|
const MIN_DISTANCE = 10;
|
|
9362
9362
|
function getDirection(x2, y2) {
|
|
@@ -9507,14 +9507,14 @@ class Notification$1 extends React.PureComponent {
|
|
|
9507
9507
|
size,
|
|
9508
9508
|
customClass,
|
|
9509
9509
|
cover,
|
|
9510
|
-
type
|
|
9510
|
+
type: type4
|
|
9511
9511
|
} = this.props;
|
|
9512
9512
|
const toastBem = cn("toast");
|
|
9513
9513
|
const classes = classNames({
|
|
9514
9514
|
"nut-toast-center": center,
|
|
9515
9515
|
"nut-toast-has-icon": icon,
|
|
9516
9516
|
"nut-toast-cover": cover,
|
|
9517
|
-
"nut-toast-loading":
|
|
9517
|
+
"nut-toast-loading": type4 === "loading",
|
|
9518
9518
|
[`${customClass}`]: true,
|
|
9519
9519
|
[`nut-toast-${size}`]: true
|
|
9520
9520
|
});
|
|
@@ -9654,7 +9654,7 @@ var Toast = {
|
|
|
9654
9654
|
}
|
|
9655
9655
|
}
|
|
9656
9656
|
};
|
|
9657
|
-
const defaultProps$
|
|
9657
|
+
const defaultProps$_ = {
|
|
9658
9658
|
range: false,
|
|
9659
9659
|
hiddenRange: false,
|
|
9660
9660
|
hiddenTag: false,
|
|
@@ -9671,7 +9671,7 @@ const Range = (props) => {
|
|
|
9671
9671
|
const { locale } = useConfig();
|
|
9672
9672
|
const {
|
|
9673
9673
|
className,
|
|
9674
|
-
range,
|
|
9674
|
+
range: range3,
|
|
9675
9675
|
disabled,
|
|
9676
9676
|
activeColor,
|
|
9677
9677
|
inactiveColor,
|
|
@@ -9687,9 +9687,12 @@ const Range = (props) => {
|
|
|
9687
9687
|
dragEnd,
|
|
9688
9688
|
onChange,
|
|
9689
9689
|
onDragStart,
|
|
9690
|
-
onDragEnd
|
|
9691
|
-
|
|
9692
|
-
|
|
9690
|
+
onDragEnd,
|
|
9691
|
+
minDesc,
|
|
9692
|
+
maxDesc,
|
|
9693
|
+
curValueDesc
|
|
9694
|
+
} = { ...defaultProps$_, ...props };
|
|
9695
|
+
let { min, max, step } = { ...defaultProps$_, ...props };
|
|
9693
9696
|
min = Number(min);
|
|
9694
9697
|
max = Number(max);
|
|
9695
9698
|
step = Number(step);
|
|
@@ -9701,7 +9704,7 @@ const Range = (props) => {
|
|
|
9701
9704
|
const [marksList, SetMarksList] = useState([]);
|
|
9702
9705
|
useEffect(() => {
|
|
9703
9706
|
if (modelValue) {
|
|
9704
|
-
if (!
|
|
9707
|
+
if (!range3 && (modelValue < min || modelValue > max)) {
|
|
9705
9708
|
SetInitValue(0);
|
|
9706
9709
|
Toast.text(`${modelValue} ${locale.range.rangeText}`);
|
|
9707
9710
|
return;
|
|
@@ -9737,7 +9740,7 @@ const Range = (props) => {
|
|
|
9737
9740
|
const classPrefix = "nut-range-mark";
|
|
9738
9741
|
let lowerBound = Number(min);
|
|
9739
9742
|
let upperBound = Number(max);
|
|
9740
|
-
if (
|
|
9743
|
+
if (range3) {
|
|
9741
9744
|
const [left, right] = modelValue;
|
|
9742
9745
|
lowerBound = left;
|
|
9743
9746
|
upperBound = right;
|
|
@@ -9750,7 +9753,7 @@ const Range = (props) => {
|
|
|
9750
9753
|
`${isActive ? `${classPrefix}-text-active` : ""}`
|
|
9751
9754
|
].filter(Boolean).join(" ");
|
|
9752
9755
|
},
|
|
9753
|
-
[
|
|
9756
|
+
[range3, modelValue, min, max]
|
|
9754
9757
|
);
|
|
9755
9758
|
const [rangeName, setRangeName] = useState(classes());
|
|
9756
9759
|
const [containerName, setContainerName] = useState(containerClasses());
|
|
@@ -9769,7 +9772,7 @@ const Range = (props) => {
|
|
|
9769
9772
|
};
|
|
9770
9773
|
};
|
|
9771
9774
|
const isRange = (val) => {
|
|
9772
|
-
return !!
|
|
9775
|
+
return !!range3 && Array.isArray(val);
|
|
9773
9776
|
};
|
|
9774
9777
|
const calcMainAxis = () => {
|
|
9775
9778
|
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
@@ -9815,7 +9818,7 @@ const Range = (props) => {
|
|
|
9815
9818
|
const tickStyle = (mark) => {
|
|
9816
9819
|
let lowerBound = Number(min);
|
|
9817
9820
|
let upperBound = Number(max);
|
|
9818
|
-
if (
|
|
9821
|
+
if (range3) {
|
|
9819
9822
|
const [left, right] = modelValue;
|
|
9820
9823
|
lowerBound = left;
|
|
9821
9824
|
upperBound = right;
|
|
@@ -9826,7 +9829,7 @@ const Range = (props) => {
|
|
|
9826
9829
|
};
|
|
9827
9830
|
return style;
|
|
9828
9831
|
};
|
|
9829
|
-
const
|
|
9832
|
+
const format2 = (value) => {
|
|
9830
9833
|
value = Math.max(+min, Math.min(value, +max));
|
|
9831
9834
|
return Math.round(value / +step) * +step;
|
|
9832
9835
|
};
|
|
@@ -9841,9 +9844,9 @@ const Range = (props) => {
|
|
|
9841
9844
|
};
|
|
9842
9845
|
const updateValue = (value, end) => {
|
|
9843
9846
|
if (isRange(value)) {
|
|
9844
|
-
value = handleOverlap(value).map(
|
|
9847
|
+
value = handleOverlap(value).map(format2);
|
|
9845
9848
|
} else {
|
|
9846
|
-
value =
|
|
9849
|
+
value = format2(value);
|
|
9847
9850
|
}
|
|
9848
9851
|
const modelVal = initValue || initValue === 0 ? initValue : modelValue;
|
|
9849
9852
|
if (!isSameValue(value, modelVal)) {
|
|
@@ -9887,9 +9890,9 @@ const Range = (props) => {
|
|
|
9887
9890
|
touch.start(event);
|
|
9888
9891
|
currentValue = initValue || initValue === 0 ? initValue : modelValue;
|
|
9889
9892
|
if (isRange(currentValue)) {
|
|
9890
|
-
startValue = currentValue.map(
|
|
9893
|
+
startValue = currentValue.map(format2);
|
|
9891
9894
|
} else {
|
|
9892
|
-
startValue =
|
|
9895
|
+
startValue = format2(currentValue);
|
|
9893
9896
|
}
|
|
9894
9897
|
SetDragStatus("start");
|
|
9895
9898
|
};
|
|
@@ -9939,7 +9942,7 @@ const Range = (props) => {
|
|
|
9939
9942
|
className: `${containerName}`
|
|
9940
9943
|
}, !hiddenRange ? /* @__PURE__ */ React__default.createElement("div", {
|
|
9941
9944
|
className: "min"
|
|
9942
|
-
}, +min) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
9945
|
+
}, minDesc || +min) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
9943
9946
|
ref: root,
|
|
9944
9947
|
style: wrapperStyle(),
|
|
9945
9948
|
className: `${rangeName}`,
|
|
@@ -9960,7 +9963,7 @@ const Range = (props) => {
|
|
|
9960
9963
|
})) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
9961
9964
|
className: "nut-range-bar",
|
|
9962
9965
|
style: barStyle()
|
|
9963
|
-
},
|
|
9966
|
+
}, range3 ? [0, 1].map((item, index) => {
|
|
9964
9967
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
9965
9968
|
role: "slider",
|
|
9966
9969
|
key: index,
|
|
@@ -9994,7 +9997,7 @@ const Range = (props) => {
|
|
|
9994
9997
|
style: buttonStyle()
|
|
9995
9998
|
}, !hiddenTag ? /* @__PURE__ */ React__default.createElement("div", {
|
|
9996
9999
|
className: "number"
|
|
9997
|
-
}, curValue(index)) : null));
|
|
10000
|
+
}, curValueDesc || curValue(index)) : null));
|
|
9998
10001
|
}) : /* @__PURE__ */ React__default.createElement("div", {
|
|
9999
10002
|
role: "slider",
|
|
10000
10003
|
className: "nut-range-button-wrapper",
|
|
@@ -10023,19 +10026,19 @@ const Range = (props) => {
|
|
|
10023
10026
|
style: buttonStyle()
|
|
10024
10027
|
}, !hiddenTag ? /* @__PURE__ */ React__default.createElement("div", {
|
|
10025
10028
|
className: "number"
|
|
10026
|
-
}, curValue()) : null)))), !hiddenRange ? /* @__PURE__ */ React__default.createElement("div", {
|
|
10029
|
+
}, curValueDesc || curValue()) : null)))), !hiddenRange ? /* @__PURE__ */ React__default.createElement("div", {
|
|
10027
10030
|
className: "max"
|
|
10028
|
-
}, +max) : null);
|
|
10031
|
+
}, maxDesc || +max) : null);
|
|
10029
10032
|
};
|
|
10030
|
-
Range.defaultProps = defaultProps$
|
|
10033
|
+
Range.defaultProps = defaultProps$_;
|
|
10031
10034
|
Range.displayName = "NutRange";
|
|
10032
10035
|
const Utils = {
|
|
10033
10036
|
isLeapYear(y2) {
|
|
10034
10037
|
return y2 % 4 == 0 && y2 % 100 != 0 || y2 % 400 == 0;
|
|
10035
10038
|
},
|
|
10036
10039
|
getWhatDay(year, month, day) {
|
|
10037
|
-
const
|
|
10038
|
-
const index =
|
|
10040
|
+
const date4 = new Date(`${year}/${month}/${day}`);
|
|
10041
|
+
const index = date4.getDay();
|
|
10039
10042
|
const dayNames = [
|
|
10040
10043
|
"\u661F\u671F\u65E5",
|
|
10041
10044
|
"\u661F\u671F\u4E00",
|
|
@@ -10048,8 +10051,8 @@ const Utils = {
|
|
|
10048
10051
|
return dayNames[index];
|
|
10049
10052
|
},
|
|
10050
10053
|
getMonthPreDay(year, month) {
|
|
10051
|
-
const
|
|
10052
|
-
let day =
|
|
10054
|
+
const date4 = new Date(`${year}/${month}/01`);
|
|
10055
|
+
let day = date4.getDay();
|
|
10053
10056
|
if (day == 0) {
|
|
10054
10057
|
day = 7;
|
|
10055
10058
|
}
|
|
@@ -10079,31 +10082,31 @@ const Utils = {
|
|
|
10079
10082
|
n2 = Number(n2);
|
|
10080
10083
|
return (n2 > 9 ? "" : "0") + n2;
|
|
10081
10084
|
},
|
|
10082
|
-
date2Str(
|
|
10085
|
+
date2Str(date4, split) {
|
|
10083
10086
|
split = split || "-";
|
|
10084
|
-
const y2 =
|
|
10085
|
-
const m2 = this.getNumTwoBit(
|
|
10086
|
-
const d2 = this.getNumTwoBit(
|
|
10087
|
+
const y2 = date4.getFullYear();
|
|
10088
|
+
const m2 = this.getNumTwoBit(date4.getMonth() + 1);
|
|
10089
|
+
const d2 = this.getNumTwoBit(date4.getDate());
|
|
10087
10090
|
return [y2, m2, d2].join(split);
|
|
10088
10091
|
},
|
|
10089
10092
|
getDay(i) {
|
|
10090
10093
|
i = i || 0;
|
|
10091
|
-
let
|
|
10094
|
+
let date4 = new Date();
|
|
10092
10095
|
const diff = i * (1e3 * 60 * 60 * 24);
|
|
10093
|
-
|
|
10094
|
-
return this.date2Str(
|
|
10096
|
+
date4 = new Date(date4.getTime() + diff);
|
|
10097
|
+
return this.date2Str(date4);
|
|
10095
10098
|
},
|
|
10096
|
-
compareDate(date1,
|
|
10099
|
+
compareDate(date1, date22) {
|
|
10097
10100
|
const startTime = new Date(date1.replace("-", "/").replace("-", "/"));
|
|
10098
|
-
const endTime = new Date(
|
|
10101
|
+
const endTime = new Date(date22.replace("-", "/").replace("-", "/"));
|
|
10099
10102
|
if (startTime >= endTime) {
|
|
10100
10103
|
return false;
|
|
10101
10104
|
}
|
|
10102
10105
|
return true;
|
|
10103
10106
|
},
|
|
10104
|
-
isEqual(date1,
|
|
10107
|
+
isEqual(date1, date22) {
|
|
10105
10108
|
const startTime = new Date(date1).getTime();
|
|
10106
|
-
const endTime = new Date(
|
|
10109
|
+
const endTime = new Date(date22).getTime();
|
|
10107
10110
|
if (startTime == endTime) {
|
|
10108
10111
|
return true;
|
|
10109
10112
|
}
|
|
@@ -10121,7 +10124,7 @@ function requestAniFrame() {
|
|
|
10121
10124
|
};
|
|
10122
10125
|
}
|
|
10123
10126
|
var requestAniFrame$1 = requestAniFrame();
|
|
10124
|
-
const defaultProps$
|
|
10127
|
+
const defaultProps$Z = {
|
|
10125
10128
|
type: "one",
|
|
10126
10129
|
isAutoBackFill: false,
|
|
10127
10130
|
poppable: true,
|
|
@@ -10151,7 +10154,7 @@ const defaultProps$X = {
|
|
|
10151
10154
|
const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
10152
10155
|
const { locale } = useConfig();
|
|
10153
10156
|
const {
|
|
10154
|
-
type,
|
|
10157
|
+
type: type4,
|
|
10155
10158
|
isAutoBackFill,
|
|
10156
10159
|
poppable,
|
|
10157
10160
|
title,
|
|
@@ -10170,7 +10173,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10170
10173
|
onChoose,
|
|
10171
10174
|
onUpdate,
|
|
10172
10175
|
onSelected
|
|
10173
|
-
} = { ...defaultProps$
|
|
10176
|
+
} = { ...defaultProps$Z, ...props };
|
|
10174
10177
|
const weeks = locale.calendaritem.weekdays;
|
|
10175
10178
|
const [yearMonthTitle, setYearMonthTitle] = useState("");
|
|
10176
10179
|
const [monthsData, setMonthsData] = useState([]);
|
|
@@ -10222,10 +10225,10 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10222
10225
|
});
|
|
10223
10226
|
const monthitemclasses = classNames({
|
|
10224
10227
|
"calendar-month-item": true,
|
|
10225
|
-
[`${
|
|
10228
|
+
[`${type4 === "range" ? "month-item-range" : ""}`]: true
|
|
10226
10229
|
});
|
|
10227
|
-
const splitDate = (
|
|
10228
|
-
return
|
|
10230
|
+
const splitDate = (date4) => {
|
|
10231
|
+
return date4.split("-");
|
|
10229
10232
|
};
|
|
10230
10233
|
const isStart = (currDate) => {
|
|
10231
10234
|
return Utils.isEqual(state.currDate[0], currDate);
|
|
@@ -10249,13 +10252,13 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10249
10252
|
const getClass = (day, month) => {
|
|
10250
10253
|
const currDate = getCurrDate(day, month);
|
|
10251
10254
|
if (day.type === "curr") {
|
|
10252
|
-
if (Utils.isEqual(state.currDate, currDate) ||
|
|
10255
|
+
if (Utils.isEqual(state.currDate, currDate) || type4 === "range" && (isStart(currDate) || isEnd(currDate)) || type4 === "multiple" && isMultiple(currDate)) {
|
|
10253
10256
|
return `${state.dayPrefix}-active`;
|
|
10254
10257
|
}
|
|
10255
10258
|
if (state.propStartDate && Utils.compareDate(currDate, state.propStartDate) || state.propEndDate && Utils.compareDate(state.propEndDate, currDate)) {
|
|
10256
10259
|
return `${state.dayPrefix}-disabled`;
|
|
10257
10260
|
}
|
|
10258
|
-
if (
|
|
10261
|
+
if (type4 === "range" && Array.isArray(state.currDate) && Object.values(state.currDate).length === 2 && Utils.compareDate(state.currDate[0], currDate) && Utils.compareDate(currDate, state.currDate[1])) {
|
|
10259
10262
|
return `${state.dayPrefix}-choose`;
|
|
10260
10263
|
}
|
|
10261
10264
|
return null;
|
|
@@ -10266,12 +10269,12 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10266
10269
|
return state.isRange && day.type === "curr" && getClass(day, month) === "calendar-month-day-active";
|
|
10267
10270
|
};
|
|
10268
10271
|
const isCurrDay = (month, day) => {
|
|
10269
|
-
const
|
|
10270
|
-
return Utils.isEqual(
|
|
10272
|
+
const date4 = `${month.curData[0]}-${month.curData[1]}-${day}`;
|
|
10273
|
+
return Utils.isEqual(date4, Utils.date2Str(new Date()));
|
|
10271
10274
|
};
|
|
10272
10275
|
const confirm2 = () => {
|
|
10273
|
-
const { type:
|
|
10274
|
-
if (
|
|
10276
|
+
const { type: type22 } = props;
|
|
10277
|
+
if (type22 === "range" && state.chooseData.length === 2 || type22 !== "range") {
|
|
10275
10278
|
const chooseData = state.chooseData.slice(0);
|
|
10276
10279
|
onChoose && onChoose(chooseData);
|
|
10277
10280
|
if (poppable) {
|
|
@@ -10281,12 +10284,12 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10281
10284
|
};
|
|
10282
10285
|
const chooseDay = (day, month, isFirst) => {
|
|
10283
10286
|
if (getClass(day, month) !== `${state.dayPrefix}-disabled`) {
|
|
10284
|
-
const { type:
|
|
10287
|
+
const { type: type22 } = props;
|
|
10285
10288
|
const days = [...month.curData];
|
|
10286
10289
|
days[2] = typeof day.day === "number" ? Utils.getNumTwoBit(day.day) : day.day;
|
|
10287
10290
|
days[3] = `${days[0]}-${days[1]}-${days[2]}`;
|
|
10288
10291
|
days[4] = Utils.getWhatDay(+days[0], +days[1], +days[2]);
|
|
10289
|
-
if (
|
|
10292
|
+
if (type22 === "multiple") {
|
|
10290
10293
|
if (state.currDate.length > 0) {
|
|
10291
10294
|
let hasIndex = "";
|
|
10292
10295
|
state.currDate.forEach((item, index) => {
|
|
@@ -10307,7 +10310,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10307
10310
|
state.currDate = [days[3]];
|
|
10308
10311
|
state.chooseData = [[...days]];
|
|
10309
10312
|
}
|
|
10310
|
-
} else if (
|
|
10313
|
+
} else if (type22 === "range") {
|
|
10311
10314
|
const curDataLength = Object.values(state.currDate).length;
|
|
10312
10315
|
if (curDataLength === 2 || curDataLength === 0) {
|
|
10313
10316
|
state.currDate = [days[3]];
|
|
@@ -10351,11 +10354,11 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10351
10354
|
}
|
|
10352
10355
|
return false;
|
|
10353
10356
|
};
|
|
10354
|
-
const getCurrData = (
|
|
10355
|
-
const monthData =
|
|
10357
|
+
const getCurrData = (type22) => {
|
|
10358
|
+
const monthData = type22 === "prev" ? state.monthsData[0] : state.monthsData[state.monthsData.length - 1];
|
|
10356
10359
|
let year = parseInt(monthData.curData[0]);
|
|
10357
10360
|
let month = parseInt(monthData.curData[1].toString().replace(/^0/, ""));
|
|
10358
|
-
switch (
|
|
10361
|
+
switch (type22) {
|
|
10359
10362
|
case "prev":
|
|
10360
10363
|
month === 1 && (year -= 1);
|
|
10361
10364
|
month = month === 1 ? 12 : --month;
|
|
@@ -10371,36 +10374,36 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10371
10374
|
Utils.getMonthDays(String(year), String(month))
|
|
10372
10375
|
];
|
|
10373
10376
|
};
|
|
10374
|
-
const getDaysStatus = (days,
|
|
10377
|
+
const getDaysStatus = (days, type22, dateInfo) => {
|
|
10375
10378
|
const { year, month } = dateInfo;
|
|
10376
|
-
if (
|
|
10379
|
+
if (type22 === "prev" && days >= 7) {
|
|
10377
10380
|
days -= 7;
|
|
10378
10381
|
}
|
|
10379
10382
|
return Array.from(Array(days), (v2, k2) => {
|
|
10380
10383
|
return {
|
|
10381
10384
|
day: k2 + 1,
|
|
10382
|
-
type:
|
|
10385
|
+
type: type22,
|
|
10383
10386
|
year,
|
|
10384
10387
|
month
|
|
10385
10388
|
};
|
|
10386
10389
|
});
|
|
10387
10390
|
};
|
|
10388
|
-
const getPreDaysStatus = (days,
|
|
10391
|
+
const getPreDaysStatus = (days, type22, dateInfo, preCurrMonthDays) => {
|
|
10389
10392
|
const { year, month } = dateInfo;
|
|
10390
|
-
if (
|
|
10393
|
+
if (type22 === "prev" && days >= 7) {
|
|
10391
10394
|
days -= 7;
|
|
10392
10395
|
}
|
|
10393
10396
|
const months2 = Array.from(Array(preCurrMonthDays), (v2, k2) => {
|
|
10394
10397
|
return {
|
|
10395
10398
|
day: k2 + 1,
|
|
10396
|
-
type:
|
|
10399
|
+
type: type22,
|
|
10397
10400
|
year,
|
|
10398
10401
|
month
|
|
10399
10402
|
};
|
|
10400
10403
|
});
|
|
10401
10404
|
return months2.slice(preCurrMonthDays - days);
|
|
10402
10405
|
};
|
|
10403
|
-
const getMonth = (curData,
|
|
10406
|
+
const getMonth = (curData, type22) => {
|
|
10404
10407
|
const preMonthDays = Utils.getMonthPreDay(+curData[0], +curData[1]);
|
|
10405
10408
|
let preMonth = +curData[1] - 1;
|
|
10406
10409
|
let preYear = curData[0];
|
|
@@ -10433,7 +10436,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10433
10436
|
cssScrollHeight = state.monthsData[state.monthsData.length - 1].cssScrollHeight + state.monthsData[state.monthsData.length - 1].cssHeight;
|
|
10434
10437
|
}
|
|
10435
10438
|
monthInfo.cssScrollHeight = cssScrollHeight;
|
|
10436
|
-
if (
|
|
10439
|
+
if (type22 === "next") {
|
|
10437
10440
|
if (!state.endData || !Utils.compareDate(
|
|
10438
10441
|
`${state.endData[0]}-${state.endData[1]}-${Utils.getMonthDays(
|
|
10439
10442
|
state.endData[0],
|
|
@@ -10539,7 +10542,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10539
10542
|
getMonth(getCurrData("next"), "next");
|
|
10540
10543
|
} while (i++ < monthsNum);
|
|
10541
10544
|
state.monthsNum = monthsNum;
|
|
10542
|
-
if (
|
|
10545
|
+
if (type4 === "range" && Array.isArray(state.currDate)) {
|
|
10543
10546
|
if (state.currDate.length > 0) {
|
|
10544
10547
|
if (propStartDate && Utils.compareDate(state.currDate[0], propStartDate)) {
|
|
10545
10548
|
state.currDate.splice(0, 1, propStartDate);
|
|
@@ -10599,7 +10602,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10599
10602
|
state.currentIndex = current;
|
|
10600
10603
|
setYearMonthTitle(state.monthsData[state.currentIndex].title);
|
|
10601
10604
|
if (state.defaultData.length > 0) {
|
|
10602
|
-
if (
|
|
10605
|
+
if (type4 === "range") {
|
|
10603
10606
|
chooseDay(
|
|
10604
10607
|
{ day: state.defaultData[2], type: "curr" },
|
|
10605
10608
|
state.monthsData[state.currentIndex],
|
|
@@ -10610,7 +10613,7 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10610
10613
|
state.monthsData[lastCurrent],
|
|
10611
10614
|
true
|
|
10612
10615
|
);
|
|
10613
|
-
} else if (
|
|
10616
|
+
} else if (type4 === "multiple") {
|
|
10614
10617
|
[...state.currDate].forEach((item) => {
|
|
10615
10618
|
const dateArr = splitDate(item);
|
|
10616
10619
|
let current2 = state.currentIndex;
|
|
@@ -10649,13 +10652,13 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10649
10652
|
state.monthsData.splice(0);
|
|
10650
10653
|
initData();
|
|
10651
10654
|
};
|
|
10652
|
-
const scrollToDate = (
|
|
10653
|
-
if (Utils.compareDate(
|
|
10654
|
-
|
|
10655
|
-
} else if (!Utils.compareDate(
|
|
10656
|
-
|
|
10655
|
+
const scrollToDate = (date4) => {
|
|
10656
|
+
if (Utils.compareDate(date4, state.propStartDate)) {
|
|
10657
|
+
date4 = state.propStartDate;
|
|
10658
|
+
} else if (!Utils.compareDate(date4, state.propEndDate)) {
|
|
10659
|
+
date4 = state.propEndDate;
|
|
10657
10660
|
}
|
|
10658
|
-
const dateArr = splitDate(
|
|
10661
|
+
const dateArr = splitDate(date4);
|
|
10659
10662
|
state.monthsData.forEach((item, index) => {
|
|
10660
10663
|
if (item.title === locale.calendaritem.monthTitle(dateArr[0], dateArr[1])) {
|
|
10661
10664
|
if (months.current) {
|
|
@@ -10757,9 +10760,9 @@ const CalendarItem = React__default.forwardRef((props, ref) => {
|
|
|
10757
10760
|
onClick: confirm2
|
|
10758
10761
|
}, confirmText || locale.confirm)) : ""));
|
|
10759
10762
|
});
|
|
10760
|
-
CalendarItem.defaultProps = defaultProps$
|
|
10763
|
+
CalendarItem.defaultProps = defaultProps$Z;
|
|
10761
10764
|
CalendarItem.displayName = "NutCalendarItem";
|
|
10762
|
-
const defaultProps$
|
|
10765
|
+
const defaultProps$Y = {
|
|
10763
10766
|
type: "one",
|
|
10764
10767
|
isAutoBackFill: false,
|
|
10765
10768
|
poppable: true,
|
|
@@ -10791,7 +10794,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
10791
10794
|
const {
|
|
10792
10795
|
poppable,
|
|
10793
10796
|
visible,
|
|
10794
|
-
type,
|
|
10797
|
+
type: type4,
|
|
10795
10798
|
isAutoBackFill,
|
|
10796
10799
|
title,
|
|
10797
10800
|
defaultValue,
|
|
@@ -10811,7 +10814,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
10811
10814
|
onClose,
|
|
10812
10815
|
onChoose,
|
|
10813
10816
|
onSelected
|
|
10814
|
-
} = { ...defaultProps$
|
|
10817
|
+
} = { ...defaultProps$Y, ...props };
|
|
10815
10818
|
const calendarRef = useRef(null);
|
|
10816
10819
|
const close = () => {
|
|
10817
10820
|
onClose && onClose();
|
|
@@ -10826,9 +10829,9 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
10826
10829
|
const select = (param) => {
|
|
10827
10830
|
onSelected && onSelected(param);
|
|
10828
10831
|
};
|
|
10829
|
-
const scrollToDate = (
|
|
10832
|
+
const scrollToDate = (date4) => {
|
|
10830
10833
|
var _a;
|
|
10831
|
-
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(
|
|
10834
|
+
(_a = calendarRef.current) == null ? void 0 : _a.scrollToDate(date4);
|
|
10832
10835
|
};
|
|
10833
10836
|
React__default.useImperativeHandle(ref, () => ({
|
|
10834
10837
|
scrollToDate
|
|
@@ -10836,7 +10839,7 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
10836
10839
|
const renderItem = () => {
|
|
10837
10840
|
return /* @__PURE__ */ React__default.createElement(CalendarItem, {
|
|
10838
10841
|
ref: calendarRef,
|
|
10839
|
-
type,
|
|
10842
|
+
type: type4,
|
|
10840
10843
|
isAutoBackFill,
|
|
10841
10844
|
poppable,
|
|
10842
10845
|
title: locale.calendaritem.title || title,
|
|
@@ -10870,9 +10873,9 @@ const Calendar = React__default.forwardRef((props, ref) => {
|
|
|
10870
10873
|
style: { height: "85vh" }
|
|
10871
10874
|
}, renderItem()) : renderItem());
|
|
10872
10875
|
});
|
|
10873
|
-
Calendar.defaultProps = defaultProps$
|
|
10876
|
+
Calendar.defaultProps = defaultProps$Y;
|
|
10874
10877
|
Calendar.displayName = "NutCalendar";
|
|
10875
|
-
const defaultProps$
|
|
10878
|
+
const defaultProps$X = {
|
|
10876
10879
|
disabled: false,
|
|
10877
10880
|
checkedValue: [],
|
|
10878
10881
|
max: void 0,
|
|
@@ -10882,7 +10885,7 @@ const defaultProps$V = {
|
|
|
10882
10885
|
};
|
|
10883
10886
|
const CheckboxGroup = React__default.forwardRef(
|
|
10884
10887
|
(props, ref) => {
|
|
10885
|
-
const { children } = { ...defaultProps$
|
|
10888
|
+
const { children } = { ...defaultProps$X, ...props };
|
|
10886
10889
|
const b2 = cn("checkboxgroup");
|
|
10887
10890
|
const {
|
|
10888
10891
|
className,
|
|
@@ -10989,9 +10992,9 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
10989
10992
|
}, (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : cloneChildren());
|
|
10990
10993
|
}
|
|
10991
10994
|
);
|
|
10992
|
-
CheckboxGroup.defaultProps = defaultProps$
|
|
10995
|
+
CheckboxGroup.defaultProps = defaultProps$X;
|
|
10993
10996
|
CheckboxGroup.displayName = "NutCheckboxGroup";
|
|
10994
|
-
const defaultProps$
|
|
10997
|
+
const defaultProps$W = {
|
|
10995
10998
|
...ComponentDefaults,
|
|
10996
10999
|
checked: false,
|
|
10997
11000
|
disabled: false,
|
|
@@ -11007,7 +11010,7 @@ const defaultProps$U = {
|
|
|
11007
11010
|
};
|
|
11008
11011
|
const Checkbox = (props) => {
|
|
11009
11012
|
const { children } = {
|
|
11010
|
-
...defaultProps$
|
|
11013
|
+
...defaultProps$W,
|
|
11011
11014
|
...props
|
|
11012
11015
|
};
|
|
11013
11016
|
const b2 = cn("checkbox");
|
|
@@ -11089,7 +11092,7 @@ const Checkbox = (props) => {
|
|
|
11089
11092
|
onClick: handleClick2
|
|
11090
11093
|
}, renderIcon(), renderLabel());
|
|
11091
11094
|
};
|
|
11092
|
-
Checkbox.defaultProps = defaultProps$
|
|
11095
|
+
Checkbox.defaultProps = defaultProps$W;
|
|
11093
11096
|
Checkbox.displayName = "NutCheckBox";
|
|
11094
11097
|
Checkbox.Group = CheckboxGroup;
|
|
11095
11098
|
const InternalPickerSlot = (props, ref) => {
|
|
@@ -11125,18 +11128,18 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
11125
11128
|
}
|
|
11126
11129
|
return false;
|
|
11127
11130
|
};
|
|
11128
|
-
const setTransform = (translateY = 0,
|
|
11131
|
+
const setTransform = (translateY = 0, type4, time = DEFAULT_DURATION, deg) => {
|
|
11129
11132
|
let nTime = time;
|
|
11130
|
-
if (
|
|
11133
|
+
if (type4 !== "end") {
|
|
11131
11134
|
nTime = 0;
|
|
11132
11135
|
}
|
|
11133
11136
|
setTouchTime(nTime);
|
|
11134
11137
|
setTouchDeg(deg);
|
|
11135
11138
|
setScrollDistance(translateY);
|
|
11136
11139
|
};
|
|
11137
|
-
const setMove = (move,
|
|
11140
|
+
const setMove = (move, type4, time) => {
|
|
11138
11141
|
let updateMove = move + transformY.current;
|
|
11139
|
-
if (
|
|
11142
|
+
if (type4 === "end") {
|
|
11140
11143
|
if (updateMove > 0) {
|
|
11141
11144
|
updateMove = 0;
|
|
11142
11145
|
}
|
|
@@ -11145,7 +11148,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
11145
11148
|
}
|
|
11146
11149
|
const endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
|
|
11147
11150
|
const deg = `${(Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation}deg`;
|
|
11148
|
-
setTransform(endMove,
|
|
11151
|
+
setTransform(endMove, type4, time, deg);
|
|
11149
11152
|
setCurrIndex(Math.abs(Math.round(endMove / lineSpacing)) + 1);
|
|
11150
11153
|
} else {
|
|
11151
11154
|
let deg = 0;
|
|
@@ -11198,7 +11201,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
11198
11201
|
nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
|
|
11199
11202
|
return nDistance;
|
|
11200
11203
|
};
|
|
11201
|
-
const modifyStatus = (
|
|
11204
|
+
const modifyStatus = (type4, val) => {
|
|
11202
11205
|
const value = val || defaultValue;
|
|
11203
11206
|
let index = -1;
|
|
11204
11207
|
if (value) {
|
|
@@ -11218,7 +11221,7 @@ const InternalPickerSlot = (props, ref) => {
|
|
|
11218
11221
|
}
|
|
11219
11222
|
setCurrIndex(index === -1 ? 1 : index + 1);
|
|
11220
11223
|
const move = index === -1 ? 0 : index * lineSpacing;
|
|
11221
|
-
|
|
11224
|
+
type4 && setChooseValue(-move);
|
|
11222
11225
|
setMove(-move);
|
|
11223
11226
|
};
|
|
11224
11227
|
const stopMomentum = () => {
|
|
@@ -11417,8 +11420,8 @@ const InternalPicker = (props, ref) => {
|
|
|
11417
11420
|
}
|
|
11418
11421
|
};
|
|
11419
11422
|
const normalListData = () => {
|
|
11420
|
-
const
|
|
11421
|
-
switch (
|
|
11423
|
+
const type4 = columnsType();
|
|
11424
|
+
switch (type4) {
|
|
11422
11425
|
case "multiple":
|
|
11423
11426
|
return listData;
|
|
11424
11427
|
case "cascade":
|
|
@@ -11514,7 +11517,7 @@ const InternalPicker = (props, ref) => {
|
|
|
11514
11517
|
};
|
|
11515
11518
|
const Picker = React__default.forwardRef(InternalPicker);
|
|
11516
11519
|
const currentYear = new Date().getFullYear();
|
|
11517
|
-
const defaultProps$
|
|
11520
|
+
const defaultProps$V = {
|
|
11518
11521
|
modelValue: null,
|
|
11519
11522
|
visible: false,
|
|
11520
11523
|
title: "",
|
|
@@ -11529,7 +11532,7 @@ const DatePicker = (props) => {
|
|
|
11529
11532
|
const {
|
|
11530
11533
|
minDate,
|
|
11531
11534
|
maxDate,
|
|
11532
|
-
type,
|
|
11535
|
+
type: type4,
|
|
11533
11536
|
isShowChinese,
|
|
11534
11537
|
minuteStep,
|
|
11535
11538
|
modelValue,
|
|
@@ -11545,7 +11548,7 @@ const DatePicker = (props) => {
|
|
|
11545
11548
|
style,
|
|
11546
11549
|
...rest
|
|
11547
11550
|
} = {
|
|
11548
|
-
...defaultProps$
|
|
11551
|
+
...defaultProps$V,
|
|
11549
11552
|
...props
|
|
11550
11553
|
};
|
|
11551
11554
|
const { locale } = useConfig();
|
|
@@ -11578,16 +11581,16 @@ const DatePicker = (props) => {
|
|
|
11578
11581
|
function getMonthEndDay(year, month) {
|
|
11579
11582
|
return new Date(year, month, 0).getDate();
|
|
11580
11583
|
}
|
|
11581
|
-
const getBoundary = (
|
|
11582
|
-
const boundary =
|
|
11584
|
+
const getBoundary = (type22, value) => {
|
|
11585
|
+
const boundary = type22 === "min" ? minDate : maxDate;
|
|
11583
11586
|
const year = boundary.getFullYear();
|
|
11584
11587
|
let month = 1;
|
|
11585
|
-
let
|
|
11588
|
+
let date4 = 1;
|
|
11586
11589
|
let hour = 0;
|
|
11587
11590
|
let minute = 0;
|
|
11588
|
-
if (
|
|
11591
|
+
if (type22 === "max") {
|
|
11589
11592
|
month = 12;
|
|
11590
|
-
|
|
11593
|
+
date4 = getMonthEndDay(value.getFullYear(), value.getMonth() + 1);
|
|
11591
11594
|
hour = 23;
|
|
11592
11595
|
minute = 59;
|
|
11593
11596
|
}
|
|
@@ -11595,8 +11598,8 @@ const DatePicker = (props) => {
|
|
|
11595
11598
|
if (value.getFullYear() === year) {
|
|
11596
11599
|
month = boundary.getMonth() + 1;
|
|
11597
11600
|
if (value.getMonth() + 1 === month) {
|
|
11598
|
-
|
|
11599
|
-
if (value.getDate() ===
|
|
11601
|
+
date4 = boundary.getDate();
|
|
11602
|
+
if (value.getDate() === date4) {
|
|
11600
11603
|
hour = boundary.getHours();
|
|
11601
11604
|
if (value.getHours() === hour) {
|
|
11602
11605
|
minute = boundary.getMinutes();
|
|
@@ -11605,16 +11608,16 @@ const DatePicker = (props) => {
|
|
|
11605
11608
|
}
|
|
11606
11609
|
}
|
|
11607
11610
|
return {
|
|
11608
|
-
[`${
|
|
11609
|
-
[`${
|
|
11610
|
-
[`${
|
|
11611
|
-
[`${
|
|
11612
|
-
[`${
|
|
11613
|
-
[`${
|
|
11611
|
+
[`${type22}Year`]: year,
|
|
11612
|
+
[`${type22}Month`]: month,
|
|
11613
|
+
[`${type22}Date`]: date4,
|
|
11614
|
+
[`${type22}Hour`]: hour,
|
|
11615
|
+
[`${type22}Minute`]: minute,
|
|
11616
|
+
[`${type22}Seconds`]: seconds
|
|
11614
11617
|
};
|
|
11615
11618
|
};
|
|
11616
|
-
const ranges = (
|
|
11617
|
-
const curDate =
|
|
11619
|
+
const ranges = (date4) => {
|
|
11620
|
+
const curDate = date4 || currentDate;
|
|
11618
11621
|
if (!curDate)
|
|
11619
11622
|
return [];
|
|
11620
11623
|
const { maxYear, maxDate: maxDate2, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
|
|
@@ -11645,7 +11648,7 @@ const DatePicker = (props) => {
|
|
|
11645
11648
|
range: [minSeconds, maxSeconds]
|
|
11646
11649
|
}
|
|
11647
11650
|
];
|
|
11648
|
-
switch (
|
|
11651
|
+
switch (type4.toLocaleLowerCase()) {
|
|
11649
11652
|
case "date":
|
|
11650
11653
|
result = result.slice(0, 3);
|
|
11651
11654
|
break;
|
|
@@ -11669,18 +11672,18 @@ const DatePicker = (props) => {
|
|
|
11669
11672
|
};
|
|
11670
11673
|
const updateChooseValueCustmer = (index, selectedValue, cacheValueData) => {
|
|
11671
11674
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
11672
|
-
|
|
11675
|
+
type4.toLocaleLowerCase()
|
|
11673
11676
|
)) {
|
|
11674
11677
|
const formatDate = [];
|
|
11675
11678
|
selectedValue.forEach((item) => {
|
|
11676
11679
|
formatDate.push(item);
|
|
11677
11680
|
});
|
|
11678
|
-
if (
|
|
11681
|
+
if (type4.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
|
|
11679
11682
|
formatDate.unshift(
|
|
11680
11683
|
new Date(modelValue || minDate || maxDate).getFullYear()
|
|
11681
11684
|
);
|
|
11682
11685
|
}
|
|
11683
|
-
if (
|
|
11686
|
+
if (type4.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
|
|
11684
11687
|
formatDate.push(new Date(modelValue || minDate || maxDate).getDate());
|
|
11685
11688
|
}
|
|
11686
11689
|
const year = Number(formatDate[0]);
|
|
@@ -11689,22 +11692,22 @@ const DatePicker = (props) => {
|
|
|
11689
11692
|
Number(formatDate[2]),
|
|
11690
11693
|
getMonthEndDay(Number(formatDate[0]), Number(formatDate[1]))
|
|
11691
11694
|
);
|
|
11692
|
-
let
|
|
11693
|
-
if (
|
|
11694
|
-
|
|
11695
|
-
} else if (
|
|
11696
|
-
|
|
11695
|
+
let date4 = null;
|
|
11696
|
+
if (type4.toLocaleLowerCase() === "date" || type4.toLocaleLowerCase() === "month-day" || type4.toLocaleLowerCase() === "year-month") {
|
|
11697
|
+
date4 = new Date(year, month, day);
|
|
11698
|
+
} else if (type4.toLocaleLowerCase() === "datetime") {
|
|
11699
|
+
date4 = new Date(
|
|
11697
11700
|
year,
|
|
11698
11701
|
month,
|
|
11699
11702
|
day,
|
|
11700
11703
|
Number(formatDate[3]),
|
|
11701
11704
|
Number(formatDate[4])
|
|
11702
11705
|
);
|
|
11703
|
-
} else if (
|
|
11704
|
-
|
|
11706
|
+
} else if (type4.toLocaleLowerCase() === "datehour") {
|
|
11707
|
+
date4 = new Date(year, month, day, Number(formatDate[3]));
|
|
11705
11708
|
}
|
|
11706
|
-
const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (
|
|
11707
|
-
|
|
11709
|
+
const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date4 == null ? void 0 : date4.getTime());
|
|
11710
|
+
date4 && isDate(date4) && !isEqual2 && setCurrentDate(formatValue(date4));
|
|
11708
11711
|
}
|
|
11709
11712
|
props.onChange && props.onChange(index, selectedValue, cacheValueData);
|
|
11710
11713
|
};
|
|
@@ -11715,27 +11718,27 @@ const DatePicker = (props) => {
|
|
|
11715
11718
|
}
|
|
11716
11719
|
return str;
|
|
11717
11720
|
};
|
|
11718
|
-
const formatterOption = (
|
|
11721
|
+
const formatterOption = (type22, value) => {
|
|
11719
11722
|
let fOption = null;
|
|
11720
11723
|
if (formatter) {
|
|
11721
|
-
fOption = formatter(
|
|
11724
|
+
fOption = formatter(type22, {
|
|
11722
11725
|
text: padZero(value, 2),
|
|
11723
11726
|
value: padZero(value, 2)
|
|
11724
11727
|
});
|
|
11725
11728
|
} else {
|
|
11726
11729
|
const padMin = padZero(value, 2);
|
|
11727
|
-
const fatter = isShowChinese ? zhCNType[
|
|
11730
|
+
const fatter = isShowChinese ? zhCNType[type22] : "";
|
|
11728
11731
|
fOption = { text: padMin + fatter, value: padMin };
|
|
11729
11732
|
}
|
|
11730
11733
|
return fOption;
|
|
11731
11734
|
};
|
|
11732
|
-
const generateValue = (min, max, val,
|
|
11735
|
+
const generateValue = (min, max, val, type22, columnIndex) => {
|
|
11733
11736
|
let cmin = min;
|
|
11734
11737
|
const arr = [];
|
|
11735
11738
|
let index = 0;
|
|
11736
11739
|
while (cmin <= max) {
|
|
11737
|
-
arr.push(formatterOption(
|
|
11738
|
-
if (
|
|
11740
|
+
arr.push(formatterOption(type22, cmin));
|
|
11741
|
+
if (type22 === "minute") {
|
|
11739
11742
|
cmin += minuteStep;
|
|
11740
11743
|
} else {
|
|
11741
11744
|
cmin++;
|
|
@@ -11746,32 +11749,32 @@ const DatePicker = (props) => {
|
|
|
11746
11749
|
}
|
|
11747
11750
|
defaultValue[columnIndex] = arr[index].value;
|
|
11748
11751
|
setDefaultValue([...defaultValue]);
|
|
11749
|
-
if (props.filter && props.filter(
|
|
11750
|
-
return props.filter(
|
|
11752
|
+
if (props.filter && props.filter(type22, arr)) {
|
|
11753
|
+
return props.filter(type22, arr);
|
|
11751
11754
|
}
|
|
11752
11755
|
return arr;
|
|
11753
11756
|
};
|
|
11754
|
-
const getDateIndex = (
|
|
11757
|
+
const getDateIndex = (type22) => {
|
|
11755
11758
|
if (!currentDate)
|
|
11756
11759
|
return 0;
|
|
11757
11760
|
let d2 = 0;
|
|
11758
|
-
if (
|
|
11761
|
+
if (type22 === "year") {
|
|
11759
11762
|
d2 = currentDate.getFullYear();
|
|
11760
|
-
} else if (
|
|
11763
|
+
} else if (type22 === "month") {
|
|
11761
11764
|
d2 = currentDate.getMonth() + 1;
|
|
11762
|
-
} else if (
|
|
11765
|
+
} else if (type22 === "day") {
|
|
11763
11766
|
d2 = currentDate.getDate();
|
|
11764
|
-
} else if (
|
|
11767
|
+
} else if (type22 === "hour") {
|
|
11765
11768
|
d2 = currentDate.getHours();
|
|
11766
|
-
} else if (
|
|
11769
|
+
} else if (type22 === "minute") {
|
|
11767
11770
|
d2 = currentDate.getMinutes();
|
|
11768
|
-
} else if (
|
|
11771
|
+
} else if (type22 === "seconds") {
|
|
11769
11772
|
d2 = currentDate.getSeconds();
|
|
11770
11773
|
}
|
|
11771
11774
|
return d2;
|
|
11772
11775
|
};
|
|
11773
|
-
const columns = (
|
|
11774
|
-
const val = ranges(
|
|
11776
|
+
const columns = (date4) => {
|
|
11777
|
+
const val = ranges(date4).map((res, columnIndex) => {
|
|
11775
11778
|
return generateValue(
|
|
11776
11779
|
res.range[0],
|
|
11777
11780
|
res.range[1],
|
|
@@ -11811,9 +11814,9 @@ const DatePicker = (props) => {
|
|
|
11811
11814
|
ref: pickerRef
|
|
11812
11815
|
}));
|
|
11813
11816
|
};
|
|
11814
|
-
DatePicker.defaultProps = defaultProps$
|
|
11817
|
+
DatePicker.defaultProps = defaultProps$V;
|
|
11815
11818
|
DatePicker.displayName = "NutDatePicker";
|
|
11816
|
-
const defaultProps$
|
|
11819
|
+
const defaultProps$U = {
|
|
11817
11820
|
...ComponentDefaults,
|
|
11818
11821
|
disabled: false,
|
|
11819
11822
|
buttonSize: "",
|
|
@@ -11860,7 +11863,7 @@ const InputNumber = (props) => {
|
|
|
11860
11863
|
iconFontClassName,
|
|
11861
11864
|
...restProps
|
|
11862
11865
|
} = {
|
|
11863
|
-
...defaultProps$
|
|
11866
|
+
...defaultProps$U,
|
|
11864
11867
|
...props
|
|
11865
11868
|
};
|
|
11866
11869
|
const [inputValue, setInputValue] = useState(modelValue);
|
|
@@ -11997,7 +12000,7 @@ const InputNumber = (props) => {
|
|
|
11997
12000
|
onClick: addNumber
|
|
11998
12001
|
}));
|
|
11999
12002
|
};
|
|
12000
|
-
InputNumber.defaultProps = defaultProps$
|
|
12003
|
+
InputNumber.defaultProps = defaultProps$U;
|
|
12001
12004
|
InputNumber.displayName = "NutInputNumber";
|
|
12002
12005
|
function trimExtraChar(value, char, regExp) {
|
|
12003
12006
|
const index = value.indexOf(char);
|
|
@@ -12023,7 +12026,7 @@ function formatNumber(value, allowDot = true, allowMinus = true) {
|
|
|
12023
12026
|
const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
|
|
12024
12027
|
return value.replace(regExp, "");
|
|
12025
12028
|
}
|
|
12026
|
-
const defaultProps$
|
|
12029
|
+
const defaultProps$T = {
|
|
12027
12030
|
...ComponentDefaults,
|
|
12028
12031
|
type: "text",
|
|
12029
12032
|
name: "",
|
|
@@ -12063,7 +12066,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
12063
12066
|
const { locale } = useConfig();
|
|
12064
12067
|
const {
|
|
12065
12068
|
children,
|
|
12066
|
-
type,
|
|
12069
|
+
type: type4,
|
|
12067
12070
|
name,
|
|
12068
12071
|
defaultValue,
|
|
12069
12072
|
placeholder,
|
|
@@ -12074,7 +12077,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
12074
12077
|
colon,
|
|
12075
12078
|
inputAlign,
|
|
12076
12079
|
center,
|
|
12077
|
-
required,
|
|
12080
|
+
required: required4,
|
|
12078
12081
|
disabled,
|
|
12079
12082
|
readonly,
|
|
12080
12083
|
error,
|
|
@@ -12088,7 +12091,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
12088
12091
|
clearSize,
|
|
12089
12092
|
border,
|
|
12090
12093
|
formatTrigger,
|
|
12091
|
-
rules,
|
|
12094
|
+
rules: rules2,
|
|
12092
12095
|
errorMessage,
|
|
12093
12096
|
errorMessageAlign,
|
|
12094
12097
|
showWordLimit,
|
|
@@ -12120,7 +12123,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
12120
12123
|
iconFontClassName,
|
|
12121
12124
|
...rest
|
|
12122
12125
|
} = {
|
|
12123
|
-
...defaultProps$
|
|
12126
|
+
...defaultProps$T,
|
|
12124
12127
|
...props
|
|
12125
12128
|
};
|
|
12126
12129
|
locale.placeholder = placeholder || locale.placeholder;
|
|
@@ -12151,21 +12154,21 @@ const Input = forwardRef((props, ref) => {
|
|
|
12151
12154
|
prefixCls,
|
|
12152
12155
|
`${center ? "center" : ""}`,
|
|
12153
12156
|
`${disabled ? `${prefixCls}-disabled` : ""}`,
|
|
12154
|
-
`${
|
|
12157
|
+
`${required4 ? `${prefixCls}-required` : ""}`,
|
|
12155
12158
|
`${error ? `${prefixCls}-error` : ""}`,
|
|
12156
12159
|
`${border ? `${prefixCls}-border` : ""}`
|
|
12157
12160
|
].filter(Boolean).join(" ");
|
|
12158
|
-
}, [disabled,
|
|
12161
|
+
}, [disabled, required4, error, border]);
|
|
12159
12162
|
const updateValue = (value, trigger = "onChange") => {
|
|
12160
12163
|
var _a;
|
|
12161
12164
|
let val = value;
|
|
12162
|
-
if (
|
|
12165
|
+
if (type4 === "digit" || type4 === "tel") {
|
|
12163
12166
|
val = formatNumber(val, false, false);
|
|
12164
12167
|
}
|
|
12165
|
-
if (
|
|
12168
|
+
if (type4 === "number") {
|
|
12166
12169
|
val = formatNumber(val, true, true);
|
|
12167
12170
|
}
|
|
12168
|
-
if (
|
|
12171
|
+
if (type4 === "tel" && !formatter) {
|
|
12169
12172
|
const regTel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
|
|
12170
12173
|
const regNumber = /[^-0-9]/g;
|
|
12171
12174
|
val = !regTel.test(val) && val.length > 11 ? val.substring(0, 11) : val.replace(regNumber, "");
|
|
@@ -12219,14 +12222,14 @@ const Input = forwardRef((props, ref) => {
|
|
|
12219
12222
|
};
|
|
12220
12223
|
const resetValidation = () => {
|
|
12221
12224
|
};
|
|
12222
|
-
const inputType = (
|
|
12223
|
-
if (
|
|
12225
|
+
const inputType = (type22) => {
|
|
12226
|
+
if (type22 === "number") {
|
|
12224
12227
|
return "text";
|
|
12225
12228
|
}
|
|
12226
|
-
if (
|
|
12229
|
+
if (type22 === "digit") {
|
|
12227
12230
|
return "tel";
|
|
12228
12231
|
}
|
|
12229
|
-
return
|
|
12232
|
+
return type22;
|
|
12230
12233
|
};
|
|
12231
12234
|
const handleClear = (event) => {
|
|
12232
12235
|
updateValue("");
|
|
@@ -12275,7 +12278,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
12275
12278
|
onClick: (e2) => {
|
|
12276
12279
|
handleClickInput(e2);
|
|
12277
12280
|
}
|
|
12278
|
-
},
|
|
12281
|
+
}, type4 === "textarea" ? /* @__PURE__ */ React__default.createElement("textarea", {
|
|
12279
12282
|
name,
|
|
12280
12283
|
className: "input-text",
|
|
12281
12284
|
ref: inputRef,
|
|
@@ -12303,7 +12306,7 @@ const Input = forwardRef((props, ref) => {
|
|
|
12303
12306
|
className: "input-text",
|
|
12304
12307
|
ref: inputRef,
|
|
12305
12308
|
style: { textAlign: inputAlign },
|
|
12306
|
-
type: inputType(
|
|
12309
|
+
type: inputType(type4),
|
|
12307
12310
|
maxLength: maxlength,
|
|
12308
12311
|
placeholder: placeholder || locale.placeholder,
|
|
12309
12312
|
disabled,
|
|
@@ -12351,14 +12354,14 @@ const Input = forwardRef((props, ref) => {
|
|
|
12351
12354
|
}
|
|
12352
12355
|
}, errorMessage) : null)));
|
|
12353
12356
|
});
|
|
12354
|
-
Input.defaultProps = defaultProps$
|
|
12357
|
+
Input.defaultProps = defaultProps$T;
|
|
12355
12358
|
Input.displayName = "NutInput";
|
|
12356
12359
|
const radioContext = {
|
|
12357
12360
|
onChange: (val) => {
|
|
12358
12361
|
}
|
|
12359
12362
|
};
|
|
12360
12363
|
var RadioContext = React__default.createContext(radioContext);
|
|
12361
|
-
const defaultProps$
|
|
12364
|
+
const defaultProps$S = {
|
|
12362
12365
|
value: null,
|
|
12363
12366
|
textPosition: "right",
|
|
12364
12367
|
onChange: (value) => {
|
|
@@ -12368,7 +12371,7 @@ const defaultProps$Q = {
|
|
|
12368
12371
|
};
|
|
12369
12372
|
const RadioGroup = React__default.forwardRef(
|
|
12370
12373
|
(props, ref) => {
|
|
12371
|
-
const { children } = { ...defaultProps$
|
|
12374
|
+
const { children } = { ...defaultProps$S, ...props };
|
|
12372
12375
|
cn("RadioGroup");
|
|
12373
12376
|
const {
|
|
12374
12377
|
className,
|
|
@@ -12433,9 +12436,9 @@ const RadioGroup = React__default.forwardRef(
|
|
|
12433
12436
|
}, (options2 == null ? void 0 : options2.length) ? renderOptionsChildren() : cloneChildren()));
|
|
12434
12437
|
}
|
|
12435
12438
|
);
|
|
12436
|
-
RadioGroup.defaultProps = defaultProps$
|
|
12439
|
+
RadioGroup.defaultProps = defaultProps$S;
|
|
12437
12440
|
RadioGroup.displayName = "NutRadioGroup";
|
|
12438
|
-
const defaultProps$
|
|
12441
|
+
const defaultProps$R = {
|
|
12439
12442
|
...ComponentDefaults,
|
|
12440
12443
|
className: "",
|
|
12441
12444
|
style: {},
|
|
@@ -12452,7 +12455,7 @@ const defaultProps$P = {
|
|
|
12452
12455
|
};
|
|
12453
12456
|
const Radio = (props) => {
|
|
12454
12457
|
const { children } = {
|
|
12455
|
-
...defaultProps$
|
|
12458
|
+
...defaultProps$R,
|
|
12456
12459
|
...props
|
|
12457
12460
|
};
|
|
12458
12461
|
const {
|
|
@@ -12532,10 +12535,10 @@ const Radio = (props) => {
|
|
|
12532
12535
|
...rest
|
|
12533
12536
|
}, renderRadioItem());
|
|
12534
12537
|
};
|
|
12535
|
-
Radio.defaultProps = defaultProps$
|
|
12538
|
+
Radio.defaultProps = defaultProps$R;
|
|
12536
12539
|
Radio.displayName = "NutRadio";
|
|
12537
12540
|
Radio.RadioGroup = RadioGroup;
|
|
12538
|
-
const defaultProps$
|
|
12541
|
+
const defaultProps$Q = {
|
|
12539
12542
|
...ComponentDefaults,
|
|
12540
12543
|
count: 5,
|
|
12541
12544
|
modelValue: 0,
|
|
@@ -12570,7 +12573,7 @@ const Rate = (props) => {
|
|
|
12570
12573
|
iconClassPrefix,
|
|
12571
12574
|
iconFontClassName
|
|
12572
12575
|
} = {
|
|
12573
|
-
...defaultProps$
|
|
12576
|
+
...defaultProps$Q,
|
|
12574
12577
|
...props
|
|
12575
12578
|
};
|
|
12576
12579
|
const b2 = cn("rate");
|
|
@@ -12643,9 +12646,9 @@ const Rate = (props) => {
|
|
|
12643
12646
|
}));
|
|
12644
12647
|
}));
|
|
12645
12648
|
};
|
|
12646
|
-
Rate.defaultProps = defaultProps$
|
|
12649
|
+
Rate.defaultProps = defaultProps$Q;
|
|
12647
12650
|
Rate.displayName = "NutRate";
|
|
12648
|
-
const defaultProps$
|
|
12651
|
+
const defaultProps$P = {
|
|
12649
12652
|
...ComponentDefaults,
|
|
12650
12653
|
title: "",
|
|
12651
12654
|
desc: "",
|
|
@@ -12696,11 +12699,11 @@ const ShortPassword = (props) => {
|
|
|
12696
12699
|
} = props;
|
|
12697
12700
|
const b2 = cn("shortpassword");
|
|
12698
12701
|
const textInput = useRef(null);
|
|
12699
|
-
const
|
|
12702
|
+
const range3 = (val) => {
|
|
12700
12703
|
return Math.min(Math.max(4, val), 6);
|
|
12701
12704
|
};
|
|
12702
12705
|
const [innerVisible, setInnerVisible] = useState(visible);
|
|
12703
|
-
const [comLen, setComLen] = useState(
|
|
12706
|
+
const [comLen, setComLen] = useState(range3(Number(length)));
|
|
12704
12707
|
const [inputValue, setInputValue] = useState("");
|
|
12705
12708
|
useEffect(() => {
|
|
12706
12709
|
setInnerVisible(visible);
|
|
@@ -12813,9 +12816,9 @@ const ShortPassword = (props) => {
|
|
|
12813
12816
|
onClick: () => sure()
|
|
12814
12817
|
}, locale.confirm)) : null)));
|
|
12815
12818
|
};
|
|
12816
|
-
ShortPassword.defaultProps = defaultProps$
|
|
12819
|
+
ShortPassword.defaultProps = defaultProps$P;
|
|
12817
12820
|
ShortPassword.displayName = "NutShortPassword";
|
|
12818
|
-
const defaultProps$
|
|
12821
|
+
const defaultProps$O = {
|
|
12819
12822
|
defaultValue: "",
|
|
12820
12823
|
textAlign: "left",
|
|
12821
12824
|
limitshow: false,
|
|
@@ -12843,18 +12846,16 @@ const TextArea = (props) => {
|
|
|
12843
12846
|
onChange,
|
|
12844
12847
|
onBlur,
|
|
12845
12848
|
onFocus
|
|
12846
|
-
} = { ...defaultProps$
|
|
12849
|
+
} = { ...defaultProps$O, ...props };
|
|
12847
12850
|
const textareaBem = cn("textarea");
|
|
12848
12851
|
const [inputValue, SetInputValue] = useState("");
|
|
12849
12852
|
const textareaRef = useRef(null);
|
|
12850
12853
|
useEffect(() => {
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
initValue = initValue.substring(0, Number(maxlength));
|
|
12855
|
-
}
|
|
12856
|
-
SetInputValue(initValue);
|
|
12854
|
+
let initValue = defaultValue;
|
|
12855
|
+
if (initValue && maxlength && [...initValue].length > Number(maxlength)) {
|
|
12856
|
+
initValue = initValue.substring(0, Number(maxlength));
|
|
12857
12857
|
}
|
|
12858
|
+
SetInputValue(initValue);
|
|
12858
12859
|
if (autosize) {
|
|
12859
12860
|
setTimeout(() => {
|
|
12860
12861
|
setContentHeight();
|
|
@@ -12889,7 +12890,7 @@ const TextArea = (props) => {
|
|
|
12889
12890
|
};
|
|
12890
12891
|
const textChange = (event) => {
|
|
12891
12892
|
const text = event.target;
|
|
12892
|
-
if (maxlength && text.value.length > Number(maxlength)) {
|
|
12893
|
+
if (maxlength && [...text.value].length > Number(maxlength)) {
|
|
12893
12894
|
text.value = text.value.substring(0, Number(maxlength));
|
|
12894
12895
|
}
|
|
12895
12896
|
SetInputValue(text.value);
|
|
@@ -12940,11 +12941,11 @@ const TextArea = (props) => {
|
|
|
12940
12941
|
placeholder: placeholder || locale.placeholder
|
|
12941
12942
|
}), limitshow ? /* @__PURE__ */ React__default.createElement("div", {
|
|
12942
12943
|
className: textareaBem("limit")
|
|
12943
|
-
}, inputValue.length, "/", maxlength < 0 ? 0 : maxlength) : null);
|
|
12944
|
+
}, [...inputValue].length, "/", maxlength < 0 ? 0 : maxlength) : null);
|
|
12944
12945
|
};
|
|
12945
|
-
TextArea.defaultProps = defaultProps$
|
|
12946
|
+
TextArea.defaultProps = defaultProps$O;
|
|
12946
12947
|
TextArea.displayName = "NutTextArea";
|
|
12947
|
-
const defaultProps$
|
|
12948
|
+
const defaultProps$N = {
|
|
12948
12949
|
name: "",
|
|
12949
12950
|
size: "",
|
|
12950
12951
|
classPrefix: "nut-icon",
|
|
@@ -12972,11 +12973,11 @@ function Icon(props) {
|
|
|
12972
12973
|
onClick,
|
|
12973
12974
|
...rest
|
|
12974
12975
|
} = {
|
|
12975
|
-
...defaultProps$
|
|
12976
|
+
...defaultProps$N,
|
|
12976
12977
|
...props
|
|
12977
12978
|
};
|
|
12978
12979
|
const isImage = name ? name.indexOf("/") !== -1 : false;
|
|
12979
|
-
const
|
|
12980
|
+
const type4 = isImage ? "img" : tag;
|
|
12980
12981
|
const b2 = cn("icon");
|
|
12981
12982
|
const handleClick2 = (e2) => {
|
|
12982
12983
|
if (onClick) {
|
|
@@ -12989,7 +12990,7 @@ function Icon(props) {
|
|
|
12989
12990
|
return {};
|
|
12990
12991
|
};
|
|
12991
12992
|
return React__default.createElement(
|
|
12992
|
-
|
|
12993
|
+
type4,
|
|
12993
12994
|
{
|
|
12994
12995
|
className: isImage ? `${b2("img")} ${className || ""} ` : `${fontClassName} ${b2(null)} ${classPrefix}-${name} ${className || ""}`,
|
|
12995
12996
|
style: {
|
|
@@ -13006,9 +13007,9 @@ function Icon(props) {
|
|
|
13006
13007
|
children
|
|
13007
13008
|
);
|
|
13008
13009
|
}
|
|
13009
|
-
Icon.defaultProps = defaultProps$
|
|
13010
|
+
Icon.defaultProps = defaultProps$N;
|
|
13010
13011
|
Icon.displayName = "NutIcon";
|
|
13011
|
-
const defaultProps$
|
|
13012
|
+
const defaultProps$M = {
|
|
13012
13013
|
...ComponentDefaults,
|
|
13013
13014
|
className: "",
|
|
13014
13015
|
style: {},
|
|
@@ -13056,7 +13057,7 @@ const Progress = (props) => {
|
|
|
13056
13057
|
iconFontClassName,
|
|
13057
13058
|
...rest
|
|
13058
13059
|
} = {
|
|
13059
|
-
...defaultProps$
|
|
13060
|
+
...defaultProps$M,
|
|
13060
13061
|
...props
|
|
13061
13062
|
};
|
|
13062
13063
|
const b2 = cn("progress");
|
|
@@ -13134,7 +13135,7 @@ const Progress = (props) => {
|
|
|
13134
13135
|
color: iconColor
|
|
13135
13136
|
})));
|
|
13136
13137
|
};
|
|
13137
|
-
Progress.defaultProps = defaultProps$
|
|
13138
|
+
Progress.defaultProps = defaultProps$M;
|
|
13138
13139
|
Progress.displayName = "NutProgress";
|
|
13139
13140
|
class UploadOptions {
|
|
13140
13141
|
constructor() {
|
|
@@ -13232,7 +13233,7 @@ class Upload {
|
|
|
13232
13233
|
}
|
|
13233
13234
|
}
|
|
13234
13235
|
}
|
|
13235
|
-
const defaultProps$
|
|
13236
|
+
const defaultProps$L = {
|
|
13236
13237
|
...ComponentDefaults,
|
|
13237
13238
|
url: "",
|
|
13238
13239
|
maximum: 1,
|
|
@@ -13281,11 +13282,11 @@ const InternalUploader = (props, ref) => {
|
|
|
13281
13282
|
listType,
|
|
13282
13283
|
disabled,
|
|
13283
13284
|
multiple,
|
|
13284
|
-
url,
|
|
13285
|
+
url: url2,
|
|
13285
13286
|
defaultImg,
|
|
13286
13287
|
headers,
|
|
13287
13288
|
timeout,
|
|
13288
|
-
method,
|
|
13289
|
+
method: method4,
|
|
13289
13290
|
xhrState,
|
|
13290
13291
|
withCredentials,
|
|
13291
13292
|
data,
|
|
@@ -13312,7 +13313,7 @@ const InternalUploader = (props, ref) => {
|
|
|
13312
13313
|
onBeforeXhrUpload,
|
|
13313
13314
|
onBeforeDelete,
|
|
13314
13315
|
...restProps
|
|
13315
|
-
} = { ...defaultProps$
|
|
13316
|
+
} = { ...defaultProps$L, ...props };
|
|
13316
13317
|
const [fileList, setFileList] = useState([]);
|
|
13317
13318
|
const [uploadQueue, setUploadQueue] = useState([]);
|
|
13318
13319
|
useEffect(() => {
|
|
@@ -13342,13 +13343,13 @@ const InternalUploader = (props, ref) => {
|
|
|
13342
13343
|
};
|
|
13343
13344
|
const executeUpload = (fileItem, index) => {
|
|
13344
13345
|
const uploadOption = new UploadOptions();
|
|
13345
|
-
uploadOption.url =
|
|
13346
|
+
uploadOption.url = url2;
|
|
13346
13347
|
for (const [key, value] of Object.entries(data)) {
|
|
13347
13348
|
fileItem.formData.append(key, value);
|
|
13348
13349
|
}
|
|
13349
13350
|
uploadOption.formData = fileItem.formData;
|
|
13350
13351
|
uploadOption.timeout = timeout * 1;
|
|
13351
|
-
uploadOption.method =
|
|
13352
|
+
uploadOption.method = method4;
|
|
13352
13353
|
uploadOption.xhrState = xhrState;
|
|
13353
13354
|
uploadOption.headers = headers;
|
|
13354
13355
|
uploadOption.withCredentials = withCredentials;
|
|
@@ -13633,9 +13634,9 @@ const InternalUploader = (props, ref) => {
|
|
|
13633
13634
|
})));
|
|
13634
13635
|
};
|
|
13635
13636
|
const Uploader = React__default.forwardRef(InternalUploader);
|
|
13636
|
-
Uploader.defaultProps = defaultProps$
|
|
13637
|
+
Uploader.defaultProps = defaultProps$L;
|
|
13637
13638
|
Uploader.displayName = "NutUploader";
|
|
13638
|
-
const defaultProps$
|
|
13639
|
+
const defaultProps$K = {
|
|
13639
13640
|
data: {
|
|
13640
13641
|
text: "",
|
|
13641
13642
|
value: "",
|
|
@@ -13650,7 +13651,7 @@ const defaultProps$I = {
|
|
|
13650
13651
|
};
|
|
13651
13652
|
const InternalCascaderItem = (props) => {
|
|
13652
13653
|
const { data, checked, chooseItem } = {
|
|
13653
|
-
...defaultProps$
|
|
13654
|
+
...defaultProps$K,
|
|
13654
13655
|
...props
|
|
13655
13656
|
};
|
|
13656
13657
|
const b2 = cn("cascader-item");
|
|
@@ -13686,7 +13687,7 @@ const InternalCascaderItem = (props) => {
|
|
|
13686
13687
|
}));
|
|
13687
13688
|
};
|
|
13688
13689
|
const CascaderItem = React__default.forwardRef(InternalCascaderItem);
|
|
13689
|
-
CascaderItem.defaultProps = defaultProps$
|
|
13690
|
+
CascaderItem.defaultProps = defaultProps$K;
|
|
13690
13691
|
CascaderItem.displayName = "NutCascaderItem";
|
|
13691
13692
|
const formatTree = (tree, parent, config2) => tree.map((node) => {
|
|
13692
13693
|
const {
|
|
@@ -13820,7 +13821,7 @@ class Tree {
|
|
|
13820
13821
|
return pathNodes;
|
|
13821
13822
|
}
|
|
13822
13823
|
}
|
|
13823
|
-
const defaultProps$
|
|
13824
|
+
const defaultProps$J = {
|
|
13824
13825
|
className: "",
|
|
13825
13826
|
style: {},
|
|
13826
13827
|
poppable: true,
|
|
@@ -13867,7 +13868,7 @@ const InternalCascader = (props) => {
|
|
|
13867
13868
|
onClose,
|
|
13868
13869
|
onChange,
|
|
13869
13870
|
onPathChange
|
|
13870
|
-
} = { ...defaultProps$
|
|
13871
|
+
} = { ...defaultProps$J, ...props };
|
|
13871
13872
|
const [tabvalue, setTabvalue] = useState("c1");
|
|
13872
13873
|
const [optiosData, setOptiosData] = useState([]);
|
|
13873
13874
|
const isLazy = () => state.configs.lazy && Boolean(state.configs.lazyLoad);
|
|
@@ -14022,15 +14023,15 @@ const InternalCascader = (props) => {
|
|
|
14022
14023
|
const closePopup = () => {
|
|
14023
14024
|
close();
|
|
14024
14025
|
};
|
|
14025
|
-
const chooseItem = async (node,
|
|
14026
|
-
if (!
|
|
14026
|
+
const chooseItem = async (node, type4) => {
|
|
14027
|
+
if (!type4 && node.disabled || !state.panes[state.tabsCursor]) {
|
|
14027
14028
|
return;
|
|
14028
14029
|
}
|
|
14029
14030
|
if (state.tree.isLeaf(node, isLazy())) {
|
|
14030
14031
|
node.leaf = true;
|
|
14031
14032
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
14032
14033
|
state.panes = state.panes.slice(0, node.level + 1);
|
|
14033
|
-
if (!
|
|
14034
|
+
if (!type4) {
|
|
14034
14035
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
14035
14036
|
const optionParams = pathNodes.map((item) => item.value);
|
|
14036
14037
|
onChange(optionParams, pathNodes);
|
|
@@ -14052,7 +14053,7 @@ const InternalCascader = (props) => {
|
|
|
14052
14053
|
});
|
|
14053
14054
|
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
14054
14055
|
setOptiosData(state.panes);
|
|
14055
|
-
if (!
|
|
14056
|
+
if (!type4) {
|
|
14056
14057
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
14057
14058
|
const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
|
|
14058
14059
|
onPathChange(optionParams, pathNodes);
|
|
@@ -14066,7 +14067,7 @@ const InternalCascader = (props) => {
|
|
|
14066
14067
|
await invokeLazyLoad(node);
|
|
14067
14068
|
if (state.currentProcessNode === node) {
|
|
14068
14069
|
state.panes[state.tabsCursor].selectedNode = node;
|
|
14069
|
-
chooseItem(node,
|
|
14070
|
+
chooseItem(node, type4);
|
|
14070
14071
|
}
|
|
14071
14072
|
setOptiosData(state.panes);
|
|
14072
14073
|
};
|
|
@@ -14126,9 +14127,9 @@ const InternalCascader = (props) => {
|
|
|
14126
14127
|
}, renderItem()) : renderItem());
|
|
14127
14128
|
};
|
|
14128
14129
|
const Cascader = React__default.forwardRef(InternalCascader);
|
|
14129
|
-
Cascader.defaultProps = defaultProps$
|
|
14130
|
+
Cascader.defaultProps = defaultProps$J;
|
|
14130
14131
|
Cascader.displayName = "NutCascader";
|
|
14131
|
-
const defaultProps$
|
|
14132
|
+
const defaultProps$I = {
|
|
14132
14133
|
...ComponentDefaults,
|
|
14133
14134
|
placeholder: "",
|
|
14134
14135
|
shape: "square",
|
|
@@ -14179,7 +14180,7 @@ const SearchBar = (props) => {
|
|
|
14179
14180
|
iconClassPrefix,
|
|
14180
14181
|
iconFontClassName
|
|
14181
14182
|
} = {
|
|
14182
|
-
...defaultProps$
|
|
14183
|
+
...defaultProps$I,
|
|
14183
14184
|
...props
|
|
14184
14185
|
};
|
|
14185
14186
|
const alignClass = `${align}`;
|
|
@@ -14328,9 +14329,9 @@ const SearchBar = (props) => {
|
|
|
14328
14329
|
className: `${searchbarBem("content")}`
|
|
14329
14330
|
}, renderLeftinIcon(), renderField(), renderRightinIcon(), clearable && value && handleClear()), renderRightoutIcon(), renderRightLabel());
|
|
14330
14331
|
};
|
|
14331
|
-
SearchBar.defaultProps = defaultProps$
|
|
14332
|
+
SearchBar.defaultProps = defaultProps$I;
|
|
14332
14333
|
SearchBar.displayName = "NutSearchBar";
|
|
14333
|
-
const defaultProps$
|
|
14334
|
+
const defaultProps$H = {
|
|
14334
14335
|
confirmText: "",
|
|
14335
14336
|
title: "",
|
|
14336
14337
|
visible: false,
|
|
@@ -14348,7 +14349,7 @@ const NumberKeyboard = (props) => {
|
|
|
14348
14349
|
title,
|
|
14349
14350
|
confirmText,
|
|
14350
14351
|
visible,
|
|
14351
|
-
type,
|
|
14352
|
+
type: type4,
|
|
14352
14353
|
customKey,
|
|
14353
14354
|
randomKeys,
|
|
14354
14355
|
popClass,
|
|
@@ -14471,7 +14472,7 @@ const NumberKeyboard = (props) => {
|
|
|
14471
14472
|
className: b2("header")
|
|
14472
14473
|
}, /* @__PURE__ */ React__default.createElement("h3", {
|
|
14473
14474
|
className: b2("header__tit")
|
|
14474
|
-
}, title),
|
|
14475
|
+
}, title), type4 === "default" ? /* @__PURE__ */ React__default.createElement("span", {
|
|
14475
14476
|
className: b2("header__close"),
|
|
14476
14477
|
onClick: onClose
|
|
14477
14478
|
}, locale.done) : null) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
@@ -14483,7 +14484,7 @@ const NumberKeyboard = (props) => {
|
|
|
14483
14484
|
key: index,
|
|
14484
14485
|
className: classNames({
|
|
14485
14486
|
"key-board-wrapper": true,
|
|
14486
|
-
"key-board-wrapper-large": item.id === 0 &&
|
|
14487
|
+
"key-board-wrapper-large": item.id === 0 && type4 === "rightColumn" && Array.isArray(customKey) && customKey.length === 1
|
|
14487
14488
|
})
|
|
14488
14489
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
14489
14490
|
className: classNames({
|
|
@@ -14502,7 +14503,7 @@ const NumberKeyboard = (props) => {
|
|
|
14502
14503
|
src: "https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png",
|
|
14503
14504
|
alt: ""
|
|
14504
14505
|
}) : null));
|
|
14505
|
-
})),
|
|
14506
|
+
})), type4 === "rightColumn" ? /* @__PURE__ */ React__default.createElement("div", {
|
|
14506
14507
|
className: b2("sidebar")
|
|
14507
14508
|
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
14508
14509
|
className: "key-board-wrapper"
|
|
@@ -14528,8 +14529,1312 @@ const NumberKeyboard = (props) => {
|
|
|
14528
14529
|
})
|
|
14529
14530
|
}, confirmText || locale.done))) : null))));
|
|
14530
14531
|
};
|
|
14531
|
-
NumberKeyboard.defaultProps = defaultProps$
|
|
14532
|
+
NumberKeyboard.defaultProps = defaultProps$H;
|
|
14532
14533
|
NumberKeyboard.displayName = "NutNumberKeyboard";
|
|
14534
|
+
const FormItemContext = createContext$1({});
|
|
14535
|
+
function _extends() {
|
|
14536
|
+
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
14537
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
14538
|
+
var source = arguments[i];
|
|
14539
|
+
for (var key in source) {
|
|
14540
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
14541
|
+
target[key] = source[key];
|
|
14542
|
+
}
|
|
14543
|
+
}
|
|
14544
|
+
}
|
|
14545
|
+
return target;
|
|
14546
|
+
};
|
|
14547
|
+
return _extends.apply(this, arguments);
|
|
14548
|
+
}
|
|
14549
|
+
function _inheritsLoose(subClass, superClass) {
|
|
14550
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
14551
|
+
subClass.prototype.constructor = subClass;
|
|
14552
|
+
_setPrototypeOf(subClass, superClass);
|
|
14553
|
+
}
|
|
14554
|
+
function _getPrototypeOf(o) {
|
|
14555
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
|
|
14556
|
+
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
14557
|
+
};
|
|
14558
|
+
return _getPrototypeOf(o);
|
|
14559
|
+
}
|
|
14560
|
+
function _setPrototypeOf(o, p2) {
|
|
14561
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
|
|
14562
|
+
o2.__proto__ = p3;
|
|
14563
|
+
return o2;
|
|
14564
|
+
};
|
|
14565
|
+
return _setPrototypeOf(o, p2);
|
|
14566
|
+
}
|
|
14567
|
+
function _isNativeReflectConstruct() {
|
|
14568
|
+
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
14569
|
+
return false;
|
|
14570
|
+
if (Reflect.construct.sham)
|
|
14571
|
+
return false;
|
|
14572
|
+
if (typeof Proxy === "function")
|
|
14573
|
+
return true;
|
|
14574
|
+
try {
|
|
14575
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
14576
|
+
}));
|
|
14577
|
+
return true;
|
|
14578
|
+
} catch (e2) {
|
|
14579
|
+
return false;
|
|
14580
|
+
}
|
|
14581
|
+
}
|
|
14582
|
+
function _construct(Parent, args, Class) {
|
|
14583
|
+
if (_isNativeReflectConstruct()) {
|
|
14584
|
+
_construct = Reflect.construct.bind();
|
|
14585
|
+
} else {
|
|
14586
|
+
_construct = function _construct2(Parent2, args2, Class2) {
|
|
14587
|
+
var a = [null];
|
|
14588
|
+
a.push.apply(a, args2);
|
|
14589
|
+
var Constructor = Function.bind.apply(Parent2, a);
|
|
14590
|
+
var instance = new Constructor();
|
|
14591
|
+
if (Class2)
|
|
14592
|
+
_setPrototypeOf(instance, Class2.prototype);
|
|
14593
|
+
return instance;
|
|
14594
|
+
};
|
|
14595
|
+
}
|
|
14596
|
+
return _construct.apply(null, arguments);
|
|
14597
|
+
}
|
|
14598
|
+
function _isNativeFunction(fn) {
|
|
14599
|
+
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
14600
|
+
}
|
|
14601
|
+
function _wrapNativeSuper(Class) {
|
|
14602
|
+
var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
|
|
14603
|
+
_wrapNativeSuper = function _wrapNativeSuper2(Class2) {
|
|
14604
|
+
if (Class2 === null || !_isNativeFunction(Class2))
|
|
14605
|
+
return Class2;
|
|
14606
|
+
if (typeof Class2 !== "function") {
|
|
14607
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
14608
|
+
}
|
|
14609
|
+
if (typeof _cache !== "undefined") {
|
|
14610
|
+
if (_cache.has(Class2))
|
|
14611
|
+
return _cache.get(Class2);
|
|
14612
|
+
_cache.set(Class2, Wrapper);
|
|
14613
|
+
}
|
|
14614
|
+
function Wrapper() {
|
|
14615
|
+
return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
|
|
14616
|
+
}
|
|
14617
|
+
Wrapper.prototype = Object.create(Class2.prototype, {
|
|
14618
|
+
constructor: {
|
|
14619
|
+
value: Wrapper,
|
|
14620
|
+
enumerable: false,
|
|
14621
|
+
writable: true,
|
|
14622
|
+
configurable: true
|
|
14623
|
+
}
|
|
14624
|
+
});
|
|
14625
|
+
return _setPrototypeOf(Wrapper, Class2);
|
|
14626
|
+
};
|
|
14627
|
+
return _wrapNativeSuper(Class);
|
|
14628
|
+
}
|
|
14629
|
+
var formatRegExp = /%[sdj%]/g;
|
|
14630
|
+
var warning = function warning2() {
|
|
14631
|
+
};
|
|
14632
|
+
if (typeof process !== "undefined" && process.env && false) {
|
|
14633
|
+
warning = function warning3(type4, errors) {
|
|
14634
|
+
if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
|
|
14635
|
+
if (errors.every(function(e2) {
|
|
14636
|
+
return typeof e2 === "string";
|
|
14637
|
+
})) {
|
|
14638
|
+
console.warn(type4, errors);
|
|
14639
|
+
}
|
|
14640
|
+
}
|
|
14641
|
+
};
|
|
14642
|
+
}
|
|
14643
|
+
function convertFieldsError(errors) {
|
|
14644
|
+
if (!errors || !errors.length)
|
|
14645
|
+
return null;
|
|
14646
|
+
var fields = {};
|
|
14647
|
+
errors.forEach(function(error) {
|
|
14648
|
+
var field = error.field;
|
|
14649
|
+
fields[field] = fields[field] || [];
|
|
14650
|
+
fields[field].push(error);
|
|
14651
|
+
});
|
|
14652
|
+
return fields;
|
|
14653
|
+
}
|
|
14654
|
+
function format(template) {
|
|
14655
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
14656
|
+
args[_key - 1] = arguments[_key];
|
|
14657
|
+
}
|
|
14658
|
+
var i = 0;
|
|
14659
|
+
var len = args.length;
|
|
14660
|
+
if (typeof template === "function") {
|
|
14661
|
+
return template.apply(null, args);
|
|
14662
|
+
}
|
|
14663
|
+
if (typeof template === "string") {
|
|
14664
|
+
var str = template.replace(formatRegExp, function(x2) {
|
|
14665
|
+
if (x2 === "%%") {
|
|
14666
|
+
return "%";
|
|
14667
|
+
}
|
|
14668
|
+
if (i >= len) {
|
|
14669
|
+
return x2;
|
|
14670
|
+
}
|
|
14671
|
+
switch (x2) {
|
|
14672
|
+
case "%s":
|
|
14673
|
+
return String(args[i++]);
|
|
14674
|
+
case "%d":
|
|
14675
|
+
return Number(args[i++]);
|
|
14676
|
+
case "%j":
|
|
14677
|
+
try {
|
|
14678
|
+
return JSON.stringify(args[i++]);
|
|
14679
|
+
} catch (_) {
|
|
14680
|
+
return "[Circular]";
|
|
14681
|
+
}
|
|
14682
|
+
break;
|
|
14683
|
+
default:
|
|
14684
|
+
return x2;
|
|
14685
|
+
}
|
|
14686
|
+
});
|
|
14687
|
+
return str;
|
|
14688
|
+
}
|
|
14689
|
+
return template;
|
|
14690
|
+
}
|
|
14691
|
+
function isNativeStringType(type4) {
|
|
14692
|
+
return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
|
|
14693
|
+
}
|
|
14694
|
+
function isEmptyValue(value, type4) {
|
|
14695
|
+
if (value === void 0 || value === null) {
|
|
14696
|
+
return true;
|
|
14697
|
+
}
|
|
14698
|
+
if (type4 === "array" && Array.isArray(value) && !value.length) {
|
|
14699
|
+
return true;
|
|
14700
|
+
}
|
|
14701
|
+
if (isNativeStringType(type4) && typeof value === "string" && !value) {
|
|
14702
|
+
return true;
|
|
14703
|
+
}
|
|
14704
|
+
return false;
|
|
14705
|
+
}
|
|
14706
|
+
function asyncParallelArray(arr, func, callback) {
|
|
14707
|
+
var results = [];
|
|
14708
|
+
var total = 0;
|
|
14709
|
+
var arrLength = arr.length;
|
|
14710
|
+
function count(errors) {
|
|
14711
|
+
results.push.apply(results, errors || []);
|
|
14712
|
+
total++;
|
|
14713
|
+
if (total === arrLength) {
|
|
14714
|
+
callback(results);
|
|
14715
|
+
}
|
|
14716
|
+
}
|
|
14717
|
+
arr.forEach(function(a) {
|
|
14718
|
+
func(a, count);
|
|
14719
|
+
});
|
|
14720
|
+
}
|
|
14721
|
+
function asyncSerialArray(arr, func, callback) {
|
|
14722
|
+
var index = 0;
|
|
14723
|
+
var arrLength = arr.length;
|
|
14724
|
+
function next(errors) {
|
|
14725
|
+
if (errors && errors.length) {
|
|
14726
|
+
callback(errors);
|
|
14727
|
+
return;
|
|
14728
|
+
}
|
|
14729
|
+
var original = index;
|
|
14730
|
+
index = index + 1;
|
|
14731
|
+
if (original < arrLength) {
|
|
14732
|
+
func(arr[original], next);
|
|
14733
|
+
} else {
|
|
14734
|
+
callback([]);
|
|
14735
|
+
}
|
|
14736
|
+
}
|
|
14737
|
+
next([]);
|
|
14738
|
+
}
|
|
14739
|
+
function flattenObjArr(objArr) {
|
|
14740
|
+
var ret = [];
|
|
14741
|
+
Object.keys(objArr).forEach(function(k2) {
|
|
14742
|
+
ret.push.apply(ret, objArr[k2] || []);
|
|
14743
|
+
});
|
|
14744
|
+
return ret;
|
|
14745
|
+
}
|
|
14746
|
+
var AsyncValidationError = /* @__PURE__ */ function(_Error) {
|
|
14747
|
+
_inheritsLoose(AsyncValidationError2, _Error);
|
|
14748
|
+
function AsyncValidationError2(errors, fields) {
|
|
14749
|
+
var _this;
|
|
14750
|
+
_this = _Error.call(this, "Async Validation Error") || this;
|
|
14751
|
+
_this.errors = errors;
|
|
14752
|
+
_this.fields = fields;
|
|
14753
|
+
return _this;
|
|
14754
|
+
}
|
|
14755
|
+
return AsyncValidationError2;
|
|
14756
|
+
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
14757
|
+
function asyncMap(objArr, option, func, callback, source) {
|
|
14758
|
+
if (option.first) {
|
|
14759
|
+
var _pending = new Promise(function(resolve, reject) {
|
|
14760
|
+
var next = function next2(errors) {
|
|
14761
|
+
callback(errors);
|
|
14762
|
+
return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
|
|
14763
|
+
};
|
|
14764
|
+
var flattenArr = flattenObjArr(objArr);
|
|
14765
|
+
asyncSerialArray(flattenArr, func, next);
|
|
14766
|
+
});
|
|
14767
|
+
_pending["catch"](function(e2) {
|
|
14768
|
+
return e2;
|
|
14769
|
+
});
|
|
14770
|
+
return _pending;
|
|
14771
|
+
}
|
|
14772
|
+
var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
|
|
14773
|
+
var objArrKeys = Object.keys(objArr);
|
|
14774
|
+
var objArrLength = objArrKeys.length;
|
|
14775
|
+
var total = 0;
|
|
14776
|
+
var results = [];
|
|
14777
|
+
var pending = new Promise(function(resolve, reject) {
|
|
14778
|
+
var next = function next2(errors) {
|
|
14779
|
+
results.push.apply(results, errors);
|
|
14780
|
+
total++;
|
|
14781
|
+
if (total === objArrLength) {
|
|
14782
|
+
callback(results);
|
|
14783
|
+
return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
|
|
14784
|
+
}
|
|
14785
|
+
};
|
|
14786
|
+
if (!objArrKeys.length) {
|
|
14787
|
+
callback(results);
|
|
14788
|
+
resolve(source);
|
|
14789
|
+
}
|
|
14790
|
+
objArrKeys.forEach(function(key) {
|
|
14791
|
+
var arr = objArr[key];
|
|
14792
|
+
if (firstFields.indexOf(key) !== -1) {
|
|
14793
|
+
asyncSerialArray(arr, func, next);
|
|
14794
|
+
} else {
|
|
14795
|
+
asyncParallelArray(arr, func, next);
|
|
14796
|
+
}
|
|
14797
|
+
});
|
|
14798
|
+
});
|
|
14799
|
+
pending["catch"](function(e2) {
|
|
14800
|
+
return e2;
|
|
14801
|
+
});
|
|
14802
|
+
return pending;
|
|
14803
|
+
}
|
|
14804
|
+
function isErrorObj(obj) {
|
|
14805
|
+
return !!(obj && obj.message !== void 0);
|
|
14806
|
+
}
|
|
14807
|
+
function getValue(value, path) {
|
|
14808
|
+
var v2 = value;
|
|
14809
|
+
for (var i = 0; i < path.length; i++) {
|
|
14810
|
+
if (v2 == void 0) {
|
|
14811
|
+
return v2;
|
|
14812
|
+
}
|
|
14813
|
+
v2 = v2[path[i]];
|
|
14814
|
+
}
|
|
14815
|
+
return v2;
|
|
14816
|
+
}
|
|
14817
|
+
function complementError(rule, source) {
|
|
14818
|
+
return function(oe) {
|
|
14819
|
+
var fieldValue;
|
|
14820
|
+
if (rule.fullFields) {
|
|
14821
|
+
fieldValue = getValue(source, rule.fullFields);
|
|
14822
|
+
} else {
|
|
14823
|
+
fieldValue = source[oe.field || rule.fullField];
|
|
14824
|
+
}
|
|
14825
|
+
if (isErrorObj(oe)) {
|
|
14826
|
+
oe.field = oe.field || rule.fullField;
|
|
14827
|
+
oe.fieldValue = fieldValue;
|
|
14828
|
+
return oe;
|
|
14829
|
+
}
|
|
14830
|
+
return {
|
|
14831
|
+
message: typeof oe === "function" ? oe() : oe,
|
|
14832
|
+
fieldValue,
|
|
14833
|
+
field: oe.field || rule.fullField
|
|
14834
|
+
};
|
|
14835
|
+
};
|
|
14836
|
+
}
|
|
14837
|
+
function deepMerge(target, source) {
|
|
14838
|
+
if (source) {
|
|
14839
|
+
for (var s in source) {
|
|
14840
|
+
if (source.hasOwnProperty(s)) {
|
|
14841
|
+
var value = source[s];
|
|
14842
|
+
if (typeof value === "object" && typeof target[s] === "object") {
|
|
14843
|
+
target[s] = _extends({}, target[s], value);
|
|
14844
|
+
} else {
|
|
14845
|
+
target[s] = value;
|
|
14846
|
+
}
|
|
14847
|
+
}
|
|
14848
|
+
}
|
|
14849
|
+
}
|
|
14850
|
+
return target;
|
|
14851
|
+
}
|
|
14852
|
+
var required$1 = function required(rule, value, source, errors, options2, type4) {
|
|
14853
|
+
if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
|
|
14854
|
+
errors.push(format(options2.messages.required, rule.fullField));
|
|
14855
|
+
}
|
|
14856
|
+
};
|
|
14857
|
+
var whitespace = function whitespace2(rule, value, source, errors, options2) {
|
|
14858
|
+
if (/^\s+$/.test(value) || value === "") {
|
|
14859
|
+
errors.push(format(options2.messages.whitespace, rule.fullField));
|
|
14860
|
+
}
|
|
14861
|
+
};
|
|
14862
|
+
var urlReg;
|
|
14863
|
+
var getUrlRegex = function() {
|
|
14864
|
+
if (urlReg) {
|
|
14865
|
+
return urlReg;
|
|
14866
|
+
}
|
|
14867
|
+
var word = "[a-fA-F\\d:]";
|
|
14868
|
+
var b2 = function b3(options2) {
|
|
14869
|
+
return options2 && options2.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
|
|
14870
|
+
};
|
|
14871
|
+
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}";
|
|
14872
|
+
var v6seg = "[a-fA-F\\d]{1,4}";
|
|
14873
|
+
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();
|
|
14874
|
+
var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
|
|
14875
|
+
var v4exact = new RegExp("^" + v4 + "$");
|
|
14876
|
+
var v6exact = new RegExp("^" + v6 + "$");
|
|
14877
|
+
var ip = function ip2(options2) {
|
|
14878
|
+
return options2 && options2.exact ? v46Exact : new RegExp("(?:" + b2(options2) + v4 + b2(options2) + ")|(?:" + b2(options2) + v6 + b2(options2) + ")", "g");
|
|
14879
|
+
};
|
|
14880
|
+
ip.v4 = function(options2) {
|
|
14881
|
+
return options2 && options2.exact ? v4exact : new RegExp("" + b2(options2) + v4 + b2(options2), "g");
|
|
14882
|
+
};
|
|
14883
|
+
ip.v6 = function(options2) {
|
|
14884
|
+
return options2 && options2.exact ? v6exact : new RegExp("" + b2(options2) + v6 + b2(options2), "g");
|
|
14885
|
+
};
|
|
14886
|
+
var protocol = "(?:(?:[a-z]+:)?//)";
|
|
14887
|
+
var auth = "(?:\\S+(?::\\S*)?@)?";
|
|
14888
|
+
var ipv4 = ip.v4().source;
|
|
14889
|
+
var ipv6 = ip.v6().source;
|
|
14890
|
+
var host2 = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
|
|
14891
|
+
var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
|
|
14892
|
+
var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
|
|
14893
|
+
var port = "(?::\\d{2,5})?";
|
|
14894
|
+
var path = '(?:[/?#][^\\s"]*)?';
|
|
14895
|
+
var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host2 + domain + tld + ")" + port + path;
|
|
14896
|
+
urlReg = new RegExp("(?:^" + regex + "$)", "i");
|
|
14897
|
+
return urlReg;
|
|
14898
|
+
};
|
|
14899
|
+
var pattern$2 = {
|
|
14900
|
+
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,}))$/,
|
|
14901
|
+
hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
|
|
14902
|
+
};
|
|
14903
|
+
var types = {
|
|
14904
|
+
integer: function integer(value) {
|
|
14905
|
+
return types.number(value) && parseInt(value, 10) === value;
|
|
14906
|
+
},
|
|
14907
|
+
"float": function float(value) {
|
|
14908
|
+
return types.number(value) && !types.integer(value);
|
|
14909
|
+
},
|
|
14910
|
+
array: function array(value) {
|
|
14911
|
+
return Array.isArray(value);
|
|
14912
|
+
},
|
|
14913
|
+
regexp: function regexp(value) {
|
|
14914
|
+
if (value instanceof RegExp) {
|
|
14915
|
+
return true;
|
|
14916
|
+
}
|
|
14917
|
+
try {
|
|
14918
|
+
return !!new RegExp(value);
|
|
14919
|
+
} catch (e2) {
|
|
14920
|
+
return false;
|
|
14921
|
+
}
|
|
14922
|
+
},
|
|
14923
|
+
date: function date(value) {
|
|
14924
|
+
return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
|
|
14925
|
+
},
|
|
14926
|
+
number: function number(value) {
|
|
14927
|
+
if (isNaN(value)) {
|
|
14928
|
+
return false;
|
|
14929
|
+
}
|
|
14930
|
+
return typeof value === "number";
|
|
14931
|
+
},
|
|
14932
|
+
object: function object(value) {
|
|
14933
|
+
return typeof value === "object" && !types.array(value);
|
|
14934
|
+
},
|
|
14935
|
+
method: function method(value) {
|
|
14936
|
+
return typeof value === "function";
|
|
14937
|
+
},
|
|
14938
|
+
email: function email(value) {
|
|
14939
|
+
return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
|
|
14940
|
+
},
|
|
14941
|
+
url: function url(value) {
|
|
14942
|
+
return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
|
|
14943
|
+
},
|
|
14944
|
+
hex: function hex(value) {
|
|
14945
|
+
return typeof value === "string" && !!value.match(pattern$2.hex);
|
|
14946
|
+
}
|
|
14947
|
+
};
|
|
14948
|
+
var type$1 = function type(rule, value, source, errors, options2) {
|
|
14949
|
+
if (rule.required && value === void 0) {
|
|
14950
|
+
required$1(rule, value, source, errors, options2);
|
|
14951
|
+
return;
|
|
14952
|
+
}
|
|
14953
|
+
var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
|
|
14954
|
+
var ruleType = rule.type;
|
|
14955
|
+
if (custom.indexOf(ruleType) > -1) {
|
|
14956
|
+
if (!types[ruleType](value)) {
|
|
14957
|
+
errors.push(format(options2.messages.types[ruleType], rule.fullField, rule.type));
|
|
14958
|
+
}
|
|
14959
|
+
} else if (ruleType && typeof value !== rule.type) {
|
|
14960
|
+
errors.push(format(options2.messages.types[ruleType], rule.fullField, rule.type));
|
|
14961
|
+
}
|
|
14962
|
+
};
|
|
14963
|
+
var range = function range2(rule, value, source, errors, options2) {
|
|
14964
|
+
var len = typeof rule.len === "number";
|
|
14965
|
+
var min = typeof rule.min === "number";
|
|
14966
|
+
var max = typeof rule.max === "number";
|
|
14967
|
+
var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
14968
|
+
var val = value;
|
|
14969
|
+
var key = null;
|
|
14970
|
+
var num = typeof value === "number";
|
|
14971
|
+
var str = typeof value === "string";
|
|
14972
|
+
var arr = Array.isArray(value);
|
|
14973
|
+
if (num) {
|
|
14974
|
+
key = "number";
|
|
14975
|
+
} else if (str) {
|
|
14976
|
+
key = "string";
|
|
14977
|
+
} else if (arr) {
|
|
14978
|
+
key = "array";
|
|
14979
|
+
}
|
|
14980
|
+
if (!key) {
|
|
14981
|
+
return false;
|
|
14982
|
+
}
|
|
14983
|
+
if (arr) {
|
|
14984
|
+
val = value.length;
|
|
14985
|
+
}
|
|
14986
|
+
if (str) {
|
|
14987
|
+
val = value.replace(spRegexp, "_").length;
|
|
14988
|
+
}
|
|
14989
|
+
if (len) {
|
|
14990
|
+
if (val !== rule.len) {
|
|
14991
|
+
errors.push(format(options2.messages[key].len, rule.fullField, rule.len));
|
|
14992
|
+
}
|
|
14993
|
+
} else if (min && !max && val < rule.min) {
|
|
14994
|
+
errors.push(format(options2.messages[key].min, rule.fullField, rule.min));
|
|
14995
|
+
} else if (max && !min && val > rule.max) {
|
|
14996
|
+
errors.push(format(options2.messages[key].max, rule.fullField, rule.max));
|
|
14997
|
+
} else if (min && max && (val < rule.min || val > rule.max)) {
|
|
14998
|
+
errors.push(format(options2.messages[key].range, rule.fullField, rule.min, rule.max));
|
|
14999
|
+
}
|
|
15000
|
+
};
|
|
15001
|
+
var ENUM$1 = "enum";
|
|
15002
|
+
var enumerable$1 = function enumerable(rule, value, source, errors, options2) {
|
|
15003
|
+
rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
|
|
15004
|
+
if (rule[ENUM$1].indexOf(value) === -1) {
|
|
15005
|
+
errors.push(format(options2.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
|
|
15006
|
+
}
|
|
15007
|
+
};
|
|
15008
|
+
var pattern$1 = function pattern(rule, value, source, errors, options2) {
|
|
15009
|
+
if (rule.pattern) {
|
|
15010
|
+
if (rule.pattern instanceof RegExp) {
|
|
15011
|
+
rule.pattern.lastIndex = 0;
|
|
15012
|
+
if (!rule.pattern.test(value)) {
|
|
15013
|
+
errors.push(format(options2.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
15014
|
+
}
|
|
15015
|
+
} else if (typeof rule.pattern === "string") {
|
|
15016
|
+
var _pattern = new RegExp(rule.pattern);
|
|
15017
|
+
if (!_pattern.test(value)) {
|
|
15018
|
+
errors.push(format(options2.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
|
|
15019
|
+
}
|
|
15020
|
+
}
|
|
15021
|
+
}
|
|
15022
|
+
};
|
|
15023
|
+
var rules = {
|
|
15024
|
+
required: required$1,
|
|
15025
|
+
whitespace,
|
|
15026
|
+
type: type$1,
|
|
15027
|
+
range,
|
|
15028
|
+
"enum": enumerable$1,
|
|
15029
|
+
pattern: pattern$1
|
|
15030
|
+
};
|
|
15031
|
+
var string = function string2(rule, value, callback, source, options2) {
|
|
15032
|
+
var errors = [];
|
|
15033
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15034
|
+
if (validate) {
|
|
15035
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
15036
|
+
return callback();
|
|
15037
|
+
}
|
|
15038
|
+
rules.required(rule, value, source, errors, options2, "string");
|
|
15039
|
+
if (!isEmptyValue(value, "string")) {
|
|
15040
|
+
rules.type(rule, value, source, errors, options2);
|
|
15041
|
+
rules.range(rule, value, source, errors, options2);
|
|
15042
|
+
rules.pattern(rule, value, source, errors, options2);
|
|
15043
|
+
if (rule.whitespace === true) {
|
|
15044
|
+
rules.whitespace(rule, value, source, errors, options2);
|
|
15045
|
+
}
|
|
15046
|
+
}
|
|
15047
|
+
}
|
|
15048
|
+
callback(errors);
|
|
15049
|
+
};
|
|
15050
|
+
var method2 = function method3(rule, value, callback, source, options2) {
|
|
15051
|
+
var errors = [];
|
|
15052
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15053
|
+
if (validate) {
|
|
15054
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15055
|
+
return callback();
|
|
15056
|
+
}
|
|
15057
|
+
rules.required(rule, value, source, errors, options2);
|
|
15058
|
+
if (value !== void 0) {
|
|
15059
|
+
rules.type(rule, value, source, errors, options2);
|
|
15060
|
+
}
|
|
15061
|
+
}
|
|
15062
|
+
callback(errors);
|
|
15063
|
+
};
|
|
15064
|
+
var number2 = function number3(rule, value, callback, source, options2) {
|
|
15065
|
+
var errors = [];
|
|
15066
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15067
|
+
if (validate) {
|
|
15068
|
+
if (value === "") {
|
|
15069
|
+
value = void 0;
|
|
15070
|
+
}
|
|
15071
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15072
|
+
return callback();
|
|
15073
|
+
}
|
|
15074
|
+
rules.required(rule, value, source, errors, options2);
|
|
15075
|
+
if (value !== void 0) {
|
|
15076
|
+
rules.type(rule, value, source, errors, options2);
|
|
15077
|
+
rules.range(rule, value, source, errors, options2);
|
|
15078
|
+
}
|
|
15079
|
+
}
|
|
15080
|
+
callback(errors);
|
|
15081
|
+
};
|
|
15082
|
+
var _boolean = function _boolean2(rule, value, callback, source, options2) {
|
|
15083
|
+
var errors = [];
|
|
15084
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15085
|
+
if (validate) {
|
|
15086
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15087
|
+
return callback();
|
|
15088
|
+
}
|
|
15089
|
+
rules.required(rule, value, source, errors, options2);
|
|
15090
|
+
if (value !== void 0) {
|
|
15091
|
+
rules.type(rule, value, source, errors, options2);
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
callback(errors);
|
|
15095
|
+
};
|
|
15096
|
+
var regexp2 = function regexp3(rule, value, callback, source, options2) {
|
|
15097
|
+
var errors = [];
|
|
15098
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15099
|
+
if (validate) {
|
|
15100
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15101
|
+
return callback();
|
|
15102
|
+
}
|
|
15103
|
+
rules.required(rule, value, source, errors, options2);
|
|
15104
|
+
if (!isEmptyValue(value)) {
|
|
15105
|
+
rules.type(rule, value, source, errors, options2);
|
|
15106
|
+
}
|
|
15107
|
+
}
|
|
15108
|
+
callback(errors);
|
|
15109
|
+
};
|
|
15110
|
+
var integer2 = function integer3(rule, value, callback, source, options2) {
|
|
15111
|
+
var errors = [];
|
|
15112
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15113
|
+
if (validate) {
|
|
15114
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15115
|
+
return callback();
|
|
15116
|
+
}
|
|
15117
|
+
rules.required(rule, value, source, errors, options2);
|
|
15118
|
+
if (value !== void 0) {
|
|
15119
|
+
rules.type(rule, value, source, errors, options2);
|
|
15120
|
+
rules.range(rule, value, source, errors, options2);
|
|
15121
|
+
}
|
|
15122
|
+
}
|
|
15123
|
+
callback(errors);
|
|
15124
|
+
};
|
|
15125
|
+
var floatFn = function floatFn2(rule, value, callback, source, options2) {
|
|
15126
|
+
var errors = [];
|
|
15127
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15128
|
+
if (validate) {
|
|
15129
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15130
|
+
return callback();
|
|
15131
|
+
}
|
|
15132
|
+
rules.required(rule, value, source, errors, options2);
|
|
15133
|
+
if (value !== void 0) {
|
|
15134
|
+
rules.type(rule, value, source, errors, options2);
|
|
15135
|
+
rules.range(rule, value, source, errors, options2);
|
|
15136
|
+
}
|
|
15137
|
+
}
|
|
15138
|
+
callback(errors);
|
|
15139
|
+
};
|
|
15140
|
+
var array2 = function array3(rule, value, callback, source, options2) {
|
|
15141
|
+
var errors = [];
|
|
15142
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15143
|
+
if (validate) {
|
|
15144
|
+
if ((value === void 0 || value === null) && !rule.required) {
|
|
15145
|
+
return callback();
|
|
15146
|
+
}
|
|
15147
|
+
rules.required(rule, value, source, errors, options2, "array");
|
|
15148
|
+
if (value !== void 0 && value !== null) {
|
|
15149
|
+
rules.type(rule, value, source, errors, options2);
|
|
15150
|
+
rules.range(rule, value, source, errors, options2);
|
|
15151
|
+
}
|
|
15152
|
+
}
|
|
15153
|
+
callback(errors);
|
|
15154
|
+
};
|
|
15155
|
+
var object2 = function object3(rule, value, callback, source, options2) {
|
|
15156
|
+
var errors = [];
|
|
15157
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15158
|
+
if (validate) {
|
|
15159
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15160
|
+
return callback();
|
|
15161
|
+
}
|
|
15162
|
+
rules.required(rule, value, source, errors, options2);
|
|
15163
|
+
if (value !== void 0) {
|
|
15164
|
+
rules.type(rule, value, source, errors, options2);
|
|
15165
|
+
}
|
|
15166
|
+
}
|
|
15167
|
+
callback(errors);
|
|
15168
|
+
};
|
|
15169
|
+
var ENUM = "enum";
|
|
15170
|
+
var enumerable2 = function enumerable3(rule, value, callback, source, options2) {
|
|
15171
|
+
var errors = [];
|
|
15172
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15173
|
+
if (validate) {
|
|
15174
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15175
|
+
return callback();
|
|
15176
|
+
}
|
|
15177
|
+
rules.required(rule, value, source, errors, options2);
|
|
15178
|
+
if (value !== void 0) {
|
|
15179
|
+
rules[ENUM](rule, value, source, errors, options2);
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15182
|
+
callback(errors);
|
|
15183
|
+
};
|
|
15184
|
+
var pattern2 = function pattern3(rule, value, callback, source, options2) {
|
|
15185
|
+
var errors = [];
|
|
15186
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15187
|
+
if (validate) {
|
|
15188
|
+
if (isEmptyValue(value, "string") && !rule.required) {
|
|
15189
|
+
return callback();
|
|
15190
|
+
}
|
|
15191
|
+
rules.required(rule, value, source, errors, options2);
|
|
15192
|
+
if (!isEmptyValue(value, "string")) {
|
|
15193
|
+
rules.pattern(rule, value, source, errors, options2);
|
|
15194
|
+
}
|
|
15195
|
+
}
|
|
15196
|
+
callback(errors);
|
|
15197
|
+
};
|
|
15198
|
+
var date2 = function date3(rule, value, callback, source, options2) {
|
|
15199
|
+
var errors = [];
|
|
15200
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15201
|
+
if (validate) {
|
|
15202
|
+
if (isEmptyValue(value, "date") && !rule.required) {
|
|
15203
|
+
return callback();
|
|
15204
|
+
}
|
|
15205
|
+
rules.required(rule, value, source, errors, options2);
|
|
15206
|
+
if (!isEmptyValue(value, "date")) {
|
|
15207
|
+
var dateObject;
|
|
15208
|
+
if (value instanceof Date) {
|
|
15209
|
+
dateObject = value;
|
|
15210
|
+
} else {
|
|
15211
|
+
dateObject = new Date(value);
|
|
15212
|
+
}
|
|
15213
|
+
rules.type(rule, dateObject, source, errors, options2);
|
|
15214
|
+
if (dateObject) {
|
|
15215
|
+
rules.range(rule, dateObject.getTime(), source, errors, options2);
|
|
15216
|
+
}
|
|
15217
|
+
}
|
|
15218
|
+
}
|
|
15219
|
+
callback(errors);
|
|
15220
|
+
};
|
|
15221
|
+
var required2 = function required3(rule, value, callback, source, options2) {
|
|
15222
|
+
var errors = [];
|
|
15223
|
+
var type4 = Array.isArray(value) ? "array" : typeof value;
|
|
15224
|
+
rules.required(rule, value, source, errors, options2, type4);
|
|
15225
|
+
callback(errors);
|
|
15226
|
+
};
|
|
15227
|
+
var type2 = function type3(rule, value, callback, source, options2) {
|
|
15228
|
+
var ruleType = rule.type;
|
|
15229
|
+
var errors = [];
|
|
15230
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15231
|
+
if (validate) {
|
|
15232
|
+
if (isEmptyValue(value, ruleType) && !rule.required) {
|
|
15233
|
+
return callback();
|
|
15234
|
+
}
|
|
15235
|
+
rules.required(rule, value, source, errors, options2, ruleType);
|
|
15236
|
+
if (!isEmptyValue(value, ruleType)) {
|
|
15237
|
+
rules.type(rule, value, source, errors, options2);
|
|
15238
|
+
}
|
|
15239
|
+
}
|
|
15240
|
+
callback(errors);
|
|
15241
|
+
};
|
|
15242
|
+
var any = function any2(rule, value, callback, source, options2) {
|
|
15243
|
+
var errors = [];
|
|
15244
|
+
var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
|
|
15245
|
+
if (validate) {
|
|
15246
|
+
if (isEmptyValue(value) && !rule.required) {
|
|
15247
|
+
return callback();
|
|
15248
|
+
}
|
|
15249
|
+
rules.required(rule, value, source, errors, options2);
|
|
15250
|
+
}
|
|
15251
|
+
callback(errors);
|
|
15252
|
+
};
|
|
15253
|
+
var validators = {
|
|
15254
|
+
string,
|
|
15255
|
+
method: method2,
|
|
15256
|
+
number: number2,
|
|
15257
|
+
"boolean": _boolean,
|
|
15258
|
+
regexp: regexp2,
|
|
15259
|
+
integer: integer2,
|
|
15260
|
+
"float": floatFn,
|
|
15261
|
+
array: array2,
|
|
15262
|
+
object: object2,
|
|
15263
|
+
"enum": enumerable2,
|
|
15264
|
+
pattern: pattern2,
|
|
15265
|
+
date: date2,
|
|
15266
|
+
url: type2,
|
|
15267
|
+
hex: type2,
|
|
15268
|
+
email: type2,
|
|
15269
|
+
required: required2,
|
|
15270
|
+
any
|
|
15271
|
+
};
|
|
15272
|
+
function newMessages() {
|
|
15273
|
+
return {
|
|
15274
|
+
"default": "Validation error on field %s",
|
|
15275
|
+
required: "%s is required",
|
|
15276
|
+
"enum": "%s must be one of %s",
|
|
15277
|
+
whitespace: "%s cannot be empty",
|
|
15278
|
+
date: {
|
|
15279
|
+
format: "%s date %s is invalid for format %s",
|
|
15280
|
+
parse: "%s date could not be parsed, %s is invalid ",
|
|
15281
|
+
invalid: "%s date %s is invalid"
|
|
15282
|
+
},
|
|
15283
|
+
types: {
|
|
15284
|
+
string: "%s is not a %s",
|
|
15285
|
+
method: "%s is not a %s (function)",
|
|
15286
|
+
array: "%s is not an %s",
|
|
15287
|
+
object: "%s is not an %s",
|
|
15288
|
+
number: "%s is not a %s",
|
|
15289
|
+
date: "%s is not a %s",
|
|
15290
|
+
"boolean": "%s is not a %s",
|
|
15291
|
+
integer: "%s is not an %s",
|
|
15292
|
+
"float": "%s is not a %s",
|
|
15293
|
+
regexp: "%s is not a valid %s",
|
|
15294
|
+
email: "%s is not a valid %s",
|
|
15295
|
+
url: "%s is not a valid %s",
|
|
15296
|
+
hex: "%s is not a valid %s"
|
|
15297
|
+
},
|
|
15298
|
+
string: {
|
|
15299
|
+
len: "%s must be exactly %s characters",
|
|
15300
|
+
min: "%s must be at least %s characters",
|
|
15301
|
+
max: "%s cannot be longer than %s characters",
|
|
15302
|
+
range: "%s must be between %s and %s characters"
|
|
15303
|
+
},
|
|
15304
|
+
number: {
|
|
15305
|
+
len: "%s must equal %s",
|
|
15306
|
+
min: "%s cannot be less than %s",
|
|
15307
|
+
max: "%s cannot be greater than %s",
|
|
15308
|
+
range: "%s must be between %s and %s"
|
|
15309
|
+
},
|
|
15310
|
+
array: {
|
|
15311
|
+
len: "%s must be exactly %s in length",
|
|
15312
|
+
min: "%s cannot be less than %s in length",
|
|
15313
|
+
max: "%s cannot be greater than %s in length",
|
|
15314
|
+
range: "%s must be between %s and %s in length"
|
|
15315
|
+
},
|
|
15316
|
+
pattern: {
|
|
15317
|
+
mismatch: "%s value %s does not match pattern %s"
|
|
15318
|
+
},
|
|
15319
|
+
clone: function clone() {
|
|
15320
|
+
var cloned = JSON.parse(JSON.stringify(this));
|
|
15321
|
+
cloned.clone = this.clone;
|
|
15322
|
+
return cloned;
|
|
15323
|
+
}
|
|
15324
|
+
};
|
|
15325
|
+
}
|
|
15326
|
+
var messages = newMessages();
|
|
15327
|
+
var Schema = /* @__PURE__ */ function() {
|
|
15328
|
+
function Schema2(descriptor) {
|
|
15329
|
+
this.rules = null;
|
|
15330
|
+
this._messages = messages;
|
|
15331
|
+
this.define(descriptor);
|
|
15332
|
+
}
|
|
15333
|
+
var _proto = Schema2.prototype;
|
|
15334
|
+
_proto.define = function define(rules2) {
|
|
15335
|
+
var _this = this;
|
|
15336
|
+
if (!rules2) {
|
|
15337
|
+
throw new Error("Cannot configure a schema with no rules");
|
|
15338
|
+
}
|
|
15339
|
+
if (typeof rules2 !== "object" || Array.isArray(rules2)) {
|
|
15340
|
+
throw new Error("Rules must be an object");
|
|
15341
|
+
}
|
|
15342
|
+
this.rules = {};
|
|
15343
|
+
Object.keys(rules2).forEach(function(name) {
|
|
15344
|
+
var item = rules2[name];
|
|
15345
|
+
_this.rules[name] = Array.isArray(item) ? item : [item];
|
|
15346
|
+
});
|
|
15347
|
+
};
|
|
15348
|
+
_proto.messages = function messages2(_messages) {
|
|
15349
|
+
if (_messages) {
|
|
15350
|
+
this._messages = deepMerge(newMessages(), _messages);
|
|
15351
|
+
}
|
|
15352
|
+
return this._messages;
|
|
15353
|
+
};
|
|
15354
|
+
_proto.validate = function validate(source_, o, oc) {
|
|
15355
|
+
var _this2 = this;
|
|
15356
|
+
if (o === void 0) {
|
|
15357
|
+
o = {};
|
|
15358
|
+
}
|
|
15359
|
+
if (oc === void 0) {
|
|
15360
|
+
oc = function oc2() {
|
|
15361
|
+
};
|
|
15362
|
+
}
|
|
15363
|
+
var source = source_;
|
|
15364
|
+
var options2 = o;
|
|
15365
|
+
var callback = oc;
|
|
15366
|
+
if (typeof options2 === "function") {
|
|
15367
|
+
callback = options2;
|
|
15368
|
+
options2 = {};
|
|
15369
|
+
}
|
|
15370
|
+
if (!this.rules || Object.keys(this.rules).length === 0) {
|
|
15371
|
+
if (callback) {
|
|
15372
|
+
callback(null, source);
|
|
15373
|
+
}
|
|
15374
|
+
return Promise.resolve(source);
|
|
15375
|
+
}
|
|
15376
|
+
function complete(results) {
|
|
15377
|
+
var errors = [];
|
|
15378
|
+
var fields = {};
|
|
15379
|
+
function add(e2) {
|
|
15380
|
+
if (Array.isArray(e2)) {
|
|
15381
|
+
var _errors;
|
|
15382
|
+
errors = (_errors = errors).concat.apply(_errors, e2);
|
|
15383
|
+
} else {
|
|
15384
|
+
errors.push(e2);
|
|
15385
|
+
}
|
|
15386
|
+
}
|
|
15387
|
+
for (var i = 0; i < results.length; i++) {
|
|
15388
|
+
add(results[i]);
|
|
15389
|
+
}
|
|
15390
|
+
if (!errors.length) {
|
|
15391
|
+
callback(null, source);
|
|
15392
|
+
} else {
|
|
15393
|
+
fields = convertFieldsError(errors);
|
|
15394
|
+
callback(errors, fields);
|
|
15395
|
+
}
|
|
15396
|
+
}
|
|
15397
|
+
if (options2.messages) {
|
|
15398
|
+
var messages$1 = this.messages();
|
|
15399
|
+
if (messages$1 === messages) {
|
|
15400
|
+
messages$1 = newMessages();
|
|
15401
|
+
}
|
|
15402
|
+
deepMerge(messages$1, options2.messages);
|
|
15403
|
+
options2.messages = messages$1;
|
|
15404
|
+
} else {
|
|
15405
|
+
options2.messages = this.messages();
|
|
15406
|
+
}
|
|
15407
|
+
var series = {};
|
|
15408
|
+
var keys = options2.keys || Object.keys(this.rules);
|
|
15409
|
+
keys.forEach(function(z2) {
|
|
15410
|
+
var arr = _this2.rules[z2];
|
|
15411
|
+
var value = source[z2];
|
|
15412
|
+
arr.forEach(function(r2) {
|
|
15413
|
+
var rule = r2;
|
|
15414
|
+
if (typeof rule.transform === "function") {
|
|
15415
|
+
if (source === source_) {
|
|
15416
|
+
source = _extends({}, source);
|
|
15417
|
+
}
|
|
15418
|
+
value = source[z2] = rule.transform(value);
|
|
15419
|
+
}
|
|
15420
|
+
if (typeof rule === "function") {
|
|
15421
|
+
rule = {
|
|
15422
|
+
validator: rule
|
|
15423
|
+
};
|
|
15424
|
+
} else {
|
|
15425
|
+
rule = _extends({}, rule);
|
|
15426
|
+
}
|
|
15427
|
+
rule.validator = _this2.getValidationMethod(rule);
|
|
15428
|
+
if (!rule.validator) {
|
|
15429
|
+
return;
|
|
15430
|
+
}
|
|
15431
|
+
rule.field = z2;
|
|
15432
|
+
rule.fullField = rule.fullField || z2;
|
|
15433
|
+
rule.type = _this2.getType(rule);
|
|
15434
|
+
series[z2] = series[z2] || [];
|
|
15435
|
+
series[z2].push({
|
|
15436
|
+
rule,
|
|
15437
|
+
value,
|
|
15438
|
+
source,
|
|
15439
|
+
field: z2
|
|
15440
|
+
});
|
|
15441
|
+
});
|
|
15442
|
+
});
|
|
15443
|
+
var errorFields = {};
|
|
15444
|
+
return asyncMap(series, options2, function(data, doIt) {
|
|
15445
|
+
var rule = data.rule;
|
|
15446
|
+
var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
|
|
15447
|
+
deep = deep && (rule.required || !rule.required && data.value);
|
|
15448
|
+
rule.field = data.field;
|
|
15449
|
+
function addFullField(key, schema) {
|
|
15450
|
+
return _extends({}, schema, {
|
|
15451
|
+
fullField: rule.fullField + "." + key,
|
|
15452
|
+
fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
|
|
15453
|
+
});
|
|
15454
|
+
}
|
|
15455
|
+
function cb(e2) {
|
|
15456
|
+
if (e2 === void 0) {
|
|
15457
|
+
e2 = [];
|
|
15458
|
+
}
|
|
15459
|
+
var errorList = Array.isArray(e2) ? e2 : [e2];
|
|
15460
|
+
if (!options2.suppressWarning && errorList.length) {
|
|
15461
|
+
Schema2.warning("async-validator:", errorList);
|
|
15462
|
+
}
|
|
15463
|
+
if (errorList.length && rule.message !== void 0) {
|
|
15464
|
+
errorList = [].concat(rule.message);
|
|
15465
|
+
}
|
|
15466
|
+
var filledErrors = errorList.map(complementError(rule, source));
|
|
15467
|
+
if (options2.first && filledErrors.length) {
|
|
15468
|
+
errorFields[rule.field] = 1;
|
|
15469
|
+
return doIt(filledErrors);
|
|
15470
|
+
}
|
|
15471
|
+
if (!deep) {
|
|
15472
|
+
doIt(filledErrors);
|
|
15473
|
+
} else {
|
|
15474
|
+
if (rule.required && !data.value) {
|
|
15475
|
+
if (rule.message !== void 0) {
|
|
15476
|
+
filledErrors = [].concat(rule.message).map(complementError(rule, source));
|
|
15477
|
+
} else if (options2.error) {
|
|
15478
|
+
filledErrors = [options2.error(rule, format(options2.messages.required, rule.field))];
|
|
15479
|
+
}
|
|
15480
|
+
return doIt(filledErrors);
|
|
15481
|
+
}
|
|
15482
|
+
var fieldsSchema = {};
|
|
15483
|
+
if (rule.defaultField) {
|
|
15484
|
+
Object.keys(data.value).map(function(key) {
|
|
15485
|
+
fieldsSchema[key] = rule.defaultField;
|
|
15486
|
+
});
|
|
15487
|
+
}
|
|
15488
|
+
fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
|
|
15489
|
+
var paredFieldsSchema = {};
|
|
15490
|
+
Object.keys(fieldsSchema).forEach(function(field) {
|
|
15491
|
+
var fieldSchema = fieldsSchema[field];
|
|
15492
|
+
var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
|
|
15493
|
+
paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
|
|
15494
|
+
});
|
|
15495
|
+
var schema = new Schema2(paredFieldsSchema);
|
|
15496
|
+
schema.messages(options2.messages);
|
|
15497
|
+
if (data.rule.options) {
|
|
15498
|
+
data.rule.options.messages = options2.messages;
|
|
15499
|
+
data.rule.options.error = options2.error;
|
|
15500
|
+
}
|
|
15501
|
+
schema.validate(data.value, data.rule.options || options2, function(errs) {
|
|
15502
|
+
var finalErrors = [];
|
|
15503
|
+
if (filledErrors && filledErrors.length) {
|
|
15504
|
+
finalErrors.push.apply(finalErrors, filledErrors);
|
|
15505
|
+
}
|
|
15506
|
+
if (errs && errs.length) {
|
|
15507
|
+
finalErrors.push.apply(finalErrors, errs);
|
|
15508
|
+
}
|
|
15509
|
+
doIt(finalErrors.length ? finalErrors : null);
|
|
15510
|
+
});
|
|
15511
|
+
}
|
|
15512
|
+
}
|
|
15513
|
+
var res;
|
|
15514
|
+
if (rule.asyncValidator) {
|
|
15515
|
+
res = rule.asyncValidator(rule, data.value, cb, data.source, options2);
|
|
15516
|
+
} else if (rule.validator) {
|
|
15517
|
+
try {
|
|
15518
|
+
res = rule.validator(rule, data.value, cb, data.source, options2);
|
|
15519
|
+
} catch (error) {
|
|
15520
|
+
console.error == null ? void 0 : console.error(error);
|
|
15521
|
+
if (!options2.suppressValidatorError) {
|
|
15522
|
+
setTimeout(function() {
|
|
15523
|
+
throw error;
|
|
15524
|
+
}, 0);
|
|
15525
|
+
}
|
|
15526
|
+
cb(error.message);
|
|
15527
|
+
}
|
|
15528
|
+
if (res === true) {
|
|
15529
|
+
cb();
|
|
15530
|
+
} else if (res === false) {
|
|
15531
|
+
cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
|
|
15532
|
+
} else if (res instanceof Array) {
|
|
15533
|
+
cb(res);
|
|
15534
|
+
} else if (res instanceof Error) {
|
|
15535
|
+
cb(res.message);
|
|
15536
|
+
}
|
|
15537
|
+
}
|
|
15538
|
+
if (res && res.then) {
|
|
15539
|
+
res.then(function() {
|
|
15540
|
+
return cb();
|
|
15541
|
+
}, function(e2) {
|
|
15542
|
+
return cb(e2);
|
|
15543
|
+
});
|
|
15544
|
+
}
|
|
15545
|
+
}, function(results) {
|
|
15546
|
+
complete(results);
|
|
15547
|
+
}, source);
|
|
15548
|
+
};
|
|
15549
|
+
_proto.getType = function getType(rule) {
|
|
15550
|
+
if (rule.type === void 0 && rule.pattern instanceof RegExp) {
|
|
15551
|
+
rule.type = "pattern";
|
|
15552
|
+
}
|
|
15553
|
+
if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
|
|
15554
|
+
throw new Error(format("Unknown rule type %s", rule.type));
|
|
15555
|
+
}
|
|
15556
|
+
return rule.type || "string";
|
|
15557
|
+
};
|
|
15558
|
+
_proto.getValidationMethod = function getValidationMethod(rule) {
|
|
15559
|
+
if (typeof rule.validator === "function") {
|
|
15560
|
+
return rule.validator;
|
|
15561
|
+
}
|
|
15562
|
+
var keys = Object.keys(rule);
|
|
15563
|
+
var messageIndex = keys.indexOf("message");
|
|
15564
|
+
if (messageIndex !== -1) {
|
|
15565
|
+
keys.splice(messageIndex, 1);
|
|
15566
|
+
}
|
|
15567
|
+
if (keys.length === 1 && keys[0] === "required") {
|
|
15568
|
+
return validators.required;
|
|
15569
|
+
}
|
|
15570
|
+
return validators[this.getType(rule)] || void 0;
|
|
15571
|
+
};
|
|
15572
|
+
return Schema2;
|
|
15573
|
+
}();
|
|
15574
|
+
Schema.register = function register(type4, validator) {
|
|
15575
|
+
if (typeof validator !== "function") {
|
|
15576
|
+
throw new Error("Cannot register a validator by type, validator is not a function");
|
|
15577
|
+
}
|
|
15578
|
+
validators[type4] = validator;
|
|
15579
|
+
};
|
|
15580
|
+
Schema.warning = warning;
|
|
15581
|
+
Schema.messages = messages;
|
|
15582
|
+
Schema.validators = validators;
|
|
15583
|
+
class FormStore {
|
|
15584
|
+
constructor() {
|
|
15585
|
+
this.store = {};
|
|
15586
|
+
this.fieldEntities = [];
|
|
15587
|
+
this.callbacks = {};
|
|
15588
|
+
this.errList = [];
|
|
15589
|
+
this.registerField = (field) => {
|
|
15590
|
+
this.fieldEntities.push(field);
|
|
15591
|
+
return () => {
|
|
15592
|
+
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
15593
|
+
delete this.store[field.props.name];
|
|
15594
|
+
};
|
|
15595
|
+
};
|
|
15596
|
+
this.getFieldValue = (name) => {
|
|
15597
|
+
return this.store[name];
|
|
15598
|
+
};
|
|
15599
|
+
this.setFieldsValue = (newStore) => {
|
|
15600
|
+
this.store = {
|
|
15601
|
+
...this.store,
|
|
15602
|
+
...newStore
|
|
15603
|
+
};
|
|
15604
|
+
this.fieldEntities.forEach((enetity) => {
|
|
15605
|
+
const { name } = enetity.props;
|
|
15606
|
+
Object.keys(newStore).forEach((key) => {
|
|
15607
|
+
if (key === name) {
|
|
15608
|
+
enetity.onStoreChange();
|
|
15609
|
+
}
|
|
15610
|
+
});
|
|
15611
|
+
});
|
|
15612
|
+
};
|
|
15613
|
+
this.validate = () => {
|
|
15614
|
+
const err = [];
|
|
15615
|
+
this.errList.length = 0;
|
|
15616
|
+
this.fieldEntities.forEach((entity) => {
|
|
15617
|
+
const { name, rules: rules2 = [] } = entity.props;
|
|
15618
|
+
const descriptor = {};
|
|
15619
|
+
if (rules2.length) {
|
|
15620
|
+
if (rules2.length > 1) {
|
|
15621
|
+
descriptor[name] = [];
|
|
15622
|
+
rules2.map((v2) => {
|
|
15623
|
+
descriptor[name].push(v2);
|
|
15624
|
+
});
|
|
15625
|
+
} else {
|
|
15626
|
+
descriptor[name] = rules2[0];
|
|
15627
|
+
}
|
|
15628
|
+
}
|
|
15629
|
+
const validator = new Schema(descriptor);
|
|
15630
|
+
validator.validate({ [name]: this.store[name] }, (errors) => {
|
|
15631
|
+
if (errors) {
|
|
15632
|
+
err.push(...errors);
|
|
15633
|
+
this.errList.push(...errors);
|
|
15634
|
+
}
|
|
15635
|
+
entity.onStoreChange();
|
|
15636
|
+
});
|
|
15637
|
+
});
|
|
15638
|
+
return err;
|
|
15639
|
+
};
|
|
15640
|
+
this.setCallback = (callback) => {
|
|
15641
|
+
this.callbacks = {
|
|
15642
|
+
...this.callbacks,
|
|
15643
|
+
...callback
|
|
15644
|
+
};
|
|
15645
|
+
};
|
|
15646
|
+
this.submit = () => {
|
|
15647
|
+
var _a, _b, _c, _d;
|
|
15648
|
+
const err = this.validate();
|
|
15649
|
+
if (err.length === 0) {
|
|
15650
|
+
(_b = (_a = this.callbacks).onFinish) == null ? void 0 : _b.call(_a, this.store);
|
|
15651
|
+
} else if (err.length > 0) {
|
|
15652
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, err);
|
|
15653
|
+
}
|
|
15654
|
+
};
|
|
15655
|
+
this.resetFields = () => {
|
|
15656
|
+
};
|
|
15657
|
+
this.getForm = () => {
|
|
15658
|
+
return {
|
|
15659
|
+
setCallback: this.setCallback,
|
|
15660
|
+
registerField: this.registerField,
|
|
15661
|
+
getFieldValue: this.getFieldValue,
|
|
15662
|
+
setFieldsValue: this.setFieldsValue,
|
|
15663
|
+
submit: this.submit,
|
|
15664
|
+
store: this.store,
|
|
15665
|
+
errList: this.errList,
|
|
15666
|
+
fieldEntities: this.fieldEntities
|
|
15667
|
+
};
|
|
15668
|
+
};
|
|
15669
|
+
this.callbacks = {
|
|
15670
|
+
onFinish: (value) => {
|
|
15671
|
+
},
|
|
15672
|
+
onFinishFailed: () => {
|
|
15673
|
+
}
|
|
15674
|
+
};
|
|
15675
|
+
}
|
|
15676
|
+
}
|
|
15677
|
+
const useForm = (form) => {
|
|
15678
|
+
const formRef = useRef();
|
|
15679
|
+
if (!formRef.current) {
|
|
15680
|
+
if (form) {
|
|
15681
|
+
formRef.current = form;
|
|
15682
|
+
} else {
|
|
15683
|
+
const formStore = new FormStore();
|
|
15684
|
+
formRef.current = formStore.getForm();
|
|
15685
|
+
}
|
|
15686
|
+
}
|
|
15687
|
+
return [formRef.current];
|
|
15688
|
+
};
|
|
15689
|
+
const defaultProps$G = {
|
|
15690
|
+
...ComponentDefaults,
|
|
15691
|
+
name: "",
|
|
15692
|
+
label: "",
|
|
15693
|
+
className: "",
|
|
15694
|
+
rules: [{ required: false, message: "" }],
|
|
15695
|
+
disabled: false,
|
|
15696
|
+
labelWidth: 90,
|
|
15697
|
+
errorMessageAlign: "left",
|
|
15698
|
+
showErrorLine: true,
|
|
15699
|
+
showErrorMessage: true
|
|
15700
|
+
};
|
|
15701
|
+
class FormItem extends React__default.Component {
|
|
15702
|
+
constructor() {
|
|
15703
|
+
super(...arguments);
|
|
15704
|
+
this.getControlled = (children) => {
|
|
15705
|
+
const { getFieldValue, setFieldsValue } = this.context;
|
|
15706
|
+
const { name } = this.props;
|
|
15707
|
+
const type4 = children.type.NAME;
|
|
15708
|
+
return {
|
|
15709
|
+
value: getFieldValue(name),
|
|
15710
|
+
onChange: (event) => {
|
|
15711
|
+
let newValue = event;
|
|
15712
|
+
switch (type4) {
|
|
15713
|
+
case "checkbox":
|
|
15714
|
+
newValue = event.target.value;
|
|
15715
|
+
break;
|
|
15716
|
+
}
|
|
15717
|
+
setFieldsValue({ [name]: newValue });
|
|
15718
|
+
}
|
|
15719
|
+
};
|
|
15720
|
+
};
|
|
15721
|
+
this.onStoreChange = () => {
|
|
15722
|
+
this.forceUpdate();
|
|
15723
|
+
};
|
|
15724
|
+
this.renderLayout = (childNode) => {
|
|
15725
|
+
var _a, _b;
|
|
15726
|
+
const {
|
|
15727
|
+
label,
|
|
15728
|
+
name,
|
|
15729
|
+
rules: rules2 = [{ required: false, message: "" }],
|
|
15730
|
+
className,
|
|
15731
|
+
labelWidth,
|
|
15732
|
+
errorMessageAlign,
|
|
15733
|
+
showErrorLine,
|
|
15734
|
+
showErrorMessage
|
|
15735
|
+
} = {
|
|
15736
|
+
...defaultProps$G,
|
|
15737
|
+
...this.props
|
|
15738
|
+
};
|
|
15739
|
+
const item = ((_a = this.context.errList) == null ? void 0 : _a.length) > 0 && ((_b = this.context.errList) == null ? void 0 : _b.filter((item2) => {
|
|
15740
|
+
return item2.field === name;
|
|
15741
|
+
}));
|
|
15742
|
+
const { starPositon } = this.context;
|
|
15743
|
+
const renderStar = rules2.length > 0 && rules2[0].required && /* @__PURE__ */ React__default.createElement("i", {
|
|
15744
|
+
className: "required"
|
|
15745
|
+
});
|
|
15746
|
+
const renderLabel = starPositon === "Right" ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, label, renderStar) : /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, renderStar, label);
|
|
15747
|
+
return /* @__PURE__ */ React__default.createElement(Cell, {
|
|
15748
|
+
className: `nut-form-item ${className}`
|
|
15749
|
+
}, label ? /* @__PURE__ */ React__default.createElement("div", {
|
|
15750
|
+
className: "nut-cell__title nut-form-item__label",
|
|
15751
|
+
style: {
|
|
15752
|
+
width: this.pxCheck(labelWidth)
|
|
15753
|
+
}
|
|
15754
|
+
}, renderLabel) : null, /* @__PURE__ */ React__default.createElement("div", {
|
|
15755
|
+
className: "nut-cell__value nut-form-item__body"
|
|
15756
|
+
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
15757
|
+
className: "nut-form-item__body__slots"
|
|
15758
|
+
}, childNode), item.length > 0 && /* @__PURE__ */ React__default.createElement("div", {
|
|
15759
|
+
className: "nut-form-item__body__tips",
|
|
15760
|
+
style: { textAlign: errorMessageAlign }
|
|
15761
|
+
}, item[0].message)));
|
|
15762
|
+
};
|
|
15763
|
+
this.pxCheck = (value) => {
|
|
15764
|
+
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
15765
|
+
};
|
|
15766
|
+
}
|
|
15767
|
+
componentDidMount() {
|
|
15768
|
+
this.cancelRegister = this.context.registerField(this);
|
|
15769
|
+
}
|
|
15770
|
+
componentWillUnmount() {
|
|
15771
|
+
if (this.cancelRegister) {
|
|
15772
|
+
this.cancelRegister();
|
|
15773
|
+
}
|
|
15774
|
+
}
|
|
15775
|
+
render() {
|
|
15776
|
+
const { children } = this.props;
|
|
15777
|
+
const c6 = Array.isArray(children) ? children[0] : children;
|
|
15778
|
+
const returnChildNode = React__default.cloneElement(
|
|
15779
|
+
c6,
|
|
15780
|
+
this.getControlled(c6)
|
|
15781
|
+
);
|
|
15782
|
+
return this.renderLayout(returnChildNode);
|
|
15783
|
+
}
|
|
15784
|
+
}
|
|
15785
|
+
FormItem.defaultProps = defaultProps$G;
|
|
15786
|
+
FormItem.contextType = FormItemContext;
|
|
15787
|
+
const defaultProps$F = {
|
|
15788
|
+
...ComponentDefaults,
|
|
15789
|
+
className: "",
|
|
15790
|
+
style: void 0,
|
|
15791
|
+
form: {},
|
|
15792
|
+
labelPosition: "Right",
|
|
15793
|
+
formGroupTitle: "",
|
|
15794
|
+
onFinish: (obj) => {
|
|
15795
|
+
},
|
|
15796
|
+
onFinishFailed: (value) => {
|
|
15797
|
+
},
|
|
15798
|
+
starPositon: "Left"
|
|
15799
|
+
};
|
|
15800
|
+
const PositionInfo = {
|
|
15801
|
+
Top: "form-layout-top",
|
|
15802
|
+
Left: "form-layout-left",
|
|
15803
|
+
Right: "form-layout-right"
|
|
15804
|
+
};
|
|
15805
|
+
const Form = (props) => {
|
|
15806
|
+
const {
|
|
15807
|
+
children,
|
|
15808
|
+
onFinish,
|
|
15809
|
+
onFinishFailed,
|
|
15810
|
+
labelPosition,
|
|
15811
|
+
starPositon,
|
|
15812
|
+
...rest
|
|
15813
|
+
} = {
|
|
15814
|
+
...defaultProps$F,
|
|
15815
|
+
...props
|
|
15816
|
+
};
|
|
15817
|
+
const [formInstance] = useForm();
|
|
15818
|
+
formInstance.starPositon = starPositon;
|
|
15819
|
+
const { setCallback, submit } = formInstance;
|
|
15820
|
+
setCallback({
|
|
15821
|
+
onFinish,
|
|
15822
|
+
onFinishFailed
|
|
15823
|
+
});
|
|
15824
|
+
return /* @__PURE__ */ React__default.createElement("form", {
|
|
15825
|
+
className: `nut-form ${PositionInfo[labelPosition]} ${props.className}`,
|
|
15826
|
+
style: props.style,
|
|
15827
|
+
onSubmit: (e2) => {
|
|
15828
|
+
e2.preventDefault();
|
|
15829
|
+
submit();
|
|
15830
|
+
}
|
|
15831
|
+
}, /* @__PURE__ */ React__default.createElement(CellGroup, null, /* @__PURE__ */ React__default.createElement(FormItemContext.Provider, {
|
|
15832
|
+
value: formInstance
|
|
15833
|
+
}, children)));
|
|
15834
|
+
};
|
|
15835
|
+
Form.defaultProps = defaultProps$F;
|
|
15836
|
+
Form.displayName = "NutForm";
|
|
15837
|
+
Form.Item = FormItem;
|
|
14533
15838
|
const defaultProps$E = {
|
|
14534
15839
|
cancelTxt: "",
|
|
14535
15840
|
optionTag: "name",
|
|
@@ -15081,12 +16386,12 @@ const Dialog = forwardRef(BaseDialog);
|
|
|
15081
16386
|
Dialog.confirm = (props) => {
|
|
15082
16387
|
return confirm(props);
|
|
15083
16388
|
};
|
|
15084
|
-
["alert"].forEach((
|
|
15085
|
-
Dialog[
|
|
16389
|
+
["alert"].forEach((type4) => {
|
|
16390
|
+
Dialog[type4] = (props) => {
|
|
15086
16391
|
return confirm({
|
|
15087
16392
|
...props,
|
|
15088
16393
|
isNotice: false,
|
|
15089
|
-
noticeType:
|
|
16394
|
+
noticeType: type4
|
|
15090
16395
|
});
|
|
15091
16396
|
};
|
|
15092
16397
|
});
|
|
@@ -15347,7 +16652,7 @@ class Notification extends React.PureComponent {
|
|
|
15347
16652
|
msg,
|
|
15348
16653
|
color,
|
|
15349
16654
|
background,
|
|
15350
|
-
type,
|
|
16655
|
+
type: type4,
|
|
15351
16656
|
className,
|
|
15352
16657
|
position,
|
|
15353
16658
|
isWrapTeleport
|
|
@@ -15358,7 +16663,7 @@ class Notification extends React.PureComponent {
|
|
|
15358
16663
|
"popup-top": position === "top",
|
|
15359
16664
|
"popup-bottom": position === "bottom",
|
|
15360
16665
|
"nut-notify": true,
|
|
15361
|
-
[`nut-notify--${
|
|
16666
|
+
[`nut-notify--${type4}`]: true
|
|
15362
16667
|
});
|
|
15363
16668
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(CSSTransition$1, {
|
|
15364
16669
|
in: this.state.show,
|
|
@@ -16638,9 +17943,9 @@ const Swiper = React__default.forwardRef((props, ref) => {
|
|
|
16638
17943
|
if (pace) {
|
|
16639
17944
|
const _active = active + pace;
|
|
16640
17945
|
if (props.loop) {
|
|
16641
|
-
return
|
|
17946
|
+
return range3(_active, -1, childCount);
|
|
16642
17947
|
}
|
|
16643
|
-
return
|
|
17948
|
+
return range3(_active, 0, childCount - 1);
|
|
16644
17949
|
}
|
|
16645
17950
|
return active;
|
|
16646
17951
|
};
|
|
@@ -16651,14 +17956,14 @@ const Swiper = React__default.forwardRef((props, ref) => {
|
|
|
16651
17956
|
}
|
|
16652
17957
|
let targetOffset = offset2 - currentPosition;
|
|
16653
17958
|
if (!props.loop) {
|
|
16654
|
-
targetOffset =
|
|
17959
|
+
targetOffset = range3(targetOffset, minOffset, 0);
|
|
16655
17960
|
}
|
|
16656
17961
|
return targetOffset;
|
|
16657
17962
|
};
|
|
16658
17963
|
const requestFrame = (fn) => {
|
|
16659
17964
|
window.requestAnimationFrame.call(window, fn);
|
|
16660
17965
|
};
|
|
16661
|
-
const
|
|
17966
|
+
const range3 = (num, min, max) => {
|
|
16662
17967
|
return Math.min(Math.max(num, min), max);
|
|
16663
17968
|
};
|
|
16664
17969
|
const getDirection2 = (x2, y2) => {
|
|
@@ -16924,7 +18229,7 @@ const Avatar = (props) => {
|
|
|
16924
18229
|
shape,
|
|
16925
18230
|
bgColor,
|
|
16926
18231
|
color,
|
|
16927
|
-
url,
|
|
18232
|
+
url: url2,
|
|
16928
18233
|
alt,
|
|
16929
18234
|
icon,
|
|
16930
18235
|
iconSize,
|
|
@@ -17003,9 +18308,9 @@ const Avatar = (props) => {
|
|
|
17003
18308
|
style: !showMax ? styles : maxStyles,
|
|
17004
18309
|
onClick: clickAvatar,
|
|
17005
18310
|
ref: avatarRef
|
|
17006
|
-
}, (!((_j = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _j.maxCount) || avatarIndex <= ((_k = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _k.maxCount)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null,
|
|
18311
|
+
}, (!((_j = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _j.maxCount) || avatarIndex <= ((_k = parent == null ? void 0 : parent.propAvatarGroup) == null ? void 0 : _k.maxCount)) && /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, url2 && /* @__PURE__ */ React__default.createElement("img", {
|
|
17007
18312
|
className: "avatar-img",
|
|
17008
|
-
src:
|
|
18313
|
+
src: url2,
|
|
17009
18314
|
alt,
|
|
17010
18315
|
onError: errorEvent
|
|
17011
18316
|
}), icon && /* @__PURE__ */ React__default.createElement(Icon$1, {
|
|
@@ -17219,7 +18524,7 @@ const Tag = (props) => {
|
|
|
17219
18524
|
style,
|
|
17220
18525
|
color,
|
|
17221
18526
|
plain,
|
|
17222
|
-
type,
|
|
18527
|
+
type: type4,
|
|
17223
18528
|
round,
|
|
17224
18529
|
prefixCls,
|
|
17225
18530
|
children,
|
|
@@ -17239,7 +18544,7 @@ const Tag = (props) => {
|
|
|
17239
18544
|
useEffect(() => {
|
|
17240
18545
|
setBtnName(classes());
|
|
17241
18546
|
}, [
|
|
17242
|
-
|
|
18547
|
+
type4,
|
|
17243
18548
|
color,
|
|
17244
18549
|
textColor,
|
|
17245
18550
|
plain,
|
|
@@ -17253,7 +18558,7 @@ const Tag = (props) => {
|
|
|
17253
18558
|
const classes = () => {
|
|
17254
18559
|
const prefixCls2 = "nut-tag";
|
|
17255
18560
|
return `${prefixCls2}
|
|
17256
|
-
${
|
|
18561
|
+
${type4 ? `${prefixCls2}--${type4}` : ""}
|
|
17257
18562
|
${plain ? `${prefixCls2}--plain` : ""}
|
|
17258
18563
|
${round ? `${prefixCls2}--round` : ""}
|
|
17259
18564
|
${mark ? `${prefixCls2}--mark` : ""}
|
|
@@ -17322,12 +18627,12 @@ function composeRef(...refs) {
|
|
|
17322
18627
|
};
|
|
17323
18628
|
}
|
|
17324
18629
|
class Trigger extends React__default.Component {
|
|
17325
|
-
fireEvents(
|
|
17326
|
-
const childCallback = this.props.children.props[
|
|
18630
|
+
fireEvents(type4, e2) {
|
|
18631
|
+
const childCallback = this.props.children.props[type4];
|
|
17327
18632
|
if (childCallback) {
|
|
17328
18633
|
childCallback(e2);
|
|
17329
18634
|
}
|
|
17330
|
-
const callback = this.props[
|
|
18635
|
+
const callback = this.props[type4];
|
|
17331
18636
|
if (callback) {
|
|
17332
18637
|
callback(e2);
|
|
17333
18638
|
}
|
|
@@ -17575,7 +18880,7 @@ const InternalCountDown = (props, ref) => {
|
|
|
17575
18880
|
startTime,
|
|
17576
18881
|
endTime,
|
|
17577
18882
|
millisecond,
|
|
17578
|
-
format,
|
|
18883
|
+
format: format2,
|
|
17579
18884
|
autoStart,
|
|
17580
18885
|
time,
|
|
17581
18886
|
className,
|
|
@@ -17635,7 +18940,7 @@ const InternalCountDown = (props, ref) => {
|
|
|
17635
18940
|
}
|
|
17636
18941
|
});
|
|
17637
18942
|
};
|
|
17638
|
-
const formatRemainTime = (t2,
|
|
18943
|
+
const formatRemainTime = (t2, type4) => {
|
|
17639
18944
|
const ts2 = t2;
|
|
17640
18945
|
const rest2 = {
|
|
17641
18946
|
d: 0,
|
|
@@ -17655,12 +18960,12 @@ const InternalCountDown = (props, ref) => {
|
|
|
17655
18960
|
rest2.s = Math.floor(ts2 % MINUTE / SECOND);
|
|
17656
18961
|
rest2.ms = Math.floor(ts2 % SECOND);
|
|
17657
18962
|
}
|
|
17658
|
-
return
|
|
18963
|
+
return type4 === "custom" ? rest2 : parseFormat({ ...rest2 });
|
|
17659
18964
|
};
|
|
17660
18965
|
const parseFormat = (time2) => {
|
|
17661
18966
|
const { d: d2 } = time2;
|
|
17662
18967
|
let { h: h2, m: m2, s, ms } = time2;
|
|
17663
|
-
let formatCache =
|
|
18968
|
+
let formatCache = format2;
|
|
17664
18969
|
if (formatCache.includes("DD")) {
|
|
17665
18970
|
formatCache = formatCache.replace("DD", padZero(d2));
|
|
17666
18971
|
} else {
|
|
@@ -18071,10 +19376,10 @@ const CountUp = (props) => {
|
|
|
18071
19376
|
}, !Number.isNaN(Number(item)) ? /* @__PURE__ */ React__default.createElement("span", {
|
|
18072
19377
|
className: b2("number"),
|
|
18073
19378
|
style: numberEaseStyle
|
|
18074
|
-
}, [...numbers, ...numbers].map((
|
|
19379
|
+
}, [...numbers, ...numbers].map((number4, subidx) => {
|
|
18075
19380
|
return /* @__PURE__ */ React__default.createElement("span", {
|
|
18076
19381
|
key: subidx
|
|
18077
|
-
},
|
|
19382
|
+
}, number4);
|
|
18078
19383
|
})) : /* @__PURE__ */ React__default.createElement("span", {
|
|
18079
19384
|
className: b2("separator")
|
|
18080
19385
|
}, item));
|
|
@@ -18676,13 +19981,13 @@ const Audio = (props) => {
|
|
|
18676
19981
|
const { locale } = useConfig();
|
|
18677
19982
|
const {
|
|
18678
19983
|
className,
|
|
18679
|
-
url,
|
|
19984
|
+
url: url2,
|
|
18680
19985
|
style,
|
|
18681
19986
|
muted,
|
|
18682
19987
|
autoplay,
|
|
18683
19988
|
loop: loop2,
|
|
18684
19989
|
preload,
|
|
18685
|
-
type,
|
|
19990
|
+
type: type4,
|
|
18686
19991
|
onFastBack,
|
|
18687
19992
|
onForward,
|
|
18688
19993
|
onPause,
|
|
@@ -18841,7 +20146,7 @@ const Audio = (props) => {
|
|
|
18841
20146
|
}, children);
|
|
18842
20147
|
};
|
|
18843
20148
|
const renderAudio = () => {
|
|
18844
|
-
switch (
|
|
20149
|
+
switch (type4) {
|
|
18845
20150
|
case "icon":
|
|
18846
20151
|
return renderIcon();
|
|
18847
20152
|
case "progress":
|
|
@@ -18876,9 +20181,9 @@ const Audio = (props) => {
|
|
|
18876
20181
|
...rest
|
|
18877
20182
|
}, renderAudio(), /* @__PURE__ */ React__default.createElement("audio", {
|
|
18878
20183
|
className: "audioMain",
|
|
18879
|
-
controls:
|
|
20184
|
+
controls: type4 === "controls",
|
|
18880
20185
|
ref: AudioRef,
|
|
18881
|
-
src:
|
|
20186
|
+
src: url2,
|
|
18882
20187
|
muted,
|
|
18883
20188
|
preload,
|
|
18884
20189
|
loop: loop2,
|
|
@@ -19098,7 +20403,7 @@ const ExistRender = (props) => {
|
|
|
19098
20403
|
const { locale } = useConfig();
|
|
19099
20404
|
const {
|
|
19100
20405
|
children,
|
|
19101
|
-
type,
|
|
20406
|
+
type: type4,
|
|
19102
20407
|
existAddress,
|
|
19103
20408
|
selectedIcon,
|
|
19104
20409
|
defaultIcon,
|
|
@@ -19130,7 +20435,7 @@ const ExistRender = (props) => {
|
|
|
19130
20435
|
onSelected && onSelected(prevExistAdd, item, copyExistAdd);
|
|
19131
20436
|
};
|
|
19132
20437
|
const switchModule = () => {
|
|
19133
|
-
onSwitchModule && onSwitchModule({ type:
|
|
20438
|
+
onSwitchModule && onSwitchModule({ type: type4 === "exist" ? "custom" : "exist" });
|
|
19134
20439
|
};
|
|
19135
20440
|
useEffect(() => {
|
|
19136
20441
|
}, [existAddress]);
|
|
@@ -19182,7 +20487,7 @@ const CustomRender = (props) => {
|
|
|
19182
20487
|
const { locale } = useConfig();
|
|
19183
20488
|
const {
|
|
19184
20489
|
children,
|
|
19185
|
-
type,
|
|
20490
|
+
type: type4,
|
|
19186
20491
|
modelValue,
|
|
19187
20492
|
height,
|
|
19188
20493
|
province,
|
|
@@ -19198,7 +20503,7 @@ const CustomRender = (props) => {
|
|
|
19198
20503
|
...props
|
|
19199
20504
|
};
|
|
19200
20505
|
const b2 = cn("address");
|
|
19201
|
-
const [privateType] = useState(
|
|
20506
|
+
const [privateType] = useState(type4);
|
|
19202
20507
|
const [tabIndex, setTabIndex] = useState(0);
|
|
19203
20508
|
const [tabName] = useState(["province", "city", "country", "town"]);
|
|
19204
20509
|
const provinceRef = useRef(null);
|
|
@@ -19207,7 +20512,7 @@ const CustomRender = (props) => {
|
|
|
19207
20512
|
const townRef = useRef(null);
|
|
19208
20513
|
const regionLine = useRef(null);
|
|
19209
20514
|
const isCustom2 = () => {
|
|
19210
|
-
return
|
|
20515
|
+
return type4 === "custom2";
|
|
19211
20516
|
};
|
|
19212
20517
|
const transformData = (data) => {
|
|
19213
20518
|
if (!Array.isArray(data))
|
|
@@ -19471,7 +20776,7 @@ const Address = (props) => {
|
|
|
19471
20776
|
modelValue,
|
|
19472
20777
|
modelSelect,
|
|
19473
20778
|
children,
|
|
19474
|
-
type,
|
|
20779
|
+
type: type4,
|
|
19475
20780
|
height,
|
|
19476
20781
|
customAddressTitle,
|
|
19477
20782
|
existAddress,
|
|
@@ -19502,7 +20807,7 @@ const Address = (props) => {
|
|
|
19502
20807
|
...props
|
|
19503
20808
|
};
|
|
19504
20809
|
const b2 = cn("address");
|
|
19505
|
-
const [privateType, setPrivateType] = useState(
|
|
20810
|
+
const [privateType, setPrivateType] = useState(type4);
|
|
19506
20811
|
const [tabName] = useState(["province", "city", "country", "town"]);
|
|
19507
20812
|
const [showPopup, setShowPopup] = useState(modelValue);
|
|
19508
20813
|
const [selectedRegion, setSelectedRegion] = useState({
|
|
@@ -19639,8 +20944,8 @@ const Address = (props) => {
|
|
|
19639
20944
|
onNextArea: (cal) => {
|
|
19640
20945
|
nextAreaList && nextAreaList(cal);
|
|
19641
20946
|
},
|
|
19642
|
-
onTabClick: (
|
|
19643
|
-
onTabChecked && onTabChecked(
|
|
20947
|
+
onTabClick: (type22) => {
|
|
20948
|
+
onTabChecked && onTabChecked(type22);
|
|
19644
20949
|
},
|
|
19645
20950
|
onClose: handClose
|
|
19646
20951
|
}), privateType === "exist" && /* @__PURE__ */ React__default.createElement(ExistRender, {
|
|
@@ -19748,7 +21053,7 @@ const defaultProps$4 = {
|
|
|
19748
21053
|
const Signature = (props) => {
|
|
19749
21054
|
const { locale } = useConfig();
|
|
19750
21055
|
const {
|
|
19751
|
-
type,
|
|
21056
|
+
type: type4,
|
|
19752
21057
|
lineWidth,
|
|
19753
21058
|
strokeStyle,
|
|
19754
21059
|
unSupportTpl,
|
|
@@ -19837,7 +21142,7 @@ const Signature = (props) => {
|
|
|
19837
21142
|
};
|
|
19838
21143
|
const onSave = (canvas) => {
|
|
19839
21144
|
let dataurl;
|
|
19840
|
-
switch (
|
|
21145
|
+
switch (type4) {
|
|
19841
21146
|
case "png":
|
|
19842
21147
|
dataurl = canvas.toDataURL("image/png");
|
|
19843
21148
|
break;
|
|
@@ -19938,7 +21243,7 @@ const defaultProps$2 = {
|
|
|
19938
21243
|
};
|
|
19939
21244
|
const TimePannel = (props) => {
|
|
19940
21245
|
useConfig();
|
|
19941
|
-
const { children, className, date, curKey, change } = {
|
|
21246
|
+
const { children, className, date: date4, curKey, change } = {
|
|
19942
21247
|
...defaultProps$2,
|
|
19943
21248
|
...props
|
|
19944
21249
|
};
|
|
@@ -19946,7 +21251,7 @@ const TimePannel = (props) => {
|
|
|
19946
21251
|
return /* @__PURE__ */ React__default.createElement("div", {
|
|
19947
21252
|
className: `${b2()} ${className || ""}`,
|
|
19948
21253
|
onClick: () => change(curKey)
|
|
19949
|
-
},
|
|
21254
|
+
}, date4);
|
|
19950
21255
|
};
|
|
19951
21256
|
TimePannel.defaultProps = defaultProps$2;
|
|
19952
21257
|
TimePannel.displayName = "NutTimePannel";
|
|
@@ -20149,4 +21454,4 @@ const TimeSelect = (props) => {
|
|
|
20149
21454
|
};
|
|
20150
21455
|
TimeSelect.defaultProps = defaultProps;
|
|
20151
21456
|
TimeSelect.displayName = "NutTimeSelect";
|
|
20152
|
-
export { ActionSheet, Address, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator, Empty, FixedNav, Grid, GridItem, Icon$1 as Icon, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, PullToRefresh, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, Sticky, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, Uploader, Video, VirtualList };
|
|
21457
|
+
export { ActionSheet, Address, AnimatingNumbers, Audio, Avatar, AvatarGroup, BackTop, Badge, Barrage, Button, Calendar, CalendarItem, Card, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, CircleProgress, Col, Collapse, CollapseItem, ConfigProvider, CountDown, DatePicker, Dialog, Divider, Drag, Elevator, Empty, FixedNav, Form, FormItem, Grid, GridItem, Icon$1 as Icon, ImagePreview, Indicator, Infiniteloading, Input, InputNumber, Layout, Menu, MenuItem, NavBar, NoticeBar, Notify, NumberKeyboard, Overlay, Pagination, Picker, Popover, Popup, Price, Progress, PullToRefresh, Radio, RadioGroup, Range, Rate, Row, SearchBar, ShortPassword, SideNavBar, SideNavBarItem, Signature, Skeleton, Step, Steps, Sticky, SubSideNavBar, Swipe, Swiper, SwiperItem, Switch, TabPane, Tabbar, TabbarItem, Table, Tabs, Tag, TextArea, TimeDetail, TimePannel, TimeSelect, Toast, Uploader, Video, VirtualList };
|