@trionesdev/antd-mobile-base-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 (226) hide show
  1. package/dist/Alert/alert.js +1 -1
  2. package/dist/Alert/style.scss +17 -17
  3. package/dist/Avatar/avatar.d.ts +4 -1
  4. package/dist/Avatar/avatar.js +19 -6
  5. package/dist/Avatar/style.scss +3 -2
  6. package/dist/Card/style.scss +12 -12
  7. package/dist/CascaderView/cascader-column-item.js +1 -1
  8. package/dist/CascaderView/style.scss +2 -2
  9. package/dist/Cell/CellGroup.js +53 -14
  10. package/dist/Cell/cell.js +52 -15
  11. package/dist/Cell/context.d.ts +19 -0
  12. package/dist/Cell/context.js +2 -0
  13. package/dist/Cell/styles.scss +42 -13
  14. package/dist/Cell/types.d.ts +30 -7
  15. package/dist/Checkbox/checkbox-button.d.ts +6 -2
  16. package/dist/Checkbox/checkbox-button.js +6 -18
  17. package/dist/Checkbox/checkbox-group.js +19 -4
  18. package/dist/Checkbox/checkbox-round.d.ts +8 -0
  19. package/dist/Checkbox/checkbox-round.js +35 -0
  20. package/dist/Checkbox/checkbox.js +49 -34
  21. package/dist/Checkbox/index.d.ts +0 -2
  22. package/dist/Checkbox/index.js +0 -2
  23. package/dist/Checkbox/index.scss +48 -34
  24. package/dist/Checkbox/types.d.ts +11 -1
  25. package/dist/ConfigProvider/config-provider.d.ts +1 -0
  26. package/dist/Descriptions/style.scss +4 -4
  27. package/dist/Divider/divider.d.ts +1 -1
  28. package/dist/Divider/divider.js +5 -3
  29. package/dist/Divider/style.scss +7 -7
  30. package/dist/Form/ErrorList.d.ts +4 -0
  31. package/dist/Form/ErrorList.js +9 -0
  32. package/dist/Form/context.d.ts +5 -2
  33. package/dist/Form/context.js +2 -1
  34. package/dist/Form/form.d.ts +25 -12
  35. package/dist/Form/form.js +25 -13
  36. package/dist/Form/hooks/useForm.js +1 -8
  37. package/dist/Form/hooks/useFormContext.js +1 -2
  38. package/dist/Form/index.d.ts +8 -3
  39. package/dist/Form/index.js +7 -2
  40. package/dist/Form/styles.scss +11 -0
  41. package/dist/Form/types.d.ts +8 -0
  42. package/dist/FormCell/FormCell.d.ts +22 -0
  43. package/dist/FormCell/FormCell.js +57 -0
  44. package/dist/FormCell/index.d.ts +4 -0
  45. package/dist/FormCell/index.js +3 -0
  46. package/dist/FormCell/styles.scss +103 -0
  47. package/dist/IndexedStack/IndexedStack.d.ts +9 -0
  48. package/dist/IndexedStack/IndexedStack.js +27 -0
  49. package/dist/IndexedStack/index.d.ts +3 -0
  50. package/dist/IndexedStack/index.js +2 -0
  51. package/dist/InputNumber/input-number.d.ts +3 -2
  52. package/dist/InputNumber/input-number.js +48 -26
  53. package/dist/InputNumber/style.scss +79 -22
  54. package/dist/Loading/DotLoading.d.ts +7 -0
  55. package/dist/{Mask/mask-modal.js → Loading/DotLoading.js} +25 -25
  56. package/dist/{SpinLoading/spin-loading.d.ts → Loading/SpinLoading.d.ts} +0 -1
  57. package/dist/Loading/SpinLoading.js +69 -0
  58. package/dist/Loading/index.d.ts +6 -0
  59. package/dist/Loading/index.js +4 -0
  60. package/dist/Loading/style.scss +113 -0
  61. package/dist/NavBar/nav-bar.d.ts +1 -0
  62. package/dist/NavBar/nav-bar.js +3 -2
  63. package/dist/NavBar/style.scss +7 -3
  64. package/dist/Progress/Progress.d.ts +39 -0
  65. package/dist/Progress/Progress.js +56 -0
  66. package/dist/Progress/ProgressCircle.d.ts +15 -0
  67. package/dist/Progress/ProgressCircle.js +117 -0
  68. package/dist/Progress/ProgressLine.d.ts +15 -0
  69. package/dist/Progress/ProgressLine.js +87 -0
  70. package/dist/Progress/index.d.ts +3 -0
  71. package/dist/Progress/index.js +2 -0
  72. package/dist/Progress/style.scss +33 -0
  73. package/dist/Progress/types.d.ts +6 -0
  74. package/dist/Progress/types.js +2 -0
  75. package/dist/Radio/RadioGroup.js +3 -3
  76. package/dist/Radio/radio.js +1 -1
  77. package/dist/Radio/style.scss +40 -24
  78. package/dist/Radio/types.d.ts +6 -4
  79. package/dist/Rate/rate.js +1 -1
  80. package/dist/Result/use-result-icon.js +1 -1
  81. package/dist/SafeArea/style.scss +5 -3
  82. package/dist/Scaffold/style.scss +2 -1
  83. package/dist/Segmented/Segmented.d.ts +57 -0
  84. package/dist/Segmented/Segmented.js +82 -0
  85. package/dist/Segmented/index.d.ts +2 -0
  86. package/dist/Segmented/index.js +1 -0
  87. package/dist/Segmented/style.scss +75 -0
  88. package/dist/Skeleton/Skeleton.d.ts +86 -0
  89. package/dist/Skeleton/Skeleton.js +263 -0
  90. package/dist/Skeleton/index.d.ts +3 -0
  91. package/dist/Skeleton/index.js +2 -0
  92. package/dist/Skeleton/style.scss +215 -0
  93. package/dist/Space/space.d.ts +1 -0
  94. package/dist/Space/space.js +20 -6
  95. package/dist/Space/style.scss +27 -3
  96. package/dist/Stepper/index.d.ts +3 -0
  97. package/dist/Stepper/index.js +2 -0
  98. package/dist/Stepper/stepper.d.ts +14 -0
  99. package/dist/Stepper/stepper.js +92 -0
  100. package/dist/Stepper/style.scss +100 -0
  101. package/dist/Steps/HorizontalSteps.js +10 -3
  102. package/dist/Steps/VerticalSteps.js +5 -2
  103. package/dist/Steps/style.scss +7 -0
  104. package/dist/Steps/types.d.ts +2 -0
  105. package/dist/Switch/style.scss +6 -7
  106. package/dist/Switch/switch.d.ts +2 -0
  107. package/dist/Switch/switch.js +6 -5
  108. package/dist/TabBar/index.js +2 -1
  109. package/dist/TabBar/index.scss +3 -2
  110. package/dist/Tabs/style.scss +5 -5
  111. package/dist/Tag/style.scss +45 -21
  112. package/dist/Tag/tag.d.ts +4 -1
  113. package/dist/Tag/tag.js +8 -2
  114. package/dist/index.d.ts +17 -26
  115. package/dist/index.js +8 -13
  116. package/dist/style/css-variable.scss +6 -0
  117. package/dist/style/style.scss +2 -2
  118. package/dist/style/variable.scss +176 -164
  119. package/dist/types.d.ts +10 -1
  120. package/package.json +5 -8
  121. package/dist/ActionSheet/ActionSheet.d.ts +0 -25
  122. package/dist/ActionSheet/ActionSheet.js +0 -77
  123. package/dist/ActionSheet/index.d.ts +0 -3
  124. package/dist/ActionSheet/index.js +0 -2
  125. package/dist/ActionSheet/style.scss +0 -51
  126. package/dist/CascaderPicker/cascader-picker.d.ts +0 -27
  127. package/dist/CascaderPicker/cascader-picker.js +0 -88
  128. package/dist/CascaderPicker/index.d.ts +0 -3
  129. package/dist/CascaderPicker/index.js +0 -2
  130. package/dist/CascaderPicker/style.scss +0 -42
  131. package/dist/Form/FormItem/form-item-input.d.ts +0 -15
  132. package/dist/Form/FormItem/form-item-input.js +0 -39
  133. package/dist/Form/FormItem/form-item-label.d.ts +0 -13
  134. package/dist/Form/FormItem/form-item-label.js +0 -25
  135. package/dist/Form/FormItem/form-item.d.ts +0 -21
  136. package/dist/Form/FormItem/form-item.js +0 -70
  137. package/dist/Form/FormItem/index.d.ts +0 -5
  138. package/dist/Form/FormItem/index.js +0 -3
  139. package/dist/Form/style.scss +0 -45
  140. package/dist/Input/base-input.d.ts +0 -14
  141. package/dist/Input/base-input.js +0 -63
  142. package/dist/Input/index.d.ts +0 -12
  143. package/dist/Input/index.js +0 -9
  144. package/dist/Input/index.scss +0 -173
  145. package/dist/Input/input-affix-wrapper.d.ts +0 -8
  146. package/dist/Input/input-affix-wrapper.js +0 -50
  147. package/dist/Input/input-opt.d.ts +0 -16
  148. package/dist/Input/input-opt.js +0 -93
  149. package/dist/Input/input-password.d.ts +0 -7
  150. package/dist/Input/input-password.js +0 -47
  151. package/dist/Input/input.d.ts +0 -15
  152. package/dist/Input/input.js +0 -47
  153. package/dist/Input/textarea.d.ts +0 -13
  154. package/dist/Input/textarea.js +0 -45
  155. package/dist/Input/types.d.ts +0 -1
  156. package/dist/Input/types.js +0 -1
  157. package/dist/Mask/index.d.ts +0 -3
  158. package/dist/Mask/index.js +0 -2
  159. package/dist/Mask/mask-modal.d.ts +0 -45
  160. package/dist/Mask/mask.d.ts +0 -5
  161. package/dist/Mask/mask.js +0 -19
  162. package/dist/Mask/style.scss +0 -20
  163. package/dist/Picker/index.d.ts +0 -3
  164. package/dist/Picker/index.js +0 -2
  165. package/dist/Picker/picker.d.ts +0 -19
  166. package/dist/Picker/picker.js +0 -97
  167. package/dist/Picker/style.scss +0 -41
  168. package/dist/PickerView/index.d.ts +0 -4
  169. package/dist/PickerView/index.js +0 -2
  170. package/dist/PickerView/picker-view-column-item.d.ts +0 -7
  171. package/dist/PickerView/picker-view-column-item.js +0 -11
  172. package/dist/PickerView/picker-view-column.d.ts +0 -10
  173. package/dist/PickerView/picker-view-column.js +0 -117
  174. package/dist/PickerView/picker-view.d.ts +0 -12
  175. package/dist/PickerView/picker-view.js +0 -60
  176. package/dist/PickerView/style.scss +0 -72
  177. package/dist/PickerView/types.d.ts +0 -4
  178. package/dist/Popup/index.d.ts +0 -3
  179. package/dist/Popup/index.js +0 -2
  180. package/dist/Popup/popup-modal.d.ts +0 -52
  181. package/dist/Popup/popup-modal.js +0 -74
  182. package/dist/Popup/popup.d.ts +0 -4
  183. package/dist/Popup/popup.js +0 -56
  184. package/dist/Popup/style.scss +0 -53
  185. package/dist/ScrollView/index.d.ts +0 -4
  186. package/dist/ScrollView/index.js +0 -2
  187. package/dist/ScrollView/scroll-view.d.ts +0 -4
  188. package/dist/ScrollView/scroll-view.js +0 -55
  189. package/dist/ScrollView/style.scss +0 -19
  190. package/dist/ScrollView/types.d.ts +0 -26
  191. package/dist/ScrollView/types.js +0 -1
  192. package/dist/SideBar/SideBarContext.d.ts +0 -18
  193. package/dist/SideBar/SideBarContext.js +0 -2
  194. package/dist/SideBar/index.d.ts +0 -3
  195. package/dist/SideBar/index.js +0 -2
  196. package/dist/SideBar/side-bar.d.ts +0 -25
  197. package/dist/SideBar/side-bar.js +0 -351
  198. package/dist/SideBar/style.scss +0 -85
  199. package/dist/SideBar/types.d.ts +0 -7
  200. package/dist/SideBar/types.js +0 -1
  201. package/dist/SpinLoading/demo/base.d.ts +0 -3
  202. package/dist/SpinLoading/demo/base.js +0 -21
  203. package/dist/SpinLoading/index.d.ts +0 -3
  204. package/dist/SpinLoading/index.js +0 -2
  205. package/dist/SpinLoading/spin-loading.js +0 -59
  206. package/dist/SpinLoading/spin-loading.scss +0 -40
  207. package/dist/Tabs/demo/base.d.ts +0 -3
  208. package/dist/Tabs/demo/base.js +0 -59
  209. package/dist/Tag/demo/base.d.ts +0 -7
  210. package/dist/Tag/demo/base.js +0 -67
  211. package/dist/Tag/demo/style.scss +0 -8
  212. package/dist/Toast/index.d.ts +0 -5
  213. package/dist/Toast/index.js +0 -3
  214. package/dist/Toast/style.scss +0 -63
  215. package/dist/Toast/toast-modal.d.ts +0 -18
  216. package/dist/Toast/toast-modal.js +0 -112
  217. package/dist/Toast/toast.d.ts +0 -7
  218. package/dist/Toast/toast.js +0 -78
  219. package/dist/VerificationCodeInput/demo/base.d.ts +0 -3
  220. package/dist/VerificationCodeInput/demo/base.js +0 -11
  221. package/dist/VerificationCodeInput/index.d.ts +0 -3
  222. package/dist/VerificationCodeInput/index.js +0 -2
  223. package/dist/VerificationCodeInput/style.scss +0 -20
  224. package/dist/VerificationCodeInput/verification-code-input.d.ts +0 -24
  225. package/dist/VerificationCodeInput/verification-code-input.js +0 -99
  226. /package/dist/{PickerView → Form}/types.js +0 -0
@@ -3,17 +3,12 @@ import type { FormProps as RcFormProps } from 'rc-field-form/lib/Form';
3
3
  import type { FormRef } from 'rc-field-form/lib/interface';
4
4
  import React from 'react';
5
5
  import { FormInstance } from './interface';
6
- import './style.scss';
7
- export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
8
- required: boolean;
9
- }) => React.ReactNode);
10
- export type FormLayout = 'horizontal' | 'inline' | 'vertical';
11
- export type FormItemLayout = 'horizontal' | 'vertical';
12
- export type FormLayoutAlign = 'left' | 'right';
6
+ import { FormHorizontalAlign, FormLayout, RequiredMark } from "./types";
7
+ import "./styles.scss";
13
8
  export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form' | 'component'> {
14
9
  /**
15
10
  * @description 配置 Form.Item 的 colon 的默认值。表示是否显示 label 后面的冒号 (只有在属性 layout 为 horizontal 时有效)
16
- * @default true
11
+ * @default false
17
12
  */
18
13
  colon?: boolean;
19
14
  /**
@@ -27,18 +22,36 @@ export interface FormProps<Values = any> extends Omit<RcFormProps<Values>, 'form
27
22
  */
28
23
  form?: FormInstance<Values>;
29
24
  /**
30
- * @description 标签
31
- * @default horizontal
25
+ * @description 标签对齐方式
26
+ * @default left
27
+ */
28
+ labelAlign?: FormHorizontalAlign;
29
+ /**
30
+ * @description 标签宽度
31
+ * @default
32
32
  */
33
- labelAlign?: FormLayoutAlign;
34
33
  labelWidth?: number;
34
+ /**
35
+ * @description 表单控件的对齐方式
36
+ * @default left
37
+ */
38
+ contentAlign?: FormHorizontalAlign;
39
+ /**
40
+ * @description 是否显示必填标记
41
+ * @default true
42
+ */
35
43
  requiredMark?: RequiredMark;
36
44
  /**
37
45
  * @description 是否隐藏错误信息,主要用于自定义异常样式
38
46
  * @default false
39
47
  */
40
48
  hiddenError?: boolean;
49
+ /**
50
+ * @description 表单底部内容
51
+ * @default
52
+ */
53
+ extra?: React.ReactNode;
41
54
  }
42
- export declare const InternalForm: React.ForwardRefRenderFunction<FormRef, FormProps>;
55
+ declare const InternalForm: React.ForwardRefExoticComponent<FormProps<any> & React.RefAttributes<FormRef>>;
43
56
  export { useWatch };
44
57
  export default InternalForm;
package/dist/Form/form.js CHANGED
@@ -1,31 +1,43 @@
1
- var _excluded = ["children", "layout", "labelAlign", "labelWidth", "requiredMark", "hiddenError"];
1
+ var _excluded = ["children", "colon", "layout", "labelAlign", "labelWidth", "contentAlign", "requiredMark", "hiddenError", "extra"];
2
2
  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); }
3
3
  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; }
4
4
  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; }
5
5
  import FieldForm, { useWatch } from 'rc-field-form';
6
6
  import React from 'react';
7
7
  import { FormContext } from "./context";
8
- import "./style.scss";
9
- export var InternalForm = function InternalForm(_ref, ref) {
8
+ import "./styles.scss";
9
+ var InternalForm = /*#__PURE__*/React.forwardRef(function Form(_ref, ref) {
10
10
  var children = _ref.children,
11
+ _ref$colon = _ref.colon,
12
+ colon = _ref$colon === void 0 ? false : _ref$colon,
11
13
  layout = _ref.layout,
12
14
  labelAlign = _ref.labelAlign,
13
15
  labelWidth = _ref.labelWidth,
16
+ contentAlign = _ref.contentAlign,
14
17
  requiredMark = _ref.requiredMark,
15
18
  _ref$hiddenError = _ref.hiddenError,
16
19
  hiddenError = _ref$hiddenError === void 0 ? false : _ref$hiddenError,
17
- props = _objectWithoutProperties(_ref, _excluded);
18
- return /*#__PURE__*/React.createElement(FormContext.Provider, {
19
- value: {
20
- layout: layout || 'horizontal',
21
- labelAlign: labelAlign || 'left',
20
+ extra = _ref.extra,
21
+ rest = _objectWithoutProperties(_ref, _excluded);
22
+ var contextValue = React.useMemo(function () {
23
+ return {
24
+ colon: colon,
25
+ layout: layout !== null && layout !== void 0 ? layout : 'horizontal',
26
+ labelAlign: labelAlign !== null && labelAlign !== void 0 ? labelAlign : 'start',
22
27
  labelWidth: labelWidth,
23
- requiredMark: requiredMark || true,
24
- hiddenError: hiddenError
25
- }
26
- }, /*#__PURE__*/React.createElement(FieldForm, _extends({}, props, {
28
+ contentAlign: contentAlign !== null && contentAlign !== void 0 ? contentAlign : 'start',
29
+ requiredMark: requiredMark !== null && requiredMark !== void 0 ? requiredMark : true,
30
+ hiddenError: hiddenError,
31
+ extra: extra
32
+ };
33
+ }, [colon, layout, labelAlign, labelWidth, contentAlign, requiredMark, hiddenError, extra]);
34
+ return /*#__PURE__*/React.createElement(FormContext.Provider, {
35
+ value: contextValue
36
+ }, /*#__PURE__*/React.createElement(FieldForm, _extends({}, rest, {
37
+ ref: ref,
27
38
  component: false
28
39
  }), children));
29
- };
40
+ });
41
+ InternalForm.displayName = 'Form';
30
42
  export { useWatch };
31
43
  export default InternalForm;
@@ -1,9 +1,3 @@
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 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; }
3
- 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; }
4
- 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; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- 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); }
7
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
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."); }
9
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); }
@@ -16,9 +10,8 @@ export default function useForm(form) {
16
10
  var _useRcForm = useRcForm(),
17
11
  _useRcForm2 = _slicedToArray(_useRcForm, 1),
18
12
  rcForm = _useRcForm2[0];
19
- var itemsRef = React.useRef({});
20
13
  var wrapForm = React.useMemo(function () {
21
- return form !== null && form !== void 0 ? form : _objectSpread({}, rcForm);
14
+ return form !== null && form !== void 0 ? form : rcForm;
22
15
  }, [form, rcForm]);
23
16
  return [wrapForm];
24
17
  }
@@ -1,6 +1,5 @@
1
1
  import { FormContext } from "../context";
2
2
  import React from "react";
3
3
  export function useFormContext() {
4
- var formContext = React.useContext(FormContext);
5
- return formContext;
4
+ return React.useContext(FormContext);
6
5
  }
@@ -1,12 +1,17 @@
1
+ import FieldForm, { Field } from 'rc-field-form';
1
2
  import InternalForm, { FormProps, useWatch } from "./form";
2
- import FormItem, { FormItemProps } from "./FormItem";
3
+ import { ErrorList } from "./ErrorList";
3
4
  import useForm from "./hooks/useForm";
5
+ import { FormItemLayout, FormLayout, FormHorizontalAlign, FormItemVerticalAlign } from "./types";
6
+ export { Field };
7
+ export { useFormContext } from "./hooks/useFormContext";
4
8
  type InternalFormType = typeof InternalForm;
5
9
  type CompoundedComponent = InternalFormType & {
6
10
  useForm: typeof useForm;
7
- Item: typeof FormItem;
11
+ List: typeof FieldForm.List;
12
+ ErrorList: typeof ErrorList;
8
13
  useWatch: typeof useWatch;
9
14
  };
10
15
  declare const Form: CompoundedComponent;
11
- export type { FormProps, FormItemProps };
16
+ export type { FormProps, FormLayout, FormItemLayout, FormHorizontalAlign, FormItemVerticalAlign, };
12
17
  export default Form;
@@ -1,8 +1,13 @@
1
+ import FieldForm, { Field } from 'rc-field-form';
1
2
  import InternalForm, { useWatch } from "./form";
2
- import FormItem from "./FormItem";
3
+ import { ErrorList } from "./ErrorList";
3
4
  import useForm from "./hooks/useForm";
5
+ export { Field };
6
+ export { useFormContext } from "./hooks/useFormContext";
4
7
  var Form = InternalForm;
8
+ Form.List = FieldForm.List;
9
+ Form.ErrorList = ErrorList;
5
10
  Form.useForm = useForm;
6
- Form.Item = FormItem;
11
+ // Form.Item = FormItem;
7
12
  Form.useWatch = useWatch;
8
13
  export default Form;
@@ -0,0 +1,11 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ .triones-antm-form{
4
+ &-item{
5
+ &-explain-error{
6
+ font-size: variable.$trionesFontSizeSm;
7
+ color: variable.$trionesColorError;
8
+ }
9
+ }
10
+
11
+ }
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export type RequiredMark = boolean | 'optional' | ((labelNode: React.ReactNode, info: {
3
+ required: boolean;
4
+ }) => React.ReactNode);
5
+ export type FormLayout = 'horizontal' | 'inline' | 'vertical';
6
+ export type FormItemLayout = 'horizontal' | 'vertical';
7
+ export type FormHorizontalAlign = 'start' | 'end';
8
+ export type FormItemVerticalAlign = 'start' | 'center';
@@ -0,0 +1,22 @@
1
+ import React, { FC, PropsWithChildren } from "react";
2
+ import { AntSize } from "../types";
3
+ export type VariantType = 'outlined' | 'borderless' | 'filled' | 'underlined' | undefined;
4
+ export type FormCellProps = {
5
+ className?: string;
6
+ style?: React.CSSProperties;
7
+ styles?: {
8
+ root?: React.CSSProperties;
9
+ content?: React.CSSProperties;
10
+ extra?: React.CSSProperties;
11
+ arrow?: React.CSSProperties;
12
+ };
13
+ value?: React.ReactNode;
14
+ size?: AntSize;
15
+ variant?: VariantType;
16
+ placeholder?: string;
17
+ onClick?: () => void;
18
+ extra?: React.ReactNode;
19
+ arrow?: boolean | React.ReactNode;
20
+ align?: 'start' | 'center' | 'end';
21
+ };
22
+ export declare const FormCell: FC<PropsWithChildren<FormCellProps>>;
@@ -0,0 +1,57 @@
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 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; }
3
+ 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; }
4
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ 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); }
7
+ import React from "react";
8
+ import classNames from "classnames";
9
+ import { RightOutline } from "@trionesdev/antd-mobile-icons-react";
10
+ import ConfigProvider from "../ConfigProvider";
11
+ import { mergeProp } from "../utils/with-default-props";
12
+ var cls = 'triones-antm-form-cell';
13
+ var defaultArrowIcon = /*#__PURE__*/React.createElement(RightOutline, null);
14
+ export var FormCell = function FormCell(_ref) {
15
+ var className = _ref.className,
16
+ style = _ref.style,
17
+ styles = _ref.styles,
18
+ children = _ref.children,
19
+ value = _ref.value,
20
+ _ref$size = _ref.size,
21
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
22
+ _ref$variant = _ref.variant,
23
+ variant = _ref$variant === void 0 ? 'borderless' : _ref$variant,
24
+ placeholder = _ref.placeholder,
25
+ extra = _ref.extra,
26
+ _ref$arrow = _ref.arrow,
27
+ arrow = _ref$arrow === void 0 ? false : _ref$arrow,
28
+ _ref$align = _ref.align,
29
+ align = _ref$align === void 0 ? 'left' : _ref$align,
30
+ onClick = _ref.onClick;
31
+ var _ConfigProvider$useCo = ConfigProvider.useConfig(),
32
+ _ConfigProvider$useCo2 = _ConfigProvider$useCo.form,
33
+ componentConfig = _ConfigProvider$useCo2 === void 0 ? {} : _ConfigProvider$useCo2;
34
+ var mergedArrow = function () {
35
+ if (arrow === false || arrow === undefined || arrow === null) return null;
36
+ if (arrow === true) {
37
+ return mergeProp(defaultArrowIcon, componentConfig.arrowIcon);
38
+ }
39
+ return arrow;
40
+ }();
41
+ return /*#__PURE__*/React.createElement("div", {
42
+ className: classNames("".concat(cls), "".concat(cls, "-").concat(align), "".concat(cls, "-").concat(size), "".concat(cls, "-").concat(variant), className),
43
+ style: _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root),
44
+ onClick: onClick
45
+ }, /*#__PURE__*/React.createElement("div", {
46
+ className: classNames("".concat(cls, "-content")),
47
+ style: styles === null || styles === void 0 ? void 0 : styles.content
48
+ }, children || value || placeholder && /*#__PURE__*/React.createElement("div", {
49
+ className: classNames("".concat(cls, "-placeholder"))
50
+ }, placeholder)), extra && /*#__PURE__*/React.createElement("div", {
51
+ className: classNames("".concat(cls, "-extra")),
52
+ style: styles === null || styles === void 0 ? void 0 : styles.extra
53
+ }, extra), mergedArrow && /*#__PURE__*/React.createElement("div", {
54
+ className: classNames("".concat(cls, "-arrow")),
55
+ style: styles === null || styles === void 0 ? void 0 : styles.arrow
56
+ }, mergedArrow));
57
+ };
@@ -0,0 +1,4 @@
1
+ import { FormCell, FormCellProps } from "./FormCell";
2
+ import "./styles.scss";
3
+ export type { FormCellProps };
4
+ export default FormCell;
@@ -0,0 +1,3 @@
1
+ import { FormCell } from "./FormCell";
2
+ import "./styles.scss";
3
+ export default FormCell;
@@ -0,0 +1,103 @@
1
+ @use "../style/variable" as variable;
2
+
3
+ $cellCls: 'triones-antm-form-cell';
4
+
5
+ .#{$cellCls} {
6
+ width: 100%;
7
+ display: flex;
8
+ flex-direction: row;
9
+ gap: 4Px;
10
+ align-items: center;
11
+
12
+ &-content {
13
+ flex: 1 auto;
14
+ display: flex;
15
+ align-items: center;
16
+ min-height: 20Px;
17
+ }
18
+
19
+ &-placeholder {
20
+ font-size: variable.$trionesFontSize;
21
+ color: variable.$trionesColorTextPlaceholder;
22
+ //width: 100%;
23
+ }
24
+
25
+ &-extra {
26
+ flex-shrink: 0;
27
+ }
28
+
29
+ &-arrow {
30
+ flex-shrink: 0;
31
+
32
+ .triones-antm-icon {
33
+ color: variable.$trionesColorTextPlaceholder;
34
+ font-size: variable.$trionesFontSize;
35
+ }
36
+ }
37
+
38
+ &-small {
39
+ min-height: 20Px;
40
+ }
41
+
42
+ &-medium {
43
+ //min-height: 32Px;
44
+ }
45
+
46
+ &-large {
47
+ min-height: 40Px;
48
+ }
49
+
50
+ &-start {
51
+ .#{$cellCls} {
52
+ &-content {
53
+ justify-content: flex-start;
54
+ }
55
+ }
56
+ }
57
+
58
+ &-center {
59
+ .#{$cellCls} {
60
+ &-content {
61
+ justify-content: center;
62
+ }
63
+ }
64
+ }
65
+
66
+ &-end {
67
+ .#{$cellCls} {
68
+ &-content {
69
+ justify-content: flex-end;
70
+ }
71
+ }
72
+ }
73
+
74
+ &-borderless {
75
+ border: 0;
76
+ }
77
+
78
+ &-outlined {
79
+ border-radius: variable.$trionesBorderRadius;
80
+ border: 1Px solid variable.$trionesBorderColor;
81
+ padding-inline: 4Px;
82
+ box-sizing: border-box;
83
+ min-height: variable.$trionesControlHeight;
84
+ }
85
+
86
+ &-filled {
87
+ border-radius: variable.$trionesBorderRadius;
88
+ background-color: variable.$trionesColorFillTertiary;
89
+ padding-inline: 4Px;
90
+ box-sizing: border-box;
91
+ border: 0;
92
+ min-height: variable.$trionesControlHeight;
93
+ }
94
+
95
+ &-underlined {
96
+ border-top: 0;
97
+ border-left: 0;
98
+ border-right: 0;
99
+ border-bottom: 1Px solid variable.$trionesBorderColor;
100
+ box-sizing: border-box;
101
+ min-height: variable.$trionesControlHeight;
102
+ }
103
+ }
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ export interface IndexedStackProps {
3
+ children: ReactNode[];
4
+ activeIndex: number;
5
+ className?: string;
6
+ style?: React.CSSProperties;
7
+ }
8
+ declare const IndexedStack: React.FC<IndexedStackProps>;
9
+ export { IndexedStack };
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ var IndexedStack = function IndexedStack(_ref) {
3
+ var children = _ref.children,
4
+ _ref$activeIndex = _ref.activeIndex,
5
+ activeIndex = _ref$activeIndex === void 0 ? 0 : _ref$activeIndex,
6
+ className = _ref.className,
7
+ style = _ref.style;
8
+ // 确保 activeIndex 在有效范围内
9
+ var validActiveIndex = Math.max(0, Math.min(activeIndex, children.length - 1));
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ className: className,
12
+ style: style
13
+ }, React.Children.map(children, function (child, index) {
14
+ if (! /*#__PURE__*/React.isValidElement(child)) {
15
+ return null;
16
+ }
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ key: index,
19
+ style: {
20
+ display: index === validActiveIndex ? 'block' : 'none',
21
+ width: '100%',
22
+ height: '100%'
23
+ }
24
+ }, child);
25
+ }));
26
+ };
27
+ export { IndexedStack };
@@ -0,0 +1,3 @@
1
+ import { IndexedStack, IndexedStackProps } from './IndexedStack';
2
+ export type { IndexedStackProps };
3
+ export default IndexedStack;
@@ -0,0 +1,2 @@
1
+ import { IndexedStack } from "./IndexedStack";
2
+ export default IndexedStack;
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { FC } from "react";
1
+ import React, { FC } from "react";
3
2
  import "./style.scss";
4
3
  export type InputNumberProps = {
5
4
  value?: number;
@@ -7,6 +6,8 @@ export type InputNumberProps = {
7
6
  step?: number;
8
7
  min?: number;
9
8
  max?: number;
9
+ disabled?: boolean;
10
+ block?: boolean;
10
11
  className?: string;
11
12
  style?: React.CSSProperties;
12
13
  };
@@ -8,62 +8,84 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import React, { useEffect } from "react";
11
+ import React, { useEffect, useState } from "react";
12
12
  import classNames from "classnames";
13
- import { AddOutline, MinusOutline } from "../../../antd-mobile-icons-react";
13
+ import { AddOutline, MinusOutline } from "@trionesdev/antd-mobile-icons-react";
14
14
  import "./style.scss";
15
+ function clampValue(n, min, max) {
16
+ var v = n;
17
+ if (min !== undefined) v = Math.max(min, v);
18
+ if (max !== undefined) v = Math.min(max, v);
19
+ return v;
20
+ }
15
21
  export var InputNumber = function InputNumber(_ref) {
16
22
  var value = _ref.value,
17
- _onChange = _ref.onChange,
23
+ onChange = _ref.onChange,
18
24
  step = _ref.step,
19
25
  min = _ref.min,
20
26
  max = _ref.max,
27
+ _ref$disabled = _ref.disabled,
28
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
29
+ _ref$block = _ref.block,
30
+ block = _ref$block === void 0 ? false : _ref$block,
21
31
  className = _ref.className,
22
32
  style = _ref.style;
23
- var _React$useState = React.useState(value || 0),
24
- _React$useState2 = _slicedToArray(_React$useState, 2),
25
- internalValue = _React$useState2[0],
26
- setInternalValue = _React$useState2[1];
33
+ var _useState = useState(value !== null && value !== void 0 ? value : 0),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ internalValue = _useState2[0],
36
+ setInternalValue = _useState2[1];
37
+ var stepSize = step !== null && step !== void 0 ? step : 1;
27
38
  useEffect(function () {
28
39
  if (value !== undefined) {
29
- if (value !== internalValue) {
30
- setInternalValue(value);
31
- }
40
+ setInternalValue(clampValue(value, min, max));
32
41
  }
33
- }, [value]);
42
+ }, [value, min, max]);
34
43
  var minMatch = min !== undefined && internalValue <= min;
35
44
  var maxMatch = max !== undefined && internalValue >= max;
36
45
  var trionesInputNumberCls = 'triones-antm-input-number';
46
+ var setValue = function setValue(next) {
47
+ var clamped = clampValue(next, min, max);
48
+ setInternalValue(clamped);
49
+ onChange === null || onChange === void 0 || onChange(clamped);
50
+ };
37
51
  return /*#__PURE__*/React.createElement("div", {
38
- className: classNames(trionesInputNumberCls, className),
52
+ className: classNames(trionesInputNumberCls, _defineProperty({}, "".concat(trionesInputNumberCls, "--block"), block), className),
39
53
  style: style
40
54
  }, /*#__PURE__*/React.createElement("div", {
41
- className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty({}, "".concat(trionesInputNumberCls, "-button-disabled"), minMatch)),
55
+ className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty({}, "".concat(trionesInputNumberCls, "-button-disabled"), minMatch || disabled)),
56
+ role: "button",
57
+ tabIndex: disabled || minMatch ? -1 : 0,
42
58
  onClick: function onClick() {
43
- if (minMatch) {
59
+ if (minMatch || disabled) {
44
60
  return;
45
61
  }
46
- var newValue = internalValue - (step || 1);
47
- setInternalValue(newValue);
48
- _onChange === null || _onChange === void 0 || _onChange(newValue);
62
+ setValue(internalValue - stepSize);
49
63
  }
50
- }, /*#__PURE__*/React.createElement(MinusOutline, null)), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("input", {
64
+ }, /*#__PURE__*/React.createElement(MinusOutline, null)), /*#__PURE__*/React.createElement("div", {
65
+ className: "".concat(trionesInputNumberCls, "-input")
66
+ }, /*#__PURE__*/React.createElement("input", {
51
67
  type: "number",
68
+ disabled: disabled,
69
+ min: min,
70
+ max: max,
71
+ step: stepSize,
52
72
  value: internalValue,
53
73
  onChange: function onChange(e) {
54
- var newVal = Number(e.target.value);
55
- setInternalValue(newVal);
56
- _onChange === null || _onChange === void 0 || _onChange(newVal);
74
+ var num = Number(e.target.value);
75
+ if (!Number.isFinite(num)) {
76
+ return;
77
+ }
78
+ setValue(num);
57
79
  }
58
80
  })), /*#__PURE__*/React.createElement("div", {
59
- className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty({}, "".concat(trionesInputNumberCls, "-button-disabled"), maxMatch)),
81
+ className: classNames("".concat(trionesInputNumberCls, "-button"), _defineProperty({}, "".concat(trionesInputNumberCls, "-button-disabled"), maxMatch || disabled)),
82
+ role: "button",
83
+ tabIndex: disabled || maxMatch ? -1 : 0,
60
84
  onClick: function onClick() {
61
- if (maxMatch) {
85
+ if (maxMatch || disabled) {
62
86
  return;
63
87
  }
64
- var newVal = internalValue + (step || 1);
65
- setInternalValue(newVal);
66
- _onChange === null || _onChange === void 0 || _onChange(newVal);
88
+ setValue(internalValue + stepSize);
67
89
  }
68
90
  }, /*#__PURE__*/React.createElement(AddOutline, null)));
69
91
  };