antd-mobile 5.38.0 → 5.39.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 (134) hide show
  1. package/2x/bundle/antd-mobile.cjs.development.js +278 -237
  2. package/2x/bundle/antd-mobile.cjs.js +7 -7
  3. package/2x/bundle/antd-mobile.es.development.js +279 -238
  4. package/2x/bundle/antd-mobile.es.js +5466 -5430
  5. package/2x/bundle/antd-mobile.umd.development.js +278 -237
  6. package/2x/bundle/antd-mobile.umd.js +7 -7
  7. package/2x/bundle/style.css +17 -2
  8. package/2x/cjs/components/calendar-picker/calendar-picker.d.ts +9 -9
  9. package/2x/cjs/components/calendar-picker-view/calendar-picker-view.d.ts +5 -4
  10. package/2x/cjs/components/calendar-picker-view/calendar-picker-view.js +18 -11
  11. package/2x/cjs/components/date-picker/date-picker-week-utils.js +2 -2
  12. package/2x/cjs/components/ellipsis/ellipsis.css +1 -0
  13. package/2x/cjs/components/ellipsis/ellipsis.d.ts +1 -1
  14. package/2x/cjs/components/ellipsis/ellipsis.js +28 -124
  15. package/2x/cjs/components/ellipsis/useMeasure.d.ts +2 -0
  16. package/2x/cjs/components/ellipsis/useMeasure.js +112 -0
  17. package/2x/cjs/components/ellipsis/~ellipsis.d.ts +15 -0
  18. package/2x/cjs/components/ellipsis/~ellipsis.js +161 -0
  19. package/2x/cjs/components/floating-panel/floating-panel.css +16 -2
  20. package/2x/cjs/components/floating-panel/floating-panel.d.ts +3 -1
  21. package/2x/cjs/components/floating-panel/floating-panel.js +43 -30
  22. package/2x/cjs/components/image-uploader/image-uploader.d.ts +3 -3
  23. package/2x/cjs/components/image-uploader/image-uploader.js +11 -11
  24. package/2x/cjs/components/image-viewer/image-viewer.d.ts +13 -4
  25. package/2x/cjs/components/image-viewer/image-viewer.js +8 -6
  26. package/2x/cjs/components/image-viewer/index.d.ts +4 -1
  27. package/2x/cjs/components/image-viewer/slide.d.ts +5 -1
  28. package/2x/cjs/components/image-viewer/slide.js +10 -5
  29. package/2x/cjs/components/image-viewer/slides.d.ts +4 -1
  30. package/2x/cjs/components/image-viewer/slides.js +14 -12
  31. package/2x/cjs/components/passcode-input/passcode-input.d.ts +7 -5
  32. package/2x/cjs/components/passcode-input/passcode-input.js +7 -6
  33. package/2x/cjs/components/popover/popover.d.ts +2 -2
  34. package/2x/cjs/components/popover/popover.js +11 -11
  35. package/2x/cjs/components/swipe-action/swipe-action.d.ts +3 -1
  36. package/2x/cjs/components/swipe-action/swipe-action.js +25 -23
  37. package/2x/es/components/calendar-picker/calendar-picker.d.ts +9 -9
  38. package/2x/es/components/calendar-picker-view/calendar-picker-view.d.ts +5 -4
  39. package/2x/es/components/calendar-picker-view/calendar-picker-view.js +18 -11
  40. package/2x/es/components/date-picker/date-picker-week-utils.js +2 -2
  41. package/2x/es/components/ellipsis/ellipsis.css +1 -0
  42. package/2x/es/components/ellipsis/ellipsis.d.ts +1 -1
  43. package/2x/es/components/ellipsis/ellipsis.js +28 -122
  44. package/2x/es/components/ellipsis/useMeasure.d.ts +2 -0
  45. package/2x/es/components/ellipsis/useMeasure.js +105 -0
  46. package/2x/es/components/ellipsis/~ellipsis.d.ts +15 -0
  47. package/2x/es/components/ellipsis/~ellipsis.js +151 -0
  48. package/2x/es/components/floating-panel/floating-panel.css +16 -2
  49. package/2x/es/components/floating-panel/floating-panel.d.ts +3 -1
  50. package/2x/es/components/floating-panel/floating-panel.js +31 -19
  51. package/2x/es/components/image-uploader/image-uploader.d.ts +3 -3
  52. package/2x/es/components/image-uploader/image-uploader.js +11 -11
  53. package/2x/es/components/image-viewer/image-viewer.d.ts +13 -4
  54. package/2x/es/components/image-viewer/image-viewer.js +8 -6
  55. package/2x/es/components/image-viewer/index.d.ts +4 -1
  56. package/2x/es/components/image-viewer/slide.d.ts +5 -1
  57. package/2x/es/components/image-viewer/slide.js +11 -6
  58. package/2x/es/components/image-viewer/slides.d.ts +4 -1
  59. package/2x/es/components/image-viewer/slides.js +6 -4
  60. package/2x/es/components/passcode-input/passcode-input.d.ts +7 -5
  61. package/2x/es/components/passcode-input/passcode-input.js +6 -5
  62. package/2x/es/components/popover/popover.d.ts +2 -2
  63. package/2x/es/components/popover/popover.js +10 -10
  64. package/2x/es/components/swipe-action/swipe-action.d.ts +3 -1
  65. package/2x/es/components/swipe-action/swipe-action.js +9 -7
  66. package/2x/package.json +1 -1
  67. package/bundle/antd-mobile.cjs.development.js +278 -237
  68. package/bundle/antd-mobile.cjs.js +7 -7
  69. package/bundle/antd-mobile.compatible.umd.js +1 -1
  70. package/bundle/antd-mobile.es.development.js +279 -238
  71. package/bundle/antd-mobile.es.js +5466 -5430
  72. package/bundle/antd-mobile.umd.development.js +278 -237
  73. package/bundle/antd-mobile.umd.js +7 -7
  74. package/bundle/style.css +1 -1
  75. package/cjs/components/calendar-picker/calendar-picker.d.ts +9 -9
  76. package/cjs/components/calendar-picker-view/calendar-picker-view.d.ts +5 -4
  77. package/cjs/components/calendar-picker-view/calendar-picker-view.js +18 -11
  78. package/cjs/components/date-picker/date-picker-week-utils.js +2 -2
  79. package/cjs/components/ellipsis/ellipsis.css +1 -0
  80. package/cjs/components/ellipsis/ellipsis.d.ts +1 -1
  81. package/cjs/components/ellipsis/ellipsis.js +28 -124
  82. package/cjs/components/ellipsis/useMeasure.d.ts +2 -0
  83. package/cjs/components/ellipsis/useMeasure.js +112 -0
  84. package/cjs/components/ellipsis/~ellipsis.d.ts +15 -0
  85. package/cjs/components/ellipsis/~ellipsis.js +161 -0
  86. package/cjs/components/floating-panel/floating-panel.css +12 -2
  87. package/cjs/components/floating-panel/floating-panel.d.ts +3 -1
  88. package/cjs/components/floating-panel/floating-panel.js +43 -30
  89. package/cjs/components/image-uploader/image-uploader.d.ts +3 -3
  90. package/cjs/components/image-uploader/image-uploader.js +11 -11
  91. package/cjs/components/image-viewer/image-viewer.d.ts +13 -4
  92. package/cjs/components/image-viewer/image-viewer.js +8 -6
  93. package/cjs/components/image-viewer/index.d.ts +4 -1
  94. package/cjs/components/image-viewer/slide.d.ts +5 -1
  95. package/cjs/components/image-viewer/slide.js +10 -5
  96. package/cjs/components/image-viewer/slides.d.ts +4 -1
  97. package/cjs/components/image-viewer/slides.js +14 -12
  98. package/cjs/components/passcode-input/passcode-input.d.ts +7 -5
  99. package/cjs/components/passcode-input/passcode-input.js +7 -6
  100. package/cjs/components/popover/popover.d.ts +2 -2
  101. package/cjs/components/popover/popover.js +11 -11
  102. package/cjs/components/swipe-action/swipe-action.d.ts +3 -1
  103. package/cjs/components/swipe-action/swipe-action.js +25 -23
  104. package/es/components/calendar-picker/calendar-picker.d.ts +9 -9
  105. package/es/components/calendar-picker-view/calendar-picker-view.d.ts +5 -4
  106. package/es/components/calendar-picker-view/calendar-picker-view.js +18 -11
  107. package/es/components/date-picker/date-picker-week-utils.js +2 -2
  108. package/es/components/ellipsis/ellipsis.css +1 -0
  109. package/es/components/ellipsis/ellipsis.d.ts +1 -1
  110. package/es/components/ellipsis/ellipsis.js +28 -122
  111. package/es/components/ellipsis/useMeasure.d.ts +2 -0
  112. package/es/components/ellipsis/useMeasure.js +105 -0
  113. package/es/components/ellipsis/~ellipsis.d.ts +15 -0
  114. package/es/components/ellipsis/~ellipsis.js +151 -0
  115. package/es/components/floating-panel/floating-panel.css +12 -2
  116. package/es/components/floating-panel/floating-panel.d.ts +3 -1
  117. package/es/components/floating-panel/floating-panel.js +31 -19
  118. package/es/components/image-uploader/image-uploader.d.ts +3 -3
  119. package/es/components/image-uploader/image-uploader.js +11 -11
  120. package/es/components/image-viewer/image-viewer.d.ts +13 -4
  121. package/es/components/image-viewer/image-viewer.js +8 -6
  122. package/es/components/image-viewer/index.d.ts +4 -1
  123. package/es/components/image-viewer/slide.d.ts +5 -1
  124. package/es/components/image-viewer/slide.js +11 -6
  125. package/es/components/image-viewer/slides.d.ts +4 -1
  126. package/es/components/image-viewer/slides.js +6 -4
  127. package/es/components/passcode-input/passcode-input.d.ts +7 -5
  128. package/es/components/passcode-input/passcode-input.js +6 -5
  129. package/es/components/popover/popover.d.ts +2 -2
  130. package/es/components/popover/popover.js +10 -10
  131. package/es/components/swipe-action/swipe-action.d.ts +3 -1
  132. package/es/components/swipe-action/swipe-action.js +9 -7
  133. package/package.json +1 -1
  134. package/umd/antd-mobile.js +1 -1
@@ -10130,7 +10130,6 @@ const CalendarPickerView = forwardRef((p, ref) => {
10130
10130
  })), React__default.createElement("div", {
10131
10131
  className: `${classPrefix$1f}-cells`
10132
10132
  }, presetEmptyCells, Array(monthIterator.daysInMonth()).fill(null).map((_, index2) => {
10133
- var _a3;
10134
10133
  const d = monthIterator.date(index2 + 1);
10135
10134
  let isSelect = false;
10136
10135
  let isBegin = false;
@@ -10149,22 +10148,36 @@ const CalendarPickerView = forwardRef((p, ref) => {
10149
10148
  }
10150
10149
  const disabled = props.shouldDisableDate ? props.shouldDisableDate(d.toDate()) : maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
10151
10150
  const renderTop = () => {
10152
- var _a4;
10153
- const top = (_a4 = props.renderTop) === null || _a4 === void 0 ? void 0 : _a4.call(props, d.toDate());
10151
+ var _a3;
10152
+ if (props.renderTop === false)
10153
+ return null;
10154
+ const contentWrapper = (content) => React__default.createElement("div", {
10155
+ className: `${classPrefix$1f}-cell-top`
10156
+ }, content);
10157
+ const top = (_a3 = props.renderTop) === null || _a3 === void 0 ? void 0 : _a3.call(props, d.toDate());
10154
10158
  if (top) {
10155
- return top;
10159
+ return contentWrapper(top);
10156
10160
  }
10157
10161
  if (props.selectionMode === "range") {
10158
10162
  if (isBegin) {
10159
- return locale.Calendar.start;
10163
+ return contentWrapper(locale.Calendar.start);
10160
10164
  }
10161
10165
  if (isEnd) {
10162
- return locale.Calendar.end;
10166
+ return contentWrapper(locale.Calendar.end);
10163
10167
  }
10164
10168
  }
10165
10169
  if (d.isSame(today, "day") && !isSelect) {
10166
- return locale.Calendar.today;
10170
+ return contentWrapper(locale.Calendar.today);
10167
10171
  }
10172
+ return contentWrapper(null);
10173
+ };
10174
+ const renderBottom = () => {
10175
+ var _a3;
10176
+ if (props.renderBottom === false)
10177
+ return null;
10178
+ return React__default.createElement("div", {
10179
+ className: `${classPrefix$1f}-cell-bottom`
10180
+ }, (_a3 = props.renderBottom) === null || _a3 === void 0 ? void 0 : _a3.call(props, d.toDate()));
10168
10181
  };
10169
10182
  return React__default.createElement("div", {
10170
10183
  key: d.valueOf(),
@@ -10218,13 +10231,9 @@ const CalendarPickerView = forwardRef((p, ref) => {
10218
10231
  }
10219
10232
  }
10220
10233
  }
10221
- }, React__default.createElement("div", {
10222
- className: `${classPrefix$1f}-cell-top`
10223
- }, renderTop()), React__default.createElement("div", {
10234
+ }, renderTop(), React__default.createElement("div", {
10224
10235
  className: `${classPrefix$1f}-cell-date`
10225
- }, props.renderDate ? props.renderDate(d.toDate()) : d.date()), React__default.createElement("div", {
10226
- className: `${classPrefix$1f}-cell-bottom`
10227
- }, (_a3 = props.renderBottom) === null || _a3 === void 0 ? void 0 : _a3.call(props, d.toDate())));
10236
+ }, props.renderDate ? props.renderDate(d.toDate()) : d.date()), renderBottom());
10228
10237
  }))));
10229
10238
  monthIterator = monthIterator.add(1, "month");
10230
10239
  }
@@ -13165,7 +13174,7 @@ function convertStringArrayToDate$1(value) {
13165
13174
  const yearString = (_a = value[0]) !== null && _a !== void 0 ? _a : "1900";
13166
13175
  const weekString = (_b = value[1]) !== null && _b !== void 0 ? _b : "1";
13167
13176
  const weekdayString = (_c = value[2]) !== null && _c !== void 0 ? _c : "1";
13168
- const day = dayjs().year(parseInt(yearString)).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
13177
+ const day = dayjs(`${parseInt(yearString)}-01-01`).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
13169
13178
  return day.toDate();
13170
13179
  }
13171
13180
  const precisionLengthRecord = {
@@ -13756,6 +13765,115 @@ function betweenInclusive(i2, e2, n2) {
13756
13765
  !function(i2) {
13757
13766
  i2[i2.unit_1 = 1] = "unit_1", i2[i2.unit_2 = 2] = "unit_2", i2[i2.unit_4 = 4] = "unit_4";
13758
13767
  }(n || (n = {}));
13768
+ const ELLIPSIS_TEXT = "...";
13769
+ const measureStyle = {
13770
+ visibility: "hidden",
13771
+ whiteSpace: "inherit",
13772
+ lineHeight: "inherit",
13773
+ fontSize: "inherit"
13774
+ };
13775
+ function useMeasure(containerRef, content, rows, direction, expanded, expandNode, collapseNode) {
13776
+ const contentChars = React__default.useMemo(() => runes(content), [content]);
13777
+ const [maxHeight, setMaxHeight] = React__default.useState(0);
13778
+ const [walkingIndexes, setWalkingIndexes] = React__default.useState([0, 0]);
13779
+ const midIndex = Math.ceil((walkingIndexes[0] + walkingIndexes[1]) / 2);
13780
+ const [status, setStatus] = React__default.useState(
13781
+ 100
13782
+ /* STABLE_NO_ELLIPSIS */
13783
+ );
13784
+ const singleRowMeasureRef = React__default.useRef(null);
13785
+ const fullMeasureRef = React__default.useRef(null);
13786
+ const midMeasureRef = React__default.useRef(null);
13787
+ const startMeasure = useEvent(() => {
13788
+ unstable_batchedUpdates(() => {
13789
+ setStatus(
13790
+ 1
13791
+ /* PREPARE */
13792
+ );
13793
+ setWalkingIndexes([0, direction === "middle" ? Math.ceil(contentChars.length / 2) : contentChars.length]);
13794
+ });
13795
+ });
13796
+ React__default.useLayoutEffect(() => {
13797
+ startMeasure();
13798
+ }, [contentChars, rows]);
13799
+ React__default.useLayoutEffect(() => {
13800
+ var _a, _b;
13801
+ if (status === 1) {
13802
+ const fullMeasureHeight = ((_a = fullMeasureRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
13803
+ const singleRowMeasureHeight = ((_b = singleRowMeasureRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
13804
+ const rowMeasureHeight = singleRowMeasureHeight * (rows + 0.5);
13805
+ if (fullMeasureHeight <= rowMeasureHeight) {
13806
+ setStatus(
13807
+ 100
13808
+ /* STABLE_NO_ELLIPSIS */
13809
+ );
13810
+ } else {
13811
+ setMaxHeight(rowMeasureHeight);
13812
+ setStatus(
13813
+ 2
13814
+ /* MEASURE_WALKING */
13815
+ );
13816
+ }
13817
+ }
13818
+ }, [status]);
13819
+ React__default.useLayoutEffect(() => {
13820
+ var _a;
13821
+ if (status === 2) {
13822
+ const diff = walkingIndexes[1] - walkingIndexes[0];
13823
+ const midHeight = ((_a = midMeasureRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
13824
+ if (diff > 1) {
13825
+ if (midHeight > maxHeight) {
13826
+ setWalkingIndexes([walkingIndexes[0], midIndex]);
13827
+ } else {
13828
+ setWalkingIndexes([midIndex, walkingIndexes[1]]);
13829
+ }
13830
+ } else {
13831
+ if (midHeight > maxHeight) {
13832
+ setWalkingIndexes([walkingIndexes[0], walkingIndexes[0]]);
13833
+ } else {
13834
+ setWalkingIndexes([walkingIndexes[1], walkingIndexes[1]]);
13835
+ }
13836
+ setStatus(
13837
+ 99
13838
+ /* STABLE_ELLIPSIS */
13839
+ );
13840
+ }
13841
+ }
13842
+ }, [status, walkingIndexes]);
13843
+ const renderContent = (index2) => {
13844
+ const prefixContent = contentChars.slice(0, index2);
13845
+ const suffixContent = contentChars.slice(contentChars.length - index2);
13846
+ return React__default.createElement(React__default.Fragment, null, direction === "start" && React__default.createElement(React__default.Fragment, null, expandNode, ELLIPSIS_TEXT), direction !== "start" && prefixContent.join(""), direction === "middle" && React__default.createElement(React__default.Fragment, null, ELLIPSIS_TEXT, expandNode, ELLIPSIS_TEXT), direction !== "end" && suffixContent.join(""), direction === "end" && React__default.createElement(React__default.Fragment, null, ELLIPSIS_TEXT, expandNode));
13847
+ };
13848
+ const finalContent = React__default.useMemo(() => {
13849
+ if (expanded || status === 100) {
13850
+ return React__default.createElement(React__default.Fragment, {
13851
+ key: "display"
13852
+ }, content, status === 99 && collapseNode);
13853
+ }
13854
+ if (status === 99) {
13855
+ return renderContent(midIndex);
13856
+ }
13857
+ return null;
13858
+ }, [expanded, status, content, collapseNode, midIndex]);
13859
+ const allNodes = React__default.createElement(React__default.Fragment, null, status === 1 && React__default.createElement("div", {
13860
+ key: "full",
13861
+ "aria-hidden": true,
13862
+ ref: fullMeasureRef,
13863
+ style: measureStyle
13864
+ }, content, expandNode), status === 1 && React__default.createElement("div", {
13865
+ key: "stable",
13866
+ "aria-hidden": true,
13867
+ ref: singleRowMeasureRef,
13868
+ style: measureStyle
13869
+ }, " "), status === 2 && React__default.createElement("div", {
13870
+ key: "walking-mid",
13871
+ "aria-hidden": true,
13872
+ ref: midMeasureRef,
13873
+ style: measureStyle
13874
+ }, renderContent(midIndex)), finalContent);
13875
+ return [allNodes, startMeasure];
13876
+ }
13759
13877
  const classPrefix$U = `adm-ellipsis`;
13760
13878
  const defaultProps$F = {
13761
13879
  direction: "end",
@@ -13770,140 +13888,40 @@ const defaultProps$F = {
13770
13888
  };
13771
13889
  const Ellipsis = (p) => {
13772
13890
  const props = mergeProps(defaultProps$F, p);
13773
- const rootRef = useRef(null);
13774
- const expandElRef = useRef(null);
13775
- const collapseElRef = useRef(null);
13776
- const [ellipsised, setEllipsised] = useState({});
13777
- const [expanded, setExpanded] = useState(props.defaultExpanded);
13778
- const [exceeded, setExceeded] = useState(false);
13779
- const chars = useMemo(() => runes(props.content), [props.content]);
13780
- function getSubString(start2, end) {
13781
- return chars.slice(start2, end).join("");
13782
- }
13783
- function calcEllipsised() {
13784
- var _a, _b;
13785
- const root2 = rootRef.current;
13786
- if (!root2)
13787
- return;
13788
- const originDisplay = root2.style.display;
13789
- root2.style.display = "block";
13790
- const originStyle = window.getComputedStyle(root2);
13791
- const container = document.createElement("div");
13792
- const styleNames = Array.prototype.slice.apply(originStyle);
13793
- styleNames.forEach((name) => {
13794
- container.style.setProperty(name, originStyle.getPropertyValue(name));
13795
- });
13796
- root2.style.display = originDisplay;
13797
- container.style.height = "auto";
13798
- container.style.minHeight = "auto";
13799
- container.style.maxHeight = "auto";
13800
- container.style.textOverflow = "clip";
13801
- container.style.webkitLineClamp = "unset";
13802
- container.style.display = "block";
13803
- const lineHeight = pxToNumber(originStyle.lineHeight);
13804
- const maxHeight = Math.floor(lineHeight * (props.rows + 0.5) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom));
13805
- container.innerText = props.content;
13806
- document.body.appendChild(container);
13807
- if (container.offsetHeight <= maxHeight) {
13808
- setExceeded(false);
13809
- } else {
13810
- let check = function(left, right) {
13811
- if (right - left <= 1) {
13812
- if (props.direction === "end") {
13813
- return {
13814
- leading: getSubString(0, left) + "..."
13815
- };
13816
- } else {
13817
- return {
13818
- tailing: "..." + getSubString(right, end)
13819
- };
13820
- }
13821
- }
13822
- const middle2 = Math.round((left + right) / 2);
13823
- if (props.direction === "end") {
13824
- container.innerHTML = getSubString(0, middle2) + "..." + actionText;
13825
- } else {
13826
- container.innerHTML = actionText + "..." + getSubString(middle2, end);
13827
- }
13828
- if (container.offsetHeight <= maxHeight) {
13829
- if (props.direction === "end") {
13830
- return check(middle2, right);
13831
- } else {
13832
- return check(left, middle2);
13833
- }
13834
- } else {
13835
- if (props.direction === "end") {
13836
- return check(left, middle2);
13837
- } else {
13838
- return check(middle2, right);
13839
- }
13840
- }
13841
- }, checkMiddle = function(leftPart, rightPart) {
13842
- if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
13843
- return {
13844
- leading: getSubString(0, leftPart[0]) + "...",
13845
- tailing: "..." + getSubString(rightPart[1], end)
13846
- };
13847
- }
13848
- const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
13849
- const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
13850
- container.innerHTML = getSubString(0, leftPartMiddle) + "..." + actionText + "..." + getSubString(rightPartMiddle, end);
13851
- if (container.offsetHeight <= maxHeight) {
13852
- return checkMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
13853
- } else {
13854
- return checkMiddle([leftPart[0], leftPartMiddle], [rightPartMiddle, rightPart[1]]);
13855
- }
13856
- };
13857
- setExceeded(true);
13858
- const end = props.content.length;
13859
- const collapseEl = typeof props.collapseText === "string" ? props.collapseText : (_a = collapseElRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML;
13860
- const expandEl = typeof props.expandText === "string" ? props.expandText : (_b = expandElRef.current) === null || _b === void 0 ? void 0 : _b.innerHTML;
13861
- const actionText = expanded ? collapseEl : expandEl;
13862
- const middle = Math.floor((0 + end) / 2);
13863
- const ellipsised2 = props.direction === "middle" ? checkMiddle([0, middle], [middle, end]) : check(0, end);
13864
- setEllipsised(ellipsised2);
13865
- }
13866
- document.body.removeChild(container);
13867
- }
13868
- useResizeEffect(calcEllipsised, rootRef);
13869
- useIsomorphicLayoutEffect$3(() => {
13870
- calcEllipsised();
13871
- }, [props.content, props.direction, props.rows, props.expandText, props.collapseText]);
13872
- const expandActionElement = !!props.expandText && withStopPropagation(props.stopPropagationForActionButtons, React__default.createElement("a", {
13873
- ref: expandElRef,
13891
+ const {
13892
+ content,
13893
+ direction,
13894
+ rows,
13895
+ expandText,
13896
+ collapseText,
13897
+ stopPropagationForActionButtons,
13898
+ onContentClick,
13899
+ defaultExpanded
13900
+ } = props;
13901
+ const rootRef = React__default.useRef(null);
13902
+ const [expanded, setExpanded] = React__default.useState(defaultExpanded);
13903
+ const expandNode = expandText ? withStopPropagation(stopPropagationForActionButtons, React__default.createElement("a", {
13874
13904
  onClick: () => {
13875
13905
  setExpanded(true);
13876
13906
  }
13877
- }, props.expandText));
13878
- const collapseActionElement = !!props.collapseText && withStopPropagation(props.stopPropagationForActionButtons, React__default.createElement("a", {
13879
- ref: collapseElRef,
13907
+ }, expandText)) : null;
13908
+ const collapseNode = collapseText ? withStopPropagation(stopPropagationForActionButtons, React__default.createElement("a", {
13880
13909
  onClick: () => {
13881
13910
  setExpanded(false);
13882
13911
  }
13883
- }, props.collapseText));
13884
- const renderContent = () => {
13885
- if (!exceeded)
13886
- return props.content;
13887
- if (expanded)
13888
- return React__default.createElement(React__default.Fragment, null, props.content, collapseActionElement);
13889
- return React__default.createElement(React__default.Fragment, null, ellipsised.leading, expandActionElement, ellipsised.tailing);
13890
- };
13912
+ }, collapseText)) : null;
13913
+ const [measureNodes, forceResize] = useMeasure(rootRef, content, rows, direction, expanded, expandNode, collapseNode);
13914
+ useResizeEffect(forceResize, rootRef);
13891
13915
  return withNativeProps(props, React__default.createElement("div", {
13892
13916
  ref: rootRef,
13893
13917
  className: classPrefix$U,
13894
13918
  onClick: (e2) => {
13895
13919
  if (e2.target === e2.currentTarget) {
13896
- props.onContentClick(e2);
13920
+ onContentClick(e2);
13897
13921
  }
13898
13922
  }
13899
- }, renderContent()));
13923
+ }, measureNodes));
13900
13924
  };
13901
- function pxToNumber(value) {
13902
- if (!value)
13903
- return 0;
13904
- const match = value.match(/^\d*(\.\d*)?/);
13905
- return match ? Number(match[0]) : 0;
13906
- }
13907
13925
  const EmptyIcon = (props) => {
13908
13926
  return withNativeProps(props, React__default.createElement("svg", {
13909
13927
  viewBox: "0 0 64 41"
@@ -14609,25 +14627,27 @@ const FloatingPanel = forwardRef((p, ref) => {
14609
14627
  var _a, _b;
14610
14628
  const props = mergeProps(defaultProps$C, p);
14611
14629
  const {
14612
- anchors
14630
+ anchors,
14631
+ placement = "bottom"
14613
14632
  } = props;
14614
14633
  const maxHeight = (_a = anchors[anchors.length - 1]) !== null && _a !== void 0 ? _a : window.innerHeight;
14615
- const possibles = anchors.map((x) => -x);
14634
+ const isBottomPlacement = placement !== "top";
14635
+ const possibles = isBottomPlacement ? anchors.map((x) => -x) : anchors;
14616
14636
  const elementRef = useRef(null);
14617
14637
  const headerRef = useRef(null);
14618
14638
  const contentRef = useRef(null);
14619
14639
  const [pulling, setPulling] = useState(false);
14620
14640
  const pullingRef = useRef(false);
14621
14641
  const bounds = {
14622
- top: possibles[possibles.length - 1],
14623
- bottom: possibles[0]
14642
+ top: Math.min(...possibles),
14643
+ bottom: Math.max(...possibles)
14624
14644
  };
14625
14645
  const onHeightChange = useMemoizedFn((_b = props.onHeightChange) !== null && _b !== void 0 ? _b : () => {
14626
14646
  });
14627
14647
  const [{
14628
14648
  y
14629
14649
  }, api] = useSpring(() => ({
14630
- y: bounds.bottom,
14650
+ y: isBottomPlacement ? bounds.bottom : bounds.top,
14631
14651
  config: {
14632
14652
  tension: 300
14633
14653
  },
@@ -14699,27 +14719,36 @@ const FloatingPanel = forwardRef((p, ref) => {
14699
14719
  }
14700
14720
  }), [api]);
14701
14721
  useLockScroll(elementRef, true);
14722
+ const HeaderNode = React__default.createElement("div", {
14723
+ className: `${classPrefix$Q}-header`,
14724
+ ref: headerRef
14725
+ }, React__default.createElement("div", {
14726
+ className: `${classPrefix$Q}-bar`
14727
+ }));
14702
14728
  return withNativeProps(props, React__default.createElement(animated.div, {
14703
14729
  ref: elementRef,
14704
- className: classPrefix$Q,
14730
+ className: classNames(classPrefix$Q, `${classPrefix$Q}-${placement}`),
14705
14731
  style: {
14706
14732
  height: Math.round(maxHeight),
14707
- translateY: y.to((y2) => `calc(100% + (${Math.round(y2)}px))`)
14733
+ translateY: y.to((y2) => {
14734
+ if (isBottomPlacement) {
14735
+ return `calc(100% + (${Math.round(y2)}px))`;
14736
+ }
14737
+ if (placement === "top") {
14738
+ return `calc(-100% + (${Math.round(y2)}px))`;
14739
+ }
14740
+ return y2;
14741
+ })
14708
14742
  }
14709
14743
  }, React__default.createElement("div", {
14710
14744
  className: `${classPrefix$Q}-mask`,
14711
14745
  style: {
14712
14746
  display: pulling ? "block" : "none"
14713
14747
  }
14714
- }), React__default.createElement("div", {
14715
- className: `${classPrefix$Q}-header`,
14716
- ref: headerRef
14717
- }, React__default.createElement("div", {
14718
- className: `${classPrefix$Q}-bar`
14719
- })), React__default.createElement("div", {
14748
+ }), isBottomPlacement && HeaderNode, React__default.createElement("div", {
14720
14749
  className: `${classPrefix$Q}-content`,
14721
14750
  ref: contentRef
14722
- }, props.children)));
14751
+ }, props.children), placement === "top" && HeaderNode));
14723
14752
  });
14724
14753
  function _extends$1() {
14725
14754
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
@@ -18718,15 +18747,6 @@ function undefinedFallback(...items) {
18718
18747
  }
18719
18748
  return items[i2];
18720
18749
  }
18721
- const Arrow = memo((props) => {
18722
- return withNativeProps(props, React__default.createElement("svg", {
18723
- viewBox: "0 0 30 16"
18724
- }, React__default.createElement("g", {
18725
- fill: "currentColor"
18726
- }, React__default.createElement("path", {
18727
- d: "M0,0 L30,0 L18.07289,14.312538 C16.65863,16.009645 14.13637,16.238942 12.43926,14.824685 C12.25341,14.669808 12.08199,14.49839 11.92711,14.312538 L0,0 L0,0 Z"
18728
- }))));
18729
- });
18730
18750
  const sides = ["top", "right", "bottom", "left"];
18731
18751
  const min = Math.min;
18732
18752
  const max = Math.max;
@@ -20095,40 +20115,6 @@ const computePosition = (reference, floating, options) => {
20095
20115
  platform: platformWithCache
20096
20116
  });
20097
20117
  };
20098
- class Wrapper extends React__default.Component {
20099
- constructor() {
20100
- super(...arguments);
20101
- this.element = null;
20102
- }
20103
- componentDidMount() {
20104
- this.componentDidUpdate();
20105
- }
20106
- componentDidUpdate() {
20107
- const node = findDOMNode$1(this);
20108
- if (node instanceof Element) {
20109
- this.element = node;
20110
- } else {
20111
- this.element = null;
20112
- }
20113
- }
20114
- render() {
20115
- return React__default.Children.only(this.props.children);
20116
- }
20117
- }
20118
- const record = {
20119
- "topLeft": "top-start",
20120
- "topRight": "top-end",
20121
- "bottomLeft": "bottom-start",
20122
- "bottomRight": "bottom-end",
20123
- "leftTop": "left-start",
20124
- "leftBottom": "left-end",
20125
- "rightTop": "right-start",
20126
- "rightBottom": "right-end"
20127
- };
20128
- function normalizePlacement(placement) {
20129
- var _a;
20130
- return (_a = record[placement]) !== null && _a !== void 0 ? _a : placement;
20131
- }
20132
20118
  let tenPxTester = null;
20133
20119
  let tester = null;
20134
20120
  if (canUseDom$1) {
@@ -20154,6 +20140,49 @@ function convertPx(px) {
20154
20140
  tester.style.setProperty("--size", px.toString());
20155
20141
  return tester.getBoundingClientRect().height;
20156
20142
  }
20143
+ const Arrow = memo((props) => {
20144
+ return withNativeProps(props, React__default.createElement("svg", {
20145
+ viewBox: "0 0 30 16"
20146
+ }, React__default.createElement("g", {
20147
+ fill: "currentColor"
20148
+ }, React__default.createElement("path", {
20149
+ d: "M0,0 L30,0 L18.07289,14.312538 C16.65863,16.009645 14.13637,16.238942 12.43926,14.824685 C12.25341,14.669808 12.08199,14.49839 11.92711,14.312538 L0,0 L0,0 Z"
20150
+ }))));
20151
+ });
20152
+ const record = {
20153
+ "topLeft": "top-start",
20154
+ "topRight": "top-end",
20155
+ "bottomLeft": "bottom-start",
20156
+ "bottomRight": "bottom-end",
20157
+ "leftTop": "left-start",
20158
+ "leftBottom": "left-end",
20159
+ "rightTop": "right-start",
20160
+ "rightBottom": "right-end"
20161
+ };
20162
+ function normalizePlacement(placement) {
20163
+ var _a;
20164
+ return (_a = record[placement]) !== null && _a !== void 0 ? _a : placement;
20165
+ }
20166
+ class Wrapper extends React__default.Component {
20167
+ constructor() {
20168
+ super(...arguments);
20169
+ this.element = null;
20170
+ }
20171
+ componentDidMount() {
20172
+ this.componentDidUpdate();
20173
+ }
20174
+ componentDidUpdate() {
20175
+ const node = findDOMNode$1(this);
20176
+ if (node instanceof Element) {
20177
+ this.element = node;
20178
+ } else {
20179
+ this.element = null;
20180
+ }
20181
+ }
20182
+ render() {
20183
+ return React__default.Children.only(this.props.children);
20184
+ }
20185
+ }
20157
20186
  const classPrefix$O = `adm-popover`;
20158
20187
  const defaultProps$A = {
20159
20188
  placement: "top",
@@ -20268,12 +20297,12 @@ const Popover$1 = forwardRef((p, ref) => {
20268
20297
  }, [targetElement, props.trigger]);
20269
20298
  useEffect(() => {
20270
20299
  const floatingElement = floatingRef.current;
20271
- if (!targetElement || !floatingElement)
20300
+ if (!targetElement || !floatingElement || !visible)
20272
20301
  return;
20273
20302
  return autoUpdate(targetElement, floatingElement, update2, {
20274
20303
  elementResize: typeof ResizeObserver !== "undefined"
20275
20304
  });
20276
- }, [targetElement]);
20305
+ }, [targetElement, visible]);
20277
20306
  useClickAway(() => {
20278
20307
  if (!props.trigger)
20279
20308
  return;
@@ -20710,7 +20739,6 @@ const GridItem = (p) => {
20710
20739
  const Grid = attachPropertiesToComponent(Grid$1, {
20711
20740
  Item: GridItem
20712
20741
  });
20713
- const useDragAndPinch = createUseGesture([dragAction, pinchAction]);
20714
20742
  const create = () => {
20715
20743
  return [1, 0, 0, 1, 0, 0];
20716
20744
  };
@@ -20735,11 +20763,14 @@ const apply = (m, [ox, oy]) => {
20735
20763
  const multiply = (m1, m2) => {
20736
20764
  return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
20737
20765
  };
20766
+ const useDragAndPinch = createUseGesture([dragAction, pinchAction]);
20738
20767
  const classPrefix$K = `adm-image-viewer`;
20739
20768
  const Slide = (props) => {
20740
20769
  const {
20741
20770
  dragLockRef,
20742
- maxZoom
20771
+ maxZoom,
20772
+ imageRender,
20773
+ index: index2
20743
20774
  } = props;
20744
20775
  const initialMartix = useRef([]);
20745
20776
  const controlRef = useRef(null);
@@ -20944,6 +20975,9 @@ const Slide = (props) => {
20944
20975
  }
20945
20976
  }
20946
20977
  });
20978
+ const customRendering = typeof imageRender === "function" && imageRender(props.image, {
20979
+ index: index2
20980
+ });
20947
20981
  return React__default.createElement("div", {
20948
20982
  className: `${classPrefix$K}-slide`
20949
20983
  }, React__default.createElement("div", {
@@ -20954,7 +20988,7 @@ const Slide = (props) => {
20954
20988
  style: {
20955
20989
  matrix
20956
20990
  }
20957
- }, React__default.createElement("img", {
20991
+ }, customRendering ? customRendering : React__default.createElement("img", {
20958
20992
  ref: imgRef,
20959
20993
  src: props.image,
20960
20994
  draggable: false,
@@ -21032,6 +21066,8 @@ const Slides = forwardRef((props, ref) => {
21032
21066
  image,
21033
21067
  onTap: props.onTap,
21034
21068
  maxZoom: props.maxZoom,
21069
+ imageRender: props.imageRender,
21070
+ index: index2,
21035
21071
  onZoomChange: (zoom) => {
21036
21072
  if (zoom !== 1) {
21037
21073
  const index3 = Math.round(x.get() / slideWidth);
@@ -21061,10 +21097,11 @@ const ImageViewer$1 = (p) => {
21061
21097
  className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21062
21098
  }, React__default.createElement("div", {
21063
21099
  className: classNames(`${classPrefix$I}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21064
- }, props.image && React__default.createElement(Slide, {
21100
+ }, (props.image || typeof props.imageRender === "function") && React__default.createElement(Slide, {
21065
21101
  image: props.image,
21066
21102
  onTap: props.onClose,
21067
- maxZoom: props.maxZoom
21103
+ maxZoom: props.maxZoom,
21104
+ imageRender: props.imageRender
21068
21105
  })), props.image && React__default.createElement("div", {
21069
21106
  className: `${classPrefix$I}-footer`
21070
21107
  }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React__default.createElement(SafeArea, {
@@ -21109,7 +21146,8 @@ const MultiImageViewer = forwardRef((p, ref) => {
21109
21146
  onIndexChange: onSlideChange,
21110
21147
  images: props.images,
21111
21148
  onTap: props.onClose,
21112
- maxZoom: props.maxZoom
21149
+ maxZoom: props.maxZoom,
21150
+ imageRender: props.imageRender
21113
21151
  })), props.images && React__default.createElement("div", {
21114
21152
  className: `${classPrefix$I}-footer`
21115
21153
  }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index2], index2), React__default.createElement(SafeArea, {
@@ -21156,7 +21194,32 @@ const ImageViewer = attachPropertiesToComponent(ImageViewer$1, {
21156
21194
  show: showImageViewer,
21157
21195
  clear: clearImageViewer
21158
21196
  });
21159
- const classPrefix$H = `adm-image-uploader`;
21197
+ const classPrefix$H = `adm-space`;
21198
+ const defaultProps$y = {
21199
+ direction: "horizontal"
21200
+ };
21201
+ const Space = (p) => {
21202
+ const props = mergeProps(defaultProps$y, p);
21203
+ const {
21204
+ direction,
21205
+ onClick
21206
+ } = props;
21207
+ return withNativeProps(props, React__default.createElement("div", {
21208
+ className: classNames(classPrefix$H, {
21209
+ [`${classPrefix$H}-wrap`]: props.wrap,
21210
+ [`${classPrefix$H}-block`]: props.block,
21211
+ [`${classPrefix$H}-${direction}`]: true,
21212
+ [`${classPrefix$H}-align-${props.align}`]: !!props.align,
21213
+ [`${classPrefix$H}-justify-${props.justify}`]: !!props.justify
21214
+ }),
21215
+ onClick
21216
+ }, React__default.Children.map(props.children, (child) => {
21217
+ return child !== null && child !== void 0 && React__default.createElement("div", {
21218
+ className: `${classPrefix$H}-item`
21219
+ }, child);
21220
+ })));
21221
+ };
21222
+ const classPrefix$G = `adm-image-uploader`;
21160
21223
  const PreviewItem = (props) => {
21161
21224
  const {
21162
21225
  locale
@@ -21186,56 +21249,31 @@ const PreviewItem = (props) => {
21186
21249
  }, [src, file]);
21187
21250
  function renderLoading() {
21188
21251
  return props.status === "pending" && React__default.createElement("div", {
21189
- className: `${classPrefix$H}-cell-mask`
21252
+ className: `${classPrefix$G}-cell-mask`
21190
21253
  }, React__default.createElement("span", {
21191
- className: `${classPrefix$H}-cell-loading`
21254
+ className: `${classPrefix$G}-cell-loading`
21192
21255
  }, React__default.createElement(SpinLoading, {
21193
21256
  color: "white"
21194
21257
  }), React__default.createElement("span", {
21195
- className: `${classPrefix$H}-cell-mask-message`
21258
+ className: `${classPrefix$G}-cell-mask-message`
21196
21259
  }, locale.ImageUploader.uploading)));
21197
21260
  }
21198
21261
  function renderDelete() {
21199
21262
  return deletable && React__default.createElement("span", {
21200
- className: `${classPrefix$H}-cell-delete`,
21263
+ className: `${classPrefix$G}-cell-delete`,
21201
21264
  onClick: onDelete
21202
21265
  }, deleteIcon);
21203
21266
  }
21204
21267
  return React__default.createElement("div", {
21205
- className: classNames(`${classPrefix$H}-cell`, props.status === "fail" && `${classPrefix$H}-cell-fail`)
21268
+ className: classNames(`${classPrefix$G}-cell`, props.status === "fail" && `${classPrefix$G}-cell-fail`)
21206
21269
  }, React__default.createElement(Image$1, {
21207
- className: `${classPrefix$H}-cell-image`,
21270
+ className: `${classPrefix$G}-cell-image`,
21208
21271
  src,
21209
21272
  fit: imageFit,
21210
21273
  onClick: props.onClick
21211
21274
  }), renderLoading(), renderDelete());
21212
21275
  };
21213
21276
  const PreviewItem$1 = PreviewItem;
21214
- const classPrefix$G = `adm-space`;
21215
- const defaultProps$y = {
21216
- direction: "horizontal"
21217
- };
21218
- const Space = (p) => {
21219
- const props = mergeProps(defaultProps$y, p);
21220
- const {
21221
- direction,
21222
- onClick
21223
- } = props;
21224
- return withNativeProps(props, React__default.createElement("div", {
21225
- className: classNames(classPrefix$G, {
21226
- [`${classPrefix$G}-wrap`]: props.wrap,
21227
- [`${classPrefix$G}-block`]: props.block,
21228
- [`${classPrefix$G}-${direction}`]: true,
21229
- [`${classPrefix$G}-align-${props.align}`]: !!props.align,
21230
- [`${classPrefix$G}-justify-${props.justify}`]: !!props.justify
21231
- }),
21232
- onClick
21233
- }, React__default.Children.map(props.children, (child) => {
21234
- return child !== null && child !== void 0 && React__default.createElement("div", {
21235
- className: `${classPrefix$G}-item`
21236
- }, child);
21237
- })));
21238
- };
21239
21277
  const classPrefix$F = `adm-image-uploader`;
21240
21278
  const defaultProps$x = {
21241
21279
  disableUpload: false,
@@ -21371,10 +21409,10 @@ const ImageUploader = forwardRef((p, ref) => {
21371
21409
  return task;
21372
21410
  });
21373
21411
  });
21374
- throw e3;
21412
+ console.error(e3);
21375
21413
  }
21376
- }))).catch((error) => console.error(error));
21377
- setValue((prev) => prev.concat(newVal));
21414
+ })));
21415
+ setValue((prev) => prev.concat(newVal).filter(Boolean));
21378
21416
  });
21379
21417
  }
21380
21418
  const imageViewerHandlerRef = useRef(null);
@@ -22509,7 +22547,8 @@ const defaultProps$o = {
22509
22547
  plain: false,
22510
22548
  error: false,
22511
22549
  seperated: false,
22512
- caret: true
22550
+ caret: true,
22551
+ inputMode: "numeric"
22513
22552
  };
22514
22553
  const PasscodeInput = forwardRef((p, ref) => {
22515
22554
  const props = mergeProps(defaultProps$o, p);
@@ -22604,7 +22643,7 @@ const PasscodeInput = forwardRef((p, ref) => {
22604
22643
  value,
22605
22644
  type: "text",
22606
22645
  pattern: "[0-9]*",
22607
- inputMode: "numeric",
22646
+ inputMode: props.inputMode,
22608
22647
  onChange: (e2) => {
22609
22648
  setValue(e2.target.value.slice(0, props.length));
22610
22649
  },
@@ -25426,12 +25465,14 @@ const SwipeAction = forwardRef((p, ref) => {
25426
25465
  },
25427
25466
  triggerAllEvents: true
25428
25467
  });
25429
- function close() {
25468
+ const close = () => {
25469
+ var _a;
25430
25470
  api.start({
25431
25471
  x: 0
25432
25472
  });
25433
25473
  forceCancelDrag();
25434
- }
25474
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
25475
+ };
25435
25476
  useImperativeHandle(ref, () => ({
25436
25477
  show: (side = "right") => {
25437
25478
  var _a;