antd-mobile 5.10.3 → 5.11.1
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/button/button.d.ts +6 -4
- package/2x/cjs/components/button/button.js +31 -7
- package/2x/cjs/components/calendar/calendar.css +2 -2
- package/2x/cjs/components/calendar/calendar.d.ts +2 -0
- package/2x/cjs/components/calendar/calendar.js +6 -1
- package/2x/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/2x/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
- package/2x/cjs/components/cascade-picker/cascade-picker.js +2 -7
- package/2x/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
- package/2x/cjs/components/date-picker/date-picker.js +1 -0
- package/2x/cjs/components/dialog/dialog-action-button.js +3 -26
- package/2x/cjs/components/floating-panel/floating-panel.js +1 -1
- package/2x/cjs/components/form/context.d.ts +1 -0
- package/2x/cjs/components/form/context.js +2 -1
- package/2x/cjs/components/form/form-item.css +2 -2
- package/2x/cjs/components/form/form-item.js +5 -2
- package/2x/cjs/components/form/form.d.ts +0 -3
- package/2x/cjs/components/form/form.js +4 -2
- package/2x/cjs/components/form/index.css +2 -2
- package/2x/cjs/components/form/index.d.ts +2 -2
- package/2x/cjs/components/form/index.js +2 -1
- package/2x/cjs/components/index-bar/panel.d.ts +1 -0
- package/2x/cjs/components/input/input.css +4 -0
- package/2x/cjs/components/input/input.d.ts +2 -0
- package/2x/cjs/components/input/input.js +13 -2
- package/2x/cjs/components/modal/modal-action-button.js +3 -26
- package/2x/cjs/components/search-bar/search-bar.d.ts +2 -0
- package/2x/cjs/components/search-bar/search-bar.js +2 -0
- package/2x/cjs/global/index.js +2 -0
- package/2x/cjs/utils/get-scroll-parent.js +7 -4
- package/2x/es/components/button/button.d.ts +6 -4
- package/2x/es/components/button/button.js +30 -8
- package/2x/es/components/calendar/calendar.css +2 -2
- package/2x/es/components/calendar/calendar.d.ts +2 -0
- package/2x/es/components/calendar/calendar.js +6 -2
- package/2x/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/2x/es/components/cascade-picker/cascade-picker-utils.js +35 -15
- package/2x/es/components/cascade-picker/cascade-picker.js +3 -7
- package/2x/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
- package/2x/es/components/date-picker/date-picker.js +1 -0
- package/2x/es/components/dialog/dialog-action-button.js +3 -21
- package/2x/es/components/floating-panel/floating-panel.js +1 -1
- package/2x/es/components/form/context.d.ts +1 -0
- package/2x/es/components/form/context.js +2 -1
- package/2x/es/components/form/form-item.css +2 -2
- package/2x/es/components/form/form-item.js +5 -2
- package/2x/es/components/form/form.d.ts +0 -3
- package/2x/es/components/form/form.js +4 -2
- package/2x/es/components/form/index.css +2 -2
- package/2x/es/components/form/index.d.ts +2 -2
- package/2x/es/components/form/index.js +3 -2
- package/2x/es/components/index-bar/panel.d.ts +1 -0
- package/2x/es/components/input/input.css +4 -0
- package/2x/es/components/input/input.d.ts +2 -0
- package/2x/es/components/input/input.js +13 -2
- package/2x/es/components/modal/modal-action-button.js +3 -21
- package/2x/es/components/search-bar/search-bar.d.ts +2 -0
- package/2x/es/components/search-bar/search-bar.js +2 -0
- package/2x/es/global/index.js +2 -0
- package/2x/es/utils/get-scroll-parent.js +7 -4
- package/2x/package.json +2 -2
- package/bundle/antd-mobile.cjs.js +107 -98
- package/bundle/antd-mobile.es.js +108 -99
- package/bundle/style.css +7 -4
- package/cjs/components/button/button.d.ts +6 -4
- package/cjs/components/button/button.js +31 -7
- package/cjs/components/calendar/calendar.css +2 -2
- package/cjs/components/calendar/calendar.d.ts +2 -0
- package/cjs/components/calendar/calendar.js +6 -1
- package/cjs/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/cjs/components/cascade-picker/cascade-picker-utils.js +37 -16
- package/cjs/components/cascade-picker/cascade-picker.js +2 -7
- package/cjs/components/cascade-picker-view/cascade-picker-view.js +2 -7
- package/cjs/components/date-picker/date-picker.js +1 -0
- package/cjs/components/dialog/dialog-action-button.js +3 -26
- package/cjs/components/floating-panel/floating-panel.js +1 -1
- package/cjs/components/form/context.d.ts +1 -0
- package/cjs/components/form/context.js +2 -1
- package/cjs/components/form/form-item.css +2 -2
- package/cjs/components/form/form-item.js +5 -2
- package/cjs/components/form/form.d.ts +0 -3
- package/cjs/components/form/form.js +4 -2
- package/cjs/components/form/index.css +2 -2
- package/cjs/components/form/index.d.ts +2 -2
- package/cjs/components/form/index.js +2 -1
- package/cjs/components/index-bar/panel.d.ts +1 -0
- package/cjs/components/input/input.css +3 -0
- package/cjs/components/input/input.d.ts +2 -0
- package/cjs/components/input/input.js +13 -2
- package/cjs/components/modal/modal-action-button.js +3 -26
- package/cjs/components/search-bar/search-bar.d.ts +2 -0
- package/cjs/components/search-bar/search-bar.js +2 -0
- package/cjs/global/index.js +2 -0
- package/cjs/utils/get-scroll-parent.js +7 -4
- package/es/components/button/button.d.ts +6 -4
- package/es/components/button/button.js +30 -8
- package/es/components/calendar/calendar.css +2 -2
- package/es/components/calendar/calendar.d.ts +2 -0
- package/es/components/calendar/calendar.js +6 -2
- package/es/components/cascade-picker/cascade-picker-utils.d.ts +2 -2
- package/es/components/cascade-picker/cascade-picker-utils.js +35 -15
- package/es/components/cascade-picker/cascade-picker.js +3 -7
- package/es/components/cascade-picker-view/cascade-picker-view.js +3 -7
- package/es/components/date-picker/date-picker.js +1 -0
- package/es/components/dialog/dialog-action-button.js +3 -21
- package/es/components/floating-panel/floating-panel.js +1 -1
- package/es/components/form/context.d.ts +1 -0
- package/es/components/form/context.js +2 -1
- package/es/components/form/form-item.css +2 -2
- package/es/components/form/form-item.js +5 -2
- package/es/components/form/form.d.ts +0 -3
- package/es/components/form/form.js +4 -2
- package/es/components/form/index.css +2 -2
- package/es/components/form/index.d.ts +2 -2
- package/es/components/form/index.js +3 -2
- package/es/components/index-bar/panel.d.ts +1 -0
- package/es/components/input/input.css +3 -0
- package/es/components/input/input.d.ts +2 -0
- package/es/components/input/input.js +13 -2
- package/es/components/modal/modal-action-button.js +3 -21
- package/es/components/search-bar/search-bar.d.ts +2 -0
- package/es/components/search-bar/search-bar.js +2 -0
- package/es/global/index.js +2 -0
- package/es/utils/get-scroll-parent.js +7 -4
- package/package.json +2 -2
- package/umd/antd-mobile.js +1 -1
- package/2x/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/2x/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
- package/2x/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/2x/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
- package/cjs/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/cjs/components/cascade-picker/use-cascade-picker-options.js +0 -40
- package/es/components/cascade-picker/use-cascade-picker-options.d.ts +0 -5
- package/es/components/cascade-picker/use-cascade-picker-options.js +0 -32
package/bundle/antd-mobile.es.js
CHANGED
|
@@ -8,7 +8,7 @@ import { isFragment } from "react-is";
|
|
|
8
8
|
import { useDrag, useWheel, createUseGesture, dragAction, pinchAction } from "@use-gesture/react";
|
|
9
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";
|
|
10
10
|
import { staged } from "staged-components";
|
|
11
|
-
import RcForm, { List as List$2, Field, useForm } from "rc-field-form";
|
|
11
|
+
import RcForm, { List as List$2, Field, useForm, useWatch } from "rc-field-form";
|
|
12
12
|
import { computePosition, offset, shift, limitShift, flip, hide, arrow, autoUpdate } from "@floating-ui/dom";
|
|
13
13
|
import Big from "big.js";
|
|
14
14
|
var global$1 = "";
|
|
@@ -1583,8 +1583,8 @@ function useTouch() {
|
|
|
1583
1583
|
isHorizontal
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
-
const overflowScrollReg = /scroll|auto|overlay/i;
|
|
1587
1586
|
const defaultRoot = canUseDom ? window : void 0;
|
|
1587
|
+
const overflowStylePatterns = ["scroll", "auto", "overlay"];
|
|
1588
1588
|
function isElement(node) {
|
|
1589
1589
|
const ELEMENT_NODE_TYPE = 1;
|
|
1590
1590
|
return node.nodeType === ELEMENT_NODE_TYPE;
|
|
@@ -1592,10 +1592,13 @@ function isElement(node) {
|
|
|
1592
1592
|
function getScrollParent(el, root2 = defaultRoot) {
|
|
1593
1593
|
let node = el;
|
|
1594
1594
|
while (node && node !== root2 && isElement(node)) {
|
|
1595
|
+
if (node === document.body) {
|
|
1596
|
+
return root2;
|
|
1597
|
+
}
|
|
1595
1598
|
const {
|
|
1596
1599
|
overflowY
|
|
1597
1600
|
} = window.getComputedStyle(node);
|
|
1598
|
-
if (
|
|
1601
|
+
if (overflowStylePatterns.includes(overflowY)) {
|
|
1599
1602
|
return node;
|
|
1600
1603
|
}
|
|
1601
1604
|
node = node.parentNode;
|
|
@@ -8432,29 +8435,52 @@ const DotLoading = memo((p) => {
|
|
|
8432
8435
|
keyTimes: "0; 0.1; 0.3; 0.4; 1"
|
|
8433
8436
|
}))))))))));
|
|
8434
8437
|
});
|
|
8438
|
+
function isPromise(obj) {
|
|
8439
|
+
return !!obj && typeof obj === "object" && typeof obj.then === "function";
|
|
8440
|
+
}
|
|
8435
8441
|
const classPrefix$1d = `adm-button`;
|
|
8436
8442
|
const defaultProps$W = {
|
|
8437
8443
|
color: "default",
|
|
8438
8444
|
fill: "solid",
|
|
8439
8445
|
block: false,
|
|
8440
8446
|
loading: false,
|
|
8447
|
+
loadingIcon: React$1.createElement(DotLoading, {
|
|
8448
|
+
color: "currentColor"
|
|
8449
|
+
}),
|
|
8441
8450
|
type: "button",
|
|
8442
8451
|
shape: "default",
|
|
8443
8452
|
size: "middle"
|
|
8444
8453
|
};
|
|
8445
8454
|
const Button = forwardRef((p, ref) => {
|
|
8446
8455
|
const props = mergeProps(defaultProps$W, p);
|
|
8447
|
-
const
|
|
8456
|
+
const [innerLoading, setInnerLoading] = useState(false);
|
|
8448
8457
|
const nativeButtonRef = useRef(null);
|
|
8458
|
+
const loading = props.loading === "auto" ? innerLoading : props.loading;
|
|
8459
|
+
const disabled = props.disabled || loading;
|
|
8449
8460
|
useImperativeHandle(ref, () => ({
|
|
8450
8461
|
get nativeElement() {
|
|
8451
8462
|
return nativeButtonRef.current;
|
|
8452
8463
|
}
|
|
8453
8464
|
}));
|
|
8465
|
+
const handleClick = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8466
|
+
if (!props.onClick)
|
|
8467
|
+
return;
|
|
8468
|
+
const promise = props.onClick(e);
|
|
8469
|
+
if (isPromise(promise)) {
|
|
8470
|
+
try {
|
|
8471
|
+
setInnerLoading(true);
|
|
8472
|
+
yield promise;
|
|
8473
|
+
setInnerLoading(false);
|
|
8474
|
+
} catch (e2) {
|
|
8475
|
+
setInnerLoading(false);
|
|
8476
|
+
throw e2;
|
|
8477
|
+
}
|
|
8478
|
+
}
|
|
8479
|
+
});
|
|
8454
8480
|
return withNativeProps(props, React$1.createElement("button", {
|
|
8455
8481
|
ref: nativeButtonRef,
|
|
8456
8482
|
type: props.type,
|
|
8457
|
-
onClick:
|
|
8483
|
+
onClick: handleClick,
|
|
8458
8484
|
className: classNames(classPrefix$1d, props.color ? `${classPrefix$1d}-${props.color}` : null, {
|
|
8459
8485
|
[`${classPrefix$1d}-block`]: props.block,
|
|
8460
8486
|
[`${classPrefix$1d}-disabled`]: disabled,
|
|
@@ -8463,14 +8489,12 @@ const Button = forwardRef((p, ref) => {
|
|
|
8463
8489
|
[`${classPrefix$1d}-mini`]: props.size === "mini",
|
|
8464
8490
|
[`${classPrefix$1d}-small`]: props.size === "small",
|
|
8465
8491
|
[`${classPrefix$1d}-large`]: props.size === "large",
|
|
8466
|
-
[`${classPrefix$1d}-loading`]:
|
|
8492
|
+
[`${classPrefix$1d}-loading`]: loading
|
|
8467
8493
|
}, `${classPrefix$1d}-shape-${props.shape}`),
|
|
8468
8494
|
disabled
|
|
8469
|
-
},
|
|
8495
|
+
}, loading ? React$1.createElement("div", {
|
|
8470
8496
|
className: `${classPrefix$1d}-loading-wrapper`
|
|
8471
|
-
},
|
|
8472
|
-
color: "currentColor"
|
|
8473
|
-
}), props.loadingText) : props.children));
|
|
8497
|
+
}, props.loadingIcon, props.loadingText) : props.children));
|
|
8474
8498
|
});
|
|
8475
8499
|
var safeArea = "";
|
|
8476
8500
|
const classPrefix$1c = "adm-safe-area";
|
|
@@ -8901,6 +8925,8 @@ const Calendar = forwardRef((p, ref) => {
|
|
|
8901
8925
|
setCurrent(current.add(1, "year"));
|
|
8902
8926
|
}
|
|
8903
8927
|
}, React$1.createElement(ArrowLeftDouble, null)));
|
|
8928
|
+
const maxDay = useMemo(() => props.max && dayjs(props.max), [props.max]);
|
|
8929
|
+
const minDay = useMemo(() => props.min && dayjs(props.min), [props.min]);
|
|
8904
8930
|
function renderCells() {
|
|
8905
8931
|
var _a;
|
|
8906
8932
|
const cells = [];
|
|
@@ -8920,9 +8946,10 @@ const Calendar = forwardRef((p, ref) => {
|
|
|
8920
8946
|
isSelect = isBegin || isEnd || d.isAfter(begin, "day") && d.isBefore(end, "day");
|
|
8921
8947
|
}
|
|
8922
8948
|
const inThisMonth = d.month() === current.month();
|
|
8949
|
+
const disabled = !inThisMonth || maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
|
|
8923
8950
|
cells.push(React$1.createElement("div", {
|
|
8924
8951
|
key: d.valueOf(),
|
|
8925
|
-
className: classNames(`${classPrefix$17}-cell`,
|
|
8952
|
+
className: classNames(`${classPrefix$17}-cell`, disabled && `${classPrefix$17}-cell-disabled`, inThisMonth && {
|
|
8926
8953
|
[`${classPrefix$17}-cell-today`]: d.isSame(today, "day"),
|
|
8927
8954
|
[`${classPrefix$17}-cell-selected`]: isSelect,
|
|
8928
8955
|
[`${classPrefix$17}-cell-selected-begin`]: isBegin,
|
|
@@ -8931,6 +8958,8 @@ const Calendar = forwardRef((p, ref) => {
|
|
|
8931
8958
|
onClick: () => {
|
|
8932
8959
|
if (!props.selectionMode)
|
|
8933
8960
|
return;
|
|
8961
|
+
if (disabled)
|
|
8962
|
+
return;
|
|
8934
8963
|
const date = d.toDate();
|
|
8935
8964
|
if (!inThisMonth) {
|
|
8936
8965
|
setCurrent(d.clone().date(1));
|
|
@@ -9977,62 +10006,52 @@ function prompt$3(props) {
|
|
|
9977
10006
|
var Picker = attachPropertiesToComponent(Picker$1, {
|
|
9978
10007
|
prompt: prompt$3
|
|
9979
10008
|
});
|
|
9980
|
-
function
|
|
9981
|
-
|
|
9982
|
-
let
|
|
9983
|
-
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
return;
|
|
9987
|
-
}
|
|
9988
|
-
subOptionsRecord[option.value] = option.children;
|
|
10009
|
+
function useColumnsFn(options) {
|
|
10010
|
+
const depth = useMemo(() => {
|
|
10011
|
+
let depth2 = 0;
|
|
10012
|
+
function traverse(options2, currentDepth) {
|
|
10013
|
+
if (currentDepth > depth2)
|
|
10014
|
+
depth2 = currentDepth;
|
|
9989
10015
|
const nextDepth = currentDepth + 1;
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
traverse(option2, nextDepth);
|
|
10016
|
+
options2.forEach((option) => {
|
|
10017
|
+
if (option.children) {
|
|
10018
|
+
traverse(option.children, nextDepth);
|
|
10019
|
+
}
|
|
9995
10020
|
});
|
|
9996
10021
|
}
|
|
9997
|
-
options
|
|
9998
|
-
|
|
9999
|
-
});
|
|
10000
|
-
return {
|
|
10001
|
-
depth,
|
|
10002
|
-
subOptionsRecord
|
|
10003
|
-
};
|
|
10022
|
+
traverse(options, 1);
|
|
10023
|
+
return depth2;
|
|
10004
10024
|
}, [options]);
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
})));
|
|
10012
|
-
for (let i = 0; i < depth - 1; i++) {
|
|
10013
|
-
const x = value[i];
|
|
10014
|
-
const subOptions = subOptionsRecord[x];
|
|
10015
|
-
if (!subOptions) {
|
|
10016
|
-
columns.push([]);
|
|
10017
|
-
} else {
|
|
10018
|
-
columns.push(subOptions.map((option) => ({
|
|
10025
|
+
return (selected) => {
|
|
10026
|
+
const columns = [];
|
|
10027
|
+
let currentOptions = options;
|
|
10028
|
+
let i = 0;
|
|
10029
|
+
while (true) {
|
|
10030
|
+
columns.push(currentOptions.map((option) => ({
|
|
10019
10031
|
label: option.label,
|
|
10020
10032
|
value: option.value
|
|
10021
10033
|
})));
|
|
10034
|
+
const x = selected[i];
|
|
10035
|
+
const targetOptions = currentOptions.find((option) => option.value === x);
|
|
10036
|
+
if (!targetOptions || !targetOptions.children)
|
|
10037
|
+
break;
|
|
10038
|
+
currentOptions = targetOptions.children;
|
|
10039
|
+
i++;
|
|
10022
10040
|
}
|
|
10023
|
-
|
|
10024
|
-
|
|
10041
|
+
while (i < depth - 1) {
|
|
10042
|
+
columns.push([]);
|
|
10043
|
+
i++;
|
|
10044
|
+
}
|
|
10045
|
+
return columns;
|
|
10046
|
+
};
|
|
10025
10047
|
}
|
|
10026
10048
|
const CascadePicker = (props) => {
|
|
10027
10049
|
const {
|
|
10028
10050
|
options
|
|
10029
10051
|
} = props, pickerProps = __rest(props, ["options"]);
|
|
10030
|
-
const
|
|
10031
|
-
depth,
|
|
10032
|
-
subOptionsRecord
|
|
10033
|
-
} = useCascadePickerOptions(options);
|
|
10052
|
+
const columnsFn = useColumnsFn(options);
|
|
10034
10053
|
return React$1.createElement(Picker, Object.assign({}, pickerProps, {
|
|
10035
|
-
columns:
|
|
10054
|
+
columns: columnsFn
|
|
10036
10055
|
}));
|
|
10037
10056
|
};
|
|
10038
10057
|
function prompt$2(props) {
|
|
@@ -10072,12 +10091,9 @@ const CascadePickerView = (props) => {
|
|
|
10072
10091
|
const {
|
|
10073
10092
|
options
|
|
10074
10093
|
} = props, pickerProps = __rest(props, ["options"]);
|
|
10075
|
-
const
|
|
10076
|
-
depth,
|
|
10077
|
-
subOptionsRecord
|
|
10078
|
-
} = useCascadePickerOptions(options);
|
|
10094
|
+
const columnsFn = useColumnsFn(options);
|
|
10079
10095
|
return React$1.createElement(PickerView, Object.assign({}, pickerProps, {
|
|
10080
|
-
columns:
|
|
10096
|
+
columns: columnsFn
|
|
10081
10097
|
}));
|
|
10082
10098
|
};
|
|
10083
10099
|
var cascaderView = "";
|
|
@@ -11388,6 +11404,7 @@ const DatePicker = (p) => {
|
|
|
11388
11404
|
value: pickerValue,
|
|
11389
11405
|
onCancel: props.onCancel,
|
|
11390
11406
|
onClose: props.onClose,
|
|
11407
|
+
closeOnMaskClick: props.closeOnMaskClick,
|
|
11391
11408
|
visible: props.visible,
|
|
11392
11409
|
confirmText: props.confirmText,
|
|
11393
11410
|
cancelText: props.cancelText,
|
|
@@ -11473,23 +11490,9 @@ const DialogActionButton = (props) => {
|
|
|
11473
11490
|
const {
|
|
11474
11491
|
action
|
|
11475
11492
|
} = props;
|
|
11476
|
-
const [loading, setLoading] = useState(false);
|
|
11477
|
-
function handleClick() {
|
|
11478
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
11479
|
-
setLoading(true);
|
|
11480
|
-
try {
|
|
11481
|
-
const promise = props.onAction();
|
|
11482
|
-
yield promise;
|
|
11483
|
-
setLoading(false);
|
|
11484
|
-
} catch (e) {
|
|
11485
|
-
setLoading(false);
|
|
11486
|
-
throw e;
|
|
11487
|
-
}
|
|
11488
|
-
});
|
|
11489
|
-
}
|
|
11490
11493
|
return withNativeProps(props.action, React$1.createElement(Button, {
|
|
11491
11494
|
key: action.key,
|
|
11492
|
-
onClick:
|
|
11495
|
+
onClick: props.onAction,
|
|
11493
11496
|
className: classNames("adm-dialog-button", {
|
|
11494
11497
|
"adm-dialog-button-bold": action.bold
|
|
11495
11498
|
}),
|
|
@@ -11497,7 +11500,7 @@ const DialogActionButton = (props) => {
|
|
|
11497
11500
|
shape: "rectangular",
|
|
11498
11501
|
block: true,
|
|
11499
11502
|
color: action.danger ? "danger" : "primary",
|
|
11500
|
-
loading,
|
|
11503
|
+
loading: "auto",
|
|
11501
11504
|
disabled: action.disabled
|
|
11502
11505
|
}, action.text));
|
|
11503
11506
|
};
|
|
@@ -12770,7 +12773,7 @@ const FloatingPanel = forwardRef((p, ref) => {
|
|
|
12770
12773
|
tension: 300
|
|
12771
12774
|
},
|
|
12772
12775
|
onChange: (result2) => {
|
|
12773
|
-
onHeightChange(result2.value.y, y2.isAnimating);
|
|
12776
|
+
onHeightChange(-result2.value.y, y2.isAnimating);
|
|
12774
12777
|
}
|
|
12775
12778
|
}));
|
|
12776
12779
|
useDrag((state) => {
|
|
@@ -12864,7 +12867,8 @@ const defaultFormContext = {
|
|
|
12864
12867
|
name: void 0,
|
|
12865
12868
|
hasFeedback: true,
|
|
12866
12869
|
layout: "vertical",
|
|
12867
|
-
requiredMarkStyle: "asterisk"
|
|
12870
|
+
requiredMarkStyle: "asterisk",
|
|
12871
|
+
disabled: false
|
|
12868
12872
|
};
|
|
12869
12873
|
const FormContext = React$1.createContext(defaultFormContext);
|
|
12870
12874
|
const NoStyleItemContext = React$1.createContext(null);
|
|
@@ -12913,8 +12917,9 @@ const Form$1 = forwardRef((p, ref) => {
|
|
|
12913
12917
|
layout,
|
|
12914
12918
|
footer,
|
|
12915
12919
|
mode,
|
|
12920
|
+
disabled,
|
|
12916
12921
|
requiredMarkStyle
|
|
12917
|
-
} = props, formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "requiredMarkStyle"]);
|
|
12922
|
+
} = props, formProps = __rest(props, ["className", "style", "hasFeedback", "children", "layout", "footer", "mode", "disabled", "requiredMarkStyle"]);
|
|
12918
12923
|
const {
|
|
12919
12924
|
locale
|
|
12920
12925
|
} = useConfig();
|
|
@@ -12961,7 +12966,8 @@ const Form$1 = forwardRef((p, ref) => {
|
|
|
12961
12966
|
name: formProps.name,
|
|
12962
12967
|
hasFeedback,
|
|
12963
12968
|
layout,
|
|
12964
|
-
requiredMarkStyle
|
|
12969
|
+
requiredMarkStyle,
|
|
12970
|
+
disabled
|
|
12965
12971
|
}
|
|
12966
12972
|
}, lists), footer && React$1.createElement("div", {
|
|
12967
12973
|
className: `${classPrefix$K}-footer`
|
|
@@ -13113,7 +13119,9 @@ var Context = /* @__PURE__ */ React.createContext({
|
|
|
13113
13119
|
registerField: warningFunc,
|
|
13114
13120
|
useSubscribe: warningFunc,
|
|
13115
13121
|
setInitialValues: warningFunc,
|
|
13122
|
+
destroyForm: warningFunc,
|
|
13116
13123
|
setCallbacks: warningFunc,
|
|
13124
|
+
registerWatch: warningFunc,
|
|
13117
13125
|
getFields: warningFunc,
|
|
13118
13126
|
setValidateMessages: warningFunc,
|
|
13119
13127
|
setPreserve: warningFunc,
|
|
@@ -13388,6 +13396,7 @@ const MemoInput = React$1.memo(({
|
|
|
13388
13396
|
children
|
|
13389
13397
|
}) => children, (prev, next) => prev.value === next.value && prev.update === next.update);
|
|
13390
13398
|
const FormItemLayout = (props) => {
|
|
13399
|
+
var _a;
|
|
13391
13400
|
const {
|
|
13392
13401
|
className,
|
|
13393
13402
|
style,
|
|
@@ -13395,7 +13404,6 @@ const FormItemLayout = (props) => {
|
|
|
13395
13404
|
label,
|
|
13396
13405
|
help,
|
|
13397
13406
|
required,
|
|
13398
|
-
disabled,
|
|
13399
13407
|
children,
|
|
13400
13408
|
htmlFor,
|
|
13401
13409
|
hidden,
|
|
@@ -13408,6 +13416,7 @@ const FormItemLayout = (props) => {
|
|
|
13408
13416
|
} = useConfig();
|
|
13409
13417
|
const hasFeedback = props.hasFeedback !== void 0 ? props.hasFeedback : context.hasFeedback;
|
|
13410
13418
|
const layout = props.layout || context.layout;
|
|
13419
|
+
const disabled = (_a = props.disabled) !== null && _a !== void 0 ? _a : context.disabled;
|
|
13411
13420
|
const requiredMark = (() => {
|
|
13412
13421
|
const {
|
|
13413
13422
|
requiredMarkStyle
|
|
@@ -13456,7 +13465,8 @@ const FormItemLayout = (props) => {
|
|
|
13456
13465
|
extra,
|
|
13457
13466
|
description,
|
|
13458
13467
|
className: classNames(classPrefix$H, className, `${classPrefix$H}-${layout}`, {
|
|
13459
|
-
[`${classPrefix$H}-hidden`]: hidden
|
|
13468
|
+
[`${classPrefix$H}-hidden`]: hidden,
|
|
13469
|
+
[`${classPrefix$H}-has-error`]: props.errors.length
|
|
13460
13470
|
}),
|
|
13461
13471
|
disabled,
|
|
13462
13472
|
onClick: props.onClick,
|
|
@@ -13643,7 +13653,8 @@ var Form = attachPropertiesToComponent(Form$1, {
|
|
|
13643
13653
|
Subscribe: FormSubscribe,
|
|
13644
13654
|
Header,
|
|
13645
13655
|
Array: FormArray,
|
|
13646
|
-
useForm
|
|
13656
|
+
useForm,
|
|
13657
|
+
useWatch
|
|
13647
13658
|
});
|
|
13648
13659
|
var grid = "";
|
|
13649
13660
|
const classPrefix$G = `adm-grid`;
|
|
@@ -14549,7 +14560,8 @@ const InfiniteScroll = (p) => {
|
|
|
14549
14560
|
var input = "";
|
|
14550
14561
|
const classPrefix$v = `adm-input`;
|
|
14551
14562
|
const defaultProps$r = {
|
|
14552
|
-
defaultValue: ""
|
|
14563
|
+
defaultValue: "",
|
|
14564
|
+
onlyShowClearWhenFocus: true
|
|
14553
14565
|
};
|
|
14554
14566
|
const Input = forwardRef((p, ref) => {
|
|
14555
14567
|
const props = mergeProps(defaultProps$r, p);
|
|
@@ -14598,6 +14610,15 @@ const Input = forwardRef((p, ref) => {
|
|
|
14598
14610
|
setValue(nextValue);
|
|
14599
14611
|
}
|
|
14600
14612
|
}
|
|
14613
|
+
const shouldShowClear = (() => {
|
|
14614
|
+
if (!props.clearable || !value || props.readOnly)
|
|
14615
|
+
return false;
|
|
14616
|
+
if (props.onlyShowClearWhenFocus) {
|
|
14617
|
+
return hasFocus;
|
|
14618
|
+
} else {
|
|
14619
|
+
return true;
|
|
14620
|
+
}
|
|
14621
|
+
})();
|
|
14601
14622
|
return withNativeProps(props, React$1.createElement("div", {
|
|
14602
14623
|
className: classNames(`${classPrefix$v}`, props.disabled && `${classPrefix$v}-disabled`)
|
|
14603
14624
|
}, React$1.createElement("input", {
|
|
@@ -14638,7 +14659,7 @@ const Input = forwardRef((p, ref) => {
|
|
|
14638
14659
|
onCompositionStart: props.onCompositionStart,
|
|
14639
14660
|
onCompositionEnd: props.onCompositionEnd,
|
|
14640
14661
|
onClick: props.onClick
|
|
14641
|
-
}),
|
|
14662
|
+
}), shouldShowClear && React$1.createElement("div", {
|
|
14642
14663
|
className: `${classPrefix$v}-clear`,
|
|
14643
14664
|
onMouseDown: (e) => {
|
|
14644
14665
|
e.preventDefault();
|
|
@@ -14751,23 +14772,9 @@ const ModalActionButton = (props) => {
|
|
|
14751
14772
|
const {
|
|
14752
14773
|
action
|
|
14753
14774
|
} = props;
|
|
14754
|
-
const [loading, setLoading] = useState(false);
|
|
14755
|
-
function handleClick() {
|
|
14756
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14757
|
-
setLoading(true);
|
|
14758
|
-
try {
|
|
14759
|
-
const promise = props.onAction();
|
|
14760
|
-
yield promise;
|
|
14761
|
-
setLoading(false);
|
|
14762
|
-
} catch (e) {
|
|
14763
|
-
setLoading(false);
|
|
14764
|
-
throw e;
|
|
14765
|
-
}
|
|
14766
|
-
});
|
|
14767
|
-
}
|
|
14768
14775
|
return withNativeProps(props.action, React$1.createElement(Button, {
|
|
14769
14776
|
key: action.key,
|
|
14770
|
-
onClick:
|
|
14777
|
+
onClick: props.onAction,
|
|
14771
14778
|
className: classNames("adm-modal-button", {
|
|
14772
14779
|
"adm-modal-button-primary": props.action.primary
|
|
14773
14780
|
}),
|
|
@@ -14775,7 +14782,7 @@ const ModalActionButton = (props) => {
|
|
|
14775
14782
|
size: props.action.primary ? "large" : "middle",
|
|
14776
14783
|
block: true,
|
|
14777
14784
|
color: action.danger ? "danger" : "primary",
|
|
14778
|
-
loading,
|
|
14785
|
+
loading: "auto",
|
|
14779
14786
|
disabled: action.disabled
|
|
14780
14787
|
}, action.text));
|
|
14781
14788
|
};
|
|
@@ -15752,6 +15759,7 @@ var searchBar = "";
|
|
|
15752
15759
|
const classPrefix$i = `adm-search-bar`;
|
|
15753
15760
|
const defaultProps$f = {
|
|
15754
15761
|
clearable: true,
|
|
15762
|
+
onlyShowClearWhenFocus: false,
|
|
15755
15763
|
showCancelButton: false,
|
|
15756
15764
|
defaultValue: "",
|
|
15757
15765
|
clearOnCancel: true,
|
|
@@ -15831,6 +15839,7 @@ const SearchBar = forwardRef((p, ref) => {
|
|
|
15831
15839
|
maxLength: props.maxLength,
|
|
15832
15840
|
placeholder: props.placeholder,
|
|
15833
15841
|
clearable: props.clearable,
|
|
15842
|
+
onlyShowClearWhenFocus: props.onlyShowClearWhenFocus,
|
|
15834
15843
|
onFocus: (e) => {
|
|
15835
15844
|
var _a;
|
|
15836
15845
|
setHasFocus(true);
|
package/bundle/style.css
CHANGED
|
@@ -398,10 +398,10 @@ div.adm-px-tester {
|
|
|
398
398
|
.adm-calendar-cell.adm-calendar-cell-today {
|
|
399
399
|
color: var(--adm-color-primary);
|
|
400
400
|
}
|
|
401
|
-
.adm-calendar-cell.adm-calendar-cell-
|
|
401
|
+
.adm-calendar-cell.adm-calendar-cell-disabled {
|
|
402
402
|
color: var(--adm-color-light);
|
|
403
403
|
}
|
|
404
|
-
.adm-calendar-cell.adm-calendar-cell-
|
|
404
|
+
.adm-calendar-cell.adm-calendar-cell-disabled .adm-calendar-cell-bottom {
|
|
405
405
|
color: var(--adm-color-light);
|
|
406
406
|
}
|
|
407
407
|
.adm-calendar-cell.adm-calendar-cell-selected.adm-calendar-cell.adm-calendar-cell-selected {
|
|
@@ -1535,7 +1535,7 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1535
1535
|
flex: auto;
|
|
1536
1536
|
}
|
|
1537
1537
|
.adm-form-item-child-position-right {
|
|
1538
|
-
justify-content:
|
|
1538
|
+
justify-content: flex-end;
|
|
1539
1539
|
}
|
|
1540
1540
|
.adm-form-item-child-position-right > * {
|
|
1541
1541
|
flex: none;
|
|
@@ -1553,7 +1553,7 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
.adm-form-item.adm-form-item-horizontal.adm-list-item {
|
|
1555
1555
|
--align-items: stretch;
|
|
1556
|
-
--prefix-width:
|
|
1556
|
+
--prefix-width: 6.8em;
|
|
1557
1557
|
}
|
|
1558
1558
|
.adm-form-item.adm-form-item-horizontal .adm-list-item-content-prefix {
|
|
1559
1559
|
padding-top: 12px;
|
|
@@ -2085,6 +2085,9 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
|
|
|
2085
2085
|
.adm-input-element::-webkit-search-decoration {
|
|
2086
2086
|
display: none;
|
|
2087
2087
|
}
|
|
2088
|
+
.adm-input-element:disabled {
|
|
2089
|
+
opacity: 1;
|
|
2090
|
+
}
|
|
2088
2091
|
.adm-input-element[type='date'],
|
|
2089
2092
|
.adm-input-element[type='time'],
|
|
2090
2093
|
.adm-input-element[type='datetime-local'] {
|
|
@@ -5,10 +5,11 @@ export declare type ButtonProps = {
|
|
|
5
5
|
fill?: 'solid' | 'outline' | 'none';
|
|
6
6
|
size?: 'mini' | 'small' | 'middle' | 'large';
|
|
7
7
|
block?: boolean;
|
|
8
|
-
loading?: boolean;
|
|
8
|
+
loading?: boolean | 'auto';
|
|
9
9
|
loadingText?: string;
|
|
10
|
+
loadingIcon?: React.ReactNode;
|
|
10
11
|
disabled?: boolean;
|
|
11
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void
|
|
12
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>;
|
|
12
13
|
type?: 'submit' | 'reset' | 'button';
|
|
13
14
|
shape?: 'default' | 'rounded' | 'rectangular';
|
|
14
15
|
children?: React.ReactNode;
|
|
@@ -21,10 +22,11 @@ export declare const Button: React.ForwardRefExoticComponent<{
|
|
|
21
22
|
fill?: "none" | "solid" | "outline" | undefined;
|
|
22
23
|
size?: "small" | "large" | "middle" | "mini" | undefined;
|
|
23
24
|
block?: boolean | undefined;
|
|
24
|
-
loading?: boolean | undefined;
|
|
25
|
+
loading?: boolean | "auto" | undefined;
|
|
25
26
|
loadingText?: string | undefined;
|
|
27
|
+
loadingIcon?: React.ReactNode;
|
|
26
28
|
disabled?: boolean | undefined;
|
|
27
|
-
onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void) | undefined;
|
|
29
|
+
onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
|
|
28
30
|
type?: "reset" | "submit" | "button" | undefined;
|
|
29
31
|
shape?: "default" | "rounded" | "rectangular" | undefined;
|
|
30
32
|
children?: React.ReactNode;
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Button = void 0;
|
|
7
7
|
|
|
8
|
+
var _tslib = require("tslib");
|
|
9
|
+
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
11
|
|
|
10
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -15,6 +17,8 @@ var _withDefaultProps = require("../../utils/with-default-props");
|
|
|
15
17
|
|
|
16
18
|
var _nativeProps = require("../../utils/native-props");
|
|
17
19
|
|
|
20
|
+
var _validate = require("../../utils/validate");
|
|
21
|
+
|
|
18
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
23
|
|
|
20
24
|
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); }
|
|
@@ -27,24 +31,46 @@ const defaultProps = {
|
|
|
27
31
|
fill: 'solid',
|
|
28
32
|
block: false,
|
|
29
33
|
loading: false,
|
|
34
|
+
loadingIcon: _react.default.createElement(_dotLoading.default, {
|
|
35
|
+
color: 'currentColor'
|
|
36
|
+
}),
|
|
30
37
|
type: 'button',
|
|
31
38
|
shape: 'default',
|
|
32
39
|
size: 'middle'
|
|
33
40
|
};
|
|
34
41
|
const Button = (0, _react.forwardRef)((p, ref) => {
|
|
35
42
|
const props = (0, _withDefaultProps.mergeProps)(defaultProps, p);
|
|
36
|
-
const
|
|
43
|
+
const [innerLoading, setInnerLoading] = (0, _react.useState)(false);
|
|
37
44
|
const nativeButtonRef = (0, _react.useRef)(null);
|
|
45
|
+
const loading = props.loading === 'auto' ? innerLoading : props.loading;
|
|
46
|
+
const disabled = props.disabled || loading;
|
|
38
47
|
(0, _react.useImperativeHandle)(ref, () => ({
|
|
39
48
|
get nativeElement() {
|
|
40
49
|
return nativeButtonRef.current;
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
}));
|
|
53
|
+
|
|
54
|
+
const handleClick = e => (0, _tslib.__awaiter)(void 0, void 0, void 0, function* () {
|
|
55
|
+
if (!props.onClick) return;
|
|
56
|
+
const promise = props.onClick(e);
|
|
57
|
+
|
|
58
|
+
if ((0, _validate.isPromise)(promise)) {
|
|
59
|
+
try {
|
|
60
|
+
setInnerLoading(true);
|
|
61
|
+
yield promise;
|
|
62
|
+
setInnerLoading(false);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
setInnerLoading(false);
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
44
70
|
return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("button", {
|
|
45
71
|
ref: nativeButtonRef,
|
|
46
72
|
type: props.type,
|
|
47
|
-
onClick:
|
|
73
|
+
onClick: handleClick,
|
|
48
74
|
className: (0, _classnames.default)(classPrefix, props.color ? `${classPrefix}-${props.color}` : null, {
|
|
49
75
|
[`${classPrefix}-block`]: props.block,
|
|
50
76
|
[`${classPrefix}-disabled`]: disabled,
|
|
@@ -53,13 +79,11 @@ const Button = (0, _react.forwardRef)((p, ref) => {
|
|
|
53
79
|
[`${classPrefix}-mini`]: props.size === 'mini',
|
|
54
80
|
[`${classPrefix}-small`]: props.size === 'small',
|
|
55
81
|
[`${classPrefix}-large`]: props.size === 'large',
|
|
56
|
-
[`${classPrefix}-loading`]:
|
|
82
|
+
[`${classPrefix}-loading`]: loading
|
|
57
83
|
}, `${classPrefix}-shape-${props.shape}`),
|
|
58
84
|
disabled: disabled
|
|
59
|
-
},
|
|
85
|
+
}, loading ? _react.default.createElement("div", {
|
|
60
86
|
className: `${classPrefix}-loading-wrapper`
|
|
61
|
-
},
|
|
62
|
-
color: 'currentColor'
|
|
63
|
-
}), props.loadingText) : props.children));
|
|
87
|
+
}, props.loadingIcon, props.loadingText) : props.children));
|
|
64
88
|
});
|
|
65
89
|
exports.Button = Button;
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
.adm-calendar-cell.adm-calendar-cell-today {
|
|
51
51
|
color: var(--adm-color-primary);
|
|
52
52
|
}
|
|
53
|
-
.adm-calendar-cell.adm-calendar-cell-
|
|
53
|
+
.adm-calendar-cell.adm-calendar-cell-disabled {
|
|
54
54
|
color: var(--adm-color-light);
|
|
55
55
|
}
|
|
56
|
-
.adm-calendar-cell.adm-calendar-cell-
|
|
56
|
+
.adm-calendar-cell.adm-calendar-cell-disabled .adm-calendar-cell-bottom {
|
|
57
57
|
color: var(--adm-color-light);
|
|
58
58
|
}
|
|
59
59
|
.adm-calendar-cell.adm-calendar-cell-selected.adm-calendar-cell.adm-calendar-cell-selected {
|
|
@@ -122,6 +122,9 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
|
|
|
122
122
|
}
|
|
123
123
|
}, _react.default.createElement(_arrowLeftDouble.ArrowLeftDouble, null)));
|
|
124
124
|
|
|
125
|
+
const maxDay = (0, _react.useMemo)(() => props.max && (0, _dayjs.default)(props.max), [props.max]);
|
|
126
|
+
const minDay = (0, _react.useMemo)(() => props.min && (0, _dayjs.default)(props.min), [props.min]);
|
|
127
|
+
|
|
125
128
|
function renderCells() {
|
|
126
129
|
var _a;
|
|
127
130
|
|
|
@@ -146,9 +149,10 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
|
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
const inThisMonth = d.month() === current.month();
|
|
152
|
+
const disabled = !inThisMonth || maxDay && d.isAfter(maxDay, 'day') || minDay && d.isBefore(minDay, 'day');
|
|
149
153
|
cells.push(_react.default.createElement("div", {
|
|
150
154
|
key: d.valueOf(),
|
|
151
|
-
className: (0, _classnames.default)(`${classPrefix}-cell`,
|
|
155
|
+
className: (0, _classnames.default)(`${classPrefix}-cell`, disabled && `${classPrefix}-cell-disabled`, inThisMonth && {
|
|
152
156
|
[`${classPrefix}-cell-today`]: d.isSame(today, 'day'),
|
|
153
157
|
[`${classPrefix}-cell-selected`]: isSelect,
|
|
154
158
|
[`${classPrefix}-cell-selected-begin`]: isBegin,
|
|
@@ -156,6 +160,7 @@ const Calendar = (0, _react.forwardRef)((p, ref) => {
|
|
|
156
160
|
}),
|
|
157
161
|
onClick: () => {
|
|
158
162
|
if (!props.selectionMode) return;
|
|
163
|
+
if (disabled) return;
|
|
159
164
|
const date = d.toDate();
|
|
160
165
|
|
|
161
166
|
if (!inThisMonth) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { PickerColumn } from '../picker-view';
|
|
1
|
+
import { PickerColumn, PickerValue } from '../picker-view';
|
|
2
2
|
import { CascadePickerOption } from './cascade-picker';
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function useColumnsFn(options: CascadePickerOption[]): (selected: PickerValue[]) => PickerColumn[];
|