@nutui/nutui-react 2.0.0-alpha.16 → 2.0.0-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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 +64 -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.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/formitem2.js +87 -69
- 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/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 +244 -173
- package/dist/nutui.react.umd.js +244 -173
- package/dist/packages/actionsheet/actionsheet.scss +6 -6
- package/dist/packages/divider/divider.scss +8 -7
- package/dist/packages/formitem/formitem.scss +1 -13
- package/dist/packages/layout/layout.scss +0 -2
- package/dist/packages/pagination/pagination.scss +8 -30
- 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/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.17 Wed Jun 14 2023 16:27:27 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();
|
|
@@ -13834,7 +13838,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13834
13838
|
Cascader.defaultProps = defaultProps$Z;
|
|
13835
13839
|
Cascader.displayName = "NutCascader";
|
|
13836
13840
|
const CheckboxGroupContext = React.createContext(null);
|
|
13837
|
-
const Context = CheckboxGroupContext;
|
|
13841
|
+
const Context$1 = CheckboxGroupContext;
|
|
13838
13842
|
const defaultProps$Y = {
|
|
13839
13843
|
max: void 0,
|
|
13840
13844
|
labelPosition: "right",
|
|
@@ -13905,7 +13909,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13905
13909
|
});
|
|
13906
13910
|
}, [options2, max]);
|
|
13907
13911
|
return /* @__PURE__ */ React.createElement(
|
|
13908
|
-
Context.Provider,
|
|
13912
|
+
Context$1.Provider,
|
|
13909
13913
|
{
|
|
13910
13914
|
value: {
|
|
13911
13915
|
labelPosition: labelPosition || "right",
|
|
@@ -13968,7 +13972,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13968
13972
|
...others
|
|
13969
13973
|
} = props;
|
|
13970
13974
|
let { labelPosition, ...rest } = others;
|
|
13971
|
-
const ctx2 = React.useContext(Context);
|
|
13975
|
+
const ctx2 = React.useContext(Context$1);
|
|
13972
13976
|
let [innerChecked, setChecked] = usePropsValue({
|
|
13973
13977
|
value: props.checked,
|
|
13974
13978
|
defaultValue: props.defaultChecked,
|
|
@@ -14349,7 +14353,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14349
14353
|
}
|
|
14350
14354
|
const defaultProps$W = {
|
|
14351
14355
|
...ComponentDefaults,
|
|
14352
|
-
visible: false,
|
|
14353
14356
|
title: "",
|
|
14354
14357
|
options: [],
|
|
14355
14358
|
value: [],
|
|
@@ -14386,12 +14389,26 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14386
14389
|
(_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
|
|
14387
14390
|
}
|
|
14388
14391
|
});
|
|
14392
|
+
const [innerVisible, setInnerVisible] = usePropsValue({
|
|
14393
|
+
value: props.visible,
|
|
14394
|
+
defaultValue: false,
|
|
14395
|
+
finalValue: false
|
|
14396
|
+
});
|
|
14389
14397
|
const [innerValue, setInnerValue] = React.useState(selectedValue);
|
|
14390
14398
|
const [columnIndex, setColumnIndex] = React.useState(0);
|
|
14391
14399
|
const pickerRef = React.useRef(null);
|
|
14392
14400
|
const [refs, setRefs] = useRefs();
|
|
14393
14401
|
const [columnsList, setColumnsList] = React.useState([]);
|
|
14394
14402
|
const isConfirmEvent = React.useRef(false);
|
|
14403
|
+
const actions = {
|
|
14404
|
+
open: () => {
|
|
14405
|
+
setInnerVisible(true);
|
|
14406
|
+
},
|
|
14407
|
+
close: () => {
|
|
14408
|
+
setInnerVisible(false);
|
|
14409
|
+
}
|
|
14410
|
+
};
|
|
14411
|
+
React.useImperativeHandle(ref, () => actions);
|
|
14395
14412
|
const formatCascade = (columns, values) => {
|
|
14396
14413
|
const formatted = [];
|
|
14397
14414
|
let columnOptions = {
|
|
@@ -14453,12 +14470,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14453
14470
|
};
|
|
14454
14471
|
React.useEffect(() => {
|
|
14455
14472
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
14456
|
-
}, [
|
|
14473
|
+
}, [innerVisible]);
|
|
14457
14474
|
React.useEffect(() => {
|
|
14458
|
-
if (
|
|
14475
|
+
if (innerVisible) {
|
|
14459
14476
|
init();
|
|
14460
14477
|
}
|
|
14461
|
-
}, [options2,
|
|
14478
|
+
}, [options2, innerVisible]);
|
|
14462
14479
|
React.useEffect(() => {
|
|
14463
14480
|
onChange && onChange(setSelectedOptions(), innerValue, columnIndex);
|
|
14464
14481
|
}, [innerValue, columnsList]);
|
|
@@ -14531,6 +14548,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14531
14548
|
}, 0);
|
|
14532
14549
|
};
|
|
14533
14550
|
const closePicker = () => {
|
|
14551
|
+
setInnerVisible(false);
|
|
14534
14552
|
onClose && onClose(setSelectedOptions(), innerValue);
|
|
14535
14553
|
afterClose && afterClose(setSelectedOptions(), innerValue, pickerRef);
|
|
14536
14554
|
};
|
|
@@ -14539,21 +14557,34 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14539
14557
|
"span",
|
|
14540
14558
|
{
|
|
14541
14559
|
className: `${classPrefix2}__cancel-btn`,
|
|
14542
|
-
onClick: () =>
|
|
14560
|
+
onClick: (e) => {
|
|
14561
|
+
e.stopPropagation();
|
|
14562
|
+
closePicker();
|
|
14563
|
+
}
|
|
14543
14564
|
},
|
|
14544
14565
|
locale.cancel
|
|
14545
|
-
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
14566
|
+
), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React.createElement(
|
|
14567
|
+
"span",
|
|
14568
|
+
{
|
|
14569
|
+
className: `${classPrefix2}__confirm-btn`,
|
|
14570
|
+
onClick: (e) => {
|
|
14571
|
+
e.stopPropagation();
|
|
14572
|
+
confirm2();
|
|
14573
|
+
}
|
|
14574
|
+
},
|
|
14575
|
+
locale.confirm
|
|
14576
|
+
));
|
|
14546
14577
|
};
|
|
14547
|
-
return /* @__PURE__ */ React.createElement(
|
|
14578
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React.createElement(
|
|
14548
14579
|
Popup,
|
|
14549
14580
|
{
|
|
14550
|
-
visible,
|
|
14581
|
+
visible: innerVisible,
|
|
14551
14582
|
position: "bottom",
|
|
14552
14583
|
afterClose: () => {
|
|
14553
14584
|
closePicker();
|
|
14554
14585
|
}
|
|
14555
14586
|
},
|
|
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) => {
|
|
14587
|
+
/* @__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
14588
|
return /* @__PURE__ */ React.createElement(
|
|
14558
14589
|
PickerPanel$1,
|
|
14559
14590
|
{
|
|
@@ -14568,7 +14599,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14568
14599
|
}
|
|
14569
14600
|
);
|
|
14570
14601
|
})))
|
|
14571
|
-
);
|
|
14602
|
+
));
|
|
14572
14603
|
};
|
|
14573
14604
|
const Picker = React.forwardRef(InternalPicker);
|
|
14574
14605
|
const Picker$1 = Picker;
|
|
@@ -14872,7 +14903,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14872
14903
|
};
|
|
14873
14904
|
DatePicker.defaultProps = defaultProps$V;
|
|
14874
14905
|
DatePicker.displayName = "NutDatePicker";
|
|
14875
|
-
const
|
|
14906
|
+
const Context = React.createContext({});
|
|
14876
14907
|
function _extends() {
|
|
14877
14908
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
14878
14909
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -15928,13 +15959,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15928
15959
|
Schema.validators = validators;
|
|
15929
15960
|
class FormStore {
|
|
15930
15961
|
constructor() {
|
|
15931
|
-
|
|
15962
|
+
// 初始化数据
|
|
15963
|
+
__publicField(this, "initialValues", {});
|
|
15932
15964
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
15933
|
-
__publicField(this, "
|
|
15965
|
+
__publicField(this, "store", {});
|
|
15934
15966
|
// 所有的组件实例
|
|
15935
|
-
|
|
15967
|
+
__publicField(this, "fieldEntities", []);
|
|
15968
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
15936
15969
|
__publicField(this, "callbacks", {});
|
|
15937
|
-
__publicField(this, "
|
|
15970
|
+
__publicField(this, "errors", []);
|
|
15938
15971
|
/**
|
|
15939
15972
|
* 注册组件实例
|
|
15940
15973
|
* @param field
|
|
@@ -15943,11 +15976,29 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15943
15976
|
this.fieldEntities.push(field);
|
|
15944
15977
|
return () => {
|
|
15945
15978
|
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
15946
|
-
|
|
15979
|
+
if (this.store) {
|
|
15980
|
+
delete this.store[field.props.name];
|
|
15981
|
+
}
|
|
15947
15982
|
};
|
|
15948
15983
|
});
|
|
15984
|
+
/**
|
|
15985
|
+
* 获取 formItem 的值
|
|
15986
|
+
* @param name
|
|
15987
|
+
*/
|
|
15949
15988
|
__publicField(this, "getFieldValue", (name) => {
|
|
15950
|
-
|
|
15989
|
+
var _a2;
|
|
15990
|
+
return (_a2 = this.store) == null ? void 0 : _a2[name];
|
|
15991
|
+
});
|
|
15992
|
+
/**
|
|
15993
|
+
* 设置 form 的初始值,之后在 reset 的时候使用
|
|
15994
|
+
* @param values
|
|
15995
|
+
* @param init
|
|
15996
|
+
*/
|
|
15997
|
+
__publicField(this, "setInitialValues", (values, init) => {
|
|
15998
|
+
if (init) {
|
|
15999
|
+
this.initialValues = values;
|
|
16000
|
+
this.store = values;
|
|
16001
|
+
}
|
|
15951
16002
|
});
|
|
15952
16003
|
/**
|
|
15953
16004
|
* 存储组件数据
|
|
@@ -15962,34 +16013,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15962
16013
|
const { name } = enetity.props;
|
|
15963
16014
|
Object.keys(newStore).forEach((key) => {
|
|
15964
16015
|
if (key === name) {
|
|
15965
|
-
enetity.onStoreChange();
|
|
16016
|
+
enetity.onStoreChange("update");
|
|
15966
16017
|
}
|
|
15967
16018
|
});
|
|
15968
16019
|
});
|
|
15969
16020
|
});
|
|
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
|
-
*/
|
|
16021
|
+
__publicField(this, "setCallback", (callback) => {
|
|
16022
|
+
this.callbacks = {
|
|
16023
|
+
...this.callbacks,
|
|
16024
|
+
...callback
|
|
16025
|
+
};
|
|
16026
|
+
});
|
|
15983
16027
|
__publicField(this, "validate", () => {
|
|
15984
16028
|
const err = [];
|
|
15985
|
-
this.
|
|
16029
|
+
this.errors.length = 0;
|
|
15986
16030
|
this.fieldEntities.forEach((entity) => {
|
|
16031
|
+
var _a2;
|
|
15987
16032
|
const { name, rules: rules2 = [] } = entity.props;
|
|
15988
16033
|
const descriptor = {};
|
|
15989
16034
|
if (rules2.length) {
|
|
15990
16035
|
if (rules2.length > 1) {
|
|
15991
16036
|
descriptor[name] = [];
|
|
15992
|
-
rules2.
|
|
16037
|
+
rules2.forEach((v) => {
|
|
15993
16038
|
descriptor[name].push(v);
|
|
15994
16039
|
});
|
|
15995
16040
|
} else {
|
|
@@ -15997,39 +16042,36 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15997
16042
|
}
|
|
15998
16043
|
}
|
|
15999
16044
|
const validator = new Schema(descriptor);
|
|
16000
|
-
validator.
|
|
16045
|
+
validator.messages();
|
|
16046
|
+
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16001
16047
|
if (errors) {
|
|
16002
16048
|
err.push(...errors);
|
|
16003
|
-
this.
|
|
16049
|
+
this.errors.push(...errors);
|
|
16004
16050
|
}
|
|
16005
|
-
entity.onStoreChange();
|
|
16051
|
+
entity.onStoreChange("validate");
|
|
16006
16052
|
});
|
|
16007
16053
|
});
|
|
16008
16054
|
return err;
|
|
16009
16055
|
});
|
|
16010
|
-
__publicField(this, "setCallback", (callback) => {
|
|
16011
|
-
this.callbacks = {
|
|
16012
|
-
...this.callbacks,
|
|
16013
|
-
...callback
|
|
16014
|
-
};
|
|
16015
|
-
});
|
|
16016
16056
|
__publicField(this, "submit", () => {
|
|
16017
16057
|
var _a2, _b, _c, _d;
|
|
16018
|
-
const
|
|
16019
|
-
if (
|
|
16058
|
+
const errors = this.validate();
|
|
16059
|
+
if (errors.length === 0) {
|
|
16020
16060
|
(_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,
|
|
16061
|
+
} else if (errors.length > 0) {
|
|
16062
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
|
|
16023
16063
|
}
|
|
16024
16064
|
});
|
|
16025
16065
|
__publicField(this, "resetFields", () => {
|
|
16026
|
-
this.
|
|
16027
|
-
this.
|
|
16028
|
-
|
|
16066
|
+
this.errors.length = 0;
|
|
16067
|
+
this.store = this.initialValues;
|
|
16068
|
+
this.fieldEntities.forEach((entity) => {
|
|
16069
|
+
entity.onStoreChange("reset");
|
|
16029
16070
|
});
|
|
16030
16071
|
});
|
|
16031
16072
|
__publicField(this, "getForm", () => {
|
|
16032
16073
|
return {
|
|
16074
|
+
setInitialValues: this.setInitialValues,
|
|
16033
16075
|
setCallback: this.setCallback,
|
|
16034
16076
|
registerField: this.registerField,
|
|
16035
16077
|
getFieldValue: this.getFieldValue,
|
|
@@ -16037,12 +16079,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16037
16079
|
resetFields: this.resetFields,
|
|
16038
16080
|
submit: this.submit,
|
|
16039
16081
|
store: this.store,
|
|
16040
|
-
|
|
16082
|
+
errors: this.errors,
|
|
16041
16083
|
fieldEntities: this.fieldEntities
|
|
16042
16084
|
};
|
|
16043
16085
|
});
|
|
16044
16086
|
this.callbacks = {
|
|
16045
|
-
onFinish: (
|
|
16087
|
+
onFinish: () => {
|
|
16046
16088
|
},
|
|
16047
16089
|
onFinishFailed: () => {
|
|
16048
16090
|
}
|
|
@@ -16061,98 +16103,113 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16061
16103
|
}
|
|
16062
16104
|
return [formRef.current];
|
|
16063
16105
|
};
|
|
16106
|
+
function isForwardRefComponent(component) {
|
|
16107
|
+
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
16108
|
+
React.forwardRef(
|
|
16109
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16110
|
+
// @ts-ignore
|
|
16111
|
+
() => {
|
|
16112
|
+
}
|
|
16113
|
+
).$$typeof === component.type.$$typeof;
|
|
16114
|
+
}
|
|
16064
16115
|
const defaultProps$U = {
|
|
16065
16116
|
...ComponentDefaults,
|
|
16117
|
+
required: false,
|
|
16066
16118
|
name: "",
|
|
16067
16119
|
label: "",
|
|
16068
|
-
className: "",
|
|
16069
16120
|
rules: [{ required: false, message: "" }],
|
|
16070
|
-
|
|
16071
|
-
labelWidth: 90,
|
|
16072
|
-
errorMessageAlign: "left",
|
|
16073
|
-
showErrorLine: true,
|
|
16074
|
-
showErrorMessage: true,
|
|
16075
|
-
initialValue: ""
|
|
16121
|
+
errorMessageAlign: "left"
|
|
16076
16122
|
};
|
|
16077
16123
|
class FormItem extends React.Component {
|
|
16078
|
-
constructor() {
|
|
16079
|
-
super(
|
|
16124
|
+
constructor(props) {
|
|
16125
|
+
super(props);
|
|
16080
16126
|
__publicField(this, "cancelRegister");
|
|
16081
|
-
__publicField(this, "
|
|
16127
|
+
__publicField(this, "componentRef");
|
|
16082
16128
|
// children添加value属性和onChange事件
|
|
16083
16129
|
__publicField(this, "getControlled", (children) => {
|
|
16084
|
-
var _a2
|
|
16085
|
-
const {
|
|
16130
|
+
var _a2;
|
|
16131
|
+
const { setFieldsValue, getFieldValue } = this.context;
|
|
16086
16132
|
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;
|
|
16133
|
+
if ((_a2 = children == null ? void 0 : children.props) == null ? void 0 : _a2.defaultValue) {
|
|
16134
|
+
console.warn("通过 initialValue 设置初始值");
|
|
16135
|
+
}
|
|
16136
|
+
const controlled = {
|
|
16137
|
+
...children.props,
|
|
16138
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) || this.props.initialValue,
|
|
16139
|
+
[this.props.trigger || "onChange"]: (...args) => {
|
|
16140
|
+
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
16098
16141
|
if (originOnChange) {
|
|
16099
|
-
originOnChange(
|
|
16142
|
+
originOnChange(...args);
|
|
16100
16143
|
}
|
|
16101
|
-
let
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
newValue = event.target.value;
|
|
16105
|
-
break;
|
|
16144
|
+
let [next] = args;
|
|
16145
|
+
if (this.props.getValueFromEvent) {
|
|
16146
|
+
next = this.props.getValueFromEvent(...args);
|
|
16106
16147
|
}
|
|
16107
|
-
setFieldsValue({ [name]:
|
|
16148
|
+
setFieldsValue({ [name]: next });
|
|
16108
16149
|
}
|
|
16109
16150
|
};
|
|
16151
|
+
if (isForwardRefComponent(children)) {
|
|
16152
|
+
controlled.ref = (componentInstance) => {
|
|
16153
|
+
const originRef = children.ref;
|
|
16154
|
+
if (originRef) {
|
|
16155
|
+
if (typeof originRef === "function") {
|
|
16156
|
+
originRef(componentInstance);
|
|
16157
|
+
}
|
|
16158
|
+
if ("current" in originRef) {
|
|
16159
|
+
originRef.current = componentInstance;
|
|
16160
|
+
}
|
|
16161
|
+
}
|
|
16162
|
+
this.componentRef = componentInstance;
|
|
16163
|
+
};
|
|
16164
|
+
}
|
|
16165
|
+
return controlled;
|
|
16166
|
+
});
|
|
16167
|
+
__publicField(this, "refresh", () => {
|
|
16168
|
+
this.setState(({ resetCount }) => ({
|
|
16169
|
+
resetCount: resetCount + 1
|
|
16170
|
+
}));
|
|
16110
16171
|
});
|
|
16111
|
-
__publicField(this, "onStoreChange", () => {
|
|
16112
|
-
|
|
16172
|
+
__publicField(this, "onStoreChange", (type2) => {
|
|
16173
|
+
if (type2 === "reset") {
|
|
16174
|
+
this.refresh();
|
|
16175
|
+
} else {
|
|
16176
|
+
this.forceUpdate();
|
|
16177
|
+
}
|
|
16113
16178
|
});
|
|
16114
16179
|
__publicField(this, "renderLayout", (childNode) => {
|
|
16115
16180
|
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
|
-
} = {
|
|
16181
|
+
const { label, name, required: required2, className, style, errorMessageAlign } = {
|
|
16126
16182
|
...defaultProps$U,
|
|
16127
16183
|
...this.props
|
|
16128
16184
|
};
|
|
16129
|
-
const item = ((_a2 = this.context.
|
|
16185
|
+
const item = ((_a2 = this.context.errors) == null ? void 0 : _a2.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
16130
16186
|
return item2.field === name;
|
|
16131
16187
|
}));
|
|
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",
|
|
16188
|
+
const { starPosition } = this.context;
|
|
16189
|
+
const renderStar = required2 && /* @__PURE__ */ React.createElement("i", { className: "required" });
|
|
16190
|
+
const renderLabel = /* @__PURE__ */ React.createElement(React.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
|
|
16191
|
+
return /* @__PURE__ */ React.createElement(
|
|
16192
|
+
Cell,
|
|
16146
16193
|
{
|
|
16147
|
-
className:
|
|
16148
|
-
style
|
|
16194
|
+
className: `nut-form-item ${className}`,
|
|
16195
|
+
style,
|
|
16196
|
+
onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
|
|
16149
16197
|
},
|
|
16150
|
-
|
|
16151
|
-
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16198
|
+
label ? /* @__PURE__ */ React.createElement("div", { className: "nut-cell__title nut-form-item__label" }, renderLabel) : null,
|
|
16199
|
+
/* @__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(
|
|
16200
|
+
"div",
|
|
16201
|
+
{
|
|
16202
|
+
className: "nut-form-item__body__tips",
|
|
16203
|
+
style: { textAlign: errorMessageAlign }
|
|
16204
|
+
},
|
|
16205
|
+
item[0].message
|
|
16206
|
+
))
|
|
16207
|
+
);
|
|
16155
16208
|
});
|
|
16209
|
+
this.componentRef = React.createRef();
|
|
16210
|
+
this.state = {
|
|
16211
|
+
resetCount: 1
|
|
16212
|
+
};
|
|
16156
16213
|
}
|
|
16157
16214
|
componentDidMount() {
|
|
16158
16215
|
this.cancelRegister = this.context.registerField(this);
|
|
@@ -16163,81 +16220,86 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16163
16220
|
}
|
|
16164
16221
|
}
|
|
16165
16222
|
render() {
|
|
16166
|
-
const { children
|
|
16167
|
-
const
|
|
16168
|
-
let restCNode = c;
|
|
16169
|
-
if (initialValue) {
|
|
16170
|
-
restCNode = React.cloneElement(c, {
|
|
16171
|
-
defaultValue: initialValue
|
|
16172
|
-
});
|
|
16173
|
-
}
|
|
16223
|
+
const { children } = this.props;
|
|
16224
|
+
const child = Array.isArray(children) ? children[0] : children;
|
|
16174
16225
|
const returnChildNode = React.cloneElement(
|
|
16175
|
-
|
|
16176
|
-
this.getControlled(
|
|
16226
|
+
child,
|
|
16227
|
+
this.getControlled(child)
|
|
16177
16228
|
);
|
|
16178
|
-
return this.renderLayout(returnChildNode);
|
|
16229
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
16179
16230
|
}
|
|
16180
16231
|
}
|
|
16181
16232
|
__publicField(FormItem, "defaultProps", defaultProps$U);
|
|
16182
|
-
__publicField(FormItem, "contextType",
|
|
16233
|
+
__publicField(FormItem, "contextType", Context);
|
|
16183
16234
|
const defaultProps$T = {
|
|
16184
16235
|
...ComponentDefaults,
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
labelPosition: "Right",
|
|
16189
|
-
formGroupTitle: "",
|
|
16190
|
-
onFinish: (obj) => {
|
|
16191
|
-
},
|
|
16192
|
-
onFinishFailed: (value) => {
|
|
16236
|
+
labelPosition: "right",
|
|
16237
|
+
starPosition: "left",
|
|
16238
|
+
onFinish: (values) => {
|
|
16193
16239
|
},
|
|
16194
|
-
|
|
16240
|
+
onFinishFailed: (values, errorFields) => {
|
|
16241
|
+
}
|
|
16195
16242
|
};
|
|
16196
16243
|
const PositionInfo = {
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
|
|
16244
|
+
top: "form-layout-top",
|
|
16245
|
+
left: "form-layout-left",
|
|
16246
|
+
right: "form-layout-right"
|
|
16200
16247
|
};
|
|
16201
16248
|
const Form = (props) => {
|
|
16249
|
+
const classPrefix2 = "nut-form";
|
|
16202
16250
|
const {
|
|
16251
|
+
className,
|
|
16252
|
+
style,
|
|
16253
|
+
footer,
|
|
16203
16254
|
children,
|
|
16255
|
+
initialValues,
|
|
16204
16256
|
onFinish,
|
|
16205
16257
|
onFinishFailed,
|
|
16206
16258
|
labelPosition,
|
|
16207
|
-
|
|
16208
|
-
form
|
|
16209
|
-
...rest
|
|
16259
|
+
starPosition,
|
|
16260
|
+
form
|
|
16210
16261
|
} = {
|
|
16211
16262
|
...defaultProps$T,
|
|
16212
16263
|
...props
|
|
16213
16264
|
};
|
|
16214
|
-
let formInstance
|
|
16215
|
-
if (
|
|
16265
|
+
let formInstance;
|
|
16266
|
+
if (form !== void 0) {
|
|
16216
16267
|
formInstance = form;
|
|
16217
16268
|
} else {
|
|
16218
16269
|
[formInstance] = useForm();
|
|
16219
16270
|
}
|
|
16220
|
-
formInstance.
|
|
16221
|
-
const { setCallback, submit, resetFields } = formInstance;
|
|
16271
|
+
formInstance.starPosition = starPosition;
|
|
16272
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16222
16273
|
setCallback({
|
|
16223
16274
|
onFinish,
|
|
16224
16275
|
onFinishFailed
|
|
16225
16276
|
});
|
|
16277
|
+
const mountRef = React.useRef(false);
|
|
16278
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
16279
|
+
if (!mountRef.current) {
|
|
16280
|
+
mountRef.current = true;
|
|
16281
|
+
}
|
|
16226
16282
|
return /* @__PURE__ */ React.createElement(
|
|
16227
16283
|
"form",
|
|
16228
16284
|
{
|
|
16229
|
-
className:
|
|
16230
|
-
|
|
16285
|
+
className: classNames(
|
|
16286
|
+
classPrefix2,
|
|
16287
|
+
className,
|
|
16288
|
+
PositionInfo[labelPosition]
|
|
16289
|
+
),
|
|
16290
|
+
style,
|
|
16231
16291
|
onSubmit: (e) => {
|
|
16232
16292
|
e.preventDefault();
|
|
16293
|
+
e.stopPropagation();
|
|
16233
16294
|
submit();
|
|
16234
16295
|
},
|
|
16235
16296
|
onReset: (e) => {
|
|
16236
16297
|
e.preventDefault();
|
|
16298
|
+
e.stopPropagation();
|
|
16237
16299
|
resetFields();
|
|
16238
16300
|
}
|
|
16239
16301
|
},
|
|
16240
|
-
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(
|
|
16302
|
+
/* @__PURE__ */ React.createElement(CellGroup, null, /* @__PURE__ */ React.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React.createElement(Cell, null, footer) : null)
|
|
16241
16303
|
);
|
|
16242
16304
|
};
|
|
16243
16305
|
Form.defaultProps = defaultProps$T;
|
|
@@ -16453,7 +16515,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16453
16515
|
disabled: false,
|
|
16454
16516
|
min: 1,
|
|
16455
16517
|
max: 9999,
|
|
16456
|
-
|
|
16518
|
+
readOnly: false,
|
|
16457
16519
|
allowEmpty: false,
|
|
16458
16520
|
defaultValue: 0,
|
|
16459
16521
|
step: 1,
|
|
@@ -16467,7 +16529,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16467
16529
|
disabled,
|
|
16468
16530
|
min,
|
|
16469
16531
|
max,
|
|
16470
|
-
|
|
16532
|
+
readOnly,
|
|
16471
16533
|
value,
|
|
16472
16534
|
defaultValue,
|
|
16473
16535
|
allowEmpty,
|
|
@@ -16626,14 +16688,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16626
16688
|
const focusValue = (e) => {
|
|
16627
16689
|
if (disabled)
|
|
16628
16690
|
return;
|
|
16629
|
-
if (
|
|
16691
|
+
if (readOnly)
|
|
16630
16692
|
return;
|
|
16631
16693
|
onFocus && onFocus(e);
|
|
16632
16694
|
};
|
|
16633
16695
|
const burValue = (e) => {
|
|
16634
16696
|
if (disabled)
|
|
16635
16697
|
return;
|
|
16636
|
-
if (
|
|
16698
|
+
if (readOnly)
|
|
16637
16699
|
return;
|
|
16638
16700
|
const input = e.target;
|
|
16639
16701
|
let value2 = input.valueAsNumber;
|
|
@@ -16661,7 +16723,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16661
16723
|
min,
|
|
16662
16724
|
max,
|
|
16663
16725
|
disabled,
|
|
16664
|
-
readOnly
|
|
16726
|
+
readOnly,
|
|
16665
16727
|
value: _checked,
|
|
16666
16728
|
onInput: changeFormatValue,
|
|
16667
16729
|
onBlur: burFormatValue,
|
|
@@ -16674,7 +16736,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16674
16736
|
min,
|
|
16675
16737
|
max,
|
|
16676
16738
|
disabled,
|
|
16677
|
-
readOnly
|
|
16739
|
+
readOnly,
|
|
16678
16740
|
value: _checked,
|
|
16679
16741
|
onInput: changeValue,
|
|
16680
16742
|
onBlur: burValue,
|
|
@@ -17866,7 +17928,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17866
17928
|
return /* @__PURE__ */ React.createElement(
|
|
17867
17929
|
"input",
|
|
17868
17930
|
{
|
|
17869
|
-
className: `${classPrefix2}__input ${
|
|
17931
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
17870
17932
|
ref: searchRef,
|
|
17871
17933
|
style: { ...props.style },
|
|
17872
17934
|
value: value || "",
|
|
@@ -17939,7 +18001,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17939
18001
|
style: { ...props.style }
|
|
17940
18002
|
},
|
|
17941
18003
|
renderLeft(),
|
|
17942
|
-
/* @__PURE__ */ React.createElement(
|
|
18004
|
+
/* @__PURE__ */ React.createElement(
|
|
18005
|
+
"div",
|
|
18006
|
+
{
|
|
18007
|
+
className: `${classPrefix2}__content ${shape === "round" ? `${classPrefix2}__round` : ""}`
|
|
18008
|
+
},
|
|
18009
|
+
renderLeftIn(),
|
|
18010
|
+
renderField(),
|
|
18011
|
+
renderRightIn(),
|
|
18012
|
+
clearable && value && handleClear()
|
|
18013
|
+
),
|
|
17943
18014
|
renderRight()
|
|
17944
18015
|
);
|
|
17945
18016
|
};
|
|
@@ -20347,7 +20418,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20347
20418
|
return styles;
|
|
20348
20419
|
};
|
|
20349
20420
|
const getRootPosition = () => {
|
|
20350
|
-
|
|
20421
|
+
const styles = {};
|
|
20351
20422
|
if (!rootPosition)
|
|
20352
20423
|
return {};
|
|
20353
20424
|
const contentWidth = elWidth;
|
|
@@ -20357,34 +20428,34 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20357
20428
|
const skew = location.split("-")[1];
|
|
20358
20429
|
let cross = 0;
|
|
20359
20430
|
let parallel = 0;
|
|
20360
|
-
if (Array.isArray(offset) && offset.length
|
|
20431
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
20361
20432
|
cross += +offset[1];
|
|
20362
20433
|
parallel += +offset[0];
|
|
20363
20434
|
}
|
|
20364
20435
|
if (width) {
|
|
20365
20436
|
if (["bottom", "top"].includes(direction)) {
|
|
20366
|
-
const h = direction
|
|
20437
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
20367
20438
|
styles.top = `${top + h}px`;
|
|
20368
20439
|
if (!skew) {
|
|
20369
20440
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
20370
20441
|
}
|
|
20371
|
-
if (skew
|
|
20442
|
+
if (skew === "start") {
|
|
20372
20443
|
styles.left = `${left + parallel}px`;
|
|
20373
20444
|
}
|
|
20374
|
-
if (skew
|
|
20445
|
+
if (skew === "end") {
|
|
20375
20446
|
styles.left = `${right + parallel}px`;
|
|
20376
20447
|
}
|
|
20377
20448
|
}
|
|
20378
20449
|
if (["left", "right"].includes(direction)) {
|
|
20379
|
-
const contentW = direction
|
|
20450
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
20380
20451
|
styles.left = `${left + contentW}px`;
|
|
20381
20452
|
if (!skew) {
|
|
20382
20453
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
20383
20454
|
}
|
|
20384
|
-
if (skew
|
|
20455
|
+
if (skew === "start") {
|
|
20385
20456
|
styles.top = `${top + parallel}px`;
|
|
20386
20457
|
}
|
|
20387
|
-
if (skew
|
|
20458
|
+
if (skew === "end") {
|
|
20388
20459
|
styles.top = `${top + height + parallel}px`;
|
|
20389
20460
|
}
|
|
20390
20461
|
}
|
|
@@ -20836,7 +20907,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20836
20907
|
name: ""
|
|
20837
20908
|
};
|
|
20838
20909
|
const Swipe = React.forwardRef((props, instanceRef) => {
|
|
20839
|
-
const
|
|
20910
|
+
const classPrefix2 = "nut-swipe";
|
|
20840
20911
|
const touch = useTouch();
|
|
20841
20912
|
const { children, className, style } = { ...defaultProps$s, ...props };
|
|
20842
20913
|
const root2 = React.useRef();
|
|
@@ -20957,7 +21028,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20957
21028
|
"div",
|
|
20958
21029
|
{
|
|
20959
21030
|
ref: measuredRef,
|
|
20960
|
-
className: `${
|
|
21031
|
+
className: `${classPrefix2}__${side}`,
|
|
20961
21032
|
onClick: (e) => handleOperate(e, side)
|
|
20962
21033
|
},
|
|
20963
21034
|
props[`${side}Action`]
|
|
@@ -20997,13 +21068,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20997
21068
|
"div",
|
|
20998
21069
|
{
|
|
20999
21070
|
ref: root2,
|
|
21000
|
-
className: classNames(
|
|
21071
|
+
className: classNames(classPrefix2, className),
|
|
21001
21072
|
onTouchStart: (e) => onTouchStart(e),
|
|
21002
21073
|
onTouchMove: (e) => onTouchMove(e),
|
|
21003
21074
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
21004
21075
|
style
|
|
21005
21076
|
},
|
|
21006
|
-
/* @__PURE__ */ React.createElement("div", { className: `${
|
|
21077
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef))
|
|
21007
21078
|
);
|
|
21008
21079
|
});
|
|
21009
21080
|
Swipe.defaultProps = defaultProps$s;
|