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
@@ -7033,6 +7033,10 @@
7033
7033
  thin: 0.35,
7034
7034
  thick: 0.75
7035
7035
  };
7036
+ const colorRecord$4 = {
7037
+ black: "0, 0, 0",
7038
+ white: "255, 255, 255"
7039
+ };
7036
7040
  const defaultProps$13 = {
7037
7041
  visible: true,
7038
7042
  destroyOnClose: false,
@@ -7053,8 +7057,8 @@
7053
7057
  const background = React$1.useMemo(() => {
7054
7058
  var _a;
7055
7059
  const opacity2 = (_a = opacityRecord[props.opacity]) !== null && _a !== void 0 ? _a : props.opacity;
7056
- const rgb2 = props.color === "white" ? "255, 255, 255" : "0, 0, 0";
7057
- return `rgba(${rgb2}, ${opacity2})`;
7060
+ const rgb2 = colorRecord$4[props.color];
7061
+ return rgb2 ? `rgba(${rgb2}, ${opacity2})` : props.color;
7058
7062
  }, [props.color, props.opacity]);
7059
7063
  const [active, setActive] = React$1.useState(props.visible);
7060
7064
  const unmountedRef = useUnmountedRef$1();
@@ -8619,11 +8623,17 @@
8619
8623
  let isSelect = false;
8620
8624
  let isBegin = false;
8621
8625
  let isEnd = false;
8626
+ let isSelectRowBegin = false;
8627
+ let isSelectRowEnd = false;
8622
8628
  if (dateRange) {
8623
8629
  const [begin, end] = dateRange;
8624
8630
  isBegin = d.isSame(begin, "day");
8625
8631
  isEnd = d.isSame(end, "day");
8626
8632
  isSelect = isBegin || isEnd || d.isAfter(begin, "day") && d.isBefore(end, "day");
8633
+ if (isSelect) {
8634
+ isSelectRowBegin = (cells.length % 7 === 0 || d.isSame(d.startOf("month"), "day")) && !isBegin;
8635
+ isSelectRowEnd = (cells.length % 7 === 6 || d.isSame(d.endOf("month"), "day")) && !isEnd;
8636
+ }
8627
8637
  }
8628
8638
  const inThisMonth = d.month() === current.month();
8629
8639
  const disabled = props.shouldDisableDate ? props.shouldDisableDate(d.toDate()) : maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
@@ -8633,7 +8643,9 @@
8633
8643
  [`${classPrefix$1b}-cell-today`]: d.isSame(today, "day"),
8634
8644
  [`${classPrefix$1b}-cell-selected`]: isSelect,
8635
8645
  [`${classPrefix$1b}-cell-selected-begin`]: isBegin,
8636
- [`${classPrefix$1b}-cell-selected-end`]: isEnd
8646
+ [`${classPrefix$1b}-cell-selected-end`]: isEnd,
8647
+ [`${classPrefix$1b}-cell-selected-row-begin`]: isSelectRowBegin,
8648
+ [`${classPrefix$1b}-cell-selected-row-end`]: isSelectRowEnd
8637
8649
  }),
8638
8650
  onClick: () => {
8639
8651
  if (!props.selectionMode)
@@ -14530,22 +14542,36 @@ Please add \`${key}Action\` when creating your handler.`);
14530
14542
  const floatingBubble = "";
14531
14543
  const classPrefix$P = `adm-floating-bubble`;
14532
14544
  const defaultProps$E = {
14533
- axis: "y"
14545
+ axis: "y",
14546
+ defaultOffset: {
14547
+ x: 0,
14548
+ y: 0
14549
+ }
14534
14550
  };
14535
14551
  const FloatingBubble$1 = (p) => {
14536
14552
  const props = mergeProps(defaultProps$E, p);
14537
14553
  const boundaryRef = React$1.useRef(null);
14538
14554
  const buttonRef = React$1.useRef(null);
14555
+ const [innerValue, setInnerValue] = React$1.useState(props.offset === void 0 ? props.defaultOffset : props.offset);
14556
+ React$1.useEffect(() => {
14557
+ if (props.offset === void 0)
14558
+ return;
14559
+ api.start({
14560
+ x: props.offset.x,
14561
+ y: props.offset.y
14562
+ });
14563
+ }, [props.offset]);
14539
14564
  const [{
14540
14565
  x,
14541
14566
  y,
14542
14567
  opacity
14543
14568
  }, api] = useSpring(() => ({
14544
- x: 0,
14545
- y: 0,
14569
+ x: innerValue.x,
14570
+ y: innerValue.y,
14546
14571
  opacity: 1
14547
14572
  }));
14548
14573
  const bind = useDrag((state) => {
14574
+ var _a;
14549
14575
  let nextX = state.offset[0];
14550
14576
  let nextY = state.offset[1];
14551
14577
  if (state.last && props.magnetic) {
@@ -14575,10 +14601,16 @@ Please add \`${key}Action\` when creating your handler.`);
14575
14601
  }
14576
14602
  }
14577
14603
  }
14578
- api.start({
14604
+ const nextOffest = {
14579
14605
  x: nextX,
14580
14606
  y: nextY
14581
- });
14607
+ };
14608
+ if (props.offset === void 0) {
14609
+ api.start(nextOffest);
14610
+ } else {
14611
+ setInnerValue(nextOffest);
14612
+ }
14613
+ (_a = props.onOffsetChange) === null || _a === void 0 ? void 0 : _a.call(props, nextOffest);
14582
14614
  api.start({
14583
14615
  opacity: state.active ? 0.8 : 1
14584
14616
  });
@@ -19227,18 +19259,22 @@ Please add \`${key}Action\` when creating your handler.`);
19227
19259
  middleware = [],
19228
19260
  platform: platform2
19229
19261
  } = config2;
19262
+ const validMiddleware = middleware.filter(Boolean);
19230
19263
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
19231
19264
  {
19232
19265
  if (platform2 == null) {
19233
19266
  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(" "));
19234
19267
  }
19235
- if (middleware.filter((_ref) => {
19268
+ if (validMiddleware.filter((_ref) => {
19236
19269
  let {
19237
19270
  name
19238
19271
  } = _ref;
19239
19272
  return name === "autoPlacement" || name === "flip";
19240
19273
  }).length > 1) {
19241
- 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(" "));
19274
+ 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(" "));
19275
+ }
19276
+ if (!reference || !floating) {
19277
+ 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(" "));
19242
19278
  }
19243
19279
  }
19244
19280
  let rects = await platform2.getElementRects({
@@ -19253,11 +19289,11 @@ Please add \`${key}Action\` when creating your handler.`);
19253
19289
  let statefulPlacement = placement;
19254
19290
  let middlewareData = {};
19255
19291
  let resetCount = 0;
19256
- for (let i = 0; i < middleware.length; i++) {
19292
+ for (let i = 0; i < validMiddleware.length; i++) {
19257
19293
  const {
19258
19294
  name,
19259
19295
  fn
19260
- } = middleware[i];
19296
+ } = validMiddleware[i];
19261
19297
  const {
19262
19298
  x: nextX,
19263
19299
  y: nextY,
@@ -19849,7 +19885,7 @@ Please add \`${key}Action\` when creating your handler.`);
19849
19885
  }
19850
19886
  function getUAString() {
19851
19887
  const uaData = navigator.userAgentData;
19852
- if (uaData != null && uaData.brands) {
19888
+ if (uaData && Array.isArray(uaData.brands)) {
19853
19889
  return uaData.brands.map((item) => item.brand + "/" + item.version).join(" ");
19854
19890
  }
19855
19891
  return navigator.userAgent;
@@ -19885,7 +19921,8 @@ Please add \`${key}Action\` when creating your handler.`);
19885
19921
  function isContainingBlock(element) {
19886
19922
  const isFirefox = /firefox/i.test(getUAString());
19887
19923
  const css = getComputedStyle(element);
19888
- 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(
19924
+ const backdropFilter = css.backdropFilter || css.WebkitBackdropFilter;
19925
+ 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(
19889
19926
  (value) => {
19890
19927
  const contain = css.contain;
19891
19928
  return contain != null ? contain.includes(value) : false;
@@ -19994,7 +20031,8 @@ Please add \`${key}Action\` when creating your handler.`);
19994
20031
  if (getNodeName(node) === "html") {
19995
20032
  return node;
19996
20033
  }
19997
- return node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
20034
+ const result2 = node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
20035
+ return isShadowRoot(result2) ? result2.host : result2;
19998
20036
  }
19999
20037
  function getTrueOffsetParent(element) {
20000
20038
  if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
@@ -20004,15 +20042,11 @@ Please add \`${key}Action\` when creating your handler.`);
20004
20042
  }
20005
20043
  function getContainingBlock(element) {
20006
20044
  let currentNode = getParentNode(element);
20007
- if (isShadowRoot(currentNode)) {
20008
- currentNode = currentNode.host;
20009
- }
20010
20045
  while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
20011
20046
  if (isContainingBlock(currentNode)) {
20012
20047
  return currentNode;
20013
20048
  } else {
20014
- const parent = currentNode.parentNode;
20015
- currentNode = isShadowRoot(parent) ? parent.host : parent;
20049
+ currentNode = getParentNode(currentNode);
20016
20050
  }
20017
20051
  }
20018
20052
  return null;
@@ -20141,32 +20175,6 @@ Please add \`${key}Action\` when creating your handler.`);
20141
20175
  const updatedList = list2.concat(target);
20142
20176
  return isBody ? updatedList : updatedList.concat(getOverflowAncestors(target));
20143
20177
  }
20144
- function contains(parent, child) {
20145
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
20146
- if (parent.contains(child)) {
20147
- return true;
20148
- } else if (rootNode && isShadowRoot(rootNode)) {
20149
- let next = child;
20150
- do {
20151
- if (next && parent === next) {
20152
- return true;
20153
- }
20154
- next = next.parentNode || next.host;
20155
- } while (next);
20156
- }
20157
- return false;
20158
- }
20159
- function getNearestParentCapableOfEscapingClipping(element, clippingAncestors) {
20160
- let currentNode = element;
20161
- while (currentNode && !isLastTraversableNode(currentNode) && !clippingAncestors.includes(currentNode)) {
20162
- if (isElement(currentNode) && ["absolute", "fixed"].includes(getComputedStyle(currentNode).position)) {
20163
- break;
20164
- }
20165
- const parentNode = getParentNode(currentNode);
20166
- currentNode = isShadowRoot(parentNode) ? parentNode.host : parentNode;
20167
- }
20168
- return currentNode;
20169
- }
20170
20178
  function getInnerBoundingClientRect(element, strategy) {
20171
20179
  const clientRect = getBoundingClientRect(element, false, strategy === "fixed");
20172
20180
  const top = clientRect.top + element.clientTop;
@@ -20182,31 +20190,32 @@ Please add \`${key}Action\` when creating your handler.`);
20182
20190
  height: element.clientHeight
20183
20191
  };
20184
20192
  }
20185
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
20186
- if (clippingParent === "viewport") {
20193
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
20194
+ if (clippingAncestor === "viewport") {
20187
20195
  return rectToClientRect(getViewportRect(element, strategy));
20188
20196
  }
20189
- if (isElement(clippingParent)) {
20190
- return getInnerBoundingClientRect(clippingParent, strategy);
20197
+ if (isElement(clippingAncestor)) {
20198
+ return getInnerBoundingClientRect(clippingAncestor, strategy);
20191
20199
  }
20192
20200
  return rectToClientRect(getDocumentRect(getDocumentElement(element)));
20193
20201
  }
20194
- function getClippingAncestors(element) {
20195
- const clippingAncestors = getOverflowAncestors(element);
20196
- const nearestEscapableParent = getNearestParentCapableOfEscapingClipping(element, clippingAncestors);
20197
- let clipperElement = null;
20198
- if (nearestEscapableParent && isHTMLElement(nearestEscapableParent)) {
20199
- const offsetParent = getOffsetParent(nearestEscapableParent);
20200
- if (isOverflowElement(nearestEscapableParent)) {
20201
- clipperElement = nearestEscapableParent;
20202
- } else if (isHTMLElement(offsetParent)) {
20203
- clipperElement = offsetParent;
20202
+ function getClippingElementAncestors(element) {
20203
+ let result2 = getOverflowAncestors(element).filter((el) => isElement(el) && getNodeName(el) !== "body");
20204
+ let currentContainingBlockComputedStyle = null;
20205
+ const elementIsFixed = getComputedStyle(element).position === "fixed";
20206
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
20207
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
20208
+ const computedStyle = getComputedStyle(currentNode);
20209
+ const containingBlock = isContainingBlock(currentNode);
20210
+ const shouldDropCurrentNode = elementIsFixed ? !containingBlock && !currentContainingBlockComputedStyle : !containingBlock && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position);
20211
+ if (shouldDropCurrentNode) {
20212
+ result2 = result2.filter((ancestor) => ancestor !== currentNode);
20213
+ } else {
20214
+ currentContainingBlockComputedStyle = computedStyle;
20204
20215
  }
20216
+ currentNode = getParentNode(currentNode);
20205
20217
  }
20206
- if (!isElement(clipperElement)) {
20207
- return [];
20208
- }
20209
- return clippingAncestors.filter((clippingAncestors2) => clipperElement && isElement(clippingAncestors2) && contains(clippingAncestors2, clipperElement) && getNodeName(clippingAncestors2) !== "body");
20218
+ return result2;
20210
20219
  }
20211
20220
  function getClippingRect(_ref) {
20212
20221
  let {
@@ -20215,8 +20224,8 @@ Please add \`${key}Action\` when creating your handler.`);
20215
20224
  rootBoundary,
20216
20225
  strategy
20217
20226
  } = _ref;
20218
- const mainClippingAncestors = boundary === "clippingAncestors" ? getClippingAncestors(element) : [].concat(boundary);
20219
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
20227
+ const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element) : [].concat(boundary);
20228
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
20220
20229
  const firstClippingAncestor = clippingAncestors[0];
20221
20230
  const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
20222
20231
  const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
@@ -20240,18 +20249,20 @@ Please add \`${key}Action\` when creating your handler.`);
20240
20249
  getDimensions,
20241
20250
  getOffsetParent,
20242
20251
  getDocumentElement,
20243
- getElementRects: (_ref) => {
20252
+ async getElementRects(_ref) {
20244
20253
  let {
20245
20254
  reference,
20246
20255
  floating,
20247
20256
  strategy
20248
20257
  } = _ref;
20258
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
20259
+ const getDimensionsFn = this.getDimensions;
20249
20260
  return {
20250
- reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
20261
+ reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
20251
20262
  floating: {
20252
- ...getDimensions(floating),
20253
20263
  x: 0,
20254
- y: 0
20264
+ y: 0,
20265
+ ...await getDimensionsFn(floating)
20255
20266
  }
20256
20267
  };
20257
20268
  },
@@ -21304,6 +21315,7 @@ Please add \`${key}Action\` when creating your handler.`);
21304
21315
  url,
21305
21316
  file,
21306
21317
  deletable,
21318
+ deleteIcon,
21307
21319
  onDelete,
21308
21320
  imageFit
21309
21321
  } = props;
@@ -21316,11 +21328,12 @@ Please add \`${key}Action\` when creating your handler.`);
21316
21328
  }
21317
21329
  return "";
21318
21330
  }, [url, file]);
21319
- React$1.useLayoutEffect(() => {
21331
+ React$1.useEffect(() => {
21320
21332
  return () => {
21321
- URL.revokeObjectURL(src);
21333
+ if (file)
21334
+ URL.revokeObjectURL(src);
21322
21335
  };
21323
- }, [src]);
21336
+ }, [src, file]);
21324
21337
  function renderLoading() {
21325
21338
  return props.status === "pending" && React__default.default.createElement("div", {
21326
21339
  className: `${classPrefix$G}-cell-mask`
@@ -21336,9 +21349,7 @@ Please add \`${key}Action\` when creating your handler.`);
21336
21349
  return deletable && React__default.default.createElement("span", {
21337
21350
  className: `${classPrefix$G}-cell-delete`,
21338
21351
  onClick: onDelete
21339
- }, React__default.default.createElement(CloseOutline, {
21340
- className: `${classPrefix$G}-cell-delete-icon`
21341
- }));
21352
+ }, deleteIcon);
21342
21353
  }
21343
21354
  return React__default.default.createElement("div", {
21344
21355
  className: classNames(`${classPrefix$G}-cell`, props.status === "fail" && `${classPrefix$G}-cell-fail`)
@@ -21381,6 +21392,9 @@ Please add \`${key}Action\` when creating your handler.`);
21381
21392
  const defaultProps$y = {
21382
21393
  disableUpload: false,
21383
21394
  deletable: true,
21395
+ deleteIcon: React__default.default.createElement(CloseOutline, {
21396
+ className: `${classPrefix$E}-cell-delete-icon`
21397
+ }),
21384
21398
  showUpload: true,
21385
21399
  multiple: false,
21386
21400
  maxCount: 0,
@@ -21395,8 +21409,26 @@ Please add \`${key}Action\` when creating your handler.`);
21395
21409
  locale
21396
21410
  } = useConfig();
21397
21411
  const props = mergeProps(defaultProps$y, p);
21412
+ const {
21413
+ columns
21414
+ } = props;
21398
21415
  const [value, setValue2] = usePropsValue(props);
21399
21416
  const [tasks, setTasks] = React$1.useState([]);
21417
+ const containerRef = React$1.useRef(null);
21418
+ const containerSize = useSize(containerRef);
21419
+ const gapMeasureRef = React$1.useRef(null);
21420
+ const [cellSize, setCellSize] = React$1.useState(80);
21421
+ useIsomorphicLayoutEffect$2(() => {
21422
+ const gapMeasure = gapMeasureRef.current;
21423
+ if (columns && containerSize && gapMeasure) {
21424
+ const width = containerSize.width;
21425
+ const gap = measureCSSLength(window.getComputedStyle(gapMeasure).getPropertyValue("height"));
21426
+ setCellSize((width - gap * (columns - 1)) / columns);
21427
+ }
21428
+ }, [containerSize === null || containerSize === void 0 ? void 0 : containerSize.width]);
21429
+ const style = {
21430
+ "--cell-size": cellSize + "px"
21431
+ };
21400
21432
  useIsomorphicLayoutEffect$2(() => {
21401
21433
  setTasks((prev) => prev.filter((task) => {
21402
21434
  if (task.url === void 0)
@@ -21522,6 +21554,7 @@ Please add \`${key}Action\` when creating your handler.`);
21522
21554
  key: (_a = fileItem.key) !== null && _a !== void 0 ? _a : index2,
21523
21555
  url: (_b = fileItem.thumbnailUrl) !== null && _b !== void 0 ? _b : fileItem.url,
21524
21556
  deletable: props.deletable,
21557
+ deleteIcon: props.deleteIcon,
21525
21558
  imageFit: props.imageFit,
21526
21559
  onClick: () => {
21527
21560
  if (props.preview) {
@@ -21540,21 +21573,19 @@ Please add \`${key}Action\` when creating your handler.`);
21540
21573
  return renderItem ? renderItem(originNode, fileItem, value) : originNode;
21541
21574
  });
21542
21575
  };
21543
- return withNativeProps(props, React__default.default.createElement("div", {
21544
- className: classPrefix$E
21545
- }, React__default.default.createElement(Space, {
21546
- className: `${classPrefix$E}-space`,
21547
- wrap: true,
21548
- block: true
21549
- }, renderImages(), finalTasks.map((task) => {
21576
+ const contentNode = React__default.default.createElement(React__default.default.Fragment, null, renderImages(), tasks.map((task) => {
21577
+ if (!props.showFailed && task.status === "fail") {
21578
+ return null;
21579
+ }
21550
21580
  return React__default.default.createElement(PreviewItem$1, {
21551
21581
  key: task.id,
21552
21582
  file: task.file,
21553
21583
  deletable: task.status !== "pending",
21584
+ deleteIcon: props.deleteIcon,
21554
21585
  status: task.status,
21555
21586
  imageFit: props.imageFit,
21556
21587
  onDelete: () => {
21557
- setTasks((prev) => prev.filter((x) => x.id !== task.id));
21588
+ setTasks(tasks.filter((x) => x.id !== task.id));
21558
21589
  }
21559
21590
  });
21560
21591
  }), showUpload && React__default.default.createElement("div", {
@@ -21573,7 +21604,22 @@ Please add \`${key}Action\` when creating your handler.`);
21573
21604
  className: `${classPrefix$E}-input`,
21574
21605
  onChange,
21575
21606
  "aria-hidden": true
21576
- })))));
21607
+ })));
21608
+ return withNativeProps(props, React__default.default.createElement("div", {
21609
+ className: classPrefix$E,
21610
+ ref: containerRef
21611
+ }, columns ? React__default.default.createElement(Grid, {
21612
+ className: `${classPrefix$E}-grid`,
21613
+ columns,
21614
+ style
21615
+ }, React__default.default.createElement("div", {
21616
+ className: `${classPrefix$E}-gap-measure`,
21617
+ ref: gapMeasureRef
21618
+ }), contentNode.props.children) : React__default.default.createElement(Space, {
21619
+ className: `${classPrefix$E}-space`,
21620
+ wrap: true,
21621
+ block: true
21622
+ }, contentNode.props.children)));
21577
21623
  };
21578
21624
  const imageUploader = "";
21579
21625
  const ImageUploader = ImageUploader$1;
@@ -22287,6 +22333,7 @@ Please add \`${key}Action\` when creating your handler.`);
22287
22333
  color: "default",
22288
22334
  delay: 2e3,
22289
22335
  speed: 50,
22336
+ wrap: false,
22290
22337
  icon: React__default.default.createElement(SoundOutline, null)
22291
22338
  };
22292
22339
  const NoticeBar$1 = React$1.memo((p) => {
@@ -22298,7 +22345,7 @@ Please add \`${key}Action\` when creating your handler.`);
22298
22345
  const delayLockRef = React$1.useRef(true);
22299
22346
  const animatingRef = React$1.useRef(false);
22300
22347
  function start2() {
22301
- if (delayLockRef.current)
22348
+ if (delayLockRef.current || props.wrap)
22302
22349
  return;
22303
22350
  const container = containerRef.current;
22304
22351
  const text = textRef.current;
@@ -22341,7 +22388,9 @@ Please add \`${key}Action\` when creating your handler.`);
22341
22388
  if (!visible)
22342
22389
  return null;
22343
22390
  return withNativeProps(props, React__default.default.createElement("div", {
22344
- className: classNames(classPrefix$x, `${classPrefix$x}-${props.color}`)
22391
+ className: classNames(classPrefix$x, `${classPrefix$x}-${props.color}`, {
22392
+ [`${classPrefix$x}-wrap`]: props.wrap
22393
+ })
22345
22394
  }, props.icon && React__default.default.createElement("span", {
22346
22395
  className: `${classPrefix$x}-left`
22347
22396
  }, props.icon), React__default.default.createElement("span", {
@@ -24366,36 +24415,44 @@ Please add \`${key}Action\` when creating your handler.`);
24366
24415
  step,
24367
24416
  max: max2,
24368
24417
  min: min2,
24369
- inputReadOnly
24418
+ inputReadOnly,
24419
+ digits,
24420
+ formatter,
24421
+ parser
24370
24422
  } = props;
24371
24423
  const {
24372
24424
  locale
24373
24425
  } = useConfig();
24426
+ const parseValue = (text) => {
24427
+ if (text === "")
24428
+ return null;
24429
+ return parser ? parser(text) : parseFloat(text);
24430
+ };
24431
+ const formatValue = (value2) => {
24432
+ if (value2 === null)
24433
+ return "";
24434
+ if (formatter) {
24435
+ return formatter(value2);
24436
+ } else if (digits !== void 0) {
24437
+ return value2.toFixed(digits);
24438
+ } else {
24439
+ return value2.toString();
24440
+ }
24441
+ };
24374
24442
  const [value, setValue2] = usePropsValue(props);
24375
- const [inputValue, setInputValue] = React$1.useState(() => convertValueToText(value, props.digits));
24443
+ const [inputValue, setInputValue] = React$1.useState(() => formatValue(value));
24376
24444
  function setValueWithCheck(v) {
24377
24445
  if (isNaN(v))
24378
24446
  return;
24379
24447
  let target = bound(v, props.min, props.max);
24380
- if (props.digits !== void 0) {
24381
- target = parseFloat(target.toFixed(props.digits));
24448
+ if (digits !== void 0) {
24449
+ target = parseFloat(target.toFixed(digits));
24382
24450
  }
24383
24451
  setValue2(target);
24384
24452
  }
24385
- const [hasFocus, setHasFocus] = React$1.useState(false);
24386
- React$1.useEffect(() => {
24387
- if (!hasFocus) {
24388
- setInputValue(convertValueToText(value, props.digits));
24389
- }
24390
- }, [hasFocus]);
24391
- React$1.useEffect(() => {
24392
- if (!hasFocus) {
24393
- setInputValue(convertValueToText(value, props.digits));
24394
- }
24395
- }, [value, props.digits]);
24396
24453
  const handleInputChange = (v) => {
24397
24454
  setInputValue(v);
24398
- const value2 = convertTextToValue(v);
24455
+ const value2 = parseValue(v);
24399
24456
  if (value2 === null) {
24400
24457
  if (props.allowEmpty) {
24401
24458
  setValue2(null);
@@ -24406,6 +24463,25 @@ Please add \`${key}Action\` when creating your handler.`);
24406
24463
  setValueWithCheck(value2);
24407
24464
  }
24408
24465
  };
24466
+ const [focused, setFocused] = React$1.useState(false);
24467
+ const inputRef = React__default.default.useRef(null);
24468
+ function triggerFocus(nextFocus) {
24469
+ setFocused(nextFocus);
24470
+ if (nextFocus) {
24471
+ setInputValue(typeof value === "number" ? String(value) : "");
24472
+ }
24473
+ }
24474
+ React$1.useEffect(() => {
24475
+ var _a, _b, _c;
24476
+ if (focused) {
24477
+ (_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);
24478
+ }
24479
+ }, [focused]);
24480
+ React$1.useEffect(() => {
24481
+ if (!focused) {
24482
+ setInputValue(formatValue(value));
24483
+ }
24484
+ }, [focused, value, digits]);
24409
24485
  const handleMinus = () => {
24410
24486
  setValueWithCheck(Big(value !== null && value !== void 0 ? value : 0).minus(step).toNumber());
24411
24487
  };
@@ -24434,7 +24510,7 @@ Please add \`${key}Action\` when creating your handler.`);
24434
24510
  };
24435
24511
  return withNativeProps(props, React__default.default.createElement("div", {
24436
24512
  className: classNames(classPrefix$e, {
24437
- [`${classPrefix$e}-active`]: hasFocus
24513
+ [`${classPrefix$e}-active`]: focused
24438
24514
  })
24439
24515
  }, React__default.default.createElement(Button, {
24440
24516
  className: `${classPrefix$e}-minus`,
@@ -24447,10 +24523,11 @@ Please add \`${key}Action\` when creating your handler.`);
24447
24523
  }, React__default.default.createElement(MinusOutline, null)), React__default.default.createElement("div", {
24448
24524
  className: `${classPrefix$e}-middle`
24449
24525
  }, React__default.default.createElement(Input, {
24526
+ ref: inputRef,
24450
24527
  className: `${classPrefix$e}-input`,
24451
24528
  onFocus: (e) => {
24452
24529
  var _a;
24453
- setHasFocus(true);
24530
+ triggerFocus(true);
24454
24531
  (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
24455
24532
  },
24456
24533
  value: inputValue,
@@ -24460,7 +24537,7 @@ Please add \`${key}Action\` when creating your handler.`);
24460
24537
  disabled,
24461
24538
  onBlur: (e) => {
24462
24539
  var _a;
24463
- setHasFocus(false);
24540
+ triggerFocus(false);
24464
24541
  (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
24465
24542
  },
24466
24543
  readOnly: inputReadOnly,
@@ -24479,20 +24556,6 @@ Please add \`${key}Action\` when creating your handler.`);
24479
24556
  "aria-label": locale.Stepper.increase
24480
24557
  }, React__default.default.createElement(AddOutline, null))));
24481
24558
  };
24482
- function convertValueToText(value, digits) {
24483
- if (value === null)
24484
- return "";
24485
- if (digits !== void 0) {
24486
- return value.toFixed(digits);
24487
- } else {
24488
- return value.toString();
24489
- }
24490
- }
24491
- function convertTextToValue(text) {
24492
- if (text === "")
24493
- return null;
24494
- return parseFloat(text);
24495
- }
24496
24559
  const Stepper = Stepper$1;
24497
24560
  const steps = "";
24498
24561
  const classPrefix$d = `adm-step`;
@@ -25974,7 +26037,11 @@ Please add \`${key}Action\` when creating your handler.`);
25974
26037
  const markSize = Number(fontSize) * ratio;
25975
26038
  ctx2.font = `${fontStyle} normal ${fontWeight} ${markSize}px/${markHeight}px ${fontFamily}`;
25976
26039
  ctx2.fillStyle = fontColor;
25977
- ctx2.fillText(content, 0, 0);
26040
+ if (Array.isArray(content)) {
26041
+ content.forEach((item, index2) => ctx2.fillText(item, 0, index2 * markSize));
26042
+ } else {
26043
+ ctx2.fillText(content, 0, 0);
26044
+ }
25978
26045
  ctx2.restore();
25979
26046
  setBase64Url(canvas.toDataURL());
25980
26047
  }