@trionesdev/antd-mobile-react 0.0.2-beta.2 → 0.0.2-beta.21

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 (219) hide show
  1. package/dist/ActionSheet/ActionSheet.d.ts +25 -0
  2. package/dist/ActionSheet/ActionSheet.js +77 -0
  3. package/dist/ActionSheet/index.d.ts +1 -1
  4. package/dist/ActionSheet/index.js +1 -1
  5. package/dist/ActionSheet/style.scss +52 -0
  6. package/dist/Button/button.d.ts +2 -1
  7. package/dist/Button/button.js +1 -1
  8. package/dist/Button/style.scss +41 -39
  9. package/dist/Calendar/calendar-grid.d.ts +10 -9
  10. package/dist/Calendar/calendar-grid.js +41 -64
  11. package/dist/Calendar/calendar-header.d.ts +3 -2
  12. package/dist/Calendar/calendar-header.js +6 -6
  13. package/dist/Calendar/calendar-range.d.ts +4 -3
  14. package/dist/Calendar/calendar-range.js +12 -11
  15. package/dist/Calendar/calendar.d.ts +5 -4
  16. package/dist/Calendar/calendar.js +23 -14
  17. package/dist/Calendar/style.scss +4 -4
  18. package/dist/Calendar/touchable-calendar-grid.d.ts +6 -5
  19. package/dist/Calendar/touchable-calendar-grid.js +58 -50
  20. package/dist/CalendarDatetimePicker/CalendarDatetimePicker.d.ts +3 -2
  21. package/dist/CalendarDatetimePicker/CalendarDatetimePicker.js +14 -28
  22. package/dist/CalendarDatetimePicker/DateTimeSwitch.d.ts +3 -2
  23. package/dist/CalendarDatetimePicker/DateTimeSwitch.js +4 -3
  24. package/dist/CalendarDatetimePicker/demo/base.js +1 -1
  25. package/dist/CalendarDatetimePicker/style.scss +9 -9
  26. package/dist/CalendarDatetimePicker/types.d.ts +1 -1
  27. package/dist/CalendarDatetimePicker/types.js +1 -1
  28. package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.d.ts +11 -0
  29. package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.js +61 -0
  30. package/dist/{Mask → CalendarDatetimePickerCell}/demo/base.js +9 -15
  31. package/dist/CalendarDatetimePickerCell/index.d.ts +3 -0
  32. package/dist/CalendarDatetimePickerCell/index.js +2 -0
  33. package/dist/CalendarDatetimePickerCell/style.scss +10 -0
  34. package/dist/CalendarDatetimePickerCell/types.d.ts +1 -0
  35. package/dist/CalendarDatetimePickerCell/types.js +1 -0
  36. package/dist/CalendarPicker/calendar-picker.js +2 -2
  37. package/dist/CalendarPicker/calendar-range-picker.d.ts +4 -4
  38. package/dist/CalendarPicker/calendar-range-picker.js +11 -9
  39. package/dist/CalendarPicker/demo/base.js +6 -6
  40. package/dist/CalendarPicker/index.d.ts +2 -2
  41. package/dist/CalendarPicker/index.js +3 -3
  42. package/dist/CalendarPicker/style.scss +5 -5
  43. package/dist/CalendarPicker/types.d.ts +8 -7
  44. package/dist/CalendarPickerCell/CalendarPickerCell.d.ts +11 -0
  45. package/dist/CalendarPickerCell/CalendarPickerCell.js +54 -0
  46. package/dist/CalendarPickerCell/CalendarRangePickerCell.d.ts +11 -0
  47. package/dist/CalendarPickerCell/CalendarRangePickerCell.js +56 -0
  48. package/dist/CalendarPickerCell/demo/base.d.ts +3 -0
  49. package/dist/CalendarPickerCell/demo/base.js +31 -0
  50. package/dist/CalendarPickerCell/index.d.ts +8 -0
  51. package/dist/CalendarPickerCell/index.js +5 -0
  52. package/dist/CascaderPicker/cascader-picker.d.ts +27 -0
  53. package/dist/CascaderPicker/cascader-picker.js +90 -0
  54. package/dist/CascaderPicker/demo/base.js +1 -4
  55. package/dist/CascaderPicker/index.d.ts +1 -1
  56. package/dist/CascaderPicker/index.js +1 -1
  57. package/dist/CascaderPicker/style.scss +45 -0
  58. package/dist/CascaderPickerCell/CascaderPickerCell.d.ts +21 -0
  59. package/dist/CascaderPickerCell/CascaderPickerCell.js +70 -0
  60. package/dist/CascaderPickerCell/demo/base.js +71 -0
  61. package/dist/CascaderPickerCell/index.d.ts +3 -0
  62. package/dist/CascaderPickerCell/index.js +2 -0
  63. package/dist/CascaderPickerCell/style.scss +24 -0
  64. package/dist/Cell/demo/base.js +41 -2
  65. package/dist/Checkbox/demo/base.js +9 -4
  66. package/dist/Checkbox/demo/disabled.js +2 -1
  67. package/dist/DemoBlock/index.d.ts +6 -0
  68. package/dist/DemoBlock/index.js +9 -2
  69. package/dist/FetchPicker/FetchPicker.d.ts +113 -0
  70. package/dist/FetchPicker/FetchPicker.js +319 -0
  71. package/dist/FetchPicker/index.d.ts +4 -0
  72. package/dist/FetchPicker/index.js +3 -0
  73. package/dist/FetchPicker/styles.scss +118 -0
  74. package/dist/FloatButton/FloatButton.d.ts +21 -0
  75. package/dist/FloatButton/FloatButton.js +66 -0
  76. package/dist/FloatButton/FloatButtonGroup.d.ts +21 -0
  77. package/dist/FloatButton/FloatButtonGroup.js +120 -0
  78. package/dist/FloatButton/context.d.ts +13 -0
  79. package/dist/FloatButton/context.js +2 -0
  80. package/dist/FloatButton/demo/base.d.ts +3 -0
  81. package/dist/FloatButton/demo/base.js +10 -0
  82. package/dist/FloatButton/demo/group.d.ts +3 -0
  83. package/dist/FloatButton/demo/group.js +20 -0
  84. package/dist/FloatButton/demo/square.d.ts +3 -0
  85. package/dist/FloatButton/demo/square.js +12 -0
  86. package/dist/FloatButton/index.d.ts +10 -0
  87. package/dist/FloatButton/index.js +5 -0
  88. package/dist/FloatButton/style.scss +123 -0
  89. package/dist/Form/FormItem/form-item-content.d.ts +17 -0
  90. package/dist/Form/FormItem/form-item-content.js +39 -0
  91. package/dist/Form/FormItem/form-item-label.d.ts +13 -0
  92. package/dist/Form/FormItem/form-item-label.js +29 -0
  93. package/dist/Form/FormItem/form-item.d.ts +51 -0
  94. package/dist/Form/FormItem/form-item.js +74 -0
  95. package/dist/Form/FormItem/index.d.ts +5 -0
  96. package/dist/Form/FormItem/index.js +3 -0
  97. package/dist/Form/demo/input.js +7 -3
  98. package/dist/Form/demo/vertical.d.ts +3 -0
  99. package/dist/Form/demo/vertical.js +45 -0
  100. package/dist/Form/index.d.ts +9 -2
  101. package/dist/Form/index.js +5 -1
  102. package/dist/Form/style.scss +106 -0
  103. package/dist/FormCell/index.d.ts +3 -0
  104. package/dist/FormCell/index.js +2 -0
  105. package/dist/ImagesPreview/ImagesPreview.js +2 -2
  106. package/dist/ImagesWall/CameraModal.js +2 -2
  107. package/dist/ImagesWall/style.scss +4 -4
  108. package/dist/Input/base-input.d.ts +13 -0
  109. package/dist/Input/base-input.js +41 -0
  110. package/dist/Input/demo/base.js +113 -11
  111. package/dist/Input/index.d.ts +14 -2
  112. package/dist/Input/index.js +11 -1
  113. package/dist/Input/index.scss +240 -0
  114. package/dist/Input/input-affix-wrapper.d.ts +13 -0
  115. package/dist/Input/input-affix-wrapper.js +37 -0
  116. package/dist/Input/input-opt.d.ts +16 -0
  117. package/dist/Input/input-opt.js +87 -0
  118. package/dist/Input/input-password.d.ts +7 -0
  119. package/dist/Input/input-password.js +48 -0
  120. package/dist/Input/input.d.ts +20 -0
  121. package/dist/Input/input.js +66 -0
  122. package/dist/Input/textarea.d.ts +15 -0
  123. package/dist/Input/textarea.js +51 -0
  124. package/dist/Input/types.d.ts +3 -0
  125. package/dist/Input/types.js +2 -0
  126. package/dist/Loading/DotLoading.d.ts +1 -0
  127. package/dist/Loading/DotLoading.js +1 -0
  128. package/dist/Loading/SpinLoading.d.ts +1 -0
  129. package/dist/Loading/SpinLoading.js +1 -0
  130. package/dist/Loading/demo/base.d.ts +3 -0
  131. package/dist/{SpinLoading → Loading}/demo/base.js +8 -2
  132. package/dist/Loading/demo/dot-loading.d.ts +3 -0
  133. package/dist/Loading/demo/dot-loading.js +25 -0
  134. package/dist/Loading/index.d.ts +5 -0
  135. package/dist/Loading/index.js +3 -0
  136. package/dist/Overlay/Overlay.d.ts +16 -0
  137. package/dist/Overlay/Overlay.js +117 -0
  138. package/dist/Overlay/demo/base.d.ts +3 -0
  139. package/dist/Overlay/demo/base.js +27 -0
  140. package/dist/Overlay/index.d.ts +4 -0
  141. package/dist/Overlay/index.js +3 -0
  142. package/dist/Overlay/style.scss +20 -0
  143. package/dist/Picker/index.d.ts +1 -1
  144. package/dist/Picker/index.js +1 -1
  145. package/dist/Picker/picker.d.ts +20 -0
  146. package/dist/Picker/picker.js +94 -0
  147. package/dist/Picker/style.scss +44 -0
  148. package/dist/PickerView/index.d.ts +2 -1
  149. package/dist/PickerView/index.js +1 -1
  150. package/dist/PickerView/picker-view-column-item.d.ts +7 -0
  151. package/dist/PickerView/picker-view-column-item.js +11 -0
  152. package/dist/PickerView/picker-view-column.d.ts +10 -0
  153. package/dist/PickerView/picker-view-column.js +117 -0
  154. package/dist/PickerView/picker-view.d.ts +12 -0
  155. package/dist/PickerView/picker-view.js +60 -0
  156. package/dist/PickerView/style.scss +72 -0
  157. package/dist/PickerView/types.d.ts +4 -0
  158. package/dist/PickerView/types.js +1 -0
  159. package/dist/Popup/demo/base.js +107 -25
  160. package/dist/Popup/index.d.ts +2 -1
  161. package/dist/Popup/index.js +2 -1
  162. package/dist/Popup/popup.d.ts +31 -0
  163. package/dist/Popup/popup.js +87 -0
  164. package/dist/Popup/style.scss +129 -0
  165. package/dist/Progress/index.d.ts +1 -1
  166. package/dist/Progress/index.js +1 -1
  167. package/dist/Radio/demo/base.js +2 -2
  168. package/dist/ScrollView/index.d.ts +2 -1
  169. package/dist/ScrollView/index.js +1 -1
  170. package/dist/ScrollView/scroll-view.d.ts +4 -0
  171. package/dist/ScrollView/scroll-view.js +55 -0
  172. package/dist/ScrollView/style.scss +19 -0
  173. package/dist/ScrollView/types.d.ts +26 -0
  174. package/dist/ScrollView/types.js +1 -0
  175. package/dist/Segmented/demo/base.d.ts +3 -0
  176. package/dist/Segmented/demo/base.js +33 -0
  177. package/dist/Segmented/index.d.ts +3 -0
  178. package/dist/Segmented/index.js +2 -0
  179. package/dist/SideBar/index.d.ts +1 -1
  180. package/dist/SideBar/style.scss +6 -6
  181. package/dist/Skeleton/demo/base.d.ts +3 -0
  182. package/dist/Skeleton/demo/base.js +8 -0
  183. package/dist/Skeleton/index.d.ts +3 -0
  184. package/dist/Skeleton/index.js +2 -0
  185. package/dist/Stepper/demo/base.d.ts +3 -0
  186. package/dist/Stepper/demo/base.js +23 -0
  187. package/dist/Stepper/index.d.ts +3 -0
  188. package/dist/Stepper/index.js +2 -0
  189. package/dist/Swiper/style.scss +1 -1
  190. package/dist/Toast/toast-modal.js +4 -4
  191. package/dist/VerificationCodeInput/demo/base.js +2 -2
  192. package/dist/VerificationCodeInput/index.d.ts +2 -2
  193. package/dist/VerificationCodeInput/index.js +1 -1
  194. package/dist/VerificationCodeInput/style.scss +20 -0
  195. package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
  196. package/dist/VerificationCodeInput/verification-code-input.js +99 -0
  197. package/dist/index.d.ts +33 -19
  198. package/dist/index.js +9 -2
  199. package/dist/types.d.ts +0 -8
  200. package/dist/types.js +0 -1
  201. package/dist/utils/dayjs.d.ts +4 -0
  202. package/dist/utils/dayjs.js +42 -0
  203. package/dist/utils/use-isomorphic-update-layout-effect.d.ts +1 -1
  204. package/package.json +11 -16
  205. package/dist/Mask/index.d.ts +0 -3
  206. package/dist/Mask/index.js +0 -2
  207. package/dist/Progress/Progress.d.ts +0 -37
  208. package/dist/Progress/Progress.js +0 -52
  209. package/dist/Progress/ProgressCircle.d.ts +0 -17
  210. package/dist/Progress/ProgressCircle.js +0 -148
  211. package/dist/Progress/ProgressLine.d.ts +0 -15
  212. package/dist/Progress/ProgressLine.js +0 -87
  213. package/dist/Progress/style.scss +0 -33
  214. package/dist/Progress/types.d.ts +0 -4
  215. package/dist/Progress/types.js +0 -2
  216. package/dist/SpinLoading/index.d.ts +0 -3
  217. package/dist/SpinLoading/index.js +0 -2
  218. /package/dist/{Mask → CalendarDatetimePickerCell}/demo/base.d.ts +0 -0
  219. /package/dist/{SpinLoading → CascaderPickerCell}/demo/base.d.ts +0 -0
@@ -0,0 +1,25 @@
1
+ import React, { FC } from "react";
2
+ import "./style.scss";
3
+ type ActionSheetActionItemType = {
4
+ key?: any;
5
+ children?: React.ReactNode;
6
+ onClick?: () => void;
7
+ };
8
+ export type ActionSheetProps = {
9
+ className?: string;
10
+ style?: React.CSSProperties;
11
+ open?: boolean;
12
+ afterOpenChange?: (open: boolean) => void;
13
+ title?: React.ReactNode;
14
+ actions?: ActionSheetActionItemType[];
15
+ cancel?: React.ReactNode | false;
16
+ onCancel?: () => void;
17
+ onClose?: () => void;
18
+ /**
19
+ * @description 点击操作项后是否关闭
20
+ * @default true
21
+ */
22
+ closeAfterClickAction?: boolean;
23
+ };
24
+ export declare const ActionSheet: FC<ActionSheetProps>;
25
+ export {};
@@ -0,0 +1,77 @@
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 Popup from "../Popup";
9
+ import classNames from "classnames";
10
+ import "./style.scss";
11
+ var cls = 'triones-antm-action-sheet';
12
+ export var ActionSheet = function ActionSheet(_ref) {
13
+ var className = _ref.className,
14
+ style = _ref.style,
15
+ open = _ref.open,
16
+ afterOpenChange = _ref.afterOpenChange,
17
+ title = _ref.title,
18
+ actions = _ref.actions,
19
+ cancel = _ref.cancel,
20
+ onCancel = _ref.onCancel,
21
+ onClose = _ref.onClose,
22
+ _ref$closeAfterClickA = _ref.closeAfterClickAction,
23
+ closeAfterClickAction = _ref$closeAfterClickA === void 0 ? true : _ref$closeAfterClickA;
24
+ var _React$useState = React.useState(open || false),
25
+ _React$useState2 = _slicedToArray(_React$useState, 2),
26
+ innerOpen = _React$useState2[0],
27
+ setInnerOpen = _React$useState2[1];
28
+ var handleClose = function handleClose() {
29
+ setInnerOpen(false);
30
+ onClose === null || onClose === void 0 || onClose();
31
+ };
32
+ React.useEffect(function () {
33
+ if (open === undefined) {
34
+ return;
35
+ }
36
+ if (open === innerOpen) {
37
+ return;
38
+ }
39
+ setInnerOpen(open);
40
+ }, [open]);
41
+ React.useEffect(function () {
42
+ afterOpenChange === null || afterOpenChange === void 0 || afterOpenChange(innerOpen);
43
+ }, [innerOpen]);
44
+ return /*#__PURE__*/React.createElement(Popup, {
45
+ open: open,
46
+ afterClose: function afterClose() {
47
+ setInnerOpen(false);
48
+ }
49
+ }, /*#__PURE__*/React.createElement("div", {
50
+ className: classNames(cls, className),
51
+ style: style
52
+ }, /*#__PURE__*/React.createElement("div", {
53
+ className: classNames("".concat(cls, "-body"))
54
+ }, title && /*#__PURE__*/React.createElement("div", {
55
+ className: classNames("".concat(cls, "-title"))
56
+ }, title), actions && /*#__PURE__*/React.createElement("div", {
57
+ className: classNames("".concat(cls, "-actions"))
58
+ }, actions.map(function (action) {
59
+ return /*#__PURE__*/React.createElement("div", {
60
+ className: "".concat(cls, "-actions-item"),
61
+ key: action.key,
62
+ onClick: function onClick() {
63
+ var _action$onClick;
64
+ (_action$onClick = action.onClick) === null || _action$onClick === void 0 || _action$onClick.call(action);
65
+ if (closeAfterClickAction) {
66
+ handleClose();
67
+ }
68
+ }
69
+ }, action.children);
70
+ }))), cancel !== false && /*#__PURE__*/React.createElement("div", {
71
+ className: classNames("".concat(cls, "-cancel")),
72
+ onClick: function onClick() {
73
+ onCancel === null || onCancel === void 0 || onCancel();
74
+ handleClose();
75
+ }
76
+ }, cancel || /*#__PURE__*/React.createElement("div", null, "\u53D6\u6D88"))));
77
+ };
@@ -1,3 +1,3 @@
1
- import { ActionSheet, ActionSheetProps } from "@trionesdev/antd-mobile-base-react";
1
+ import { ActionSheet, ActionSheetProps } from "./ActionSheet";
2
2
  export type { ActionSheetProps };
3
3
  export default ActionSheet;
@@ -1,2 +1,2 @@
1
- import { ActionSheet } from "@trionesdev/antd-mobile-base-react";
1
+ import { ActionSheet } from "./ActionSheet";
2
2
  export default ActionSheet;
@@ -0,0 +1,52 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ $actionSheetCls: 'triones-antm-action-sheet';
4
+
5
+ .#{$actionSheetCls} {
6
+ display: flex;
7
+ flex-direction: column;
8
+ background-color: variable.$trionesColorFill;
9
+ border-top-left-radius: variable.$trionesBorderRadius;
10
+ border-top-right-radius: variable.$trionesBorderRadius;
11
+ overflow: hidden;
12
+ gap: 2Px;
13
+ &-body{
14
+
15
+ }
16
+ &-title{
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ min-height: 48Px;
21
+ background-color: white;
22
+ font-size: 18Px;
23
+ border-bottom: 1Px solid variable.$trionesBorderColor;
24
+ }
25
+ &-actions{
26
+ &-item{
27
+ display: flex;
28
+ justify-content: center;
29
+ align-items: center;
30
+ min-height: 48Px;
31
+ background-color: white;
32
+ cursor: default;
33
+ position: relative;
34
+ font-size: 18Px;
35
+ &:hover{
36
+ opacity: 0.8;
37
+ }
38
+ }
39
+ }
40
+ &-cancel{
41
+ display: flex;
42
+ justify-content: center;
43
+ align-items: center;
44
+ min-height: 48Px;
45
+ font-size: 18Px;
46
+ background-color: white;
47
+ cursor: default;
48
+ &:hover{
49
+ opacity: 0.8;
50
+ }
51
+ }
52
+ }
@@ -1,5 +1,6 @@
1
1
  import React, { FC, PropsWithChildren } from 'react';
2
2
  import './style.scss';
3
+ import { AntSize } from "@trionesdev/antd-mobile-base-react";
3
4
  export type ButtonProps = {
4
5
  /**
5
6
  * @description block 按钮宽高自适应
@@ -43,7 +44,7 @@ export type ButtonProps = {
43
44
  * @description 按钮样式
44
45
  */
45
46
  variant?: 'outlined' | 'dashed' | 'solid' | 'filled' | 'text' | 'link';
46
- size?: 'small' | 'middle' | 'large';
47
+ size?: AntSize;
47
48
  /**
48
49
  * @description 点击事件
49
50
  */
@@ -25,7 +25,7 @@ export var Button = function Button(_ref) {
25
25
  style = _ref.style,
26
26
  icon = _ref.icon,
27
27
  _ref$iconPosition = _ref.iconPosition,
28
- iconPosition = _ref$iconPosition === void 0 ? 'start' : _ref$iconPosition,
28
+ iconPosition = _ref$iconPosition === void 0 ? 'medium' : _ref$iconPosition,
29
29
  loading = _ref.loading,
30
30
  variant = _ref.variant,
31
31
  _ref$size = _ref.size,
@@ -1,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $trionesButtonPendingInlineSm: 7Px;
4
4
  $trionesButtonHeightSm: 24Px;
@@ -6,14 +6,16 @@ $trionesButtonHeightSm: 24Px;
6
6
  $trionesButtonPendingInline: 15Px;
7
7
  $trionesButtonHeight: 32Px;
8
8
 
9
- $trionesButtonContentFontSizeLg: $trionesFontSizeLg;
9
+ $trionesButtonContentFontSizeLg: variable.$trionesFontSizeLg;
10
10
  $trionesButtonPendingInlineLg: 15Px;
11
11
  $trionesButtonHeightLg: 40Px;
12
12
 
13
13
  // 定义常用颜色变量以提高可维护性
14
14
  $buttonBackgroundColor: #ffffff;
15
- $buttonDarkTextColor: rgba(0, 0, 0, 0.75);
16
- $buttonLightTextColor: rgba(0, 0, 0, 0.06);
15
+ $buttonColorPrimary: variable.$trionesColorPrimary!default;
16
+ $buttonColorError: variable.$trionesColorError!default;
17
+ $buttonDarkColor: rgba(0, 0, 0, 0.75);
18
+ $buttonLightColor: rgba(0, 0, 0, 0.06);
17
19
 
18
20
  button::after {
19
21
  content: none;
@@ -61,34 +63,34 @@ $buttonCls: 'triones-antm-button';
61
63
  &-variant {
62
64
  &-solid {
63
65
  color: $buttonBackgroundColor;
64
- background-color: $buttonDarkTextColor;
65
- box-shadow: inset 0 0 0 1px $buttonDarkTextColor;
66
+ background-color: $buttonDarkColor;
67
+ box-shadow: inset 0 0 0 1px $buttonDarkColor;
66
68
  }
67
69
 
68
70
  &-outlined {
69
- color: $buttonDarkTextColor;
70
- border: 1px solid $buttonDarkTextColor;
71
+ color: $buttonDarkColor;
72
+ border: 1px solid $buttonDarkColor;
71
73
  background-color: $buttonBackgroundColor;
72
74
  }
73
75
 
74
76
  &-dashed {
75
- color: $buttonDarkTextColor;
76
- border: 1px dashed $buttonDarkTextColor;
77
+ color: $buttonDarkColor;
78
+ border: 1px dashed $buttonDarkColor;
77
79
  background-color: $buttonBackgroundColor;
78
80
  }
79
81
 
80
82
  &-filled {
81
- color: $buttonDarkTextColor;
82
- background-color: $buttonLightTextColor;
83
+ color: $buttonDarkColor;
84
+ background-color: $buttonLightColor;
83
85
  }
84
86
 
85
87
  &-text {
86
- color: $buttonDarkTextColor;
88
+ color: $buttonDarkColor;
87
89
  background-color: $buttonBackgroundColor;
88
90
  }
89
91
 
90
92
  &-link {
91
- color: $buttonDarkTextColor;
93
+ color: $buttonDarkColor;
92
94
  background-color: $buttonBackgroundColor;
93
95
 
94
96
  &:active {
@@ -104,34 +106,34 @@ $buttonCls: 'triones-antm-button';
104
106
  &-variant {
105
107
  &-solid {
106
108
  color: $buttonBackgroundColor;
107
- background-color: $trionesColorPrimaryText;
108
- box-shadow: inset 0 0 0 1px $trionesColorPrimaryText;
109
+ background-color: $buttonColorPrimary;
110
+ box-shadow: inset 0 0 0 1px $buttonColorPrimary;
109
111
  }
110
112
 
111
113
  &-outlined {
112
- color: #1677ff;
114
+ color: $buttonColorPrimary;
113
115
  background-color: $buttonBackgroundColor;
114
- border: 1px solid $trionesColorPrimaryText;
116
+ border: 1px solid $buttonColorPrimary;
115
117
  }
116
118
 
117
119
  &-dashed {
118
- color: $trionesColorPrimaryText;
119
- border: 1px dashed $trionesColorPrimaryText;
120
+ color: $buttonColorPrimary;
121
+ border: 1px dashed $buttonColorPrimary;
120
122
  background-color: $buttonBackgroundColor;
121
123
  }
122
124
 
123
125
  &-filled {
124
- color: $trionesColorPrimaryText;
125
- background-color: $trionesColorPrimaryBg;
126
+ color: $buttonColorPrimary;
127
+ background-color: variable.$trionesColorPrimaryBg;
126
128
  }
127
129
 
128
130
  &-text {
129
- color: $trionesColorPrimaryText;
131
+ color: $buttonColorPrimary;
130
132
  background-color: $buttonBackgroundColor;
131
133
  }
132
134
 
133
135
  &-link {
134
- color: $trionesColorPrimaryText;
136
+ color: $buttonColorPrimary;
135
137
  background-color: $buttonBackgroundColor;
136
138
 
137
139
  &:active {
@@ -147,34 +149,34 @@ $buttonCls: 'triones-antm-button';
147
149
  &-variant {
148
150
  &-solid {
149
151
  color: $buttonBackgroundColor;
150
- background-color: $trionesColorErrorText;
151
- box-shadow: inset 0 0 0 1px $trionesColorErrorText;
152
+ background-color: $buttonColorError;
153
+ box-shadow: inset 0 0 0 1px $buttonColorError;
152
154
  }
153
155
 
154
156
  &-outlined {
155
- color: $trionesColorErrorText;
157
+ color: $buttonColorError;
156
158
  background-color: $buttonBackgroundColor;
157
- border: 1px solid $trionesColorErrorText;
159
+ border: 1px solid $buttonColorError;
158
160
  }
159
161
 
160
162
  &-dashed {
161
- color: $trionesColorErrorText;
162
- border: 1px dashed $trionesColorErrorText;
163
+ color: $buttonColorError;
164
+ border: 1px dashed $buttonColorError;
163
165
  background-color: $buttonBackgroundColor;
164
166
  }
165
167
 
166
168
  &-filled {
167
- color: $trionesColorErrorText;
169
+ color: $buttonColorError;
168
170
  background-color: #ffdfdc;
169
171
  }
170
172
 
171
173
  &-text {
172
- color: $trionesColorErrorText;
174
+ color: $buttonColorError;
173
175
  background-color: $buttonBackgroundColor;
174
176
  }
175
177
 
176
178
  &-link {
177
- color: $trionesColorErrorText;
179
+ color: $buttonColorError;
178
180
  background-color: $buttonBackgroundColor;
179
181
 
180
182
  &:active {
@@ -211,22 +213,22 @@ $buttonCls: 'triones-antm-button';
211
213
  }
212
214
 
213
215
  &-small {
214
- font-size: $trionesFontSizeSm;
216
+ font-size: variable.$trionesFontSizeSm;
215
217
  padding-inline: $trionesButtonPendingInlineSm;
216
218
  height: $trionesButtonHeightSm;
217
- border-radius: $trionesBorderRadiusSm;
219
+ border-radius: variable.$trionesBorderRadiusSm;
218
220
  }
219
221
 
220
- &-middle {
222
+ &-medium {
221
223
  padding-inline: $trionesButtonPendingInline;
222
224
  height: $trionesButtonHeight;
223
- border-radius: $trionesBorderRadius;
225
+ border-radius: variable.$trionesBorderRadius;
224
226
  }
225
227
 
226
228
  &-large {
227
229
  font-size: $trionesButtonContentFontSizeLg;
228
230
  padding-inline: $trionesButtonPendingInlineLg;
229
231
  height: $trionesButtonHeightLg;
230
- border-radius: $trionesBorderRadiusLg;
232
+ border-radius: variable.$trionesBorderRadiusLg;
231
233
  }
232
- }
234
+ }
@@ -1,27 +1,28 @@
1
1
  import { FC } from 'react';
2
2
  import './style.scss';
3
+ import dayjs from "dayjs";
3
4
  export type CalendarGridProps = {
4
- mouth?: Date;
5
+ month?: dayjs.Dayjs;
5
6
  /**
6
7
  * @description 值,如果是区间模式,则 0,1 索引的值有效,0是开始时间,1是结束时间
7
8
  */
8
- value?: Date[];
9
+ value?: (dayjs.Dayjs | Date)[];
9
10
  /**
10
11
  * @description 默认值,如果是区间模式,则 0,1 索引的值有效,0是开始时间,1是结束时间
11
12
  */
12
- defaultValue?: Date[];
13
- onChange?: (value: Date[]) => void;
13
+ defaultValue?: (dayjs.Dayjs | Date)[];
14
+ onChange?: (value: dayjs.Dayjs[]) => void;
14
15
  /**
15
16
  * @description 是否为范围选择
16
17
  */
17
18
  range?: boolean;
18
- onSelect?: (date: Date) => void;
19
+ onSelect?: (date: dayjs.Dayjs) => void;
19
20
  };
20
21
  export type CalendarCellProps = {
21
- mouth?: Date;
22
- date?: Date;
23
- value?: Date[];
22
+ month?: dayjs.Dayjs;
23
+ date?: dayjs.Dayjs;
24
+ value?: dayjs.Dayjs[];
24
25
  range?: boolean;
25
- onSelect?: (date: Date) => void;
26
+ onSelect?: (date: dayjs.Dayjs) => void;
26
27
  };
27
28
  export declare const CalendarGrid: FC<CalendarGridProps>;
@@ -1,8 +1,4 @@
1
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
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
3
  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."); }
8
4
  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); }
@@ -16,41 +12,32 @@ import classNames from 'classnames';
16
12
  import { isEmpty } from 'lodash-es';
17
13
  import React, { forwardRef, memo, useEffect, useMemo, useState } from 'react';
18
14
  import "./style.scss";
15
+ import dayjs from "dayjs";
16
+ import { isSame, toDayjsArray } from "../utils/dayjs";
19
17
  var calendarCls = 'triones-antm-calendar';
20
18
  var CalendarCell = /*#__PURE__*/memo(function (_ref) {
21
- var _ref$mouth = _ref.mouth,
22
- mouth = _ref$mouth === void 0 ? new Date() : _ref$mouth,
19
+ var _ref$month = _ref.month,
20
+ month = _ref$month === void 0 ? dayjs() : _ref$month,
23
21
  _ref$date = _ref.date,
24
- date = _ref$date === void 0 ? new Date() : _ref$date,
22
+ date = _ref$date === void 0 ? dayjs() : _ref$date,
25
23
  value = _ref.value,
26
24
  range = _ref.range,
27
25
  onSelect = _ref.onSelect;
28
26
  var disabled = useMemo(function () {
29
- return date.getMonth() !== mouth.getMonth();
30
- }, [date, mouth]);
27
+ return !isSame(date, month, 'month');
28
+ }, [date, month]);
31
29
  var selected = useMemo(function () {
32
30
  if (disabled || isEmpty(value)) {
33
31
  return false;
34
32
  }
35
- if (value !== null && value !== void 0 && value[0]) {
36
- var _value$;
37
- value === null || value === void 0 || (_value$ = value[0]) === null || _value$ === void 0 || _value$.setHours(0, 0, 0, 0);
38
- }
39
- if (value !== null && value !== void 0 && value[1]) {
40
- var _value$2;
41
- value === null || value === void 0 || (_value$2 = value[1]) === null || _value$2 === void 0 || _value$2.setHours(0, 0, 0, 0);
42
- }
43
- date.setHours(0, 0, 0, 0);
44
33
  if (range) {
45
34
  var startDate = value === null || value === void 0 ? void 0 : value[0];
46
35
  var endDate = value === null || value === void 0 ? void 0 : value[1];
47
- console.log('value', value);
48
- return date.getTime() === (startDate === null || startDate === void 0 ? void 0 : startDate.getTime()) || date.getTime() === (endDate === null || endDate === void 0 ? void 0 : endDate.getTime());
36
+ return isSame(date, startDate, 'date') || isSame(date, endDate, 'date');
49
37
  } else {
50
- var _value$3;
51
- return date.getTime() === (value === null || value === void 0 || (_value$3 = value[0]) === null || _value$3 === void 0 ? void 0 : _value$3.getTime());
38
+ return isSame(date, value === null || value === void 0 ? void 0 : value[0], 'date');
52
39
  }
53
- }, [mouth, date, value]);
40
+ }, [month, date, value]);
54
41
  var selectedRange = useMemo(function () {
55
42
  if (disabled || !range) {
56
43
  return false;
@@ -60,11 +47,8 @@ var CalendarCell = /*#__PURE__*/memo(function (_ref) {
60
47
  if (!startDate || !endDate) {
61
48
  return false;
62
49
  }
63
- date.setHours(0, 0, 0, 0);
64
- startDate.setHours(0, 0, 0, 0);
65
- endDate.setHours(0, 0, 0, 0);
66
- return date.getTime() > startDate.getTime() && date.getTime() < endDate.getTime();
67
- }, [mouth, date, value]);
50
+ return dayjs(date).isAfter(startDate, 'date') && dayjs(date).isBefore(endDate, 'date');
51
+ }, [month, date, value]);
68
52
  return /*#__PURE__*/React.createElement("div", {
69
53
  className: classNames("".concat(calendarCls, "-cell"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(calendarCls, "-cell-disabled"), disabled), "".concat(calendarCls, "-cell-selected"), selected), "".concat(calendarCls, "-cell-selected-range"), selectedRange))
70
54
  // style={{ width: size, height: size }}
@@ -74,33 +58,32 @@ var CalendarCell = /*#__PURE__*/memo(function (_ref) {
74
58
  }
75
59
  }, /*#__PURE__*/React.createElement("div", {
76
60
  className: classNames("".concat(calendarCls, "-cell-date"))
77
- }, date.getDate()), date.getDate() === 1 && /*#__PURE__*/React.createElement("div", {
61
+ }, date.date()), date.date() === 1 && /*#__PURE__*/React.createElement("div", {
78
62
  className: classNames("".concat(calendarCls, "-cell-mouth"))
79
- }, "".concat(date.getMonth() + 1, "\u6708")));
63
+ }, "".concat(date.month() + 1, "\u6708")));
80
64
  });
81
65
  export var CalendarGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref2, ref) {
82
- var _ref3;
83
- var _ref2$mouth = _ref2.mouth,
84
- mouth = _ref2$mouth === void 0 ? new Date() : _ref2$mouth,
66
+ var _ref3, _toDayjsArray;
67
+ var _ref2$month = _ref2.month,
68
+ month = _ref2$month === void 0 ? dayjs() : _ref2$month,
85
69
  value = _ref2.value,
86
70
  defaultValue = _ref2.defaultValue,
87
71
  _ref2$range = _ref2.range,
88
72
  range = _ref2$range === void 0 ? false : _ref2$range,
89
73
  onChange = _ref2.onChange,
90
74
  onSelect = _ref2.onSelect;
91
- var _useState = useState((_ref3 = value !== null && value !== void 0 ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : []),
75
+ var _useState = useState((_ref3 = (_toDayjsArray = toDayjsArray(value)) !== null && _toDayjsArray !== void 0 ? _toDayjsArray : toDayjsArray(defaultValue)) !== null && _ref3 !== void 0 ? _ref3 : []),
92
76
  _useState2 = _slicedToArray(_useState, 2),
93
77
  innerValue = _useState2[0],
94
78
  setInnerValue = _useState2[1];
95
79
  var handleSelect = function handleSelect(date) {
96
- date.setHours(0, 0, 0, 0);
97
80
  var _value = innerValue;
98
81
  if (range) {
99
82
  if (!_value[0]) {
100
83
  _value = [date];
101
84
  } else if (!_value[1]) {
102
85
  var startDate = _value[0];
103
- if (date.getTime() < startDate.getTime()) {
86
+ if (dayjs(date).isBefore(startDate, 'date')) {
104
87
  _value = [date, startDate];
105
88
  } else {
106
89
  _value = [startDate, date];
@@ -116,35 +99,29 @@ export var CalendarGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_
116
99
  onChange === null || onChange === void 0 || onChange(_value);
117
100
  };
118
101
  var cells = useMemo(function () {
119
- var firstDate = new Date(mouth.getFullYear(), mouth.getMonth(), 1);
120
- var lastDate = new Date(mouth.getFullYear(), mouth.getMonth() + 1, 0);
121
- var beforeDays = Array.from({
122
- length: firstDate.getDay()
123
- }).map(function (_, index) {
124
- var date = new Date(firstDate);
125
- date.setDate(firstDate.getDate() - (firstDate.getDay() - index));
126
- return date;
127
- });
128
- var afterDays = Array.from({
129
- length: 6 - lastDate.getDay()
130
- }).map(function (_, index) {
131
- var date = new Date(lastDate);
132
- date.setDate(lastDate.getDate() + index + 1);
133
- return date;
102
+ var firstDate = dayjs(month).startOf('month');
103
+
104
+ // 固定生成42天的日期网格(6行7列)
105
+ var startDate = firstDate.subtract(firstDate.day(), 'day');
106
+ var cells = Array.from({
107
+ length: 42
108
+ }, function (_, index) {
109
+ return startDate.add(index, 'day');
134
110
  });
135
- var mouthDays = Array.from({
136
- length: lastDate.getDate()
137
- }).map(function (_, index) {
138
- var date = new Date(firstDate);
139
- date.setDate(date.getDate() + index);
140
- return date;
141
- });
142
- return [].concat(_toConsumableArray(beforeDays), _toConsumableArray(mouthDays), _toConsumableArray(afterDays));
143
- }, [mouth]);
111
+ return cells;
112
+ }, [month]);
144
113
  useEffect(function () {
145
114
  if (value !== undefined) {
146
- if (value !== innerValue) {
147
- setInnerValue(value);
115
+ if (range) {
116
+ if (!isSame(value[0], innerValue[0], 'day') || !isSame(value[1], innerValue[1], 'day')) {
117
+ var _toDayjsArray2;
118
+ setInnerValue((_toDayjsArray2 = toDayjsArray(value)) !== null && _toDayjsArray2 !== void 0 ? _toDayjsArray2 : []);
119
+ }
120
+ } else {
121
+ if (!isSame(value[0], innerValue[0], 'day')) {
122
+ var _toDayjsArray3;
123
+ setInnerValue((_toDayjsArray3 = toDayjsArray(value)) !== null && _toDayjsArray3 !== void 0 ? _toDayjsArray3 : []);
124
+ }
148
125
  }
149
126
  }
150
127
  }, [value]);
@@ -154,9 +131,9 @@ export var CalendarGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_
154
131
  }, cells.map(function (item, index) {
155
132
  return /*#__PURE__*/React.createElement(CalendarCell, {
156
133
  key: index,
157
- mouth: mouth,
134
+ month: month,
158
135
  date: item,
159
- value: innerValue,
136
+ value: toDayjsArray(innerValue),
160
137
  range: range,
161
138
  onSelect: handleSelect
162
139
  });
@@ -1,7 +1,8 @@
1
1
  import { FC } from "react";
2
+ import dayjs from "dayjs";
2
3
  type CalendarHeaderProps = {
3
- mouth: Date;
4
- onChange: (mouth: Date) => void;
4
+ month: dayjs.Dayjs;
5
+ onChange: (mouth: dayjs.Dayjs) => void;
5
6
  };
6
7
  export declare const CalendarHeader: FC<CalendarHeaderProps>;
7
8
  export {};
@@ -3,7 +3,7 @@ import classNames from "classnames";
3
3
  import ConfigProvider from "../ConfigProvider";
4
4
  var calendarCls = 'triones-antm-calendar';
5
5
  export var CalendarHeader = function CalendarHeader(_ref) {
6
- var mouth = _ref.mouth,
6
+ var month = _ref.month,
7
7
  onChange = _ref.onChange;
8
8
  var _ConfigProvider$useCo = ConfigProvider.useConfig(),
9
9
  locale = _ConfigProvider$useCo.locale;
@@ -12,24 +12,24 @@ export var CalendarHeader = function CalendarHeader(_ref) {
12
12
  }, /*#__PURE__*/React.createElement("div", {
13
13
  className: classNames("".concat(calendarCls, "-header-button")),
14
14
  onClick: function onClick() {
15
- onChange(new Date(mouth.getFullYear() - 1, mouth.getMonth(), 1));
15
+ onChange(month.subtract(1, 'year'));
16
16
  }
17
17
  }, "<<"), /*#__PURE__*/React.createElement("div", {
18
18
  className: classNames("".concat(calendarCls, "-header-button")),
19
19
  onClick: function onClick() {
20
- onChange(new Date(mouth.getFullYear(), mouth.getMonth() - 1, 1));
20
+ onChange(month.subtract(1, 'month'));
21
21
  }
22
22
  }, "<"), /*#__PURE__*/React.createElement("div", {
23
23
  className: classNames("".concat(calendarCls, "-header-title"))
24
- }, "".concat(mouth.getFullYear(), "\u5E74").concat(mouth.getMonth() + 1, "\u6708")), /*#__PURE__*/React.createElement("div", {
24
+ }, "".concat(month.year(), "\u5E74").concat(month.month() + 1, "\u6708")), /*#__PURE__*/React.createElement("div", {
25
25
  className: classNames("".concat(calendarCls, "-header-button")),
26
26
  onClick: function onClick() {
27
- onChange(new Date(mouth.getFullYear(), mouth.getMonth() + 1, 1));
27
+ onChange(month.add(1, 'month'));
28
28
  }
29
29
  }, ">"), /*#__PURE__*/React.createElement("div", {
30
30
  className: classNames("".concat(calendarCls, "-header-button")),
31
31
  onClick: function onClick() {
32
- onChange(new Date(mouth.getFullYear() + 1, mouth.getMonth(), 1));
32
+ onChange(month.add(1, 'year'));
33
33
  }
34
34
  }, ">>")), /*#__PURE__*/React.createElement("div", {
35
35
  className: classNames("".concat(calendarCls, "-week"))