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
@@ -10148,7 +10148,6 @@ const CalendarPickerView = React$1.forwardRef((p, ref) => {
10148
10148
  })), React$1.createElement("div", {
10149
10149
  className: `${classPrefix$1f}-cells`
10150
10150
  }, presetEmptyCells, Array(monthIterator.daysInMonth()).fill(null).map((_, index2) => {
10151
- var _a3;
10152
10151
  const d = monthIterator.date(index2 + 1);
10153
10152
  let isSelect = false;
10154
10153
  let isBegin = false;
@@ -10167,22 +10166,36 @@ const CalendarPickerView = React$1.forwardRef((p, ref) => {
10167
10166
  }
10168
10167
  const disabled = props.shouldDisableDate ? props.shouldDisableDate(d.toDate()) : maxDay && d.isAfter(maxDay, "day") || minDay && d.isBefore(minDay, "day");
10169
10168
  const renderTop = () => {
10170
- var _a4;
10171
- const top = (_a4 = props.renderTop) === null || _a4 === void 0 ? void 0 : _a4.call(props, d.toDate());
10169
+ var _a3;
10170
+ if (props.renderTop === false)
10171
+ return null;
10172
+ const contentWrapper = (content) => React$1.createElement("div", {
10173
+ className: `${classPrefix$1f}-cell-top`
10174
+ }, content);
10175
+ const top = (_a3 = props.renderTop) === null || _a3 === void 0 ? void 0 : _a3.call(props, d.toDate());
10172
10176
  if (top) {
10173
- return top;
10177
+ return contentWrapper(top);
10174
10178
  }
10175
10179
  if (props.selectionMode === "range") {
10176
10180
  if (isBegin) {
10177
- return locale.Calendar.start;
10181
+ return contentWrapper(locale.Calendar.start);
10178
10182
  }
10179
10183
  if (isEnd) {
10180
- return locale.Calendar.end;
10184
+ return contentWrapper(locale.Calendar.end);
10181
10185
  }
10182
10186
  }
10183
10187
  if (d.isSame(today, "day") && !isSelect) {
10184
- return locale.Calendar.today;
10188
+ return contentWrapper(locale.Calendar.today);
10185
10189
  }
10190
+ return contentWrapper(null);
10191
+ };
10192
+ const renderBottom = () => {
10193
+ var _a3;
10194
+ if (props.renderBottom === false)
10195
+ return null;
10196
+ return React$1.createElement("div", {
10197
+ className: `${classPrefix$1f}-cell-bottom`
10198
+ }, (_a3 = props.renderBottom) === null || _a3 === void 0 ? void 0 : _a3.call(props, d.toDate()));
10186
10199
  };
10187
10200
  return React$1.createElement("div", {
10188
10201
  key: d.valueOf(),
@@ -10236,13 +10249,9 @@ const CalendarPickerView = React$1.forwardRef((p, ref) => {
10236
10249
  }
10237
10250
  }
10238
10251
  }
10239
- }, React$1.createElement("div", {
10240
- className: `${classPrefix$1f}-cell-top`
10241
- }, renderTop()), React$1.createElement("div", {
10252
+ }, renderTop(), React$1.createElement("div", {
10242
10253
  className: `${classPrefix$1f}-cell-date`
10243
- }, props.renderDate ? props.renderDate(d.toDate()) : d.date()), React$1.createElement("div", {
10244
- className: `${classPrefix$1f}-cell-bottom`
10245
- }, (_a3 = props.renderBottom) === null || _a3 === void 0 ? void 0 : _a3.call(props, d.toDate())));
10254
+ }, props.renderDate ? props.renderDate(d.toDate()) : d.date()), renderBottom());
10246
10255
  }))));
10247
10256
  monthIterator = monthIterator.add(1, "month");
10248
10257
  }
@@ -13183,7 +13192,7 @@ function convertStringArrayToDate$1(value) {
13183
13192
  const yearString = (_a = value[0]) !== null && _a !== void 0 ? _a : "1900";
13184
13193
  const weekString = (_b = value[1]) !== null && _b !== void 0 ? _b : "1";
13185
13194
  const weekdayString = (_c = value[2]) !== null && _c !== void 0 ? _c : "1";
13186
- const day = dayjs().year(parseInt(yearString)).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
13195
+ const day = dayjs(`${parseInt(yearString)}-01-01`).isoWeek(parseInt(weekString)).isoWeekday(parseInt(weekdayString)).hour(0).minute(0).second(0);
13187
13196
  return day.toDate();
13188
13197
  }
13189
13198
  const precisionLengthRecord = {
@@ -13774,6 +13783,115 @@ function betweenInclusive(i2, e2, n2) {
13774
13783
  !function(i2) {
13775
13784
  i2[i2.unit_1 = 1] = "unit_1", i2[i2.unit_2 = 2] = "unit_2", i2[i2.unit_4 = 4] = "unit_4";
13776
13785
  }(n || (n = {}));
13786
+ const ELLIPSIS_TEXT = "...";
13787
+ const measureStyle = {
13788
+ visibility: "hidden",
13789
+ whiteSpace: "inherit",
13790
+ lineHeight: "inherit",
13791
+ fontSize: "inherit"
13792
+ };
13793
+ function useMeasure(containerRef, content, rows, direction, expanded, expandNode, collapseNode) {
13794
+ const contentChars = React$1.useMemo(() => runes(content), [content]);
13795
+ const [maxHeight, setMaxHeight] = React$1.useState(0);
13796
+ const [walkingIndexes, setWalkingIndexes] = React$1.useState([0, 0]);
13797
+ const midIndex = Math.ceil((walkingIndexes[0] + walkingIndexes[1]) / 2);
13798
+ const [status, setStatus] = React$1.useState(
13799
+ 100
13800
+ /* STABLE_NO_ELLIPSIS */
13801
+ );
13802
+ const singleRowMeasureRef = React$1.useRef(null);
13803
+ const fullMeasureRef = React$1.useRef(null);
13804
+ const midMeasureRef = React$1.useRef(null);
13805
+ const startMeasure = useEvent(() => {
13806
+ ReactDOM.unstable_batchedUpdates(() => {
13807
+ setStatus(
13808
+ 1
13809
+ /* PREPARE */
13810
+ );
13811
+ setWalkingIndexes([0, direction === "middle" ? Math.ceil(contentChars.length / 2) : contentChars.length]);
13812
+ });
13813
+ });
13814
+ React$1.useLayoutEffect(() => {
13815
+ startMeasure();
13816
+ }, [contentChars, rows]);
13817
+ React$1.useLayoutEffect(() => {
13818
+ var _a, _b;
13819
+ if (status === 1) {
13820
+ const fullMeasureHeight = ((_a = fullMeasureRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
13821
+ const singleRowMeasureHeight = ((_b = singleRowMeasureRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
13822
+ const rowMeasureHeight = singleRowMeasureHeight * (rows + 0.5);
13823
+ if (fullMeasureHeight <= rowMeasureHeight) {
13824
+ setStatus(
13825
+ 100
13826
+ /* STABLE_NO_ELLIPSIS */
13827
+ );
13828
+ } else {
13829
+ setMaxHeight(rowMeasureHeight);
13830
+ setStatus(
13831
+ 2
13832
+ /* MEASURE_WALKING */
13833
+ );
13834
+ }
13835
+ }
13836
+ }, [status]);
13837
+ React$1.useLayoutEffect(() => {
13838
+ var _a;
13839
+ if (status === 2) {
13840
+ const diff = walkingIndexes[1] - walkingIndexes[0];
13841
+ const midHeight = ((_a = midMeasureRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0;
13842
+ if (diff > 1) {
13843
+ if (midHeight > maxHeight) {
13844
+ setWalkingIndexes([walkingIndexes[0], midIndex]);
13845
+ } else {
13846
+ setWalkingIndexes([midIndex, walkingIndexes[1]]);
13847
+ }
13848
+ } else {
13849
+ if (midHeight > maxHeight) {
13850
+ setWalkingIndexes([walkingIndexes[0], walkingIndexes[0]]);
13851
+ } else {
13852
+ setWalkingIndexes([walkingIndexes[1], walkingIndexes[1]]);
13853
+ }
13854
+ setStatus(
13855
+ 99
13856
+ /* STABLE_ELLIPSIS */
13857
+ );
13858
+ }
13859
+ }
13860
+ }, [status, walkingIndexes]);
13861
+ const renderContent = (index2) => {
13862
+ const prefixContent = contentChars.slice(0, index2);
13863
+ const suffixContent = contentChars.slice(contentChars.length - index2);
13864
+ return React$1.createElement(React$1.Fragment, null, direction === "start" && React$1.createElement(React$1.Fragment, null, expandNode, ELLIPSIS_TEXT), direction !== "start" && prefixContent.join(""), direction === "middle" && React$1.createElement(React$1.Fragment, null, ELLIPSIS_TEXT, expandNode, ELLIPSIS_TEXT), direction !== "end" && suffixContent.join(""), direction === "end" && React$1.createElement(React$1.Fragment, null, ELLIPSIS_TEXT, expandNode));
13865
+ };
13866
+ const finalContent = React$1.useMemo(() => {
13867
+ if (expanded || status === 100) {
13868
+ return React$1.createElement(React$1.Fragment, {
13869
+ key: "display"
13870
+ }, content, status === 99 && collapseNode);
13871
+ }
13872
+ if (status === 99) {
13873
+ return renderContent(midIndex);
13874
+ }
13875
+ return null;
13876
+ }, [expanded, status, content, collapseNode, midIndex]);
13877
+ const allNodes = React$1.createElement(React$1.Fragment, null, status === 1 && React$1.createElement("div", {
13878
+ key: "full",
13879
+ "aria-hidden": true,
13880
+ ref: fullMeasureRef,
13881
+ style: measureStyle
13882
+ }, content, expandNode), status === 1 && React$1.createElement("div", {
13883
+ key: "stable",
13884
+ "aria-hidden": true,
13885
+ ref: singleRowMeasureRef,
13886
+ style: measureStyle
13887
+ }, " "), status === 2 && React$1.createElement("div", {
13888
+ key: "walking-mid",
13889
+ "aria-hidden": true,
13890
+ ref: midMeasureRef,
13891
+ style: measureStyle
13892
+ }, renderContent(midIndex)), finalContent);
13893
+ return [allNodes, startMeasure];
13894
+ }
13777
13895
  const classPrefix$U = `adm-ellipsis`;
13778
13896
  const defaultProps$F = {
13779
13897
  direction: "end",
@@ -13788,140 +13906,40 @@ const defaultProps$F = {
13788
13906
  };
13789
13907
  const Ellipsis = (p) => {
13790
13908
  const props = mergeProps(defaultProps$F, p);
13909
+ const {
13910
+ content,
13911
+ direction,
13912
+ rows,
13913
+ expandText,
13914
+ collapseText,
13915
+ stopPropagationForActionButtons,
13916
+ onContentClick,
13917
+ defaultExpanded
13918
+ } = props;
13791
13919
  const rootRef = React$1.useRef(null);
13792
- const expandElRef = React$1.useRef(null);
13793
- const collapseElRef = React$1.useRef(null);
13794
- const [ellipsised, setEllipsised] = React$1.useState({});
13795
- const [expanded, setExpanded] = React$1.useState(props.defaultExpanded);
13796
- const [exceeded, setExceeded] = React$1.useState(false);
13797
- const chars = React$1.useMemo(() => runes(props.content), [props.content]);
13798
- function getSubString(start2, end) {
13799
- return chars.slice(start2, end).join("");
13800
- }
13801
- function calcEllipsised() {
13802
- var _a, _b;
13803
- const root2 = rootRef.current;
13804
- if (!root2)
13805
- return;
13806
- const originDisplay = root2.style.display;
13807
- root2.style.display = "block";
13808
- const originStyle = window.getComputedStyle(root2);
13809
- const container = document.createElement("div");
13810
- const styleNames = Array.prototype.slice.apply(originStyle);
13811
- styleNames.forEach((name) => {
13812
- container.style.setProperty(name, originStyle.getPropertyValue(name));
13813
- });
13814
- root2.style.display = originDisplay;
13815
- container.style.height = "auto";
13816
- container.style.minHeight = "auto";
13817
- container.style.maxHeight = "auto";
13818
- container.style.textOverflow = "clip";
13819
- container.style.webkitLineClamp = "unset";
13820
- container.style.display = "block";
13821
- const lineHeight = pxToNumber(originStyle.lineHeight);
13822
- const maxHeight = Math.floor(lineHeight * (props.rows + 0.5) + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom));
13823
- container.innerText = props.content;
13824
- document.body.appendChild(container);
13825
- if (container.offsetHeight <= maxHeight) {
13826
- setExceeded(false);
13827
- } else {
13828
- let check = function(left, right) {
13829
- if (right - left <= 1) {
13830
- if (props.direction === "end") {
13831
- return {
13832
- leading: getSubString(0, left) + "..."
13833
- };
13834
- } else {
13835
- return {
13836
- tailing: "..." + getSubString(right, end)
13837
- };
13838
- }
13839
- }
13840
- const middle2 = Math.round((left + right) / 2);
13841
- if (props.direction === "end") {
13842
- container.innerHTML = getSubString(0, middle2) + "..." + actionText;
13843
- } else {
13844
- container.innerHTML = actionText + "..." + getSubString(middle2, end);
13845
- }
13846
- if (container.offsetHeight <= maxHeight) {
13847
- if (props.direction === "end") {
13848
- return check(middle2, right);
13849
- } else {
13850
- return check(left, middle2);
13851
- }
13852
- } else {
13853
- if (props.direction === "end") {
13854
- return check(left, middle2);
13855
- } else {
13856
- return check(middle2, right);
13857
- }
13858
- }
13859
- }, checkMiddle = function(leftPart, rightPart) {
13860
- if (leftPart[1] - leftPart[0] <= 1 && rightPart[1] - rightPart[0] <= 1) {
13861
- return {
13862
- leading: getSubString(0, leftPart[0]) + "...",
13863
- tailing: "..." + getSubString(rightPart[1], end)
13864
- };
13865
- }
13866
- const leftPartMiddle = Math.floor((leftPart[0] + leftPart[1]) / 2);
13867
- const rightPartMiddle = Math.ceil((rightPart[0] + rightPart[1]) / 2);
13868
- container.innerHTML = getSubString(0, leftPartMiddle) + "..." + actionText + "..." + getSubString(rightPartMiddle, end);
13869
- if (container.offsetHeight <= maxHeight) {
13870
- return checkMiddle([leftPartMiddle, leftPart[1]], [rightPart[0], rightPartMiddle]);
13871
- } else {
13872
- return checkMiddle([leftPart[0], leftPartMiddle], [rightPartMiddle, rightPart[1]]);
13873
- }
13874
- };
13875
- setExceeded(true);
13876
- const end = props.content.length;
13877
- const collapseEl = typeof props.collapseText === "string" ? props.collapseText : (_a = collapseElRef.current) === null || _a === void 0 ? void 0 : _a.innerHTML;
13878
- const expandEl = typeof props.expandText === "string" ? props.expandText : (_b = expandElRef.current) === null || _b === void 0 ? void 0 : _b.innerHTML;
13879
- const actionText = expanded ? collapseEl : expandEl;
13880
- const middle = Math.floor((0 + end) / 2);
13881
- const ellipsised2 = props.direction === "middle" ? checkMiddle([0, middle], [middle, end]) : check(0, end);
13882
- setEllipsised(ellipsised2);
13883
- }
13884
- document.body.removeChild(container);
13885
- }
13886
- useResizeEffect(calcEllipsised, rootRef);
13887
- useIsomorphicLayoutEffect$3(() => {
13888
- calcEllipsised();
13889
- }, [props.content, props.direction, props.rows, props.expandText, props.collapseText]);
13890
- const expandActionElement = !!props.expandText && withStopPropagation(props.stopPropagationForActionButtons, React$1.createElement("a", {
13891
- ref: expandElRef,
13920
+ const [expanded, setExpanded] = React$1.useState(defaultExpanded);
13921
+ const expandNode = expandText ? withStopPropagation(stopPropagationForActionButtons, React$1.createElement("a", {
13892
13922
  onClick: () => {
13893
13923
  setExpanded(true);
13894
13924
  }
13895
- }, props.expandText));
13896
- const collapseActionElement = !!props.collapseText && withStopPropagation(props.stopPropagationForActionButtons, React$1.createElement("a", {
13897
- ref: collapseElRef,
13925
+ }, expandText)) : null;
13926
+ const collapseNode = collapseText ? withStopPropagation(stopPropagationForActionButtons, React$1.createElement("a", {
13898
13927
  onClick: () => {
13899
13928
  setExpanded(false);
13900
13929
  }
13901
- }, props.collapseText));
13902
- const renderContent = () => {
13903
- if (!exceeded)
13904
- return props.content;
13905
- if (expanded)
13906
- return React$1.createElement(React$1.Fragment, null, props.content, collapseActionElement);
13907
- return React$1.createElement(React$1.Fragment, null, ellipsised.leading, expandActionElement, ellipsised.tailing);
13908
- };
13930
+ }, collapseText)) : null;
13931
+ const [measureNodes, forceResize] = useMeasure(rootRef, content, rows, direction, expanded, expandNode, collapseNode);
13932
+ useResizeEffect(forceResize, rootRef);
13909
13933
  return withNativeProps(props, React$1.createElement("div", {
13910
13934
  ref: rootRef,
13911
13935
  className: classPrefix$U,
13912
13936
  onClick: (e2) => {
13913
13937
  if (e2.target === e2.currentTarget) {
13914
- props.onContentClick(e2);
13938
+ onContentClick(e2);
13915
13939
  }
13916
13940
  }
13917
- }, renderContent()));
13941
+ }, measureNodes));
13918
13942
  };
13919
- function pxToNumber(value) {
13920
- if (!value)
13921
- return 0;
13922
- const match = value.match(/^\d*(\.\d*)?/);
13923
- return match ? Number(match[0]) : 0;
13924
- }
13925
13943
  const EmptyIcon = (props) => {
13926
13944
  return withNativeProps(props, React$1.createElement("svg", {
13927
13945
  viewBox: "0 0 64 41"
@@ -14627,25 +14645,27 @@ const FloatingPanel = React$1.forwardRef((p, ref) => {
14627
14645
  var _a, _b;
14628
14646
  const props = mergeProps(defaultProps$C, p);
14629
14647
  const {
14630
- anchors
14648
+ anchors,
14649
+ placement = "bottom"
14631
14650
  } = props;
14632
14651
  const maxHeight = (_a = anchors[anchors.length - 1]) !== null && _a !== void 0 ? _a : window.innerHeight;
14633
- const possibles = anchors.map((x) => -x);
14652
+ const isBottomPlacement = placement !== "top";
14653
+ const possibles = isBottomPlacement ? anchors.map((x) => -x) : anchors;
14634
14654
  const elementRef = React$1.useRef(null);
14635
14655
  const headerRef = React$1.useRef(null);
14636
14656
  const contentRef = React$1.useRef(null);
14637
14657
  const [pulling, setPulling] = React$1.useState(false);
14638
14658
  const pullingRef = React$1.useRef(false);
14639
14659
  const bounds = {
14640
- top: possibles[possibles.length - 1],
14641
- bottom: possibles[0]
14660
+ top: Math.min(...possibles),
14661
+ bottom: Math.max(...possibles)
14642
14662
  };
14643
14663
  const onHeightChange = useMemoizedFn((_b = props.onHeightChange) !== null && _b !== void 0 ? _b : () => {
14644
14664
  });
14645
14665
  const [{
14646
14666
  y
14647
14667
  }, api] = useSpring(() => ({
14648
- y: bounds.bottom,
14668
+ y: isBottomPlacement ? bounds.bottom : bounds.top,
14649
14669
  config: {
14650
14670
  tension: 300
14651
14671
  },
@@ -14717,27 +14737,36 @@ const FloatingPanel = React$1.forwardRef((p, ref) => {
14717
14737
  }
14718
14738
  }), [api]);
14719
14739
  useLockScroll(elementRef, true);
14740
+ const HeaderNode = React$1.createElement("div", {
14741
+ className: `${classPrefix$Q}-header`,
14742
+ ref: headerRef
14743
+ }, React$1.createElement("div", {
14744
+ className: `${classPrefix$Q}-bar`
14745
+ }));
14720
14746
  return withNativeProps(props, React$1.createElement(animated.div, {
14721
14747
  ref: elementRef,
14722
- className: classPrefix$Q,
14748
+ className: classNames(classPrefix$Q, `${classPrefix$Q}-${placement}`),
14723
14749
  style: {
14724
14750
  height: Math.round(maxHeight),
14725
- translateY: y.to((y2) => `calc(100% + (${Math.round(y2)}px))`)
14751
+ translateY: y.to((y2) => {
14752
+ if (isBottomPlacement) {
14753
+ return `calc(100% + (${Math.round(y2)}px))`;
14754
+ }
14755
+ if (placement === "top") {
14756
+ return `calc(-100% + (${Math.round(y2)}px))`;
14757
+ }
14758
+ return y2;
14759
+ })
14726
14760
  }
14727
14761
  }, React$1.createElement("div", {
14728
14762
  className: `${classPrefix$Q}-mask`,
14729
14763
  style: {
14730
14764
  display: pulling ? "block" : "none"
14731
14765
  }
14732
- }), React$1.createElement("div", {
14733
- className: `${classPrefix$Q}-header`,
14734
- ref: headerRef
14735
- }, React$1.createElement("div", {
14736
- className: `${classPrefix$Q}-bar`
14737
- })), React$1.createElement("div", {
14766
+ }), isBottomPlacement && HeaderNode, React$1.createElement("div", {
14738
14767
  className: `${classPrefix$Q}-content`,
14739
14768
  ref: contentRef
14740
- }, props.children)));
14769
+ }, props.children), placement === "top" && HeaderNode));
14741
14770
  });
14742
14771
  function _extends$1() {
14743
14772
  _extends$1 = Object.assign ? Object.assign.bind() : function(target) {
@@ -18736,15 +18765,6 @@ function undefinedFallback(...items) {
18736
18765
  }
18737
18766
  return items[i2];
18738
18767
  }
18739
- const Arrow = React$1.memo((props) => {
18740
- return withNativeProps(props, React$1.createElement("svg", {
18741
- viewBox: "0 0 30 16"
18742
- }, React$1.createElement("g", {
18743
- fill: "currentColor"
18744
- }, React$1.createElement("path", {
18745
- 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"
18746
- }))));
18747
- });
18748
18768
  const sides = ["top", "right", "bottom", "left"];
18749
18769
  const min = Math.min;
18750
18770
  const max = Math.max;
@@ -20113,40 +20133,6 @@ const computePosition = (reference, floating, options) => {
20113
20133
  platform: platformWithCache
20114
20134
  });
20115
20135
  };
20116
- class Wrapper extends React$1.Component {
20117
- constructor() {
20118
- super(...arguments);
20119
- this.element = null;
20120
- }
20121
- componentDidMount() {
20122
- this.componentDidUpdate();
20123
- }
20124
- componentDidUpdate() {
20125
- const node = ReactDOM.findDOMNode(this);
20126
- if (node instanceof Element) {
20127
- this.element = node;
20128
- } else {
20129
- this.element = null;
20130
- }
20131
- }
20132
- render() {
20133
- return React$1.Children.only(this.props.children);
20134
- }
20135
- }
20136
- const record = {
20137
- "topLeft": "top-start",
20138
- "topRight": "top-end",
20139
- "bottomLeft": "bottom-start",
20140
- "bottomRight": "bottom-end",
20141
- "leftTop": "left-start",
20142
- "leftBottom": "left-end",
20143
- "rightTop": "right-start",
20144
- "rightBottom": "right-end"
20145
- };
20146
- function normalizePlacement(placement) {
20147
- var _a;
20148
- return (_a = record[placement]) !== null && _a !== void 0 ? _a : placement;
20149
- }
20150
20136
  let tenPxTester = null;
20151
20137
  let tester = null;
20152
20138
  if (canUseDom$1) {
@@ -20172,6 +20158,49 @@ function convertPx(px) {
20172
20158
  tester.style.setProperty("--size", px.toString());
20173
20159
  return tester.getBoundingClientRect().height;
20174
20160
  }
20161
+ const Arrow = React$1.memo((props) => {
20162
+ return withNativeProps(props, React$1.createElement("svg", {
20163
+ viewBox: "0 0 30 16"
20164
+ }, React$1.createElement("g", {
20165
+ fill: "currentColor"
20166
+ }, React$1.createElement("path", {
20167
+ 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"
20168
+ }))));
20169
+ });
20170
+ const record = {
20171
+ "topLeft": "top-start",
20172
+ "topRight": "top-end",
20173
+ "bottomLeft": "bottom-start",
20174
+ "bottomRight": "bottom-end",
20175
+ "leftTop": "left-start",
20176
+ "leftBottom": "left-end",
20177
+ "rightTop": "right-start",
20178
+ "rightBottom": "right-end"
20179
+ };
20180
+ function normalizePlacement(placement) {
20181
+ var _a;
20182
+ return (_a = record[placement]) !== null && _a !== void 0 ? _a : placement;
20183
+ }
20184
+ class Wrapper extends React$1.Component {
20185
+ constructor() {
20186
+ super(...arguments);
20187
+ this.element = null;
20188
+ }
20189
+ componentDidMount() {
20190
+ this.componentDidUpdate();
20191
+ }
20192
+ componentDidUpdate() {
20193
+ const node = ReactDOM.findDOMNode(this);
20194
+ if (node instanceof Element) {
20195
+ this.element = node;
20196
+ } else {
20197
+ this.element = null;
20198
+ }
20199
+ }
20200
+ render() {
20201
+ return React$1.Children.only(this.props.children);
20202
+ }
20203
+ }
20175
20204
  const classPrefix$O = `adm-popover`;
20176
20205
  const defaultProps$A = {
20177
20206
  placement: "top",
@@ -20286,12 +20315,12 @@ const Popover$1 = React$1.forwardRef((p, ref) => {
20286
20315
  }, [targetElement, props.trigger]);
20287
20316
  React$1.useEffect(() => {
20288
20317
  const floatingElement = floatingRef.current;
20289
- if (!targetElement || !floatingElement)
20318
+ if (!targetElement || !floatingElement || !visible)
20290
20319
  return;
20291
20320
  return autoUpdate(targetElement, floatingElement, update2, {
20292
20321
  elementResize: typeof ResizeObserver !== "undefined"
20293
20322
  });
20294
- }, [targetElement]);
20323
+ }, [targetElement, visible]);
20295
20324
  useClickAway(() => {
20296
20325
  if (!props.trigger)
20297
20326
  return;
@@ -20728,7 +20757,6 @@ const GridItem = (p) => {
20728
20757
  const Grid = attachPropertiesToComponent(Grid$1, {
20729
20758
  Item: GridItem
20730
20759
  });
20731
- const useDragAndPinch = createUseGesture([dragAction, pinchAction]);
20732
20760
  const create = () => {
20733
20761
  return [1, 0, 0, 1, 0, 0];
20734
20762
  };
@@ -20753,11 +20781,14 @@ const apply = (m, [ox, oy]) => {
20753
20781
  const multiply = (m1, m2) => {
20754
20782
  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]];
20755
20783
  };
20784
+ const useDragAndPinch = createUseGesture([dragAction, pinchAction]);
20756
20785
  const classPrefix$K = `adm-image-viewer`;
20757
20786
  const Slide = (props) => {
20758
20787
  const {
20759
20788
  dragLockRef,
20760
- maxZoom
20789
+ maxZoom,
20790
+ imageRender,
20791
+ index: index2
20761
20792
  } = props;
20762
20793
  const initialMartix = React$1.useRef([]);
20763
20794
  const controlRef = React$1.useRef(null);
@@ -20962,6 +20993,9 @@ const Slide = (props) => {
20962
20993
  }
20963
20994
  }
20964
20995
  });
20996
+ const customRendering = typeof imageRender === "function" && imageRender(props.image, {
20997
+ index: index2
20998
+ });
20965
20999
  return React$1.createElement("div", {
20966
21000
  className: `${classPrefix$K}-slide`
20967
21001
  }, React$1.createElement("div", {
@@ -20972,7 +21006,7 @@ const Slide = (props) => {
20972
21006
  style: {
20973
21007
  matrix
20974
21008
  }
20975
- }, React$1.createElement("img", {
21009
+ }, customRendering ? customRendering : React$1.createElement("img", {
20976
21010
  ref: imgRef,
20977
21011
  src: props.image,
20978
21012
  draggable: false,
@@ -21050,6 +21084,8 @@ const Slides = React$1.forwardRef((props, ref) => {
21050
21084
  image,
21051
21085
  onTap: props.onTap,
21052
21086
  maxZoom: props.maxZoom,
21087
+ imageRender: props.imageRender,
21088
+ index: index2,
21053
21089
  onZoomChange: (zoom) => {
21054
21090
  if (zoom !== 1) {
21055
21091
  const index3 = Math.round(x.get() / slideWidth);
@@ -21079,10 +21115,11 @@ const ImageViewer$1 = (p) => {
21079
21115
  className: (_a = props === null || props === void 0 ? void 0 : props.classNames) === null || _a === void 0 ? void 0 : _a.mask
21080
21116
  }, React$1.createElement("div", {
21081
21117
  className: classNames(`${classPrefix$I}-content`, (_b = props === null || props === void 0 ? void 0 : props.classNames) === null || _b === void 0 ? void 0 : _b.body)
21082
- }, props.image && React$1.createElement(Slide, {
21118
+ }, (props.image || typeof props.imageRender === "function") && React$1.createElement(Slide, {
21083
21119
  image: props.image,
21084
21120
  onTap: props.onClose,
21085
- maxZoom: props.maxZoom
21121
+ maxZoom: props.maxZoom,
21122
+ imageRender: props.imageRender
21086
21123
  })), props.image && React$1.createElement("div", {
21087
21124
  className: `${classPrefix$I}-footer`
21088
21125
  }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.image), React$1.createElement(SafeArea, {
@@ -21127,7 +21164,8 @@ const MultiImageViewer = React$1.forwardRef((p, ref) => {
21127
21164
  onIndexChange: onSlideChange,
21128
21165
  images: props.images,
21129
21166
  onTap: props.onClose,
21130
- maxZoom: props.maxZoom
21167
+ maxZoom: props.maxZoom,
21168
+ imageRender: props.imageRender
21131
21169
  })), props.images && React$1.createElement("div", {
21132
21170
  className: `${classPrefix$I}-footer`
21133
21171
  }, (_c = props.renderFooter) === null || _c === void 0 ? void 0 : _c.call(props, props.images[index2], index2), React$1.createElement(SafeArea, {
@@ -21174,7 +21212,32 @@ const ImageViewer = attachPropertiesToComponent(ImageViewer$1, {
21174
21212
  show: showImageViewer,
21175
21213
  clear: clearImageViewer
21176
21214
  });
21177
- const classPrefix$H = `adm-image-uploader`;
21215
+ const classPrefix$H = `adm-space`;
21216
+ const defaultProps$y = {
21217
+ direction: "horizontal"
21218
+ };
21219
+ const Space = (p) => {
21220
+ const props = mergeProps(defaultProps$y, p);
21221
+ const {
21222
+ direction,
21223
+ onClick
21224
+ } = props;
21225
+ return withNativeProps(props, React$1.createElement("div", {
21226
+ className: classNames(classPrefix$H, {
21227
+ [`${classPrefix$H}-wrap`]: props.wrap,
21228
+ [`${classPrefix$H}-block`]: props.block,
21229
+ [`${classPrefix$H}-${direction}`]: true,
21230
+ [`${classPrefix$H}-align-${props.align}`]: !!props.align,
21231
+ [`${classPrefix$H}-justify-${props.justify}`]: !!props.justify
21232
+ }),
21233
+ onClick
21234
+ }, React$1.Children.map(props.children, (child) => {
21235
+ return child !== null && child !== void 0 && React$1.createElement("div", {
21236
+ className: `${classPrefix$H}-item`
21237
+ }, child);
21238
+ })));
21239
+ };
21240
+ const classPrefix$G = `adm-image-uploader`;
21178
21241
  const PreviewItem = (props) => {
21179
21242
  const {
21180
21243
  locale
@@ -21204,56 +21267,31 @@ const PreviewItem = (props) => {
21204
21267
  }, [src, file]);
21205
21268
  function renderLoading() {
21206
21269
  return props.status === "pending" && React$1.createElement("div", {
21207
- className: `${classPrefix$H}-cell-mask`
21270
+ className: `${classPrefix$G}-cell-mask`
21208
21271
  }, React$1.createElement("span", {
21209
- className: `${classPrefix$H}-cell-loading`
21272
+ className: `${classPrefix$G}-cell-loading`
21210
21273
  }, React$1.createElement(SpinLoading, {
21211
21274
  color: "white"
21212
21275
  }), React$1.createElement("span", {
21213
- className: `${classPrefix$H}-cell-mask-message`
21276
+ className: `${classPrefix$G}-cell-mask-message`
21214
21277
  }, locale.ImageUploader.uploading)));
21215
21278
  }
21216
21279
  function renderDelete() {
21217
21280
  return deletable && React$1.createElement("span", {
21218
- className: `${classPrefix$H}-cell-delete`,
21281
+ className: `${classPrefix$G}-cell-delete`,
21219
21282
  onClick: onDelete
21220
21283
  }, deleteIcon);
21221
21284
  }
21222
21285
  return React$1.createElement("div", {
21223
- className: classNames(`${classPrefix$H}-cell`, props.status === "fail" && `${classPrefix$H}-cell-fail`)
21286
+ className: classNames(`${classPrefix$G}-cell`, props.status === "fail" && `${classPrefix$G}-cell-fail`)
21224
21287
  }, React$1.createElement(Image$1, {
21225
- className: `${classPrefix$H}-cell-image`,
21288
+ className: `${classPrefix$G}-cell-image`,
21226
21289
  src,
21227
21290
  fit: imageFit,
21228
21291
  onClick: props.onClick
21229
21292
  }), renderLoading(), renderDelete());
21230
21293
  };
21231
21294
  const PreviewItem$1 = PreviewItem;
21232
- const classPrefix$G = `adm-space`;
21233
- const defaultProps$y = {
21234
- direction: "horizontal"
21235
- };
21236
- const Space = (p) => {
21237
- const props = mergeProps(defaultProps$y, p);
21238
- const {
21239
- direction,
21240
- onClick
21241
- } = props;
21242
- return withNativeProps(props, React$1.createElement("div", {
21243
- className: classNames(classPrefix$G, {
21244
- [`${classPrefix$G}-wrap`]: props.wrap,
21245
- [`${classPrefix$G}-block`]: props.block,
21246
- [`${classPrefix$G}-${direction}`]: true,
21247
- [`${classPrefix$G}-align-${props.align}`]: !!props.align,
21248
- [`${classPrefix$G}-justify-${props.justify}`]: !!props.justify
21249
- }),
21250
- onClick
21251
- }, React$1.Children.map(props.children, (child) => {
21252
- return child !== null && child !== void 0 && React$1.createElement("div", {
21253
- className: `${classPrefix$G}-item`
21254
- }, child);
21255
- })));
21256
- };
21257
21295
  const classPrefix$F = `adm-image-uploader`;
21258
21296
  const defaultProps$x = {
21259
21297
  disableUpload: false,
@@ -21389,10 +21427,10 @@ const ImageUploader = React$1.forwardRef((p, ref) => {
21389
21427
  return task;
21390
21428
  });
21391
21429
  });
21392
- throw e3;
21430
+ console.error(e3);
21393
21431
  }
21394
- }))).catch((error) => console.error(error));
21395
- setValue((prev) => prev.concat(newVal));
21432
+ })));
21433
+ setValue((prev) => prev.concat(newVal).filter(Boolean));
21396
21434
  });
21397
21435
  }
21398
21436
  const imageViewerHandlerRef = React$1.useRef(null);
@@ -22527,7 +22565,8 @@ const defaultProps$o = {
22527
22565
  plain: false,
22528
22566
  error: false,
22529
22567
  seperated: false,
22530
- caret: true
22568
+ caret: true,
22569
+ inputMode: "numeric"
22531
22570
  };
22532
22571
  const PasscodeInput = React$1.forwardRef((p, ref) => {
22533
22572
  const props = mergeProps(defaultProps$o, p);
@@ -22622,7 +22661,7 @@ const PasscodeInput = React$1.forwardRef((p, ref) => {
22622
22661
  value,
22623
22662
  type: "text",
22624
22663
  pattern: "[0-9]*",
22625
- inputMode: "numeric",
22664
+ inputMode: props.inputMode,
22626
22665
  onChange: (e2) => {
22627
22666
  setValue(e2.target.value.slice(0, props.length));
22628
22667
  },
@@ -25444,12 +25483,14 @@ const SwipeAction = React$1.forwardRef((p, ref) => {
25444
25483
  },
25445
25484
  triggerAllEvents: true
25446
25485
  });
25447
- function close() {
25486
+ const close = () => {
25487
+ var _a;
25448
25488
  api.start({
25449
25489
  x: 0
25450
25490
  });
25451
25491
  forceCancelDrag();
25452
- }
25492
+ (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
25493
+ };
25453
25494
  React$1.useImperativeHandle(ref, () => ({
25454
25495
  show: (side = "right") => {
25455
25496
  var _a;