@nutui/nutui-react 2.0.0-alpha.15 → 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 +26 -0
- package/dist/esm/ActionSheet/style/style.css +1 -1
- package/dist/esm/Button.js +4 -2
- package/dist/esm/DatePicker.js +54 -58
- package/dist/esm/Dialog/style/index.js +1 -0
- package/dist/esm/Dialog/style/style.css +1 -1
- 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/Menu/style/style.css +1 -1
- package/dist/esm/Menu.js +5 -3
- package/dist/esm/MenuItem/style/style.css +1 -1
- package/dist/esm/MenuItem.js +31 -44
- package/dist/esm/NoticeBar.js +2 -2
- package/dist/esm/Pagination/style/style.css +1 -1
- package/dist/esm/Picker.js +32 -12
- package/dist/esm/Popover.js +10 -47
- package/dist/esm/Popup.js +2 -1
- package/dist/esm/SearchBar.js +2 -2
- package/dist/esm/Swipe.js +4 -6
- package/dist/esm/Toast.js +16 -7
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/formitem2.js +87 -69
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/src/packages/button/button.d.ts +1 -0
- package/dist/esm/types/src/packages/datepicker/datepicker.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/datepicker.taro.d.ts +11 -17
- package/dist/esm/types/src/packages/datepicker/index.d.ts +1 -0
- package/dist/esm/types/src/packages/datepicker/index.taro.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/nutui.react.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/nutui.taro.react.build.d.ts +2 -2
- 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/toast/Notification.d.ts +4 -1
- package/dist/esm/types/src/utils/is-forward-ref-component.d.ts +1 -0
- package/dist/esm/use-click-away.js +43 -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 +453 -396
- package/dist/nutui.react.umd.js +453 -396
- 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/menuitem/menuitem.scss +1 -1
- package/dist/packages/noticebar/noticebar.scss +0 -3
- 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/datepicker/datepicker.d.ts +79 -25
- package/dist/types/packages/datepicker/index.d.ts +1 -0
- 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/Notification.d.ts +4 -1
- 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();
|
|
@@ -11221,7 +11225,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11221
11225
|
{
|
|
11222
11226
|
classNames: transitionName,
|
|
11223
11227
|
unmountOnExit: true,
|
|
11224
|
-
timeout:
|
|
11228
|
+
timeout: 300,
|
|
11225
11229
|
in: innerVisible,
|
|
11226
11230
|
onEntered: onHandleOpened,
|
|
11227
11231
|
onExited: onHandleClosed
|
|
@@ -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,35 +14599,35 @@ 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;
|
|
14575
14606
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
14576
14607
|
const defaultProps$V = {
|
|
14577
|
-
|
|
14608
|
+
...ComponentDefaults,
|
|
14578
14609
|
visible: false,
|
|
14579
14610
|
title: "",
|
|
14580
14611
|
type: "date",
|
|
14581
|
-
|
|
14612
|
+
showChinese: false,
|
|
14582
14613
|
threeDimensional: true,
|
|
14583
14614
|
minuteStep: 1,
|
|
14584
|
-
|
|
14585
|
-
|
|
14615
|
+
startDate: new Date(currentYear - 10, 0, 1),
|
|
14616
|
+
endDate: new Date(currentYear + 10, 11, 31)
|
|
14586
14617
|
};
|
|
14587
14618
|
const DatePicker = (props) => {
|
|
14588
14619
|
const {
|
|
14589
|
-
|
|
14590
|
-
|
|
14620
|
+
startDate,
|
|
14621
|
+
endDate,
|
|
14591
14622
|
type: type2,
|
|
14592
|
-
|
|
14623
|
+
showChinese,
|
|
14593
14624
|
minuteStep,
|
|
14594
|
-
modelValue,
|
|
14595
14625
|
visible,
|
|
14596
14626
|
title,
|
|
14627
|
+
defaultValue,
|
|
14597
14628
|
formatter,
|
|
14598
|
-
|
|
14599
|
-
|
|
14629
|
+
onClose,
|
|
14630
|
+
onConfirm,
|
|
14600
14631
|
filter,
|
|
14601
14632
|
onChange,
|
|
14602
14633
|
threeDimensional,
|
|
@@ -14608,14 +14639,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14608
14639
|
...props
|
|
14609
14640
|
};
|
|
14610
14641
|
const { locale } = useConfig();
|
|
14611
|
-
const [show2, setShow] = React.useState(false);
|
|
14612
|
-
const [currentDate, setCurrentDate] = React.useState(modelValue);
|
|
14613
|
-
const [defaultValue, setDefaultValue] = React.useState([]);
|
|
14614
|
-
const [options2, setListData] = React.useState([]);
|
|
14615
|
-
const pickerRef = React.useRef(null);
|
|
14616
|
-
const isDate = (val) => {
|
|
14617
|
-
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
14618
|
-
};
|
|
14619
14642
|
const datepickerLang = locale.datepicker;
|
|
14620
14643
|
const zhCNType = {
|
|
14621
14644
|
day: datepickerLang.day,
|
|
@@ -14625,20 +14648,32 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14625
14648
|
minute: datepickerLang.min,
|
|
14626
14649
|
seconds: datepickerLang.seconds
|
|
14627
14650
|
};
|
|
14651
|
+
const [defaultValueOfPicker, setDefaultValueOfPicker] = React.useState([]);
|
|
14652
|
+
const [options2, setOptions] = React.useState([]);
|
|
14653
|
+
const isDate = (val) => {
|
|
14654
|
+
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
14655
|
+
};
|
|
14628
14656
|
const formatValue = (value) => {
|
|
14629
14657
|
let cvalue = value;
|
|
14630
14658
|
if (!cvalue || cvalue && !isDate(cvalue)) {
|
|
14631
|
-
cvalue =
|
|
14659
|
+
cvalue = startDate;
|
|
14632
14660
|
}
|
|
14633
|
-
let timestmp = Math.max(cvalue.getTime(),
|
|
14634
|
-
timestmp = Math.min(timestmp,
|
|
14661
|
+
let timestmp = Math.max(cvalue.getTime(), startDate.getTime());
|
|
14662
|
+
timestmp = Math.min(timestmp, endDate.getTime());
|
|
14635
14663
|
return new Date(timestmp);
|
|
14636
14664
|
};
|
|
14665
|
+
const [currentDate, setCurrentDate] = usePropsValue({
|
|
14666
|
+
value: props.value && formatValue(props.value),
|
|
14667
|
+
defaultValue: formatValue(props.defaultValue || null),
|
|
14668
|
+
finalValue: null,
|
|
14669
|
+
onChange: (val) => {
|
|
14670
|
+
}
|
|
14671
|
+
});
|
|
14637
14672
|
function getMonthEndDay(year, month) {
|
|
14638
14673
|
return new Date(year, month, 0).getDate();
|
|
14639
14674
|
}
|
|
14640
14675
|
const getBoundary = (type22, value) => {
|
|
14641
|
-
const boundary = type22 === "min" ?
|
|
14676
|
+
const boundary = type22 === "min" ? startDate : endDate;
|
|
14642
14677
|
const year = boundary.getFullYear();
|
|
14643
14678
|
let month = 1;
|
|
14644
14679
|
let date2 = 1;
|
|
@@ -14672,12 +14707,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14672
14707
|
[`${type22}Seconds`]: seconds
|
|
14673
14708
|
};
|
|
14674
14709
|
};
|
|
14675
|
-
const ranges = (
|
|
14676
|
-
const curDate =
|
|
14710
|
+
const ranges = () => {
|
|
14711
|
+
const curDate = currentDate;
|
|
14677
14712
|
if (!curDate)
|
|
14678
14713
|
return [];
|
|
14679
|
-
const { maxYear, maxDate
|
|
14680
|
-
const { minYear, minDate
|
|
14714
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
|
|
14715
|
+
const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", curDate);
|
|
14681
14716
|
let result = [
|
|
14682
14717
|
{
|
|
14683
14718
|
type: "year",
|
|
@@ -14689,7 +14724,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14689
14724
|
},
|
|
14690
14725
|
{
|
|
14691
14726
|
type: "day",
|
|
14692
|
-
range: [
|
|
14727
|
+
range: [minDate, maxDate]
|
|
14693
14728
|
},
|
|
14694
14729
|
{
|
|
14695
14730
|
type: "hour",
|
|
@@ -14729,7 +14764,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14729
14764
|
}
|
|
14730
14765
|
return result;
|
|
14731
14766
|
};
|
|
14732
|
-
const updateChooseValueCustmer = (
|
|
14767
|
+
const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
|
|
14733
14768
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
14734
14769
|
type2.toLocaleLowerCase()
|
|
14735
14770
|
)) {
|
|
@@ -14739,11 +14774,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14739
14774
|
});
|
|
14740
14775
|
if (type2.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
|
|
14741
14776
|
formatDate.unshift(
|
|
14742
|
-
new Date(
|
|
14777
|
+
new Date(defaultValue || startDate || endDate).getFullYear()
|
|
14743
14778
|
);
|
|
14744
14779
|
}
|
|
14745
14780
|
if (type2.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
|
|
14746
|
-
formatDate.push(
|
|
14781
|
+
formatDate.push(
|
|
14782
|
+
new Date(defaultValue || startDate || endDate).getDate()
|
|
14783
|
+
);
|
|
14747
14784
|
}
|
|
14748
14785
|
const year = Number(formatDate[0]);
|
|
14749
14786
|
const month = Number(formatDate[1]) - 1;
|
|
@@ -14768,7 +14805,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14768
14805
|
const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date2 == null ? void 0 : date2.getTime());
|
|
14769
14806
|
date2 && isDate(date2) && !isEqual2 && setCurrentDate(formatValue(date2));
|
|
14770
14807
|
}
|
|
14771
|
-
props.onChange && props.onChange(
|
|
14808
|
+
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
14772
14809
|
};
|
|
14773
14810
|
const padZero = (num, targetLength = 2) => {
|
|
14774
14811
|
let str = `${num}`;
|
|
@@ -14786,12 +14823,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14786
14823
|
});
|
|
14787
14824
|
} else {
|
|
14788
14825
|
const padMin = padZero(value, 2);
|
|
14789
|
-
const fatter =
|
|
14826
|
+
const fatter = showChinese ? zhCNType[type22] : "";
|
|
14790
14827
|
fOption = { text: padMin + fatter, value: padMin };
|
|
14791
14828
|
}
|
|
14792
14829
|
return fOption;
|
|
14793
14830
|
};
|
|
14794
14831
|
const generateValue = (min, max, val, type22, columnIndex) => {
|
|
14832
|
+
var _a2;
|
|
14795
14833
|
let cmin = min;
|
|
14796
14834
|
const arr = [];
|
|
14797
14835
|
let index = 0;
|
|
@@ -14806,8 +14844,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14806
14844
|
index++;
|
|
14807
14845
|
}
|
|
14808
14846
|
}
|
|
14809
|
-
|
|
14810
|
-
|
|
14847
|
+
defaultValueOfPicker[columnIndex] = (_a2 = arr[index]) == null ? void 0 : _a2.value;
|
|
14848
|
+
setDefaultValueOfPicker([...defaultValueOfPicker]);
|
|
14811
14849
|
if (props.filter && props.filter(type22, arr)) {
|
|
14812
14850
|
return props.filter(type22, arr);
|
|
14813
14851
|
}
|
|
@@ -14832,8 +14870,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14832
14870
|
}
|
|
14833
14871
|
return d;
|
|
14834
14872
|
};
|
|
14835
|
-
const columns = (
|
|
14836
|
-
const val = ranges(
|
|
14873
|
+
const columns = () => {
|
|
14874
|
+
const val = ranges().map((res, columnIndex) => {
|
|
14837
14875
|
return generateValue(
|
|
14838
14876
|
res.range[0],
|
|
14839
14877
|
res.range[1],
|
|
@@ -14844,46 +14882,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14844
14882
|
});
|
|
14845
14883
|
return val || [];
|
|
14846
14884
|
};
|
|
14847
|
-
React.useEffect(() => {
|
|
14848
|
-
setCurrentDate(formatValue(modelValue));
|
|
14849
|
-
}, []);
|
|
14850
|
-
React.useEffect(() => {
|
|
14851
|
-
setCurrentDate(formatValue(modelValue));
|
|
14852
|
-
}, [modelValue]);
|
|
14853
|
-
React.useEffect(() => {
|
|
14854
|
-
setShow(visible);
|
|
14855
|
-
}, [visible]);
|
|
14856
14885
|
React.useEffect(() => {
|
|
14857
14886
|
if (currentDate) {
|
|
14858
|
-
|
|
14887
|
+
setOptions(columns());
|
|
14859
14888
|
}
|
|
14860
|
-
}, [
|
|
14861
|
-
return /* @__PURE__ */ React.createElement(
|
|
14862
|
-
|
|
14889
|
+
}, []);
|
|
14890
|
+
return /* @__PURE__ */ React.createElement("div", { className: `nut-datepicker ${className}`, style, ...rest }, options2.length && /* @__PURE__ */ React.createElement(
|
|
14891
|
+
Picker$1,
|
|
14863
14892
|
{
|
|
14864
|
-
|
|
14865
|
-
|
|
14866
|
-
|
|
14867
|
-
|
|
14868
|
-
|
|
14869
|
-
|
|
14870
|
-
|
|
14871
|
-
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
onClose: onCloseDatePicker,
|
|
14875
|
-
defaultValue,
|
|
14876
|
-
onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
|
|
14877
|
-
onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
|
|
14878
|
-
threeDimensional,
|
|
14879
|
-
ref: pickerRef
|
|
14880
|
-
}
|
|
14881
|
-
)
|
|
14882
|
-
);
|
|
14893
|
+
title,
|
|
14894
|
+
visible,
|
|
14895
|
+
options: options2,
|
|
14896
|
+
onClose,
|
|
14897
|
+
defaultValue: defaultValueOfPicker,
|
|
14898
|
+
onConfirm: (options22, value) => onConfirm && onConfirm(options22, value),
|
|
14899
|
+
onChange: (options22, value, index) => updateChooseValueCustmer(options22, value, index),
|
|
14900
|
+
threeDimensional
|
|
14901
|
+
}
|
|
14902
|
+
));
|
|
14883
14903
|
};
|
|
14884
14904
|
DatePicker.defaultProps = defaultProps$V;
|
|
14885
14905
|
DatePicker.displayName = "NutDatePicker";
|
|
14886
|
-
const
|
|
14906
|
+
const Context = React.createContext({});
|
|
14887
14907
|
function _extends() {
|
|
14888
14908
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
14889
14909
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -15939,13 +15959,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15939
15959
|
Schema.validators = validators;
|
|
15940
15960
|
class FormStore {
|
|
15941
15961
|
constructor() {
|
|
15942
|
-
|
|
15962
|
+
// 初始化数据
|
|
15963
|
+
__publicField(this, "initialValues", {});
|
|
15943
15964
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
15944
|
-
__publicField(this, "
|
|
15965
|
+
__publicField(this, "store", {});
|
|
15945
15966
|
// 所有的组件实例
|
|
15946
|
-
|
|
15967
|
+
__publicField(this, "fieldEntities", []);
|
|
15968
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
15947
15969
|
__publicField(this, "callbacks", {});
|
|
15948
|
-
__publicField(this, "
|
|
15970
|
+
__publicField(this, "errors", []);
|
|
15949
15971
|
/**
|
|
15950
15972
|
* 注册组件实例
|
|
15951
15973
|
* @param field
|
|
@@ -15954,11 +15976,29 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15954
15976
|
this.fieldEntities.push(field);
|
|
15955
15977
|
return () => {
|
|
15956
15978
|
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
15957
|
-
|
|
15979
|
+
if (this.store) {
|
|
15980
|
+
delete this.store[field.props.name];
|
|
15981
|
+
}
|
|
15958
15982
|
};
|
|
15959
15983
|
});
|
|
15984
|
+
/**
|
|
15985
|
+
* 获取 formItem 的值
|
|
15986
|
+
* @param name
|
|
15987
|
+
*/
|
|
15960
15988
|
__publicField(this, "getFieldValue", (name) => {
|
|
15961
|
-
|
|
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
|
+
}
|
|
15962
16002
|
});
|
|
15963
16003
|
/**
|
|
15964
16004
|
* 存储组件数据
|
|
@@ -15973,34 +16013,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15973
16013
|
const { name } = enetity.props;
|
|
15974
16014
|
Object.keys(newStore).forEach((key) => {
|
|
15975
16015
|
if (key === name) {
|
|
15976
|
-
enetity.onStoreChange();
|
|
16016
|
+
enetity.onStoreChange("update");
|
|
15977
16017
|
}
|
|
15978
16018
|
});
|
|
15979
16019
|
});
|
|
15980
16020
|
});
|
|
15981
|
-
|
|
15982
|
-
|
|
15983
|
-
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
|
|
15987
|
-
* required: true,
|
|
15988
|
-
* validator: (rule, value) => {
|
|
15989
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
15990
|
-
* },
|
|
15991
|
-
* },
|
|
15992
|
-
* }
|
|
15993
|
-
*/
|
|
16021
|
+
__publicField(this, "setCallback", (callback) => {
|
|
16022
|
+
this.callbacks = {
|
|
16023
|
+
...this.callbacks,
|
|
16024
|
+
...callback
|
|
16025
|
+
};
|
|
16026
|
+
});
|
|
15994
16027
|
__publicField(this, "validate", () => {
|
|
15995
16028
|
const err = [];
|
|
15996
|
-
this.
|
|
16029
|
+
this.errors.length = 0;
|
|
15997
16030
|
this.fieldEntities.forEach((entity) => {
|
|
16031
|
+
var _a2;
|
|
15998
16032
|
const { name, rules: rules2 = [] } = entity.props;
|
|
15999
16033
|
const descriptor = {};
|
|
16000
16034
|
if (rules2.length) {
|
|
16001
16035
|
if (rules2.length > 1) {
|
|
16002
16036
|
descriptor[name] = [];
|
|
16003
|
-
rules2.
|
|
16037
|
+
rules2.forEach((v) => {
|
|
16004
16038
|
descriptor[name].push(v);
|
|
16005
16039
|
});
|
|
16006
16040
|
} else {
|
|
@@ -16008,39 +16042,36 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16008
16042
|
}
|
|
16009
16043
|
}
|
|
16010
16044
|
const validator = new Schema(descriptor);
|
|
16011
|
-
validator.
|
|
16045
|
+
validator.messages();
|
|
16046
|
+
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
16012
16047
|
if (errors) {
|
|
16013
16048
|
err.push(...errors);
|
|
16014
|
-
this.
|
|
16049
|
+
this.errors.push(...errors);
|
|
16015
16050
|
}
|
|
16016
|
-
entity.onStoreChange();
|
|
16051
|
+
entity.onStoreChange("validate");
|
|
16017
16052
|
});
|
|
16018
16053
|
});
|
|
16019
16054
|
return err;
|
|
16020
16055
|
});
|
|
16021
|
-
__publicField(this, "setCallback", (callback) => {
|
|
16022
|
-
this.callbacks = {
|
|
16023
|
-
...this.callbacks,
|
|
16024
|
-
...callback
|
|
16025
|
-
};
|
|
16026
|
-
});
|
|
16027
16056
|
__publicField(this, "submit", () => {
|
|
16028
16057
|
var _a2, _b, _c, _d;
|
|
16029
|
-
const
|
|
16030
|
-
if (
|
|
16058
|
+
const errors = this.validate();
|
|
16059
|
+
if (errors.length === 0) {
|
|
16031
16060
|
(_b = (_a2 = this.callbacks).onFinish) == null ? void 0 : _b.call(_a2, this.store);
|
|
16032
|
-
} else if (
|
|
16033
|
-
(_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);
|
|
16034
16063
|
}
|
|
16035
16064
|
});
|
|
16036
16065
|
__publicField(this, "resetFields", () => {
|
|
16037
|
-
this.
|
|
16038
|
-
this.
|
|
16039
|
-
|
|
16066
|
+
this.errors.length = 0;
|
|
16067
|
+
this.store = this.initialValues;
|
|
16068
|
+
this.fieldEntities.forEach((entity) => {
|
|
16069
|
+
entity.onStoreChange("reset");
|
|
16040
16070
|
});
|
|
16041
16071
|
});
|
|
16042
16072
|
__publicField(this, "getForm", () => {
|
|
16043
16073
|
return {
|
|
16074
|
+
setInitialValues: this.setInitialValues,
|
|
16044
16075
|
setCallback: this.setCallback,
|
|
16045
16076
|
registerField: this.registerField,
|
|
16046
16077
|
getFieldValue: this.getFieldValue,
|
|
@@ -16048,12 +16079,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16048
16079
|
resetFields: this.resetFields,
|
|
16049
16080
|
submit: this.submit,
|
|
16050
16081
|
store: this.store,
|
|
16051
|
-
|
|
16082
|
+
errors: this.errors,
|
|
16052
16083
|
fieldEntities: this.fieldEntities
|
|
16053
16084
|
};
|
|
16054
16085
|
});
|
|
16055
16086
|
this.callbacks = {
|
|
16056
|
-
onFinish: (
|
|
16087
|
+
onFinish: () => {
|
|
16057
16088
|
},
|
|
16058
16089
|
onFinishFailed: () => {
|
|
16059
16090
|
}
|
|
@@ -16072,98 +16103,113 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16072
16103
|
}
|
|
16073
16104
|
return [formRef.current];
|
|
16074
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
|
+
}
|
|
16075
16115
|
const defaultProps$U = {
|
|
16076
16116
|
...ComponentDefaults,
|
|
16117
|
+
required: false,
|
|
16077
16118
|
name: "",
|
|
16078
16119
|
label: "",
|
|
16079
|
-
className: "",
|
|
16080
16120
|
rules: [{ required: false, message: "" }],
|
|
16081
|
-
|
|
16082
|
-
labelWidth: 90,
|
|
16083
|
-
errorMessageAlign: "left",
|
|
16084
|
-
showErrorLine: true,
|
|
16085
|
-
showErrorMessage: true,
|
|
16086
|
-
initialValue: ""
|
|
16121
|
+
errorMessageAlign: "left"
|
|
16087
16122
|
};
|
|
16088
16123
|
class FormItem extends React.Component {
|
|
16089
|
-
constructor() {
|
|
16090
|
-
super(
|
|
16124
|
+
constructor(props) {
|
|
16125
|
+
super(props);
|
|
16091
16126
|
__publicField(this, "cancelRegister");
|
|
16092
|
-
__publicField(this, "
|
|
16127
|
+
__publicField(this, "componentRef");
|
|
16093
16128
|
// children添加value属性和onChange事件
|
|
16094
16129
|
__publicField(this, "getControlled", (children) => {
|
|
16095
|
-
var _a2
|
|
16096
|
-
const {
|
|
16130
|
+
var _a2;
|
|
16131
|
+
const { setFieldsValue, getFieldValue } = this.context;
|
|
16097
16132
|
const { name } = this.props;
|
|
16098
|
-
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
defaultValue: getFieldValue(name),
|
|
16107
|
-
onChange: (event) => {
|
|
16108
|
-
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"];
|
|
16109
16141
|
if (originOnChange) {
|
|
16110
|
-
originOnChange(
|
|
16142
|
+
originOnChange(...args);
|
|
16111
16143
|
}
|
|
16112
|
-
let
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
newValue = event.target.value;
|
|
16116
|
-
break;
|
|
16144
|
+
let [next] = args;
|
|
16145
|
+
if (this.props.getValueFromEvent) {
|
|
16146
|
+
next = this.props.getValueFromEvent(...args);
|
|
16117
16147
|
}
|
|
16118
|
-
setFieldsValue({ [name]:
|
|
16148
|
+
setFieldsValue({ [name]: next });
|
|
16119
16149
|
}
|
|
16120
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;
|
|
16121
16166
|
});
|
|
16122
|
-
__publicField(this, "
|
|
16123
|
-
this.
|
|
16167
|
+
__publicField(this, "refresh", () => {
|
|
16168
|
+
this.setState(({ resetCount }) => ({
|
|
16169
|
+
resetCount: resetCount + 1
|
|
16170
|
+
}));
|
|
16171
|
+
});
|
|
16172
|
+
__publicField(this, "onStoreChange", (type2) => {
|
|
16173
|
+
if (type2 === "reset") {
|
|
16174
|
+
this.refresh();
|
|
16175
|
+
} else {
|
|
16176
|
+
this.forceUpdate();
|
|
16177
|
+
}
|
|
16124
16178
|
});
|
|
16125
16179
|
__publicField(this, "renderLayout", (childNode) => {
|
|
16126
16180
|
var _a2, _b;
|
|
16127
|
-
const {
|
|
16128
|
-
label,
|
|
16129
|
-
name,
|
|
16130
|
-
rules: rules2 = [{ required: false, message: "" }],
|
|
16131
|
-
className,
|
|
16132
|
-
labelWidth,
|
|
16133
|
-
errorMessageAlign,
|
|
16134
|
-
showErrorLine,
|
|
16135
|
-
showErrorMessage
|
|
16136
|
-
} = {
|
|
16181
|
+
const { label, name, required: required2, className, style, errorMessageAlign } = {
|
|
16137
16182
|
...defaultProps$U,
|
|
16138
16183
|
...this.props
|
|
16139
16184
|
};
|
|
16140
|
-
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) => {
|
|
16141
16186
|
return item2.field === name;
|
|
16142
16187
|
}));
|
|
16143
|
-
const {
|
|
16144
|
-
const renderStar =
|
|
16145
|
-
const renderLabel =
|
|
16146
|
-
return /* @__PURE__ */ React.createElement(
|
|
16147
|
-
|
|
16148
|
-
{
|
|
16149
|
-
className: "nut-cell__title nut-form-item__label",
|
|
16150
|
-
style: {
|
|
16151
|
-
width: this.pxCheck(labelWidth)
|
|
16152
|
-
}
|
|
16153
|
-
},
|
|
16154
|
-
renderLabel
|
|
16155
|
-
) : 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(
|
|
16156
|
-
"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,
|
|
16157
16193
|
{
|
|
16158
|
-
className:
|
|
16159
|
-
style
|
|
16194
|
+
className: `nut-form-item ${className}`,
|
|
16195
|
+
style,
|
|
16196
|
+
onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
|
|
16160
16197
|
},
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
|
|
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
|
+
);
|
|
16166
16208
|
});
|
|
16209
|
+
this.componentRef = React.createRef();
|
|
16210
|
+
this.state = {
|
|
16211
|
+
resetCount: 1
|
|
16212
|
+
};
|
|
16167
16213
|
}
|
|
16168
16214
|
componentDidMount() {
|
|
16169
16215
|
this.cancelRegister = this.context.registerField(this);
|
|
@@ -16174,81 +16220,86 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16174
16220
|
}
|
|
16175
16221
|
}
|
|
16176
16222
|
render() {
|
|
16177
|
-
const { children
|
|
16178
|
-
const
|
|
16179
|
-
let restCNode = c;
|
|
16180
|
-
if (initialValue) {
|
|
16181
|
-
restCNode = React.cloneElement(c, {
|
|
16182
|
-
defaultValue: initialValue
|
|
16183
|
-
});
|
|
16184
|
-
}
|
|
16223
|
+
const { children } = this.props;
|
|
16224
|
+
const child = Array.isArray(children) ? children[0] : children;
|
|
16185
16225
|
const returnChildNode = React.cloneElement(
|
|
16186
|
-
|
|
16187
|
-
this.getControlled(
|
|
16226
|
+
child,
|
|
16227
|
+
this.getControlled(child)
|
|
16188
16228
|
);
|
|
16189
|
-
return this.renderLayout(returnChildNode);
|
|
16229
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
16190
16230
|
}
|
|
16191
16231
|
}
|
|
16192
16232
|
__publicField(FormItem, "defaultProps", defaultProps$U);
|
|
16193
|
-
__publicField(FormItem, "contextType",
|
|
16233
|
+
__publicField(FormItem, "contextType", Context);
|
|
16194
16234
|
const defaultProps$T = {
|
|
16195
16235
|
...ComponentDefaults,
|
|
16196
|
-
|
|
16197
|
-
|
|
16198
|
-
|
|
16199
|
-
labelPosition: "Right",
|
|
16200
|
-
formGroupTitle: "",
|
|
16201
|
-
onFinish: (obj) => {
|
|
16202
|
-
},
|
|
16203
|
-
onFinishFailed: (value) => {
|
|
16236
|
+
labelPosition: "right",
|
|
16237
|
+
starPosition: "left",
|
|
16238
|
+
onFinish: (values) => {
|
|
16204
16239
|
},
|
|
16205
|
-
|
|
16240
|
+
onFinishFailed: (values, errorFields) => {
|
|
16241
|
+
}
|
|
16206
16242
|
};
|
|
16207
16243
|
const PositionInfo = {
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16244
|
+
top: "form-layout-top",
|
|
16245
|
+
left: "form-layout-left",
|
|
16246
|
+
right: "form-layout-right"
|
|
16211
16247
|
};
|
|
16212
16248
|
const Form = (props) => {
|
|
16249
|
+
const classPrefix2 = "nut-form";
|
|
16213
16250
|
const {
|
|
16251
|
+
className,
|
|
16252
|
+
style,
|
|
16253
|
+
footer,
|
|
16214
16254
|
children,
|
|
16255
|
+
initialValues,
|
|
16215
16256
|
onFinish,
|
|
16216
16257
|
onFinishFailed,
|
|
16217
16258
|
labelPosition,
|
|
16218
|
-
|
|
16219
|
-
form
|
|
16220
|
-
...rest
|
|
16259
|
+
starPosition,
|
|
16260
|
+
form
|
|
16221
16261
|
} = {
|
|
16222
16262
|
...defaultProps$T,
|
|
16223
16263
|
...props
|
|
16224
16264
|
};
|
|
16225
|
-
let formInstance
|
|
16226
|
-
if (
|
|
16265
|
+
let formInstance;
|
|
16266
|
+
if (form !== void 0) {
|
|
16227
16267
|
formInstance = form;
|
|
16228
16268
|
} else {
|
|
16229
16269
|
[formInstance] = useForm();
|
|
16230
16270
|
}
|
|
16231
|
-
formInstance.
|
|
16232
|
-
const { setCallback, submit, resetFields } = formInstance;
|
|
16271
|
+
formInstance.starPosition = starPosition;
|
|
16272
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16233
16273
|
setCallback({
|
|
16234
16274
|
onFinish,
|
|
16235
16275
|
onFinishFailed
|
|
16236
16276
|
});
|
|
16277
|
+
const mountRef = React.useRef(false);
|
|
16278
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
16279
|
+
if (!mountRef.current) {
|
|
16280
|
+
mountRef.current = true;
|
|
16281
|
+
}
|
|
16237
16282
|
return /* @__PURE__ */ React.createElement(
|
|
16238
16283
|
"form",
|
|
16239
16284
|
{
|
|
16240
|
-
className:
|
|
16241
|
-
|
|
16285
|
+
className: classNames(
|
|
16286
|
+
classPrefix2,
|
|
16287
|
+
className,
|
|
16288
|
+
PositionInfo[labelPosition]
|
|
16289
|
+
),
|
|
16290
|
+
style,
|
|
16242
16291
|
onSubmit: (e) => {
|
|
16243
16292
|
e.preventDefault();
|
|
16293
|
+
e.stopPropagation();
|
|
16244
16294
|
submit();
|
|
16245
16295
|
},
|
|
16246
16296
|
onReset: (e) => {
|
|
16247
16297
|
e.preventDefault();
|
|
16298
|
+
e.stopPropagation();
|
|
16248
16299
|
resetFields();
|
|
16249
16300
|
}
|
|
16250
16301
|
},
|
|
16251
|
-
/* @__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)
|
|
16252
16303
|
);
|
|
16253
16304
|
};
|
|
16254
16305
|
Form.defaultProps = defaultProps$T;
|
|
@@ -16464,7 +16515,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16464
16515
|
disabled: false,
|
|
16465
16516
|
min: 1,
|
|
16466
16517
|
max: 9999,
|
|
16467
|
-
|
|
16518
|
+
readOnly: false,
|
|
16468
16519
|
allowEmpty: false,
|
|
16469
16520
|
defaultValue: 0,
|
|
16470
16521
|
step: 1,
|
|
@@ -16478,7 +16529,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16478
16529
|
disabled,
|
|
16479
16530
|
min,
|
|
16480
16531
|
max,
|
|
16481
|
-
|
|
16532
|
+
readOnly,
|
|
16482
16533
|
value,
|
|
16483
16534
|
defaultValue,
|
|
16484
16535
|
allowEmpty,
|
|
@@ -16637,14 +16688,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16637
16688
|
const focusValue = (e) => {
|
|
16638
16689
|
if (disabled)
|
|
16639
16690
|
return;
|
|
16640
|
-
if (
|
|
16691
|
+
if (readOnly)
|
|
16641
16692
|
return;
|
|
16642
16693
|
onFocus && onFocus(e);
|
|
16643
16694
|
};
|
|
16644
16695
|
const burValue = (e) => {
|
|
16645
16696
|
if (disabled)
|
|
16646
16697
|
return;
|
|
16647
|
-
if (
|
|
16698
|
+
if (readOnly)
|
|
16648
16699
|
return;
|
|
16649
16700
|
const input = e.target;
|
|
16650
16701
|
let value2 = input.valueAsNumber;
|
|
@@ -16672,7 +16723,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16672
16723
|
min,
|
|
16673
16724
|
max,
|
|
16674
16725
|
disabled,
|
|
16675
|
-
readOnly
|
|
16726
|
+
readOnly,
|
|
16676
16727
|
value: _checked,
|
|
16677
16728
|
onInput: changeFormatValue,
|
|
16678
16729
|
onBlur: burFormatValue,
|
|
@@ -16685,7 +16736,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16685
16736
|
min,
|
|
16686
16737
|
max,
|
|
16687
16738
|
disabled,
|
|
16688
|
-
readOnly
|
|
16739
|
+
readOnly,
|
|
16689
16740
|
value: _checked,
|
|
16690
16741
|
onInput: changeValue,
|
|
16691
16742
|
onBlur: burValue,
|
|
@@ -16745,6 +16796,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16745
16796
|
};
|
|
16746
16797
|
const hideMenuItem = (index) => {
|
|
16747
16798
|
showMenuItem[index] = false;
|
|
16799
|
+
console.log([...showMenuItem]);
|
|
16748
16800
|
setShowMenuItem([...showMenuItem]);
|
|
16749
16801
|
};
|
|
16750
16802
|
const updateTitle = (text, index) => {
|
|
@@ -16754,6 +16806,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16754
16806
|
const cloneChildren = () => {
|
|
16755
16807
|
return React.Children.map(children, (child, index) => {
|
|
16756
16808
|
return React.cloneElement(child, {
|
|
16809
|
+
...child.props,
|
|
16757
16810
|
show: showMenuItem[index],
|
|
16758
16811
|
index,
|
|
16759
16812
|
activeColor,
|
|
@@ -16793,7 +16846,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16793
16846
|
}),
|
|
16794
16847
|
style: { color: showMenuItem[index] ? activeColor : "" },
|
|
16795
16848
|
key: index,
|
|
16796
|
-
onClick: () => {
|
|
16849
|
+
onClick: (e) => {
|
|
16850
|
+
e.stopPropagation();
|
|
16797
16851
|
!disabled && toggleMenuItem(index);
|
|
16798
16852
|
}
|
|
16799
16853
|
},
|
|
@@ -16835,12 +16889,59 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16835
16889
|
};
|
|
16836
16890
|
Menu.defaultProps = defaultProps$Q;
|
|
16837
16891
|
Menu.displayName = "NutMenu";
|
|
16892
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
16893
|
+
const isFunction = (val) => typeof val === "function";
|
|
16894
|
+
const isPromise = (val) => {
|
|
16895
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
16896
|
+
};
|
|
16897
|
+
const upperCaseFirst = (str) => {
|
|
16898
|
+
var str = str.toLowerCase();
|
|
16899
|
+
str = str.replace(
|
|
16900
|
+
/\b\w+\b/g,
|
|
16901
|
+
(word) => word.substring(0, 1).toUpperCase() + word.substring(1)
|
|
16902
|
+
);
|
|
16903
|
+
return str;
|
|
16904
|
+
};
|
|
16905
|
+
const getTargetElement = (target) => {
|
|
16906
|
+
let targetElement;
|
|
16907
|
+
if (isFunction(target)) {
|
|
16908
|
+
targetElement = target();
|
|
16909
|
+
} else if ("current" in target) {
|
|
16910
|
+
targetElement = target.current;
|
|
16911
|
+
} else {
|
|
16912
|
+
targetElement = target;
|
|
16913
|
+
}
|
|
16914
|
+
return targetElement;
|
|
16915
|
+
};
|
|
16916
|
+
function useClickAway(onClickAway, target, eventName = "click", isListener, outerVar) {
|
|
16917
|
+
const handler = (event) => {
|
|
16918
|
+
const targets = Array.isArray(target) ? target : [target];
|
|
16919
|
+
if (targets.some((item) => {
|
|
16920
|
+
const targetElement = getTargetElement(item);
|
|
16921
|
+
return !targetElement || targetElement.contains(event.target);
|
|
16922
|
+
})) {
|
|
16923
|
+
return;
|
|
16924
|
+
}
|
|
16925
|
+
if (outerVar) {
|
|
16926
|
+
onClickAway();
|
|
16927
|
+
}
|
|
16928
|
+
};
|
|
16929
|
+
React.useEffect(() => {
|
|
16930
|
+
if (isListener) {
|
|
16931
|
+
window.addEventListener(eventName, handler, false);
|
|
16932
|
+
} else {
|
|
16933
|
+
window.removeEventListener(eventName, handler, false);
|
|
16934
|
+
}
|
|
16935
|
+
return () => {
|
|
16936
|
+
window.removeEventListener(eventName, handler, true);
|
|
16937
|
+
};
|
|
16938
|
+
}, [target]);
|
|
16939
|
+
}
|
|
16838
16940
|
const defaultProps$P = {
|
|
16839
16941
|
...ComponentDefaults,
|
|
16840
16942
|
columns: 1,
|
|
16841
16943
|
direction: "down",
|
|
16842
16944
|
icon: null,
|
|
16843
|
-
closeOnClickAway: false,
|
|
16844
16945
|
activeTitleClass: "",
|
|
16845
16946
|
inactiveTitleClass: "",
|
|
16846
16947
|
onChange: (value) => void 0
|
|
@@ -16873,9 +16974,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16873
16974
|
React.useEffect(() => {
|
|
16874
16975
|
setShowPopup(show2);
|
|
16875
16976
|
}, [show2]);
|
|
16876
|
-
React.useEffect(() => {
|
|
16877
|
-
getParentOffset();
|
|
16878
|
-
}, [_showPopup]);
|
|
16879
16977
|
React.useImperativeHandle(ref, () => ({
|
|
16880
16978
|
toggle: parent.toggleMenuItem
|
|
16881
16979
|
}));
|
|
@@ -16896,119 +16994,108 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
16896
16994
|
setValue(item.value);
|
|
16897
16995
|
onChange && onChange(item);
|
|
16898
16996
|
};
|
|
16899
|
-
const [position, setPosition] = React.useState({
|
|
16900
|
-
top: 0,
|
|
16901
|
-
height: 0
|
|
16902
|
-
});
|
|
16903
|
-
const getParentOffset = () => {
|
|
16904
|
-
setTimeout(() => {
|
|
16905
|
-
const p = parent.menuRef.current;
|
|
16906
|
-
const rect = p.getBoundingClientRect();
|
|
16907
|
-
setPosition({
|
|
16908
|
-
height: rect.height,
|
|
16909
|
-
top: rect.top
|
|
16910
|
-
});
|
|
16911
|
-
});
|
|
16912
|
-
};
|
|
16913
16997
|
const isShow = () => {
|
|
16914
16998
|
if (_showPopup)
|
|
16915
16999
|
return {};
|
|
16916
17000
|
return { display: "none" };
|
|
16917
17001
|
};
|
|
16918
17002
|
const getPosition = () => {
|
|
16919
|
-
return direction === "down" ? {
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
if (direction === "down") {
|
|
16923
|
-
return {
|
|
16924
|
-
height: `${position.top + position.height}px`,
|
|
16925
|
-
top: 0,
|
|
16926
|
-
...isShow()
|
|
16927
|
-
};
|
|
16928
|
-
}
|
|
16929
|
-
return {
|
|
16930
|
-
height: `${window.innerHeight - position.top}px`,
|
|
16931
|
-
bottom: `0px`,
|
|
17003
|
+
return direction === "down" ? { position: "absolute", height: `${window.innerHeight}px` } : {
|
|
17004
|
+
position: "absolute",
|
|
17005
|
+
bottom: "100%",
|
|
16932
17006
|
top: "auto",
|
|
16933
|
-
|
|
17007
|
+
height: `${window.innerHeight}px`
|
|
16934
17008
|
};
|
|
16935
17009
|
};
|
|
16936
|
-
|
|
16937
|
-
|
|
16938
|
-
|
|
16939
|
-
|
|
16940
|
-
|
|
16941
|
-
|
|
16942
|
-
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
|
|
16946
|
-
|
|
16947
|
-
|
|
16948
|
-
|
|
16949
|
-
|
|
16950
|
-
lockScroll: parent.lockScroll,
|
|
16951
|
-
visible: _showPopup,
|
|
16952
|
-
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
16953
|
-
onClick: () => {
|
|
16954
|
-
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
16955
|
-
}
|
|
16956
|
-
}
|
|
16957
|
-
), /* @__PURE__ */ React.createElement(
|
|
17010
|
+
const micRef = React.useRef(null);
|
|
17011
|
+
const targetSet = [micRef.current];
|
|
17012
|
+
useClickAway(
|
|
17013
|
+
() => {
|
|
17014
|
+
parent.hideMenuItem(index);
|
|
17015
|
+
},
|
|
17016
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
17017
|
+
// @ts-ignore
|
|
17018
|
+
targetSet,
|
|
17019
|
+
"click",
|
|
17020
|
+
_showPopup,
|
|
17021
|
+
closeOnClickAway
|
|
17022
|
+
);
|
|
17023
|
+
return /* @__PURE__ */ React.createElement(
|
|
16958
17024
|
"div",
|
|
16959
17025
|
{
|
|
16960
|
-
className:
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
}),
|
|
16964
|
-
style: {
|
|
16965
|
-
...style,
|
|
16966
|
-
...isShow()
|
|
16967
|
-
}
|
|
17026
|
+
className: "nut-menu-item-container",
|
|
17027
|
+
ref: micRef,
|
|
17028
|
+
style: { position: "absolute", left: 0, right: 0 }
|
|
16968
17029
|
},
|
|
16969
17030
|
/* @__PURE__ */ React.createElement(
|
|
16970
|
-
|
|
17031
|
+
Overlay,
|
|
16971
17032
|
{
|
|
16972
|
-
|
|
16973
|
-
|
|
16974
|
-
|
|
17033
|
+
className: "nut-menu__overlay",
|
|
17034
|
+
style: getPosition(),
|
|
17035
|
+
lockScroll: parent.lockScroll,
|
|
17036
|
+
visible: _showPopup,
|
|
17037
|
+
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
17038
|
+
onClick: () => {
|
|
17039
|
+
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
17040
|
+
}
|
|
17041
|
+
}
|
|
17042
|
+
),
|
|
17043
|
+
/* @__PURE__ */ React.createElement(
|
|
17044
|
+
"div",
|
|
17045
|
+
{
|
|
17046
|
+
className: classNames(className, {
|
|
17047
|
+
"nut-menu-item__wrap": direction === "down",
|
|
17048
|
+
"nut-menu-item__wrap-up": direction !== "down"
|
|
17049
|
+
}),
|
|
17050
|
+
style: {
|
|
17051
|
+
...style,
|
|
17052
|
+
...isShow()
|
|
17053
|
+
}
|
|
16975
17054
|
},
|
|
16976
|
-
/* @__PURE__ */ React.createElement(
|
|
16977
|
-
|
|
16978
|
-
|
|
16979
|
-
|
|
16980
|
-
|
|
16981
|
-
|
|
16982
|
-
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
flexBasis: `${100 / columns}%`
|
|
16986
|
-
},
|
|
16987
|
-
onClick: () => {
|
|
16988
|
-
handleClick2(item);
|
|
16989
|
-
}
|
|
16990
|
-
},
|
|
16991
|
-
item.value === _value ? /* @__PURE__ */ React.createElement("i", null, icon || /* @__PURE__ */ React.createElement(
|
|
16992
|
-
x$f,
|
|
16993
|
-
{
|
|
16994
|
-
color: activeColor,
|
|
16995
|
-
className: getIconCName(item.value, value)
|
|
16996
|
-
}
|
|
16997
|
-
)) : null,
|
|
16998
|
-
/* @__PURE__ */ React.createElement(
|
|
17055
|
+
/* @__PURE__ */ React.createElement(
|
|
17056
|
+
CSSTransition$1,
|
|
17057
|
+
{
|
|
17058
|
+
in: _showPopup,
|
|
17059
|
+
timeout: 100,
|
|
17060
|
+
classNames: direction === "down" ? "menu-item" : "menu-item-up"
|
|
17061
|
+
},
|
|
17062
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-menu-item__content" }, options2 == null ? void 0 : options2.map((item) => {
|
|
17063
|
+
return /* @__PURE__ */ React.createElement(
|
|
16999
17064
|
"div",
|
|
17000
17065
|
{
|
|
17001
|
-
className:
|
|
17066
|
+
className: `nut-menu-item__option ${classNames({
|
|
17067
|
+
active: item.value === _value
|
|
17068
|
+
})}`,
|
|
17069
|
+
key: item.text,
|
|
17002
17070
|
style: {
|
|
17003
|
-
|
|
17071
|
+
flexBasis: `${100 / columns}%`
|
|
17072
|
+
},
|
|
17073
|
+
onClick: () => {
|
|
17074
|
+
handleClick2(item);
|
|
17004
17075
|
}
|
|
17005
17076
|
},
|
|
17006
|
-
item.
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17077
|
+
item.value === _value ? /* @__PURE__ */ React.createElement("i", null, icon || /* @__PURE__ */ React.createElement(
|
|
17078
|
+
x$f,
|
|
17079
|
+
{
|
|
17080
|
+
color: activeColor,
|
|
17081
|
+
className: getIconCName(item.value, value)
|
|
17082
|
+
}
|
|
17083
|
+
)) : null,
|
|
17084
|
+
/* @__PURE__ */ React.createElement(
|
|
17085
|
+
"div",
|
|
17086
|
+
{
|
|
17087
|
+
className: getIconCName(item.value, value),
|
|
17088
|
+
style: {
|
|
17089
|
+
color: `${item.value === _value ? activeColor : ""}`
|
|
17090
|
+
}
|
|
17091
|
+
},
|
|
17092
|
+
item.text
|
|
17093
|
+
)
|
|
17094
|
+
);
|
|
17095
|
+
}), children)
|
|
17096
|
+
)
|
|
17010
17097
|
)
|
|
17011
|
-
)
|
|
17098
|
+
);
|
|
17012
17099
|
});
|
|
17013
17100
|
MenuItem.defaultProps = defaultProps$P;
|
|
17014
17101
|
MenuItem.displayName = "NutMenuItem";
|
|
@@ -17841,7 +17928,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17841
17928
|
return /* @__PURE__ */ React.createElement(
|
|
17842
17929
|
"input",
|
|
17843
17930
|
{
|
|
17844
|
-
className: `${classPrefix2}__input ${
|
|
17931
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
17845
17932
|
ref: searchRef,
|
|
17846
17933
|
style: { ...props.style },
|
|
17847
17934
|
value: value || "",
|
|
@@ -17914,7 +18001,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17914
18001
|
style: { ...props.style }
|
|
17915
18002
|
},
|
|
17916
18003
|
renderLeft(),
|
|
17917
|
-
/* @__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
|
+
),
|
|
17918
18014
|
renderRight()
|
|
17919
18015
|
);
|
|
17920
18016
|
};
|
|
@@ -18474,19 +18570,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18474
18570
|
}
|
|
18475
18571
|
}
|
|
18476
18572
|
}
|
|
18477
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
18478
|
-
const isFunction = (val) => typeof val === "function";
|
|
18479
|
-
const isPromise = (val) => {
|
|
18480
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
18481
|
-
};
|
|
18482
|
-
const upperCaseFirst = (str) => {
|
|
18483
|
-
var str = str.toLowerCase();
|
|
18484
|
-
str = str.replace(
|
|
18485
|
-
/\b\w+\b/g,
|
|
18486
|
-
(word) => word.substring(0, 1).toUpperCase() + word.substring(1)
|
|
18487
|
-
);
|
|
18488
|
-
return str;
|
|
18489
|
-
};
|
|
18490
18573
|
const funcInterceptor = (interceptor, {
|
|
18491
18574
|
args = [],
|
|
18492
18575
|
done,
|
|
@@ -19981,7 +20064,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19981
20064
|
onClick: handleClick2
|
|
19982
20065
|
},
|
|
19983
20066
|
leftIcon ? /* @__PURE__ */ React.createElement("div", { className: "left-icon" }, leftIcon) : null,
|
|
19984
|
-
children ? /* @__PURE__ */ React.createElement(
|
|
20067
|
+
children ? /* @__PURE__ */ React.createElement("div", { className: "nut-noticebar__inner", ref: innerRef }, scrollList.current.map((item, index) => {
|
|
19985
20068
|
return /* @__PURE__ */ React.createElement(
|
|
19986
20069
|
"div",
|
|
19987
20070
|
{
|
|
@@ -19994,7 +20077,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19994
20077
|
},
|
|
19995
20078
|
item
|
|
19996
20079
|
);
|
|
19997
|
-
}))
|
|
20080
|
+
})) : /* @__PURE__ */ React.createElement("div", { className: "horseLamp_list", style: horseLampStyle }, scrollList.current.map((item, index) => {
|
|
19998
20081
|
return (
|
|
19999
20082
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
20000
20083
|
/* @__PURE__ */ React.createElement(
|
|
@@ -20188,41 +20271,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20188
20271
|
}
|
|
20189
20272
|
}
|
|
20190
20273
|
};
|
|
20191
|
-
const getTargetElement = (target) => {
|
|
20192
|
-
let targetElement;
|
|
20193
|
-
if (isFunction(target)) {
|
|
20194
|
-
targetElement = target();
|
|
20195
|
-
} else if ("current" in target) {
|
|
20196
|
-
targetElement = target.current;
|
|
20197
|
-
} else {
|
|
20198
|
-
targetElement = target;
|
|
20199
|
-
}
|
|
20200
|
-
return targetElement;
|
|
20201
|
-
};
|
|
20202
|
-
function useClickAway(onClickAway, target, eventName = "click", isListener, outerVar) {
|
|
20203
|
-
const handler = (event) => {
|
|
20204
|
-
const targets = Array.isArray(target) ? target : [target];
|
|
20205
|
-
if (targets.some((item) => {
|
|
20206
|
-
const targetElement = getTargetElement(item);
|
|
20207
|
-
return !targetElement || targetElement.contains(event.target);
|
|
20208
|
-
})) {
|
|
20209
|
-
return;
|
|
20210
|
-
}
|
|
20211
|
-
if (outerVar) {
|
|
20212
|
-
onClickAway();
|
|
20213
|
-
}
|
|
20214
|
-
};
|
|
20215
|
-
React.useEffect(() => {
|
|
20216
|
-
if (isListener) {
|
|
20217
|
-
window.addEventListener(eventName, handler, true);
|
|
20218
|
-
} else {
|
|
20219
|
-
window.removeEventListener(eventName, handler, true);
|
|
20220
|
-
}
|
|
20221
|
-
return () => {
|
|
20222
|
-
window.removeEventListener(eventName, handler, true);
|
|
20223
|
-
};
|
|
20224
|
-
}, [target]);
|
|
20225
|
-
}
|
|
20226
20274
|
const defaultProps$w = {
|
|
20227
20275
|
...ComponentDefaults,
|
|
20228
20276
|
list: [],
|
|
@@ -20370,7 +20418,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20370
20418
|
return styles;
|
|
20371
20419
|
};
|
|
20372
20420
|
const getRootPosition = () => {
|
|
20373
|
-
|
|
20421
|
+
const styles = {};
|
|
20374
20422
|
if (!rootPosition)
|
|
20375
20423
|
return {};
|
|
20376
20424
|
const contentWidth = elWidth;
|
|
@@ -20380,34 +20428,34 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20380
20428
|
const skew = location.split("-")[1];
|
|
20381
20429
|
let cross = 0;
|
|
20382
20430
|
let parallel = 0;
|
|
20383
|
-
if (Array.isArray(offset) && offset.length
|
|
20431
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
20384
20432
|
cross += +offset[1];
|
|
20385
20433
|
parallel += +offset[0];
|
|
20386
20434
|
}
|
|
20387
20435
|
if (width) {
|
|
20388
20436
|
if (["bottom", "top"].includes(direction)) {
|
|
20389
|
-
const h = direction
|
|
20437
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
20390
20438
|
styles.top = `${top + h}px`;
|
|
20391
20439
|
if (!skew) {
|
|
20392
20440
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
20393
20441
|
}
|
|
20394
|
-
if (skew
|
|
20442
|
+
if (skew === "start") {
|
|
20395
20443
|
styles.left = `${left + parallel}px`;
|
|
20396
20444
|
}
|
|
20397
|
-
if (skew
|
|
20445
|
+
if (skew === "end") {
|
|
20398
20446
|
styles.left = `${right + parallel}px`;
|
|
20399
20447
|
}
|
|
20400
20448
|
}
|
|
20401
20449
|
if (["left", "right"].includes(direction)) {
|
|
20402
|
-
const contentW = direction
|
|
20450
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
20403
20451
|
styles.left = `${left + contentW}px`;
|
|
20404
20452
|
if (!skew) {
|
|
20405
20453
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
20406
20454
|
}
|
|
20407
|
-
if (skew
|
|
20455
|
+
if (skew === "start") {
|
|
20408
20456
|
styles.top = `${top + parallel}px`;
|
|
20409
20457
|
}
|
|
20410
|
-
if (skew
|
|
20458
|
+
if (skew === "end") {
|
|
20411
20459
|
styles.top = `${top + height + parallel}px`;
|
|
20412
20460
|
}
|
|
20413
20461
|
}
|
|
@@ -20859,7 +20907,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20859
20907
|
name: ""
|
|
20860
20908
|
};
|
|
20861
20909
|
const Swipe = React.forwardRef((props, instanceRef) => {
|
|
20862
|
-
const
|
|
20910
|
+
const classPrefix2 = "nut-swipe";
|
|
20863
20911
|
const touch = useTouch();
|
|
20864
20912
|
const { children, className, style } = { ...defaultProps$s, ...props };
|
|
20865
20913
|
const root2 = React.useRef();
|
|
@@ -20980,7 +21028,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20980
21028
|
"div",
|
|
20981
21029
|
{
|
|
20982
21030
|
ref: measuredRef,
|
|
20983
|
-
className: `${
|
|
21031
|
+
className: `${classPrefix2}__${side}`,
|
|
20984
21032
|
onClick: (e) => handleOperate(e, side)
|
|
20985
21033
|
},
|
|
20986
21034
|
props[`${side}Action`]
|
|
@@ -21020,13 +21068,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21020
21068
|
"div",
|
|
21021
21069
|
{
|
|
21022
21070
|
ref: root2,
|
|
21023
|
-
className: classNames(
|
|
21071
|
+
className: classNames(classPrefix2, className),
|
|
21024
21072
|
onTouchStart: (e) => onTouchStart(e),
|
|
21025
21073
|
onTouchMove: (e) => onTouchMove(e),
|
|
21026
21074
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
21027
21075
|
style
|
|
21028
21076
|
},
|
|
21029
|
-
/* @__PURE__ */ React.createElement("div", { className: `${
|
|
21077
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef))
|
|
21030
21078
|
);
|
|
21031
21079
|
});
|
|
21032
21080
|
Swipe.defaultProps = defaultProps$s;
|
|
@@ -21039,11 +21087,20 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21039
21087
|
this.close = this.close.bind(this);
|
|
21040
21088
|
this.startCloseTimer = this.startCloseTimer.bind(this);
|
|
21041
21089
|
this.clearCloseTimer = this.clearCloseTimer.bind(this);
|
|
21042
|
-
this.close = this.close.bind(this);
|
|
21043
21090
|
this.clickCover = this.clickCover.bind(this);
|
|
21091
|
+
this.state = {
|
|
21092
|
+
show: true
|
|
21093
|
+
};
|
|
21044
21094
|
}
|
|
21045
21095
|
close() {
|
|
21096
|
+
this.setState({
|
|
21097
|
+
show: false
|
|
21098
|
+
});
|
|
21046
21099
|
this.clearCloseTimer();
|
|
21100
|
+
if (this.props.id) {
|
|
21101
|
+
const element = document.getElementById(this.props.id);
|
|
21102
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
21103
|
+
}
|
|
21047
21104
|
this.props.onClose();
|
|
21048
21105
|
}
|
|
21049
21106
|
startCloseTimer() {
|
|
@@ -21108,6 +21165,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21108
21165
|
contentClassName,
|
|
21109
21166
|
contentStyle
|
|
21110
21167
|
} = this.props;
|
|
21168
|
+
const { show: show2 } = this.state;
|
|
21111
21169
|
const classes = classNames({
|
|
21112
21170
|
"nut-toast-has-icon": icon,
|
|
21113
21171
|
[`nut-toast-${size}`]: true
|
|
@@ -21115,11 +21173,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21115
21173
|
return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, /* @__PURE__ */ React__namespace.createElement(
|
|
21116
21174
|
Overlay,
|
|
21117
21175
|
{
|
|
21118
|
-
visible:
|
|
21176
|
+
visible: show2,
|
|
21119
21177
|
style,
|
|
21120
21178
|
className: `${classPrefix$7}__overlay-default ${className}`,
|
|
21121
21179
|
onClick: () => {
|
|
21122
|
-
console.log("onclick");
|
|
21123
21180
|
this.clickCover();
|
|
21124
21181
|
},
|
|
21125
21182
|
closeOnOverlayClick
|
|
@@ -21140,9 +21197,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
21140
21197
|
__publicField(Notification, "newInstance");
|
|
21141
21198
|
Notification.newInstance = (properties, callback) => {
|
|
21142
21199
|
const element = document.createElement("div");
|
|
21143
|
-
|
|
21144
|
-
|
|
21145
|
-
|
|
21200
|
+
const id = properties.id ? properties.id : `${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
21201
|
+
element.id = id;
|
|
21202
|
+
properties.id = id;
|
|
21146
21203
|
document.body.appendChild(element);
|
|
21147
21204
|
let called = false;
|
|
21148
21205
|
function ref(instance) {
|