antd-mobile 5.12.3 → 5.12.4

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 (70) hide show
  1. package/2x/cjs/components/badge/badge.d.ts +1 -1
  2. package/2x/cjs/components/badge/badge.js +3 -1
  3. package/2x/cjs/components/badge/index.d.ts +2 -4
  4. package/2x/cjs/components/badge/index.js +2 -4
  5. package/2x/cjs/components/button/button.d.ts +6 -4
  6. package/2x/cjs/components/button/button.js +5 -1
  7. package/2x/cjs/components/image/broken-image-icon.d.ts +1 -0
  8. package/2x/cjs/components/image/broken-image-icon.js +21 -0
  9. package/2x/cjs/components/image/image-icon.d.ts +1 -0
  10. package/2x/cjs/components/image/image-icon.js +21 -0
  11. package/2x/cjs/components/image/image.css +4 -2
  12. package/2x/cjs/components/image/image.js +6 -4
  13. package/2x/cjs/components/infinite-scroll/infinite-scroll.js +8 -6
  14. package/2x/cjs/components/search-bar/search-bar.js +3 -0
  15. package/2x/cjs/components/side-bar/side-bar.d.ts +2 -1
  16. package/2x/cjs/components/toast/toast.css +1 -1
  17. package/2x/es/components/badge/badge.d.ts +1 -1
  18. package/2x/es/components/badge/badge.js +1 -1
  19. package/2x/es/components/badge/index.d.ts +2 -4
  20. package/2x/es/components/badge/index.js +2 -3
  21. package/2x/es/components/button/button.d.ts +6 -4
  22. package/2x/es/components/button/button.js +5 -1
  23. package/2x/es/components/image/broken-image-icon.d.ts +1 -0
  24. package/2x/es/components/image/broken-image-icon.js +9 -0
  25. package/2x/es/components/image/image-icon.d.ts +1 -0
  26. package/2x/es/components/image/image-icon.js +9 -0
  27. package/2x/es/components/image/image.css +4 -2
  28. package/2x/es/components/image/image.js +4 -3
  29. package/2x/es/components/infinite-scroll/infinite-scroll.js +8 -6
  30. package/2x/es/components/search-bar/search-bar.js +3 -0
  31. package/2x/es/components/side-bar/side-bar.d.ts +2 -1
  32. package/2x/es/components/toast/toast.css +1 -1
  33. package/2x/package.json +2 -2
  34. package/bundle/antd-mobile.cjs.js +39 -16
  35. package/bundle/antd-mobile.es.js +40 -17
  36. package/bundle/style.css +5 -3
  37. package/cjs/components/badge/badge.d.ts +1 -1
  38. package/cjs/components/badge/badge.js +3 -1
  39. package/cjs/components/badge/index.d.ts +2 -4
  40. package/cjs/components/badge/index.js +2 -4
  41. package/cjs/components/button/button.d.ts +6 -4
  42. package/cjs/components/button/button.js +5 -1
  43. package/cjs/components/image/broken-image-icon.d.ts +1 -0
  44. package/cjs/components/image/broken-image-icon.js +21 -0
  45. package/cjs/components/image/image-icon.d.ts +1 -0
  46. package/cjs/components/image/image-icon.js +21 -0
  47. package/cjs/components/image/image.css +4 -2
  48. package/cjs/components/image/image.js +6 -4
  49. package/cjs/components/infinite-scroll/infinite-scroll.js +8 -6
  50. package/cjs/components/search-bar/search-bar.js +3 -0
  51. package/cjs/components/side-bar/side-bar.d.ts +2 -1
  52. package/cjs/components/toast/toast.css +1 -1
  53. package/es/components/badge/badge.d.ts +1 -1
  54. package/es/components/badge/badge.js +1 -1
  55. package/es/components/badge/index.d.ts +2 -4
  56. package/es/components/badge/index.js +2 -3
  57. package/es/components/button/button.d.ts +6 -4
  58. package/es/components/button/button.js +5 -1
  59. package/es/components/image/broken-image-icon.d.ts +1 -0
  60. package/es/components/image/broken-image-icon.js +9 -0
  61. package/es/components/image/image-icon.d.ts +1 -0
  62. package/es/components/image/image-icon.js +9 -0
  63. package/es/components/image/image.css +4 -2
  64. package/es/components/image/image.js +4 -3
  65. package/es/components/infinite-scroll/infinite-scroll.js +8 -6
  66. package/es/components/search-bar/search-bar.js +3 -0
  67. package/es/components/side-bar/side-bar.d.ts +2 -1
  68. package/es/components/toast/toast.css +1 -1
  69. package/package.json +2 -2
  70. package/umd/antd-mobile.js +1 -1
@@ -1489,11 +1489,11 @@ function useConfig() {
1489
1489
  return (_a = React$1.useContext(ConfigContext)) !== null && _a !== void 0 ? _a : getDefaultConfig();
1490
1490
  }
1491
1491
  var actionSheet = "";
1492
- function attachPropertiesToComponent(component, properties2) {
1492
+ function attachPropertiesToComponent(component, properties) {
1493
1493
  const ret = component;
1494
- for (const key in properties2) {
1495
- if (properties2.hasOwnProperty(key)) {
1496
- ret[key] = properties2[key];
1494
+ for (const key in properties) {
1495
+ if (properties.hasOwnProperty(key)) {
1496
+ ret[key] = properties[key];
1497
1497
  }
1498
1498
  }
1499
1499
  return ret;
@@ -9144,7 +9144,11 @@ const Button = React$1.forwardRef((p2, ref) => {
9144
9144
  [`${classPrefix$1d}-large`]: props.size === "large",
9145
9145
  [`${classPrefix$1d}-loading`]: loading
9146
9146
  }, `${classPrefix$1d}-shape-${props.shape}`),
9147
- disabled
9147
+ disabled,
9148
+ onMouseDown: props.onMouseDown,
9149
+ onMouseUp: props.onMouseUp,
9150
+ onTouchStart: props.onTouchStart,
9151
+ onTouchEnd: props.onTouchEnd
9148
9152
  }, loading ? React__default["default"].createElement("div", {
9149
9153
  className: `${classPrefix$1d}-loading-wrapper`
9150
9154
  }, props.loadingIcon, props.loadingText) : props.children));
@@ -9416,7 +9420,7 @@ const Avatar = (p2) => {
9416
9420
  };
9417
9421
  var badge = "";
9418
9422
  const classPrefix$18 = `adm-badge`;
9419
- const dot = Symbol();
9423
+ const dot = React__default["default"].createElement(React__default["default"].Fragment, null);
9420
9424
  const Badge$1 = (props) => {
9421
9425
  const {
9422
9426
  content,
@@ -9437,10 +9441,9 @@ const Badge$1 = (props) => {
9437
9441
  className: `${classPrefix$18}-wrap`
9438
9442
  }, children, element) : element;
9439
9443
  };
9440
- const properties = {
9444
+ var Badge = attachPropertiesToComponent(Badge$1, {
9441
9445
  dot
9442
- };
9443
- var Badge = attachPropertiesToComponent(Badge$1, properties);
9446
+ });
9444
9447
  var calendar = "";
9445
9448
  const ArrowLeft = () => {
9446
9449
  return React__default["default"].createElement("svg", {
@@ -12264,15 +12267,31 @@ const LazyDetector = (props) => {
12264
12267
  ref
12265
12268
  });
12266
12269
  };
12270
+ const ImageIcon = () => React__default["default"].createElement("svg", {
12271
+ viewBox: "0 0 48 48",
12272
+ xmlns: "http://www.w3.org/2000/svg"
12273
+ }, React__default["default"].createElement("path", {
12274
+ d: "M41.396 6.234c1.923 0 3.487 1.574 3.487 3.505v29.14c0 1.937-1.568 3.51-3.491 3.51H6.604c-1.923 0-3.487-1.573-3.487-3.51V9.745c0-1.936 1.564-3.51 3.487-3.51Zm0 2.847H6.604c-.355 0-.654.3-.654.658V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.405 2.405 0 0 1 1.933.752l4.182 4.525 7.58-11.005a2.374 2.374 0 0 1 1.96-1.01c.79 0 1.532.38 1.966 1.01L42.05 34.89V9.74a.664.664 0 0 0-.654-.658Zm-28.305 2.763a3.119 3.119 0 0 1 3.117 3.117 3.119 3.119 0 0 1-3.117 3.117 3.122 3.122 0 0 1-3.117-3.117 3.119 3.119 0 0 1 3.117-3.117Z",
12275
+ fill: "#DBDBDB",
12276
+ fillRule: "nonzero"
12277
+ }));
12278
+ const BrokenImageIcon = () => React__default["default"].createElement("svg", {
12279
+ viewBox: "0 0 48 48",
12280
+ xmlns: "http://www.w3.org/2000/svg"
12281
+ }, React__default["default"].createElement("path", {
12282
+ d: "M19.233 6.233 17.42 9.08l-10.817.001a.665.665 0 0 0-.647.562l-.007.096V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.415 2.415 0 0 1 1.807.625l.126.127 4.182 4.525 2.267-3.292 5.461 7.841-4.065 7.375H6.604c-1.86 0-3.382-1.47-3.482-3.317l-.005-.192V9.744c0-1.872 1.461-3.405 3.296-3.505l.19-.005h12.63Zm22.163 0c1.86 0 3.382 1.472 3.482 3.314l.005.192v29.14a3.507 3.507 0 0 1-3.3 3.505l-.191.006H27.789l3.63-6.587.06-.119a1.87 1.87 0 0 0-.163-1.853l-6.928-9.949 3.047-4.422a2.374 2.374 0 0 1 1.96-1.01 2.4 2.4 0 0 1 1.86.87l.106.14L42.05 34.89V9.74a.664.664 0 0 0-.654-.658H21.855l1.812-2.848h17.73Zm-28.305 5.611c.794 0 1.52.298 2.07.788l-.843 1.325-.067.114a1.87 1.87 0 0 0 .11 1.959l.848 1.217c-.556.515-1.3.83-2.118.83a3.122 3.122 0 0 1-3.117-3.116 3.119 3.119 0 0 1 3.117-3.117Z",
12283
+ fill: "#DBDBDB",
12284
+ fillRule: "nonzero"
12285
+ }));
12267
12286
  const classPrefix$S = `adm-image`;
12268
12287
  const defaultProps$H = {
12269
12288
  fit: "fill",
12270
12289
  placeholder: React__default["default"].createElement("div", {
12271
12290
  className: `${classPrefix$S}-tip`
12272
- }, React__default["default"].createElement(antdMobileIcons.PictureOutline, null)),
12291
+ }, React__default["default"].createElement(ImageIcon, null)),
12273
12292
  fallback: React__default["default"].createElement("div", {
12274
12293
  className: `${classPrefix$S}-tip`
12275
- }, React__default["default"].createElement(antdMobileIcons.PictureWrongOutline, null)),
12294
+ }, React__default["default"].createElement(BrokenImageIcon, null)),
12276
12295
  lazy: false
12277
12296
  };
12278
12297
  const Image$1 = stagedComponents.staged((p2) => {
@@ -15274,6 +15293,7 @@ const InfiniteScroll = (p2) => {
15274
15293
  const elementRef = React$1.useRef(null);
15275
15294
  const [flag, setFlag] = React$1.useState({});
15276
15295
  const nextFlagRef = React$1.useRef(flag);
15296
+ const [scrollParent, setScrollParent] = React$1.useState();
15277
15297
  const check = ahooks.useMemoizedFn(() => tslib.__awaiter(void 0, void 0, void 0, function* () {
15278
15298
  if (nextFlagRef.current !== flag)
15279
15299
  return;
@@ -15285,6 +15305,7 @@ const InfiniteScroll = (p2) => {
15285
15305
  if (!element.offsetParent)
15286
15306
  return;
15287
15307
  const parent = getScrollParent(element);
15308
+ setScrollParent(parent);
15288
15309
  if (!parent)
15289
15310
  return;
15290
15311
  const rect = element.getBoundingClientRect();
@@ -15304,17 +15325,16 @@ const InfiniteScroll = (p2) => {
15304
15325
  const element = elementRef.current;
15305
15326
  if (!element)
15306
15327
  return;
15307
- const parent = getScrollParent(element);
15308
- if (!parent)
15328
+ if (!scrollParent)
15309
15329
  return;
15310
15330
  function onScroll() {
15311
15331
  check();
15312
15332
  }
15313
- parent.addEventListener("scroll", onScroll);
15333
+ scrollParent.addEventListener("scroll", onScroll);
15314
15334
  return () => {
15315
- parent.removeEventListener("scroll", onScroll);
15335
+ scrollParent.removeEventListener("scroll", onScroll);
15316
15336
  };
15317
- }, []);
15337
+ }, [scrollParent]);
15318
15338
  return withNativeProps(props, React__default["default"].createElement("div", {
15319
15339
  className: classPrefix$w,
15320
15340
  ref: elementRef
@@ -16578,6 +16598,9 @@ const SearchBar = React$1.forwardRef((p2, ref) => {
16578
16598
  }
16579
16599
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
16580
16600
  (_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
16601
+ },
16602
+ onMouseDown: (e) => {
16603
+ e.preventDefault();
16581
16604
  }
16582
16605
  }, props.cancelText));
16583
16606
  };
@@ -6,7 +6,7 @@ import { useSpring, animated, to } from "@react-spring/web";
6
6
  import dayjs from "dayjs";
7
7
  import { isFragment, isMemo } from "react-is";
8
8
  import { useDrag, useWheel, createUseGesture, dragAction, pinchAction } from "@use-gesture/react";
9
- import { RightOutline, CheckOutline, DownOutline, PictureOutline, PictureWrongOutline, DownFill, QuestionCircleOutline, CloseOutline, AddOutline, CloseCircleFill, LeftOutline, SoundOutline, TextDeletionOutline, StarFill, CheckCircleFill, InformationCircleFill, ClockCircleFill, ExclamationCircleFill, SearchOutline, MinusOutline } from "antd-mobile-icons";
9
+ import { RightOutline, CheckOutline, DownOutline, DownFill, QuestionCircleOutline, CloseOutline, AddOutline, CloseCircleFill, LeftOutline, SoundOutline, TextDeletionOutline, StarFill, CheckCircleFill, InformationCircleFill, ClockCircleFill, ExclamationCircleFill, SearchOutline, MinusOutline } from "antd-mobile-icons";
10
10
  import { staged } from "staged-components";
11
11
  import RcForm, { List as List$2, Field, useForm, useWatch } from "rc-field-form";
12
12
  import { computePosition, offset, shift, limitShift, flip, hide, arrow, autoUpdate } from "@floating-ui/dom";
@@ -1479,11 +1479,11 @@ function useConfig() {
1479
1479
  return (_a = useContext(ConfigContext)) !== null && _a !== void 0 ? _a : getDefaultConfig();
1480
1480
  }
1481
1481
  var actionSheet = "";
1482
- function attachPropertiesToComponent(component, properties2) {
1482
+ function attachPropertiesToComponent(component, properties) {
1483
1483
  const ret = component;
1484
- for (const key in properties2) {
1485
- if (properties2.hasOwnProperty(key)) {
1486
- ret[key] = properties2[key];
1484
+ for (const key in properties) {
1485
+ if (properties.hasOwnProperty(key)) {
1486
+ ret[key] = properties[key];
1487
1487
  }
1488
1488
  }
1489
1489
  return ret;
@@ -9134,7 +9134,11 @@ const Button = forwardRef((p2, ref) => {
9134
9134
  [`${classPrefix$1d}-large`]: props.size === "large",
9135
9135
  [`${classPrefix$1d}-loading`]: loading
9136
9136
  }, `${classPrefix$1d}-shape-${props.shape}`),
9137
- disabled
9137
+ disabled,
9138
+ onMouseDown: props.onMouseDown,
9139
+ onMouseUp: props.onMouseUp,
9140
+ onTouchStart: props.onTouchStart,
9141
+ onTouchEnd: props.onTouchEnd
9138
9142
  }, loading ? React$1.createElement("div", {
9139
9143
  className: `${classPrefix$1d}-loading-wrapper`
9140
9144
  }, props.loadingIcon, props.loadingText) : props.children));
@@ -9406,7 +9410,7 @@ const Avatar = (p2) => {
9406
9410
  };
9407
9411
  var badge = "";
9408
9412
  const classPrefix$18 = `adm-badge`;
9409
- const dot = Symbol();
9413
+ const dot = React$1.createElement(React$1.Fragment, null);
9410
9414
  const Badge$1 = (props) => {
9411
9415
  const {
9412
9416
  content,
@@ -9427,10 +9431,9 @@ const Badge$1 = (props) => {
9427
9431
  className: `${classPrefix$18}-wrap`
9428
9432
  }, children, element) : element;
9429
9433
  };
9430
- const properties = {
9434
+ var Badge = attachPropertiesToComponent(Badge$1, {
9431
9435
  dot
9432
- };
9433
- var Badge = attachPropertiesToComponent(Badge$1, properties);
9436
+ });
9434
9437
  var calendar = "";
9435
9438
  const ArrowLeft = () => {
9436
9439
  return React$1.createElement("svg", {
@@ -12254,15 +12257,31 @@ const LazyDetector = (props) => {
12254
12257
  ref
12255
12258
  });
12256
12259
  };
12260
+ const ImageIcon = () => React$1.createElement("svg", {
12261
+ viewBox: "0 0 48 48",
12262
+ xmlns: "http://www.w3.org/2000/svg"
12263
+ }, React$1.createElement("path", {
12264
+ d: "M41.396 6.234c1.923 0 3.487 1.574 3.487 3.505v29.14c0 1.937-1.568 3.51-3.491 3.51H6.604c-1.923 0-3.487-1.573-3.487-3.51V9.745c0-1.936 1.564-3.51 3.487-3.51Zm0 2.847H6.604c-.355 0-.654.3-.654.658V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.405 2.405 0 0 1 1.933.752l4.182 4.525 7.58-11.005a2.374 2.374 0 0 1 1.96-1.01c.79 0 1.532.38 1.966 1.01L42.05 34.89V9.74a.664.664 0 0 0-.654-.658Zm-28.305 2.763a3.119 3.119 0 0 1 3.117 3.117 3.119 3.119 0 0 1-3.117 3.117 3.122 3.122 0 0 1-3.117-3.117 3.119 3.119 0 0 1 3.117-3.117Z",
12265
+ fill: "#DBDBDB",
12266
+ fillRule: "nonzero"
12267
+ }));
12268
+ const BrokenImageIcon = () => React$1.createElement("svg", {
12269
+ viewBox: "0 0 48 48",
12270
+ xmlns: "http://www.w3.org/2000/svg"
12271
+ }, React$1.createElement("path", {
12272
+ d: "M19.233 6.233 17.42 9.08l-10.817.001a.665.665 0 0 0-.647.562l-.007.096V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.415 2.415 0 0 1 1.807.625l.126.127 4.182 4.525 2.267-3.292 5.461 7.841-4.065 7.375H6.604c-1.86 0-3.382-1.47-3.482-3.317l-.005-.192V9.744c0-1.872 1.461-3.405 3.296-3.505l.19-.005h12.63Zm22.163 0c1.86 0 3.382 1.472 3.482 3.314l.005.192v29.14a3.507 3.507 0 0 1-3.3 3.505l-.191.006H27.789l3.63-6.587.06-.119a1.87 1.87 0 0 0-.163-1.853l-6.928-9.949 3.047-4.422a2.374 2.374 0 0 1 1.96-1.01 2.4 2.4 0 0 1 1.86.87l.106.14L42.05 34.89V9.74a.664.664 0 0 0-.654-.658H21.855l1.812-2.848h17.73Zm-28.305 5.611c.794 0 1.52.298 2.07.788l-.843 1.325-.067.114a1.87 1.87 0 0 0 .11 1.959l.848 1.217c-.556.515-1.3.83-2.118.83a3.122 3.122 0 0 1-3.117-3.116 3.119 3.119 0 0 1 3.117-3.117Z",
12273
+ fill: "#DBDBDB",
12274
+ fillRule: "nonzero"
12275
+ }));
12257
12276
  const classPrefix$S = `adm-image`;
12258
12277
  const defaultProps$H = {
12259
12278
  fit: "fill",
12260
12279
  placeholder: React$1.createElement("div", {
12261
12280
  className: `${classPrefix$S}-tip`
12262
- }, React$1.createElement(PictureOutline, null)),
12281
+ }, React$1.createElement(ImageIcon, null)),
12263
12282
  fallback: React$1.createElement("div", {
12264
12283
  className: `${classPrefix$S}-tip`
12265
- }, React$1.createElement(PictureWrongOutline, null)),
12284
+ }, React$1.createElement(BrokenImageIcon, null)),
12266
12285
  lazy: false
12267
12286
  };
12268
12287
  const Image$1 = staged((p2) => {
@@ -15264,6 +15283,7 @@ const InfiniteScroll = (p2) => {
15264
15283
  const elementRef = useRef(null);
15265
15284
  const [flag, setFlag] = useState({});
15266
15285
  const nextFlagRef = useRef(flag);
15286
+ const [scrollParent, setScrollParent] = useState();
15267
15287
  const check = useMemoizedFn(() => __awaiter(void 0, void 0, void 0, function* () {
15268
15288
  if (nextFlagRef.current !== flag)
15269
15289
  return;
@@ -15275,6 +15295,7 @@ const InfiniteScroll = (p2) => {
15275
15295
  if (!element.offsetParent)
15276
15296
  return;
15277
15297
  const parent = getScrollParent(element);
15298
+ setScrollParent(parent);
15278
15299
  if (!parent)
15279
15300
  return;
15280
15301
  const rect = element.getBoundingClientRect();
@@ -15294,17 +15315,16 @@ const InfiniteScroll = (p2) => {
15294
15315
  const element = elementRef.current;
15295
15316
  if (!element)
15296
15317
  return;
15297
- const parent = getScrollParent(element);
15298
- if (!parent)
15318
+ if (!scrollParent)
15299
15319
  return;
15300
15320
  function onScroll() {
15301
15321
  check();
15302
15322
  }
15303
- parent.addEventListener("scroll", onScroll);
15323
+ scrollParent.addEventListener("scroll", onScroll);
15304
15324
  return () => {
15305
- parent.removeEventListener("scroll", onScroll);
15325
+ scrollParent.removeEventListener("scroll", onScroll);
15306
15326
  };
15307
- }, []);
15327
+ }, [scrollParent]);
15308
15328
  return withNativeProps(props, React$1.createElement("div", {
15309
15329
  className: classPrefix$w,
15310
15330
  ref: elementRef
@@ -16568,6 +16588,9 @@ const SearchBar = forwardRef((p2, ref) => {
16568
16588
  }
16569
16589
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
16570
16590
  (_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
16591
+ },
16592
+ onMouseDown: (e) => {
16593
+ e.preventDefault();
16571
16594
  }
16572
16595
  }, props.cancelText));
16573
16596
  };
package/bundle/style.css CHANGED
@@ -1186,12 +1186,14 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
1186
1186
  }
1187
1187
  .adm-image-tip {
1188
1188
  position: relative;
1189
- background-color: #f3f3f3;
1189
+ background-color: #f5f5f5;
1190
1190
  height: 100%;
1191
1191
  min-height: 24px;
1192
1192
  min-width: 24px;
1193
1193
  }
1194
- .adm-image-tip > .antd-mobile-icon {
1194
+ .adm-image-tip > svg {
1195
+ width: 24px;
1196
+ height: 24px;
1195
1197
  position: absolute;
1196
1198
  left: 50%;
1197
1199
  top: 50%;
@@ -3756,7 +3758,7 @@ a.adm-list-item:active:not(.adm-list-item-disabled)::after {
3756
3758
  transform: translate(-50%, -50%);
3757
3759
  width: auto;
3758
3760
  min-width: 96px;
3759
- max-width: 70%;
3761
+ max-width: 200px;
3760
3762
  max-height: 70%;
3761
3763
  overflow: auto;
3762
3764
  color: white;
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
- export declare const dot: unique symbol;
3
+ export declare const dot: JSX.Element;
4
4
  export declare type BadgeProps = {
5
5
  content?: React.ReactNode | typeof dot;
6
6
  color?: string;
@@ -14,7 +14,9 @@ var _nativeProps = require("../../utils/native-props");
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
16
  const classPrefix = `adm-badge`;
17
- const dot = Symbol();
17
+
18
+ const dot = _react.default.createElement(_react.default.Fragment, null);
19
+
18
20
  exports.dot = dot;
19
21
 
20
22
  const Badge = props => {
@@ -1,9 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import './badge.less';
3
- import { dot } from './badge';
4
3
  export type { BadgeProps } from './badge';
5
- declare type Properties = {
6
- dot: typeof dot;
4
+ declare const _default: import("react").FC<import("./badge").BadgeProps> & {
5
+ dot: JSX.Element;
7
6
  };
8
- declare const _default: import("react").FC<import("./badge").BadgeProps> & Properties;
9
7
  export default _default;
@@ -11,10 +11,8 @@ var _badge2 = require("./badge");
11
11
 
12
12
  var _attachPropertiesToComponent = require("../../utils/attach-properties-to-component");
13
13
 
14
- const properties = {
14
+ var _default = (0, _attachPropertiesToComponent.attachPropertiesToComponent)(_badge2.Badge, {
15
15
  dot: _badge2.dot
16
- };
17
-
18
- var _default = (0, _attachPropertiesToComponent.attachPropertiesToComponent)(_badge2.Badge, properties);
16
+ });
19
17
 
20
18
  exports.default = _default;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
+ declare type NativeButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
3
4
  export declare type ButtonProps = {
4
5
  color?: 'default' | 'primary' | 'success' | 'warning' | 'danger';
5
6
  fill?: 'solid' | 'outline' | 'none';
@@ -9,11 +10,11 @@ export declare type ButtonProps = {
9
10
  loadingText?: string;
10
11
  loadingIcon?: React.ReactNode;
11
12
  disabled?: boolean;
12
- onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>;
13
+ onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void> | unknown;
13
14
  type?: 'submit' | 'reset' | 'button';
14
15
  shape?: 'default' | 'rounded' | 'rectangular';
15
16
  children?: React.ReactNode;
16
- } & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
17
+ } & Pick<NativeButtonProps, 'onMouseDown' | 'onMouseUp' | 'onTouchStart' | 'onTouchEnd'> & NativeProps<'--text-color' | '--background-color' | '--border-radius' | '--border-width' | '--border-style' | '--border-color'>;
17
18
  export declare type ButtonRef = {
18
19
  nativeElement: HTMLButtonElement | null;
19
20
  };
@@ -26,8 +27,9 @@ export declare const Button: React.ForwardRefExoticComponent<{
26
27
  loadingText?: string | undefined;
27
28
  loadingIcon?: React.ReactNode;
28
29
  disabled?: boolean | undefined;
29
- onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void>) | undefined;
30
+ onClick?: ((event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void | Promise<void> | unknown) | undefined;
30
31
  type?: "reset" | "submit" | "button" | undefined;
31
32
  shape?: "default" | "rounded" | "rectangular" | undefined;
32
33
  children?: React.ReactNode;
33
- } & NativeProps<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color"> & React.RefAttributes<ButtonRef>>;
34
+ } & Pick<NativeButtonProps, "onMouseDown" | "onMouseUp" | "onTouchEnd" | "onTouchStart"> & NativeProps<"--text-color" | "--background-color" | "--border-radius" | "--border-width" | "--border-style" | "--border-color"> & React.RefAttributes<ButtonRef>>;
35
+ export {};
@@ -81,7 +81,11 @@ const Button = (0, _react.forwardRef)((p, ref) => {
81
81
  [`${classPrefix}-large`]: props.size === 'large',
82
82
  [`${classPrefix}-loading`]: loading
83
83
  }, `${classPrefix}-shape-${props.shape}`),
84
- disabled: disabled
84
+ disabled: disabled,
85
+ onMouseDown: props.onMouseDown,
86
+ onMouseUp: props.onMouseUp,
87
+ onTouchStart: props.onTouchStart,
88
+ onTouchEnd: props.onTouchEnd
85
89
  }, loading ? _react.default.createElement("div", {
86
90
  className: `${classPrefix}-loading-wrapper`
87
91
  }, props.loadingIcon, props.loadingText) : props.children));
@@ -0,0 +1 @@
1
+ export declare const BrokenImageIcon: () => JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BrokenImageIcon = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const BrokenImageIcon = () => _react.default.createElement("svg", {
13
+ viewBox: '0 0 48 48',
14
+ xmlns: 'http://www.w3.org/2000/svg'
15
+ }, _react.default.createElement("path", {
16
+ d: 'M19.233 6.233 17.42 9.08l-10.817.001a.665.665 0 0 0-.647.562l-.007.096V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.415 2.415 0 0 1 1.807.625l.126.127 4.182 4.525 2.267-3.292 5.461 7.841-4.065 7.375H6.604c-1.86 0-3.382-1.47-3.482-3.317l-.005-.192V9.744c0-1.872 1.461-3.405 3.296-3.505l.19-.005h12.63Zm22.163 0c1.86 0 3.382 1.472 3.482 3.314l.005.192v29.14a3.507 3.507 0 0 1-3.3 3.505l-.191.006H27.789l3.63-6.587.06-.119a1.87 1.87 0 0 0-.163-1.853l-6.928-9.949 3.047-4.422a2.374 2.374 0 0 1 1.96-1.01 2.4 2.4 0 0 1 1.86.87l.106.14L42.05 34.89V9.74a.664.664 0 0 0-.654-.658H21.855l1.812-2.848h17.73Zm-28.305 5.611c.794 0 1.52.298 2.07.788l-.843 1.325-.067.114a1.87 1.87 0 0 0 .11 1.959l.848 1.217c-.556.515-1.3.83-2.118.83a3.122 3.122 0 0 1-3.117-3.116 3.119 3.119 0 0 1 3.117-3.117Z',
17
+ fill: '#DBDBDB',
18
+ fillRule: 'nonzero'
19
+ }));
20
+
21
+ exports.BrokenImageIcon = BrokenImageIcon;
@@ -0,0 +1 @@
1
+ export declare const ImageIcon: () => JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ImageIcon = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const ImageIcon = () => _react.default.createElement("svg", {
13
+ viewBox: '0 0 48 48',
14
+ xmlns: 'http://www.w3.org/2000/svg'
15
+ }, _react.default.createElement("path", {
16
+ d: 'M41.396 6.234c1.923 0 3.487 1.574 3.487 3.505v29.14c0 1.937-1.568 3.51-3.491 3.51H6.604c-1.923 0-3.487-1.573-3.487-3.51V9.745c0-1.936 1.564-3.51 3.487-3.51Zm0 2.847H6.604c-.355 0-.654.3-.654.658V34.9l5.989-8.707a2.373 2.373 0 0 1 1.801-1.005 2.405 2.405 0 0 1 1.933.752l4.182 4.525 7.58-11.005a2.374 2.374 0 0 1 1.96-1.01c.79 0 1.532.38 1.966 1.01L42.05 34.89V9.74a.664.664 0 0 0-.654-.658Zm-28.305 2.763a3.119 3.119 0 0 1 3.117 3.117 3.119 3.119 0 0 1-3.117 3.117 3.122 3.122 0 0 1-3.117-3.117 3.119 3.119 0 0 1 3.117-3.117Z',
17
+ fill: '#DBDBDB',
18
+ fillRule: 'nonzero'
19
+ }));
20
+
21
+ exports.ImageIcon = ImageIcon;
@@ -12,12 +12,14 @@
12
12
  }
13
13
  .adm-image-tip {
14
14
  position: relative;
15
- background-color: #f3f3f3;
15
+ background-color: #f5f5f5;
16
16
  height: 100%;
17
17
  min-height: 24px;
18
18
  min-width: 24px;
19
19
  }
20
- .adm-image-tip > .antd-mobile-icon {
20
+ .adm-image-tip > svg {
21
+ width: 24px;
22
+ height: 24px;
21
23
  position: absolute;
22
24
  left: 50%;
23
25
  top: 50%;
@@ -11,8 +11,6 @@ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _nativeProps = require("../../utils/native-props");
13
13
 
14
- var _antdMobileIcons = require("antd-mobile-icons");
15
-
16
14
  var _stagedComponents = require("staged-components");
17
15
 
18
16
  var _toCssLength = require("../../utils/to-css-length");
@@ -21,6 +19,10 @@ var _lazyDetector = require("./lazy-detector");
21
19
 
22
20
  var _useIsomorphicUpdateLayoutEffect = require("../../utils/use-isomorphic-update-layout-effect");
23
21
 
22
+ var _imageIcon = require("./image-icon");
23
+
24
+ var _brokenImageIcon = require("./broken-image-icon");
25
+
24
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
27
 
26
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -30,10 +32,10 @@ const defaultProps = {
30
32
  fit: 'fill',
31
33
  placeholder: _react.default.createElement("div", {
32
34
  className: `${classPrefix}-tip`
33
- }, _react.default.createElement(_antdMobileIcons.PictureOutline, null)),
35
+ }, _react.default.createElement(_imageIcon.ImageIcon, null)),
34
36
  fallback: _react.default.createElement("div", {
35
37
  className: `${classPrefix}-tip`
36
- }, _react.default.createElement(_antdMobileIcons.PictureWrongOutline, null)),
38
+ }, _react.default.createElement(_brokenImageIcon.BrokenImageIcon, null)),
37
39
  lazy: false
38
40
  };
39
41
  const Image = (0, _stagedComponents.staged)(p => {
@@ -47,9 +47,11 @@ const InfiniteScroll = p => {
47
47
  threshold: 250
48
48
  }, p);
49
49
  const doLoadMore = (0, _ahooks.useLockFn)(() => props.loadMore());
50
- const elementRef = (0, _react.useRef)(null);
50
+ const elementRef = (0, _react.useRef)(null); // Prevent duplicated trigger of `check` function
51
+
51
52
  const [flag, setFlag] = (0, _react.useState)({});
52
53
  const nextFlagRef = (0, _react.useRef)(flag);
54
+ const [scrollParent, setScrollParent] = (0, _react.useState)();
53
55
  const check = (0, _ahooks.useMemoizedFn)(() => (0, _tslib.__awaiter)(void 0, void 0, void 0, function* () {
54
56
  if (nextFlagRef.current !== flag) return;
55
57
  if (!props.hasMore) return;
@@ -57,6 +59,7 @@ const InfiniteScroll = p => {
57
59
  if (!element) return;
58
60
  if (!element.offsetParent) return;
59
61
  const parent = (0, _getScrollParent.getScrollParent)(element);
62
+ setScrollParent(parent);
60
63
  if (!parent) return;
61
64
  const rect = element.getBoundingClientRect();
62
65
  const elementTop = rect.top;
@@ -76,18 +79,17 @@ const InfiniteScroll = p => {
76
79
  (0, _react.useEffect)(() => {
77
80
  const element = elementRef.current;
78
81
  if (!element) return;
79
- const parent = (0, _getScrollParent.getScrollParent)(element);
80
- if (!parent) return;
82
+ if (!scrollParent) return;
81
83
 
82
84
  function onScroll() {
83
85
  check();
84
86
  }
85
87
 
86
- parent.addEventListener('scroll', onScroll);
88
+ scrollParent.addEventListener('scroll', onScroll);
87
89
  return () => {
88
- parent.removeEventListener('scroll', onScroll);
90
+ scrollParent.removeEventListener('scroll', onScroll);
89
91
  };
90
- }, []);
92
+ }, [scrollParent]);
91
93
  return (0, _nativeProps.withNativeProps)(props, _react.default.createElement("div", {
92
94
  className: classPrefix,
93
95
  ref: elementRef
@@ -96,6 +96,9 @@ const SearchBar = (0, _react.forwardRef)((p, ref) => {
96
96
 
97
97
  (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.blur();
98
98
  (_c = props.onCancel) === null || _c === void 0 ? void 0 : _c.call(props);
99
+ },
100
+ onMouseDown: e => {
101
+ e.preventDefault();
99
102
  }
100
103
  }, props.cancelText));
101
104
  };
@@ -1,10 +1,11 @@
1
1
  import { FC, ReactNode } from 'react';
2
2
  import React from 'react';
3
+ import { BadgeProps } from '../badge';
3
4
  import { NativeProps } from '../../utils/native-props';
4
5
  export declare type SideBarItemProps = {
5
6
  title?: ReactNode;
6
7
  disabled?: boolean;
7
- badge?: ReactNode;
8
+ badge?: BadgeProps['content'];
8
9
  } & NativeProps;
9
10
  export declare const SideBarItem: FC<SideBarItemProps>;
10
11
  export declare type SideBarProps = {
@@ -13,7 +13,7 @@
13
13
  transform: translate(-50%, -50%);
14
14
  width: auto;
15
15
  min-width: 96px;
16
- max-width: 70%;
16
+ max-width: 200px;
17
17
  max-height: 70%;
18
18
  overflow: auto;
19
19
  color: white;
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { NativeProps } from '../../utils/native-props';
3
- export declare const dot: unique symbol;
3
+ export declare const dot: JSX.Element;
4
4
  export declare type BadgeProps = {
5
5
  content?: React.ReactNode | typeof dot;
6
6
  color?: string;
@@ -2,7 +2,7 @@ import classNames from 'classnames';
2
2
  import React from 'react';
3
3
  import { withNativeProps } from '../../utils/native-props';
4
4
  const classPrefix = `adm-badge`;
5
- export const dot = Symbol();
5
+ export const dot = React.createElement(React.Fragment, null);
6
6
  export const Badge = props => {
7
7
  const {
8
8
  content,
@@ -1,9 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import './badge.less';
3
- import { dot } from './badge';
4
3
  export type { BadgeProps } from './badge';
5
- declare type Properties = {
6
- dot: typeof dot;
4
+ declare const _default: import("react").FC<import("./badge").BadgeProps> & {
5
+ dot: JSX.Element;
7
6
  };
8
- declare const _default: import("react").FC<import("./badge").BadgeProps> & Properties;
9
7
  export default _default;
@@ -1,7 +1,6 @@
1
1
  import "./badge.css";
2
2
  import { Badge, dot } from './badge';
3
3
  import { attachPropertiesToComponent } from '../../utils/attach-properties-to-component';
4
- const properties = {
4
+ export default attachPropertiesToComponent(Badge, {
5
5
  dot
6
- };
7
- export default attachPropertiesToComponent(Badge, properties);
6
+ });