antd-mobile 5.25.0 → 5.26.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.
Files changed (100) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +188 -121
  2. package/2x/bundle/antd-mobile.cjs.js +8 -8
  3. package/2x/bundle/antd-mobile.es.development.js +188 -121
  4. package/2x/bundle/antd-mobile.es.js +3936 -3910
  5. package/2x/bundle/antd-mobile.umd.development.js +188 -121
  6. package/2x/bundle/antd-mobile.umd.js +8 -8
  7. package/2x/bundle/css-vars-patch.css +399 -0
  8. package/2x/bundle/style.css +29 -5
  9. package/2x/cjs/components/calendar/calendar.js +9 -1
  10. package/2x/cjs/components/floating-bubble/floating-bubble.d.ts +8 -0
  11. package/2x/cjs/components/floating-bubble/floating-bubble.js +25 -5
  12. package/2x/cjs/components/form/form.d.ts +1 -1
  13. package/2x/cjs/components/image-uploader/image-uploader.css +16 -1
  14. package/2x/cjs/components/image-uploader/image-uploader.d.ts +4 -1
  15. package/2x/cjs/components/image-uploader/image-uploader.js +46 -9
  16. package/2x/cjs/components/image-uploader/preview-item.d.ts +2 -1
  17. package/2x/cjs/components/image-uploader/preview-item.js +5 -7
  18. package/2x/cjs/components/mask/mask.d.ts +1 -1
  19. package/2x/cjs/components/mask/mask.js +6 -2
  20. package/2x/cjs/components/notice-bar/notice-bar.css +13 -4
  21. package/2x/cjs/components/notice-bar/notice-bar.d.ts +10 -8
  22. package/2x/cjs/components/notice-bar/notice-bar.js +5 -2
  23. package/2x/cjs/components/stepper/stepper.d.ts +2 -0
  24. package/2x/cjs/components/stepper/stepper.js +55 -32
  25. package/2x/cjs/components/water-mark/water-mark.d.ts +1 -1
  26. package/2x/cjs/components/water-mark/water-mark.js +5 -1
  27. package/2x/es/components/calendar/calendar.js +9 -1
  28. package/2x/es/components/floating-bubble/floating-bubble.d.ts +8 -0
  29. package/2x/es/components/floating-bubble/floating-bubble.js +26 -6
  30. package/2x/es/components/form/form.d.ts +1 -1
  31. package/2x/es/components/image-uploader/image-uploader.css +16 -1
  32. package/2x/es/components/image-uploader/image-uploader.d.ts +4 -1
  33. package/2x/es/components/image-uploader/image-uploader.js +48 -11
  34. package/2x/es/components/image-uploader/preview-item.d.ts +2 -1
  35. package/2x/es/components/image-uploader/preview-item.js +6 -8
  36. package/2x/es/components/mask/mask.d.ts +1 -1
  37. package/2x/es/components/mask/mask.js +6 -2
  38. package/2x/es/components/notice-bar/notice-bar.css +13 -4
  39. package/2x/es/components/notice-bar/notice-bar.d.ts +10 -8
  40. package/2x/es/components/notice-bar/notice-bar.js +5 -2
  41. package/2x/es/components/stepper/stepper.d.ts +2 -0
  42. package/2x/es/components/stepper/stepper.js +55 -32
  43. package/2x/es/components/water-mark/water-mark.d.ts +1 -1
  44. package/2x/es/components/water-mark/water-mark.js +5 -1
  45. package/2x/package.json +9 -9
  46. package/bundle/antd-mobile.cjs.development.js +188 -121
  47. package/bundle/antd-mobile.cjs.js +8 -8
  48. package/bundle/antd-mobile.compatible.umd.js +1 -1
  49. package/bundle/antd-mobile.es.development.js +188 -121
  50. package/bundle/antd-mobile.es.js +3936 -3910
  51. package/bundle/antd-mobile.umd.development.js +188 -121
  52. package/bundle/antd-mobile.umd.js +8 -8
  53. package/bundle/css-vars-patch.css +312 -0
  54. package/bundle/style.css +1 -1
  55. package/cjs/components/calendar/calendar.js +9 -1
  56. package/cjs/components/floating-bubble/floating-bubble.d.ts +8 -0
  57. package/cjs/components/floating-bubble/floating-bubble.js +25 -5
  58. package/cjs/components/form/form.d.ts +1 -1
  59. package/cjs/components/image-uploader/image-uploader.css +15 -1
  60. package/cjs/components/image-uploader/image-uploader.d.ts +4 -1
  61. package/cjs/components/image-uploader/image-uploader.js +46 -9
  62. package/cjs/components/image-uploader/preview-item.d.ts +2 -1
  63. package/cjs/components/image-uploader/preview-item.js +5 -7
  64. package/cjs/components/mask/mask.d.ts +1 -1
  65. package/cjs/components/mask/mask.js +6 -2
  66. package/cjs/components/notice-bar/notice-bar.css +11 -4
  67. package/cjs/components/notice-bar/notice-bar.d.ts +10 -8
  68. package/cjs/components/notice-bar/notice-bar.js +5 -2
  69. package/cjs/components/stepper/stepper.d.ts +2 -0
  70. package/cjs/components/stepper/stepper.js +55 -32
  71. package/cjs/components/water-mark/water-mark.d.ts +1 -1
  72. package/cjs/components/water-mark/water-mark.js +5 -1
  73. package/es/components/calendar/calendar.js +9 -1
  74. package/es/components/floating-bubble/floating-bubble.d.ts +8 -0
  75. package/es/components/floating-bubble/floating-bubble.js +26 -6
  76. package/es/components/form/form.d.ts +1 -1
  77. package/es/components/image-uploader/image-uploader.css +15 -1
  78. package/es/components/image-uploader/image-uploader.d.ts +4 -1
  79. package/es/components/image-uploader/image-uploader.js +48 -11
  80. package/es/components/image-uploader/preview-item.d.ts +2 -1
  81. package/es/components/image-uploader/preview-item.js +6 -8
  82. package/es/components/mask/mask.d.ts +1 -1
  83. package/es/components/mask/mask.js +6 -2
  84. package/es/components/notice-bar/notice-bar.css +11 -4
  85. package/es/components/notice-bar/notice-bar.d.ts +10 -8
  86. package/es/components/notice-bar/notice-bar.js +5 -2
  87. package/es/components/stepper/stepper.d.ts +2 -0
  88. package/es/components/stepper/stepper.js +55 -32
  89. package/es/components/water-mark/water-mark.d.ts +1 -1
  90. package/es/components/water-mark/water-mark.js +5 -1
  91. package/package.json +9 -9
  92. package/umd/antd-mobile.js +1 -1
  93. package/2x/cjs/components/image/test/image.test.d.ts +0 -1
  94. package/2x/cjs/components/image/test/image.test.js +0 -73
  95. package/2x/es/components/image/test/image.test.d.ts +0 -1
  96. package/2x/es/components/image/test/image.test.js +0 -70
  97. package/cjs/components/image/test/image.test.d.ts +0 -1
  98. package/cjs/components/image/test/image.test.js +0 -73
  99. package/es/components/image/test/image.test.d.ts +0 -1
  100. package/es/components/image/test/image.test.js +0 -70
@@ -7011,6 +7011,10 @@ const opacityRecord = {
7011
7011
  thin: 0.35,
7012
7012
  thick: 0.75
7013
7013
  };
7014
+ const colorRecord$4 = {
7015
+ black: "0, 0, 0",
7016
+ white: "255, 255, 255"
7017
+ };
7014
7018
  const defaultProps$13 = {
7015
7019
  visible: true,
7016
7020
  destroyOnClose: false,
@@ -7031,8 +7035,8 @@ const Mask$1 = (p) => {
7031
7035
  const background = useMemo(() => {
7032
7036
  var _a;
7033
7037
  const opacity2 = (_a = opacityRecord[props.opacity]) !== null && _a !== void 0 ? _a : props.opacity;
7034
- const rgb2 = props.color === "white" ? "255, 255, 255" : "0, 0, 0";
7035
- return `rgba(${rgb2}, ${opacity2})`;
7038
+ const rgb2 = colorRecord$4[props.color];
7039
+ return rgb2 ? `rgba(${rgb2}, ${opacity2})` : props.color;
7036
7040
  }, [props.color, props.opacity]);
7037
7041
  const [active, setActive] = useState(props.visible);
7038
7042
  const unmountedRef = useUnmountedRef$1();
@@ -8597,11 +8601,17 @@ const Calendar$1 = forwardRef((p, ref) => {
8597
8601
  let isSelect = false;
8598
8602
  let isBegin = false;
8599
8603
  let isEnd = false;
8604
+ let isSelectRowBegin = false;
8605
+ let isSelectRowEnd = false;
8600
8606
  if (dateRange) {
8601
8607
  const [begin, end] = dateRange;
8602
8608
  isBegin = d.isSame(begin, "day");
8603
8609
  isEnd = d.isSame(end, "day");
8604
8610
  isSelect = isBegin || isEnd || d.isAfter(begin, "day") && d.isBefore(end, "day");
8611
+ if (isSelect) {
8612
+ isSelectRowBegin = (cells.length % 7 === 0 || d.isSame(d.startOf("month"), "day")) && !isBegin;
8613
+ isSelectRowEnd = (cells.length % 7 === 6 || d.isSame(d.endOf("month"), "day")) && !isEnd;
8614
+ }
8605
8615
  }
8606
8616
  const inThisMonth = d.month() === current.month();
8607
8617
  const disabled = props.shouldDisableDate ? props.shouldDisableDate(d.toDate()) : maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
@@ -8611,7 +8621,9 @@ const Calendar$1 = forwardRef((p, ref) => {
8611
8621
  [`${classPrefix$1b}-cell-today`]: d.isSame(today, "day"),
8612
8622
  [`${classPrefix$1b}-cell-selected`]: isSelect,
8613
8623
  [`${classPrefix$1b}-cell-selected-begin`]: isBegin,
8614
- [`${classPrefix$1b}-cell-selected-end`]: isEnd
8624
+ [`${classPrefix$1b}-cell-selected-end`]: isEnd,
8625
+ [`${classPrefix$1b}-cell-selected-row-begin`]: isSelectRowBegin,
8626
+ [`${classPrefix$1b}-cell-selected-row-end`]: isSelectRowEnd
8615
8627
  }),
8616
8628
  onClick: () => {
8617
8629
  if (!props.selectionMode)
@@ -14508,22 +14520,36 @@ const ErrorBlock = ErrorBlock$1;
14508
14520
  const floatingBubble = "";
14509
14521
  const classPrefix$P = `adm-floating-bubble`;
14510
14522
  const defaultProps$E = {
14511
- axis: "y"
14523
+ axis: "y",
14524
+ defaultOffset: {
14525
+ x: 0,
14526
+ y: 0
14527
+ }
14512
14528
  };
14513
14529
  const FloatingBubble$1 = (p) => {
14514
14530
  const props = mergeProps(defaultProps$E, p);
14515
14531
  const boundaryRef = useRef(null);
14516
14532
  const buttonRef = useRef(null);
14533
+ const [innerValue, setInnerValue] = useState(props.offset === void 0 ? props.defaultOffset : props.offset);
14534
+ useEffect(() => {
14535
+ if (props.offset === void 0)
14536
+ return;
14537
+ api.start({
14538
+ x: props.offset.x,
14539
+ y: props.offset.y
14540
+ });
14541
+ }, [props.offset]);
14517
14542
  const [{
14518
14543
  x,
14519
14544
  y,
14520
14545
  opacity
14521
14546
  }, api] = useSpring(() => ({
14522
- x: 0,
14523
- y: 0,
14547
+ x: innerValue.x,
14548
+ y: innerValue.y,
14524
14549
  opacity: 1
14525
14550
  }));
14526
14551
  const bind = useDrag((state) => {
14552
+ var _a;
14527
14553
  let nextX = state.offset[0];
14528
14554
  let nextY = state.offset[1];
14529
14555
  if (state.last && props.magnetic) {
@@ -14553,10 +14579,16 @@ const FloatingBubble$1 = (p) => {
14553
14579
  }
14554
14580
  }
14555
14581
  }
14556
- api.start({
14582
+ const nextOffest = {
14557
14583
  x: nextX,
14558
14584
  y: nextY
14559
- });
14585
+ };
14586
+ if (props.offset === void 0) {
14587
+ api.start(nextOffest);
14588
+ } else {
14589
+ setInnerValue(nextOffest);
14590
+ }
14591
+ (_a = props.onOffsetChange) === null || _a === void 0 ? void 0 : _a.call(props, nextOffest);
14560
14592
  api.start({
14561
14593
  opacity: state.active ? 0.8 : 1
14562
14594
  });
@@ -19205,18 +19237,22 @@ const computePosition$1 = async (reference, floating, config2) => {
19205
19237
  middleware = [],
19206
19238
  platform: platform2
19207
19239
  } = config2;
19240
+ const validMiddleware = middleware.filter(Boolean);
19208
19241
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
19209
19242
  {
19210
19243
  if (platform2 == null) {
19211
19244
  console.error(["Floating UI: `platform` property was not passed to config. If you", "want to use Floating UI on the web, install @floating-ui/dom", "instead of the /core package. Otherwise, you can create your own", "`platform`: https://floating-ui.com/docs/platform"].join(" "));
19212
19245
  }
19213
- if (middleware.filter((_ref) => {
19246
+ if (validMiddleware.filter((_ref) => {
19214
19247
  let {
19215
19248
  name
19216
19249
  } = _ref;
19217
19250
  return name === "autoPlacement" || name === "flip";
19218
19251
  }).length > 1) {
19219
- throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement`", "middleware detected. This will lead to an infinite loop. Ensure only", "one of either has been passed to the `middleware` array."].join(" "));
19252
+ throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware", "detected. This will lead to an infinite loop. Ensure only one of", "either has been passed to the `middleware` array."].join(" "));
19253
+ }
19254
+ if (!reference || !floating) {
19255
+ console.error(["Floating UI: The reference and/or floating element was not defined", "when `computePosition()` was called. Ensure that both elements have", "been created and can be measured."].join(" "));
19220
19256
  }
19221
19257
  }
19222
19258
  let rects = await platform2.getElementRects({
@@ -19231,11 +19267,11 @@ const computePosition$1 = async (reference, floating, config2) => {
19231
19267
  let statefulPlacement = placement;
19232
19268
  let middlewareData = {};
19233
19269
  let resetCount = 0;
19234
- for (let i = 0; i < middleware.length; i++) {
19270
+ for (let i = 0; i < validMiddleware.length; i++) {
19235
19271
  const {
19236
19272
  name,
19237
19273
  fn
19238
- } = middleware[i];
19274
+ } = validMiddleware[i];
19239
19275
  const {
19240
19276
  x: nextX,
19241
19277
  y: nextY,
@@ -19827,7 +19863,7 @@ function getNodeName(node) {
19827
19863
  }
19828
19864
  function getUAString() {
19829
19865
  const uaData = navigator.userAgentData;
19830
- if (uaData != null && uaData.brands) {
19866
+ if (uaData && Array.isArray(uaData.brands)) {
19831
19867
  return uaData.brands.map((item) => item.brand + "/" + item.version).join(" ");
19832
19868
  }
19833
19869
  return navigator.userAgent;
@@ -19863,7 +19899,8 @@ function isTableElement(element) {
19863
19899
  function isContainingBlock(element) {
19864
19900
  const isFirefox = /firefox/i.test(getUAString());
19865
19901
  const css = getComputedStyle(element);
19866
- return css.transform !== "none" || css.perspective !== "none" || isFirefox && css.willChange === "filter" || isFirefox && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective"].some((value) => css.willChange.includes(value)) || ["paint", "layout", "strict", "content"].some(
19902
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
19903
+ return css.transform !== "none" || css.perspective !== "none" || (backdropFilter ? backdropFilter !== "none" : false) || isFirefox && css.willChange === "filter" || isFirefox && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective"].some((value) => css.willChange.includes(value)) || ["paint", "layout", "strict", "content"].some(
19867
19904
  (value) => {
19868
19905
  const contain = css.contain;
19869
19906
  return contain != null ? contain.includes(value) : false;
@@ -19972,7 +20009,8 @@ function getParentNode(node) {
19972
20009
  if (getNodeName(node) === "html") {
19973
20010
  return node;
19974
20011
  }
19975
- return node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
20012
+ const result2 = node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
20013
+ return isShadowRoot(result2) ? result2.host : result2;
19976
20014
  }
19977
20015
  function getTrueOffsetParent(element) {
19978
20016
  if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
@@ -19982,15 +20020,11 @@ function getTrueOffsetParent(element) {
19982
20020
  }
19983
20021
  function getContainingBlock(element) {
19984
20022
  let currentNode = getParentNode(element);
19985
- if (isShadowRoot(currentNode)) {
19986
- currentNode = currentNode.host;
19987
- }
19988
20023
  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
19989
20024
  if (isContainingBlock(currentNode)) {
19990
20025
  return currentNode;
19991
20026
  } else {
19992
- const parent = currentNode.parentNode;
19993
- currentNode = isShadowRoot(parent) ? parent.host : parent;
20027
+ currentNode = getParentNode(currentNode);
19994
20028
  }
19995
20029
  }
19996
20030
  return null;
@@ -20119,32 +20153,6 @@ function getOverflowAncestors(node, list2) {
20119
20153
  const updatedList = list2.concat(target);
20120
20154
  return isBody ? updatedList : updatedList.concat(getOverflowAncestors(target));
20121
20155
  }
20122
- function contains(parent, child) {
20123
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
20124
- if (parent.contains(child)) {
20125
- return true;
20126
- } else if (rootNode && isShadowRoot(rootNode)) {
20127
- let next = child;
20128
- do {
20129
- if (next && parent === next) {
20130
- return true;
20131
- }
20132
- next = next.parentNode || next.host;
20133
- } while (next);
20134
- }
20135
- return false;
20136
- }
20137
- function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) {
20138
- let currentNode = element;
20139
- while (currentNode && !isLastTraversableNode(currentNode) && !clippingAncestors.includes(currentNode)) {
20140
- if (isElement(currentNode) && ["absolute", "fixed"].includes(getComputedStyle(currentNode).position)) {
20141
- break;
20142
- }
20143
- const parentNode = getParentNode(currentNode);
20144
- currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode;
20145
- }
20146
- return currentNode;
20147
- }
20148
20156
  function getInnerBoundingClientRect(element, strategy) {
20149
20157
  const clientRect = getBoundingClientRect(element, false, strategy === "fixed");
20150
20158
  const top = clientRect.top + element.clientTop;
@@ -20160,31 +20168,32 @@ function getInnerBoundingClientRect(element, strategy) {
20160
20168
  height: element.clientHeight
20161
20169
  };
20162
20170
  }
20163
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
20164
- if (clippingParent === "viewport") {
20171
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
20172
+ if (clippingAncestor === "viewport") {
20165
20173
  return rectToClientRect(getViewportRect(element, strategy));
20166
20174
  }
20167
- if (isElement(clippingParent)) {
20168
- return getInnerBoundingClientRect(clippingParent, strategy);
20175
+ if (isElement(clippingAncestor)) {
20176
+ return getInnerBoundingClientRect(clippingAncestor, strategy);
20169
20177
  }
20170
20178
  return rectToClientRect(getDocumentRect(getDocumentElement(element)));
20171
20179
  }
20172
- function getClippingAncestors(element) {
20173
- const clippingAncestors = getOverflowAncestors(element);
20174
- const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors);
20175
- let clipperElement = null;
20176
- if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) {
20177
- const offsetParent = getOffsetParent(nearestEscapableParent);
20178
- if (isOverflowElement(nearestEscapableParent)) {
20179
- clipperElement = nearestEscapableParent;
20180
- } else if (isHTMLElement(offsetParent)) {
20181
- clipperElement = offsetParent;
20180
+ function getClippingElementAncestors(element) {
20181
+ let result2 = getOverflowAncestors(element).filter((el) => isElement(el) && getNodeName(el) !== "body");
20182
+ let currentContainingBlockComputedStyle = null;
20183
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
20184
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
20185
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
20186
+ const computedStyle = getComputedStyle(currentNode);
20187
+ const containingBlock = isContainingBlock(currentNode);
20188
+ const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position);
20189
+ if (shouldDropCurrentNode) {
20190
+ result2 = result2.filter((ancestor) => ancestor !== currentNode);
20191
+ } else {
20192
+ currentContainingBlockComputedStyle = computedStyle;
20182
20193
  }
20194
+ currentNode = getParentNode(currentNode);
20183
20195
  }
20184
- if (!isElement(clipperElement)) {
20185
- return [];
20186
- }
20187
- return clippingAncestors.filter((clippingAncestors2) => clipperElement && isElement(clippingAncestors2) && contains(clippingAncestors2, clipperElement) && getNodeName(clippingAncestors2) !== "body");
20196
+ return result2;
20188
20197
  }
20189
20198
  function getClippingRect(_ref) {
20190
20199
  let {
@@ -20193,8 +20202,8 @@ function getClippingRect(_ref) {
20193
20202
  rootBoundary,
20194
20203
  strategy
20195
20204
  } = _ref;
20196
- const mainClippingAncestors = boundary === "clippingAncestors" ? getClippingAncestors(element) : [].concat(boundary);
20197
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
20205
+ const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element) : [].concat(boundary);
20206
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
20198
20207
  const firstClippingAncestor = clippingAncestors[0];
20199
20208
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
20200
20209
  const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
@@ -20218,18 +20227,20 @@ const platform = {
20218
20227
  getDimensions,
20219
20228
  getOffsetParent,
20220
20229
  getDocumentElement,
20221
- getElementRects: (_ref) => {
20230
+ async getElementRects(_ref) {
20222
20231
  let {
20223
20232
  reference,
20224
20233
  floating,
20225
20234
  strategy
20226
20235
  } = _ref;
20236
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
20237
+ const getDimensionsFn = this.getDimensions;
20227
20238
  return {
20228
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
20239
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
20229
20240
  floating: {
20230
- ...getDimensions(floating),
20231
20241
  x: 0,
20232
- y: 0
20242
+ y: 0,
20243
+ ...await getDimensionsFn(floating)
20233
20244
  }
20234
20245
  };
20235
20246
  },
@@ -21282,6 +21293,7 @@ const PreviewItem = (props) => {
21282
21293
  url: url2,
21283
21294
  file,
21284
21295
  deletable,
21296
+ deleteIcon,
21285
21297
  onDelete,
21286
21298
  imageFit
21287
21299
  } = props;
@@ -21294,11 +21306,12 @@ const PreviewItem = (props) => {
21294
21306
  }
21295
21307
  return "";
21296
21308
  }, [url2, file]);
21297
- useLayoutEffect(() => {
21309
+ useEffect(() => {
21298
21310
  return () => {
21299
- URL.revokeObjectURL(src);
21311
+ if (file)
21312
+ URL.revokeObjectURL(src);
21300
21313
  };
21301
- }, [src]);
21314
+ }, [src, file]);
21302
21315
  function renderLoading() {
21303
21316
  return props.status === "pending" && React__default.createElement("div", {
21304
21317
  className: `${classPrefix$G}-cell-mask`
@@ -21314,9 +21327,7 @@ const PreviewItem = (props) => {
21314
21327
  return deletable && React__default.createElement("span", {
21315
21328
  className: `${classPrefix$G}-cell-delete`,
21316
21329
  onClick: onDelete
21317
- }, React__default.createElement(CloseOutline, {
21318
- className: `${classPrefix$G}-cell-delete-icon`
21319
- }));
21330
+ }, deleteIcon);
21320
21331
  }
21321
21332
  return React__default.createElement("div", {
21322
21333
  className: classNames(`${classPrefix$G}-cell`, props.status === "fail" && `${classPrefix$G}-cell-fail`)
@@ -21359,6 +21370,9 @@ const classPrefix$E = `adm-image-uploader`;
21359
21370
  const defaultProps$y = {
21360
21371
  disableUpload: false,
21361
21372
  deletable: true,
21373
+ deleteIcon: React__default.createElement(CloseOutline, {
21374
+ className: `${classPrefix$E}-cell-delete-icon`
21375
+ }),
21362
21376
  showUpload: true,
21363
21377
  multiple: false,
21364
21378
  maxCount: 0,
@@ -21373,8 +21387,26 @@ const ImageUploader$1 = (p) => {
21373
21387
  locale
21374
21388
  } = useConfig();
21375
21389
  const props = mergeProps(defaultProps$y, p);
21390
+ const {
21391
+ columns
21392
+ } = props;
21376
21393
  const [value, setValue2] = usePropsValue(props);
21377
21394
  const [tasks, setTasks] = useState([]);
21395
+ const containerRef = useRef(null);
21396
+ const containerSize = useSize(containerRef);
21397
+ const gapMeasureRef = useRef(null);
21398
+ const [cellSize, setCellSize] = useState(80);
21399
+ useIsomorphicLayoutEffect$2(() => {
21400
+ const gapMeasure = gapMeasureRef.current;
21401
+ if (columns && containerSize && gapMeasure) {
21402
+ const width = containerSize.width;
21403
+ const gap = measureCSSLength(window.getComputedStyle(gapMeasure).getPropertyValue("height"));
21404
+ setCellSize((width - gap * (columns - 1)) / columns);
21405
+ }
21406
+ }, [containerSize === null || containerSize === void 0 ? void 0 : containerSize.width]);
21407
+ const style = {
21408
+ "--cell-size": cellSize + "px"
21409
+ };
21378
21410
  useIsomorphicLayoutEffect$2(() => {
21379
21411
  setTasks((prev) => prev.filter((task) => {
21380
21412
  if (task.url === void 0)
@@ -21500,6 +21532,7 @@ const ImageUploader$1 = (p) => {
21500
21532
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
21501
21533
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
21502
21534
  deletable: props.deletable,
21535
+ deleteIcon: props.deleteIcon,
21503
21536
  imageFit: props.imageFit,
21504
21537
  onClick: () => {
21505
21538
  if (props.preview) {
@@ -21518,21 +21551,19 @@ const ImageUploader$1 = (p) => {
21518
21551
  return renderItem ? renderItem(originNode, fileItem, value) : originNode;
21519
21552
  });
21520
21553
  };
21521
- return withNativeProps(props, React__default.createElement("div", {
21522
- className: classPrefix$E
21523
- }, React__default.createElement(Space, {
21524
- className: `${classPrefix$E}-space`,
21525
- wrap: true,
21526
- block: true
21527
- }, renderImages(), finalTasks.map((task) => {
21554
+ const contentNode = React__default.createElement(React__default.Fragment, null, renderImages(), tasks.map((task) => {
21555
+ if (!props.showFailed && task.status === "fail") {
21556
+ return null;
21557
+ }
21528
21558
  return React__default.createElement(PreviewItem$1, {
21529
21559
  key: task.id,
21530
21560
  file: task.file,
21531
21561
  deletable: task.status !== "pending",
21562
+ deleteIcon: props.deleteIcon,
21532
21563
  status: task.status,
21533
21564
  imageFit: props.imageFit,
21534
21565
  onDelete: () => {
21535
- setTasks((prev) => prev.filter((x) => x.id !== task.id));
21566
+ setTasks(tasks.filter((x) => x.id !== task.id));
21536
21567
  }
21537
21568
  });
21538
21569
  }), showUpload && React__default.createElement("div", {
@@ -21551,7 +21582,22 @@ const ImageUploader$1 = (p) => {
21551
21582
  className: `${classPrefix$E}-input`,
21552
21583
  onChange,
21553
21584
  "aria-hidden": true
21554
- })))));
21585
+ })));
21586
+ return withNativeProps(props, React__default.createElement("div", {
21587
+ className: classPrefix$E,
21588
+ ref: containerRef
21589
+ }, columns ? React__default.createElement(Grid, {
21590
+ className: `${classPrefix$E}-grid`,
21591
+ columns,
21592
+ style
21593
+ }, React__default.createElement("div", {
21594
+ className: `${classPrefix$E}-gap-measure`,
21595
+ ref: gapMeasureRef
21596
+ }), contentNode.props.children) : React__default.createElement(Space, {
21597
+ className: `${classPrefix$E}-space`,
21598
+ wrap: true,
21599
+ block: true
21600
+ }, contentNode.props.children)));
21555
21601
  };
21556
21602
  const imageUploader = "";
21557
21603
  const ImageUploader = ImageUploader$1;
@@ -22265,6 +22311,7 @@ const defaultProps$r = {
22265
22311
  color: "default",
22266
22312
  delay: 2e3,
22267
22313
  speed: 50,
22314
+ wrap: false,
22268
22315
  icon: React__default.createElement(SoundOutline, null)
22269
22316
  };
22270
22317
  const NoticeBar$1 = memo((p) => {
@@ -22276,7 +22323,7 @@ const NoticeBar$1 = memo((p) => {
22276
22323
  const delayLockRef = useRef(true);
22277
22324
  const animatingRef = useRef(false);
22278
22325
  function start2() {
22279
- if (delayLockRef.current)
22326
+ if (delayLockRef.current || props.wrap)
22280
22327
  return;
22281
22328
  const container = containerRef.current;
22282
22329
  const text = textRef.current;
@@ -22319,7 +22366,9 @@ const NoticeBar$1 = memo((p) => {
22319
22366
  if (!visible)
22320
22367
  return null;
22321
22368
  return withNativeProps(props, React__default.createElement("div", {
22322
- className: classNames(classPrefix$x, `${classPrefix$x}-${props.color}`)
22369
+ className: classNames(classPrefix$x, `${classPrefix$x}-${props.color}`, {
22370
+ [`${classPrefix$x}-wrap`]: props.wrap
22371
+ })
22323
22372
  }, props.icon && React__default.createElement("span", {
22324
22373
  className: `${classPrefix$x}-left`
22325
22374
  }, props.icon), React__default.createElement("span", {
@@ -24344,36 +24393,44 @@ const Stepper$1 = (p) => {
24344
24393
  step,
24345
24394
  max: max2,
24346
24395
  min: min2,
24347
- inputReadOnly
24396
+ inputReadOnly,
24397
+ digits,
24398
+ formatter,
24399
+ parser
24348
24400
  } = props;
24349
24401
  const {
24350
24402
  locale
24351
24403
  } = useConfig();
24404
+ const parseValue = (text) => {
24405
+ if (text === "")
24406
+ return null;
24407
+ return parser ? parser(text) : parseFloat(text);
24408
+ };
24409
+ const formatValue = (value2) => {
24410
+ if (value2 === null)
24411
+ return "";
24412
+ if (formatter) {
24413
+ return formatter(value2);
24414
+ } else if (digits !== void 0) {
24415
+ return value2.toFixed(digits);
24416
+ } else {
24417
+ return value2.toString();
24418
+ }
24419
+ };
24352
24420
  const [value, setValue2] = usePropsValue(props);
24353
- const [inputValue, setInputValue] = useState(() => convertValueToText(value, props.digits));
24421
+ const [inputValue, setInputValue] = useState(() => formatValue(value));
24354
24422
  function setValueWithCheck(v) {
24355
24423
  if (isNaN(v))
24356
24424
  return;
24357
24425
  let target = bound(v, props.min, props.max);
24358
- if (props.digits !== void 0) {
24359
- target = parseFloat(target.toFixed(props.digits));
24426
+ if (digits !== void 0) {
24427
+ target = parseFloat(target.toFixed(digits));
24360
24428
  }
24361
24429
  setValue2(target);
24362
24430
  }
24363
- const [hasFocus, setHasFocus] = useState(false);
24364
- useEffect(() => {
24365
- if (!hasFocus) {
24366
- setInputValue(convertValueToText(value, props.digits));
24367
- }
24368
- }, [hasFocus]);
24369
- useEffect(() => {
24370
- if (!hasFocus) {
24371
- setInputValue(convertValueToText(value, props.digits));
24372
- }
24373
- }, [value, props.digits]);
24374
24431
  const handleInputChange = (v) => {
24375
24432
  setInputValue(v);
24376
- const value2 = convertTextToValue(v);
24433
+ const value2 = parseValue(v);
24377
24434
  if (value2 === null) {
24378
24435
  if (props.allowEmpty) {
24379
24436
  setValue2(null);
@@ -24384,6 +24441,25 @@ const Stepper$1 = (p) => {
24384
24441
  setValueWithCheck(value2);
24385
24442
  }
24386
24443
  };
24444
+ const [focused, setFocused] = useState(false);
24445
+ const inputRef = React__default.useRef(null);
24446
+ function triggerFocus(nextFocus) {
24447
+ setFocused(nextFocus);
24448
+ if (nextFocus) {
24449
+ setInputValue(typeof value === "number" ? String(value) : "");
24450
+ }
24451
+ }
24452
+ useEffect(() => {
24453
+ var _a, _b, _c;
24454
+ if (focused) {
24455
+ (_c = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.nativeElement) === null || _b === void 0 ? void 0 : _b.select) === null || _c === void 0 ? void 0 : _c.call(_b);
24456
+ }
24457
+ }, [focused]);
24458
+ useEffect(() => {
24459
+ if (!focused) {
24460
+ setInputValue(formatValue(value));
24461
+ }
24462
+ }, [focused, value, digits]);
24387
24463
  const handleMinus = () => {
24388
24464
  setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
24389
24465
  };
@@ -24412,7 +24488,7 @@ const Stepper$1 = (p) => {
24412
24488
  };
24413
24489
  return withNativeProps(props, React__default.createElement("div", {
24414
24490
  className: classNames(classPrefix$e, {
24415
- [`${classPrefix$e}-active`]: hasFocus
24491
+ [`${classPrefix$e}-active`]: focused
24416
24492
  })
24417
24493
  }, React__default.createElement(Button, {
24418
24494
  className: `${classPrefix$e}-minus`,
@@ -24425,10 +24501,11 @@ const Stepper$1 = (p) => {
24425
24501
  }, React__default.createElement(MinusOutline, null)), React__default.createElement("div", {
24426
24502
  className: `${classPrefix$e}-middle`
24427
24503
  }, React__default.createElement(Input, {
24504
+ ref: inputRef,
24428
24505
  className: `${classPrefix$e}-input`,
24429
24506
  onFocus: (e) => {
24430
24507
  var _a;
24431
- setHasFocus(true);
24508
+ triggerFocus(true);
24432
24509
  (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
24433
24510
  },
24434
24511
  value: inputValue,
@@ -24438,7 +24515,7 @@ const Stepper$1 = (p) => {
24438
24515
  disabled,
24439
24516
  onBlur: (e) => {
24440
24517
  var _a;
24441
- setHasFocus(false);
24518
+ triggerFocus(false);
24442
24519
  (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
24443
24520
  },
24444
24521
  readOnly: inputReadOnly,
@@ -24457,20 +24534,6 @@ const Stepper$1 = (p) => {
24457
24534
  "aria-label": locale.Stepper.increase
24458
24535
  }, React__default.createElement(AddOutline, null))));
24459
24536
  };
24460
- function convertValueToText(value, digits) {
24461
- if (value === null)
24462
- return "";
24463
- if (digits !== void 0) {
24464
- return value.toFixed(digits);
24465
- } else {
24466
- return value.toString();
24467
- }
24468
- }
24469
- function convertTextToValue(text) {
24470
- if (text === "")
24471
- return null;
24472
- return parseFloat(text);
24473
- }
24474
24537
  const Stepper = Stepper$1;
24475
24538
  const steps = "";
24476
24539
  const classPrefix$d = `adm-step`;
@@ -25952,7 +26015,11 @@ const WaterMark$1 = (p) => {
25952
26015
  const markSize = Number(fontSize) * ratio;
25953
26016
  ctx2.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
25954
26017
  ctx2.fillStyle = fontColor;
25955
- ctx2.fillText(content, 0, 0);
26018
+ if (Array.isArray(content)) {
26019
+ content.forEach((item, index2) => ctx2.fillText(item, 0, index2 * markSize));
26020
+ } else {
26021
+ ctx2.fillText(content, 0, 0);
26022
+ }
25956
26023
  ctx2.restore();
25957
26024
  setBase64Url(canvas.toDataURL());
25958
26025
  }