@nutui/nutui-react 2.3.6 → 2.3.8-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/esm/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 +8 -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/Rate/style/style.css +1 -1
- package/dist/esm/Swiper.js +26 -22
- 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 +227 -133
- package/dist/nutui.react.umd.js +227 -133
- 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/rate/rate.scss +5 -0
- package/dist/packages/table/table.scss +12 -1
- package/dist/packages/tabs/tabs.scss +17 -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 +12 -1
- 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/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 +1 -1
- package/dist/types/utils/get-scroll-parent.d.ts +1 -0
- package/package.json +1 -1
package/dist/nutui.react.umd.js
CHANGED
|
@@ -8,7 +8,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8
8
|
return value;
|
|
9
9
|
};
|
|
10
10
|
/*!
|
|
11
|
-
* @nutui/nutui-react v2.3.
|
|
11
|
+
* @nutui/nutui-react v2.3.8-beta.0 Tue Jan 23 2024 11:20:59 GMT+0800 (China Standard Time)
|
|
12
12
|
* (c) 2023 @jdf2e.
|
|
13
13
|
* Released under the MIT License.
|
|
14
14
|
*/
|
|
@@ -4431,6 +4431,20 @@ Check the top-level render call using <` + t2 + ">.");
|
|
|
4431
4431
|
}
|
|
4432
4432
|
return root2;
|
|
4433
4433
|
}
|
|
4434
|
+
function getAllScrollableParents(element, scrollableParents = []) {
|
|
4435
|
+
if (!element) {
|
|
4436
|
+
return scrollableParents;
|
|
4437
|
+
}
|
|
4438
|
+
const isScrollable = element.scrollHeight > element.clientHeight || element.scrollWidth > element.clientWidth;
|
|
4439
|
+
if (isScrollable) {
|
|
4440
|
+
if (element.nodeName === "HTML") {
|
|
4441
|
+
scrollableParents.push(document);
|
|
4442
|
+
} else {
|
|
4443
|
+
scrollableParents.push(element);
|
|
4444
|
+
}
|
|
4445
|
+
}
|
|
4446
|
+
return getAllScrollableParents(element.parentElement, scrollableParents);
|
|
4447
|
+
}
|
|
4434
4448
|
let passiveSupported = false;
|
|
4435
4449
|
if (canUseDom) {
|
|
4436
4450
|
try {
|
|
@@ -11416,7 +11430,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11416
11430
|
activeType === "line" && /* @__PURE__ */ React.createElement(
|
|
11417
11431
|
"div",
|
|
11418
11432
|
{
|
|
11419
|
-
className: `${classPrefix$j}-titles-item-line`,
|
|
11433
|
+
className: classNames(`${classPrefix$j}-titles-item-line`, {
|
|
11434
|
+
[`${classPrefix$j}-titles-item-line-${direction}`]: true
|
|
11435
|
+
}),
|
|
11420
11436
|
style: tabsActiveStyle
|
|
11421
11437
|
}
|
|
11422
11438
|
),
|
|
@@ -11432,9 +11448,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11432
11448
|
"div",
|
|
11433
11449
|
{
|
|
11434
11450
|
className: classNames(
|
|
11435
|
-
{
|
|
11436
|
-
ellipsis: true
|
|
11437
|
-
},
|
|
11451
|
+
`${classPrefix$j}-ellipsis`,
|
|
11438
11452
|
`${classPrefix$j}-titles-item-text`
|
|
11439
11453
|
)
|
|
11440
11454
|
},
|
|
@@ -13616,28 +13630,33 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13616
13630
|
const Context$1 = CheckboxGroupContext;
|
|
13617
13631
|
const defaultProps$$ = {
|
|
13618
13632
|
max: void 0,
|
|
13633
|
+
min: void 0,
|
|
13619
13634
|
labelPosition: "right",
|
|
13620
13635
|
direction: "vertical",
|
|
13621
13636
|
onChange: (value) => {
|
|
13622
13637
|
},
|
|
13638
|
+
onLimit: (type2) => {
|
|
13639
|
+
},
|
|
13623
13640
|
options: []
|
|
13624
13641
|
};
|
|
13625
13642
|
const classPrefix$i = "nut-checkboxgroup";
|
|
13626
13643
|
const CheckboxGroup = React.forwardRef(
|
|
13627
13644
|
(props, ref) => {
|
|
13628
|
-
const { children } = { ...defaultProps$$, ...props };
|
|
13629
13645
|
const {
|
|
13646
|
+
children,
|
|
13630
13647
|
className,
|
|
13631
13648
|
disabled,
|
|
13632
13649
|
onChange,
|
|
13633
13650
|
value,
|
|
13634
13651
|
defaultValue,
|
|
13635
13652
|
max,
|
|
13653
|
+
min,
|
|
13654
|
+
onLimit,
|
|
13636
13655
|
labelPosition,
|
|
13637
13656
|
direction,
|
|
13638
13657
|
options: options2,
|
|
13639
13658
|
...rest
|
|
13640
|
-
} = props;
|
|
13659
|
+
} = { ...defaultProps$$, ...props };
|
|
13641
13660
|
React.useImperativeHandle(ref, () => ({
|
|
13642
13661
|
toggle(state) {
|
|
13643
13662
|
if (state === false) {
|
|
@@ -13682,7 +13701,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13682
13701
|
}
|
|
13683
13702
|
);
|
|
13684
13703
|
});
|
|
13685
|
-
}, [options2, max]);
|
|
13704
|
+
}, [options2, max, min]);
|
|
13686
13705
|
return /* @__PURE__ */ React.createElement(
|
|
13687
13706
|
Context$1.Provider,
|
|
13688
13707
|
{
|
|
@@ -13690,13 +13709,22 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13690
13709
|
labelPosition: labelPosition || "right",
|
|
13691
13710
|
disabled,
|
|
13692
13711
|
max,
|
|
13712
|
+
onLimit,
|
|
13693
13713
|
value: _value,
|
|
13694
13714
|
check: (value2) => {
|
|
13695
13715
|
const combined = [..._value, value2];
|
|
13716
|
+
if (max !== void 0) {
|
|
13717
|
+
if (combined.length > max) {
|
|
13718
|
+
return onLimit == null ? void 0 : onLimit("max");
|
|
13719
|
+
}
|
|
13720
|
+
}
|
|
13696
13721
|
setValue(combined);
|
|
13697
13722
|
},
|
|
13698
13723
|
uncheck: (value2) => {
|
|
13699
13724
|
const reduced = _value.filter((item) => item !== value2);
|
|
13725
|
+
if (min !== void 0 && reduced.length < min) {
|
|
13726
|
+
return onLimit == null ? void 0 : onLimit("min");
|
|
13727
|
+
}
|
|
13700
13728
|
setValue(reduced);
|
|
13701
13729
|
}
|
|
13702
13730
|
}
|
|
@@ -13835,10 +13863,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13835
13863
|
if (disabled)
|
|
13836
13864
|
return;
|
|
13837
13865
|
const latestChecked = !innerChecked;
|
|
13838
|
-
if (ctx2 && ctx2.max !== void 0) {
|
|
13839
|
-
if (latestChecked && ctx2.value.length >= ctx2.max)
|
|
13840
|
-
return;
|
|
13841
|
-
}
|
|
13842
13866
|
setChecked(latestChecked);
|
|
13843
13867
|
};
|
|
13844
13868
|
const renderButton = () => {
|
|
@@ -17022,6 +17046,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17022
17046
|
const defaultProps$R = {
|
|
17023
17047
|
...ComponentDefaults,
|
|
17024
17048
|
visible: false,
|
|
17049
|
+
rightActions: "",
|
|
17025
17050
|
type: "default",
|
|
17026
17051
|
custom: [],
|
|
17027
17052
|
random: false,
|
|
@@ -17032,6 +17057,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17032
17057
|
const { locale } = useConfig();
|
|
17033
17058
|
const {
|
|
17034
17059
|
title,
|
|
17060
|
+
rightActions,
|
|
17035
17061
|
confirmText,
|
|
17036
17062
|
visible,
|
|
17037
17063
|
type: type2,
|
|
@@ -17147,7 +17173,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
17147
17173
|
className: `${classPrefix2}-header-close`,
|
|
17148
17174
|
onClick: onConfirm
|
|
17149
17175
|
},
|
|
17150
|
-
locale.done
|
|
17176
|
+
rightActions || locale.done
|
|
17151
17177
|
)), /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-body` }, /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-body-keys` }, keysList == null ? void 0 : keysList.map((item) => {
|
|
17152
17178
|
return /* @__PURE__ */ React.createElement(NumberKeyboardKey, { key: item.id, item });
|
|
17153
17179
|
})), type2 === "rightColumn" && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-sidebar` }, /* @__PURE__ */ React.createElement(
|
|
@@ -18578,7 +18604,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
18578
18604
|
className: `nut-uploader-preview ${previewType}`,
|
|
18579
18605
|
key: item.uid
|
|
18580
18606
|
},
|
|
18581
|
-
previewType === "picture" && deletable && /* @__PURE__ */ React.createElement(
|
|
18607
|
+
previewType === "picture" && !children && deletable && /* @__PURE__ */ React.createElement(
|
|
18582
18608
|
o$3,
|
|
18583
18609
|
{
|
|
18584
18610
|
color: "rgba(0,0,0,0.6)",
|
|
@@ -19202,7 +19228,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19202
19228
|
};
|
|
19203
19229
|
const confirm$1 = confirm;
|
|
19204
19230
|
const Content = (props) => {
|
|
19205
|
-
const {
|
|
19231
|
+
const {
|
|
19232
|
+
visible,
|
|
19233
|
+
title,
|
|
19234
|
+
header,
|
|
19235
|
+
footer,
|
|
19236
|
+
close,
|
|
19237
|
+
footerDirection,
|
|
19238
|
+
onClick,
|
|
19239
|
+
children
|
|
19240
|
+
} = props;
|
|
19206
19241
|
const classPrefix2 = "nut-dialog";
|
|
19207
19242
|
const renderHeader = () => {
|
|
19208
19243
|
return title ? /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-header` }, title) : null;
|
|
@@ -19228,6 +19263,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19228
19263
|
style: props.style,
|
|
19229
19264
|
onClick: (e2) => handleClick2(e2)
|
|
19230
19265
|
},
|
|
19266
|
+
close,
|
|
19231
19267
|
header,
|
|
19232
19268
|
/* @__PURE__ */ React.createElement(
|
|
19233
19269
|
"div",
|
|
@@ -19308,6 +19344,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19308
19344
|
disableConfirmButton: false,
|
|
19309
19345
|
footerDirection: "horizontal",
|
|
19310
19346
|
lockScroll: true,
|
|
19347
|
+
closeIconPosition: "top-right",
|
|
19348
|
+
closeIcon: false,
|
|
19311
19349
|
beforeCancel: () => true,
|
|
19312
19350
|
beforeClose: () => true
|
|
19313
19351
|
};
|
|
@@ -19323,6 +19361,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19323
19361
|
closeOnOverlayClick,
|
|
19324
19362
|
confirmText,
|
|
19325
19363
|
cancelText,
|
|
19364
|
+
closeIconPosition,
|
|
19365
|
+
closeIcon,
|
|
19326
19366
|
onClose,
|
|
19327
19367
|
onCancel,
|
|
19328
19368
|
onConfirm,
|
|
@@ -19369,6 +19409,23 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19369
19409
|
confirmText || locale.confirm
|
|
19370
19410
|
));
|
|
19371
19411
|
};
|
|
19412
|
+
const renderCloseIcon = () => {
|
|
19413
|
+
if (!closeIcon)
|
|
19414
|
+
return null;
|
|
19415
|
+
const handleCancel = () => {
|
|
19416
|
+
if (!(beforeCancel == null ? void 0 : beforeCancel()))
|
|
19417
|
+
return;
|
|
19418
|
+
if (!(beforeClose == null ? void 0 : beforeClose()))
|
|
19419
|
+
return;
|
|
19420
|
+
onClose == null ? void 0 : onClose();
|
|
19421
|
+
onCancel == null ? void 0 : onCancel();
|
|
19422
|
+
};
|
|
19423
|
+
const closeClasses = classNames({
|
|
19424
|
+
[`${classPrefix2}-close`]: true,
|
|
19425
|
+
[`${classPrefix2}-close-${closeIconPosition}`]: true
|
|
19426
|
+
});
|
|
19427
|
+
return /* @__PURE__ */ React.createElement("div", { className: closeClasses, onClick: handleCancel }, React.isValidElement(closeIcon) ? closeIcon : /* @__PURE__ */ React.createElement(r$2, null));
|
|
19428
|
+
};
|
|
19372
19429
|
return /* @__PURE__ */ React.createElement("div", { style: { display: visible ? "block" : "none" } }, /* @__PURE__ */ React.createElement(
|
|
19373
19430
|
DialogWrap,
|
|
19374
19431
|
{
|
|
@@ -19376,6 +19433,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19376
19433
|
visible,
|
|
19377
19434
|
lockScroll,
|
|
19378
19435
|
footer: renderFooter(),
|
|
19436
|
+
close: renderCloseIcon(),
|
|
19379
19437
|
onClose,
|
|
19380
19438
|
onCancel
|
|
19381
19439
|
}
|
|
@@ -20359,8 +20417,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20359
20417
|
const popoverRef = React.useRef(null);
|
|
20360
20418
|
const popoverContentRef = React.useRef(null);
|
|
20361
20419
|
const [showPopup, setShowPopup] = React.useState(false);
|
|
20362
|
-
const [elWidth, setElWidth] = React.useState(0);
|
|
20363
|
-
const [elHeight, setElHeight] = React.useState(0);
|
|
20364
20420
|
const [rootPosition, setRootPosition] = React.useState();
|
|
20365
20421
|
React.useEffect(() => {
|
|
20366
20422
|
setShowPopup(visible);
|
|
@@ -20369,19 +20425,34 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20369
20425
|
getContentWidth();
|
|
20370
20426
|
}, 0);
|
|
20371
20427
|
}
|
|
20428
|
+
}, [visible, location]);
|
|
20429
|
+
const update2 = React.useRef((e2) => {
|
|
20430
|
+
getContentWidth();
|
|
20431
|
+
});
|
|
20432
|
+
React.useEffect(() => {
|
|
20433
|
+
if (visible) {
|
|
20434
|
+
scrollableParents.forEach((parent) => {
|
|
20435
|
+
parent.addEventListener("scroll", update2.current, { passive: true });
|
|
20436
|
+
});
|
|
20437
|
+
} else {
|
|
20438
|
+
scrollableParents.forEach(
|
|
20439
|
+
(parent) => parent.removeEventListener("scroll", update2.current)
|
|
20440
|
+
);
|
|
20441
|
+
}
|
|
20372
20442
|
}, [visible]);
|
|
20373
|
-
let element;
|
|
20374
|
-
|
|
20375
|
-
|
|
20443
|
+
let element = null;
|
|
20444
|
+
let targetSet = [];
|
|
20445
|
+
if (canUseDom && targetId) {
|
|
20446
|
+
element = document.querySelector(`#${targetId}`);
|
|
20447
|
+
targetSet = [element, popoverContentRef.current];
|
|
20448
|
+
} else {
|
|
20449
|
+
targetSet = [popoverRef.current, popoverContentRef.current];
|
|
20376
20450
|
}
|
|
20377
|
-
const targetSet = [
|
|
20378
|
-
targetId ? element : popoverRef.current,
|
|
20379
|
-
popoverContentRef.current
|
|
20380
|
-
];
|
|
20381
20451
|
useClickAway(
|
|
20382
20452
|
() => {
|
|
20383
|
-
|
|
20384
|
-
|
|
20453
|
+
var _a2;
|
|
20454
|
+
(_a2 = props.onClick) == null ? void 0 : _a2.call(props);
|
|
20455
|
+
onClose == null ? void 0 : onClose();
|
|
20385
20456
|
},
|
|
20386
20457
|
targetSet,
|
|
20387
20458
|
"touchstart",
|
|
@@ -20389,37 +20460,20 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20389
20460
|
visible,
|
|
20390
20461
|
closeOnOutsideClick
|
|
20391
20462
|
);
|
|
20463
|
+
const scrollableParents = React.useMemo(() => {
|
|
20464
|
+
return getAllScrollableParents(element || popoverRef.current);
|
|
20465
|
+
}, [element, popoverRef.current]);
|
|
20392
20466
|
const getContentWidth = () => {
|
|
20393
|
-
|
|
20394
|
-
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
right: rect.right
|
|
20404
|
-
});
|
|
20405
|
-
if (popoverContentRef.current) {
|
|
20406
|
-
setElWidth(popoverContentRef.current.clientWidth);
|
|
20407
|
-
setElHeight(popoverContentRef.current.clientHeight);
|
|
20408
|
-
}
|
|
20409
|
-
}, 0);
|
|
20410
|
-
} else {
|
|
20411
|
-
setRootPosition({
|
|
20412
|
-
width: rect.width,
|
|
20413
|
-
height: rect.height,
|
|
20414
|
-
left: rect.left,
|
|
20415
|
-
top: rect.top + scrollDis,
|
|
20416
|
-
right: rect.right
|
|
20417
|
-
});
|
|
20418
|
-
if (popoverContentRef.current) {
|
|
20419
|
-
setElWidth(popoverContentRef.current.clientWidth);
|
|
20420
|
-
setElHeight(popoverContentRef.current.clientHeight);
|
|
20421
|
-
}
|
|
20422
|
-
}
|
|
20467
|
+
const rect = getRect(
|
|
20468
|
+
targetId ? document.querySelector(`#${targetId}`) : popoverRef.current
|
|
20469
|
+
);
|
|
20470
|
+
setRootPosition({
|
|
20471
|
+
width: rect.width,
|
|
20472
|
+
height: rect.height,
|
|
20473
|
+
left: rect.left,
|
|
20474
|
+
top: rect.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop),
|
|
20475
|
+
right: rect.right
|
|
20476
|
+
});
|
|
20423
20477
|
};
|
|
20424
20478
|
const classes = classNames(
|
|
20425
20479
|
{
|
|
@@ -20429,16 +20483,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20429
20483
|
);
|
|
20430
20484
|
const popoverArrow = () => {
|
|
20431
20485
|
const prefixCls2 = "nut-popover-arrow";
|
|
20432
|
-
const
|
|
20433
|
-
|
|
20434
|
-
return `${prefixCls2} ${prefixCls2}-${direction} ${prefixCls2}-${loca}`;
|
|
20486
|
+
const direction = location.split("-")[0];
|
|
20487
|
+
return `${prefixCls2} ${prefixCls2}-${direction} ${prefixCls2}-${location}`;
|
|
20435
20488
|
};
|
|
20436
20489
|
const getRootPosition = () => {
|
|
20490
|
+
var _a2, _b;
|
|
20437
20491
|
const styles = {};
|
|
20438
20492
|
if (!rootPosition)
|
|
20439
20493
|
return {};
|
|
20440
|
-
const contentWidth =
|
|
20441
|
-
const contentHeight =
|
|
20494
|
+
const contentWidth = (_a2 = popoverContentRef.current) == null ? void 0 : _a2.clientWidth;
|
|
20495
|
+
const contentHeight = (_b = popoverContentRef.current) == null ? void 0 : _b.clientHeight;
|
|
20442
20496
|
const { width, height, left, top, right } = rootPosition;
|
|
20443
20497
|
const direction = location.split("-")[0];
|
|
20444
20498
|
const skew = location.split("-")[1];
|
|
@@ -20478,7 +20532,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20478
20532
|
}
|
|
20479
20533
|
return styles;
|
|
20480
20534
|
};
|
|
20481
|
-
const
|
|
20535
|
+
const arrowStyle = () => {
|
|
20482
20536
|
const styles = {};
|
|
20483
20537
|
const direction = location.split("-")[0];
|
|
20484
20538
|
const skew = location.split("-")[1];
|
|
@@ -20510,12 +20564,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20510
20564
|
return styles;
|
|
20511
20565
|
};
|
|
20512
20566
|
const handleSelect = (item, index) => {
|
|
20567
|
+
var _a2;
|
|
20513
20568
|
if (!item.disabled) {
|
|
20514
|
-
onSelect
|
|
20569
|
+
onSelect == null ? void 0 : onSelect(item, index);
|
|
20515
20570
|
}
|
|
20516
20571
|
if (closeOnActionClick) {
|
|
20517
|
-
props.onClick
|
|
20518
|
-
onClose
|
|
20572
|
+
(_a2 = props.onClick) == null ? void 0 : _a2.call(props);
|
|
20573
|
+
onClose == null ? void 0 : onClose();
|
|
20519
20574
|
}
|
|
20520
20575
|
};
|
|
20521
20576
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, !targetId && /* @__PURE__ */ React.createElement(
|
|
@@ -20524,55 +20579,69 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
20524
20579
|
className: "nut-popover-wrapper",
|
|
20525
20580
|
ref: popoverRef,
|
|
20526
20581
|
onClick: () => {
|
|
20527
|
-
|
|
20582
|
+
var _a2;
|
|
20583
|
+
(_a2 = props.onClick) == null ? void 0 : _a2.call(props);
|
|
20528
20584
|
if (!visible) {
|
|
20529
|
-
onOpen
|
|
20585
|
+
onOpen == null ? void 0 : onOpen();
|
|
20530
20586
|
} else {
|
|
20531
|
-
onClose
|
|
20587
|
+
onClose == null ? void 0 : onClose();
|
|
20532
20588
|
}
|
|
20533
20589
|
},
|
|
20534
20590
|
style
|
|
20535
20591
|
},
|
|
20536
20592
|
Array.isArray(children) ? children[0] : children
|
|
20537
|
-
),
|
|
20538
|
-
|
|
20539
|
-
|
|
20540
|
-
|
|
20541
|
-
|
|
20542
|
-
|
|
20543
|
-
|
|
20544
|
-
|
|
20545
|
-
|
|
20546
|
-
|
|
20547
|
-
|
|
20593
|
+
), ReactDOM.createPortal(
|
|
20594
|
+
/* @__PURE__ */ React.createElement("div", { className: classes, style: getRootPosition() }, /* @__PURE__ */ React.createElement(
|
|
20595
|
+
Popup,
|
|
20596
|
+
{
|
|
20597
|
+
className: `nut-popover-content nut-popover-content-${location}`,
|
|
20598
|
+
visible: showPopup,
|
|
20599
|
+
overlay,
|
|
20600
|
+
position: "default",
|
|
20601
|
+
lockScroll: false,
|
|
20602
|
+
...rest
|
|
20603
|
+
},
|
|
20604
|
+
/* @__PURE__ */ React.createElement(
|
|
20548
20605
|
"div",
|
|
20549
20606
|
{
|
|
20550
|
-
className:
|
|
20607
|
+
className: "nut-popover-content-group",
|
|
20608
|
+
ref: popoverContentRef
|
|
20609
|
+
},
|
|
20610
|
+
showArrow && /* @__PURE__ */ React.createElement("div", { className: popoverArrow(), style: arrowStyle() }),
|
|
20611
|
+
Array.isArray(children) ? children[1] : null,
|
|
20612
|
+
list.map((item, index) => {
|
|
20613
|
+
return /* @__PURE__ */ React.createElement(
|
|
20614
|
+
"div",
|
|
20551
20615
|
{
|
|
20552
|
-
|
|
20553
|
-
|
|
20616
|
+
className: classNames(
|
|
20617
|
+
{
|
|
20618
|
+
"nut-popover-menu-item": true,
|
|
20619
|
+
"nut-popover-menu-disabled": item.disabled
|
|
20620
|
+
},
|
|
20621
|
+
item.className
|
|
20622
|
+
),
|
|
20623
|
+
key: item.key || index,
|
|
20624
|
+
onClick: () => handleSelect(item, index)
|
|
20554
20625
|
},
|
|
20555
|
-
item.className
|
|
20556
|
-
|
|
20557
|
-
|
|
20558
|
-
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
|
|
20564
|
-
|
|
20565
|
-
|
|
20566
|
-
|
|
20567
|
-
|
|
20568
|
-
|
|
20569
|
-
|
|
20570
|
-
|
|
20571
|
-
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
}))
|
|
20575
|
-
)));
|
|
20626
|
+
item.icon ? /* @__PURE__ */ React.createElement("div", { className: "nut-popover-menu-item-icon" }, item.icon) : null,
|
|
20627
|
+
/* @__PURE__ */ React.createElement("div", { className: "nut-popover-menu-item-name" }, item.name),
|
|
20628
|
+
item.action && item.action.icon ? /* @__PURE__ */ React.createElement(
|
|
20629
|
+
"div",
|
|
20630
|
+
{
|
|
20631
|
+
className: "nut-popover-menu-item-action-icon",
|
|
20632
|
+
onClick: (e2) => {
|
|
20633
|
+
var _a2, _b;
|
|
20634
|
+
return (_b = (_a2 = item.action) == null ? void 0 : _a2.onClick) == null ? void 0 : _b.call(_a2, e2);
|
|
20635
|
+
}
|
|
20636
|
+
},
|
|
20637
|
+
item.action.icon
|
|
20638
|
+
) : null
|
|
20639
|
+
);
|
|
20640
|
+
})
|
|
20641
|
+
)
|
|
20642
|
+
)),
|
|
20643
|
+
document.body
|
|
20644
|
+
));
|
|
20576
20645
|
};
|
|
20577
20646
|
Popover.defaultProps = defaultProps$y;
|
|
20578
20647
|
Popover.displayName = "NutPopover";
|
|
@@ -22668,10 +22737,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22668
22737
|
resetPosition();
|
|
22669
22738
|
touch.reset();
|
|
22670
22739
|
requestAniFrame$1(() => {
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22740
|
+
requestAniFrame$1(() => {
|
|
22741
|
+
swiperRef.current.moving = false;
|
|
22742
|
+
move({
|
|
22743
|
+
pace: -1,
|
|
22744
|
+
isEmit: true
|
|
22745
|
+
});
|
|
22675
22746
|
});
|
|
22676
22747
|
});
|
|
22677
22748
|
};
|
|
@@ -22679,10 +22750,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22679
22750
|
resetPosition();
|
|
22680
22751
|
touch.reset();
|
|
22681
22752
|
requestAniFrame$1(() => {
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22753
|
+
requestAniFrame$1(() => {
|
|
22754
|
+
swiperRef.current.moving = false;
|
|
22755
|
+
move({
|
|
22756
|
+
pace: 1,
|
|
22757
|
+
isEmit: true
|
|
22758
|
+
});
|
|
22686
22759
|
});
|
|
22687
22760
|
});
|
|
22688
22761
|
};
|
|
@@ -22690,16 +22763,18 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22690
22763
|
resetPosition();
|
|
22691
22764
|
touch.reset();
|
|
22692
22765
|
requestAniFrame$1(() => {
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22766
|
+
requestAniFrame$1(() => {
|
|
22767
|
+
swiperRef.current.moving = false;
|
|
22768
|
+
let targetIndex;
|
|
22769
|
+
if (props.loop && swiperItemCount === index) {
|
|
22770
|
+
targetIndex = active === 0 ? 0 : index;
|
|
22771
|
+
} else {
|
|
22772
|
+
targetIndex = index % swiperItemCount;
|
|
22773
|
+
}
|
|
22774
|
+
move({
|
|
22775
|
+
pace: targetIndex - active,
|
|
22776
|
+
isEmit: true
|
|
22777
|
+
});
|
|
22703
22778
|
});
|
|
22704
22779
|
});
|
|
22705
22780
|
};
|
|
@@ -22773,6 +22848,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22773
22848
|
});
|
|
22774
22849
|
const getStyle = (moveOffset = offset) => {
|
|
22775
22850
|
const target = innerRef.current;
|
|
22851
|
+
if (!target)
|
|
22852
|
+
return;
|
|
22776
22853
|
let _offset = 0;
|
|
22777
22854
|
if (!center) {
|
|
22778
22855
|
_offset = moveOffset;
|
|
@@ -22881,10 +22958,6 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22881
22958
|
}
|
|
22882
22959
|
return () => setReady(false);
|
|
22883
22960
|
}, [ready]);
|
|
22884
|
-
React.useEffect(() => {
|
|
22885
|
-
stopAutoPlay();
|
|
22886
|
-
startPlay();
|
|
22887
|
-
}, [children]);
|
|
22888
22961
|
React.useEffect(() => {
|
|
22889
22962
|
const events = [
|
|
22890
22963
|
{ name: "touchstart", e: onTouchStart },
|
|
@@ -22984,6 +23057,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
22984
23057
|
closeOnContentClick: false,
|
|
22985
23058
|
indicator: false,
|
|
22986
23059
|
indicatorColor: "#fff",
|
|
23060
|
+
closeIcon: false,
|
|
23061
|
+
closeIconPosition: "top-right",
|
|
22987
23062
|
onChange: (value) => {
|
|
22988
23063
|
},
|
|
22989
23064
|
onClose: () => {
|
|
@@ -23001,6 +23076,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23001
23076
|
indicator,
|
|
23002
23077
|
autoPlay,
|
|
23003
23078
|
closeOnContentClick,
|
|
23079
|
+
closeIcon,
|
|
23080
|
+
closeIconPosition,
|
|
23004
23081
|
onClose
|
|
23005
23082
|
} = props;
|
|
23006
23083
|
const classPrefix2 = "nut-imagepreview";
|
|
@@ -23183,7 +23260,15 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23183
23260
|
)
|
|
23184
23261
|
)
|
|
23185
23262
|
),
|
|
23186
|
-
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-index` }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0))
|
|
23263
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-index` }, active, "/", (images ? images.length : 0) + (videos ? videos.length : 0)),
|
|
23264
|
+
closeIcon !== false ? /* @__PURE__ */ React.createElement(
|
|
23265
|
+
"div",
|
|
23266
|
+
{
|
|
23267
|
+
className: `${classPrefix2}-close ${closeIconPosition}`,
|
|
23268
|
+
onClick: onCloseInner
|
|
23269
|
+
},
|
|
23270
|
+
closeIcon === true ? /* @__PURE__ */ React.createElement(r$2, null) : closeIcon
|
|
23271
|
+
) : null
|
|
23187
23272
|
);
|
|
23188
23273
|
};
|
|
23189
23274
|
ImagePreview.defaultProps = defaultProps$f;
|
|
@@ -23671,16 +23756,25 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
23671
23756
|
return /* @__PURE__ */ React.createElement("div", { className: bodyClassPrefix, key: index }, renderBodyTds(item, index));
|
|
23672
23757
|
});
|
|
23673
23758
|
};
|
|
23674
|
-
return /* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, /* @__PURE__ */ React.createElement(
|
|
23759
|
+
return /* @__PURE__ */ React.createElement("div", { className: cls, ...rest }, /* @__PURE__ */ React.createElement(
|
|
23675
23760
|
"div",
|
|
23676
23761
|
{
|
|
23677
|
-
className: classNames(
|
|
23678
|
-
|
|
23679
|
-
|
|
23762
|
+
className: classNames(
|
|
23763
|
+
`${classPrefix2}-wrapper ${isSticky ? `${classPrefix2}-wrapper-sticky` : ""}`
|
|
23764
|
+
),
|
|
23765
|
+
style
|
|
23680
23766
|
},
|
|
23681
|
-
|
|
23682
|
-
|
|
23683
|
-
|
|
23767
|
+
/* @__PURE__ */ React.createElement(
|
|
23768
|
+
"div",
|
|
23769
|
+
{
|
|
23770
|
+
className: classNames(`${classPrefix2}-main`, {
|
|
23771
|
+
[`${classPrefix2}-main-striped`]: striped
|
|
23772
|
+
})
|
|
23773
|
+
},
|
|
23774
|
+
showHeader && /* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-main-head` }, /* @__PURE__ */ React.createElement("div", { className: headerClassPrefix }, renderHeadCells())),
|
|
23775
|
+
/* @__PURE__ */ React.createElement("div", { className: `${classPrefix2}-main-body` }, renderBodyTrs())
|
|
23776
|
+
)
|
|
23777
|
+
), isSticky ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
23684
23778
|
"div",
|
|
23685
23779
|
{
|
|
23686
23780
|
className: `${classPrefix2}-sticky-left`,
|