@nutui/nutui-react 3.0.1 → 3.0.2
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/dist/cjs/hooks/use-client-rect.js +1 -0
- package/dist/cjs/packages/datepicker/style/style.css +70 -0
- package/dist/cjs/packages/datepickerview/style/index.js +1 -0
- package/dist/cjs/packages/datepickerview/style/style.css +70 -0
- package/dist/cjs/packages/fixednav/fixednav.js +20 -14
- package/dist/cjs/packages/fixednav/style/fixednav.scss +0 -15
- package/dist/cjs/packages/fixednav/style/style.css +0 -14
- package/dist/cjs/packages/form/__tests__/merge.spec.d.ts +1 -0
- package/dist/cjs/packages/form/__tests__/merge.spec.js +545 -0
- package/dist/cjs/packages/form/form.d.ts +2 -0
- package/dist/cjs/packages/form/form.js +9 -2
- package/dist/cjs/packages/form/index.d.ts +2 -1
- package/dist/cjs/packages/form/index.js +1 -0
- package/dist/cjs/packages/form/style/form.scss +0 -66
- package/dist/cjs/packages/form/style/style.css +31 -21
- package/dist/cjs/packages/form/types.d.ts +2 -1
- package/dist/cjs/packages/form/useform.d.ts +2 -1
- package/dist/cjs/packages/form/useform.js +342 -278
- package/dist/cjs/packages/formitem/formitem.d.ts +1 -0
- package/dist/cjs/packages/formitem/formitem.js +55 -44
- package/dist/cjs/packages/formitem/style/formitem.scss +101 -21
- package/dist/cjs/packages/formitem/style/style.css +89 -12
- package/dist/cjs/packages/picker/style/index.js +1 -0
- package/dist/cjs/packages/picker/style/style.css +70 -0
- package/dist/cjs/packages/swipe/style/style.css +3 -3
- package/dist/cjs/packages/swipe/style/swipe.scss +7 -3
- package/dist/cjs/utils/get-rect-by-taro.d.ts +1 -1
- package/dist/cjs/utils/get-rect-by-taro.js +4 -1
- package/dist/cjs/utils/get-system-info.js +4 -5
- package/dist/cjs/utils/merge.d.ts +14 -0
- package/dist/cjs/utils/merge.js +98 -0
- package/dist/cjs/utils/platform-taro.js +4 -5
- package/dist/cjs/utils/to-array.d.ts +1 -0
- package/dist/cjs/utils/to-array.js +18 -0
- package/dist/es/hooks/use-client-rect.js +1 -0
- package/dist/es/packages/datepicker/style/style.css +70 -0
- package/dist/es/packages/datepickerview/style/index.js +1 -0
- package/dist/es/packages/datepickerview/style/style.css +70 -0
- package/dist/es/packages/fixednav/fixednav.js +20 -14
- package/dist/es/packages/fixednav/style/fixednav.scss +0 -15
- package/dist/es/packages/fixednav/style/style.css +0 -14
- package/dist/es/packages/form/__tests__/merge.spec.d.ts +1 -0
- package/dist/es/packages/form/__tests__/merge.spec.js +541 -0
- package/dist/es/packages/form/form.d.ts +10 -0
- package/dist/es/packages/form/form.js +9 -2
- package/dist/es/packages/form/index.d.ts +2 -1
- package/dist/es/packages/form/index.js +2 -1
- package/dist/es/packages/form/style/form.scss +0 -66
- package/dist/es/packages/form/style/style.css +31 -21
- package/dist/es/packages/form/types.d.ts +2 -1
- package/dist/es/packages/form/useform.d.ts +2 -1
- package/dist/es/packages/form/useform.js +340 -279
- package/dist/es/packages/formitem/formitem.d.ts +1 -0
- package/dist/es/packages/formitem/formitem.js +55 -44
- package/dist/es/packages/formitem/style/formitem.scss +101 -21
- package/dist/es/packages/formitem/style/style.css +89 -12
- package/dist/es/packages/picker/style/index.js +1 -0
- package/dist/es/packages/picker/style/style.css +70 -0
- package/dist/es/packages/swipe/style/style.css +3 -3
- package/dist/es/packages/swipe/style/swipe.scss +7 -3
- package/dist/es/utils/get-rect-by-taro.d.ts +1 -1
- package/dist/es/utils/get-rect-by-taro.js +4 -1
- package/dist/es/utils/get-system-info.js +4 -4
- package/dist/es/utils/merge.d.ts +14 -0
- package/dist/es/utils/merge.js +68 -0
- package/dist/es/utils/platform-taro.js +4 -4
- package/dist/es/utils/to-array.d.ts +1 -0
- package/dist/es/utils/to-array.js +8 -0
- package/dist/nutui.react.umd.js +555 -422
- package/dist/style.css +1 -1
- package/dist/style.scss +41 -41
- package/package.json +1 -1
package/dist/nutui.react.umd.js
CHANGED
|
@@ -4461,6 +4461,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4461
4461
|
};
|
|
4462
4462
|
}
|
|
4463
4463
|
if (element && element.getBoundingClientRect) {
|
|
4464
|
+
console.log(element, element.getBoundingClientRect());
|
|
4464
4465
|
return element.getBoundingClientRect();
|
|
4465
4466
|
}
|
|
4466
4467
|
return {
|
|
@@ -4472,7 +4473,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4472
4473
|
height: 0
|
|
4473
4474
|
};
|
|
4474
4475
|
};
|
|
4475
|
-
function useWatch(dep, callback) {
|
|
4476
|
+
function useWatch$1(dep, callback) {
|
|
4476
4477
|
var config2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
|
|
4477
4478
|
immediate: false
|
|
4478
4479
|
};
|
|
@@ -4620,7 +4621,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4620
4621
|
threshold,
|
|
4621
4622
|
container
|
|
4622
4623
|
]);
|
|
4623
|
-
useWatch(isFixed, function() {
|
|
4624
|
+
useWatch$1(isFixed, function() {
|
|
4624
4625
|
onChange && onChange(isFixed);
|
|
4625
4626
|
});
|
|
4626
4627
|
React.useEffect(function() {
|
|
@@ -6833,7 +6834,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
6833
6834
|
}
|
|
6834
6835
|
}
|
|
6835
6836
|
}
|
|
6836
|
-
const toArray = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
|
|
6837
|
+
const toArray$1 = (a) => is.und(a) ? [] : is.arr(a) ? a : [a];
|
|
6837
6838
|
function flush(queue, iterator) {
|
|
6838
6839
|
if (queue.size) {
|
|
6839
6840
|
const items = Array.from(queue);
|
|
@@ -7841,7 +7842,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
7841
7842
|
function callProp(value2, ...args) {
|
|
7842
7843
|
return is.fun(value2) ? value2(...args) : value2;
|
|
7843
7844
|
}
|
|
7844
|
-
const matchProp = (value2, key2) => value2 === true || !!(key2 && value2 && (is.fun(value2) ? value2(key2) : toArray(value2).includes(key2)));
|
|
7845
|
+
const matchProp = (value2, key2) => value2 === true || !!(key2 && value2 && (is.fun(value2) ? value2(key2) : toArray$1(value2).includes(key2)));
|
|
7845
7846
|
const resolveProp = (prop, key2) => is.obj(prop) ? key2 && prop[key2] : prop;
|
|
7846
7847
|
const getDefaultProp = (props, key2) => props.default === true ? props[key2] : props.default ? props.default[key2] : void 0;
|
|
7847
7848
|
const noopTransform = (value2) => value2;
|
|
@@ -8383,7 +8384,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
8383
8384
|
} = anim;
|
|
8384
8385
|
const payload = getPayload(anim.to);
|
|
8385
8386
|
if (!payload && hasFluidValue(anim.to)) {
|
|
8386
|
-
toValues = toArray(getFluidValue(anim.to));
|
|
8387
|
+
toValues = toArray$1(getFluidValue(anim.to));
|
|
8387
8388
|
}
|
|
8388
8389
|
anim.values.forEach((node2, i2) => {
|
|
8389
8390
|
if (node2.done) return;
|
|
@@ -8736,7 +8737,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
8736
8737
|
if (!hasAsyncTo) {
|
|
8737
8738
|
if (started || hasFluidValue(prevTo)) {
|
|
8738
8739
|
anim.values = node.getPayload();
|
|
8739
|
-
anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray(goal);
|
|
8740
|
+
anim.toValues = hasFluidValue(to2) ? null : goalType == AnimatedString ? [1] : toArray$1(goal);
|
|
8740
8741
|
}
|
|
8741
8742
|
if (anim.immediate != immediate) {
|
|
8742
8743
|
anim.immediate = immediate;
|
|
@@ -9009,7 +9010,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9009
9010
|
queue
|
|
9010
9011
|
} = this;
|
|
9011
9012
|
if (props) {
|
|
9012
|
-
queue = toArray(props).map(createUpdate);
|
|
9013
|
+
queue = toArray$1(props).map(createUpdate);
|
|
9013
9014
|
} else {
|
|
9014
9015
|
this.queue = [];
|
|
9015
9016
|
}
|
|
@@ -9025,7 +9026,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9025
9026
|
}
|
|
9026
9027
|
if (keys) {
|
|
9027
9028
|
const springs = this.springs;
|
|
9028
|
-
each(toArray(keys), (key2) => springs[key2].stop(!!arg));
|
|
9029
|
+
each(toArray$1(keys), (key2) => springs[key2].stop(!!arg));
|
|
9029
9030
|
} else {
|
|
9030
9031
|
stopAsync(this._state, this._lastAsyncId);
|
|
9031
9032
|
this.each((spring) => spring.stop(!!arg));
|
|
@@ -9039,7 +9040,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9039
9040
|
});
|
|
9040
9041
|
} else {
|
|
9041
9042
|
const springs = this.springs;
|
|
9042
|
-
each(toArray(keys), (key2) => springs[key2].pause());
|
|
9043
|
+
each(toArray$1(keys), (key2) => springs[key2].pause());
|
|
9043
9044
|
}
|
|
9044
9045
|
return this;
|
|
9045
9046
|
}
|
|
@@ -9050,7 +9051,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9050
9051
|
});
|
|
9051
9052
|
} else {
|
|
9052
9053
|
const springs = this.springs;
|
|
9053
|
-
each(toArray(keys), (key2) => springs[key2].resume());
|
|
9054
|
+
each(toArray$1(keys), (key2) => springs[key2].resume());
|
|
9054
9055
|
}
|
|
9055
9056
|
return this;
|
|
9056
9057
|
}
|
|
@@ -9201,7 +9202,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9201
9202
|
function getSprings(ctrl, props) {
|
|
9202
9203
|
const springs = _extends$1({}, ctrl.springs);
|
|
9203
9204
|
if (props) {
|
|
9204
|
-
each(toArray(props), (props2) => {
|
|
9205
|
+
each(toArray$1(props), (props2) => {
|
|
9205
9206
|
if (is.und(props2.keys)) {
|
|
9206
9207
|
props2 = createUpdate(props2);
|
|
9207
9208
|
}
|
|
@@ -9473,7 +9474,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9473
9474
|
}
|
|
9474
9475
|
}
|
|
9475
9476
|
_get() {
|
|
9476
|
-
const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray(getFluidValue(this.source));
|
|
9477
|
+
const inputs = is.arr(this.source) ? this.source.map(getFluidValue) : toArray$1(getFluidValue(this.source));
|
|
9477
9478
|
return this.calc(...inputs);
|
|
9478
9479
|
}
|
|
9479
9480
|
_start() {
|
|
@@ -9492,7 +9493,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9492
9493
|
}
|
|
9493
9494
|
_attach() {
|
|
9494
9495
|
let priority2 = 1;
|
|
9495
|
-
each(toArray(this.source), (source) => {
|
|
9496
|
+
each(toArray$1(this.source), (source) => {
|
|
9496
9497
|
if (hasFluidValue(source)) {
|
|
9497
9498
|
addFluidObserver(source, this);
|
|
9498
9499
|
}
|
|
@@ -9507,7 +9508,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9507
9508
|
this._start();
|
|
9508
9509
|
}
|
|
9509
9510
|
_detach() {
|
|
9510
|
-
each(toArray(this.source), (source) => {
|
|
9511
|
+
each(toArray$1(this.source), (source) => {
|
|
9511
9512
|
if (hasFluidValue(source)) {
|
|
9512
9513
|
removeFluidObserver(source, this);
|
|
9513
9514
|
}
|
|
@@ -9526,7 +9527,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9526
9527
|
} else if (event.type == "idle") {
|
|
9527
9528
|
this._active.delete(event.parent);
|
|
9528
9529
|
} else if (event.type == "priority") {
|
|
9529
|
-
this.priority = toArray(this.source).reduce((highest, parent2) => Math.max(highest, (isFrameValue(parent2) ? parent2.priority : 0) + 1), 0);
|
|
9530
|
+
this.priority = toArray$1(this.source).reduce((highest, parent2) => Math.max(highest, (isFrameValue(parent2) ? parent2.priority : 0) + 1), 0);
|
|
9530
9531
|
}
|
|
9531
9532
|
}
|
|
9532
9533
|
}
|
|
@@ -9688,7 +9689,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9688
9689
|
delete style[key2];
|
|
9689
9690
|
if (is.und(value2)) return;
|
|
9690
9691
|
const unit = pxTransforms.test(key2) ? "px" : degTransforms.test(key2) ? "deg" : "";
|
|
9691
|
-
inputs.push(toArray(value2));
|
|
9692
|
+
inputs.push(toArray$1(value2));
|
|
9692
9693
|
transforms.push(key2 === "rotate3d" ? ([x2, y2, z2, deg]) => [`rotate3d(${x2},${y2},${z2},${addUnit(deg, unit)})`, isValueIdentity(deg, 0)] : (input) => [`${key2}(${input.map((v) => addUnit(v, unit)).join(",")})`, isValueIdentity(input, key2.startsWith("scale") ? 1 : 0)]);
|
|
9693
9694
|
}
|
|
9694
9695
|
});
|
|
@@ -9955,7 +9956,62 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9955
9956
|
};
|
|
9956
9957
|
Elevator.displayName = "NutElevator";
|
|
9957
9958
|
Elevator.Context = elevatorContext;
|
|
9958
|
-
|
|
9959
|
+
function _type_of(obj) {
|
|
9960
|
+
"@swc/helpers - typeof";
|
|
9961
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
9962
|
+
}
|
|
9963
|
+
var defaultProps$1l = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
9964
|
+
value: "",
|
|
9965
|
+
dot: false,
|
|
9966
|
+
max: 99,
|
|
9967
|
+
top: 0,
|
|
9968
|
+
right: 0,
|
|
9969
|
+
fill: "solid",
|
|
9970
|
+
size: "large"
|
|
9971
|
+
});
|
|
9972
|
+
var Badge = function(props) {
|
|
9973
|
+
var isIcon = function isIcon2() {
|
|
9974
|
+
if ((typeof value2 === "undefined" ? "undefined" : _type_of(value2)) === "object" && value2) return value2;
|
|
9975
|
+
};
|
|
9976
|
+
var isNumber = function isNumber2() {
|
|
9977
|
+
if (typeof value2 === "number" && value2) return value2;
|
|
9978
|
+
};
|
|
9979
|
+
var isString = function isString2() {
|
|
9980
|
+
if (typeof value2 === "string" && value2) return value2;
|
|
9981
|
+
};
|
|
9982
|
+
var _this;
|
|
9983
|
+
var rtl = useRtl();
|
|
9984
|
+
var _$_object_spread = _object_spread({}, defaultProps$1l, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
|
|
9985
|
+
var classPrefix2 = "nut-badge";
|
|
9986
|
+
var classes = classNames(classPrefix2, className);
|
|
9987
|
+
var getContent = function() {
|
|
9988
|
+
if (dot || value2 === 0) return null;
|
|
9989
|
+
if (typeof value2 === "number") {
|
|
9990
|
+
return max < value2 ? "".concat(max, "+") : "".concat(value2);
|
|
9991
|
+
}
|
|
9992
|
+
return value2;
|
|
9993
|
+
};
|
|
9994
|
+
var _obj;
|
|
9995
|
+
var contentClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-sup"), isNumber() || isString() || dot), _define_property(_obj, "".concat(classPrefix2, "-number"), isNumber()), _define_property(_obj, "".concat(classPrefix2, "-one"), typeof getContent() === "string" && ((_this = "".concat(getContent())) === null || _this === void 0 ? void 0 : _this.length) === 1), _define_property(_obj, "".concat(classPrefix2, "-dot"), dot), _define_property(_obj, "".concat(classPrefix2, "-dot-").concat(size), dot), _define_property(_obj, "".concat(classPrefix2, "-").concat(fill), fill === "outline"), _define_property(_obj, "".concat(classPrefix2, "-content"), children), _obj));
|
|
9996
|
+
var getPositionStyle = function() {
|
|
9997
|
+
return _define_property({
|
|
9998
|
+
top: "".concat(Number(top) || 0, "px")
|
|
9999
|
+
}, rtl ? "left" : "right", "".concat(Number(right) || 0, "px"));
|
|
10000
|
+
};
|
|
10001
|
+
var _obj1;
|
|
10002
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
10003
|
+
className: classes,
|
|
10004
|
+
style
|
|
10005
|
+
}, isIcon() && /* @__PURE__ */ React.createElement("div", {
|
|
10006
|
+
className: classNames("".concat(classPrefix2, "-content"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix2, "-icon"), true), _define_property(_obj1, "".concat(classPrefix2, "-icon-rtl"), rtl), _obj1)),
|
|
10007
|
+
style: getPositionStyle()
|
|
10008
|
+
}, value2), children, !isIcon() && (getContent() || dot) && /* @__PURE__ */ React.createElement("div", {
|
|
10009
|
+
className: contentClasses,
|
|
10010
|
+
style: getPositionStyle()
|
|
10011
|
+
}, getContent()));
|
|
10012
|
+
};
|
|
10013
|
+
Badge.displayName = "NutBadge";
|
|
10014
|
+
var defaultProps$1k = _object_spread_props(_object_spread({}, defaultOverlayProps), {
|
|
9959
10015
|
activeText: "",
|
|
9960
10016
|
inactiveText: "",
|
|
9961
10017
|
type: "right",
|
|
@@ -9973,7 +10029,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9973
10029
|
});
|
|
9974
10030
|
var FixedNav = function(props) {
|
|
9975
10031
|
var locale = useConfig().locale;
|
|
9976
|
-
var _ref = _object_spread({}, defaultProps$
|
|
10032
|
+
var _ref = _object_spread({}, defaultProps$1k, props), overlay = _ref.overlay, visible = _ref.visible, list = _ref.list, activeText = _ref.activeText, inactiveText = _ref.inactiveText, position2 = _ref.position, type2 = _ref.type, children = _ref.children, style = _ref.style, className = _ref.className, content2 = _ref.content, zIndex = _ref.zIndex, onChange = _ref.onChange, onSelect = _ref.onSelect, rest = _object_without_properties(_ref, [
|
|
9977
10033
|
"overlay",
|
|
9978
10034
|
"visible",
|
|
9979
10035
|
"list",
|
|
@@ -9993,6 +10049,20 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
9993
10049
|
var classes = classNames(classPrefix2, {
|
|
9994
10050
|
active: visible
|
|
9995
10051
|
}, type2, className);
|
|
10052
|
+
var renderListItem = function(item, index2) {
|
|
10053
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
10054
|
+
className: "".concat(classPrefix2, "-list-item"),
|
|
10055
|
+
onClick: function(event) {
|
|
10056
|
+
return onSelect(item, event);
|
|
10057
|
+
},
|
|
10058
|
+
key: item.id || index2
|
|
10059
|
+
}, /* @__PURE__ */ React.isValidElement(item.icon) ? item.icon : /* @__PURE__ */ React.createElement("img", {
|
|
10060
|
+
src: item.icon,
|
|
10061
|
+
alt: ""
|
|
10062
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
10063
|
+
className: "".concat(classPrefix2, "-list-text")
|
|
10064
|
+
}, item.text));
|
|
10065
|
+
};
|
|
9996
10066
|
return /* @__PURE__ */ React.createElement("div", _object_spread({
|
|
9997
10067
|
className: classes,
|
|
9998
10068
|
style: _object_spread({}, position2, style)
|
|
@@ -10007,20 +10077,11 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10007
10077
|
}, children || /* @__PURE__ */ React.createElement("div", {
|
|
10008
10078
|
className: "".concat(classPrefix2, "-list")
|
|
10009
10079
|
}, list.map(function(item, index2) {
|
|
10010
|
-
return /* @__PURE__ */ React.createElement(
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
key: item.id || index2
|
|
10016
|
-
}, /* @__PURE__ */ React.isValidElement(item.icon) ? item.icon : /* @__PURE__ */ React.createElement("img", {
|
|
10017
|
-
src: item.icon,
|
|
10018
|
-
alt: ""
|
|
10019
|
-
}), /* @__PURE__ */ React.createElement("div", {
|
|
10020
|
-
className: "".concat(classPrefix2, "-list-text")
|
|
10021
|
-
}, item.text), item.num && /* @__PURE__ */ React.createElement("div", {
|
|
10022
|
-
className: "b"
|
|
10023
|
-
}, item.num));
|
|
10080
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, item.num ? /* @__PURE__ */ React.createElement(Badge, {
|
|
10081
|
+
value: item.num,
|
|
10082
|
+
top: 8,
|
|
10083
|
+
right: 6
|
|
10084
|
+
}, renderListItem(item, index2)) : /* @__PURE__ */ React.createElement(React.Fragment, null, renderListItem(item, index2)));
|
|
10024
10085
|
}))), /* @__PURE__ */ React.createElement("div", {
|
|
10025
10086
|
className: "".concat(classPrefix2, "-btn"),
|
|
10026
10087
|
onClick: function() {
|
|
@@ -10033,7 +10094,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10033
10094
|
}, visible ? activeText || locale.fixednav.activeText : inactiveText || locale.fixednav.inactiveText))));
|
|
10034
10095
|
};
|
|
10035
10096
|
FixedNav.displayName = "NutFixedNav";
|
|
10036
|
-
var defaultProps$
|
|
10097
|
+
var defaultProps$1j = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
10037
10098
|
left: "",
|
|
10038
10099
|
right: "",
|
|
10039
10100
|
back: "",
|
|
@@ -10043,7 +10104,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10043
10104
|
zIndex: 10
|
|
10044
10105
|
});
|
|
10045
10106
|
var NavBar = function(props) {
|
|
10046
|
-
var _$_object_spread = _object_spread({}, defaultProps$
|
|
10107
|
+
var _$_object_spread = _object_spread({}, defaultProps$1j, props), right = _$_object_spread.right, left = _$_object_spread.left, title = _$_object_spread.title, className = _$_object_spread.className, style = _$_object_spread.style, back = _$_object_spread.back, fixed = _$_object_spread.fixed, safeAreaInsetTop = _$_object_spread.safeAreaInsetTop, placeholder = _$_object_spread.placeholder, zIndex = _$_object_spread.zIndex, onBackClick = _$_object_spread.onBackClick;
|
|
10047
10108
|
var classPrefix2 = "nut-navbar";
|
|
10048
10109
|
var rtl = useRtl();
|
|
10049
10110
|
var children = Array.isArray(props.children) ? props.children : [
|
|
@@ -10109,13 +10170,13 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10109
10170
|
});
|
|
10110
10171
|
return ret;
|
|
10111
10172
|
}
|
|
10112
|
-
var defaultProps$
|
|
10173
|
+
var defaultProps$1i = {
|
|
10113
10174
|
title: "",
|
|
10114
10175
|
value: "",
|
|
10115
10176
|
disabled: false
|
|
10116
10177
|
};
|
|
10117
10178
|
var SideBarItem = function(props) {
|
|
10118
|
-
var _mergeProps = mergeProps(defaultProps$
|
|
10179
|
+
var _mergeProps = mergeProps(defaultProps$1i, props), children = _mergeProps.children, className = _mergeProps.className, disabled = _mergeProps.disabled;
|
|
10119
10180
|
var classPrefix2 = "nut-sidebaritem";
|
|
10120
10181
|
var classes = classNames(classPrefix2, {
|
|
10121
10182
|
active: !disabled && props.active
|
|
@@ -10156,13 +10217,13 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10156
10217
|
setState
|
|
10157
10218
|
];
|
|
10158
10219
|
}
|
|
10159
|
-
var defaultProps$
|
|
10220
|
+
var defaultProps$1h = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
10160
10221
|
contentDuration: 0,
|
|
10161
10222
|
sidebarDuration: 0
|
|
10162
10223
|
});
|
|
10163
10224
|
var classPrefix$l = "nut-sidebar";
|
|
10164
10225
|
var SideBar = function(props) {
|
|
10165
|
-
var _mergeProps = mergeProps(defaultProps$
|
|
10226
|
+
var _mergeProps = mergeProps(defaultProps$1h, props), contentDuration = _mergeProps.contentDuration, sidebarDuration = _mergeProps.sidebarDuration, children = _mergeProps.children, onClick = _mergeProps.onClick, onChange = _mergeProps.onChange, className = _mergeProps.className, rest = _object_without_properties(_mergeProps, [
|
|
10166
10227
|
"contentDuration",
|
|
10167
10228
|
"sidebarDuration",
|
|
10168
10229
|
"children",
|
|
@@ -10301,61 +10362,6 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10301
10362
|
};
|
|
10302
10363
|
SideBar.displayName = "NutSideBar";
|
|
10303
10364
|
SideBar.Item = SideBarItem;
|
|
10304
|
-
function _type_of(obj) {
|
|
10305
|
-
"@swc/helpers - typeof";
|
|
10306
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
10307
|
-
}
|
|
10308
|
-
var defaultProps$1h = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
10309
|
-
value: "",
|
|
10310
|
-
dot: false,
|
|
10311
|
-
max: 99,
|
|
10312
|
-
top: 0,
|
|
10313
|
-
right: 0,
|
|
10314
|
-
fill: "solid",
|
|
10315
|
-
size: "large"
|
|
10316
|
-
});
|
|
10317
|
-
var Badge = function(props) {
|
|
10318
|
-
var isIcon = function isIcon2() {
|
|
10319
|
-
if ((typeof value2 === "undefined" ? "undefined" : _type_of(value2)) === "object" && value2) return value2;
|
|
10320
|
-
};
|
|
10321
|
-
var isNumber = function isNumber2() {
|
|
10322
|
-
if (typeof value2 === "number" && value2) return value2;
|
|
10323
|
-
};
|
|
10324
|
-
var isString = function isString2() {
|
|
10325
|
-
if (typeof value2 === "string" && value2) return value2;
|
|
10326
|
-
};
|
|
10327
|
-
var _this;
|
|
10328
|
-
var rtl = useRtl();
|
|
10329
|
-
var _$_object_spread = _object_spread({}, defaultProps$1h, props), className = _$_object_spread.className, style = _$_object_spread.style, value2 = _$_object_spread.value, max = _$_object_spread.max, children = _$_object_spread.children, dot = _$_object_spread.dot, top = _$_object_spread.top, right = _$_object_spread.right, fill = _$_object_spread.fill, size = _$_object_spread.size;
|
|
10330
|
-
var classPrefix2 = "nut-badge";
|
|
10331
|
-
var classes = classNames(classPrefix2, className);
|
|
10332
|
-
var getContent = function() {
|
|
10333
|
-
if (dot || value2 === 0) return null;
|
|
10334
|
-
if (typeof value2 === "number") {
|
|
10335
|
-
return max < value2 ? "".concat(max, "+") : "".concat(value2);
|
|
10336
|
-
}
|
|
10337
|
-
return value2;
|
|
10338
|
-
};
|
|
10339
|
-
var _obj;
|
|
10340
|
-
var contentClasses = classNames((_obj = {}, _define_property(_obj, "".concat(classPrefix2, "-sup"), isNumber() || isString() || dot), _define_property(_obj, "".concat(classPrefix2, "-number"), isNumber()), _define_property(_obj, "".concat(classPrefix2, "-one"), typeof getContent() === "string" && ((_this = "".concat(getContent())) === null || _this === void 0 ? void 0 : _this.length) === 1), _define_property(_obj, "".concat(classPrefix2, "-dot"), dot), _define_property(_obj, "".concat(classPrefix2, "-dot-").concat(size), dot), _define_property(_obj, "".concat(classPrefix2, "-").concat(fill), fill === "outline"), _define_property(_obj, "".concat(classPrefix2, "-content"), children), _obj));
|
|
10341
|
-
var getPositionStyle = function() {
|
|
10342
|
-
return _define_property({
|
|
10343
|
-
top: "".concat(Number(top) || 0, "px")
|
|
10344
|
-
}, rtl ? "left" : "right", "".concat(Number(right) || 0, "px"));
|
|
10345
|
-
};
|
|
10346
|
-
var _obj1;
|
|
10347
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
10348
|
-
className: classes,
|
|
10349
|
-
style
|
|
10350
|
-
}, isIcon() && /* @__PURE__ */ React.createElement("div", {
|
|
10351
|
-
className: classNames("".concat(classPrefix2, "-content"), (_obj1 = {}, _define_property(_obj1, "".concat(classPrefix2, "-icon"), true), _define_property(_obj1, "".concat(classPrefix2, "-icon-rtl"), rtl), _obj1)),
|
|
10352
|
-
style: getPositionStyle()
|
|
10353
|
-
}, value2), children, !isIcon() && (getContent() || dot) && /* @__PURE__ */ React.createElement("div", {
|
|
10354
|
-
className: contentClasses,
|
|
10355
|
-
style: getPositionStyle()
|
|
10356
|
-
}, getContent()));
|
|
10357
|
-
};
|
|
10358
|
-
Badge.displayName = "NutBadge";
|
|
10359
10365
|
const TabbarContext = React.createContext(null);
|
|
10360
10366
|
var defaultProps$1g = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
10361
10367
|
title: "",
|
|
@@ -10885,17 +10891,6 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
10885
10891
|
return { value: op[0] ? op[1] : void 0, done: true };
|
|
10886
10892
|
}
|
|
10887
10893
|
}
|
|
10888
|
-
function __values(o) {
|
|
10889
|
-
var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o[s2], i2 = 0;
|
|
10890
|
-
if (m2) return m2.call(o);
|
|
10891
|
-
if (o && typeof o.length === "number") return {
|
|
10892
|
-
next: function() {
|
|
10893
|
-
if (o && i2 >= o.length) o = void 0;
|
|
10894
|
-
return { value: o && o[i2++], done: !o };
|
|
10895
|
-
}
|
|
10896
|
-
};
|
|
10897
|
-
throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
10898
|
-
}
|
|
10899
10894
|
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
10900
10895
|
var e2 = new Error(message);
|
|
10901
10896
|
return e2.name = "SuppressedError", e2.error = error, e2.suppressed = suppressed, e2;
|
|
@@ -15312,7 +15307,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
15312
15307
|
pattern: {
|
|
15313
15308
|
mismatch: "%s value %s does not match pattern %s"
|
|
15314
15309
|
},
|
|
15315
|
-
clone: function
|
|
15310
|
+
clone: function clone2() {
|
|
15316
15311
|
var cloned = JSON.parse(JSON.stringify(this));
|
|
15317
15312
|
cloned.clone = this.clone;
|
|
15318
15313
|
return cloned;
|
|
@@ -15576,299 +15571,391 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
15576
15571
|
Schema.warning = warning;
|
|
15577
15572
|
Schema.messages = messages;
|
|
15578
15573
|
Schema.validators = validators;
|
|
15574
|
+
function merge() {
|
|
15575
|
+
for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15576
|
+
items[_key] = arguments[_key];
|
|
15577
|
+
}
|
|
15578
|
+
return _merge(items[0] === true, false, items);
|
|
15579
|
+
}
|
|
15580
|
+
function recursive() {
|
|
15581
|
+
for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15582
|
+
items[_key] = arguments[_key];
|
|
15583
|
+
}
|
|
15584
|
+
return _merge(items[0] === true, true, items);
|
|
15585
|
+
}
|
|
15586
|
+
function clone(input) {
|
|
15587
|
+
if (Array.isArray(input)) {
|
|
15588
|
+
var output = [];
|
|
15589
|
+
for (var index2 = 0; index2 < input.length; ++index2) output.push(clone(input[index2]));
|
|
15590
|
+
return output;
|
|
15591
|
+
}
|
|
15592
|
+
if (isPlainObject(input)) {
|
|
15593
|
+
var output1 = {};
|
|
15594
|
+
for (var index1 in input) output1[index1] = clone(input[index1]);
|
|
15595
|
+
return output1;
|
|
15596
|
+
}
|
|
15597
|
+
return input;
|
|
15598
|
+
}
|
|
15599
|
+
function isPlainObject(input) {
|
|
15600
|
+
if (input === null || (typeof input === "undefined" ? "undefined" : _type_of(input)) !== "object") return false;
|
|
15601
|
+
if (Object.getPrototypeOf(input) === null) return true;
|
|
15602
|
+
var ref = input;
|
|
15603
|
+
while (Object.getPrototypeOf(ref) !== null) ref = Object.getPrototypeOf(ref);
|
|
15604
|
+
return Object.getPrototypeOf(input) === ref;
|
|
15605
|
+
}
|
|
15606
|
+
function _recursiveMerge(base, extend) {
|
|
15607
|
+
if (!isPlainObject(base) || !isPlainObject(extend)) return extend;
|
|
15608
|
+
for (var key2 in extend) {
|
|
15609
|
+
if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
|
|
15610
|
+
base[key2] = isPlainObject(base[key2]) && isPlainObject(extend[key2]) ? _recursiveMerge(base[key2], extend[key2]) : extend[key2];
|
|
15611
|
+
}
|
|
15612
|
+
return base;
|
|
15613
|
+
}
|
|
15614
|
+
function _merge(isClone, isRecursive, items) {
|
|
15615
|
+
var result;
|
|
15616
|
+
if (isClone || !isPlainObject(result = items.shift())) result = {};
|
|
15617
|
+
for (var index2 = 0; index2 < items.length; ++index2) {
|
|
15618
|
+
var item = items[index2];
|
|
15619
|
+
if (!isPlainObject(item)) continue;
|
|
15620
|
+
for (var key2 in item) {
|
|
15621
|
+
if (key2 === "__proto__" || key2 === "constructor" || key2 === "prototype") continue;
|
|
15622
|
+
var value2 = isClone ? clone(item[key2]) : item[key2];
|
|
15623
|
+
result[key2] = isRecursive ? _recursiveMerge(result[key2], value2) : value2;
|
|
15624
|
+
}
|
|
15625
|
+
}
|
|
15626
|
+
return result;
|
|
15627
|
+
}
|
|
15579
15628
|
var SECRET = "NUT_FORM_INTERNAL";
|
|
15580
|
-
var FormStore = function
|
|
15581
|
-
|
|
15582
|
-
|
|
15583
|
-
|
|
15584
|
-
|
|
15585
|
-
|
|
15586
|
-
|
|
15587
|
-
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
|
|
15594
|
-
|
|
15595
|
-
|
|
15629
|
+
var FormStore = /* @__PURE__ */ function() {
|
|
15630
|
+
function FormStore2() {
|
|
15631
|
+
var _this = this;
|
|
15632
|
+
var _this1 = this;
|
|
15633
|
+
_class_call_check(this, FormStore2);
|
|
15634
|
+
var _this2 = this;
|
|
15635
|
+
_define_property(this, "initialValues", {});
|
|
15636
|
+
_define_property(this, "updateList", []);
|
|
15637
|
+
_define_property(this, "store", {});
|
|
15638
|
+
_define_property(this, "fieldEntities", []);
|
|
15639
|
+
_define_property(this, "callbacks", {});
|
|
15640
|
+
_define_property(this, "errors", {});
|
|
15641
|
+
_define_property(this, "registerField", function(field) {
|
|
15642
|
+
_this.fieldEntities.push(field);
|
|
15643
|
+
return function() {
|
|
15644
|
+
_this.fieldEntities = _this.fieldEntities.filter(function(item) {
|
|
15645
|
+
return item !== field;
|
|
15646
|
+
});
|
|
15647
|
+
};
|
|
15648
|
+
});
|
|
15649
|
+
_define_property(this, "getFieldValue", function(name2) {
|
|
15650
|
+
var _this_store;
|
|
15651
|
+
return (_this_store = _this.store) === null || _this_store === void 0 ? void 0 : _this_store[name2];
|
|
15652
|
+
});
|
|
15653
|
+
_define_property(this, "getFieldsValue", function(nameList) {
|
|
15654
|
+
if (typeof nameList === "boolean") {
|
|
15655
|
+
return JSON.parse(JSON.stringify(_this.store));
|
|
15656
|
+
}
|
|
15657
|
+
var fieldsValue = {};
|
|
15658
|
+
nameList.forEach(function(field) {
|
|
15659
|
+
fieldsValue[field] = _this.getFieldValue(field);
|
|
15596
15660
|
});
|
|
15597
|
-
|
|
15598
|
-
|
|
15661
|
+
return fieldsValue;
|
|
15662
|
+
});
|
|
15663
|
+
_define_property(this, "setInitialValues", function(initialValues, init) {
|
|
15664
|
+
_this.initialValues = initialValues || {};
|
|
15665
|
+
if (init) {
|
|
15666
|
+
var nextStore = merge(initialValues, _this.store);
|
|
15667
|
+
_this.updateStore(nextStore);
|
|
15668
|
+
_this.notifyWatch();
|
|
15599
15669
|
}
|
|
15600
|
-
};
|
|
15601
|
-
});
|
|
15602
|
-
_define_property(this, "getFieldValue", function(name2) {
|
|
15603
|
-
var _this_store;
|
|
15604
|
-
return (_this_store = _this.store) === null || _this_store === void 0 ? void 0 : _this_store[name2];
|
|
15605
|
-
});
|
|
15606
|
-
_define_property(this, "getFieldsValue", function(nameList) {
|
|
15607
|
-
if (typeof nameList === "boolean") {
|
|
15608
|
-
return JSON.parse(JSON.stringify(_this.store));
|
|
15609
|
-
}
|
|
15610
|
-
var fieldsValue = {};
|
|
15611
|
-
nameList.forEach(function(field) {
|
|
15612
|
-
fieldsValue[field] = _this.getFieldValue(field);
|
|
15613
15670
|
});
|
|
15614
|
-
|
|
15615
|
-
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15671
|
+
_define_property(this, "setFieldsValue", function(newStore) {
|
|
15672
|
+
var nextStore = recursive(true, _this.store, newStore);
|
|
15673
|
+
_this.updateStore(nextStore);
|
|
15674
|
+
_this.fieldEntities.forEach(function(entity) {
|
|
15675
|
+
var name2 = entity.props.name;
|
|
15676
|
+
Object.keys(newStore).forEach(function(key2) {
|
|
15677
|
+
if (key2 === name2) {
|
|
15678
|
+
entity.onStoreChange("update");
|
|
15679
|
+
}
|
|
15680
|
+
});
|
|
15681
|
+
});
|
|
15682
|
+
_this.updateList.forEach(function(item) {
|
|
15683
|
+
var shouldUpdate = item.condition;
|
|
15684
|
+
if (typeof item.condition === "function") {
|
|
15685
|
+
shouldUpdate = item.condition();
|
|
15686
|
+
}
|
|
15687
|
+
if (shouldUpdate) {
|
|
15688
|
+
item.entity.onStoreChange("update");
|
|
15630
15689
|
}
|
|
15631
15690
|
});
|
|
15691
|
+
_this.notifyWatch();
|
|
15632
15692
|
});
|
|
15633
|
-
|
|
15634
|
-
var
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
|
|
15639
|
-
item.entity.onStoreChange("update");
|
|
15640
|
-
}
|
|
15693
|
+
_define_property(this, "setFieldValue", function(name2, value2) {
|
|
15694
|
+
var store = _define_property({}, name2, value2);
|
|
15695
|
+
_this.setFieldsValue(store);
|
|
15696
|
+
_this.notifyWatch([
|
|
15697
|
+
name2
|
|
15698
|
+
]);
|
|
15641
15699
|
});
|
|
15642
|
-
|
|
15643
|
-
|
|
15644
|
-
|
|
15645
|
-
|
|
15646
|
-
|
|
15647
|
-
|
|
15648
|
-
|
|
15649
|
-
|
|
15700
|
+
_define_property(this, "setCallback", function(callback) {
|
|
15701
|
+
_this.callbacks = _object_spread({}, _this.callbacks, callback);
|
|
15702
|
+
});
|
|
15703
|
+
_define_property(this, "validateEntities", /* @__PURE__ */ function() {
|
|
15704
|
+
var _ref = _async_to_generator(function(entity, errs) {
|
|
15705
|
+
var _entity_props, name2, _entity_props_rules, rules2, descriptor, validator, _this_store, param, errors, _errs;
|
|
15706
|
+
return __generator(this, function(_state) {
|
|
15707
|
+
switch (_state.label) {
|
|
15708
|
+
case 0:
|
|
15709
|
+
_entity_props = entity.props, name2 = _entity_props.name, _entity_props_rules = _entity_props.rules, rules2 = _entity_props_rules === void 0 ? [] : _entity_props_rules;
|
|
15710
|
+
if (!name2) {
|
|
15711
|
+
console.warn("Form field missing name property");
|
|
15712
|
+
return [
|
|
15713
|
+
2
|
|
15714
|
+
];
|
|
15715
|
+
}
|
|
15716
|
+
descriptor = {};
|
|
15717
|
+
if (rules2.length) {
|
|
15718
|
+
if (rules2.length > 1) {
|
|
15719
|
+
descriptor[name2] = [];
|
|
15720
|
+
rules2.forEach(function(v) {
|
|
15721
|
+
descriptor[name2].push(v);
|
|
15722
|
+
});
|
|
15723
|
+
} else {
|
|
15724
|
+
descriptor[name2] = rules2[0];
|
|
15725
|
+
}
|
|
15726
|
+
}
|
|
15727
|
+
validator = new Schema(descriptor);
|
|
15728
|
+
_state.label = 1;
|
|
15729
|
+
case 1:
|
|
15730
|
+
_state.trys.push([
|
|
15731
|
+
1,
|
|
15732
|
+
3,
|
|
15733
|
+
4,
|
|
15734
|
+
5
|
|
15735
|
+
]);
|
|
15736
|
+
return [
|
|
15737
|
+
4,
|
|
15738
|
+
validator.validate(_define_property({}, name2, (_this_store = _this2.store) === null || _this_store === void 0 ? void 0 : _this_store[name2]))
|
|
15739
|
+
];
|
|
15740
|
+
case 2:
|
|
15741
|
+
_state.sent();
|
|
15742
|
+
return [
|
|
15743
|
+
3,
|
|
15744
|
+
5
|
|
15745
|
+
];
|
|
15746
|
+
case 3:
|
|
15747
|
+
param = _state.sent();
|
|
15748
|
+
errors = param.errors;
|
|
15749
|
+
if (errors) {
|
|
15750
|
+
(_errs = errs).push.apply(_errs, _to_consumable_array(errors));
|
|
15751
|
+
_this2.errors[name2] = errors;
|
|
15752
|
+
}
|
|
15753
|
+
return [
|
|
15754
|
+
3,
|
|
15755
|
+
5
|
|
15756
|
+
];
|
|
15757
|
+
case 4:
|
|
15758
|
+
if (!errs || errs.length === 0) {
|
|
15759
|
+
_this2.errors[name2] = [];
|
|
15760
|
+
}
|
|
15761
|
+
return [
|
|
15762
|
+
7
|
|
15763
|
+
];
|
|
15764
|
+
case 5:
|
|
15765
|
+
entity.onStoreChange("validate");
|
|
15766
|
+
return [
|
|
15767
|
+
2
|
|
15768
|
+
];
|
|
15769
|
+
}
|
|
15770
|
+
});
|
|
15771
|
+
});
|
|
15772
|
+
return function(entity, errs) {
|
|
15773
|
+
return _ref.apply(this, arguments);
|
|
15774
|
+
};
|
|
15775
|
+
}());
|
|
15776
|
+
_define_property(this, "validateFields", /* @__PURE__ */ function() {
|
|
15777
|
+
var _ref = _async_to_generator(function(nameList) {
|
|
15778
|
+
var filterEntities, errs;
|
|
15779
|
+
return __generator(this, function(_state) {
|
|
15780
|
+
switch (_state.label) {
|
|
15781
|
+
case 0:
|
|
15782
|
+
filterEntities = [];
|
|
15783
|
+
if (!nameList || nameList.length === 0) {
|
|
15784
|
+
filterEntities = _this2.fieldEntities;
|
|
15785
|
+
} else {
|
|
15786
|
+
filterEntities = _this2.fieldEntities.filter(function(param) {
|
|
15787
|
+
var name2 = param.props.name;
|
|
15788
|
+
return nameList.includes(name2);
|
|
15789
|
+
});
|
|
15790
|
+
}
|
|
15791
|
+
errs = [];
|
|
15792
|
+
return [
|
|
15793
|
+
4,
|
|
15794
|
+
Promise.all(filterEntities.map(/* @__PURE__ */ function() {
|
|
15795
|
+
var _ref2 = _async_to_generator(function(entity) {
|
|
15796
|
+
return __generator(this, function(_state2) {
|
|
15797
|
+
switch (_state2.label) {
|
|
15798
|
+
case 0:
|
|
15799
|
+
return [
|
|
15800
|
+
4,
|
|
15801
|
+
_this2.validateEntities(entity, errs)
|
|
15802
|
+
];
|
|
15803
|
+
case 1:
|
|
15804
|
+
_state2.sent();
|
|
15805
|
+
return [
|
|
15806
|
+
2
|
|
15807
|
+
];
|
|
15808
|
+
}
|
|
15809
|
+
});
|
|
15810
|
+
});
|
|
15811
|
+
return function(entity) {
|
|
15812
|
+
return _ref2.apply(this, arguments);
|
|
15813
|
+
};
|
|
15814
|
+
}()))
|
|
15815
|
+
];
|
|
15816
|
+
case 1:
|
|
15817
|
+
_state.sent();
|
|
15818
|
+
return [
|
|
15819
|
+
2,
|
|
15820
|
+
errs
|
|
15821
|
+
];
|
|
15822
|
+
}
|
|
15823
|
+
});
|
|
15824
|
+
});
|
|
15825
|
+
return function(nameList) {
|
|
15826
|
+
return _ref.apply(this, arguments);
|
|
15827
|
+
};
|
|
15828
|
+
}());
|
|
15829
|
+
_define_property(this, "submit", /* @__PURE__ */ _async_to_generator(function() {
|
|
15830
|
+
var errors, _this_callbacks_onFinish, _this_callbacks, _this_callbacks_onFinishFailed, _this_callbacks1;
|
|
15650
15831
|
return __generator(this, function(_state) {
|
|
15651
15832
|
switch (_state.label) {
|
|
15652
15833
|
case 0:
|
|
15653
|
-
filterEntitys = [];
|
|
15654
|
-
errs = [];
|
|
15655
|
-
_this2.errors.length = 0;
|
|
15656
|
-
if (!nameList || nameList.length === 0) {
|
|
15657
|
-
filterEntitys = _this2.fieldEntities;
|
|
15658
|
-
} else {
|
|
15659
|
-
filterEntitys = _this2.fieldEntities.filter(function(param) {
|
|
15660
|
-
var name2 = param.props.name;
|
|
15661
|
-
return nameList.includes(name2);
|
|
15662
|
-
});
|
|
15663
|
-
}
|
|
15664
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
15665
|
-
_state.label = 1;
|
|
15666
|
-
case 1:
|
|
15667
|
-
_state.trys.push([
|
|
15668
|
-
1,
|
|
15669
|
-
6,
|
|
15670
|
-
7,
|
|
15671
|
-
8
|
|
15672
|
-
]);
|
|
15673
|
-
_loop = function() {
|
|
15674
|
-
var entity, _entity_props, name2, _entity_props_rules, rules2, descriptor, validator, _this_store, param, errors, _errs;
|
|
15675
|
-
return __generator(this, function(_state2) {
|
|
15676
|
-
switch (_state2.label) {
|
|
15677
|
-
case 0:
|
|
15678
|
-
entity = _step.value;
|
|
15679
|
-
_entity_props = entity.props, name2 = _entity_props.name, _entity_props_rules = _entity_props.rules, rules2 = _entity_props_rules === void 0 ? [] : _entity_props_rules;
|
|
15680
|
-
descriptor = {};
|
|
15681
|
-
if (rules2.length) {
|
|
15682
|
-
if (rules2.length > 1) {
|
|
15683
|
-
descriptor[name2] = [];
|
|
15684
|
-
rules2.forEach(function(v) {
|
|
15685
|
-
descriptor[name2].push(v);
|
|
15686
|
-
});
|
|
15687
|
-
} else {
|
|
15688
|
-
descriptor[name2] = rules2[0];
|
|
15689
|
-
}
|
|
15690
|
-
}
|
|
15691
|
-
validator = new Schema(descriptor);
|
|
15692
|
-
_state2.label = 1;
|
|
15693
|
-
case 1:
|
|
15694
|
-
_state2.trys.push([
|
|
15695
|
-
1,
|
|
15696
|
-
3,
|
|
15697
|
-
4,
|
|
15698
|
-
5
|
|
15699
|
-
]);
|
|
15700
|
-
return [
|
|
15701
|
-
4,
|
|
15702
|
-
validator.validate(_define_property({}, name2, (_this_store = _this2.store) === null || _this_store === void 0 ? void 0 : _this_store[name2]))
|
|
15703
|
-
];
|
|
15704
|
-
case 2:
|
|
15705
|
-
_state2.sent();
|
|
15706
|
-
return [
|
|
15707
|
-
3,
|
|
15708
|
-
5
|
|
15709
|
-
];
|
|
15710
|
-
case 3:
|
|
15711
|
-
param = _state2.sent();
|
|
15712
|
-
errors = param.errors;
|
|
15713
|
-
if (errors) {
|
|
15714
|
-
(_errs = errs).push.apply(_errs, _to_consumable_array(errors));
|
|
15715
|
-
_this2.errors[name2] = errors;
|
|
15716
|
-
}
|
|
15717
|
-
return [
|
|
15718
|
-
3,
|
|
15719
|
-
5
|
|
15720
|
-
];
|
|
15721
|
-
case 4:
|
|
15722
|
-
if (!errs || errs.length === 0) {
|
|
15723
|
-
_this2.errors[name2] = [];
|
|
15724
|
-
}
|
|
15725
|
-
return [
|
|
15726
|
-
7
|
|
15727
|
-
];
|
|
15728
|
-
case 5:
|
|
15729
|
-
entity.onStoreChange("validate");
|
|
15730
|
-
return [
|
|
15731
|
-
2
|
|
15732
|
-
];
|
|
15733
|
-
}
|
|
15734
|
-
});
|
|
15735
|
-
};
|
|
15736
|
-
_iterator = filterEntitys[Symbol.iterator]();
|
|
15737
|
-
_state.label = 2;
|
|
15738
|
-
case 2:
|
|
15739
|
-
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
15740
|
-
3,
|
|
15741
|
-
5
|
|
15742
|
-
];
|
|
15743
15834
|
return [
|
|
15744
|
-
|
|
15745
|
-
|
|
15746
|
-
];
|
|
15747
|
-
case 3:
|
|
15748
|
-
_state.sent();
|
|
15749
|
-
_state.label = 4;
|
|
15750
|
-
case 4:
|
|
15751
|
-
_iteratorNormalCompletion = true;
|
|
15752
|
-
return [
|
|
15753
|
-
3,
|
|
15754
|
-
2
|
|
15755
|
-
];
|
|
15756
|
-
case 5:
|
|
15757
|
-
return [
|
|
15758
|
-
3,
|
|
15759
|
-
8
|
|
15760
|
-
];
|
|
15761
|
-
case 6:
|
|
15762
|
-
err = _state.sent();
|
|
15763
|
-
_didIteratorError = true;
|
|
15764
|
-
_iteratorError = err;
|
|
15765
|
-
return [
|
|
15766
|
-
3,
|
|
15767
|
-
8
|
|
15835
|
+
4,
|
|
15836
|
+
_this2.validateFields()
|
|
15768
15837
|
];
|
|
15769
|
-
case
|
|
15770
|
-
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
if (_didIteratorError) {
|
|
15776
|
-
throw _iteratorError;
|
|
15777
|
-
}
|
|
15838
|
+
case 1:
|
|
15839
|
+
errors = _state.sent();
|
|
15840
|
+
if (errors.length === 0) {
|
|
15841
|
+
(_this_callbacks_onFinish = (_this_callbacks = _this2.callbacks).onFinish) === null || _this_callbacks_onFinish === void 0 ? void 0 : _this_callbacks_onFinish.call(_this_callbacks, _this2.store);
|
|
15842
|
+
} else if (errors.length > 0) {
|
|
15843
|
+
(_this_callbacks_onFinishFailed = (_this_callbacks1 = _this2.callbacks).onFinishFailed) === null || _this_callbacks_onFinishFailed === void 0 ? void 0 : _this_callbacks_onFinishFailed.call(_this_callbacks1, _this2.store, errors);
|
|
15778
15844
|
}
|
|
15779
15845
|
return [
|
|
15780
|
-
|
|
15781
|
-
];
|
|
15782
|
-
case 8:
|
|
15783
|
-
return [
|
|
15784
|
-
2,
|
|
15785
|
-
errs
|
|
15846
|
+
2
|
|
15786
15847
|
];
|
|
15787
15848
|
}
|
|
15788
15849
|
});
|
|
15789
|
-
});
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
|
|
15812
|
-
];
|
|
15850
|
+
}));
|
|
15851
|
+
_define_property(this, "resetFields", function(namePaths) {
|
|
15852
|
+
if (namePaths && namePaths.length) {
|
|
15853
|
+
namePaths.forEach(function(path) {
|
|
15854
|
+
_this.errors[path] = null;
|
|
15855
|
+
_this.fieldEntities.forEach(function(entity) {
|
|
15856
|
+
var name2 = entity.props.name;
|
|
15857
|
+
if (name2 === path) {
|
|
15858
|
+
if (path in _this.initialValues) {
|
|
15859
|
+
_this.updateStore(_define_property({}, path, _this.initialValues[path]));
|
|
15860
|
+
} else {
|
|
15861
|
+
delete _this.store[path];
|
|
15862
|
+
}
|
|
15863
|
+
entity.onStoreChange("reset");
|
|
15864
|
+
}
|
|
15865
|
+
});
|
|
15866
|
+
});
|
|
15867
|
+
} else {
|
|
15868
|
+
var nextStore = merge({}, _this.initialValues);
|
|
15869
|
+
_this.updateStore(nextStore);
|
|
15870
|
+
_this.fieldEntities.forEach(function(entity) {
|
|
15871
|
+
entity.onStoreChange("reset");
|
|
15872
|
+
});
|
|
15813
15873
|
}
|
|
15814
15874
|
});
|
|
15815
|
-
|
|
15816
|
-
|
|
15817
|
-
|
|
15818
|
-
|
|
15819
|
-
|
|
15820
|
-
|
|
15875
|
+
_define_property(this, "registerUpdate", function(field, shouldUpdate) {
|
|
15876
|
+
_this.updateList.push({
|
|
15877
|
+
entity: field,
|
|
15878
|
+
condition: shouldUpdate
|
|
15879
|
+
});
|
|
15880
|
+
return function() {
|
|
15881
|
+
_this.updateList = _this.updateList.filter(function(i2) {
|
|
15882
|
+
return i2.entity !== field;
|
|
15883
|
+
});
|
|
15884
|
+
};
|
|
15821
15885
|
});
|
|
15822
|
-
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15886
|
+
_define_property(this, "dispatch", function(param) {
|
|
15887
|
+
var name2 = param.name;
|
|
15888
|
+
_this.validateFields([
|
|
15889
|
+
name2
|
|
15890
|
+
]);
|
|
15827
15891
|
});
|
|
15828
|
-
|
|
15829
|
-
|
|
15830
|
-
return
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15834
|
-
|
|
15835
|
-
|
|
15836
|
-
|
|
15837
|
-
|
|
15838
|
-
|
|
15839
|
-
|
|
15840
|
-
|
|
15841
|
-
|
|
15892
|
+
_define_property(this, "getInternal", function(key2) {
|
|
15893
|
+
if (key2 === SECRET) {
|
|
15894
|
+
return {
|
|
15895
|
+
registerField: _this.registerField,
|
|
15896
|
+
setCallback: _this.setCallback,
|
|
15897
|
+
setInitialValues: _this.setInitialValues,
|
|
15898
|
+
dispatch: _this.dispatch,
|
|
15899
|
+
store: _this.store,
|
|
15900
|
+
fieldEntities: _this.fieldEntities,
|
|
15901
|
+
registerUpdate: _this.registerUpdate,
|
|
15902
|
+
registerWatch: _this.registerWatch
|
|
15903
|
+
};
|
|
15904
|
+
}
|
|
15905
|
+
});
|
|
15906
|
+
_define_property(this, "getForm", function() {
|
|
15842
15907
|
return {
|
|
15843
|
-
|
|
15844
|
-
|
|
15845
|
-
|
|
15846
|
-
|
|
15847
|
-
|
|
15848
|
-
|
|
15849
|
-
|
|
15908
|
+
getFieldValue: _this.getFieldValue,
|
|
15909
|
+
getFieldsValue: _this.getFieldsValue,
|
|
15910
|
+
setFieldsValue: _this.setFieldsValue,
|
|
15911
|
+
setFieldValue: _this.setFieldValue,
|
|
15912
|
+
resetFields: _this.resetFields,
|
|
15913
|
+
validateFields: _this.validateFields,
|
|
15914
|
+
submit: _this.submit,
|
|
15915
|
+
errors: _this.errors,
|
|
15916
|
+
getInternal: _this.getInternal
|
|
15850
15917
|
};
|
|
15851
|
-
}
|
|
15852
|
-
|
|
15853
|
-
|
|
15854
|
-
|
|
15855
|
-
|
|
15856
|
-
|
|
15857
|
-
|
|
15858
|
-
|
|
15859
|
-
|
|
15860
|
-
|
|
15861
|
-
|
|
15862
|
-
|
|
15918
|
+
});
|
|
15919
|
+
_define_property(this, "watchList", []);
|
|
15920
|
+
_define_property(this, "registerWatch", function(callback) {
|
|
15921
|
+
_this.watchList.push(callback);
|
|
15922
|
+
return function() {
|
|
15923
|
+
_this.watchList = _this.watchList.filter(function(fn) {
|
|
15924
|
+
return fn !== callback;
|
|
15925
|
+
});
|
|
15926
|
+
};
|
|
15927
|
+
});
|
|
15928
|
+
_define_property(this, "notifyWatch", function() {
|
|
15929
|
+
var namePath = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
15930
|
+
if (_this1.watchList.length) {
|
|
15931
|
+
var allValues;
|
|
15932
|
+
if (!namePath || namePath.length === 0) {
|
|
15933
|
+
allValues = _this1.getFieldsValue(true);
|
|
15934
|
+
} else {
|
|
15935
|
+
allValues = _this1.getFieldsValue(namePath);
|
|
15936
|
+
}
|
|
15937
|
+
_this1.watchList.forEach(function(callback) {
|
|
15938
|
+
callback(allValues, namePath);
|
|
15939
|
+
});
|
|
15940
|
+
}
|
|
15941
|
+
});
|
|
15942
|
+
this.callbacks = {
|
|
15943
|
+
onFinish: function() {
|
|
15944
|
+
},
|
|
15945
|
+
onFinishFailed: function() {
|
|
15946
|
+
}
|
|
15863
15947
|
};
|
|
15864
|
-
}
|
|
15865
|
-
|
|
15866
|
-
|
|
15867
|
-
|
|
15868
|
-
|
|
15948
|
+
}
|
|
15949
|
+
_create_class(FormStore2, [
|
|
15950
|
+
{
|
|
15951
|
+
key: "updateStore",
|
|
15952
|
+
value: function updateStore(nextStore) {
|
|
15953
|
+
this.store = nextStore;
|
|
15954
|
+
}
|
|
15869
15955
|
}
|
|
15870
|
-
|
|
15871
|
-
|
|
15956
|
+
]);
|
|
15957
|
+
return FormStore2;
|
|
15958
|
+
}();
|
|
15872
15959
|
var useForm = function(form) {
|
|
15873
15960
|
var formRef = React.useRef();
|
|
15874
15961
|
if (!formRef.current) {
|
|
@@ -15883,10 +15970,32 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
15883
15970
|
formRef.current
|
|
15884
15971
|
];
|
|
15885
15972
|
};
|
|
15973
|
+
var useWatch = function(path, form) {
|
|
15974
|
+
var formInstance = form.getInternal(SECRET);
|
|
15975
|
+
var _useState = _sliced_to_array(React.useState(), 2), value2 = _useState[0], setValue = _useState[1];
|
|
15976
|
+
React.useEffect(function() {
|
|
15977
|
+
var unsubscribe = formInstance.registerWatch(function(data2, namePath) {
|
|
15978
|
+
var value3 = data2[path];
|
|
15979
|
+
setValue(value3);
|
|
15980
|
+
});
|
|
15981
|
+
var initialValue = form.getFieldsValue(true);
|
|
15982
|
+
if (value2 !== initialValue[path]) {
|
|
15983
|
+
setValue(initialValue[path]);
|
|
15984
|
+
}
|
|
15985
|
+
return function() {
|
|
15986
|
+
return unsubscribe();
|
|
15987
|
+
};
|
|
15988
|
+
}, [
|
|
15989
|
+
form
|
|
15990
|
+
]);
|
|
15991
|
+
return value2;
|
|
15992
|
+
};
|
|
15886
15993
|
var defaultProps$_ = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
15887
15994
|
labelPosition: "right",
|
|
15888
15995
|
starPosition: "left",
|
|
15996
|
+
disabled: false,
|
|
15889
15997
|
divider: false,
|
|
15998
|
+
validateTrigger: "onChange",
|
|
15890
15999
|
onFinish: function(values) {
|
|
15891
16000
|
},
|
|
15892
16001
|
onFinishFailed: function(values, errorFields) {
|
|
@@ -15899,7 +16008,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
15899
16008
|
};
|
|
15900
16009
|
var Form = /* @__PURE__ */ React.forwardRef(function(props, ref) {
|
|
15901
16010
|
var classPrefix2 = "nut-form";
|
|
15902
|
-
var _$_object_spread = _object_spread({}, defaultProps$_, props), className = _$_object_spread.className, style = _$_object_spread.style, footer = _$_object_spread.footer, children = _$_object_spread.children, initialValues = _$_object_spread.initialValues, divider = _$_object_spread.divider, onFinish = _$_object_spread.onFinish, onFinishFailed = _$_object_spread.onFinishFailed, labelPosition = _$_object_spread.labelPosition, starPosition = _$_object_spread.starPosition, form = _$_object_spread.form;
|
|
16011
|
+
var _$_object_spread = _object_spread({}, defaultProps$_, props), className = _$_object_spread.className, style = _$_object_spread.style, footer = _$_object_spread.footer, children = _$_object_spread.children, initialValues = _$_object_spread.initialValues, divider = _$_object_spread.divider, disabled = _$_object_spread.disabled, onFinish = _$_object_spread.onFinish, onFinishFailed = _$_object_spread.onFinishFailed, validateTrigger = _$_object_spread.validateTrigger, labelPosition = _$_object_spread.labelPosition, starPosition = _$_object_spread.starPosition, form = _$_object_spread.form;
|
|
15903
16012
|
var formInstance;
|
|
15904
16013
|
if (form !== void 0) {
|
|
15905
16014
|
formInstance = form;
|
|
@@ -15938,7 +16047,12 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
15938
16047
|
}, /* @__PURE__ */ React.createElement(Cell.Group, {
|
|
15939
16048
|
divider
|
|
15940
16049
|
}, /* @__PURE__ */ React.createElement(Context.Provider, {
|
|
15941
|
-
value:
|
|
16050
|
+
value: {
|
|
16051
|
+
formInstance,
|
|
16052
|
+
labelPosition,
|
|
16053
|
+
disabled,
|
|
16054
|
+
validateTrigger
|
|
16055
|
+
}
|
|
15942
16056
|
}, children), footer ? /* @__PURE__ */ React.createElement(Cell, {
|
|
15943
16057
|
className: "".concat(classPrefix2, "-footer")
|
|
15944
16058
|
}, footer) : null));
|
|
@@ -15998,6 +16112,14 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
15998
16112
|
}
|
|
15999
16113
|
).$$typeof === component.type.$$typeof;
|
|
16000
16114
|
}
|
|
16115
|
+
function toArray(value2) {
|
|
16116
|
+
if (value2 === void 0 || value2 === null) {
|
|
16117
|
+
return [];
|
|
16118
|
+
}
|
|
16119
|
+
return Array.isArray(value2) ? value2 : [
|
|
16120
|
+
value2
|
|
16121
|
+
];
|
|
16122
|
+
}
|
|
16001
16123
|
var defaultProps$Z = _object_spread_props(_object_spread({}, ComponentDefaults), {
|
|
16002
16124
|
required: false,
|
|
16003
16125
|
name: "",
|
|
@@ -16009,7 +16131,6 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16009
16131
|
}
|
|
16010
16132
|
],
|
|
16011
16133
|
errorMessageAlign: "left",
|
|
16012
|
-
validateTrigger: "onChange",
|
|
16013
16134
|
shouldUpdate: false,
|
|
16014
16135
|
noStyle: false
|
|
16015
16136
|
});
|
|
@@ -16023,15 +16144,19 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16023
16144
|
]), _define_property(_this, "cancelRegister", void 0), _define_property(_this, "componentRef", void 0), _define_property(_this, "eventOff", void 0), // children添加value属性和onChange事件
|
|
16024
16145
|
_define_property(_this, "getControlled", function(children) {
|
|
16025
16146
|
var _children_props;
|
|
16026
|
-
var
|
|
16027
|
-
var dispatch = _this.context.getInternal(SECRET).dispatch;
|
|
16147
|
+
var _this_context_formInstance = _this.context.formInstance, setFieldsValue = _this_context_formInstance.setFieldsValue, getFieldValue = _this_context_formInstance.getFieldValue;
|
|
16148
|
+
var dispatch = _this.context.formInstance.getInternal(SECRET).dispatch;
|
|
16028
16149
|
var _this_props = _this.props, _this_props_name = _this_props.name, name2 = _this_props_name === void 0 ? "" : _this_props_name;
|
|
16029
16150
|
if (children === null || children === void 0 ? void 0 : (_children_props = children.props) === null || _children_props === void 0 ? void 0 : _children_props.defaultValue) {
|
|
16030
|
-
|
|
16151
|
+
if (process.env.NODE_ENV !== "production") {
|
|
16152
|
+
console.warn("[NutUI] FormItem:", "请通过 initialValue 设置初始值,而不是 defaultValue");
|
|
16153
|
+
}
|
|
16031
16154
|
}
|
|
16032
16155
|
var fieldValue = getFieldValue(name2);
|
|
16033
16156
|
var _obj;
|
|
16034
|
-
var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {
|
|
16157
|
+
var controlled = _object_spread_props(_object_spread({}, children.props), (_obj = {
|
|
16158
|
+
className: children.props.className
|
|
16159
|
+
}, _define_property(_obj, _this.props.valuePropName || "value", fieldValue !== void 0 ? fieldValue : _this.props.initialValue), _define_property(_obj, _this.props.trigger || "onChange", function() {
|
|
16035
16160
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16036
16161
|
args[_key] = arguments[_key];
|
|
16037
16162
|
}
|
|
@@ -16044,33 +16169,27 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16044
16169
|
var _this_props2;
|
|
16045
16170
|
next = (_this_props2 = _this.props).getValueFromEvent.apply(_this_props2, _to_consumable_array(args));
|
|
16046
16171
|
}
|
|
16047
|
-
setFieldsValue(_define_property({}, name2, next)
|
|
16172
|
+
setFieldsValue(_define_property({}, name2, next));
|
|
16048
16173
|
}), _obj));
|
|
16049
16174
|
var validateTrigger = _this.props.validateTrigger;
|
|
16050
|
-
var
|
|
16051
|
-
|
|
16052
|
-
|
|
16053
|
-
|
|
16054
|
-
|
|
16055
|
-
|
|
16056
|
-
|
|
16057
|
-
|
|
16058
|
-
|
|
16059
|
-
|
|
16060
|
-
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
|
|
16068
|
-
name: _this.props.name
|
|
16069
|
-
});
|
|
16070
|
-
}
|
|
16071
|
-
};
|
|
16072
|
-
});
|
|
16073
|
-
}
|
|
16175
|
+
var mergedValidateTrigger = validateTrigger || _this.context.validateTrigger;
|
|
16176
|
+
var validateTriggers = toArray(mergedValidateTrigger);
|
|
16177
|
+
validateTriggers.forEach(function(trigger) {
|
|
16178
|
+
var originTrigger = controlled[trigger];
|
|
16179
|
+
controlled[trigger] = function() {
|
|
16180
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16181
|
+
args[_key] = arguments[_key];
|
|
16182
|
+
}
|
|
16183
|
+
if (originTrigger) {
|
|
16184
|
+
originTrigger.apply(void 0, _to_consumable_array(args));
|
|
16185
|
+
}
|
|
16186
|
+
if (_this.props.rules && _this.props.rules.length) {
|
|
16187
|
+
dispatch({
|
|
16188
|
+
name: _this.props.name
|
|
16189
|
+
});
|
|
16190
|
+
}
|
|
16191
|
+
};
|
|
16192
|
+
});
|
|
16074
16193
|
if (isForwardRefComponent(children)) {
|
|
16075
16194
|
controlled.ref = function(componentInstance) {
|
|
16076
16195
|
var originRef = children.ref;
|
|
@@ -16095,7 +16214,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16095
16214
|
});
|
|
16096
16215
|
}), _define_property(_this, "onStoreChange", function(type2) {
|
|
16097
16216
|
if (type2 === "reset") {
|
|
16098
|
-
_this.context.errors[_this.props.name] = [];
|
|
16217
|
+
_this.context.formInstance.errors[_this.props.name] = [];
|
|
16099
16218
|
_this.refresh();
|
|
16100
16219
|
} else {
|
|
16101
16220
|
_this.forceUpdate();
|
|
@@ -16105,23 +16224,25 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16105
16224
|
var requiredInRules = rules2 === null || rules2 === void 0 ? void 0 : rules2.some(function(rule) {
|
|
16106
16225
|
return rule.required;
|
|
16107
16226
|
});
|
|
16108
|
-
var item = name2 ? _this.context.errors[name2] : [];
|
|
16109
|
-
var starPosition = _this.context.starPosition;
|
|
16110
|
-
var renderStar = (required2 || requiredInRules) && /* @__PURE__ */ React.createElement("
|
|
16111
|
-
className: "required"
|
|
16112
|
-
});
|
|
16113
|
-
var renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null,
|
|
16227
|
+
var item = name2 ? _this.context.formInstance.errors[name2] : [];
|
|
16228
|
+
var starPosition = _this.context.formInstance.starPosition;
|
|
16229
|
+
var renderStar = (required2 || requiredInRules) && /* @__PURE__ */ React.createElement("div", {
|
|
16230
|
+
className: "nut-form-item-label-required required"
|
|
16231
|
+
}, "*");
|
|
16232
|
+
var renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
|
|
16233
|
+
className: "nut-form-item-labeltxt"
|
|
16234
|
+
}, starPosition === "left" ? renderStar : null, label), starPosition === "right" ? renderStar : null);
|
|
16114
16235
|
return /* @__PURE__ */ React.createElement(Cell, {
|
|
16115
|
-
className: "nut-form-item ".concat(className),
|
|
16236
|
+
className: "".concat(_this.getClassNameWithDirection("nut-form-item"), " ").concat(className),
|
|
16116
16237
|
style,
|
|
16117
16238
|
align,
|
|
16118
16239
|
onClick: function(e2) {
|
|
16119
16240
|
return _this.props.onClick && _this.props.onClick(e2, _this.componentRef);
|
|
16120
16241
|
}
|
|
16121
16242
|
}, label ? /* @__PURE__ */ React.createElement("div", {
|
|
16122
|
-
className: "nut-cell-title nut-form-item-label"
|
|
16243
|
+
className: "nut-cell-title ".concat(_this.getClassNameWithDirection("nut-form-item-label"))
|
|
16123
16244
|
}, renderLabel) : null, /* @__PURE__ */ React.createElement("div", {
|
|
16124
|
-
className: "nut-cell-value nut-form-item-body"
|
|
16245
|
+
className: "nut-cell-value ".concat(_this.getClassNameWithDirection("nut-form-item-body"))
|
|
16125
16246
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
16126
16247
|
className: "nut-form-item-body-slots"
|
|
16127
16248
|
}, childNode), item && item.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
@@ -16141,11 +16262,11 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16141
16262
|
{
|
|
16142
16263
|
key: "componentDidMount",
|
|
16143
16264
|
value: function componentDidMount() {
|
|
16144
|
-
var
|
|
16265
|
+
var _this_context_formInstance_getInternal = this.context.formInstance.getInternal(SECRET), _this_context_formInstance_getInternal_store = _this_context_formInstance_getInternal.store, store = _this_context_formInstance_getInternal_store === void 0 ? {} : _this_context_formInstance_getInternal_store, setInitialValues = _this_context_formInstance_getInternal.setInitialValues;
|
|
16145
16266
|
if (this.props.initialValue && this.props.name && !Object.keys(store).includes(this.props.name)) {
|
|
16146
16267
|
setInitialValues(_object_spread_props(_object_spread({}, store), _define_property({}, this.props.name, this.props.initialValue)), true);
|
|
16147
16268
|
}
|
|
16148
|
-
var
|
|
16269
|
+
var _this_context_formInstance_getInternal1 = this.context.formInstance.getInternal(SECRET), registerField = _this_context_formInstance_getInternal1.registerField, registerUpdate = _this_context_formInstance_getInternal1.registerUpdate;
|
|
16149
16270
|
this.cancelRegister = registerField(this);
|
|
16150
16271
|
this.eventOff = registerUpdate(this, this.props.shouldUpdate);
|
|
16151
16272
|
}
|
|
@@ -16161,6 +16282,15 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16161
16282
|
}
|
|
16162
16283
|
}
|
|
16163
16284
|
},
|
|
16285
|
+
{
|
|
16286
|
+
key: "getClassNameWithDirection",
|
|
16287
|
+
value: function getClassNameWithDirection(className) {
|
|
16288
|
+
if (className && this.context.labelPosition) {
|
|
16289
|
+
return "".concat(className, " ").concat(className, "-").concat(this.context.labelPosition);
|
|
16290
|
+
}
|
|
16291
|
+
return className;
|
|
16292
|
+
}
|
|
16293
|
+
},
|
|
16164
16294
|
{
|
|
16165
16295
|
key: "render",
|
|
16166
16296
|
value: function render2() {
|
|
@@ -16170,11 +16300,13 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16170
16300
|
if (!this.props.shouldUpdate) {
|
|
16171
16301
|
returnChildNode = /* @__PURE__ */ React.cloneElement(child, this.getControlled(child));
|
|
16172
16302
|
} else {
|
|
16173
|
-
returnChildNode = child(this.context);
|
|
16303
|
+
returnChildNode = child(this.context.formInstance);
|
|
16174
16304
|
}
|
|
16175
16305
|
return /* @__PURE__ */ React.createElement(React.Fragment, {
|
|
16176
16306
|
key: this.state.resetCount
|
|
16177
|
-
},
|
|
16307
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
16308
|
+
className: this.context.disabled ? "nut-form-item-disabled" : ""
|
|
16309
|
+
}, this.props.noStyle ? returnChildNode : this.renderLayout(returnChildNode)));
|
|
16178
16310
|
}
|
|
16179
16311
|
}
|
|
16180
16312
|
]);
|
|
@@ -16185,6 +16317,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
16185
16317
|
var InnerForm = Form;
|
|
16186
16318
|
InnerForm.Item = FormItem;
|
|
16187
16319
|
InnerForm.useForm = useForm;
|
|
16320
|
+
InnerForm.useWatch = useWatch;
|
|
16188
16321
|
function trimExtraChar(value2, char, regExp) {
|
|
16189
16322
|
var index2 = value2.indexOf(char);
|
|
16190
16323
|
if (index2 === -1) {
|
|
@@ -23356,7 +23489,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
23356
23489
|
shapePath._length = 0;
|
|
23357
23490
|
shapePath.c = false;
|
|
23358
23491
|
}
|
|
23359
|
-
function
|
|
23492
|
+
function clone2(shape) {
|
|
23360
23493
|
var cloned = factory.newElement();
|
|
23361
23494
|
var i2;
|
|
23362
23495
|
var len = shape._length === void 0 ? shape.v.length : shape._length;
|
|
@@ -23368,7 +23501,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
23368
23501
|
return cloned;
|
|
23369
23502
|
}
|
|
23370
23503
|
var factory = poolFactory(4, create, release);
|
|
23371
|
-
factory.clone =
|
|
23504
|
+
factory.clone = clone2;
|
|
23372
23505
|
return factory;
|
|
23373
23506
|
}();
|
|
23374
23507
|
function ShapeCollection() {
|
|
@@ -24086,7 +24219,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24086
24219
|
}
|
|
24087
24220
|
return true;
|
|
24088
24221
|
}
|
|
24089
|
-
function
|
|
24222
|
+
function clone2(matr) {
|
|
24090
24223
|
var i2;
|
|
24091
24224
|
for (i2 = 0; i2 < 16; i2 += 1) {
|
|
24092
24225
|
matr.props[i2] = this.props[i2];
|
|
@@ -24238,7 +24371,7 @@ Please add \`${key2}Action\` when creating your handler.`);
|
|
|
24238
24371
|
this.applyToPointStringified = applyToPointStringified;
|
|
24239
24372
|
this.toCSS = toCSS;
|
|
24240
24373
|
this.to2dCSS = to2dCSS;
|
|
24241
|
-
this.clone =
|
|
24374
|
+
this.clone = clone2;
|
|
24242
24375
|
this.cloneFromProps = cloneFromProps;
|
|
24243
24376
|
this.equals = equals;
|
|
24244
24377
|
this.inversePoints = inversePoints;
|