@trionesdev/antd-mobile-react 0.0.2-beta.1 → 0.0.2-beta.11

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 (203) hide show
  1. package/LICENSE +21 -21
  2. package/dist/ActionSheet/ActionSheet.d.ts +25 -0
  3. package/dist/ActionSheet/ActionSheet.js +77 -0
  4. package/dist/ActionSheet/index.d.ts +1 -1
  5. package/dist/ActionSheet/index.js +1 -1
  6. package/dist/ActionSheet/style.scss +52 -0
  7. package/dist/Avatar/demo/base.js +2 -2
  8. package/dist/Avatar/demo/style.scss +6 -6
  9. package/dist/Badge/demo/base.js +2 -2
  10. package/dist/Badge/demo/base.scss +6 -6
  11. package/dist/Button/demo/base.js +2 -2
  12. package/dist/Button/style.scss +234 -232
  13. package/dist/Calendar/calendar.js +2 -1
  14. package/dist/Calendar/style.scss +85 -85
  15. package/dist/Calendar/touchable-calendar-grid.js +9 -9
  16. package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +5 -6
  17. package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +37 -132
  18. package/dist/CalendarDatetimePicker/demo/base.js +5 -21
  19. package/dist/CalendarDatetimePicker/index.d.ts +2 -2
  20. package/dist/CalendarDatetimePicker/style.scss +10 -54
  21. package/dist/CalendarDatetimePicker/types.d.ts +0 -4
  22. package/dist/CalendarDatetimePicker/types.js +1 -6
  23. package/dist/CalendarDatetimePopup/CalendarDatetimePopup.d.ts +10 -0
  24. package/dist/CalendarDatetimePopup/CalendarDatetimePopup.js +142 -0
  25. package/dist/CalendarDatetimePopup/demo/base.js +41 -0
  26. package/dist/CalendarDatetimePopup/index.d.ts +3 -0
  27. package/dist/CalendarDatetimePopup/index.js +2 -0
  28. package/dist/CalendarDatetimePopup/style.scss +54 -0
  29. package/dist/CalendarDatetimePopup/types.d.ts +5 -0
  30. package/dist/CalendarDatetimePopup/types.js +6 -0
  31. package/dist/CalendarPopup/calendar-popup.d.ts +4 -0
  32. package/dist/{CalendarPicker/calendar-picker.js → CalendarPopup/calendar-popup.js} +2 -2
  33. package/dist/CalendarPopup/calendar-range-popup.d.ts +4 -0
  34. package/dist/{CalendarPicker/calendar-range-picker.js → CalendarPopup/calendar-range-popup.js} +8 -7
  35. package/dist/{CalendarPicker → CalendarPopup}/demo/base.js +3 -3
  36. package/dist/CalendarPopup/index.d.ts +9 -0
  37. package/dist/CalendarPopup/index.js +5 -0
  38. package/dist/CalendarPopup/style.scss +31 -0
  39. package/dist/{CalendarPicker → CalendarPopup}/types.d.ts +2 -2
  40. package/dist/Card/demo/base.js +2 -2
  41. package/dist/Card/demo/base.scss +18 -18
  42. package/dist/CascaderPicker/CascaderPicker.d.ts +25 -0
  43. package/dist/CascaderPicker/CascaderPicker.js +78 -0
  44. package/dist/CascaderPicker/demo/base.js +6 -18
  45. package/dist/CascaderPicker/index.d.ts +1 -1
  46. package/dist/CascaderPicker/index.js +1 -1
  47. package/dist/CascaderPicker/style.scss +24 -0
  48. package/dist/CascaderPopup/cascader-popup.d.ts +27 -0
  49. package/dist/CascaderPopup/cascader-popup.js +90 -0
  50. package/dist/CascaderPopup/demo/base.d.ts +3 -0
  51. package/dist/CascaderPopup/demo/base.js +82 -0
  52. package/dist/CascaderPopup/index.d.ts +3 -0
  53. package/dist/CascaderPopup/index.js +2 -0
  54. package/dist/CascaderPopup/style.scss +45 -0
  55. package/dist/Cell/demo/base.js +41 -2
  56. package/dist/Checkbox/demo/base.js +11 -6
  57. package/dist/Checkbox/demo/disabled.js +2 -1
  58. package/dist/ConfigProvider/demo/base.js +2 -2
  59. package/dist/DemoBlock/index.d.ts +6 -0
  60. package/dist/DemoBlock/index.js +9 -2
  61. package/dist/DemoBlock/index.scss +20 -20
  62. package/dist/DemoDescription/index.scss +3 -3
  63. package/dist/Divider/demo/base.js +2 -2
  64. package/dist/Ellipsis/demo/base.js +2 -2
  65. package/dist/Empty/demo/base.js +2 -2
  66. package/dist/ErrorBlock/demo/base.js +2 -2
  67. package/dist/Footer/demo/base.js +2 -2
  68. package/dist/Form/FormItem/form-item-input.d.ts +15 -0
  69. package/dist/Form/FormItem/form-item-input.js +39 -0
  70. package/dist/Form/FormItem/form-item-label.d.ts +13 -0
  71. package/dist/Form/FormItem/form-item-label.js +27 -0
  72. package/dist/Form/FormItem/form-item.d.ts +22 -0
  73. package/dist/Form/FormItem/form-item.js +73 -0
  74. package/dist/Form/FormItem/index.d.ts +5 -0
  75. package/dist/Form/FormItem/index.js +3 -0
  76. package/dist/Form/demo/input.js +1 -1
  77. package/dist/Form/index.d.ts +8 -1
  78. package/dist/Form/index.js +5 -1
  79. package/dist/Form/style.scss +67 -0
  80. package/dist/Grid/demo/base.js +2 -2
  81. package/dist/Grid/demo/base.scss +7 -7
  82. package/dist/Icon/demo/base.js +2 -2
  83. package/dist/Image/demo/base.js +2 -2
  84. package/dist/Image/demo/base.scss +4 -4
  85. package/dist/Image/style.scss +30 -30
  86. package/dist/ImagesPreview/ImagesPreview.js +2 -2
  87. package/dist/ImagesPreview/style.scss +34 -34
  88. package/dist/ImagesWall/CameraModal.js +2 -2
  89. package/dist/ImagesWall/style.scss +70 -70
  90. package/dist/Input/base-input.d.ts +13 -0
  91. package/dist/Input/base-input.js +41 -0
  92. package/dist/Input/demo/base.js +89 -13
  93. package/dist/Input/index.d.ts +14 -2
  94. package/dist/Input/index.js +11 -1
  95. package/dist/Input/index.scss +223 -0
  96. package/dist/Input/input-affix-wrapper.d.ts +11 -0
  97. package/dist/Input/input-affix-wrapper.js +37 -0
  98. package/dist/Input/input-opt.d.ts +16 -0
  99. package/dist/Input/input-opt.js +87 -0
  100. package/dist/Input/input-password.d.ts +7 -0
  101. package/dist/Input/input-password.js +48 -0
  102. package/dist/Input/input.d.ts +18 -0
  103. package/dist/Input/input.js +63 -0
  104. package/dist/Input/textarea.d.ts +15 -0
  105. package/dist/Input/textarea.js +51 -0
  106. package/dist/Input/types.d.ts +3 -0
  107. package/dist/Input/types.js +2 -0
  108. package/dist/NavBar/demo/base.scss +5 -5
  109. package/dist/NoticeBar/demo/base.js +2 -2
  110. package/dist/Overlay/Overlay.d.ts +16 -0
  111. package/dist/Overlay/Overlay.js +117 -0
  112. package/dist/Overlay/demo/base.d.ts +3 -0
  113. package/dist/{Mask → Overlay}/demo/base.js +14 -16
  114. package/dist/Overlay/index.d.ts +4 -0
  115. package/dist/Overlay/index.js +3 -0
  116. package/dist/Overlay/style.scss +20 -0
  117. package/dist/PageIndicator/demo/base.js +2 -2
  118. package/dist/Picker/index.d.ts +1 -1
  119. package/dist/Picker/index.js +1 -1
  120. package/dist/Picker/picker.d.ts +19 -0
  121. package/dist/Picker/picker.js +97 -0
  122. package/dist/Picker/style.scss +44 -0
  123. package/dist/PickerView/index.d.ts +2 -1
  124. package/dist/PickerView/index.js +1 -1
  125. package/dist/PickerView/picker-view-column-item.d.ts +7 -0
  126. package/dist/PickerView/picker-view-column-item.js +11 -0
  127. package/dist/PickerView/picker-view-column.d.ts +10 -0
  128. package/dist/PickerView/picker-view-column.js +117 -0
  129. package/dist/PickerView/picker-view.d.ts +12 -0
  130. package/dist/PickerView/picker-view.js +60 -0
  131. package/dist/PickerView/style.scss +72 -0
  132. package/dist/PickerView/types.d.ts +4 -0
  133. package/dist/PickerView/types.js +1 -0
  134. package/dist/Popup/demo/base.js +109 -27
  135. package/dist/Popup/index.d.ts +2 -1
  136. package/dist/Popup/index.js +2 -1
  137. package/dist/Popup/popup.d.ts +31 -0
  138. package/dist/Popup/popup.js +87 -0
  139. package/dist/Popup/style.scss +129 -0
  140. package/dist/Progress/index.d.ts +1 -1
  141. package/dist/Progress/index.js +1 -1
  142. package/dist/Radio/demo/base.js +2 -2
  143. package/dist/Radio/demo/base.scss +4 -4
  144. package/dist/Result/demo/base.js +2 -2
  145. package/dist/SafeArea/demo/base.scss +18 -18
  146. package/dist/ScrollView/index.d.ts +2 -1
  147. package/dist/ScrollView/index.js +1 -1
  148. package/dist/ScrollView/scroll-view.d.ts +4 -0
  149. package/dist/ScrollView/scroll-view.js +55 -0
  150. package/dist/ScrollView/style.scss +19 -0
  151. package/dist/ScrollView/types.d.ts +26 -0
  152. package/dist/ScrollView/types.js +1 -0
  153. package/dist/SideBar/index.d.ts +1 -1
  154. package/dist/SideBar/side-bar.js +6 -6
  155. package/dist/SideBar/style.scss +85 -85
  156. package/dist/Space/demo/base.js +2 -2
  157. package/dist/Swiper/style.scss +54 -54
  158. package/dist/Switch/demo/base.js +2 -2
  159. package/dist/TabBar/demo/base.js +2 -2
  160. package/dist/Tag/demo/base.js +2 -2
  161. package/dist/Tag/demo/style.scss +8 -8
  162. package/dist/Toast/style.scss +63 -63
  163. package/dist/Toast/toast-modal.js +4 -4
  164. package/dist/VerificationCodeInput/demo/base.js +2 -2
  165. package/dist/VerificationCodeInput/index.d.ts +2 -2
  166. package/dist/VerificationCodeInput/index.js +1 -1
  167. package/dist/VerificationCodeInput/style.scss +20 -0
  168. package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
  169. package/dist/VerificationCodeInput/verification-code-input.js +99 -0
  170. package/dist/WaterMark/demo/demo1.js +2 -2
  171. package/dist/WaterMark/demo/demo1.scss +6 -6
  172. package/dist/WaterMark/demo/demo2.js +2 -2
  173. package/dist/index.d.ts +9 -7
  174. package/dist/index.js +4 -3
  175. package/dist/style/variable.scss +1 -1
  176. package/dist/types.d.ts +0 -8
  177. package/dist/types.js +0 -1
  178. package/dist/utils/type.js +36 -36
  179. package/dist/utils/use-isomorphic-update-layout-effect.d.ts +1 -1
  180. package/dist/utils/with-default-props.js +4 -4
  181. package/package.json +10 -11
  182. package/readme.md +43 -43
  183. package/dist/CalendarPicker/calendar-picker.d.ts +0 -4
  184. package/dist/CalendarPicker/calendar-range-picker.d.ts +0 -4
  185. package/dist/CalendarPicker/index.d.ts +0 -9
  186. package/dist/CalendarPicker/index.js +0 -5
  187. package/dist/CalendarPicker/style.scss +0 -31
  188. package/dist/Mask/index.d.ts +0 -3
  189. package/dist/Mask/index.js +0 -2
  190. package/dist/Progress/Progress.d.ts +0 -37
  191. package/dist/Progress/Progress.js +0 -52
  192. package/dist/Progress/ProgressCircle.d.ts +0 -17
  193. package/dist/Progress/ProgressCircle.js +0 -148
  194. package/dist/Progress/ProgressLine.d.ts +0 -15
  195. package/dist/Progress/ProgressLine.js +0 -87
  196. package/dist/Progress/style.scss +0 -33
  197. package/dist/Progress/types.d.ts +0 -4
  198. package/dist/Progress/types.js +0 -2
  199. /package/dist/{CalendarDatetimePicker → CalendarDatetimePopup}/DateTimeSwitch.d.ts +0 -0
  200. /package/dist/{CalendarDatetimePicker → CalendarDatetimePopup}/DateTimeSwitch.js +0 -0
  201. /package/dist/{CalendarPicker → CalendarDatetimePopup}/demo/base.d.ts +0 -0
  202. /package/dist/{Mask → CalendarPopup}/demo/base.d.ts +0 -0
  203. /package/dist/{CalendarPicker → CalendarPopup}/types.js +0 -0
@@ -0,0 +1,54 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ $calendarDatetimePopupCls: 'triones-antm-calendar-datetime-popup';
4
+
5
+ .#{$calendarDatetimePopupCls} {
6
+ border-top-left-radius: variable.$trionesBorderRadius;
7
+ border-top-right-radius: variable.$trionesBorderRadius;
8
+
9
+ &-header {
10
+ display: flex;
11
+ justify-content: space-between;
12
+ border-bottom: 1Px solid variable.$trionesBorderColor;
13
+
14
+
15
+ &-display {
16
+ display: flex;
17
+ padding-left: 8Px;
18
+
19
+ &-date {
20
+ padding-inline: 8Px;
21
+ cursor: default;
22
+ display: flex;
23
+ align-items: center;
24
+ }
25
+
26
+ &-time {
27
+ padding-inline: 12Px;
28
+ display: flex;
29
+ align-items: center;
30
+ cursor: default;
31
+ }
32
+
33
+ &-active {
34
+ color: variable.$trionesColorText;
35
+ font-weight: bold;
36
+ background-color: variable.$trionesColorBgTextActive;
37
+ }
38
+ }
39
+
40
+ &-button {
41
+ padding: 12Px 16Px;
42
+
43
+ &-cancel {
44
+ }
45
+
46
+ &-ok {
47
+ color: variable.$trionesColorPrimary;
48
+ }
49
+ }
50
+ }
51
+ &-body {
52
+
53
+ }
54
+ }
@@ -0,0 +1,5 @@
1
+ export declare const cls = "triones-antm-calendar-datetime-popup";
2
+ export declare enum Mode {
3
+ date = 0,
4
+ time = 1
5
+ }
@@ -0,0 +1,6 @@
1
+ export var cls = 'triones-antm-calendar-datetime-popup';
2
+ export var Mode = /*#__PURE__*/function (Mode) {
3
+ Mode[Mode["date"] = 0] = "date";
4
+ Mode[Mode["time"] = 1] = "time";
5
+ return Mode;
6
+ }({});
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import './style.scss';
3
+ import { CalendarPopupProps } from './types';
4
+ export declare const CalendarPopup: FC<CalendarPopupProps>;
@@ -10,8 +10,8 @@ import Calendar from "../Calendar";
10
10
  import "./style.scss";
11
11
  import ConfigProvider from "../ConfigProvider";
12
12
  import Popup from "../Popup";
13
- var cls = 'triones-antm-calendar-picker';
14
- export var CalendarPicker = /*#__PURE__*/memo(function (_ref) {
13
+ var cls = 'triones-antm-calendar-popup';
14
+ export var CalendarPopup = /*#__PURE__*/memo(function (_ref) {
15
15
  var mouth = _ref.mouth,
16
16
  open = _ref.open,
17
17
  title = _ref.title,
@@ -0,0 +1,4 @@
1
+ import { FC } from 'react';
2
+ import './style.scss';
3
+ import { CalendarPopupRangeProps } from './types';
4
+ export declare const CalendarRangePopup: FC<CalendarPopupRangeProps>;
@@ -4,14 +4,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import React, { memo, useEffect, useRef } from "react";
8
- import Popup from "../Popup";
9
- import classNames from "classnames";
7
+ import classNames from 'classnames';
8
+ import React, { memo, useEffect, useRef } from 'react';
10
9
  import Calendar from "../Calendar";
11
- import "./style.scss";
12
10
  import ConfigProvider from "../ConfigProvider";
13
- var cls = 'triones-antm-calendar-picker';
14
- export var CalendarRangePicker = /*#__PURE__*/memo(function (_ref) {
11
+ import Popup from "../Popup";
12
+ import "./style.scss";
13
+ var cls = 'triones-antm-calendar-popup';
14
+ export var CalendarRangePopup = /*#__PURE__*/memo(function (_ref) {
15
15
  var mouth = _ref.mouth,
16
16
  open = _ref.open,
17
17
  title = _ref.title,
@@ -62,7 +62,8 @@ export var CalendarRangePicker = /*#__PURE__*/memo(function (_ref) {
62
62
  open: innerOpen,
63
63
  onClose: function onClose() {
64
64
  setInnerOpen(false);
65
- }
65
+ },
66
+ round: true
66
67
  }, /*#__PURE__*/React.createElement("div", {
67
68
  className: classNames("".concat(cls))
68
69
  }, /*#__PURE__*/React.createElement("div", {
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React from 'react';
8
8
  import { DemoBlock } from "../../DemoBlock";
9
9
  import Button from "../../Button";
10
- import CalendarPicker from "../index";
10
+ import CalendarPopup from "../index";
11
11
  import Toast from "../../Toast";
12
12
  export default (function () {
13
13
  var toastContainer = React.useRef();
@@ -23,7 +23,7 @@ export default (function () {
23
23
  ref: toastContainer
24
24
  }), /*#__PURE__*/React.createElement(DemoBlock, {
25
25
  title: "\u65E5\u671F\u9009\u62E9\u5668"
26
- }, /*#__PURE__*/React.createElement(CalendarPicker, {
26
+ }, /*#__PURE__*/React.createElement(CalendarPopup, {
27
27
  open: open,
28
28
  afterOpenChange: function afterOpenChange(o) {
29
29
  setOpen(o);
@@ -43,7 +43,7 @@ export default (function () {
43
43
  }
44
44
  }, "\u65E5\u5386\u9009\u62E9\u5668")), /*#__PURE__*/React.createElement(DemoBlock, {
45
45
  title: "\u65E5\u5386\u9009\u62E9\u5668(\u533A\u95F4)"
46
- }, /*#__PURE__*/React.createElement(CalendarPicker.Range, {
46
+ }, /*#__PURE__*/React.createElement(CalendarPopup.Range, {
47
47
  open: open2,
48
48
  afterOpenChange: function afterOpenChange(o) {
49
49
  setOpen2(o);
@@ -0,0 +1,9 @@
1
+ import { CalendarPopup as InternalCalendarPopup } from "./calendar-popup";
2
+ import { CalendarRangePopup } from "./calendar-range-popup";
3
+ import { CalendarPopupProps } from "./types";
4
+ type CompoundedComponent = typeof InternalCalendarPopup & {
5
+ Range: typeof CalendarRangePopup;
6
+ };
7
+ declare const CalendarPopup: CompoundedComponent;
8
+ export type { CalendarPopupProps };
9
+ export default CalendarPopup;
@@ -0,0 +1,5 @@
1
+ import { CalendarPopup as InternalCalendarPopup } from "./calendar-popup";
2
+ import { CalendarRangePopup } from "./calendar-range-popup";
3
+ var CalendarPopup = InternalCalendarPopup;
4
+ CalendarPopup.Range = CalendarRangePopup;
5
+ export default CalendarPopup;
@@ -0,0 +1,31 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ $calendarPopupCls: 'triones-antm-calendar-popup';
4
+
5
+ .#{$calendarPopupCls} {
6
+ border-top-left-radius: variable.$trionesBorderRadius;
7
+ border-top-right-radius: variable.$trionesBorderRadius;
8
+
9
+ &-header {
10
+ display: flex;
11
+ justify-content: space-between;
12
+ border-bottom: 1Px solid variable.$trionesBorderColor;
13
+ padding: 4Px;
14
+ &-button {
15
+ padding: 8Px 12Px;
16
+
17
+ &-cancel {
18
+ }
19
+
20
+ &-ok {
21
+ color: variable.$trionesColorPrimary;
22
+ }
23
+ }
24
+
25
+
26
+ }
27
+
28
+ &-body {
29
+ pointer-events: unset;
30
+ }
31
+ }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export type CalendarPickerProps = {
2
+ export type CalendarPopupProps = {
3
3
  mouth?: Date;
4
4
  open?: boolean;
5
5
  title?: React.ReactNode;
@@ -9,7 +9,7 @@ export type CalendarPickerProps = {
9
9
  onCancel?: () => void;
10
10
  onClose?: () => void;
11
11
  };
12
- export type CalendarPickerRangeProps = {
12
+ export type CalendarPopupRangeProps = {
13
13
  mouth?: Date;
14
14
  open?: boolean;
15
15
  title?: React.ReactNode;
@@ -1,5 +1,5 @@
1
- /**
2
- * compact: true
1
+ /**
2
+ * compact: true
3
3
  */
4
4
  import classNames from 'classnames';
5
5
  import React from 'react';
@@ -1,18 +1,18 @@
1
- $class-prefix-card: 'card-demo';
2
-
3
- .#{$class-prefix-card} {
4
- &-content {
5
- height: 50px;
6
- }
7
- &-footer {
8
- padding-top: 11px;
9
- border-top: 1px solid #e5e5e5;
10
- display: flex;
11
- justify-content: flex-end;
12
- }
13
-
14
- &-customBody {
15
- color: green;
16
- }
17
-
18
- }
1
+ $class-prefix-card: 'card-demo';
2
+
3
+ .#{$class-prefix-card} {
4
+ &-content {
5
+ height: 50px;
6
+ }
7
+ &-footer {
8
+ padding-top: 11px;
9
+ border-top: 1px solid #e5e5e5;
10
+ display: flex;
11
+ justify-content: flex-end;
12
+ }
13
+
14
+ &-customBody {
15
+ color: green;
16
+ }
17
+
18
+ }
@@ -0,0 +1,25 @@
1
+ import React, { FC } from "react";
2
+ import "./style.scss";
3
+ export type CascaderPickerProps = {
4
+ placeholder?: string;
5
+ onChange?: (value: any[]) => void;
6
+ align?: 'left' | 'right' | 'center';
7
+ className?: string;
8
+ style?: React.CSSProperties;
9
+ title?: React.ReactNode;
10
+ options?: any[];
11
+ /**
12
+ * @description 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式
13
+ * @default false
14
+ */
15
+ labelInValue?: boolean;
16
+ fieldNames?: {
17
+ value?: string;
18
+ label?: string;
19
+ children?: string;
20
+ };
21
+ columnsCount?: number;
22
+ value?: any[];
23
+ asyncRequest?: (parentValue?: any) => Promise<any>;
24
+ };
25
+ export declare const CascaderPicker: FC<CascaderPickerProps>;
@@ -0,0 +1,78 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["placeholder", "onChange", "align", "value", "labelInValue"];
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
9
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
11
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
16
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
17
+ import React, { useEffect, useState } from "react";
18
+ import classNames from "classnames";
19
+ import { isEmpty } from "lodash-es";
20
+ import CascaderPopup from "../CascaderPopup";
21
+ import "./style.scss";
22
+ var cls = 'triones-antm-cascader-picker';
23
+ export var CascaderPicker = function CascaderPicker(_ref) {
24
+ var _ref$placeholder = _ref.placeholder,
25
+ placeholder = _ref$placeholder === void 0 ? '请选择' : _ref$placeholder,
26
+ onChange = _ref.onChange,
27
+ _ref$align = _ref.align,
28
+ align = _ref$align === void 0 ? 'left' : _ref$align,
29
+ value = _ref.value,
30
+ _ref$labelInValue = _ref.labelInValue,
31
+ labelInValue = _ref$labelInValue === void 0 ? true : _ref$labelInValue,
32
+ rest = _objectWithoutProperties(_ref, _excluded);
33
+ var mergedFieldNames = _objectSpread({
34
+ value: 'value',
35
+ label: 'label',
36
+ children: 'children'
37
+ }, rest.fieldNames);
38
+ var _useState = useState(false),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ open = _useState2[0],
41
+ setOpen = _useState2[1];
42
+ var _useState3 = useState(value || []),
43
+ _useState4 = _slicedToArray(_useState3, 2),
44
+ internalValue = _useState4[0],
45
+ setInternalValue = _useState4[1];
46
+ useEffect(function () {
47
+ if ((value || []) !== (internalValue || [])) {
48
+ setInternalValue(value || []);
49
+ }
50
+ }, [value]);
51
+ var valueText = function valueText() {
52
+ if (labelInValue) {
53
+ return internalValue === null || internalValue === void 0 ? void 0 : internalValue.map(function (item) {
54
+ return item[mergedFieldNames.label];
55
+ }).join('/');
56
+ }
57
+ };
58
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CascaderPopup, _extends({}, rest, {
59
+ open: open,
60
+ value: internalValue,
61
+ labelInValue: labelInValue,
62
+ onCancel: function onCancel() {
63
+ setOpen(false);
64
+ },
65
+ onOk: function onOk(value) {
66
+ setInternalValue(value || []);
67
+ setOpen(false);
68
+ onChange === null || onChange === void 0 || onChange(value || []);
69
+ }
70
+ })), /*#__PURE__*/React.createElement("div", {
71
+ className: classNames(cls, "".concat(cls, "-").concat(align)),
72
+ onClick: function onClick() {
73
+ setOpen(true);
74
+ }
75
+ }, isEmpty(internalValue) ? /*#__PURE__*/React.createElement("div", {
76
+ className: "".concat(cls, "-placeholder")
77
+ }, placeholder) : /*#__PURE__*/React.createElement("div", null, valueText())));
78
+ };
@@ -6,8 +6,8 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React from "react";
8
8
  import { DemoBlock } from "../../DemoBlock";
9
- import Button from "../../Button";
10
9
  import CascaderPicker from "../index";
10
+ import Cell from "../../Cell";
11
11
  export default (function () {
12
12
  var _React$useState = React.useState(false),
13
13
  _React$useState2 = _slicedToArray(_React$useState, 2),
@@ -64,22 +64,10 @@ export default (function () {
64
64
  }];
65
65
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
66
66
  title: "\u57FA\u672C\u4F7F\u7528"
67
+ }, /*#__PURE__*/React.createElement(Cell, {
68
+ label: 'Label',
69
+ wrapperAlign: "right"
67
70
  }, /*#__PURE__*/React.createElement(CascaderPicker, {
68
- open: open,
69
- options: options,
70
- onOk: function onOk(value) {
71
- console.log(value);
72
- },
73
- style: {
74
- height: 300
75
- },
76
- onClose: function onClose() {
77
- setOpen(false);
78
- }
79
- }), /*#__PURE__*/React.createElement(Button, {
80
- block: true,
81
- onClick: function onClick() {
82
- setOpen(true);
83
- }
84
- }, "\u7EA7\u8054\u9009\u62E9")));
71
+ options: options
72
+ }))));
85
73
  });
@@ -1,3 +1,3 @@
1
- import { CascaderPicker, CascaderPickerProps } from "@trionesdev/antd-mobile-base-react";
1
+ import { CascaderPicker, CascaderPickerProps } from "./CascaderPicker";
2
2
  export type { CascaderPickerProps };
3
3
  export default CascaderPicker;
@@ -1,2 +1,2 @@
1
- import { CascaderPicker } from "@trionesdev/antd-mobile-base-react";
1
+ import { CascaderPicker } from "./CascaderPicker";
2
2
  export default CascaderPicker;
@@ -0,0 +1,24 @@
1
+ @use "../style/variable" as variable;
2
+ $cascaderPickerCls: 'triones-antm-cascader-picker';
3
+
4
+ .#{$cascaderPickerCls}{
5
+ width: 100%;
6
+ line-height: 1.4;
7
+ display: flex;
8
+
9
+ &-left {
10
+ justify-content: flex-start;
11
+ }
12
+
13
+ &-center {
14
+ justify-content: center;
15
+ }
16
+
17
+ &-right {
18
+ justify-content: flex-end;
19
+ }
20
+
21
+ &-placeholder{
22
+ color: variable.$trionesColorTextPlaceholder;
23
+ }
24
+ }
@@ -0,0 +1,27 @@
1
+ import React, { FC } from 'react';
2
+ import './style.scss';
3
+ export type CascaderPopupProps = {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ open?: boolean;
7
+ afterOpenChange?: (open: boolean) => void;
8
+ title?: React.ReactNode;
9
+ options?: any[];
10
+ /**
11
+ * @description 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 string 变为 { value: string, label: ReactNode } 的格式
12
+ * @default false
13
+ */
14
+ labelInValue?: boolean;
15
+ fieldNames?: {
16
+ value?: string;
17
+ label?: string;
18
+ children?: string;
19
+ };
20
+ columnsCount?: number;
21
+ value?: any[];
22
+ onOk?: (value?: any[]) => void;
23
+ onCancel?: () => void;
24
+ onClose?: () => void;
25
+ asyncRequest?: (parentValue?: any) => Promise<any>;
26
+ };
27
+ export declare const CascaderPopup: FC<CascaderPopupProps>;
@@ -0,0 +1,90 @@
1
+ import classNames from 'classnames';
2
+ import { isEqual } from 'lodash-es';
3
+ import React, { useEffect, useRef } from 'react';
4
+ import CascaderView from "../CascaderView";
5
+ import ConfigProvider from "../ConfigProvider";
6
+ import Popup from "../Popup";
7
+ import "./style.scss";
8
+ var cascaderPopupCls = 'triones-antm-cascader-popup';
9
+ export var CascaderPopup = /*#__PURE__*/React.memo(function (_ref) {
10
+ var className = _ref.className,
11
+ style = _ref.style,
12
+ _ref$open = _ref.open,
13
+ open = _ref$open === void 0 ? false : _ref$open,
14
+ afterOpenChange = _ref.afterOpenChange,
15
+ title = _ref.title,
16
+ options = _ref.options,
17
+ _ref$labelInValue = _ref.labelInValue,
18
+ labelInValue = _ref$labelInValue === void 0 ? false : _ref$labelInValue,
19
+ fieldNames = _ref.fieldNames,
20
+ columnsCount = _ref.columnsCount,
21
+ value = _ref.value,
22
+ onOk = _ref.onOk,
23
+ onCancel = _ref.onCancel,
24
+ onClose = _ref.onClose,
25
+ asyncRequest = _ref.asyncRequest;
26
+ var _ConfigProvider$useCo = ConfigProvider.useConfig(),
27
+ locale = _ConfigProvider$useCo.locale;
28
+ var internalValueRf = useRef(value);
29
+ var handleClose = function handleClose() {
30
+ onClose === null || onClose === void 0 || onClose();
31
+ };
32
+ var handleOk = function handleOk() {
33
+ onOk === null || onOk === void 0 || onOk(internalValueRf.current);
34
+ };
35
+ var handelCancel = function handelCancel() {
36
+ onCancel === null || onCancel === void 0 || onCancel();
37
+ handleClose();
38
+ };
39
+ useEffect(function () {
40
+ if (value === undefined) {
41
+ return;
42
+ }
43
+ if (isEqual(value, internalValueRf.current)) {
44
+ return;
45
+ }
46
+ internalValueRf.current = value;
47
+ }, [value]);
48
+ return /*#__PURE__*/React.createElement(Popup, {
49
+ open: open,
50
+ onClose: handleClose,
51
+ overlayClosable: true,
52
+ round: true,
53
+ styles: {
54
+ body: {
55
+ borderTopLeftRadius: 6,
56
+ borderTopRightRadius: 6
57
+ }
58
+ }
59
+ }, /*#__PURE__*/React.createElement("div", {
60
+ className: classNames(cascaderPopupCls, className),
61
+ style: style
62
+ }, /*#__PURE__*/React.createElement("div", {
63
+ className: classNames("".concat(cascaderPopupCls, "-header"))
64
+ }, /*#__PURE__*/React.createElement("a", {
65
+ className: classNames("".concat(cascaderPopupCls, "-header-button"), "".concat(cascaderPopupCls, "-header-button-cancel")),
66
+ onClick: handelCancel
67
+ }, locale.common.cancel), title && /*#__PURE__*/React.createElement("div", {
68
+ className: classNames("".concat(cascaderPopupCls, "-header-title"))
69
+ }, title), /*#__PURE__*/React.createElement("a", {
70
+ className: classNames("".concat(cascaderPopupCls, "-header-button"), "".concat(cascaderPopupCls, "-header-button-ok")),
71
+ onClick: handleOk
72
+ }, locale.common.confirm)), /*#__PURE__*/React.createElement("div", {
73
+ className: classNames("".concat(cascaderPopupCls, "-body"))
74
+ }, /*#__PURE__*/React.createElement(CascaderView
75
+ // open={ open}
76
+ , {
77
+ fieldNames: fieldNames,
78
+ options: options,
79
+ labelInValue: labelInValue,
80
+ columnsCount: columnsCount,
81
+ value: value,
82
+ onChange: function onChange(newVal) {
83
+ internalValueRf.current = newVal;
84
+ },
85
+ asyncRequest: asyncRequest,
86
+ style: {
87
+ height: '100%'
88
+ }
89
+ }))));
90
+ });
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -0,0 +1,82 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React from "react";
8
+ import { DemoBlock } from "../../DemoBlock";
9
+ import Button from "../../Button";
10
+ import { CascaderPopup } from "../cascader-popup";
11
+ export default (function () {
12
+ var _React$useState = React.useState(false),
13
+ _React$useState2 = _slicedToArray(_React$useState, 2),
14
+ open = _React$useState2[0],
15
+ setOpen = _React$useState2[1];
16
+ var options = [{
17
+ value: "jiangsu",
18
+ label: "江苏",
19
+ children: [{
20
+ value: "nanjing",
21
+ label: '南京'
22
+ }, {
23
+ value: "wuxi",
24
+ label: '无锡'
25
+ }, {
26
+ value: "changzhou",
27
+ label: '常州'
28
+ }, {
29
+ value: "suzhou",
30
+ label: '苏州',
31
+ children: [{
32
+ value: "gushu",
33
+ label: '姑苏区'
34
+ }]
35
+ }]
36
+ }, {
37
+ value: "zhejiang",
38
+ label: "浙江",
39
+ children: [{
40
+ value: "hangzhou",
41
+ label: '杭州'
42
+ }, {
43
+ value: "wenzhou",
44
+ label: '温州'
45
+ }]
46
+ }, {
47
+ value: "shanghai",
48
+ label: "上海"
49
+ }, {
50
+ value: "shandong",
51
+ label: '山东'
52
+ }, {
53
+ value: "henan",
54
+ label: '河南'
55
+ }, {
56
+ value: "hebei",
57
+ label: '河北'
58
+ }, {
59
+ value: "hunan",
60
+ label: '湖南'
61
+ }, {
62
+ value: "hubei",
63
+ label: '湖北'
64
+ }];
65
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
66
+ title: "\u57FA\u672C\u4F7F\u7528"
67
+ }, /*#__PURE__*/React.createElement(CascaderPopup, {
68
+ open: open,
69
+ options: options,
70
+ onOk: function onOk(value) {
71
+ console.log(value);
72
+ },
73
+ onClose: function onClose() {
74
+ setOpen(false);
75
+ }
76
+ }), /*#__PURE__*/React.createElement(Button, {
77
+ block: true,
78
+ onClick: function onClick() {
79
+ setOpen(true);
80
+ }
81
+ }, "\u7EA7\u8054\u9009\u62E9")));
82
+ });
@@ -0,0 +1,3 @@
1
+ import { CascaderPopup, CascaderPopupProps } from "./cascader-popup";
2
+ export type { CascaderPopupProps };
3
+ export default CascaderPopup;
@@ -0,0 +1,2 @@
1
+ import { CascaderPopup } from "./cascader-popup";
2
+ export default CascaderPopup;