@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.es.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
var _a;
|
|
8
8
|
/*!
|
|
9
|
-
* @nutui/nutui-react v2.0.0-alpha.
|
|
9
|
+
* @nutui/nutui-react v2.0.0-alpha.17 Wed Jun 14 2023 16:27:27 GMT+0800 (China Standard Time)
|
|
10
10
|
* (c) 2023 @jdf2e.
|
|
11
11
|
* Released under the MIT License.
|
|
12
12
|
*/
|
|
@@ -2402,6 +2402,7 @@ const defaultProps$1r = {
|
|
|
2402
2402
|
disabled: false,
|
|
2403
2403
|
block: false,
|
|
2404
2404
|
icon: null,
|
|
2405
|
+
nativeType: "button",
|
|
2405
2406
|
onClick: (e) => {
|
|
2406
2407
|
}
|
|
2407
2408
|
};
|
|
@@ -2421,6 +2422,7 @@ const Button = React__default.forwardRef(
|
|
|
2421
2422
|
onClick,
|
|
2422
2423
|
className,
|
|
2423
2424
|
style,
|
|
2425
|
+
nativeType,
|
|
2424
2426
|
...rest
|
|
2425
2427
|
} = {
|
|
2426
2428
|
...defaultProps$1r,
|
|
@@ -2454,6 +2456,7 @@ const Button = React__default.forwardRef(
|
|
|
2454
2456
|
{
|
|
2455
2457
|
...rest,
|
|
2456
2458
|
ref,
|
|
2459
|
+
type: nativeType,
|
|
2457
2460
|
className: classNames(
|
|
2458
2461
|
prefixCls,
|
|
2459
2462
|
className,
|
|
@@ -11162,6 +11165,7 @@ const Popup = (props) => {
|
|
|
11162
11165
|
}
|
|
11163
11166
|
};
|
|
11164
11167
|
const onHandleClickOverlay = (e) => {
|
|
11168
|
+
e.stopPropagation();
|
|
11165
11169
|
if (closeOnOverlayClick) {
|
|
11166
11170
|
const closed = onClickOverlay && onClickOverlay(e);
|
|
11167
11171
|
closed && close();
|
|
@@ -11203,7 +11207,7 @@ const Popup = (props) => {
|
|
|
11203
11207
|
{
|
|
11204
11208
|
classNames: transitionName,
|
|
11205
11209
|
unmountOnExit: true,
|
|
11206
|
-
timeout:
|
|
11210
|
+
timeout: 300,
|
|
11207
11211
|
in: innerVisible,
|
|
11208
11212
|
onEntered: onHandleOpened,
|
|
11209
11213
|
onExited: onHandleClosed
|
|
@@ -13816,7 +13820,7 @@ const Cascader = React__default.forwardRef(InternalCascader);
|
|
|
13816
13820
|
Cascader.defaultProps = defaultProps$Z;
|
|
13817
13821
|
Cascader.displayName = "NutCascader";
|
|
13818
13822
|
const CheckboxGroupContext = createContext(null);
|
|
13819
|
-
const Context = CheckboxGroupContext;
|
|
13823
|
+
const Context$1 = CheckboxGroupContext;
|
|
13820
13824
|
const defaultProps$Y = {
|
|
13821
13825
|
max: void 0,
|
|
13822
13826
|
labelPosition: "right",
|
|
@@ -13887,7 +13891,7 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
13887
13891
|
});
|
|
13888
13892
|
}, [options2, max]);
|
|
13889
13893
|
return /* @__PURE__ */ React__default.createElement(
|
|
13890
|
-
Context.Provider,
|
|
13894
|
+
Context$1.Provider,
|
|
13891
13895
|
{
|
|
13892
13896
|
value: {
|
|
13893
13897
|
labelPosition: labelPosition || "right",
|
|
@@ -13950,7 +13954,7 @@ const Checkbox = (props) => {
|
|
|
13950
13954
|
...others
|
|
13951
13955
|
} = props;
|
|
13952
13956
|
let { labelPosition, ...rest } = others;
|
|
13953
|
-
const ctx2 = useContext(Context);
|
|
13957
|
+
const ctx2 = useContext(Context$1);
|
|
13954
13958
|
let [innerChecked, setChecked] = usePropsValue({
|
|
13955
13959
|
value: props.checked,
|
|
13956
13960
|
defaultValue: props.defaultChecked,
|
|
@@ -14331,7 +14335,6 @@ function useRefs() {
|
|
|
14331
14335
|
}
|
|
14332
14336
|
const defaultProps$W = {
|
|
14333
14337
|
...ComponentDefaults,
|
|
14334
|
-
visible: false,
|
|
14335
14338
|
title: "",
|
|
14336
14339
|
options: [],
|
|
14337
14340
|
value: [],
|
|
@@ -14368,12 +14371,26 @@ const InternalPicker = (props, ref) => {
|
|
|
14368
14371
|
(_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
|
|
14369
14372
|
}
|
|
14370
14373
|
});
|
|
14374
|
+
const [innerVisible, setInnerVisible] = usePropsValue({
|
|
14375
|
+
value: props.visible,
|
|
14376
|
+
defaultValue: false,
|
|
14377
|
+
finalValue: false
|
|
14378
|
+
});
|
|
14371
14379
|
const [innerValue, setInnerValue] = useState(selectedValue);
|
|
14372
14380
|
const [columnIndex, setColumnIndex] = useState(0);
|
|
14373
14381
|
const pickerRef = useRef(null);
|
|
14374
14382
|
const [refs, setRefs] = useRefs();
|
|
14375
14383
|
const [columnsList, setColumnsList] = useState([]);
|
|
14376
14384
|
const isConfirmEvent = useRef(false);
|
|
14385
|
+
const actions = {
|
|
14386
|
+
open: () => {
|
|
14387
|
+
setInnerVisible(true);
|
|
14388
|
+
},
|
|
14389
|
+
close: () => {
|
|
14390
|
+
setInnerVisible(false);
|
|
14391
|
+
}
|
|
14392
|
+
};
|
|
14393
|
+
useImperativeHandle(ref, () => actions);
|
|
14377
14394
|
const formatCascade = (columns, values) => {
|
|
14378
14395
|
const formatted = [];
|
|
14379
14396
|
let columnOptions = {
|
|
@@ -14435,12 +14452,12 @@ const InternalPicker = (props, ref) => {
|
|
|
14435
14452
|
};
|
|
14436
14453
|
useEffect(() => {
|
|
14437
14454
|
setInnerValue(innerValue !== selectedValue ? selectedValue : innerValue);
|
|
14438
|
-
}, [
|
|
14455
|
+
}, [innerVisible]);
|
|
14439
14456
|
useEffect(() => {
|
|
14440
|
-
if (
|
|
14457
|
+
if (innerVisible) {
|
|
14441
14458
|
init();
|
|
14442
14459
|
}
|
|
14443
|
-
}, [options2,
|
|
14460
|
+
}, [options2, innerVisible]);
|
|
14444
14461
|
useEffect(() => {
|
|
14445
14462
|
onChange && onChange(setSelectedOptions(), innerValue, columnIndex);
|
|
14446
14463
|
}, [innerValue, columnsList]);
|
|
@@ -14513,6 +14530,7 @@ const InternalPicker = (props, ref) => {
|
|
|
14513
14530
|
}, 0);
|
|
14514
14531
|
};
|
|
14515
14532
|
const closePicker = () => {
|
|
14533
|
+
setInnerVisible(false);
|
|
14516
14534
|
onClose && onClose(setSelectedOptions(), innerValue);
|
|
14517
14535
|
afterClose && afterClose(setSelectedOptions(), innerValue, pickerRef);
|
|
14518
14536
|
};
|
|
@@ -14521,21 +14539,34 @@ const InternalPicker = (props, ref) => {
|
|
|
14521
14539
|
"span",
|
|
14522
14540
|
{
|
|
14523
14541
|
className: `${classPrefix2}__cancel-btn`,
|
|
14524
|
-
onClick: () =>
|
|
14542
|
+
onClick: (e) => {
|
|
14543
|
+
e.stopPropagation();
|
|
14544
|
+
closePicker();
|
|
14545
|
+
}
|
|
14525
14546
|
},
|
|
14526
14547
|
locale.cancel
|
|
14527
|
-
), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React__default.createElement(
|
|
14548
|
+
), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__title` }, title || ""), /* @__PURE__ */ React__default.createElement(
|
|
14549
|
+
"span",
|
|
14550
|
+
{
|
|
14551
|
+
className: `${classPrefix2}__confirm-btn`,
|
|
14552
|
+
onClick: (e) => {
|
|
14553
|
+
e.stopPropagation();
|
|
14554
|
+
confirm2();
|
|
14555
|
+
}
|
|
14556
|
+
},
|
|
14557
|
+
locale.confirm
|
|
14558
|
+
));
|
|
14528
14559
|
};
|
|
14529
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14560
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, typeof children === "function" && children(selectedValue), /* @__PURE__ */ React__default.createElement(
|
|
14530
14561
|
Popup,
|
|
14531
14562
|
{
|
|
14532
|
-
visible,
|
|
14563
|
+
visible: innerVisible,
|
|
14533
14564
|
position: "bottom",
|
|
14534
|
-
|
|
14565
|
+
afterClose: () => {
|
|
14535
14566
|
closePicker();
|
|
14536
14567
|
}
|
|
14537
14568
|
},
|
|
14538
|
-
/* @__PURE__ */ React__default.createElement("div", { className: classes, style, ...rest }, renderTitleBar(), children, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__panel`, ref: pickerRef }, columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
14569
|
+
/* @__PURE__ */ React__default.createElement("div", { className: classes, style, ...rest }, renderTitleBar(), typeof children !== "function" && children, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__panel`, ref: pickerRef }, columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
14539
14570
|
return /* @__PURE__ */ React__default.createElement(
|
|
14540
14571
|
PickerPanel$1,
|
|
14541
14572
|
{
|
|
@@ -14550,35 +14581,35 @@ const InternalPicker = (props, ref) => {
|
|
|
14550
14581
|
}
|
|
14551
14582
|
);
|
|
14552
14583
|
})))
|
|
14553
|
-
);
|
|
14584
|
+
));
|
|
14554
14585
|
};
|
|
14555
14586
|
const Picker = React__default.forwardRef(InternalPicker);
|
|
14556
14587
|
const Picker$1 = Picker;
|
|
14557
14588
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
14558
14589
|
const defaultProps$V = {
|
|
14559
|
-
|
|
14590
|
+
...ComponentDefaults,
|
|
14560
14591
|
visible: false,
|
|
14561
14592
|
title: "",
|
|
14562
14593
|
type: "date",
|
|
14563
|
-
|
|
14594
|
+
showChinese: false,
|
|
14564
14595
|
threeDimensional: true,
|
|
14565
14596
|
minuteStep: 1,
|
|
14566
|
-
|
|
14567
|
-
|
|
14597
|
+
startDate: new Date(currentYear - 10, 0, 1),
|
|
14598
|
+
endDate: new Date(currentYear + 10, 11, 31)
|
|
14568
14599
|
};
|
|
14569
14600
|
const DatePicker = (props) => {
|
|
14570
14601
|
const {
|
|
14571
|
-
|
|
14572
|
-
|
|
14602
|
+
startDate,
|
|
14603
|
+
endDate,
|
|
14573
14604
|
type: type4,
|
|
14574
|
-
|
|
14605
|
+
showChinese,
|
|
14575
14606
|
minuteStep,
|
|
14576
|
-
modelValue,
|
|
14577
14607
|
visible,
|
|
14578
14608
|
title,
|
|
14609
|
+
defaultValue,
|
|
14579
14610
|
formatter,
|
|
14580
|
-
|
|
14581
|
-
|
|
14611
|
+
onClose,
|
|
14612
|
+
onConfirm,
|
|
14582
14613
|
filter,
|
|
14583
14614
|
onChange,
|
|
14584
14615
|
threeDimensional,
|
|
@@ -14590,14 +14621,6 @@ const DatePicker = (props) => {
|
|
|
14590
14621
|
...props
|
|
14591
14622
|
};
|
|
14592
14623
|
const { locale } = useConfig();
|
|
14593
|
-
const [show2, setShow] = useState(false);
|
|
14594
|
-
const [currentDate, setCurrentDate] = useState(modelValue);
|
|
14595
|
-
const [defaultValue, setDefaultValue] = useState([]);
|
|
14596
|
-
const [options2, setListData] = useState([]);
|
|
14597
|
-
const pickerRef = useRef(null);
|
|
14598
|
-
const isDate = (val) => {
|
|
14599
|
-
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
14600
|
-
};
|
|
14601
14624
|
const datepickerLang = locale.datepicker;
|
|
14602
14625
|
const zhCNType = {
|
|
14603
14626
|
day: datepickerLang.day,
|
|
@@ -14607,20 +14630,32 @@ const DatePicker = (props) => {
|
|
|
14607
14630
|
minute: datepickerLang.min,
|
|
14608
14631
|
seconds: datepickerLang.seconds
|
|
14609
14632
|
};
|
|
14633
|
+
const [defaultValueOfPicker, setDefaultValueOfPicker] = useState([]);
|
|
14634
|
+
const [options2, setOptions] = useState([]);
|
|
14635
|
+
const isDate = (val) => {
|
|
14636
|
+
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
14637
|
+
};
|
|
14610
14638
|
const formatValue = (value) => {
|
|
14611
14639
|
let cvalue = value;
|
|
14612
14640
|
if (!cvalue || cvalue && !isDate(cvalue)) {
|
|
14613
|
-
cvalue =
|
|
14641
|
+
cvalue = startDate;
|
|
14614
14642
|
}
|
|
14615
|
-
let timestmp = Math.max(cvalue.getTime(),
|
|
14616
|
-
timestmp = Math.min(timestmp,
|
|
14643
|
+
let timestmp = Math.max(cvalue.getTime(), startDate.getTime());
|
|
14644
|
+
timestmp = Math.min(timestmp, endDate.getTime());
|
|
14617
14645
|
return new Date(timestmp);
|
|
14618
14646
|
};
|
|
14647
|
+
const [currentDate, setCurrentDate] = usePropsValue({
|
|
14648
|
+
value: props.value && formatValue(props.value),
|
|
14649
|
+
defaultValue: formatValue(props.defaultValue || null),
|
|
14650
|
+
finalValue: null,
|
|
14651
|
+
onChange: (val) => {
|
|
14652
|
+
}
|
|
14653
|
+
});
|
|
14619
14654
|
function getMonthEndDay(year, month) {
|
|
14620
14655
|
return new Date(year, month, 0).getDate();
|
|
14621
14656
|
}
|
|
14622
14657
|
const getBoundary = (type22, value) => {
|
|
14623
|
-
const boundary = type22 === "min" ?
|
|
14658
|
+
const boundary = type22 === "min" ? startDate : endDate;
|
|
14624
14659
|
const year = boundary.getFullYear();
|
|
14625
14660
|
let month = 1;
|
|
14626
14661
|
let date4 = 1;
|
|
@@ -14654,12 +14689,12 @@ const DatePicker = (props) => {
|
|
|
14654
14689
|
[`${type22}Seconds`]: seconds
|
|
14655
14690
|
};
|
|
14656
14691
|
};
|
|
14657
|
-
const ranges = (
|
|
14658
|
-
const curDate =
|
|
14692
|
+
const ranges = () => {
|
|
14693
|
+
const curDate = currentDate;
|
|
14659
14694
|
if (!curDate)
|
|
14660
14695
|
return [];
|
|
14661
|
-
const { maxYear, maxDate
|
|
14662
|
-
const { minYear, minDate
|
|
14696
|
+
const { maxYear, maxDate, maxMonth, maxHour, maxMinute, maxSeconds } = getBoundary("max", curDate);
|
|
14697
|
+
const { minYear, minDate, minMonth, minHour, minMinute, minSeconds } = getBoundary("min", curDate);
|
|
14663
14698
|
let result = [
|
|
14664
14699
|
{
|
|
14665
14700
|
type: "year",
|
|
@@ -14671,7 +14706,7 @@ const DatePicker = (props) => {
|
|
|
14671
14706
|
},
|
|
14672
14707
|
{
|
|
14673
14708
|
type: "day",
|
|
14674
|
-
range: [
|
|
14709
|
+
range: [minDate, maxDate]
|
|
14675
14710
|
},
|
|
14676
14711
|
{
|
|
14677
14712
|
type: "hour",
|
|
@@ -14711,7 +14746,7 @@ const DatePicker = (props) => {
|
|
|
14711
14746
|
}
|
|
14712
14747
|
return result;
|
|
14713
14748
|
};
|
|
14714
|
-
const updateChooseValueCustmer = (
|
|
14749
|
+
const updateChooseValueCustmer = (selectedOptions, selectedValue, index) => {
|
|
14715
14750
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
14716
14751
|
type4.toLocaleLowerCase()
|
|
14717
14752
|
)) {
|
|
@@ -14721,11 +14756,13 @@ const DatePicker = (props) => {
|
|
|
14721
14756
|
});
|
|
14722
14757
|
if (type4.toLocaleLowerCase() === "month-day" && formatDate.length < 3) {
|
|
14723
14758
|
formatDate.unshift(
|
|
14724
|
-
new Date(
|
|
14759
|
+
new Date(defaultValue || startDate || endDate).getFullYear()
|
|
14725
14760
|
);
|
|
14726
14761
|
}
|
|
14727
14762
|
if (type4.toLocaleLowerCase() === "year-month" && formatDate.length < 3) {
|
|
14728
|
-
formatDate.push(
|
|
14763
|
+
formatDate.push(
|
|
14764
|
+
new Date(defaultValue || startDate || endDate).getDate()
|
|
14765
|
+
);
|
|
14729
14766
|
}
|
|
14730
14767
|
const year = Number(formatDate[0]);
|
|
14731
14768
|
const month = Number(formatDate[1]) - 1;
|
|
@@ -14750,7 +14787,7 @@ const DatePicker = (props) => {
|
|
|
14750
14787
|
const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date4 == null ? void 0 : date4.getTime());
|
|
14751
14788
|
date4 && isDate(date4) && !isEqual2 && setCurrentDate(formatValue(date4));
|
|
14752
14789
|
}
|
|
14753
|
-
props.onChange && props.onChange(
|
|
14790
|
+
props.onChange && props.onChange(selectedOptions, selectedValue, index);
|
|
14754
14791
|
};
|
|
14755
14792
|
const padZero = (num, targetLength = 2) => {
|
|
14756
14793
|
let str = `${num}`;
|
|
@@ -14768,12 +14805,13 @@ const DatePicker = (props) => {
|
|
|
14768
14805
|
});
|
|
14769
14806
|
} else {
|
|
14770
14807
|
const padMin = padZero(value, 2);
|
|
14771
|
-
const fatter =
|
|
14808
|
+
const fatter = showChinese ? zhCNType[type22] : "";
|
|
14772
14809
|
fOption = { text: padMin + fatter, value: padMin };
|
|
14773
14810
|
}
|
|
14774
14811
|
return fOption;
|
|
14775
14812
|
};
|
|
14776
14813
|
const generateValue = (min, max, val, type22, columnIndex) => {
|
|
14814
|
+
var _a2;
|
|
14777
14815
|
let cmin = min;
|
|
14778
14816
|
const arr = [];
|
|
14779
14817
|
let index = 0;
|
|
@@ -14788,8 +14826,8 @@ const DatePicker = (props) => {
|
|
|
14788
14826
|
index++;
|
|
14789
14827
|
}
|
|
14790
14828
|
}
|
|
14791
|
-
|
|
14792
|
-
|
|
14829
|
+
defaultValueOfPicker[columnIndex] = (_a2 = arr[index]) == null ? void 0 : _a2.value;
|
|
14830
|
+
setDefaultValueOfPicker([...defaultValueOfPicker]);
|
|
14793
14831
|
if (props.filter && props.filter(type22, arr)) {
|
|
14794
14832
|
return props.filter(type22, arr);
|
|
14795
14833
|
}
|
|
@@ -14814,8 +14852,8 @@ const DatePicker = (props) => {
|
|
|
14814
14852
|
}
|
|
14815
14853
|
return d;
|
|
14816
14854
|
};
|
|
14817
|
-
const columns = (
|
|
14818
|
-
const val = ranges(
|
|
14855
|
+
const columns = () => {
|
|
14856
|
+
const val = ranges().map((res, columnIndex) => {
|
|
14819
14857
|
return generateValue(
|
|
14820
14858
|
res.range[0],
|
|
14821
14859
|
res.range[1],
|
|
@@ -14826,46 +14864,28 @@ const DatePicker = (props) => {
|
|
|
14826
14864
|
});
|
|
14827
14865
|
return val || [];
|
|
14828
14866
|
};
|
|
14829
|
-
useEffect(() => {
|
|
14830
|
-
setCurrentDate(formatValue(modelValue));
|
|
14831
|
-
}, []);
|
|
14832
|
-
useEffect(() => {
|
|
14833
|
-
setCurrentDate(formatValue(modelValue));
|
|
14834
|
-
}, [modelValue]);
|
|
14835
|
-
useEffect(() => {
|
|
14836
|
-
setShow(visible);
|
|
14837
|
-
}, [visible]);
|
|
14838
14867
|
useEffect(() => {
|
|
14839
14868
|
if (currentDate) {
|
|
14840
|
-
|
|
14869
|
+
setOptions(columns());
|
|
14841
14870
|
}
|
|
14842
|
-
}, [
|
|
14843
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
14844
|
-
|
|
14871
|
+
}, []);
|
|
14872
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: `nut-datepicker ${className}`, style, ...rest }, options2.length && /* @__PURE__ */ React__default.createElement(
|
|
14873
|
+
Picker$1,
|
|
14845
14874
|
{
|
|
14846
|
-
|
|
14847
|
-
|
|
14848
|
-
|
|
14849
|
-
|
|
14850
|
-
|
|
14851
|
-
|
|
14852
|
-
|
|
14853
|
-
|
|
14854
|
-
|
|
14855
|
-
|
|
14856
|
-
onClose: onCloseDatePicker,
|
|
14857
|
-
defaultValue,
|
|
14858
|
-
onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
|
|
14859
|
-
onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
|
|
14860
|
-
threeDimensional,
|
|
14861
|
-
ref: pickerRef
|
|
14862
|
-
}
|
|
14863
|
-
)
|
|
14864
|
-
);
|
|
14875
|
+
title,
|
|
14876
|
+
visible,
|
|
14877
|
+
options: options2,
|
|
14878
|
+
onClose,
|
|
14879
|
+
defaultValue: defaultValueOfPicker,
|
|
14880
|
+
onConfirm: (options22, value) => onConfirm && onConfirm(options22, value),
|
|
14881
|
+
onChange: (options22, value, index) => updateChooseValueCustmer(options22, value, index),
|
|
14882
|
+
threeDimensional
|
|
14883
|
+
}
|
|
14884
|
+
));
|
|
14865
14885
|
};
|
|
14866
14886
|
DatePicker.defaultProps = defaultProps$V;
|
|
14867
14887
|
DatePicker.displayName = "NutDatePicker";
|
|
14868
|
-
const
|
|
14888
|
+
const Context = createContext({});
|
|
14869
14889
|
function _extends() {
|
|
14870
14890
|
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
14871
14891
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -15921,13 +15941,15 @@ Schema.messages = messages;
|
|
|
15921
15941
|
Schema.validators = validators;
|
|
15922
15942
|
class FormStore {
|
|
15923
15943
|
constructor() {
|
|
15924
|
-
|
|
15944
|
+
// 初始化数据
|
|
15945
|
+
__publicField(this, "initialValues", {});
|
|
15925
15946
|
// 存放表单中所有的数据 eg. {password: "ddd",username: "123"}
|
|
15926
|
-
__publicField(this, "
|
|
15947
|
+
__publicField(this, "store", {});
|
|
15927
15948
|
// 所有的组件实例
|
|
15928
|
-
|
|
15949
|
+
__publicField(this, "fieldEntities", []);
|
|
15950
|
+
// 校验成功或失败的回调,onFinish、onFinishFailed
|
|
15929
15951
|
__publicField(this, "callbacks", {});
|
|
15930
|
-
__publicField(this, "
|
|
15952
|
+
__publicField(this, "errors", []);
|
|
15931
15953
|
/**
|
|
15932
15954
|
* 注册组件实例
|
|
15933
15955
|
* @param field
|
|
@@ -15936,11 +15958,29 @@ class FormStore {
|
|
|
15936
15958
|
this.fieldEntities.push(field);
|
|
15937
15959
|
return () => {
|
|
15938
15960
|
this.fieldEntities = this.fieldEntities.filter((item) => item != field);
|
|
15939
|
-
|
|
15961
|
+
if (this.store) {
|
|
15962
|
+
delete this.store[field.props.name];
|
|
15963
|
+
}
|
|
15940
15964
|
};
|
|
15941
15965
|
});
|
|
15966
|
+
/**
|
|
15967
|
+
* 获取 formItem 的值
|
|
15968
|
+
* @param name
|
|
15969
|
+
*/
|
|
15942
15970
|
__publicField(this, "getFieldValue", (name) => {
|
|
15943
|
-
|
|
15971
|
+
var _a2;
|
|
15972
|
+
return (_a2 = this.store) == null ? void 0 : _a2[name];
|
|
15973
|
+
});
|
|
15974
|
+
/**
|
|
15975
|
+
* 设置 form 的初始值,之后在 reset 的时候使用
|
|
15976
|
+
* @param values
|
|
15977
|
+
* @param init
|
|
15978
|
+
*/
|
|
15979
|
+
__publicField(this, "setInitialValues", (values, init) => {
|
|
15980
|
+
if (init) {
|
|
15981
|
+
this.initialValues = values;
|
|
15982
|
+
this.store = values;
|
|
15983
|
+
}
|
|
15944
15984
|
});
|
|
15945
15985
|
/**
|
|
15946
15986
|
* 存储组件数据
|
|
@@ -15955,34 +15995,28 @@ class FormStore {
|
|
|
15955
15995
|
const { name } = enetity.props;
|
|
15956
15996
|
Object.keys(newStore).forEach((key) => {
|
|
15957
15997
|
if (key === name) {
|
|
15958
|
-
enetity.onStoreChange();
|
|
15998
|
+
enetity.onStoreChange("update");
|
|
15959
15999
|
}
|
|
15960
16000
|
});
|
|
15961
16001
|
});
|
|
15962
16002
|
});
|
|
15963
|
-
|
|
15964
|
-
|
|
15965
|
-
|
|
15966
|
-
|
|
15967
|
-
|
|
15968
|
-
|
|
15969
|
-
* required: true,
|
|
15970
|
-
* validator: (rule, value) => {
|
|
15971
|
-
* return /^[a-zA-Z0-9]+$/.test(value)
|
|
15972
|
-
* },
|
|
15973
|
-
* },
|
|
15974
|
-
* }
|
|
15975
|
-
*/
|
|
16003
|
+
__publicField(this, "setCallback", (callback) => {
|
|
16004
|
+
this.callbacks = {
|
|
16005
|
+
...this.callbacks,
|
|
16006
|
+
...callback
|
|
16007
|
+
};
|
|
16008
|
+
});
|
|
15976
16009
|
__publicField(this, "validate", () => {
|
|
15977
16010
|
const err = [];
|
|
15978
|
-
this.
|
|
16011
|
+
this.errors.length = 0;
|
|
15979
16012
|
this.fieldEntities.forEach((entity) => {
|
|
16013
|
+
var _a2;
|
|
15980
16014
|
const { name, rules: rules2 = [] } = entity.props;
|
|
15981
16015
|
const descriptor = {};
|
|
15982
16016
|
if (rules2.length) {
|
|
15983
16017
|
if (rules2.length > 1) {
|
|
15984
16018
|
descriptor[name] = [];
|
|
15985
|
-
rules2.
|
|
16019
|
+
rules2.forEach((v) => {
|
|
15986
16020
|
descriptor[name].push(v);
|
|
15987
16021
|
});
|
|
15988
16022
|
} else {
|
|
@@ -15990,39 +16024,36 @@ class FormStore {
|
|
|
15990
16024
|
}
|
|
15991
16025
|
}
|
|
15992
16026
|
const validator = new Schema(descriptor);
|
|
15993
|
-
validator.
|
|
16027
|
+
validator.messages();
|
|
16028
|
+
validator.validate({ [name]: (_a2 = this.store) == null ? void 0 : _a2[name] }, (errors) => {
|
|
15994
16029
|
if (errors) {
|
|
15995
16030
|
err.push(...errors);
|
|
15996
|
-
this.
|
|
16031
|
+
this.errors.push(...errors);
|
|
15997
16032
|
}
|
|
15998
|
-
entity.onStoreChange();
|
|
16033
|
+
entity.onStoreChange("validate");
|
|
15999
16034
|
});
|
|
16000
16035
|
});
|
|
16001
16036
|
return err;
|
|
16002
16037
|
});
|
|
16003
|
-
__publicField(this, "setCallback", (callback) => {
|
|
16004
|
-
this.callbacks = {
|
|
16005
|
-
...this.callbacks,
|
|
16006
|
-
...callback
|
|
16007
|
-
};
|
|
16008
|
-
});
|
|
16009
16038
|
__publicField(this, "submit", () => {
|
|
16010
16039
|
var _a2, _b, _c, _d;
|
|
16011
|
-
const
|
|
16012
|
-
if (
|
|
16040
|
+
const errors = this.validate();
|
|
16041
|
+
if (errors.length === 0) {
|
|
16013
16042
|
(_b = (_a2 = this.callbacks).onFinish) == null ? void 0 : _b.call(_a2, this.store);
|
|
16014
|
-
} else if (
|
|
16015
|
-
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c,
|
|
16043
|
+
} else if (errors.length > 0) {
|
|
16044
|
+
(_d = (_c = this.callbacks).onFinishFailed) == null ? void 0 : _d.call(_c, this.store, errors);
|
|
16016
16045
|
}
|
|
16017
16046
|
});
|
|
16018
16047
|
__publicField(this, "resetFields", () => {
|
|
16019
|
-
this.
|
|
16020
|
-
this.
|
|
16021
|
-
|
|
16048
|
+
this.errors.length = 0;
|
|
16049
|
+
this.store = this.initialValues;
|
|
16050
|
+
this.fieldEntities.forEach((entity) => {
|
|
16051
|
+
entity.onStoreChange("reset");
|
|
16022
16052
|
});
|
|
16023
16053
|
});
|
|
16024
16054
|
__publicField(this, "getForm", () => {
|
|
16025
16055
|
return {
|
|
16056
|
+
setInitialValues: this.setInitialValues,
|
|
16026
16057
|
setCallback: this.setCallback,
|
|
16027
16058
|
registerField: this.registerField,
|
|
16028
16059
|
getFieldValue: this.getFieldValue,
|
|
@@ -16030,12 +16061,12 @@ class FormStore {
|
|
|
16030
16061
|
resetFields: this.resetFields,
|
|
16031
16062
|
submit: this.submit,
|
|
16032
16063
|
store: this.store,
|
|
16033
|
-
|
|
16064
|
+
errors: this.errors,
|
|
16034
16065
|
fieldEntities: this.fieldEntities
|
|
16035
16066
|
};
|
|
16036
16067
|
});
|
|
16037
16068
|
this.callbacks = {
|
|
16038
|
-
onFinish: (
|
|
16069
|
+
onFinish: () => {
|
|
16039
16070
|
},
|
|
16040
16071
|
onFinishFailed: () => {
|
|
16041
16072
|
}
|
|
@@ -16054,98 +16085,113 @@ const useForm = (form) => {
|
|
|
16054
16085
|
}
|
|
16055
16086
|
return [formRef.current];
|
|
16056
16087
|
};
|
|
16088
|
+
function isForwardRefComponent(component) {
|
|
16089
|
+
return component.type && component.type.$$typeof && // eslint-disable-next-line react/display-name
|
|
16090
|
+
React__default.forwardRef(
|
|
16091
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16092
|
+
// @ts-ignore
|
|
16093
|
+
() => {
|
|
16094
|
+
}
|
|
16095
|
+
).$$typeof === component.type.$$typeof;
|
|
16096
|
+
}
|
|
16057
16097
|
const defaultProps$U = {
|
|
16058
16098
|
...ComponentDefaults,
|
|
16099
|
+
required: false,
|
|
16059
16100
|
name: "",
|
|
16060
16101
|
label: "",
|
|
16061
|
-
className: "",
|
|
16062
16102
|
rules: [{ required: false, message: "" }],
|
|
16063
|
-
|
|
16064
|
-
labelWidth: 90,
|
|
16065
|
-
errorMessageAlign: "left",
|
|
16066
|
-
showErrorLine: true,
|
|
16067
|
-
showErrorMessage: true,
|
|
16068
|
-
initialValue: ""
|
|
16103
|
+
errorMessageAlign: "left"
|
|
16069
16104
|
};
|
|
16070
16105
|
class FormItem extends React__default.Component {
|
|
16071
|
-
constructor() {
|
|
16072
|
-
super(
|
|
16106
|
+
constructor(props) {
|
|
16107
|
+
super(props);
|
|
16073
16108
|
__publicField(this, "cancelRegister");
|
|
16074
|
-
__publicField(this, "
|
|
16109
|
+
__publicField(this, "componentRef");
|
|
16075
16110
|
// children添加value属性和onChange事件
|
|
16076
16111
|
__publicField(this, "getControlled", (children) => {
|
|
16077
|
-
var _a2
|
|
16078
|
-
const {
|
|
16112
|
+
var _a2;
|
|
16113
|
+
const { setFieldsValue, getFieldValue } = this.context;
|
|
16079
16114
|
const { name } = this.props;
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
defaultValue: getFieldValue(name),
|
|
16089
|
-
onChange: (event) => {
|
|
16090
|
-
const originOnChange = children.props.onChange;
|
|
16115
|
+
if ((_a2 = children == null ? void 0 : children.props) == null ? void 0 : _a2.defaultValue) {
|
|
16116
|
+
console.warn("通过 initialValue 设置初始值");
|
|
16117
|
+
}
|
|
16118
|
+
const controlled = {
|
|
16119
|
+
...children.props,
|
|
16120
|
+
[this.props.valuePropName || "value"]: getFieldValue(name) || this.props.initialValue,
|
|
16121
|
+
[this.props.trigger || "onChange"]: (...args) => {
|
|
16122
|
+
const originOnChange = children.props[this.props.trigger || "onChange"];
|
|
16091
16123
|
if (originOnChange) {
|
|
16092
|
-
originOnChange(
|
|
16124
|
+
originOnChange(...args);
|
|
16093
16125
|
}
|
|
16094
|
-
let
|
|
16095
|
-
|
|
16096
|
-
|
|
16097
|
-
newValue = event.target.value;
|
|
16098
|
-
break;
|
|
16126
|
+
let [next] = args;
|
|
16127
|
+
if (this.props.getValueFromEvent) {
|
|
16128
|
+
next = this.props.getValueFromEvent(...args);
|
|
16099
16129
|
}
|
|
16100
|
-
setFieldsValue({ [name]:
|
|
16130
|
+
setFieldsValue({ [name]: next });
|
|
16101
16131
|
}
|
|
16102
16132
|
};
|
|
16133
|
+
if (isForwardRefComponent(children)) {
|
|
16134
|
+
controlled.ref = (componentInstance) => {
|
|
16135
|
+
const originRef = children.ref;
|
|
16136
|
+
if (originRef) {
|
|
16137
|
+
if (typeof originRef === "function") {
|
|
16138
|
+
originRef(componentInstance);
|
|
16139
|
+
}
|
|
16140
|
+
if ("current" in originRef) {
|
|
16141
|
+
originRef.current = componentInstance;
|
|
16142
|
+
}
|
|
16143
|
+
}
|
|
16144
|
+
this.componentRef = componentInstance;
|
|
16145
|
+
};
|
|
16146
|
+
}
|
|
16147
|
+
return controlled;
|
|
16103
16148
|
});
|
|
16104
|
-
__publicField(this, "
|
|
16105
|
-
this.
|
|
16149
|
+
__publicField(this, "refresh", () => {
|
|
16150
|
+
this.setState(({ resetCount }) => ({
|
|
16151
|
+
resetCount: resetCount + 1
|
|
16152
|
+
}));
|
|
16153
|
+
});
|
|
16154
|
+
__publicField(this, "onStoreChange", (type4) => {
|
|
16155
|
+
if (type4 === "reset") {
|
|
16156
|
+
this.refresh();
|
|
16157
|
+
} else {
|
|
16158
|
+
this.forceUpdate();
|
|
16159
|
+
}
|
|
16106
16160
|
});
|
|
16107
16161
|
__publicField(this, "renderLayout", (childNode) => {
|
|
16108
16162
|
var _a2, _b;
|
|
16109
|
-
const {
|
|
16110
|
-
label,
|
|
16111
|
-
name,
|
|
16112
|
-
rules: rules2 = [{ required: false, message: "" }],
|
|
16113
|
-
className,
|
|
16114
|
-
labelWidth,
|
|
16115
|
-
errorMessageAlign,
|
|
16116
|
-
showErrorLine,
|
|
16117
|
-
showErrorMessage
|
|
16118
|
-
} = {
|
|
16163
|
+
const { label, name, required: required4, className, style, errorMessageAlign } = {
|
|
16119
16164
|
...defaultProps$U,
|
|
16120
16165
|
...this.props
|
|
16121
16166
|
};
|
|
16122
|
-
const item = ((_a2 = this.context.
|
|
16167
|
+
const item = ((_a2 = this.context.errors) == null ? void 0 : _a2.length) > 0 && ((_b = this.context.errors) == null ? void 0 : _b.filter((item2) => {
|
|
16123
16168
|
return item2.field === name;
|
|
16124
16169
|
}));
|
|
16125
|
-
const {
|
|
16126
|
-
const renderStar =
|
|
16127
|
-
const renderLabel =
|
|
16128
|
-
return /* @__PURE__ */ React__default.createElement(
|
|
16129
|
-
|
|
16130
|
-
{
|
|
16131
|
-
className: "nut-cell__title nut-form-item__label",
|
|
16132
|
-
style: {
|
|
16133
|
-
width: this.pxCheck(labelWidth)
|
|
16134
|
-
}
|
|
16135
|
-
},
|
|
16136
|
-
renderLabel
|
|
16137
|
-
) : null, /* @__PURE__ */ React__default.createElement("div", { className: "nut-cell__value nut-form-item__body" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item__body__slots" }, childNode), item.length > 0 && /* @__PURE__ */ React__default.createElement(
|
|
16138
|
-
"div",
|
|
16170
|
+
const { starPosition } = this.context;
|
|
16171
|
+
const renderStar = required4 && /* @__PURE__ */ React__default.createElement("i", { className: "required" });
|
|
16172
|
+
const renderLabel = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, starPosition === "left" ? renderStar : null, label, starPosition === "right" ? renderStar : null);
|
|
16173
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
16174
|
+
Cell,
|
|
16139
16175
|
{
|
|
16140
|
-
className:
|
|
16141
|
-
style
|
|
16176
|
+
className: `nut-form-item ${className}`,
|
|
16177
|
+
style,
|
|
16178
|
+
onClick: (e) => this.props.onClick && this.props.onClick(e, this.componentRef)
|
|
16142
16179
|
},
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16180
|
+
label ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-cell__title nut-form-item__label" }, renderLabel) : null,
|
|
16181
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-cell__value nut-form-item__body" }, /* @__PURE__ */ React__default.createElement("div", { className: "nut-form-item__body__slots" }, childNode), item.length > 0 && /* @__PURE__ */ React__default.createElement(
|
|
16182
|
+
"div",
|
|
16183
|
+
{
|
|
16184
|
+
className: "nut-form-item__body__tips",
|
|
16185
|
+
style: { textAlign: errorMessageAlign }
|
|
16186
|
+
},
|
|
16187
|
+
item[0].message
|
|
16188
|
+
))
|
|
16189
|
+
);
|
|
16148
16190
|
});
|
|
16191
|
+
this.componentRef = React__default.createRef();
|
|
16192
|
+
this.state = {
|
|
16193
|
+
resetCount: 1
|
|
16194
|
+
};
|
|
16149
16195
|
}
|
|
16150
16196
|
componentDidMount() {
|
|
16151
16197
|
this.cancelRegister = this.context.registerField(this);
|
|
@@ -16156,81 +16202,86 @@ class FormItem extends React__default.Component {
|
|
|
16156
16202
|
}
|
|
16157
16203
|
}
|
|
16158
16204
|
render() {
|
|
16159
|
-
const { children
|
|
16160
|
-
const
|
|
16161
|
-
let restCNode = c;
|
|
16162
|
-
if (initialValue) {
|
|
16163
|
-
restCNode = React__default.cloneElement(c, {
|
|
16164
|
-
defaultValue: initialValue
|
|
16165
|
-
});
|
|
16166
|
-
}
|
|
16205
|
+
const { children } = this.props;
|
|
16206
|
+
const child = Array.isArray(children) ? children[0] : children;
|
|
16167
16207
|
const returnChildNode = React__default.cloneElement(
|
|
16168
|
-
|
|
16169
|
-
this.getControlled(
|
|
16208
|
+
child,
|
|
16209
|
+
this.getControlled(child)
|
|
16170
16210
|
);
|
|
16171
|
-
return this.renderLayout(returnChildNode);
|
|
16211
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, { key: this.state.resetCount }, this.renderLayout(returnChildNode));
|
|
16172
16212
|
}
|
|
16173
16213
|
}
|
|
16174
16214
|
__publicField(FormItem, "defaultProps", defaultProps$U);
|
|
16175
|
-
__publicField(FormItem, "contextType",
|
|
16215
|
+
__publicField(FormItem, "contextType", Context);
|
|
16176
16216
|
const defaultProps$T = {
|
|
16177
16217
|
...ComponentDefaults,
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
labelPosition: "Right",
|
|
16182
|
-
formGroupTitle: "",
|
|
16183
|
-
onFinish: (obj) => {
|
|
16184
|
-
},
|
|
16185
|
-
onFinishFailed: (value) => {
|
|
16218
|
+
labelPosition: "right",
|
|
16219
|
+
starPosition: "left",
|
|
16220
|
+
onFinish: (values) => {
|
|
16186
16221
|
},
|
|
16187
|
-
|
|
16222
|
+
onFinishFailed: (values, errorFields) => {
|
|
16223
|
+
}
|
|
16188
16224
|
};
|
|
16189
16225
|
const PositionInfo = {
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16226
|
+
top: "form-layout-top",
|
|
16227
|
+
left: "form-layout-left",
|
|
16228
|
+
right: "form-layout-right"
|
|
16193
16229
|
};
|
|
16194
16230
|
const Form = (props) => {
|
|
16231
|
+
const classPrefix2 = "nut-form";
|
|
16195
16232
|
const {
|
|
16233
|
+
className,
|
|
16234
|
+
style,
|
|
16235
|
+
footer,
|
|
16196
16236
|
children,
|
|
16237
|
+
initialValues,
|
|
16197
16238
|
onFinish,
|
|
16198
16239
|
onFinishFailed,
|
|
16199
16240
|
labelPosition,
|
|
16200
|
-
|
|
16201
|
-
form
|
|
16202
|
-
...rest
|
|
16241
|
+
starPosition,
|
|
16242
|
+
form
|
|
16203
16243
|
} = {
|
|
16204
16244
|
...defaultProps$T,
|
|
16205
16245
|
...props
|
|
16206
16246
|
};
|
|
16207
|
-
let formInstance
|
|
16208
|
-
if (
|
|
16247
|
+
let formInstance;
|
|
16248
|
+
if (form !== void 0) {
|
|
16209
16249
|
formInstance = form;
|
|
16210
16250
|
} else {
|
|
16211
16251
|
[formInstance] = useForm();
|
|
16212
16252
|
}
|
|
16213
|
-
formInstance.
|
|
16214
|
-
const { setCallback, submit, resetFields } = formInstance;
|
|
16253
|
+
formInstance.starPosition = starPosition;
|
|
16254
|
+
const { setCallback, submit, resetFields, setInitialValues } = formInstance;
|
|
16215
16255
|
setCallback({
|
|
16216
16256
|
onFinish,
|
|
16217
16257
|
onFinishFailed
|
|
16218
16258
|
});
|
|
16259
|
+
const mountRef = React__default.useRef(false);
|
|
16260
|
+
setInitialValues(initialValues, !mountRef.current);
|
|
16261
|
+
if (!mountRef.current) {
|
|
16262
|
+
mountRef.current = true;
|
|
16263
|
+
}
|
|
16219
16264
|
return /* @__PURE__ */ React__default.createElement(
|
|
16220
16265
|
"form",
|
|
16221
16266
|
{
|
|
16222
|
-
className:
|
|
16223
|
-
|
|
16267
|
+
className: classNames(
|
|
16268
|
+
classPrefix2,
|
|
16269
|
+
className,
|
|
16270
|
+
PositionInfo[labelPosition]
|
|
16271
|
+
),
|
|
16272
|
+
style,
|
|
16224
16273
|
onSubmit: (e) => {
|
|
16225
16274
|
e.preventDefault();
|
|
16275
|
+
e.stopPropagation();
|
|
16226
16276
|
submit();
|
|
16227
16277
|
},
|
|
16228
16278
|
onReset: (e) => {
|
|
16229
16279
|
e.preventDefault();
|
|
16280
|
+
e.stopPropagation();
|
|
16230
16281
|
resetFields();
|
|
16231
16282
|
}
|
|
16232
16283
|
},
|
|
16233
|
-
/* @__PURE__ */ React__default.createElement(CellGroup, null, /* @__PURE__ */ React__default.createElement(
|
|
16284
|
+
/* @__PURE__ */ React__default.createElement(CellGroup, null, /* @__PURE__ */ React__default.createElement(Context.Provider, { value: formInstance }, children), footer ? /* @__PURE__ */ React__default.createElement(Cell, null, footer) : null)
|
|
16234
16285
|
);
|
|
16235
16286
|
};
|
|
16236
16287
|
Form.defaultProps = defaultProps$T;
|
|
@@ -16446,7 +16497,7 @@ const defaultProps$R = {
|
|
|
16446
16497
|
disabled: false,
|
|
16447
16498
|
min: 1,
|
|
16448
16499
|
max: 9999,
|
|
16449
|
-
|
|
16500
|
+
readOnly: false,
|
|
16450
16501
|
allowEmpty: false,
|
|
16451
16502
|
defaultValue: 0,
|
|
16452
16503
|
step: 1,
|
|
@@ -16460,7 +16511,7 @@ const InputNumber = (props) => {
|
|
|
16460
16511
|
disabled,
|
|
16461
16512
|
min,
|
|
16462
16513
|
max,
|
|
16463
|
-
|
|
16514
|
+
readOnly,
|
|
16464
16515
|
value,
|
|
16465
16516
|
defaultValue,
|
|
16466
16517
|
allowEmpty,
|
|
@@ -16619,14 +16670,14 @@ const InputNumber = (props) => {
|
|
|
16619
16670
|
const focusValue = (e) => {
|
|
16620
16671
|
if (disabled)
|
|
16621
16672
|
return;
|
|
16622
|
-
if (
|
|
16673
|
+
if (readOnly)
|
|
16623
16674
|
return;
|
|
16624
16675
|
onFocus && onFocus(e);
|
|
16625
16676
|
};
|
|
16626
16677
|
const burValue = (e) => {
|
|
16627
16678
|
if (disabled)
|
|
16628
16679
|
return;
|
|
16629
|
-
if (
|
|
16680
|
+
if (readOnly)
|
|
16630
16681
|
return;
|
|
16631
16682
|
const input = e.target;
|
|
16632
16683
|
let value2 = input.valueAsNumber;
|
|
@@ -16654,7 +16705,7 @@ const InputNumber = (props) => {
|
|
|
16654
16705
|
min,
|
|
16655
16706
|
max,
|
|
16656
16707
|
disabled,
|
|
16657
|
-
readOnly
|
|
16708
|
+
readOnly,
|
|
16658
16709
|
value: _checked,
|
|
16659
16710
|
onInput: changeFormatValue,
|
|
16660
16711
|
onBlur: burFormatValue,
|
|
@@ -16667,7 +16718,7 @@ const InputNumber = (props) => {
|
|
|
16667
16718
|
min,
|
|
16668
16719
|
max,
|
|
16669
16720
|
disabled,
|
|
16670
|
-
readOnly
|
|
16721
|
+
readOnly,
|
|
16671
16722
|
value: _checked,
|
|
16672
16723
|
onInput: changeValue,
|
|
16673
16724
|
onBlur: burValue,
|
|
@@ -16727,6 +16778,7 @@ const Menu = (props) => {
|
|
|
16727
16778
|
};
|
|
16728
16779
|
const hideMenuItem = (index) => {
|
|
16729
16780
|
showMenuItem[index] = false;
|
|
16781
|
+
console.log([...showMenuItem]);
|
|
16730
16782
|
setShowMenuItem([...showMenuItem]);
|
|
16731
16783
|
};
|
|
16732
16784
|
const updateTitle = (text, index) => {
|
|
@@ -16736,6 +16788,7 @@ const Menu = (props) => {
|
|
|
16736
16788
|
const cloneChildren = () => {
|
|
16737
16789
|
return React__default.Children.map(children, (child, index) => {
|
|
16738
16790
|
return React__default.cloneElement(child, {
|
|
16791
|
+
...child.props,
|
|
16739
16792
|
show: showMenuItem[index],
|
|
16740
16793
|
index,
|
|
16741
16794
|
activeColor,
|
|
@@ -16775,7 +16828,8 @@ const Menu = (props) => {
|
|
|
16775
16828
|
}),
|
|
16776
16829
|
style: { color: showMenuItem[index] ? activeColor : "" },
|
|
16777
16830
|
key: index,
|
|
16778
|
-
onClick: () => {
|
|
16831
|
+
onClick: (e) => {
|
|
16832
|
+
e.stopPropagation();
|
|
16779
16833
|
!disabled && toggleMenuItem(index);
|
|
16780
16834
|
}
|
|
16781
16835
|
},
|
|
@@ -16817,12 +16871,59 @@ const Menu = (props) => {
|
|
|
16817
16871
|
};
|
|
16818
16872
|
Menu.defaultProps = defaultProps$Q;
|
|
16819
16873
|
Menu.displayName = "NutMenu";
|
|
16874
|
+
const isObject = (val) => val !== null && typeof val === "object";
|
|
16875
|
+
const isFunction = (val) => typeof val === "function";
|
|
16876
|
+
const isPromise = (val) => {
|
|
16877
|
+
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
16878
|
+
};
|
|
16879
|
+
const upperCaseFirst = (str) => {
|
|
16880
|
+
var str = str.toLowerCase();
|
|
16881
|
+
str = str.replace(
|
|
16882
|
+
/\b\w+\b/g,
|
|
16883
|
+
(word) => word.substring(0, 1).toUpperCase() + word.substring(1)
|
|
16884
|
+
);
|
|
16885
|
+
return str;
|
|
16886
|
+
};
|
|
16887
|
+
const getTargetElement = (target) => {
|
|
16888
|
+
let targetElement;
|
|
16889
|
+
if (isFunction(target)) {
|
|
16890
|
+
targetElement = target();
|
|
16891
|
+
} else if ("current" in target) {
|
|
16892
|
+
targetElement = target.current;
|
|
16893
|
+
} else {
|
|
16894
|
+
targetElement = target;
|
|
16895
|
+
}
|
|
16896
|
+
return targetElement;
|
|
16897
|
+
};
|
|
16898
|
+
function useClickAway(onClickAway, target, eventName = "click", isListener, outerVar) {
|
|
16899
|
+
const handler = (event) => {
|
|
16900
|
+
const targets = Array.isArray(target) ? target : [target];
|
|
16901
|
+
if (targets.some((item) => {
|
|
16902
|
+
const targetElement = getTargetElement(item);
|
|
16903
|
+
return !targetElement || targetElement.contains(event.target);
|
|
16904
|
+
})) {
|
|
16905
|
+
return;
|
|
16906
|
+
}
|
|
16907
|
+
if (outerVar) {
|
|
16908
|
+
onClickAway();
|
|
16909
|
+
}
|
|
16910
|
+
};
|
|
16911
|
+
useEffect(() => {
|
|
16912
|
+
if (isListener) {
|
|
16913
|
+
window.addEventListener(eventName, handler, false);
|
|
16914
|
+
} else {
|
|
16915
|
+
window.removeEventListener(eventName, handler, false);
|
|
16916
|
+
}
|
|
16917
|
+
return () => {
|
|
16918
|
+
window.removeEventListener(eventName, handler, true);
|
|
16919
|
+
};
|
|
16920
|
+
}, [target]);
|
|
16921
|
+
}
|
|
16820
16922
|
const defaultProps$P = {
|
|
16821
16923
|
...ComponentDefaults,
|
|
16822
16924
|
columns: 1,
|
|
16823
16925
|
direction: "down",
|
|
16824
16926
|
icon: null,
|
|
16825
|
-
closeOnClickAway: false,
|
|
16826
16927
|
activeTitleClass: "",
|
|
16827
16928
|
inactiveTitleClass: "",
|
|
16828
16929
|
onChange: (value) => void 0
|
|
@@ -16855,9 +16956,6 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
16855
16956
|
useEffect(() => {
|
|
16856
16957
|
setShowPopup(show2);
|
|
16857
16958
|
}, [show2]);
|
|
16858
|
-
useEffect(() => {
|
|
16859
|
-
getParentOffset();
|
|
16860
|
-
}, [_showPopup]);
|
|
16861
16959
|
useImperativeHandle(ref, () => ({
|
|
16862
16960
|
toggle: parent.toggleMenuItem
|
|
16863
16961
|
}));
|
|
@@ -16878,119 +16976,108 @@ const MenuItem = forwardRef((props, ref) => {
|
|
|
16878
16976
|
setValue(item.value);
|
|
16879
16977
|
onChange && onChange(item);
|
|
16880
16978
|
};
|
|
16881
|
-
const [position, setPosition] = useState({
|
|
16882
|
-
top: 0,
|
|
16883
|
-
height: 0
|
|
16884
|
-
});
|
|
16885
|
-
const getParentOffset = () => {
|
|
16886
|
-
setTimeout(() => {
|
|
16887
|
-
const p = parent.menuRef.current;
|
|
16888
|
-
const rect = p.getBoundingClientRect();
|
|
16889
|
-
setPosition({
|
|
16890
|
-
height: rect.height,
|
|
16891
|
-
top: rect.top
|
|
16892
|
-
});
|
|
16893
|
-
});
|
|
16894
|
-
};
|
|
16895
16979
|
const isShow = () => {
|
|
16896
16980
|
if (_showPopup)
|
|
16897
16981
|
return {};
|
|
16898
16982
|
return { display: "none" };
|
|
16899
16983
|
};
|
|
16900
16984
|
const getPosition = () => {
|
|
16901
|
-
return direction === "down" ? {
|
|
16902
|
-
|
|
16903
|
-
|
|
16904
|
-
if (direction === "down") {
|
|
16905
|
-
return {
|
|
16906
|
-
height: `${position.top + position.height}px`,
|
|
16907
|
-
top: 0,
|
|
16908
|
-
...isShow()
|
|
16909
|
-
};
|
|
16910
|
-
}
|
|
16911
|
-
return {
|
|
16912
|
-
height: `${window.innerHeight - position.top}px`,
|
|
16913
|
-
bottom: `0px`,
|
|
16985
|
+
return direction === "down" ? { position: "absolute", height: `${window.innerHeight}px` } : {
|
|
16986
|
+
position: "absolute",
|
|
16987
|
+
bottom: "100%",
|
|
16914
16988
|
top: "auto",
|
|
16915
|
-
|
|
16989
|
+
height: `${window.innerHeight}px`
|
|
16916
16990
|
};
|
|
16917
16991
|
};
|
|
16918
|
-
|
|
16919
|
-
|
|
16920
|
-
|
|
16921
|
-
|
|
16922
|
-
|
|
16923
|
-
|
|
16924
|
-
|
|
16925
|
-
|
|
16926
|
-
|
|
16927
|
-
|
|
16928
|
-
|
|
16929
|
-
|
|
16930
|
-
|
|
16931
|
-
|
|
16932
|
-
lockScroll: parent.lockScroll,
|
|
16933
|
-
visible: _showPopup,
|
|
16934
|
-
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
16935
|
-
onClick: () => {
|
|
16936
|
-
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
16937
|
-
}
|
|
16938
|
-
}
|
|
16939
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
16992
|
+
const micRef = useRef(null);
|
|
16993
|
+
const targetSet = [micRef.current];
|
|
16994
|
+
useClickAway(
|
|
16995
|
+
() => {
|
|
16996
|
+
parent.hideMenuItem(index);
|
|
16997
|
+
},
|
|
16998
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
16999
|
+
// @ts-ignore
|
|
17000
|
+
targetSet,
|
|
17001
|
+
"click",
|
|
17002
|
+
_showPopup,
|
|
17003
|
+
closeOnClickAway
|
|
17004
|
+
);
|
|
17005
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
16940
17006
|
"div",
|
|
16941
17007
|
{
|
|
16942
|
-
className:
|
|
16943
|
-
|
|
16944
|
-
|
|
16945
|
-
}),
|
|
16946
|
-
style: {
|
|
16947
|
-
...style,
|
|
16948
|
-
...isShow()
|
|
16949
|
-
}
|
|
17008
|
+
className: "nut-menu-item-container",
|
|
17009
|
+
ref: micRef,
|
|
17010
|
+
style: { position: "absolute", left: 0, right: 0 }
|
|
16950
17011
|
},
|
|
16951
17012
|
/* @__PURE__ */ React__default.createElement(
|
|
16952
|
-
|
|
17013
|
+
Overlay,
|
|
16953
17014
|
{
|
|
16954
|
-
|
|
16955
|
-
|
|
16956
|
-
|
|
17015
|
+
className: "nut-menu__overlay",
|
|
17016
|
+
style: getPosition(),
|
|
17017
|
+
lockScroll: parent.lockScroll,
|
|
17018
|
+
visible: _showPopup,
|
|
17019
|
+
closeOnOverlayClick: parent.closeOnOverlayClick,
|
|
17020
|
+
onClick: () => {
|
|
17021
|
+
parent.closeOnOverlayClick && parent.toggleMenuItem(index);
|
|
17022
|
+
}
|
|
17023
|
+
}
|
|
17024
|
+
),
|
|
17025
|
+
/* @__PURE__ */ React__default.createElement(
|
|
17026
|
+
"div",
|
|
17027
|
+
{
|
|
17028
|
+
className: classNames(className, {
|
|
17029
|
+
"nut-menu-item__wrap": direction === "down",
|
|
17030
|
+
"nut-menu-item__wrap-up": direction !== "down"
|
|
17031
|
+
}),
|
|
17032
|
+
style: {
|
|
17033
|
+
...style,
|
|
17034
|
+
...isShow()
|
|
17035
|
+
}
|
|
16957
17036
|
},
|
|
16958
|
-
/* @__PURE__ */ React__default.createElement(
|
|
16959
|
-
|
|
16960
|
-
|
|
16961
|
-
|
|
16962
|
-
|
|
16963
|
-
|
|
16964
|
-
|
|
16965
|
-
|
|
16966
|
-
|
|
16967
|
-
flexBasis: `${100 / columns}%`
|
|
16968
|
-
},
|
|
16969
|
-
onClick: () => {
|
|
16970
|
-
handleClick2(item);
|
|
16971
|
-
}
|
|
16972
|
-
},
|
|
16973
|
-
item.value === _value ? /* @__PURE__ */ React__default.createElement("i", null, icon || /* @__PURE__ */ React__default.createElement(
|
|
16974
|
-
x$f,
|
|
16975
|
-
{
|
|
16976
|
-
color: activeColor,
|
|
16977
|
-
className: getIconCName(item.value, value)
|
|
16978
|
-
}
|
|
16979
|
-
)) : null,
|
|
16980
|
-
/* @__PURE__ */ React__default.createElement(
|
|
17037
|
+
/* @__PURE__ */ React__default.createElement(
|
|
17038
|
+
CSSTransition$1,
|
|
17039
|
+
{
|
|
17040
|
+
in: _showPopup,
|
|
17041
|
+
timeout: 100,
|
|
17042
|
+
classNames: direction === "down" ? "menu-item" : "menu-item-up"
|
|
17043
|
+
},
|
|
17044
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-menu-item__content" }, options2 == null ? void 0 : options2.map((item) => {
|
|
17045
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
16981
17046
|
"div",
|
|
16982
17047
|
{
|
|
16983
|
-
className:
|
|
17048
|
+
className: `nut-menu-item__option ${classNames({
|
|
17049
|
+
active: item.value === _value
|
|
17050
|
+
})}`,
|
|
17051
|
+
key: item.text,
|
|
16984
17052
|
style: {
|
|
16985
|
-
|
|
17053
|
+
flexBasis: `${100 / columns}%`
|
|
17054
|
+
},
|
|
17055
|
+
onClick: () => {
|
|
17056
|
+
handleClick2(item);
|
|
16986
17057
|
}
|
|
16987
17058
|
},
|
|
16988
|
-
item.
|
|
16989
|
-
|
|
16990
|
-
|
|
16991
|
-
|
|
17059
|
+
item.value === _value ? /* @__PURE__ */ React__default.createElement("i", null, icon || /* @__PURE__ */ React__default.createElement(
|
|
17060
|
+
x$f,
|
|
17061
|
+
{
|
|
17062
|
+
color: activeColor,
|
|
17063
|
+
className: getIconCName(item.value, value)
|
|
17064
|
+
}
|
|
17065
|
+
)) : null,
|
|
17066
|
+
/* @__PURE__ */ React__default.createElement(
|
|
17067
|
+
"div",
|
|
17068
|
+
{
|
|
17069
|
+
className: getIconCName(item.value, value),
|
|
17070
|
+
style: {
|
|
17071
|
+
color: `${item.value === _value ? activeColor : ""}`
|
|
17072
|
+
}
|
|
17073
|
+
},
|
|
17074
|
+
item.text
|
|
17075
|
+
)
|
|
17076
|
+
);
|
|
17077
|
+
}), children)
|
|
17078
|
+
)
|
|
16992
17079
|
)
|
|
16993
|
-
)
|
|
17080
|
+
);
|
|
16994
17081
|
});
|
|
16995
17082
|
MenuItem.defaultProps = defaultProps$P;
|
|
16996
17083
|
MenuItem.displayName = "NutMenuItem";
|
|
@@ -17823,7 +17910,7 @@ const SearchBar = (props) => {
|
|
|
17823
17910
|
return /* @__PURE__ */ React__default.createElement(
|
|
17824
17911
|
"input",
|
|
17825
17912
|
{
|
|
17826
|
-
className: `${classPrefix2}__input ${
|
|
17913
|
+
className: `${classPrefix2}__input ${clearable ? `${classPrefix2}__input-clear` : ""}`,
|
|
17827
17914
|
ref: searchRef,
|
|
17828
17915
|
style: { ...props.style },
|
|
17829
17916
|
value: value || "",
|
|
@@ -17896,7 +17983,16 @@ const SearchBar = (props) => {
|
|
|
17896
17983
|
style: { ...props.style }
|
|
17897
17984
|
},
|
|
17898
17985
|
renderLeft(),
|
|
17899
|
-
/* @__PURE__ */ React__default.createElement(
|
|
17986
|
+
/* @__PURE__ */ React__default.createElement(
|
|
17987
|
+
"div",
|
|
17988
|
+
{
|
|
17989
|
+
className: `${classPrefix2}__content ${shape === "round" ? `${classPrefix2}__round` : ""}`
|
|
17990
|
+
},
|
|
17991
|
+
renderLeftIn(),
|
|
17992
|
+
renderField(),
|
|
17993
|
+
renderRightIn(),
|
|
17994
|
+
clearable && value && handleClear()
|
|
17995
|
+
),
|
|
17900
17996
|
renderRight()
|
|
17901
17997
|
);
|
|
17902
17998
|
};
|
|
@@ -18456,19 +18552,6 @@ class Upload {
|
|
|
18456
18552
|
}
|
|
18457
18553
|
}
|
|
18458
18554
|
}
|
|
18459
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
18460
|
-
const isFunction = (val) => typeof val === "function";
|
|
18461
|
-
const isPromise = (val) => {
|
|
18462
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
18463
|
-
};
|
|
18464
|
-
const upperCaseFirst = (str) => {
|
|
18465
|
-
var str = str.toLowerCase();
|
|
18466
|
-
str = str.replace(
|
|
18467
|
-
/\b\w+\b/g,
|
|
18468
|
-
(word) => word.substring(0, 1).toUpperCase() + word.substring(1)
|
|
18469
|
-
);
|
|
18470
|
-
return str;
|
|
18471
|
-
};
|
|
18472
18555
|
const funcInterceptor = (interceptor, {
|
|
18473
18556
|
args = [],
|
|
18474
18557
|
done,
|
|
@@ -19963,7 +20046,7 @@ const NoticeBar = (props) => {
|
|
|
19963
20046
|
onClick: handleClick2
|
|
19964
20047
|
},
|
|
19965
20048
|
leftIcon ? /* @__PURE__ */ React__default.createElement("div", { className: "left-icon" }, leftIcon) : null,
|
|
19966
|
-
children ? /* @__PURE__ */ React__default.createElement(
|
|
20049
|
+
children ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-noticebar__inner", ref: innerRef }, scrollList.current.map((item, index) => {
|
|
19967
20050
|
return /* @__PURE__ */ React__default.createElement(
|
|
19968
20051
|
"div",
|
|
19969
20052
|
{
|
|
@@ -19976,7 +20059,7 @@ const NoticeBar = (props) => {
|
|
|
19976
20059
|
},
|
|
19977
20060
|
item
|
|
19978
20061
|
);
|
|
19979
|
-
}))
|
|
20062
|
+
})) : /* @__PURE__ */ React__default.createElement("div", { className: "horseLamp_list", style: horseLampStyle }, scrollList.current.map((item, index) => {
|
|
19980
20063
|
return (
|
|
19981
20064
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
19982
20065
|
/* @__PURE__ */ React__default.createElement(
|
|
@@ -20170,41 +20253,6 @@ const Notify = {
|
|
|
20170
20253
|
}
|
|
20171
20254
|
}
|
|
20172
20255
|
};
|
|
20173
|
-
const getTargetElement = (target) => {
|
|
20174
|
-
let targetElement;
|
|
20175
|
-
if (isFunction(target)) {
|
|
20176
|
-
targetElement = target();
|
|
20177
|
-
} else if ("current" in target) {
|
|
20178
|
-
targetElement = target.current;
|
|
20179
|
-
} else {
|
|
20180
|
-
targetElement = target;
|
|
20181
|
-
}
|
|
20182
|
-
return targetElement;
|
|
20183
|
-
};
|
|
20184
|
-
function useClickAway(onClickAway, target, eventName = "click", isListener, outerVar) {
|
|
20185
|
-
const handler = (event) => {
|
|
20186
|
-
const targets = Array.isArray(target) ? target : [target];
|
|
20187
|
-
if (targets.some((item) => {
|
|
20188
|
-
const targetElement = getTargetElement(item);
|
|
20189
|
-
return !targetElement || targetElement.contains(event.target);
|
|
20190
|
-
})) {
|
|
20191
|
-
return;
|
|
20192
|
-
}
|
|
20193
|
-
if (outerVar) {
|
|
20194
|
-
onClickAway();
|
|
20195
|
-
}
|
|
20196
|
-
};
|
|
20197
|
-
useEffect(() => {
|
|
20198
|
-
if (isListener) {
|
|
20199
|
-
window.addEventListener(eventName, handler, true);
|
|
20200
|
-
} else {
|
|
20201
|
-
window.removeEventListener(eventName, handler, true);
|
|
20202
|
-
}
|
|
20203
|
-
return () => {
|
|
20204
|
-
window.removeEventListener(eventName, handler, true);
|
|
20205
|
-
};
|
|
20206
|
-
}, [target]);
|
|
20207
|
-
}
|
|
20208
20256
|
const defaultProps$w = {
|
|
20209
20257
|
...ComponentDefaults,
|
|
20210
20258
|
list: [],
|
|
@@ -20352,7 +20400,7 @@ const Popover = (props) => {
|
|
|
20352
20400
|
return styles;
|
|
20353
20401
|
};
|
|
20354
20402
|
const getRootPosition = () => {
|
|
20355
|
-
|
|
20403
|
+
const styles = {};
|
|
20356
20404
|
if (!rootPosition)
|
|
20357
20405
|
return {};
|
|
20358
20406
|
const contentWidth = elWidth;
|
|
@@ -20362,34 +20410,34 @@ const Popover = (props) => {
|
|
|
20362
20410
|
const skew = location.split("-")[1];
|
|
20363
20411
|
let cross = 0;
|
|
20364
20412
|
let parallel = 0;
|
|
20365
|
-
if (Array.isArray(offset) && offset.length
|
|
20413
|
+
if (Array.isArray(offset) && offset.length === 2) {
|
|
20366
20414
|
cross += +offset[1];
|
|
20367
20415
|
parallel += +offset[0];
|
|
20368
20416
|
}
|
|
20369
20417
|
if (width) {
|
|
20370
20418
|
if (["bottom", "top"].includes(direction)) {
|
|
20371
|
-
const h = direction
|
|
20419
|
+
const h = direction === "bottom" ? height + cross : -(contentHeight + cross);
|
|
20372
20420
|
styles.top = `${top + h}px`;
|
|
20373
20421
|
if (!skew) {
|
|
20374
20422
|
styles.left = `${-(contentWidth - width) / 2 + left + parallel}px`;
|
|
20375
20423
|
}
|
|
20376
|
-
if (skew
|
|
20424
|
+
if (skew === "start") {
|
|
20377
20425
|
styles.left = `${left + parallel}px`;
|
|
20378
20426
|
}
|
|
20379
|
-
if (skew
|
|
20427
|
+
if (skew === "end") {
|
|
20380
20428
|
styles.left = `${right + parallel}px`;
|
|
20381
20429
|
}
|
|
20382
20430
|
}
|
|
20383
20431
|
if (["left", "right"].includes(direction)) {
|
|
20384
|
-
const contentW = direction
|
|
20432
|
+
const contentW = direction === "left" ? -(contentWidth + cross) : width + cross;
|
|
20385
20433
|
styles.left = `${left + contentW}px`;
|
|
20386
20434
|
if (!skew) {
|
|
20387
20435
|
styles.top = `${top - contentHeight / 2 + height / 2 - 4 + parallel}px`;
|
|
20388
20436
|
}
|
|
20389
|
-
if (skew
|
|
20437
|
+
if (skew === "start") {
|
|
20390
20438
|
styles.top = `${top + parallel}px`;
|
|
20391
20439
|
}
|
|
20392
|
-
if (skew
|
|
20440
|
+
if (skew === "end") {
|
|
20393
20441
|
styles.top = `${top + height + parallel}px`;
|
|
20394
20442
|
}
|
|
20395
20443
|
}
|
|
@@ -20841,7 +20889,7 @@ const defaultProps$s = {
|
|
|
20841
20889
|
name: ""
|
|
20842
20890
|
};
|
|
20843
20891
|
const Swipe = forwardRef((props, instanceRef) => {
|
|
20844
|
-
const
|
|
20892
|
+
const classPrefix2 = "nut-swipe";
|
|
20845
20893
|
const touch = useTouch();
|
|
20846
20894
|
const { children, className, style } = { ...defaultProps$s, ...props };
|
|
20847
20895
|
const root2 = useRef();
|
|
@@ -20962,7 +21010,7 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
20962
21010
|
"div",
|
|
20963
21011
|
{
|
|
20964
21012
|
ref: measuredRef,
|
|
20965
|
-
className: `${
|
|
21013
|
+
className: `${classPrefix2}__${side}`,
|
|
20966
21014
|
onClick: (e) => handleOperate(e, side)
|
|
20967
21015
|
},
|
|
20968
21016
|
props[`${side}Action`]
|
|
@@ -21002,13 +21050,13 @@ const Swipe = forwardRef((props, instanceRef) => {
|
|
|
21002
21050
|
"div",
|
|
21003
21051
|
{
|
|
21004
21052
|
ref: root2,
|
|
21005
|
-
className: classNames(
|
|
21053
|
+
className: classNames(classPrefix2, className),
|
|
21006
21054
|
onTouchStart: (e) => onTouchStart(e),
|
|
21007
21055
|
onTouchMove: (e) => onTouchMove(e),
|
|
21008
21056
|
onTouchEnd: (e) => onTouchEnd(e),
|
|
21009
21057
|
style
|
|
21010
21058
|
},
|
|
21011
|
-
/* @__PURE__ */ React__default.createElement("div", { className: `${
|
|
21059
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}__wrapper`, style: wrapperStyle }, renderActionContent("left", leftRef), children, renderActionContent("right", rightRef))
|
|
21012
21060
|
);
|
|
21013
21061
|
});
|
|
21014
21062
|
Swipe.defaultProps = defaultProps$s;
|
|
@@ -21021,11 +21069,20 @@ class Notification extends React.PureComponent {
|
|
|
21021
21069
|
this.close = this.close.bind(this);
|
|
21022
21070
|
this.startCloseTimer = this.startCloseTimer.bind(this);
|
|
21023
21071
|
this.clearCloseTimer = this.clearCloseTimer.bind(this);
|
|
21024
|
-
this.close = this.close.bind(this);
|
|
21025
21072
|
this.clickCover = this.clickCover.bind(this);
|
|
21073
|
+
this.state = {
|
|
21074
|
+
show: true
|
|
21075
|
+
};
|
|
21026
21076
|
}
|
|
21027
21077
|
close() {
|
|
21078
|
+
this.setState({
|
|
21079
|
+
show: false
|
|
21080
|
+
});
|
|
21028
21081
|
this.clearCloseTimer();
|
|
21082
|
+
if (this.props.id) {
|
|
21083
|
+
const element = document.getElementById(this.props.id);
|
|
21084
|
+
element && element.parentNode && element.parentNode.removeChild(element);
|
|
21085
|
+
}
|
|
21029
21086
|
this.props.onClose();
|
|
21030
21087
|
}
|
|
21031
21088
|
startCloseTimer() {
|
|
@@ -21090,6 +21147,7 @@ class Notification extends React.PureComponent {
|
|
|
21090
21147
|
contentClassName,
|
|
21091
21148
|
contentStyle
|
|
21092
21149
|
} = this.props;
|
|
21150
|
+
const { show: show2 } = this.state;
|
|
21093
21151
|
const classes = classNames({
|
|
21094
21152
|
"nut-toast-has-icon": icon,
|
|
21095
21153
|
[`nut-toast-${size}`]: true
|
|
@@ -21097,11 +21155,10 @@ class Notification extends React.PureComponent {
|
|
|
21097
21155
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
21098
21156
|
Overlay,
|
|
21099
21157
|
{
|
|
21100
|
-
visible:
|
|
21158
|
+
visible: show2,
|
|
21101
21159
|
style,
|
|
21102
21160
|
className: `${classPrefix$7}__overlay-default ${className}`,
|
|
21103
21161
|
onClick: () => {
|
|
21104
|
-
console.log("onclick");
|
|
21105
21162
|
this.clickCover();
|
|
21106
21163
|
},
|
|
21107
21164
|
closeOnOverlayClick
|
|
@@ -21122,9 +21179,9 @@ class Notification extends React.PureComponent {
|
|
|
21122
21179
|
__publicField(Notification, "newInstance");
|
|
21123
21180
|
Notification.newInstance = (properties, callback) => {
|
|
21124
21181
|
const element = document.createElement("div");
|
|
21125
|
-
|
|
21126
|
-
|
|
21127
|
-
|
|
21182
|
+
const id = properties.id ? properties.id : `${(/* @__PURE__ */ new Date()).getTime()}`;
|
|
21183
|
+
element.id = id;
|
|
21184
|
+
properties.id = id;
|
|
21128
21185
|
document.body.appendChild(element);
|
|
21129
21186
|
let called = false;
|
|
21130
21187
|
function ref(instance) {
|