antd-mobile 5.9.5 → 5.10.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/2x/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/2x/cjs/components/collapse/collapse.js +3 -3
- package/2x/cjs/components/divider/divider.css +19 -8
- package/2x/cjs/components/divider/divider.d.ts +1 -0
- package/2x/cjs/components/divider/divider.js +3 -2
- package/2x/cjs/components/form/form.js +3 -2
- package/2x/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/cjs/components/image-uploader/image-uploader.js +4 -1
- package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/cjs/components/image-uploader/preview-item.js +3 -2
- package/2x/cjs/components/index-bar/index-bar.js +3 -3
- package/2x/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/2x/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/2x/cjs/components/picker-view/wheel.js +3 -1
- package/2x/cjs/components/popover/popover-menu.js +2 -1
- package/2x/cjs/components/side-bar/side-bar.js +3 -3
- package/2x/cjs/components/stepper/stepper.js +15 -8
- package/2x/cjs/components/tab-bar/tab-bar.js +3 -3
- package/2x/cjs/components/tabs/tabs.js +3 -3
- package/2x/cjs/components/tree-select/multiple.js +2 -1
- package/2x/cjs/utils/traverse-react-node.d.ts +2 -0
- package/2x/cjs/utils/traverse-react-node.js +29 -0
- package/2x/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/2x/es/components/collapse/collapse.js +2 -1
- package/2x/es/components/divider/divider.css +19 -8
- package/2x/es/components/divider/divider.d.ts +1 -0
- package/2x/es/components/divider/divider.js +3 -2
- package/2x/es/components/form/form.js +2 -1
- package/2x/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/2x/es/components/image-uploader/image-uploader.js +4 -1
- package/2x/es/components/image-uploader/preview-item.d.ts +2 -0
- package/2x/es/components/image-uploader/preview-item.js +3 -2
- package/2x/es/components/index-bar/index-bar.js +2 -1
- package/2x/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/2x/es/components/picker-view/picker-view.d.ts +1 -0
- package/2x/es/components/picker-view/wheel.js +3 -1
- package/2x/es/components/popover/popover-menu.js +2 -1
- package/2x/es/components/side-bar/side-bar.js +2 -1
- package/2x/es/components/stepper/stepper.js +14 -8
- package/2x/es/components/tab-bar/tab-bar.js +2 -1
- package/2x/es/components/tabs/tabs.js +2 -1
- package/2x/es/components/tree-select/multiple.js +2 -1
- package/2x/es/utils/traverse-react-node.d.ts +2 -0
- package/2x/es/utils/traverse-react-node.js +18 -0
- package/2x/package.json +5 -1
- package/bundle/antd-mobile.cjs.js +49 -22
- package/bundle/antd-mobile.es.js +48 -22
- package/bundle/style.css +18 -8
- package/cjs/components/capsule-tabs/capsule-tabs.js +3 -3
- package/cjs/components/collapse/collapse.js +3 -3
- package/cjs/components/divider/divider.css +18 -8
- package/cjs/components/divider/divider.d.ts +1 -0
- package/cjs/components/divider/divider.js +3 -2
- package/cjs/components/form/form.js +3 -2
- package/cjs/components/image-uploader/image-uploader.d.ts +2 -0
- package/cjs/components/image-uploader/image-uploader.js +4 -1
- package/cjs/components/image-uploader/preview-item.d.ts +2 -0
- package/cjs/components/image-uploader/preview-item.js +3 -2
- package/cjs/components/index-bar/index-bar.js +3 -3
- package/cjs/components/jumbo-tabs/jumbo-tabs.js +3 -3
- package/cjs/components/picker-view/picker-view.d.ts +1 -0
- package/cjs/components/picker-view/wheel.js +3 -1
- package/cjs/components/popover/popover-menu.js +2 -1
- package/cjs/components/side-bar/side-bar.js +3 -3
- package/cjs/components/stepper/stepper.js +15 -8
- package/cjs/components/tab-bar/tab-bar.js +3 -3
- package/cjs/components/tabs/tabs.js +3 -3
- package/cjs/components/tree-select/multiple.js +2 -1
- package/cjs/utils/traverse-react-node.d.ts +2 -0
- package/cjs/utils/traverse-react-node.js +29 -0
- package/es/components/capsule-tabs/capsule-tabs.js +2 -1
- package/es/components/collapse/collapse.js +2 -1
- package/es/components/divider/divider.css +18 -8
- package/es/components/divider/divider.d.ts +1 -0
- package/es/components/divider/divider.js +3 -2
- package/es/components/form/form.js +2 -1
- package/es/components/image-uploader/image-uploader.d.ts +2 -0
- package/es/components/image-uploader/image-uploader.js +4 -1
- package/es/components/image-uploader/preview-item.d.ts +2 -0
- package/es/components/image-uploader/preview-item.js +3 -2
- package/es/components/index-bar/index-bar.js +2 -1
- package/es/components/jumbo-tabs/jumbo-tabs.js +2 -1
- package/es/components/picker-view/picker-view.d.ts +1 -0
- package/es/components/picker-view/wheel.js +3 -1
- package/es/components/popover/popover-menu.js +2 -1
- package/es/components/side-bar/side-bar.js +2 -1
- package/es/components/stepper/stepper.js +14 -8
- package/es/components/tab-bar/tab-bar.js +2 -1
- package/es/components/tabs/tabs.js +2 -1
- package/es/components/tree-select/multiple.js +2 -1
- package/es/utils/traverse-react-node.d.ts +2 -0
- package/es/utils/traverse-react-node.js +18 -0
- package/package.json +5 -1
- package/umd/antd-mobile.js +1 -1
- package/umd/antd-mobile.js.LICENSE.txt +9 -0
package/bundle/antd-mobile.es.js
CHANGED
|
@@ -4,11 +4,13 @@ import classNames from "classnames";
|
|
|
4
4
|
import { useUnmountedRef, useUpdate, useMemoizedFn, useUpdateEffect, useIsomorphicLayoutEffect, createUpdateEffect, useThrottleFn, useDebounceEffect, useMount, useInViewport, useClickAway, useUnmount, useLockFn, useTimeout } from "ahooks";
|
|
5
5
|
import { useSpring, animated, to } from "@react-spring/web";
|
|
6
6
|
import dayjs from "dayjs";
|
|
7
|
+
import { isFragment } from "react-is";
|
|
7
8
|
import { useDrag, createUseGesture, dragAction, pinchAction } from "@use-gesture/react";
|
|
8
9
|
import { RightOutline, CheckOutline, DownOutline, PictureOutline, PictureWrongOutline, DownFill, QuestionCircleOutline, CloseOutline, AddOutline, CloseCircleFill, LeftOutline, SoundOutline, TextDeletionOutline, StarFill, CheckCircleFill, InformationCircleFill, ClockCircleFill, ExclamationCircleFill, SearchOutline, MinusOutline } from "antd-mobile-icons";
|
|
9
10
|
import { staged } from "staged-components";
|
|
10
11
|
import RcForm, { List as List$2, Field, useForm } from "rc-field-form";
|
|
11
12
|
import { computePosition, offset, shift, limitShift, flip, hide, arrow, autoUpdate } from "@floating-ui/dom";
|
|
13
|
+
import Big from "big.js";
|
|
12
14
|
var global$1 = "";
|
|
13
15
|
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
14
16
|
if (canUseDom) {
|
|
@@ -9135,6 +9137,20 @@ const ScrollMask = (props) => {
|
|
|
9135
9137
|
}
|
|
9136
9138
|
}));
|
|
9137
9139
|
};
|
|
9140
|
+
function traverseReactNode(children, fn) {
|
|
9141
|
+
let i = 0;
|
|
9142
|
+
function handle(target) {
|
|
9143
|
+
React$1.Children.forEach(target, (child) => {
|
|
9144
|
+
if (!isFragment(child)) {
|
|
9145
|
+
fn(child, i);
|
|
9146
|
+
i += 1;
|
|
9147
|
+
} else {
|
|
9148
|
+
handle(child.props.children);
|
|
9149
|
+
}
|
|
9150
|
+
});
|
|
9151
|
+
}
|
|
9152
|
+
handle(children);
|
|
9153
|
+
}
|
|
9138
9154
|
const classPrefix$15 = `adm-capsule-tabs`;
|
|
9139
9155
|
const CapsuleTab = () => {
|
|
9140
9156
|
return null;
|
|
@@ -9146,7 +9162,7 @@ const CapsuleTabs = (props) => {
|
|
|
9146
9162
|
const keyToIndexRecord = {};
|
|
9147
9163
|
let firstActiveKey = null;
|
|
9148
9164
|
const panes = [];
|
|
9149
|
-
|
|
9165
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
9150
9166
|
if (!React$1.isValidElement(child))
|
|
9151
9167
|
return;
|
|
9152
9168
|
const key = child.key;
|
|
@@ -9664,6 +9680,7 @@ const Wheel = memo((props) => {
|
|
|
9664
9680
|
className: `${classPrefix$13}-column-wheel`,
|
|
9665
9681
|
"aria-hidden": true
|
|
9666
9682
|
}, column.map((item, index2) => {
|
|
9683
|
+
var _a;
|
|
9667
9684
|
const selected = props.value === item.value;
|
|
9668
9685
|
if (selected)
|
|
9669
9686
|
selectedIndex = index2;
|
|
@@ -9672,7 +9689,7 @@ const Wheel = memo((props) => {
|
|
|
9672
9689
|
scrollSelect(index2);
|
|
9673
9690
|
}
|
|
9674
9691
|
return React$1.createElement("div", {
|
|
9675
|
-
key: item.value,
|
|
9692
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
9676
9693
|
"data-selected": item.value === value,
|
|
9677
9694
|
className: `${classPrefix$13}-column-item`,
|
|
9678
9695
|
onClick: handleClick,
|
|
@@ -10049,7 +10066,7 @@ const Tabs$1 = (p) => {
|
|
|
10049
10066
|
const keyToIndexRecord = {};
|
|
10050
10067
|
let firstActiveKey = null;
|
|
10051
10068
|
const panes = [];
|
|
10052
|
-
|
|
10069
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
10053
10070
|
if (!React$1.isValidElement(child))
|
|
10054
10071
|
return;
|
|
10055
10072
|
const key = child.key;
|
|
@@ -10912,7 +10929,7 @@ const CollapsePanelContent = (props) => {
|
|
|
10912
10929
|
const Collapse = (props) => {
|
|
10913
10930
|
var _a;
|
|
10914
10931
|
const panels = [];
|
|
10915
|
-
|
|
10932
|
+
traverseReactNode(props.children, (child) => {
|
|
10916
10933
|
if (!React$1.isValidElement(child))
|
|
10917
10934
|
return;
|
|
10918
10935
|
const key = child.key;
|
|
@@ -11724,12 +11741,13 @@ var index$b = attachPropertiesToComponent(Dialog, {
|
|
|
11724
11741
|
var divider = "";
|
|
11725
11742
|
const classPrefix$R = `adm-divider`;
|
|
11726
11743
|
const defaultProps$E = {
|
|
11727
|
-
contentPosition: "center"
|
|
11744
|
+
contentPosition: "center",
|
|
11745
|
+
direction: "horizontal"
|
|
11728
11746
|
};
|
|
11729
11747
|
const Divider = (p) => {
|
|
11730
11748
|
const props = mergeProps(defaultProps$E, p);
|
|
11731
11749
|
return withNativeProps(props, React$1.createElement("div", {
|
|
11732
|
-
className: classNames(classPrefix$R, `${classPrefix$R}-${props.contentPosition}`)
|
|
11750
|
+
className: classNames(classPrefix$R, `${classPrefix$R}-${props.direction}`, `${classPrefix$R}-${props.contentPosition}`)
|
|
11733
11751
|
}, props.children && React$1.createElement("div", {
|
|
11734
11752
|
className: `${classPrefix$R}-content`
|
|
11735
11753
|
}, props.children)));
|
|
@@ -12882,7 +12900,7 @@ const Form$1 = forwardRef((p, ref) => {
|
|
|
12882
12900
|
}, items));
|
|
12883
12901
|
items = [];
|
|
12884
12902
|
}
|
|
12885
|
-
|
|
12903
|
+
traverseReactNode(props.children, (child) => {
|
|
12886
12904
|
if (React$1.isValidElement(child)) {
|
|
12887
12905
|
if (child.type === Header) {
|
|
12888
12906
|
collect();
|
|
@@ -14013,7 +14031,8 @@ const PreviewItem = (props) => {
|
|
|
14013
14031
|
url,
|
|
14014
14032
|
file,
|
|
14015
14033
|
deletable,
|
|
14016
|
-
onDelete
|
|
14034
|
+
onDelete,
|
|
14035
|
+
imageFit
|
|
14017
14036
|
} = props;
|
|
14018
14037
|
const src = useMemo(() => {
|
|
14019
14038
|
if (url) {
|
|
@@ -14048,7 +14067,7 @@ const PreviewItem = (props) => {
|
|
|
14048
14067
|
}, React$1.createElement(Image$1, {
|
|
14049
14068
|
className: `${classPrefix$B}-cell-image`,
|
|
14050
14069
|
src,
|
|
14051
|
-
fit:
|
|
14070
|
+
fit: imageFit,
|
|
14052
14071
|
onClick: props.onClick
|
|
14053
14072
|
}), renderLoading(), renderDelete());
|
|
14054
14073
|
};
|
|
@@ -14088,7 +14107,8 @@ const defaultProps$t = {
|
|
|
14088
14107
|
defaultValue: [],
|
|
14089
14108
|
accept: "image/*",
|
|
14090
14109
|
preview: true,
|
|
14091
|
-
showFailed: true
|
|
14110
|
+
showFailed: true,
|
|
14111
|
+
imageFit: "cover"
|
|
14092
14112
|
};
|
|
14093
14113
|
const ImageUploader = (p) => {
|
|
14094
14114
|
const props = mergeProps(defaultProps$t, p);
|
|
@@ -14214,6 +14234,7 @@ const ImageUploader = (p) => {
|
|
|
14214
14234
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
|
|
14215
14235
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
14216
14236
|
deletable: props.deletable,
|
|
14237
|
+
imageFit: props.imageFit,
|
|
14217
14238
|
onClick: () => {
|
|
14218
14239
|
if (props.preview) {
|
|
14219
14240
|
previewImage(index2);
|
|
@@ -14237,6 +14258,7 @@ const ImageUploader = (p) => {
|
|
|
14237
14258
|
file: task.file,
|
|
14238
14259
|
deletable: task.status !== "pending",
|
|
14239
14260
|
status: task.status,
|
|
14261
|
+
imageFit: props.imageFit,
|
|
14240
14262
|
onDelete: () => {
|
|
14241
14263
|
setTasks(tasks.filter((x) => x.id !== task.id));
|
|
14242
14264
|
}
|
|
@@ -14334,7 +14356,7 @@ const IndexBar = forwardRef((p, ref) => {
|
|
|
14334
14356
|
const bodyRef = useRef(null);
|
|
14335
14357
|
const indexItems = [];
|
|
14336
14358
|
const panels = [];
|
|
14337
|
-
|
|
14359
|
+
traverseReactNode(props.children, (child) => {
|
|
14338
14360
|
var _a;
|
|
14339
14361
|
if (!React$1.isValidElement(child))
|
|
14340
14362
|
return;
|
|
@@ -14602,7 +14624,7 @@ const JumboTabs = (props) => {
|
|
|
14602
14624
|
const keyToIndexRecord = {};
|
|
14603
14625
|
let firstActiveKey = null;
|
|
14604
14626
|
const panes = [];
|
|
14605
|
-
|
|
14627
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
14606
14628
|
if (!React$1.isValidElement(child))
|
|
14607
14629
|
return;
|
|
14608
14630
|
const key = child.key;
|
|
@@ -15900,7 +15922,7 @@ const SideBar = (props) => {
|
|
|
15900
15922
|
var _a;
|
|
15901
15923
|
let firstActiveKey = null;
|
|
15902
15924
|
const items = [];
|
|
15903
|
-
|
|
15925
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
15904
15926
|
if (!React$1.isValidElement(child))
|
|
15905
15927
|
return;
|
|
15906
15928
|
const key = child.key;
|
|
@@ -16276,12 +16298,12 @@ const Stepper = (p) => {
|
|
|
16276
16298
|
inputReadOnly
|
|
16277
16299
|
} = props;
|
|
16278
16300
|
const [value, setValue] = usePropsValue(props);
|
|
16279
|
-
const [inputValue, setInputValue] = useState(() => convertValueToText(value));
|
|
16301
|
+
const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
|
|
16280
16302
|
function setValueWithCheck(v) {
|
|
16281
16303
|
if (isNaN(v))
|
|
16282
16304
|
return;
|
|
16283
16305
|
let target = bound(v, props.min, props.max);
|
|
16284
|
-
if (props.digits
|
|
16306
|
+
if (props.digits !== void 0) {
|
|
16285
16307
|
target = parseFloat(target.toFixed(props.digits));
|
|
16286
16308
|
}
|
|
16287
16309
|
setValue(target);
|
|
@@ -16289,12 +16311,12 @@ const Stepper = (p) => {
|
|
|
16289
16311
|
const [hasFocus, setHasFocus] = useState(false);
|
|
16290
16312
|
useEffect(() => {
|
|
16291
16313
|
if (!hasFocus) {
|
|
16292
|
-
setInputValue(convertValueToText(value));
|
|
16314
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16293
16315
|
}
|
|
16294
16316
|
}, [hasFocus]);
|
|
16295
16317
|
useEffect(() => {
|
|
16296
16318
|
if (!hasFocus) {
|
|
16297
|
-
setInputValue(convertValueToText(value));
|
|
16319
|
+
setInputValue(convertValueToText(value, props.digits));
|
|
16298
16320
|
}
|
|
16299
16321
|
}, [value]);
|
|
16300
16322
|
const handleInputChange = (v) => {
|
|
@@ -16311,10 +16333,10 @@ const Stepper = (p) => {
|
|
|
16311
16333
|
}
|
|
16312
16334
|
};
|
|
16313
16335
|
const handleMinus = () => {
|
|
16314
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16336
|
+
setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
|
|
16315
16337
|
};
|
|
16316
16338
|
const handlePlus = () => {
|
|
16317
|
-
setValueWithCheck((value !== null && value !== void 0 ? value : 0)
|
|
16339
|
+
setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).add(step).toNumber());
|
|
16318
16340
|
};
|
|
16319
16341
|
const minusDisabled = () => {
|
|
16320
16342
|
if (disabled)
|
|
@@ -16376,10 +16398,14 @@ const Stepper = (p) => {
|
|
|
16376
16398
|
color: "primary"
|
|
16377
16399
|
}, React$1.createElement(AddOutline, null))));
|
|
16378
16400
|
};
|
|
16379
|
-
function convertValueToText(value) {
|
|
16401
|
+
function convertValueToText(value, digits) {
|
|
16380
16402
|
if (value === null)
|
|
16381
16403
|
return "";
|
|
16382
|
-
|
|
16404
|
+
if (digits !== void 0) {
|
|
16405
|
+
return value.toFixed(digits);
|
|
16406
|
+
} else {
|
|
16407
|
+
return value.toString();
|
|
16408
|
+
}
|
|
16383
16409
|
}
|
|
16384
16410
|
function convertTextToValue(text) {
|
|
16385
16411
|
if (text === "")
|
|
@@ -16971,7 +16997,7 @@ const TabBar = (p) => {
|
|
|
16971
16997
|
const props = mergeProps(defaultProps$7, p);
|
|
16972
16998
|
let firstActiveKey = null;
|
|
16973
16999
|
const items = [];
|
|
16974
|
-
|
|
17000
|
+
traverseReactNode(props.children, (child, index2) => {
|
|
16975
17001
|
if (!React$1.isValidElement(child))
|
|
16976
17002
|
return;
|
|
16977
17003
|
const key = child.key;
|
package/bundle/style.css
CHANGED
|
@@ -1191,24 +1191,24 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1191
1191
|
transform: translate(-50%, -50%);
|
|
1192
1192
|
color: var(--adm-color-weak);
|
|
1193
1193
|
}
|
|
1194
|
-
.adm-divider {
|
|
1194
|
+
.adm-divider-horizontal {
|
|
1195
1195
|
display: flex;
|
|
1196
1196
|
align-items: center;
|
|
1197
1197
|
margin: 16px 0;
|
|
1198
|
-
color: var(--adm-color-weak);
|
|
1199
|
-
font-size: 14px;
|
|
1200
1198
|
border-width: 0;
|
|
1201
1199
|
border-color: var(--adm-border-color);
|
|
1202
1200
|
border-style: solid;
|
|
1201
|
+
color: var(--adm-color-weak);
|
|
1202
|
+
font-size: 14px;
|
|
1203
1203
|
}
|
|
1204
|
-
.adm-divider-left.adm-divider::before {
|
|
1204
|
+
.adm-divider-left.adm-divider-horizontal::before {
|
|
1205
1205
|
max-width: 10%;
|
|
1206
1206
|
}
|
|
1207
|
-
.adm-divider-right.adm-divider::after {
|
|
1207
|
+
.adm-divider-right.adm-divider-horizontal::after {
|
|
1208
1208
|
max-width: 10%;
|
|
1209
1209
|
}
|
|
1210
|
-
.adm-divider::after,
|
|
1211
|
-
.adm-divider::before {
|
|
1210
|
+
.adm-divider-horizontal::after,
|
|
1211
|
+
.adm-divider-horizontal::before {
|
|
1212
1212
|
flex: auto;
|
|
1213
1213
|
display: block;
|
|
1214
1214
|
content: '';
|
|
@@ -1216,10 +1216,20 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1216
1216
|
border-color: inherit;
|
|
1217
1217
|
border-width: 1px 0 0;
|
|
1218
1218
|
}
|
|
1219
|
-
.adm-divider-content {
|
|
1219
|
+
.adm-divider-horizontal .adm-divider-content {
|
|
1220
1220
|
flex: none;
|
|
1221
1221
|
padding: 0 16px;
|
|
1222
1222
|
}
|
|
1223
|
+
.adm-divider-vertical {
|
|
1224
|
+
position: relative;
|
|
1225
|
+
top: -0.06em;
|
|
1226
|
+
display: inline-block;
|
|
1227
|
+
height: 0.9em;
|
|
1228
|
+
margin: 0 16px;
|
|
1229
|
+
vertical-align: middle;
|
|
1230
|
+
border-top: 0;
|
|
1231
|
+
border-left: 1px solid var(--adm-border-color);
|
|
1232
|
+
}
|
|
1223
1233
|
.adm-dropdown {
|
|
1224
1234
|
background-color: white;
|
|
1225
1235
|
}
|
|
@@ -23,6 +23,8 @@ var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
|
|
|
23
23
|
|
|
24
24
|
var _shouldRender = require("../../utils/should-render");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -45,8 +47,7 @@ const CapsuleTabs = props => {
|
|
|
45
47
|
const keyToIndexRecord = {};
|
|
46
48
|
let firstActiveKey = null;
|
|
47
49
|
const panes = [];
|
|
48
|
-
|
|
49
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
50
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
50
51
|
if (!_react.default.isValidElement(child)) return;
|
|
51
52
|
const key = child.key;
|
|
52
53
|
if (typeof key !== 'string') return;
|
|
@@ -58,7 +59,6 @@ const CapsuleTabs = props => {
|
|
|
58
59
|
const length = panes.push(child);
|
|
59
60
|
keyToIndexRecord[key] = length - 1;
|
|
60
61
|
});
|
|
61
|
-
|
|
62
62
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
63
63
|
value: props.activeKey,
|
|
64
64
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -25,6 +25,8 @@ var _shouldRender = require("../../utils/should-render");
|
|
|
25
25
|
|
|
26
26
|
var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
|
|
27
27
|
|
|
28
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -107,14 +109,12 @@ const Collapse = props => {
|
|
|
107
109
|
var _a;
|
|
108
110
|
|
|
109
111
|
const panels = [];
|
|
110
|
-
|
|
111
|
-
_react.default.Children.forEach(props.children, child => {
|
|
112
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, child => {
|
|
112
113
|
if (!_react.default.isValidElement(child)) return;
|
|
113
114
|
const key = child.key;
|
|
114
115
|
if (typeof key !== 'string') return;
|
|
115
116
|
panels.push(child);
|
|
116
117
|
});
|
|
117
|
-
|
|
118
118
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)(props.accordion ? {
|
|
119
119
|
value: props.activeKey === undefined ? undefined : props.activeKey === null ? [] : [props.activeKey],
|
|
120
120
|
defaultValue: props.defaultActiveKey === undefined || props.defaultActiveKey === null ? [] : [props.defaultActiveKey],
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
.adm-divider {
|
|
1
|
+
.adm-divider-horizontal {
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
margin: 16px 0;
|
|
5
|
-
color: var(--adm-color-weak);
|
|
6
|
-
font-size: 14px;
|
|
7
5
|
border-width: 0;
|
|
8
6
|
border-color: var(--adm-border-color);
|
|
9
7
|
border-style: solid;
|
|
8
|
+
color: var(--adm-color-weak);
|
|
9
|
+
font-size: 14px;
|
|
10
10
|
}
|
|
11
|
-
.adm-divider-left.adm-divider::before {
|
|
11
|
+
.adm-divider-left.adm-divider-horizontal::before {
|
|
12
12
|
max-width: 10%;
|
|
13
13
|
}
|
|
14
|
-
.adm-divider-right.adm-divider::after {
|
|
14
|
+
.adm-divider-right.adm-divider-horizontal::after {
|
|
15
15
|
max-width: 10%;
|
|
16
16
|
}
|
|
17
|
-
.adm-divider::after,
|
|
18
|
-
.adm-divider::before {
|
|
17
|
+
.adm-divider-horizontal::after,
|
|
18
|
+
.adm-divider-horizontal::before {
|
|
19
19
|
flex: auto;
|
|
20
20
|
display: block;
|
|
21
21
|
content: '';
|
|
@@ -23,7 +23,17 @@
|
|
|
23
23
|
border-color: inherit;
|
|
24
24
|
border-width: 1px 0 0;
|
|
25
25
|
}
|
|
26
|
-
.adm-divider-content {
|
|
26
|
+
.adm-divider-horizontal .adm-divider-content {
|
|
27
27
|
flex: none;
|
|
28
28
|
padding: 0 16px;
|
|
29
29
|
}
|
|
30
|
+
.adm-divider-vertical {
|
|
31
|
+
position: relative;
|
|
32
|
+
top: -0.06em;
|
|
33
|
+
display: inline-block;
|
|
34
|
+
height: 0.9em;
|
|
35
|
+
margin: 0 16px;
|
|
36
|
+
vertical-align: middle;
|
|
37
|
+
border-top: 0;
|
|
38
|
+
border-left: 1px solid var(--adm-border-color);
|
|
39
|
+
}
|
|
@@ -2,5 +2,6 @@ import { FC } from 'react';
|
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
3
|
export declare type DividerProps = {
|
|
4
4
|
contentPosition?: 'left' | 'right' | 'center';
|
|
5
|
+
direction?: 'horizontal' | 'vertical';
|
|
5
6
|
} & NativeProps;
|
|
6
7
|
export declare const Divider: FC<DividerProps>;
|
|
@@ -17,13 +17,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
|
|
18
18
|
const classPrefix = `adm-divider`;
|
|
19
19
|
const defaultProps = {
|
|
20
|
-
contentPosition: 'center'
|
|
20
|
+
contentPosition: 'center',
|
|
21
|
+
direction: 'horizontal'
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
const Divider = p => {
|
|
24
25
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
25
26
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
|
|
26
|
-
className: (0, _classnames.default)(classPrefix, `${classPrefix}-${props.contentPosition}`)
|
|
27
|
+
className: (0, _classnames.default)(classPrefix, `${classPrefix}-${props.direction}`, `${classPrefix}-${props.contentPosition}`)
|
|
27
28
|
}, props.children && _react.default.createElement("div", {
|
|
28
29
|
className: `${classPrefix}-content`
|
|
29
30
|
}, props.children)));
|
|
@@ -27,6 +27,8 @@ var _merge = _interopRequireDefault(require("lodash/merge"));
|
|
|
27
27
|
|
|
28
28
|
var _formArray = require("./form-array");
|
|
29
29
|
|
|
30
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
31
|
+
|
|
30
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
33
|
|
|
32
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -68,7 +70,7 @@ const Form = (0, _react.forwardRef)((p, ref) => {
|
|
|
68
70
|
items = [];
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
|
|
73
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, child => {
|
|
72
74
|
if (_react.default.isValidElement(child)) {
|
|
73
75
|
if (child.type === _header.Header) {
|
|
74
76
|
collect();
|
|
@@ -85,7 +87,6 @@ const Form = (0, _react.forwardRef)((p, ref) => {
|
|
|
85
87
|
|
|
86
88
|
items.push(child);
|
|
87
89
|
});
|
|
88
|
-
|
|
89
90
|
collect();
|
|
90
91
|
return _react.default.createElement(_rcFieldForm.default, Object.assign({
|
|
91
92
|
className: (0, _classnames.default)(classPrefix, className),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC, InputHTMLAttributes } from 'react';
|
|
2
2
|
import { NativeProps } from '../../utils/native-props';
|
|
3
|
+
import type { ImageProps } from '../image';
|
|
3
4
|
export declare type TaskStatus = 'pending' | 'fail';
|
|
4
5
|
export interface ImageUploadItem {
|
|
5
6
|
key?: string | number;
|
|
@@ -25,5 +26,6 @@ export declare type ImageUploaderProps = {
|
|
|
25
26
|
onDelete?: (item: ImageUploadItem) => boolean | Promise<boolean> | void;
|
|
26
27
|
preview?: boolean;
|
|
27
28
|
showFailed?: boolean;
|
|
29
|
+
imageFit?: ImageProps['fit'];
|
|
28
30
|
} & NativeProps<'--cell-size'>;
|
|
29
31
|
export declare const ImageUploader: FC<ImageUploaderProps>;
|
|
@@ -41,7 +41,8 @@ const defaultProps = {
|
|
|
41
41
|
defaultValue: [],
|
|
42
42
|
accept: 'image/*',
|
|
43
43
|
preview: true,
|
|
44
|
-
showFailed: true
|
|
44
|
+
showFailed: true,
|
|
45
|
+
imageFit: 'cover'
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
const ImageUploader = p => {
|
|
@@ -181,6 +182,7 @@ const ImageUploader = p => {
|
|
|
181
182
|
key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index,
|
|
182
183
|
url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
|
|
183
184
|
deletable: props.deletable,
|
|
185
|
+
imageFit: props.imageFit,
|
|
184
186
|
onClick: () => {
|
|
185
187
|
if (props.preview) {
|
|
186
188
|
previewImage(index);
|
|
@@ -206,6 +208,7 @@ const ImageUploader = p => {
|
|
|
206
208
|
file: task.file,
|
|
207
209
|
deletable: task.status !== 'pending',
|
|
208
210
|
status: task.status,
|
|
211
|
+
imageFit: props.imageFit,
|
|
209
212
|
onDelete: () => {
|
|
210
213
|
setTasks(tasks.filter(x => x.id !== task.id));
|
|
211
214
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { TaskStatus } from './image-uploader';
|
|
3
|
+
import type { ImageProps } from '../image';
|
|
3
4
|
declare type Props = {
|
|
4
5
|
onClick?: () => void;
|
|
5
6
|
onDelete?: () => void;
|
|
@@ -7,6 +8,7 @@ declare type Props = {
|
|
|
7
8
|
url?: string;
|
|
8
9
|
file?: File;
|
|
9
10
|
status?: TaskStatus;
|
|
11
|
+
imageFit: ImageProps['fit'];
|
|
10
12
|
};
|
|
11
13
|
declare const PreviewItem: FC<Props>;
|
|
12
14
|
export default PreviewItem;
|
|
@@ -33,7 +33,8 @@ const PreviewItem = props => {
|
|
|
33
33
|
url,
|
|
34
34
|
file,
|
|
35
35
|
deletable,
|
|
36
|
-
onDelete
|
|
36
|
+
onDelete,
|
|
37
|
+
imageFit
|
|
37
38
|
} = props;
|
|
38
39
|
const src = (0, _react.useMemo)(() => {
|
|
39
40
|
if (url) {
|
|
@@ -73,7 +74,7 @@ const PreviewItem = props => {
|
|
|
73
74
|
}, _react.default.createElement(_image.default, {
|
|
74
75
|
className: `${classPrefix}-cell-image`,
|
|
75
76
|
src: src,
|
|
76
|
-
fit:
|
|
77
|
+
fit: imageFit,
|
|
77
78
|
onClick: props.onClick
|
|
78
79
|
}), renderLoading(), renderDelete());
|
|
79
80
|
};
|
|
@@ -23,6 +23,8 @@ var _panel = require("./panel");
|
|
|
23
23
|
|
|
24
24
|
var _devLog = require("../../utils/dev-log");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -39,8 +41,7 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
39
41
|
const bodyRef = (0, _react.useRef)(null);
|
|
40
42
|
const indexItems = [];
|
|
41
43
|
const panels = [];
|
|
42
|
-
|
|
43
|
-
_react.default.Children.forEach(props.children, child => {
|
|
44
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, child => {
|
|
44
45
|
var _a;
|
|
45
46
|
|
|
46
47
|
if (!_react.default.isValidElement(child)) return;
|
|
@@ -62,7 +63,6 @@ const IndexBar = (0, _react.forwardRef)((p, ref) => {
|
|
|
62
63
|
className: `${classPrefix}-anchor-title`
|
|
63
64
|
}, child.props.title || child.props.index), child.props.children)));
|
|
64
65
|
});
|
|
65
|
-
|
|
66
66
|
const [activeIndex, setActiveIndex] = (0, _react.useState)(() => {
|
|
67
67
|
const firstItem = indexItems[0];
|
|
68
68
|
return firstItem ? firstItem.index : null;
|
|
@@ -23,6 +23,8 @@ var _scrollMask = _interopRequireDefault(require("../scroll-mask"));
|
|
|
23
23
|
|
|
24
24
|
var _shouldRender = require("../../utils/should-render");
|
|
25
25
|
|
|
26
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
27
|
+
|
|
26
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
29
|
|
|
28
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -45,8 +47,7 @@ const JumboTabs = props => {
|
|
|
45
47
|
const keyToIndexRecord = {};
|
|
46
48
|
let firstActiveKey = null;
|
|
47
49
|
const panes = [];
|
|
48
|
-
|
|
49
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
50
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
50
51
|
if (!_react.default.isValidElement(child)) return;
|
|
51
52
|
const key = child.key;
|
|
52
53
|
if (typeof key !== 'string') return;
|
|
@@ -58,7 +59,6 @@ const JumboTabs = props => {
|
|
|
58
59
|
const length = panes.push(child);
|
|
59
60
|
keyToIndexRecord[key] = length - 1;
|
|
60
61
|
});
|
|
61
|
-
|
|
62
62
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
63
63
|
value: props.activeKey,
|
|
64
64
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|
|
@@ -9,6 +9,7 @@ export declare type PickerValueExtend = {
|
|
|
9
9
|
export declare type PickerColumnItem = {
|
|
10
10
|
label: ReactNode;
|
|
11
11
|
value: string;
|
|
12
|
+
key?: string | number;
|
|
12
13
|
};
|
|
13
14
|
export declare type PickerColumn = (string | PickerColumnItem)[];
|
|
14
15
|
export declare type PickerViewProps = {
|
|
@@ -161,6 +161,8 @@ const Wheel = (0, _react.memo)(props => {
|
|
|
161
161
|
className: `${classPrefix}-column-wheel`,
|
|
162
162
|
"aria-hidden": true
|
|
163
163
|
}, column.map((item, index) => {
|
|
164
|
+
var _a;
|
|
165
|
+
|
|
164
166
|
const selected = props.value === item.value;
|
|
165
167
|
if (selected) selectedIndex = index;
|
|
166
168
|
|
|
@@ -170,7 +172,7 @@ const Wheel = (0, _react.memo)(props => {
|
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
return _react.default.createElement("div", {
|
|
173
|
-
key: item.value,
|
|
175
|
+
key: (_a = item.key) !== null && _a !== void 0 ? _a : item.value,
|
|
174
176
|
"data-selected": item.value === value,
|
|
175
177
|
className: `${classPrefix}-column-item`,
|
|
176
178
|
onClick: handleClick,
|
|
@@ -19,7 +19,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
19
19
|
|
|
20
20
|
const classPrefix = `adm-popover-menu`;
|
|
21
21
|
const PopoverMenu = (0, _react.forwardRef)((props, ref) => {
|
|
22
|
-
const innerRef = (0, _react.useRef)(null);
|
|
22
|
+
const innerRef = (0, _react.useRef)(null); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
|
+
|
|
23
24
|
(0, _react.useImperativeHandle)(ref, () => innerRef.current, []);
|
|
24
25
|
const onClick = (0, _react.useCallback)(e => {
|
|
25
26
|
var _a;
|
|
@@ -17,6 +17,8 @@ var _usePropsValue = require("../../utils/use-props-value");
|
|
|
17
17
|
|
|
18
18
|
var _corner = require("./corner");
|
|
19
19
|
|
|
20
|
+
var _traverseReactNode = require("../../utils/traverse-react-node");
|
|
21
|
+
|
|
20
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
23
|
|
|
22
24
|
const classPrefix = `adm-side-bar`;
|
|
@@ -32,8 +34,7 @@ const SideBar = props => {
|
|
|
32
34
|
|
|
33
35
|
let firstActiveKey = null;
|
|
34
36
|
const items = [];
|
|
35
|
-
|
|
36
|
-
_react.default.Children.forEach(props.children, (child, index) => {
|
|
37
|
+
(0, _traverseReactNode.traverseReactNode)(props.children, (child, index) => {
|
|
37
38
|
if (!_react.default.isValidElement(child)) return;
|
|
38
39
|
const key = child.key;
|
|
39
40
|
if (typeof key !== 'string') return;
|
|
@@ -44,7 +45,6 @@ const SideBar = props => {
|
|
|
44
45
|
|
|
45
46
|
items.push(child);
|
|
46
47
|
});
|
|
47
|
-
|
|
48
48
|
const [activeKey, setActiveKey] = (0, _usePropsValue.usePropsValue)({
|
|
49
49
|
value: props.activeKey,
|
|
50
50
|
defaultValue: (_a = props.defaultActiveKey) !== null && _a !== void 0 ? _a : firstActiveKey,
|