@nutui/nutui-react 2.0.0-alpha.16 → 2.0.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Button.js +4 -2
- package/dist/esm/Divider/style/style.css +1 -1
- package/dist/esm/Form/style/index.js +3 -1
- package/dist/esm/Form/style/style.css +1 -1
- package/dist/esm/Form.js +65 -48
- package/dist/esm/FormItem/style/index.js +1 -1
- package/dist/esm/FormItem/style/style.css +1 -1
- package/dist/esm/FormItem.js +1 -1
- package/dist/esm/InputNumber/style/style.css +1 -1
- package/dist/esm/InputNumber.js +7 -7
- package/dist/esm/Pagination/style/style.css +1 -1
- package/dist/esm/Picker.js +31 -11
- package/dist/esm/Popover.js +7 -7
- package/dist/esm/Popup.js +1 -0
- package/dist/esm/SearchBar.js +2 -2
- package/dist/esm/Swipe.js +4 -6
- package/dist/esm/Tabbar/style/style.css +1 -1
- package/dist/esm/TabbarItem/style/index.js +1 -1
- package/dist/esm/TabbarItem/style/style.css +1 -1
- package/dist/esm/formitem2.js +87 -69
- package/dist/esm/tabbaritem2.js +17 -8
- package/dist/esm/types/src/packages/button/button.d.ts +1 -0
- package/dist/esm/types/src/packages/elevator/elevator.d.ts +0 -1
- package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +0 -1
- package/dist/esm/types/src/packages/form/__tests__/form.spec.d.ts +1 -0
- package/dist/esm/types/src/packages/form/context.d.ts +4 -0
- package/dist/esm/types/src/packages/form/form.d.ts +11 -4
- package/dist/esm/types/src/packages/form/form.taro.d.ts +14 -4
- package/dist/esm/types/src/packages/form/index.d.ts +1 -0
- package/dist/esm/types/src/packages/form/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/form/types.d.ts +4 -52
- package/dist/esm/types/src/packages/formitem/formitem.d.ts +16 -15
- package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +16 -12
- package/dist/esm/types/src/packages/formitem/index.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/index.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/formitem/types.d.ts +1 -31
- package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +1 -1
- package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/picker/picker.d.ts +7 -2
- package/dist/esm/types/src/packages/picker/picker.taro.d.ts +7 -2
- package/dist/esm/types/src/packages/sticky/sticky.d.ts +0 -1
- package/dist/esm/types/src/packages/swipe/swipe.d.ts +2 -6
- package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +2 -6
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.d.ts +7 -2
- package/dist/esm/types/src/packages/tabbaritem/tabbaritem.taro.d.ts +7 -2
- package/dist/esm/types/src/utils/is-forward-ref-component.d.ts +1 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +265 -178
- package/dist/nutui.react.umd.js +265 -178
- package/dist/packages/actionsheet/actionsheet.scss +6 -6
- package/dist/packages/divider/divider.scss +8 -7
- package/dist/packages/formitem/formitem.scss +1 -13
- package/dist/packages/inputnumber/inputnumber.scss +4 -2
- package/dist/packages/layout/layout.scss +0 -2
- package/dist/packages/pagination/pagination.scss +8 -30
- package/dist/packages/tabbaritem/tabbaritem.scss +1 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/animate/animate.d.ts +3 -3
- package/dist/types/packages/audio/audio.d.ts +2 -2
- package/dist/types/packages/avatar/avatar.d.ts +5 -5
- package/dist/types/packages/avatargroup/avatargroup.d.ts +5 -5
- package/dist/types/packages/badge/badge.d.ts +1 -1
- package/dist/types/packages/button/button.d.ts +5 -4
- package/dist/types/packages/cascader/cascader.d.ts +4 -4
- package/dist/types/packages/checkboxgroup/checkboxgroup.d.ts +2 -2
- package/dist/types/packages/circleprogress/circleprogress.d.ts +2 -2
- package/dist/types/packages/divider/divider.d.ts +2 -2
- package/dist/types/packages/drag/drag.d.ts +1 -1
- package/dist/types/packages/elevator/elevator.d.ts +0 -1
- package/dist/types/packages/empty/empty.d.ts +3 -3
- package/dist/types/packages/fixednav/fixednav.d.ts +3 -3
- package/dist/types/packages/form/context.d.ts +4 -0
- package/dist/types/packages/form/form.d.ts +43 -4
- package/dist/types/packages/form/index.d.ts +1 -0
- package/dist/types/packages/form/types.d.ts +4 -52
- package/dist/types/packages/formitem/formitem.d.ts +45 -16
- package/dist/types/packages/formitem/index.d.ts +1 -0
- package/dist/types/packages/formitem/types.d.ts +1 -31
- package/dist/types/packages/grid/grid.d.ts +1 -1
- package/dist/types/packages/infiniteloading/infiniteloading.d.ts +1 -1
- package/dist/types/packages/inputnumber/inputnumber.d.ts +1 -1
- package/dist/types/packages/noticebar/noticebar.d.ts +3 -3
- package/dist/types/packages/overlay/overlay.d.ts +1 -1
- package/dist/types/packages/pagination/pagination.d.ts +1 -1
- package/dist/types/packages/picker/picker.d.ts +7 -2
- package/dist/types/packages/popover/popover.d.ts +5 -5
- package/dist/types/packages/popup/popup.d.ts +2 -2
- package/dist/types/packages/radio/radio.d.ts +2 -2
- package/dist/types/packages/searchbar/searchbar.d.ts +7 -7
- package/dist/types/packages/step/step.d.ts +3 -3
- package/dist/types/packages/steps/steps.d.ts +1 -1
- package/dist/types/packages/sticky/sticky.d.ts +1 -2
- package/dist/types/packages/swipe/swipe.d.ts +2 -6
- package/dist/types/packages/swiper/swiper.d.ts +1 -1
- package/dist/types/packages/tabbaritem/tabbaritem.d.ts +27 -2
- package/dist/types/packages/tabs/tabs.d.ts +1 -1
- package/dist/types/packages/tag/tag.d.ts +1 -1
- package/dist/types/packages/timeselect/timeselect.d.ts +2 -2
- package/dist/types/packages/toast/toast.d.ts +50 -10
- package/dist/types/packages/uploader/uploader.d.ts +17 -17
- package/dist/types/utils/is-forward-ref-component.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/types/src/packages/formitem/formitemcontext.d.ts +0 -6
- package/dist/types/packages/formitem/formitemcontext.d.ts +0 -6
- /package/dist/esm/types/src/packages/form/{useForm.d.ts → useform.d.ts} +0 -0
- /package/dist/esm/types/src/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
- /package/dist/types/packages/form/{useForm.d.ts → useform.d.ts} +0 -0
package/dist/nutui.react.umd.js
CHANGED
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
/*!
|
|
12
|
-
* @nutui/nutui-react v2.0.0-alpha.
|
|
12
|
+
* @nutui/nutui-react v2.0.0-alpha.18 Fri Jun 16 2023 18:36:57 GMT+0800 (China Standard Time)
|
|
13
13
|
* (c) 2023 @jdf2e.
|
|
14
14
|
* Released under the MIT License.
|
|
15
15
|
*/
|
|
@@ -2420,6 +2420,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2420
2420
|
disabled: false,
|
|
2421
2421
|
block: false,
|
|
2422
2422
|
icon: null,
|
|
2423
|
+
nativeType: "button",
|
|
2423
2424
|
onClick: (e) => {
|
|
2424
2425
|
}
|
|
2425
2426
|
};
|
|
@@ -2439,6 +2440,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2439
2440
|
onClick,
|
|
2440
2441
|
className,
|
|
2441
2442
|
style,
|
|
2443
|
+
nativeType,
|
|
2442
2444
|
...rest
|
|
2443
2445
|
} = {
|
|
2444
2446
|
...defaultProps$1r,
|
|
@@ -2472,6 +2474,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
2472
2474
|
{
|
|
2473
2475
|
...rest,
|
|
2474
2476
|
ref,
|
|
2477
|
+
type: nativeType,
|
|
2475
2478
|
className: classNames(
|
|
2476
2479
|
prefixCls,
|
|
2477
2480
|
className,
|
|
@@ -11180,6 +11183,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11180
11183
|
}
|
|
11181
11184
|
};
|
|
11182
11185
|
const onHandleClickOverlay = (e) => {
|
|
11186
|
+
e.stopPropagation();
|
|
11183
11187
|
if (closeOnOverlayClick) {
|
|
11184
11188
|
const closed = onClickOverlay && onClickOverlay(e);
|
|
11185
11189
|
closed && close();
|
|
@@ -11455,8 +11459,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11455
11459
|
icon: null,
|
|
11456
11460
|
active: false,
|
|
11457
11461
|
index: 0,
|
|
11458
|
-
|
|
11459
|
-
|
|
11462
|
+
value: "",
|
|
11463
|
+
dot: false,
|
|
11464
|
+
max: 99,
|
|
11465
|
+
top: "0",
|
|
11466
|
+
right: "5"
|
|
11460
11467
|
};
|
|
11461
11468
|
const TabbarItem = (props) => {
|
|
11462
11469
|
const {
|
|
@@ -11468,8 +11475,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11468
11475
|
activeColor,
|
|
11469
11476
|
inactiveColor,
|
|
11470
11477
|
index,
|
|
11471
|
-
|
|
11472
|
-
|
|
11478
|
+
value,
|
|
11479
|
+
dot,
|
|
11480
|
+
max,
|
|
11481
|
+
top,
|
|
11482
|
+
right,
|
|
11483
|
+
handleClick: handleClick2
|
|
11473
11484
|
} = {
|
|
11474
11485
|
...defaultProps$17,
|
|
11475
11486
|
...props
|
|
@@ -11482,6 +11493,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11482
11493
|
const titleClass = classNames(boxPrefix, `${boxPrefix}-nav`, {
|
|
11483
11494
|
[`${boxPrefix}-large`]: !icon
|
|
11484
11495
|
});
|
|
11496
|
+
const badgeProps = {
|
|
11497
|
+
value,
|
|
11498
|
+
dot,
|
|
11499
|
+
max,
|
|
11500
|
+
top,
|
|
11501
|
+
right,
|
|
11502
|
+
color: activeColor
|
|
11503
|
+
};
|
|
11485
11504
|
return /* @__PURE__ */ React.createElement(
|
|
11486
11505
|
"div",
|
|
11487
11506
|
{
|
|
@@ -11492,7 +11511,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11492
11511
|
},
|
|
11493
11512
|
onClick: () => handleClick2(index)
|
|
11494
11513
|
},
|
|
11495
|
-
icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, { ...
|
|
11514
|
+
icon ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: boxPrefix }, icon)), /* @__PURE__ */ React.createElement("div", { className: titleClass }, title)) : /* @__PURE__ */ React.createElement(Badge, { ...badgeProps }, /* @__PURE__ */ React.createElement("div", { className: titleClass }, title))
|
|
11496
11515
|
);
|
|
11497
11516
|
};
|
|
11498
11517
|
const defaultProps$16 = {
|
|
@@ -13834,7 +13853,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13834
13853
|
Cascader.defaultProps = defaultProps$Z;
|
|
13835
13854
|
Cascader.displayName = "NutCascader";
|
|
13836
13855
|
const CheckboxGroupContext = React.createContext(null);
|
|
13837
|
-
const Context = CheckboxGroupContext;
|
|
13856
|
+
const Context$1 = CheckboxGroupContext;
|
|
13838
13857
|
const defaultProps$Y = {
|
|
13839
13858
|
max: void 0,
|
|
13840
13859
|
labelPosition: "right",
|
|
@@ -13905,7 +13924,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13905
13924
|
});
|
|
13906
13925
|
}, [options2, max]);
|
|
13907
13926
|
return /* @__PURE__ */ React.createElement(
|
|
13908
|
-
Context.Provider,
|
|
13927
|
+
Context$1.Provider,
|
|
13909
13928
|
{
|
|
13910
13929
|
value: {
|
|
13911
13930
|
labelPosition: labelPosition || "right",
|
|
@@ -13968,7 +13987,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13968
13987
|
...others
|
|
13969
13988
|
} = props;
|
|
13970
13989
|
let { labelPosition, ...rest } = others;
|
|
13971
|
-
const ctx2 = React.useContext(Context);
|
|
13990
|
+
const ctx2 = React.useContext(Context$1);
|
|
13972
13991
|
let [innerChecked, setChecked] = usePropsValue({
|
|
13973
13992
|
value: props.checked,
|
|
13974
13993
|
defaultValue: props.defaultChecked,
|
|
@@ -14349,7 +14368,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14349
14368
|
}
|
|
14350
14369
|
const defaultProps$W = {
|
|
14351
14370
|
...ComponentDefaults,
|
|
14352
|
-
visible: false,
|
|
14353
14371
|
title: "",
|
|
14354
14372
|
options: [],
|
|
14355
14373
|
value: [],
|
|
@@ -14386,12 +14404,26 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14386
14404
|
(_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
|
|
14387
14405
|
}
|
|
14388
14406
|
});
|
|
14407
|
+
const [innerVisible, setInnerVisible] = usePropsValue({
|
|
14408
|
+
value: props.visible,
|
|
14409
|
+
defaultValue: false,
|
|
14410
|
+
finalValue: false
|
|
14411
|
+
});
|
|
14389
14412
|
const [innerValue, setInnerValue] = React.useState(selectedValue);
|
|
14390
14413
|
const [columnIndex, setColumnIndex] = React.useState(0);
|
|
14391
14414
|
const pickerRef = React.useRef(null);
|
|
14392
14415
|
const [refs, setRefs] = useRefs();
|
|
14393
14416
|
const [columnsList, setColumnsList] = React.useState([]);
|
|
14394
14417
|
const isConfirmEvent = React.useRef(false);
|
|
14418
|
+
const actions = {
|
|
14419
|
+
open: () => {
|
|
14420
|
+
setInnerVisible(true);
|
|
14421
|
+
},
|
|
14422
|
+
close: () => {
|
|
14423
|
+
setInnerVisible(false);
|
|
14424
|
+
}
|
|
14425
|
+
};
|
|
14426
|
+
React.useImperativeHandle(ref, () => actions);
|
|
14395
14427
|
const formatCascade = (columns, values) => {
|
|
14396
14428
|
const formatted = [];
|
|
14397
14429
|
let columnOptions = {
|
|
@@ -14453,12 +14485,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14453
14485
|
};
|
|
14454
14486
|
React.useEffect(() => {
|
|
14455
14487
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
14456
|
-
}, [
|
|
14488
|
+
}, [innerVisible]);
|
|
14457
14489
|
React.useEffect(() => {
|
|
14458
|
-
if (
|
|
14490
|
+
if (innerVisible) {
|
|
14459
14491
|
init();
|
|
14460
14492
|
}
|
|
14461
|
-
}, [options2,
|
|
14493
|
+
}, [options2, innerVisible]);
|
|
14462
14494
|
React.useEffect(() => {
|
|
14463
14495
|
onChange && onChange(setSelectedOptions(), innerValue, columnIndex);
|
|
14464
14496
|
}, [innerValue, columnsList]);
|
|
@@ -14531,6 +14563,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14531
14563
|
}, 0);
|
|
14532
14564
|
};
|
|
14533
14565
|
const closePicker = () => {
|
|
14566
|
+
setInnerVisible(false);
|
|
14534
14567
|
onClose && onClose(setSelectedOptions(), innerValue);
|
|
14535
14568
|
afterClose && afterClose(setSelectedOptions(), innerValue, pickerRef);
|
|
14536
14569
|
};
|
|
@@ -14539,21 +14572,34 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14539
14572
|
"span",
|
|
14540
14573
|
{
|
|
14541
14574
|
className: `${classPrefix2}__cancel-btn`,
|
|
14542
|
-
onClick: () =>
|
|
14575
|
+
onClick: (e) => {
|
|
14576
|
+
e.stopPropagation();
|
|
14577
|
+
closePicker();
|
|
14578
|
+
}
|
|
14543
14579
|
},
|
|
14544
14580
|
locale.cancel
|
|
14545
|
-
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
14581
|
+
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
14582
|
+
"span",
|
|
14583
|
+
{
|
|
14584
|
+
className: `${classPrefix2}__confirm-btn`,
|
|
14585
|
+
onClick: (e) => {
|
|
14586
|
+
e.stopPropagation();
|
|
14587
|
+
confirm2();
|
|
14588
|
+
}
|
|
14589
|
+
},
|
|
14590
|
+
locale.confirm
|
|
14591
|
+
));
|
|
14546
14592
|
};
|
|
14547
|
-
return /* @__PURE__ */ React.createElement(
|
|
14593
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React.createElement(
|
|
14548
14594
|
Popup,
|
|
14549
14595
|
{
|
|
14550
|
-
visible,
|
|
14596
|
+
visible: innerVisible,
|
|
14551
14597
|
position: "bottom",
|
|
14552
14598
|
afterClose: () => {
|
|
14553
14599
|
closePicker();
|
|
14554
14600
|
}
|
|
14555
14601
|
},
|
|
14556
|
-
/* @__PURE__ */ React.createElement("div", { className: classes, style, ...rest }, renderTitleBar(), children, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__panel`, ref: pickerRef }, columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
14602
|
+
/* @__PURE__ */ React.createElement("div", { className: classes, style, ...rest }, renderTitleBar(), typeof children !== "function" && children, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__panel`, ref: pickerRef }, columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
14557
14603
|
return /* @__PURE__ */ React.createElement(
|
|
14558
14604
|
PickerPanel$1,
|
|
14559
14605
|
{
|
|
@@ -14568,7 +14614,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14568
14614
|
}
|
|
14569
14615
|
);
|
|
14570
14616
|
})))
|
|
14571
|
-
);
|
|
14617
|
+
));
|
|
14572
14618
|
};
|
|
14573
14619
|
const Picker = React.forwardRef(InternalPicker);
|
|
14574
14620
|
const Picker$1 = Picker;
|
|
@@ -14872,7 +14918,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14872
14918
|
};
|
|
14873
14919
|
DatePicker.defaultProps = defaultProps$V;
|
|
14874
14920
|
DatePicker.displayName = "NutDatePicker";
|
|
14875
|
-
const
|
|
14921
|
+
const Context = React.createContext({});
|
|
14876
14922
|
function _extends() {
|
|
14877
14923
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
14878
14924
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -15926,15 +15972,18 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15926
15972
|
Schema.warning = warning;
|
|
15927
15973
|
Schema.messages = messages;
|
|
15928
15974
|
Schema.validators = validators;
|
|
15975
|
+
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
|
15929
15976
|
class FormStore {
|
|
15930
15977
|
constructor() {
|
|
15931
|
-
|
|
15978
|
+
// 初始化数据
|
|
15979
|
+
__publicField(this, "initialValues", {});
|
|
15932
15980
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
15933
|
-
__publicField(this, "
|
|
15981
|
+
__publicField(this, "store", {});
|
|
15934
15982
|
// 所有的组件实例
|
|
15935
|
-
|
|
15983
|
+
__publicField(this, "fieldEntities", []);
|
|
15984
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
15936
15985
|
__publicField(this, "callbacks", {});
|
|
15937
|
-
__publicField(this, "
|
|
15986
|
+
__publicField(this, "errors", []);
|
|
15938
15987
|
/**
|
|
15939
15988
|
* 注册组件实例
|
|
15940
15989
|
* @param field
|
|
@@ -15943,11 +15992,29 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15943
15992
|
this.fieldEntities.push(field);
|
|
15944
15993
|
return () => {
|
|
15945
15994
|
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
15946
|
-
|
|
15995
|
+
if (this.store) {
|
|
15996
|
+
delete this.store[field.props.name];
|
|
15997
|
+
}
|
|
15947
15998
|
};
|
|
15948
15999
|
});
|
|
16000
|
+
/**
|
|
16001
|
+
* 获取 formItem 的值
|
|
16002
|
+
* @param name
|
|
16003
|
+
*/
|
|
15949
16004
|
__publicField(this, "getFieldValue", (name) => {
|
|
15950
|
-
|
|
16005
|
+
var _a2;
|
|
16006
|
+
return (_a2 = this.store) == null ? void 0 : _a2[name];
|
|
16007
|
+
});
|
|
16008
|
+
/**
|
|
16009
|
+
* 设置 form 的初始值,之后在 reset 的时候使用
|
|
16010
|
+
* @param values
|
|
16011
|
+
* @param init
|
|
16012
|
+
*/
|
|
16013
|
+
__publicField(this, "setInitialValues", (values, init) => {
|
|
16014
|
+
if (init) {
|
|
16015
|
+
this.initialValues = values;
|
|
16016
|
+
this.store = values;
|
|
16017
|
+
}
|
|
15951
16018
|
});
|
|
15952
16019
|
/**
|
|
15953
16020
|
* 存储组件数据
|
|
@@ -15962,34 +16029,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15962
16029
|
const { name } = enetity.props;
|
|
15963
16030
|
Object.keys(newStore).forEach((key) => {
|
|
15964
16031
|
if (key === name) {
|
|
15965
|
-
enetity.onStoreChange();
|
|
16032
|
+
enetity.onStoreChange("update");
|
|
15966
16033
|
}
|
|
15967
16034
|
});
|
|
15968
16035
|
});
|
|
15969
16036
|
});
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
* required: true,
|
|
15977
|
-
* validator: (rule, value) => {
|
|
15978
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
15979
|
-
* },
|
|
15980
|
-
* },
|
|
15981
|
-
* }
|
|
15982
|
-
*/
|
|
16037
|
+
__publicField(this, "setCallback", (callback) => {
|
|
16038
|
+
this.callbacks = {
|
|
16039
|
+
...this.callbacks,
|
|
16040
|
+
...callback
|
|
16041
|
+
};
|
|
16042
|
+
});
|
|
15983
16043
|
__publicField(this, "validate", () => {
|
|
15984
16044
|
const err = [];
|
|
15985
|
-
this.
|
|
16045
|
+
this.errors.length = 0;
|
|
15986
16046
|
this.fieldEntities.forEach((entity) => {
|
|
16047
|
+
var _a2;
|
|
15987
16048
|
const { name, rules: rules2 = [] } = entity.props;
|
|
15988
16049
|
const descriptor = {};
|
|
15989
16050
|
if (rules2.length) {
|
|
15990
16051
|
if (rules2.length > 1) {
|
|
15991
16052
|
descriptor[name] = [];
|
|
15992
|
-
rules2.
|
|
16053
|
+
rules2.forEach((v) => {
|
|
15993
16054
|
descriptor[name].push(v);
|
|
15994
16055
|
});
|
|
15995
16056
|
} else {
|
|
@@ -15997,39 +16058,36 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15997
16058
|
}
|
|
15998
16059
|
}
|
|
15999
16060
|
const validator = new Schema(descriptor);
|
|
16000
|
-
validator.
|
|
16061
|
+
validator.messages();
|
|
16062
|
+
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16001
16063
|
if (errors) {
|
|
16002
16064
|
err.push(...errors);
|
|
16003
|
-
this.
|
|
16065
|
+
this.errors.push(...errors);
|
|
16004
16066
|
}
|
|
16005
|
-
entity.onStoreChange();
|
|
16067
|
+
entity.onStoreChange("validate");
|
|
16006
16068
|
});
|
|
16007
16069
|
});
|
|
16008
16070
|
return err;
|
|
16009
16071
|
});
|
|
16010
|
-
__publicField(this, "setCallback", (callback) => {
|
|
16011
|
-
this.callbacks = {
|
|
16012
|
-
...this.callbacks,
|
|
16013
|
-
...callback
|
|
16014
|
-
};
|
|
16015
|
-
});
|
|
16016
16072
|
__publicField(this, "submit", () => {
|
|
16017
16073
|
var _a2, _b, _c, _d;
|
|
16018
|
-
const
|
|
16019
|
-
if (
|
|
16074
|
+
const errors = this.validate();
|
|
16075
|
+
if (errors.length === 0) {
|
|
16020
16076
|
(_b = (_a2 = this.callbacks).onFinish) == null ? void 0 : _b.call(_a2, this.store);
|
|
16021
|
-
} else if (
|
|
16022
|
-
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c,
|
|
16077
|
+
} else if (errors.length > 0) {
|
|
16078
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
|
|
16023
16079
|
}
|
|
16024
16080
|
});
|
|
16025
16081
|
__publicField(this, "resetFields", () => {
|
|
16026
|
-
this.
|
|
16027
|
-
this.
|
|
16028
|
-
|
|
16082
|
+
this.errors.length = 0;
|
|
16083
|
+
this.store = this.initialValues;
|
|
16084
|
+
this.fieldEntities.forEach((entity) => {
|
|
16085
|
+
entity.onStoreChange("reset");
|
|
16029
16086
|
});
|
|
16030
16087
|
});
|
|
16031
16088
|
__publicField(this, "getForm", () => {
|
|
16032
16089
|
return {
|
|
16090
|
+
setInitialValues: this.setInitialValues,
|
|
16033
16091
|
setCallback: this.setCallback,
|
|
16034
16092
|
registerField: this.registerField,
|
|
16035
16093
|
getFieldValue: this.getFieldValue,
|
|
@@ -16037,12 +16095,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16037
16095
|
resetFields: this.resetFields,
|
|
16038
16096
|
submit: this.submit,
|
|
16039
16097
|
store: this.store,
|
|
16040
|
-
|
|
16098
|
+
errors: this.errors,
|
|
16041
16099
|
fieldEntities: this.fieldEntities
|
|
16042
16100
|
};
|
|
16043
16101
|
});
|
|
16044
16102
|
this.callbacks = {
|
|
16045
|
-
onFinish: (
|
|
16103
|
+
onFinish: () => {
|
|
16046
16104
|
},
|
|
16047
16105
|
onFinishFailed: () => {
|
|
16048
16106
|
}
|
|
@@ -16061,98 +16119,113 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16061
16119
|
}
|
|
16062
16120
|
return [formRef.current];
|
|
16063
16121
|
};
|
|
16122
|
+
function isForwardRefComponent(component) {
|
|
16123
|
+
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
16124
|
+
React.forwardRef(
|
|
16125
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16126
|
+
// @ts-ignore
|
|
16127
|
+
() => {
|
|
16128
|
+
}
|
|
16129
|
+
).$$typeof === component.type.$$typeof;
|
|
16130
|
+
}
|
|
16064
16131
|
const defaultProps$U = {
|
|
16065
16132
|
...ComponentDefaults,
|
|
16133
|
+
required: false,
|
|
16066
16134
|
name: "",
|
|
16067
16135
|
label: "",
|
|
16068
|
-
className: "",
|
|
16069
16136
|
rules: [{ required: false, message: "" }],
|
|
16070
|
-
|
|
16071
|
-
labelWidth: 90,
|
|
16072
|
-
errorMessageAlign: "left",
|
|
16073
|
-
showErrorLine: true,
|
|
16074
|
-
showErrorMessage: true,
|
|
16075
|
-
initialValue: ""
|
|
16137
|
+
errorMessageAlign: "left"
|
|
16076
16138
|
};
|
|
16077
16139
|
class FormItem extends React.Component {
|
|
16078
|
-
constructor() {
|
|
16079
|
-
super(
|
|
16140
|
+
constructor(props) {
|
|
16141
|
+
super(props);
|
|
16080
16142
|
__publicField(this, "cancelRegister");
|
|
16081
|
-
__publicField(this, "
|
|
16143
|
+
__publicField(this, "componentRef");
|
|
16082
16144
|
// children添加value属性和onChange事件
|
|
16083
16145
|
__publicField(this, "getControlled", (children) => {
|
|
16084
|
-
var _a2
|
|
16085
|
-
const {
|
|
16146
|
+
var _a2;
|
|
16147
|
+
const { setFieldsValue, getFieldValue } = this.context;
|
|
16086
16148
|
const { name } = this.props;
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
|
|
16090
|
-
|
|
16091
|
-
|
|
16092
|
-
|
|
16093
|
-
|
|
16094
|
-
|
|
16095
|
-
defaultValue: getFieldValue(name),
|
|
16096
|
-
onChange: (event) => {
|
|
16097
|
-
const originOnChange = children.props.onChange;
|
|
16149
|
+
if ((_a2 = children == null ? void 0 : children.props) == null ? void 0 : _a2.defaultValue) {
|
|
16150
|
+
console.warn("通过 initialValue 设置初始值");
|
|
16151
|
+
}
|
|
16152
|
+
const controlled = {
|
|
16153
|
+
...children.props,
|
|
16154
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) || this.props.initialValue,
|
|
16155
|
+
[this.props.trigger || "onChange"]: (...args) => {
|
|
16156
|
+
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
16098
16157
|
if (originOnChange) {
|
|
16099
|
-
originOnChange(
|
|
16158
|
+
originOnChange(...args);
|
|
16100
16159
|
}
|
|
16101
|
-
let
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
newValue = event.target.value;
|
|
16105
|
-
break;
|
|
16160
|
+
let [next] = args;
|
|
16161
|
+
if (this.props.getValueFromEvent) {
|
|
16162
|
+
next = this.props.getValueFromEvent(...args);
|
|
16106
16163
|
}
|
|
16107
|
-
setFieldsValue({ [name]:
|
|
16164
|
+
setFieldsValue({ [name]: next });
|
|
16108
16165
|
}
|
|
16109
16166
|
};
|
|
16167
|
+
if (isForwardRefComponent(children)) {
|
|
16168
|
+
controlled.ref = (componentInstance) => {
|
|
16169
|
+
const originRef = children.ref;
|
|
16170
|
+
if (originRef) {
|
|
16171
|
+
if (typeof originRef === "function") {
|
|
16172
|
+
originRef(componentInstance);
|
|
16173
|
+
}
|
|
16174
|
+
if ("current" in originRef) {
|
|
16175
|
+
originRef.current = componentInstance;
|
|
16176
|
+
}
|
|
16177
|
+
}
|
|
16178
|
+
this.componentRef = componentInstance;
|
|
16179
|
+
};
|
|
16180
|
+
}
|
|
16181
|
+
return controlled;
|
|
16182
|
+
});
|
|
16183
|
+
__publicField(this, "refresh", () => {
|
|
16184
|
+
this.setState(({ resetCount }) => ({
|
|
16185
|
+
resetCount: resetCount + 1
|
|
16186
|
+
}));
|
|
16110
16187
|
});
|
|
16111
|
-
__publicField(this, "onStoreChange", () => {
|
|
16112
|
-
|
|
16188
|
+
__publicField(this, "onStoreChange", (type2) => {
|
|
16189
|
+
if (type2 === "reset") {
|
|
16190
|
+
this.refresh();
|
|
16191
|
+
} else {
|
|
16192
|
+
this.forceUpdate();
|
|
16193
|
+
}
|
|
16113
16194
|
});
|
|
16114
16195
|
__publicField(this, "renderLayout", (childNode) => {
|
|
16115
16196
|
var _a2, _b;
|
|
16116
|
-
const {
|
|
16117
|
-
label,
|
|
16118
|
-
name,
|
|
16119
|
-
rules: rules2 = [{ required: false, message: "" }],
|
|
16120
|
-
className,
|
|
16121
|
-
labelWidth,
|
|
16122
|
-
errorMessageAlign,
|
|
16123
|
-
showErrorLine,
|
|
16124
|
-
showErrorMessage
|
|
16125
|
-
} = {
|
|
16197
|
+
const { label, name, required: required2, className, style, errorMessageAlign } = {
|
|
16126
16198
|
...defaultProps$U,
|
|
16127
16199
|
...this.props
|
|
16128
16200
|
};
|
|
16129
|
-
const item = ((_a2 = this.context.
|
|
16201
|
+
const item = ((_a2 = this.context.errors) == null ? void 0 : _a2.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
16130
16202
|
return item2.field === name;
|
|
16131
16203
|
}));
|
|
16132
|
-
const {
|
|
16133
|
-
const renderStar =
|
|
16134
|
-
const renderLabel =
|
|
16135
|
-
return /* @__PURE__ */ React.createElement(
|
|
16136
|
-
|
|
16137
|
-
{
|
|
16138
|
-
className: "nut-cell__title nut-form-item__label",
|
|
16139
|
-
style: {
|
|
16140
|
-
width: this.pxCheck(labelWidth)
|
|
16141
|
-
}
|
|
16142
|
-
},
|
|
16143
|
-
renderLabel
|
|
16144
|
-
) : null, /* @__PURE__ */ React.createElement("div", { className: "nut-cell__value nut-form-item__body" }, /* @__PURE__ */ React.createElement("div", { className: "nut-form-item__body__slots" }, childNode), item.length > 0 && /* @__PURE__ */ React.createElement(
|
|
16145
|
-
"div",
|
|
16204
|
+
const { starPosition } = this.context;
|
|
16205
|
+
const renderStar = required2 && /* @__PURE__ */ React.createElement("i", { className: "required" });
|
|
16206
|
+
const renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
|
|
16207
|
+
return /* @__PURE__ */ React.createElement(
|
|
16208
|
+
Cell,
|
|
16146
16209
|
{
|
|
16147
|
-
className:
|
|
16148
|
-
style
|
|
16210
|
+
className: `nut-form-item ${className}`,
|
|
16211
|
+
style,
|
|
16212
|
+
onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
|
|
16149
16213
|
},
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16214
|
+
label ? /* @__PURE__ */ React.createElement("div", { className: "nut-cell__title nut-form-item__label" }, renderLabel) : null,
|
|
16215
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-cell__value nut-form-item__body" }, /* @__PURE__ */ React.createElement("div", { className: "nut-form-item__body__slots" }, childNode), item.length > 0 && /* @__PURE__ */ React.createElement(
|
|
16216
|
+
"div",
|
|
16217
|
+
{
|
|
16218
|
+
className: "nut-form-item__body__tips",
|
|
16219
|
+
style: { textAlign: errorMessageAlign }
|
|
16220
|
+
},
|
|
16221
|
+
item[0].message
|
|
16222
|
+
))
|
|
16223
|
+
);
|
|
16155
16224
|
});
|
|
16225
|
+
this.componentRef = React.createRef();
|
|
16226
|
+
this.state = {
|
|
16227
|
+
resetCount: 1
|
|
16228
|
+
};
|
|
16156
16229
|
}
|
|
16157
16230
|
componentDidMount() {
|
|
16158
16231
|
this.cancelRegister = this.context.registerField(this);
|
|
@@ -16163,81 +16236,86 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16163
16236
|
}
|
|
16164
16237
|
}
|
|
16165
16238
|
render() {
|
|
16166
|
-
const { children
|
|
16167
|
-
const
|
|
16168
|
-
let restCNode = c;
|
|
16169
|
-
if (initialValue) {
|
|
16170
|
-
restCNode = React.cloneElement(c, {
|
|
16171
|
-
defaultValue: initialValue
|
|
16172
|
-
});
|
|
16173
|
-
}
|
|
16239
|
+
const { children } = this.props;
|
|
16240
|
+
const child = Array.isArray(children) ? children[0] : children;
|
|
16174
16241
|
const returnChildNode = React.cloneElement(
|
|
16175
|
-
|
|
16176
|
-
this.getControlled(
|
|
16242
|
+
child,
|
|
16243
|
+
this.getControlled(child)
|
|
16177
16244
|
);
|
|
16178
|
-
return this.renderLayout(returnChildNode);
|
|
16245
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
16179
16246
|
}
|
|
16180
16247
|
}
|
|
16181
16248
|
__publicField(FormItem, "defaultProps", defaultProps$U);
|
|
16182
|
-
__publicField(FormItem, "contextType",
|
|
16249
|
+
__publicField(FormItem, "contextType", Context);
|
|
16183
16250
|
const defaultProps$T = {
|
|
16184
16251
|
...ComponentDefaults,
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
labelPosition: "Right",
|
|
16189
|
-
formGroupTitle: "",
|
|
16190
|
-
onFinish: (obj) => {
|
|
16191
|
-
},
|
|
16192
|
-
onFinishFailed: (value) => {
|
|
16252
|
+
labelPosition: "right",
|
|
16253
|
+
starPosition: "left",
|
|
16254
|
+
onFinish: (values) => {
|
|
16193
16255
|
},
|
|
16194
|
-
|
|
16256
|
+
onFinishFailed: (values, errorFields) => {
|
|
16257
|
+
}
|
|
16195
16258
|
};
|
|
16196
16259
|
const PositionInfo = {
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16260
|
+
top: "form-layout-top",
|
|
16261
|
+
left: "form-layout-left",
|
|
16262
|
+
right: "form-layout-right"
|
|
16200
16263
|
};
|
|
16201
16264
|
const Form = (props) => {
|
|
16265
|
+
const classPrefix2 = "nut-form";
|
|
16202
16266
|
const {
|
|
16267
|
+
className,
|
|
16268
|
+
style,
|
|
16269
|
+
footer,
|
|
16203
16270
|
children,
|
|
16271
|
+
initialValues,
|
|
16204
16272
|
onFinish,
|
|
16205
16273
|
onFinishFailed,
|
|
16206
16274
|
labelPosition,
|
|
16207
|
-
|
|
16208
|
-
form
|
|
16209
|
-
...rest
|
|
16275
|
+
starPosition,
|
|
16276
|
+
form
|
|
16210
16277
|
} = {
|
|
16211
16278
|
...defaultProps$T,
|
|
16212
16279
|
...props
|
|
16213
16280
|
};
|
|
16214
|
-
let formInstance
|
|
16215
|
-
if (
|
|
16281
|
+
let formInstance;
|
|
16282
|
+
if (form !== void 0) {
|
|
16216
16283
|
formInstance = form;
|
|
16217
16284
|
} else {
|
|
16218
16285
|
[formInstance] = useForm();
|
|
16219
16286
|
}
|
|
16220
|
-
formInstance.
|
|
16221
|
-
const { setCallback, submit, resetFields } = formInstance;
|
|
16287
|
+
formInstance.starPosition = starPosition;
|
|
16288
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16222
16289
|
setCallback({
|
|
16223
16290
|
onFinish,
|
|
16224
16291
|
onFinishFailed
|
|
16225
16292
|
});
|
|
16293
|
+
const mountRef = React.useRef(false);
|
|
16294
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
16295
|
+
if (!mountRef.current) {
|
|
16296
|
+
mountRef.current = true;
|
|
16297
|
+
}
|
|
16226
16298
|
return /* @__PURE__ */ React.createElement(
|
|
16227
16299
|
"form",
|
|
16228
16300
|
{
|
|
16229
|
-
className:
|
|
16230
|
-
|
|
16301
|
+
className: classNames(
|
|
16302
|
+
classPrefix2,
|
|
16303
|
+
className,
|
|
16304
|
+
PositionInfo[labelPosition]
|
|
16305
|
+
),
|
|
16306
|
+
style,
|
|
16231
16307
|
onSubmit: (e) => {
|
|
16232
16308
|
e.preventDefault();
|
|
16309
|
+
e.stopPropagation();
|
|
16233
16310
|
submit();
|
|
16234
16311
|
},
|
|
16235
16312
|
onReset: (e) => {
|
|
16236
16313
|
e.preventDefault();
|
|
16314
|
+
e.stopPropagation();
|
|
16237
16315
|
resetFields();
|
|
16238
16316
|
}
|
|
16239
16317
|
},
|
|
16240
|
-
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(
|
|
16318
|
+
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
16241
16319
|
);
|
|
16242
16320
|
};
|
|
16243
16321
|
Form.defaultProps = defaultProps$T;
|
|
@@ -16453,7 +16531,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16453
16531
|
disabled: false,
|
|
16454
16532
|
min: 1,
|
|
16455
16533
|
max: 9999,
|
|
16456
|
-
|
|
16534
|
+
readOnly: false,
|
|
16457
16535
|
allowEmpty: false,
|
|
16458
16536
|
defaultValue: 0,
|
|
16459
16537
|
step: 1,
|
|
@@ -16467,7 +16545,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16467
16545
|
disabled,
|
|
16468
16546
|
min,
|
|
16469
16547
|
max,
|
|
16470
|
-
|
|
16548
|
+
readOnly,
|
|
16471
16549
|
value,
|
|
16472
16550
|
defaultValue,
|
|
16473
16551
|
allowEmpty,
|
|
@@ -16626,14 +16704,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16626
16704
|
const focusValue = (e) => {
|
|
16627
16705
|
if (disabled)
|
|
16628
16706
|
return;
|
|
16629
|
-
if (
|
|
16707
|
+
if (readOnly)
|
|
16630
16708
|
return;
|
|
16631
16709
|
onFocus && onFocus(e);
|
|
16632
16710
|
};
|
|
16633
16711
|
const burValue = (e) => {
|
|
16634
16712
|
if (disabled)
|
|
16635
16713
|
return;
|
|
16636
|
-
if (
|
|
16714
|
+
if (readOnly)
|
|
16637
16715
|
return;
|
|
16638
16716
|
const input = e.target;
|
|
16639
16717
|
let value2 = input.valueAsNumber;
|
|
@@ -16661,7 +16739,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16661
16739
|
min,
|
|
16662
16740
|
max,
|
|
16663
16741
|
disabled,
|
|
16664
|
-
readOnly
|
|
16742
|
+
readOnly,
|
|
16665
16743
|
value: _checked,
|
|
16666
16744
|
onInput: changeFormatValue,
|
|
16667
16745
|
onBlur: burFormatValue,
|
|
@@ -16674,7 +16752,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16674
16752
|
min,
|
|
16675
16753
|
max,
|
|
16676
16754
|
disabled,
|
|
16677
|
-
readOnly
|
|
16755
|
+
readOnly,
|
|
16678
16756
|
value: _checked,
|
|
16679
16757
|
onInput: changeValue,
|
|
16680
16758
|
onBlur: burValue,
|
|
@@ -17866,7 +17944,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17866
17944
|
return /* @__PURE__ */ React.createElement(
|
|
17867
17945
|
"input",
|
|
17868
17946
|
{
|
|
17869
|
-
className: `${classPrefix2}__input ${
|
|
17947
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
17870
17948
|
ref: searchRef,
|
|
17871
17949
|
style: { ...props.style },
|
|
17872
17950
|
value: value || "",
|
|
@@ -17939,7 +18017,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17939
18017
|
style: { ...props.style }
|
|
17940
18018
|
},
|
|
17941
18019
|
renderLeft(),
|
|
17942
|
-
/* @__PURE__ */ React.createElement(
|
|
18020
|
+
/* @__PURE__ */ React.createElement(
|
|
18021
|
+
"div",
|
|
18022
|
+
{
|
|
18023
|
+
className: `${classPrefix2}__content ${shape === "round" ? `${classPrefix2}__round` : ""}`
|
|
18024
|
+
},
|
|
18025
|
+
renderLeftIn(),
|
|
18026
|
+
renderField(),
|
|
18027
|
+
renderRightIn(),
|
|
18028
|
+
clearable && value && handleClear()
|
|
18029
|
+
),
|
|
17943
18030
|
renderRight()
|
|
17944
18031
|
);
|
|
17945
18032
|
};
|
|
@@ -20347,7 +20434,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20347
20434
|
return styles;
|
|
20348
20435
|
};
|
|
20349
20436
|
const getRootPosition = () => {
|
|
20350
|
-
|
|
20437
|
+
const styles = {};
|
|
20351
20438
|
if (!rootPosition)
|
|
20352
20439
|
return {};
|
|
20353
20440
|
const contentWidth = elWidth;
|
|
@@ -20357,34 +20444,34 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20357
20444
|
const skew = location.split("-")[1];
|
|
20358
20445
|
let cross = 0;
|
|
20359
20446
|
let parallel = 0;
|
|
20360
|
-
if (Array.isArray(offset) && offset.length
|
|
20447
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
20361
20448
|
cross += +offset[1];
|
|
20362
20449
|
parallel += +offset[0];
|
|
20363
20450
|
}
|
|
20364
20451
|
if (width) {
|
|
20365
20452
|
if (["bottom", "top"].includes(direction)) {
|
|
20366
|
-
const h = direction
|
|
20453
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
20367
20454
|
styles.top = `${top + h}px`;
|
|
20368
20455
|
if (!skew) {
|
|
20369
20456
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
20370
20457
|
}
|
|
20371
|
-
if (skew
|
|
20458
|
+
if (skew === "start") {
|
|
20372
20459
|
styles.left = `${left + parallel}px`;
|
|
20373
20460
|
}
|
|
20374
|
-
if (skew
|
|
20461
|
+
if (skew === "end") {
|
|
20375
20462
|
styles.left = `${right + parallel}px`;
|
|
20376
20463
|
}
|
|
20377
20464
|
}
|
|
20378
20465
|
if (["left", "right"].includes(direction)) {
|
|
20379
|
-
const contentW = direction
|
|
20466
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
20380
20467
|
styles.left = `${left + contentW}px`;
|
|
20381
20468
|
if (!skew) {
|
|
20382
20469
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
20383
20470
|
}
|
|
20384
|
-
if (skew
|
|
20471
|
+
if (skew === "start") {
|
|
20385
20472
|
styles.top = `${top + parallel}px`;
|
|
20386
20473
|
}
|
|
20387
|
-
if (skew
|
|
20474
|
+
if (skew === "end") {
|
|
20388
20475
|
styles.top = `${top + height + parallel}px`;
|
|
20389
20476
|
}
|
|
20390
20477
|
}
|
|
@@ -20836,7 +20923,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20836
20923
|
name: ""
|
|
20837
20924
|
};
|
|
20838
20925
|
const Swipe = React.forwardRef((props, instanceRef) => {
|
|
20839
|
-
const
|
|
20926
|
+
const classPrefix2 = "nut-swipe";
|
|
20840
20927
|
const touch = useTouch();
|
|
20841
20928
|
const { children, className, style } = { ...defaultProps$s, ...props };
|
|
20842
20929
|
const root2 = React.useRef();
|
|
@@ -20957,7 +21044,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20957
21044
|
"div",
|
|
20958
21045
|
{
|
|
20959
21046
|
ref: measuredRef,
|
|
20960
|
-
className: `${
|
|
21047
|
+
className: `${classPrefix2}__${side}`,
|
|
20961
21048
|
onClick: (e) => handleOperate(e, side)
|
|
20962
21049
|
},
|
|
20963
21050
|
props[`${side}Action`]
|
|
@@ -20997,13 +21084,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20997
21084
|
"div",
|
|
20998
21085
|
{
|
|
20999
21086
|
ref: root2,
|
|
21000
|
-
className: classNames(
|
|
21087
|
+
className: classNames(classPrefix2, className),
|
|
21001
21088
|
onTouchStart: (e) => onTouchStart(e),
|
|
21002
21089
|
onTouchMove: (e) => onTouchMove(e),
|
|
21003
21090
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
21004
21091
|
style
|
|
21005
21092
|
},
|
|
21006
|
-
/* @__PURE__ */ React.createElement("div", { className: `${
|
|
21093
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef))
|
|
21007
21094
|
);
|
|
21008
21095
|
});
|
|
21009
21096
|
Swipe.defaultProps = defaultProps$s;
|