@nutui/nutui-react 2.3.5 → 2.3.7
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 +35 -0
- package/dist/esm/Address/style/style.css +1 -1
- package/dist/esm/Cascader/style/style.css +1 -1
- package/dist/esm/CheckboxGroup.js +16 -5
- package/dist/esm/CircleProgress/style/style.css +1 -1
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Dialog.js +25 -4
- package/dist/esm/ImagePreview/style/style.css +1 -1
- package/dist/esm/ImagePreview.js +10 -2
- package/dist/esm/NumberKeyboard.js +4 -3
- package/dist/esm/Popover/style/style.css +1 -1
- package/dist/esm/Popover.js +61 -57
- package/dist/esm/Table/style/style.css +1 -1
- package/dist/esm/Table.js +1 -1
- package/dist/esm/Tabs/style/style.css +1 -1
- package/dist/esm/Tour/style/style.css +1 -1
- package/dist/esm/Uploader/style/style.css +1 -1
- package/dist/esm/Uploader.js +1 -1
- package/dist/esm/checkbox2.js +0 -4
- package/dist/esm/get-scroll-parent.js +16 -0
- package/dist/esm/tabs2.js +2 -4
- package/dist/esm/types/src/packages/checkbox/checkbox.d.ts +7 -6
- package/dist/esm/types/src/packages/checkbox/checkbox.taro.d.ts +7 -6
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.d.ts +3 -2
- package/dist/esm/types/src/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -2
- package/dist/esm/types/src/packages/checkboxgroup/context.d.ts +3 -1
- package/dist/esm/types/src/packages/checkboxgroup/types.d.ts +3 -0
- package/dist/esm/types/src/packages/configprovider/types.d.ts +1 -1
- package/dist/esm/types/src/packages/dialog/config.d.ts +9 -6
- package/dist/esm/types/src/packages/dialog/confirm.d.ts +3 -3
- package/dist/esm/types/src/packages/dialog/content.d.ts +1 -0
- package/dist/esm/types/src/packages/dialog/content.taro.d.ts +1 -0
- package/dist/esm/types/src/packages/dialog/dialog.d.ts +2 -2
- package/dist/esm/types/src/packages/dialog/dialog.taro.d.ts +2 -2
- package/dist/esm/types/src/packages/dialog/dialogwrap.d.ts +1 -0
- package/dist/esm/types/src/packages/dialog/index.d.ts +1 -0
- package/dist/esm/types/src/packages/imagepreview/imagepreview.d.ts +4 -1
- package/dist/esm/types/src/packages/imagepreview/imagepreview.taro.d.ts +4 -1
- package/dist/esm/types/src/packages/imagepreview/index.d.ts +1 -1
- package/dist/esm/types/src/packages/imagepreview/index.taro.d.ts +1 -1
- package/dist/esm/types/src/packages/numberkeyboard/numberkeyboard.d.ts +2 -1
- package/dist/esm/types/src/packages/numberkeyboard/numberkeyboard.taro.d.ts +2 -1
- package/dist/esm/types/src/utils/get-scroll-parent.d.ts +1 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +203 -111
- package/dist/nutui.react.umd.js +203 -111
- package/dist/packages/circleprogress/circleprogress.scss +3 -1
- package/dist/packages/dialog/dialog.scss +25 -0
- package/dist/packages/imagepreview/imagepreview.scss +24 -0
- package/dist/packages/popover/popover.scss +1 -1
- package/dist/packages/table/table.scss +12 -1
- package/dist/packages/tabs/tabs.scss +16 -1
- package/dist/packages/uploader/uploader.scss +4 -6
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +6 -0
- package/dist/styles/variables.scss +6 -0
- package/dist/types/packages/button/button.d.ts +11 -3
- package/dist/types/packages/checkbox/checkbox.d.ts +7 -6
- package/dist/types/packages/checkbox/checkbox.taro.d.ts +7 -6
- package/dist/types/packages/checkboxgroup/checkboxgroup.d.ts +7 -2
- package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -2
- package/dist/types/packages/checkboxgroup/context.d.ts +3 -1
- package/dist/types/packages/checkboxgroup/types.d.ts +3 -0
- package/dist/types/packages/configprovider/types.d.ts +1 -1
- package/dist/types/packages/dialog/config.d.ts +9 -6
- package/dist/types/packages/dialog/confirm.d.ts +3 -3
- package/dist/types/packages/dialog/content.d.ts +1 -0
- package/dist/types/packages/dialog/content.taro.d.ts +1 -0
- package/dist/types/packages/dialog/dialog.d.ts +2 -2
- package/dist/types/packages/dialog/dialog.taro.d.ts +2 -2
- package/dist/types/packages/dialog/dialogwrap.d.ts +1 -0
- package/dist/types/packages/dialog/index.d.ts +1 -0
- package/dist/types/packages/imagepreview/imagepreview.d.ts +17 -2
- package/dist/types/packages/imagepreview/imagepreview.taro.d.ts +4 -1
- package/dist/types/packages/imagepreview/index.d.ts +1 -1
- package/dist/types/packages/imagepreview/index.taro.d.ts +1 -1
- package/dist/types/packages/infiniteloading/infiniteloading.d.ts +1 -1
- package/dist/types/packages/numberkeyboard/numberkeyboard.d.ts +7 -2
- package/dist/types/packages/numberkeyboard/numberkeyboard.taro.d.ts +2 -1
- package/dist/types/packages/space/space.d.ts +2 -2
- package/dist/types/packages/swipe/swipe.d.ts +3 -3
- package/dist/types/packages/tabs/tabs.d.ts +1 -1
- package/dist/types/utils/get-scroll-parent.d.ts +1 -0
- package/package.json +2 -2
package/dist/nutui.react.es.js
CHANGED
|
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
7
|
/*!
|
|
8
|
-
* @nutui/nutui-react v2.3.
|
|
8
|
+
* @nutui/nutui-react v2.3.7 Fri Jan 19 2024 16:33:26 GMT+0800 (China Standard Time)
|
|
9
9
|
* (c) 2023 @jdf2e.
|
|
10
10
|
* Released under the MIT License.
|
|
11
11
|
*/
|
|
@@ -4413,6 +4413,20 @@ function getScrollParent(el, root2 = defaultRoot) {
|
|
|
4413
4413
|
}
|
|
4414
4414
|
return root2;
|
|
4415
4415
|
}
|
|
4416
|
+
function getAllScrollableParents(element, scrollableParents = []) {
|
|
4417
|
+
if (!element) {
|
|
4418
|
+
return scrollableParents;
|
|
4419
|
+
}
|
|
4420
|
+
const isScrollable = element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
|
4421
|
+
if (isScrollable) {
|
|
4422
|
+
if (element.nodeName === "HTML") {
|
|
4423
|
+
scrollableParents.push(document);
|
|
4424
|
+
} else {
|
|
4425
|
+
scrollableParents.push(element);
|
|
4426
|
+
}
|
|
4427
|
+
}
|
|
4428
|
+
return getAllScrollableParents(element.parentElement, scrollableParents);
|
|
4429
|
+
}
|
|
4416
4430
|
let passiveSupported = false;
|
|
4417
4431
|
if (canUseDom) {
|
|
4418
4432
|
try {
|
|
@@ -11398,7 +11412,9 @@ const Tabs = (props) => {
|
|
|
11398
11412
|
activeType === "line" && /* @__PURE__ */ React__default.createElement(
|
|
11399
11413
|
"div",
|
|
11400
11414
|
{
|
|
11401
|
-
className: `${classPrefix$j}-titles-item-line`,
|
|
11415
|
+
className: classNames(`${classPrefix$j}-titles-item-line`, {
|
|
11416
|
+
[`${classPrefix$j}-titles-item-line-${direction}`]: true
|
|
11417
|
+
}),
|
|
11402
11418
|
style: tabsActiveStyle
|
|
11403
11419
|
}
|
|
11404
11420
|
),
|
|
@@ -11414,9 +11430,7 @@ const Tabs = (props) => {
|
|
|
11414
11430
|
"div",
|
|
11415
11431
|
{
|
|
11416
11432
|
className: classNames(
|
|
11417
|
-
{
|
|
11418
|
-
ellipsis: true
|
|
11419
|
-
},
|
|
11433
|
+
`${classPrefix$j}-ellipsis`,
|
|
11420
11434
|
`${classPrefix$j}-titles-item-text`
|
|
11421
11435
|
)
|
|
11422
11436
|
},
|
|
@@ -13598,28 +13612,33 @@ const CheckboxGroupContext = createContext(null);
|
|
|
13598
13612
|
const Context$1 = CheckboxGroupContext;
|
|
13599
13613
|
const defaultProps$$ = {
|
|
13600
13614
|
max: void 0,
|
|
13615
|
+
min: void 0,
|
|
13601
13616
|
labelPosition: "right",
|
|
13602
13617
|
direction: "vertical",
|
|
13603
13618
|
onChange: (value) => {
|
|
13604
13619
|
},
|
|
13620
|
+
onLimit: (type4) => {
|
|
13621
|
+
},
|
|
13605
13622
|
options: []
|
|
13606
13623
|
};
|
|
13607
13624
|
const classPrefix$i = "nut-checkboxgroup";
|
|
13608
13625
|
const CheckboxGroup = React__default.forwardRef(
|
|
13609
13626
|
(props, ref) => {
|
|
13610
|
-
const { children } = { ...defaultProps$$, ...props };
|
|
13611
13627
|
const {
|
|
13628
|
+
children,
|
|
13612
13629
|
className,
|
|
13613
13630
|
disabled,
|
|
13614
13631
|
onChange,
|
|
13615
13632
|
value,
|
|
13616
13633
|
defaultValue,
|
|
13617
13634
|
max,
|
|
13635
|
+
min,
|
|
13636
|
+
onLimit,
|
|
13618
13637
|
labelPosition,
|
|
13619
13638
|
direction,
|
|
13620
13639
|
options: options2,
|
|
13621
13640
|
...rest
|
|
13622
|
-
} = props;
|
|
13641
|
+
} = { ...defaultProps$$, ...props };
|
|
13623
13642
|
useImperativeHandle(ref, () => ({
|
|
13624
13643
|
toggle(state) {
|
|
13625
13644
|
if (state === false) {
|
|
@@ -13664,7 +13683,7 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
13664
13683
|
}
|
|
13665
13684
|
);
|
|
13666
13685
|
});
|
|
13667
|
-
}, [options2, max]);
|
|
13686
|
+
}, [options2, max, min]);
|
|
13668
13687
|
return /* @__PURE__ */ React__default.createElement(
|
|
13669
13688
|
Context$1.Provider,
|
|
13670
13689
|
{
|
|
@@ -13672,13 +13691,22 @@ const CheckboxGroup = React__default.forwardRef(
|
|
|
13672
13691
|
labelPosition: labelPosition || "right",
|
|
13673
13692
|
disabled,
|
|
13674
13693
|
max,
|
|
13694
|
+
onLimit,
|
|
13675
13695
|
value: _value,
|
|
13676
13696
|
check: (value2) => {
|
|
13677
13697
|
const combined = [..._value, value2];
|
|
13698
|
+
if (max !== void 0) {
|
|
13699
|
+
if (combined.length > max) {
|
|
13700
|
+
return onLimit == null ? void 0 : onLimit("max");
|
|
13701
|
+
}
|
|
13702
|
+
}
|
|
13678
13703
|
setValue(combined);
|
|
13679
13704
|
},
|
|
13680
13705
|
uncheck: (value2) => {
|
|
13681
13706
|
const reduced = _value.filter((item) => item !== value2);
|
|
13707
|
+
if (min !== void 0 && reduced.length < min) {
|
|
13708
|
+
return onLimit == null ? void 0 : onLimit("min");
|
|
13709
|
+
}
|
|
13682
13710
|
setValue(reduced);
|
|
13683
13711
|
}
|
|
13684
13712
|
}
|
|
@@ -13817,10 +13845,6 @@ const Checkbox = (props) => {
|
|
|
13817
13845
|
if (disabled)
|
|
13818
13846
|
return;
|
|
13819
13847
|
const latestChecked = !innerChecked;
|
|
13820
|
-
if (ctx2 && ctx2.max !== void 0) {
|
|
13821
|
-
if (latestChecked && ctx2.value.length >= ctx2.max)
|
|
13822
|
-
return;
|
|
13823
|
-
}
|
|
13824
13848
|
setChecked(latestChecked);
|
|
13825
13849
|
};
|
|
13826
13850
|
const renderButton = () => {
|
|
@@ -17004,6 +17028,7 @@ Menu.Item = MenuItem;
|
|
|
17004
17028
|
const defaultProps$R = {
|
|
17005
17029
|
...ComponentDefaults,
|
|
17006
17030
|
visible: false,
|
|
17031
|
+
rightActions: "",
|
|
17007
17032
|
type: "default",
|
|
17008
17033
|
custom: [],
|
|
17009
17034
|
random: false,
|
|
@@ -17014,6 +17039,7 @@ const NumberKeyboard = (props) => {
|
|
|
17014
17039
|
const { locale } = useConfig();
|
|
17015
17040
|
const {
|
|
17016
17041
|
title,
|
|
17042
|
+
rightActions,
|
|
17017
17043
|
confirmText,
|
|
17018
17044
|
visible,
|
|
17019
17045
|
type: type4,
|
|
@@ -17129,7 +17155,7 @@ const NumberKeyboard = (props) => {
|
|
|
17129
17155
|
className: `${classPrefix2}-header-close`,
|
|
17130
17156
|
onClick: onConfirm
|
|
17131
17157
|
},
|
|
17132
|
-
locale.done
|
|
17158
|
+
rightActions || locale.done
|
|
17133
17159
|
)), /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-body` }, /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-body-keys` }, keysList == null ? void 0 : keysList.map((item) => {
|
|
17134
17160
|
return /* @__PURE__ */ React__default.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
17135
17161
|
})), type4 === "rightColumn" && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-sidebar` }, /* @__PURE__ */ React__default.createElement(
|
|
@@ -18560,7 +18586,7 @@ const Preview = ({
|
|
|
18560
18586
|
className: `nut-uploader-preview ${previewType}`,
|
|
18561
18587
|
key: item.uid
|
|
18562
18588
|
},
|
|
18563
|
-
previewType === "picture" && deletable && /* @__PURE__ */ React__default.createElement(
|
|
18589
|
+
previewType === "picture" && !children && deletable && /* @__PURE__ */ React__default.createElement(
|
|
18564
18590
|
o$3,
|
|
18565
18591
|
{
|
|
18566
18592
|
color: "rgba(0,0,0,0.6)",
|
|
@@ -19184,7 +19210,16 @@ const confirm = (config2, renderFunc) => {
|
|
|
19184
19210
|
};
|
|
19185
19211
|
const confirm$1 = confirm;
|
|
19186
19212
|
const Content = (props) => {
|
|
19187
|
-
const {
|
|
19213
|
+
const {
|
|
19214
|
+
visible,
|
|
19215
|
+
title,
|
|
19216
|
+
header,
|
|
19217
|
+
footer,
|
|
19218
|
+
close,
|
|
19219
|
+
footerDirection,
|
|
19220
|
+
onClick,
|
|
19221
|
+
children
|
|
19222
|
+
} = props;
|
|
19188
19223
|
const classPrefix2 = "nut-dialog";
|
|
19189
19224
|
const renderHeader = () => {
|
|
19190
19225
|
return title ? /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-header` }, title) : null;
|
|
@@ -19210,6 +19245,7 @@ const Content = (props) => {
|
|
|
19210
19245
|
style: props.style,
|
|
19211
19246
|
onClick: (e2) => handleClick2(e2)
|
|
19212
19247
|
},
|
|
19248
|
+
close,
|
|
19213
19249
|
header,
|
|
19214
19250
|
/* @__PURE__ */ React__default.createElement(
|
|
19215
19251
|
"div",
|
|
@@ -19290,6 +19326,8 @@ const defaultProps$E = {
|
|
|
19290
19326
|
disableConfirmButton: false,
|
|
19291
19327
|
footerDirection: "horizontal",
|
|
19292
19328
|
lockScroll: true,
|
|
19329
|
+
closeIconPosition: "top-right",
|
|
19330
|
+
closeIcon: false,
|
|
19293
19331
|
beforeCancel: () => true,
|
|
19294
19332
|
beforeClose: () => true
|
|
19295
19333
|
};
|
|
@@ -19305,6 +19343,8 @@ const BaseDialog = (props, ref) => {
|
|
|
19305
19343
|
closeOnOverlayClick,
|
|
19306
19344
|
confirmText,
|
|
19307
19345
|
cancelText,
|
|
19346
|
+
closeIconPosition,
|
|
19347
|
+
closeIcon,
|
|
19308
19348
|
onClose,
|
|
19309
19349
|
onCancel,
|
|
19310
19350
|
onConfirm,
|
|
@@ -19351,6 +19391,23 @@ const BaseDialog = (props, ref) => {
|
|
|
19351
19391
|
confirmText || locale.confirm
|
|
19352
19392
|
));
|
|
19353
19393
|
};
|
|
19394
|
+
const renderCloseIcon = () => {
|
|
19395
|
+
if (!closeIcon)
|
|
19396
|
+
return null;
|
|
19397
|
+
const handleCancel = () => {
|
|
19398
|
+
if (!(beforeCancel == null ? void 0 : beforeCancel()))
|
|
19399
|
+
return;
|
|
19400
|
+
if (!(beforeClose == null ? void 0 : beforeClose()))
|
|
19401
|
+
return;
|
|
19402
|
+
onClose == null ? void 0 : onClose();
|
|
19403
|
+
onCancel == null ? void 0 : onCancel();
|
|
19404
|
+
};
|
|
19405
|
+
const closeClasses = classNames({
|
|
19406
|
+
[`${classPrefix2}-close`]: true,
|
|
19407
|
+
[`${classPrefix2}-close-${closeIconPosition}`]: true
|
|
19408
|
+
});
|
|
19409
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: closeClasses, onClick: handleCancel }, React__default.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React__default.createElement(r$2, null));
|
|
19410
|
+
};
|
|
19354
19411
|
return /* @__PURE__ */ React__default.createElement("div", { style: { display: visible ? "block" : "none" } }, /* @__PURE__ */ React__default.createElement(
|
|
19355
19412
|
DialogWrap,
|
|
19356
19413
|
{
|
|
@@ -19358,6 +19415,7 @@ const BaseDialog = (props, ref) => {
|
|
|
19358
19415
|
visible,
|
|
19359
19416
|
lockScroll,
|
|
19360
19417
|
footer: renderFooter(),
|
|
19418
|
+
close: renderCloseIcon(),
|
|
19361
19419
|
onClose,
|
|
19362
19420
|
onCancel
|
|
19363
19421
|
}
|
|
@@ -20341,8 +20399,6 @@ const Popover = (props) => {
|
|
|
20341
20399
|
const popoverRef = useRef(null);
|
|
20342
20400
|
const popoverContentRef = useRef(null);
|
|
20343
20401
|
const [showPopup, setShowPopup] = useState(false);
|
|
20344
|
-
const [elWidth, setElWidth] = useState(0);
|
|
20345
|
-
const [elHeight, setElHeight] = useState(0);
|
|
20346
20402
|
const [rootPosition, setRootPosition] = useState();
|
|
20347
20403
|
useEffect(() => {
|
|
20348
20404
|
setShowPopup(visible);
|
|
@@ -20351,19 +20407,34 @@ const Popover = (props) => {
|
|
|
20351
20407
|
getContentWidth();
|
|
20352
20408
|
}, 0);
|
|
20353
20409
|
}
|
|
20410
|
+
}, [visible, location]);
|
|
20411
|
+
const update2 = useRef((e2) => {
|
|
20412
|
+
getContentWidth();
|
|
20413
|
+
});
|
|
20414
|
+
useEffect(() => {
|
|
20415
|
+
if (visible) {
|
|
20416
|
+
scrollableParents.forEach((parent) => {
|
|
20417
|
+
parent.addEventListener("scroll", update2.current, { passive: true });
|
|
20418
|
+
});
|
|
20419
|
+
} else {
|
|
20420
|
+
scrollableParents.forEach(
|
|
20421
|
+
(parent) => parent.removeEventListener("scroll", update2.current)
|
|
20422
|
+
);
|
|
20423
|
+
}
|
|
20354
20424
|
}, [visible]);
|
|
20355
|
-
let element;
|
|
20356
|
-
|
|
20357
|
-
|
|
20425
|
+
let element = null;
|
|
20426
|
+
let targetSet = [];
|
|
20427
|
+
if (canUseDom && targetId) {
|
|
20428
|
+
element = document.querySelector(`#${targetId}`);
|
|
20429
|
+
targetSet = [element, popoverContentRef.current];
|
|
20430
|
+
} else {
|
|
20431
|
+
targetSet = [popoverRef.current, popoverContentRef.current];
|
|
20358
20432
|
}
|
|
20359
|
-
const targetSet = [
|
|
20360
|
-
targetId ? element : popoverRef.current,
|
|
20361
|
-
popoverContentRef.current
|
|
20362
|
-
];
|
|
20363
20433
|
useClickAway(
|
|
20364
20434
|
() => {
|
|
20365
|
-
|
|
20366
|
-
|
|
20435
|
+
var _a2;
|
|
20436
|
+
(_a2 = props.onClick) == null ? void 0 : _a2.call(props);
|
|
20437
|
+
onClose == null ? void 0 : onClose();
|
|
20367
20438
|
},
|
|
20368
20439
|
targetSet,
|
|
20369
20440
|
"touchstart",
|
|
@@ -20371,37 +20442,20 @@ const Popover = (props) => {
|
|
|
20371
20442
|
visible,
|
|
20372
20443
|
closeOnOutsideClick
|
|
20373
20444
|
);
|
|
20445
|
+
const scrollableParents = useMemo$1(() => {
|
|
20446
|
+
return getAllScrollableParents(element || popoverRef.current);
|
|
20447
|
+
}, [element, popoverRef.current]);
|
|
20374
20448
|
const getContentWidth = () => {
|
|
20375
|
-
|
|
20376
|
-
|
|
20377
|
-
|
|
20378
|
-
|
|
20379
|
-
|
|
20380
|
-
|
|
20381
|
-
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
right: rect.right
|
|
20386
|
-
});
|
|
20387
|
-
if (popoverContentRef.current) {
|
|
20388
|
-
setElWidth(popoverContentRef.current.clientWidth);
|
|
20389
|
-
setElHeight(popoverContentRef.current.clientHeight);
|
|
20390
|
-
}
|
|
20391
|
-
}, 0);
|
|
20392
|
-
} else {
|
|
20393
|
-
setRootPosition({
|
|
20394
|
-
width: rect.width,
|
|
20395
|
-
height: rect.height,
|
|
20396
|
-
left: rect.left,
|
|
20397
|
-
top: rect.top + scrollDis,
|
|
20398
|
-
right: rect.right
|
|
20399
|
-
});
|
|
20400
|
-
if (popoverContentRef.current) {
|
|
20401
|
-
setElWidth(popoverContentRef.current.clientWidth);
|
|
20402
|
-
setElHeight(popoverContentRef.current.clientHeight);
|
|
20403
|
-
}
|
|
20404
|
-
}
|
|
20449
|
+
const rect = getRect(
|
|
20450
|
+
targetId ? document.querySelector(`#${targetId}`) : popoverRef.current
|
|
20451
|
+
);
|
|
20452
|
+
setRootPosition({
|
|
20453
|
+
width: rect.width,
|
|
20454
|
+
height: rect.height,
|
|
20455
|
+
left: rect.left,
|
|
20456
|
+
top: rect.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop),
|
|
20457
|
+
right: rect.right
|
|
20458
|
+
});
|
|
20405
20459
|
};
|
|
20406
20460
|
const classes = classNames(
|
|
20407
20461
|
{
|
|
@@ -20411,16 +20465,16 @@ const Popover = (props) => {
|
|
|
20411
20465
|
);
|
|
20412
20466
|
const popoverArrow = () => {
|
|
20413
20467
|
const prefixCls2 = "nut-popover-arrow";
|
|
20414
|
-
const
|
|
20415
|
-
|
|
20416
|
-
return `${prefixCls2} ${prefixCls2}-${direction} ${prefixCls2}-${loca}`;
|
|
20468
|
+
const direction = location.split("-")[0];
|
|
20469
|
+
return `${prefixCls2} ${prefixCls2}-${direction} ${prefixCls2}-${location}`;
|
|
20417
20470
|
};
|
|
20418
20471
|
const getRootPosition = () => {
|
|
20472
|
+
var _a2, _b;
|
|
20419
20473
|
const styles = {};
|
|
20420
20474
|
if (!rootPosition)
|
|
20421
20475
|
return {};
|
|
20422
|
-
const contentWidth =
|
|
20423
|
-
const contentHeight =
|
|
20476
|
+
const contentWidth = (_a2 = popoverContentRef.current) == null ? void 0 : _a2.clientWidth;
|
|
20477
|
+
const contentHeight = (_b = popoverContentRef.current) == null ? void 0 : _b.clientHeight;
|
|
20424
20478
|
const { width, height, left, top, right } = rootPosition;
|
|
20425
20479
|
const direction = location.split("-")[0];
|
|
20426
20480
|
const skew = location.split("-")[1];
|
|
@@ -20460,7 +20514,7 @@ const Popover = (props) => {
|
|
|
20460
20514
|
}
|
|
20461
20515
|
return styles;
|
|
20462
20516
|
};
|
|
20463
|
-
const
|
|
20517
|
+
const arrowStyle = () => {
|
|
20464
20518
|
const styles = {};
|
|
20465
20519
|
const direction = location.split("-")[0];
|
|
20466
20520
|
const skew = location.split("-")[1];
|
|
@@ -20492,12 +20546,13 @@ const Popover = (props) => {
|
|
|
20492
20546
|
return styles;
|
|
20493
20547
|
};
|
|
20494
20548
|
const handleSelect = (item, index) => {
|
|
20549
|
+
var _a2;
|
|
20495
20550
|
if (!item.disabled) {
|
|
20496
|
-
onSelect
|
|
20551
|
+
onSelect == null ? void 0 : onSelect(item, index);
|
|
20497
20552
|
}
|
|
20498
20553
|
if (closeOnActionClick) {
|
|
20499
|
-
props.onClick
|
|
20500
|
-
onClose
|
|
20554
|
+
(_a2 = props.onClick) == null ? void 0 : _a2.call(props);
|
|
20555
|
+
onClose == null ? void 0 : onClose();
|
|
20501
20556
|
}
|
|
20502
20557
|
};
|
|
20503
20558
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, !targetId && /* @__PURE__ */ React__default.createElement(
|
|
@@ -20506,55 +20561,69 @@ const Popover = (props) => {
|
|
|
20506
20561
|
className: "nut-popover-wrapper",
|
|
20507
20562
|
ref: popoverRef,
|
|
20508
20563
|
onClick: () => {
|
|
20509
|
-
|
|
20564
|
+
var _a2;
|
|
20565
|
+
(_a2 = props.onClick) == null ? void 0 : _a2.call(props);
|
|
20510
20566
|
if (!visible) {
|
|
20511
|
-
onOpen
|
|
20567
|
+
onOpen == null ? void 0 : onOpen();
|
|
20512
20568
|
} else {
|
|
20513
|
-
onClose
|
|
20569
|
+
onClose == null ? void 0 : onClose();
|
|
20514
20570
|
}
|
|
20515
20571
|
},
|
|
20516
20572
|
style
|
|
20517
20573
|
},
|
|
20518
20574
|
Array.isArray(children) ? children[0] : children
|
|
20519
|
-
),
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20575
|
+
), createPortal(
|
|
20576
|
+
/* @__PURE__ */ React__default.createElement("div", { className: classes, style: getRootPosition() }, /* @__PURE__ */ React__default.createElement(
|
|
20577
|
+
Popup,
|
|
20578
|
+
{
|
|
20579
|
+
className: `nut-popover-content nut-popover-content-${location}`,
|
|
20580
|
+
visible: showPopup,
|
|
20581
|
+
overlay,
|
|
20582
|
+
position: "default",
|
|
20583
|
+
lockScroll: false,
|
|
20584
|
+
...rest
|
|
20585
|
+
},
|
|
20586
|
+
/* @__PURE__ */ React__default.createElement(
|
|
20530
20587
|
"div",
|
|
20531
20588
|
{
|
|
20532
|
-
className:
|
|
20589
|
+
className: "nut-popover-content-group",
|
|
20590
|
+
ref: popoverContentRef
|
|
20591
|
+
},
|
|
20592
|
+
showArrow && /* @__PURE__ */ React__default.createElement("div", { className: popoverArrow(), style: arrowStyle() }),
|
|
20593
|
+
Array.isArray(children) ? children[1] : null,
|
|
20594
|
+
list.map((item, index) => {
|
|
20595
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
20596
|
+
"div",
|
|
20533
20597
|
{
|
|
20534
|
-
|
|
20535
|
-
|
|
20598
|
+
className: classNames(
|
|
20599
|
+
{
|
|
20600
|
+
"nut-popover-menu-item": true,
|
|
20601
|
+
"nut-popover-menu-disabled": item.disabled
|
|
20602
|
+
},
|
|
20603
|
+
item.className
|
|
20604
|
+
),
|
|
20605
|
+
key: item.key || index,
|
|
20606
|
+
onClick: () => handleSelect(item, index)
|
|
20536
20607
|
},
|
|
20537
|
-
item.className
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
|
|
20548
|
-
|
|
20549
|
-
|
|
20550
|
-
|
|
20551
|
-
|
|
20552
|
-
|
|
20553
|
-
|
|
20554
|
-
|
|
20555
|
-
|
|
20556
|
-
}))
|
|
20557
|
-
)));
|
|
20608
|
+
item.icon ? /* @__PURE__ */ React__default.createElement("div", { className: "nut-popover-menu-item-icon" }, item.icon) : null,
|
|
20609
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "nut-popover-menu-item-name" }, item.name),
|
|
20610
|
+
item.action && item.action.icon ? /* @__PURE__ */ React__default.createElement(
|
|
20611
|
+
"div",
|
|
20612
|
+
{
|
|
20613
|
+
className: "nut-popover-menu-item-action-icon",
|
|
20614
|
+
onClick: (e2) => {
|
|
20615
|
+
var _a2, _b;
|
|
20616
|
+
return (_b = (_a2 = item.action) == null ? void 0 : _a2.onClick) == null ? void 0 : _b.call(_a2, e2);
|
|
20617
|
+
}
|
|
20618
|
+
},
|
|
20619
|
+
item.action.icon
|
|
20620
|
+
) : null
|
|
20621
|
+
);
|
|
20622
|
+
})
|
|
20623
|
+
)
|
|
20624
|
+
)),
|
|
20625
|
+
document.body
|
|
20626
|
+
));
|
|
20558
20627
|
};
|
|
20559
20628
|
Popover.defaultProps = defaultProps$y;
|
|
20560
20629
|
Popover.displayName = "NutPopover";
|
|
@@ -22966,6 +23035,8 @@ const defaultProps$f = {
|
|
|
22966
23035
|
closeOnContentClick: false,
|
|
22967
23036
|
indicator: false,
|
|
22968
23037
|
indicatorColor: "#fff",
|
|
23038
|
+
closeIcon: false,
|
|
23039
|
+
closeIconPosition: "top-right",
|
|
22969
23040
|
onChange: (value) => {
|
|
22970
23041
|
},
|
|
22971
23042
|
onClose: () => {
|
|
@@ -22983,6 +23054,8 @@ const ImagePreview = (props) => {
|
|
|
22983
23054
|
indicator,
|
|
22984
23055
|
autoPlay,
|
|
22985
23056
|
closeOnContentClick,
|
|
23057
|
+
closeIcon,
|
|
23058
|
+
closeIconPosition,
|
|
22986
23059
|
onClose
|
|
22987
23060
|
} = props;
|
|
22988
23061
|
const classPrefix2 = "nut-imagepreview";
|
|
@@ -23104,7 +23177,9 @@ const ImagePreview = (props) => {
|
|
|
23104
23177
|
);
|
|
23105
23178
|
};
|
|
23106
23179
|
const slideChangeEnd = (page) => {
|
|
23180
|
+
var _a2;
|
|
23107
23181
|
setActive(page + 1);
|
|
23182
|
+
(_a2 = props.onChange) == null ? void 0 : _a2.call(props, page + 1);
|
|
23108
23183
|
};
|
|
23109
23184
|
const onCloseInner = () => {
|
|
23110
23185
|
setShowPop(false);
|
|
@@ -23163,7 +23238,15 @@ const ImagePreview = (props) => {
|
|
|
23163
23238
|
)
|
|
23164
23239
|
)
|
|
23165
23240
|
),
|
|
23166
|
-
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-index` }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0))
|
|
23241
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-index` }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)),
|
|
23242
|
+
closeIcon !== false ? /* @__PURE__ */ React__default.createElement(
|
|
23243
|
+
"div",
|
|
23244
|
+
{
|
|
23245
|
+
className: `${classPrefix2}-close ${closeIconPosition}`,
|
|
23246
|
+
onClick: onCloseInner
|
|
23247
|
+
},
|
|
23248
|
+
closeIcon === true ? /* @__PURE__ */ React__default.createElement(r$2, null) : closeIcon
|
|
23249
|
+
) : null
|
|
23167
23250
|
);
|
|
23168
23251
|
};
|
|
23169
23252
|
ImagePreview.defaultProps = defaultProps$f;
|
|
@@ -23651,16 +23734,25 @@ const Table = (props) => {
|
|
|
23651
23734
|
return /* @__PURE__ */ React__default.createElement("div", { className: bodyClassPrefix, key: index }, renderBodyTds(item, index));
|
|
23652
23735
|
});
|
|
23653
23736
|
};
|
|
23654
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: cls, ...rest }, /* @__PURE__ */ React__default.createElement(
|
|
23737
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: cls, ...rest }, /* @__PURE__ */ React__default.createElement(
|
|
23655
23738
|
"div",
|
|
23656
23739
|
{
|
|
23657
|
-
className: classNames(
|
|
23658
|
-
|
|
23659
|
-
|
|
23740
|
+
className: classNames(
|
|
23741
|
+
`${classPrefix2}-wrapper ${isSticky ? `${classPrefix2}-wrapper-sticky` : ""}`
|
|
23742
|
+
),
|
|
23743
|
+
style
|
|
23660
23744
|
},
|
|
23661
|
-
|
|
23662
|
-
|
|
23663
|
-
|
|
23745
|
+
/* @__PURE__ */ React__default.createElement(
|
|
23746
|
+
"div",
|
|
23747
|
+
{
|
|
23748
|
+
className: classNames(`${classPrefix2}-main`, {
|
|
23749
|
+
[`${classPrefix2}-main-striped`]: striped
|
|
23750
|
+
})
|
|
23751
|
+
},
|
|
23752
|
+
showHeader && /* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-main-head` }, /* @__PURE__ */ React__default.createElement("div", { className: headerClassPrefix }, renderHeadCells())),
|
|
23753
|
+
/* @__PURE__ */ React__default.createElement("div", { className: `${classPrefix2}-main-body` }, renderBodyTrs())
|
|
23754
|
+
)
|
|
23755
|
+
), isSticky ? /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(
|
|
23664
23756
|
"div",
|
|
23665
23757
|
{
|
|
23666
23758
|
className: `${classPrefix2}-sticky-left`,
|