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

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 (56) hide show
  1. package/dist/Button/style.scss +40 -38
  2. package/dist/Calendar/style.scss +4 -4
  3. package/dist/CalendarDatetimePicker/style.scss +7 -7
  4. package/dist/CalendarPicker/style.scss +5 -5
  5. package/dist/Cell/demo/base.js +16 -2
  6. package/dist/Checkbox/demo/base.js +9 -4
  7. package/dist/Checkbox/demo/disabled.js +2 -1
  8. package/dist/DemoBlock/index.d.ts +6 -0
  9. package/dist/DemoBlock/index.js +9 -2
  10. package/dist/Form/FormItem/form-item-input.d.ts +15 -0
  11. package/dist/Form/FormItem/form-item-input.js +39 -0
  12. package/dist/Form/FormItem/form-item-label.d.ts +13 -0
  13. package/dist/Form/FormItem/form-item-label.js +27 -0
  14. package/dist/Form/FormItem/form-item.d.ts +22 -0
  15. package/dist/Form/FormItem/form-item.js +73 -0
  16. package/dist/Form/FormItem/index.d.ts +5 -0
  17. package/dist/Form/FormItem/index.js +3 -0
  18. package/dist/Form/demo/input.js +1 -1
  19. package/dist/Form/index.d.ts +8 -1
  20. package/dist/Form/index.js +5 -1
  21. package/dist/Form/style.scss +67 -0
  22. package/dist/ImagesWall/style.scss +4 -4
  23. package/dist/Input/base-input.d.ts +13 -0
  24. package/dist/Input/base-input.js +41 -0
  25. package/dist/Input/demo/base.js +51 -10
  26. package/dist/Input/index.d.ts +14 -2
  27. package/dist/Input/index.js +11 -1
  28. package/dist/Input/index.scss +199 -0
  29. package/dist/Input/input-affix-wrapper.d.ts +9 -0
  30. package/dist/Input/input-affix-wrapper.js +31 -0
  31. package/dist/Input/input-opt.d.ts +16 -0
  32. package/dist/Input/input-opt.js +87 -0
  33. package/dist/Input/input-password.d.ts +7 -0
  34. package/dist/Input/input-password.js +48 -0
  35. package/dist/Input/input.d.ts +16 -0
  36. package/dist/Input/input.js +63 -0
  37. package/dist/Input/textarea.d.ts +13 -0
  38. package/dist/Input/textarea.js +45 -0
  39. package/dist/Input/types.d.ts +2 -0
  40. package/dist/Input/types.js +2 -0
  41. package/dist/Progress/Progress.d.ts +2 -2
  42. package/dist/Progress/ProgressCircle.d.ts +2 -2
  43. package/dist/Progress/ProgressLine.d.ts +2 -2
  44. package/dist/Radio/demo/base.js +2 -2
  45. package/dist/SideBar/style.scss +6 -6
  46. package/dist/Swiper/style.scss +1 -1
  47. package/dist/VerificationCodeInput/demo/base.js +2 -2
  48. package/dist/VerificationCodeInput/index.d.ts +2 -2
  49. package/dist/VerificationCodeInput/index.js +1 -1
  50. package/dist/VerificationCodeInput/style.scss +20 -0
  51. package/dist/VerificationCodeInput/verification-code-input.d.ts +24 -0
  52. package/dist/VerificationCodeInput/verification-code-input.js +99 -0
  53. package/dist/index.d.ts +1 -1
  54. package/dist/types.d.ts +0 -8
  55. package/dist/types.js +0 -1
  56. package/package.json +6 -6
@@ -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
222
  &-middle {
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,4 +1,4 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $calendarCls: 'triones-antm-calendar';
4
4
 
@@ -14,7 +14,7 @@ $calendarCls: 'triones-antm-calendar';
14
14
  display: flex;
15
15
  justify-content: center;
16
16
  align-items: center;
17
- border-radius: $trionesBorderRadius;
17
+ border-radius: variable.$trionesBorderRadius;
18
18
  cursor: default;
19
19
  flex-direction: column;
20
20
 
@@ -39,13 +39,13 @@ $calendarCls: 'triones-antm-calendar';
39
39
  }
40
40
 
41
41
  &-selected {
42
- background-color: $trionesColorPrimary;
42
+ background-color: variable.$trionesColorPrimary;
43
43
  color: white;
44
44
  }
45
45
 
46
46
  &-selected-range {
47
47
  border-radius: 0;
48
- background-color: $trionesColorPrimaryBg;
48
+ background-color: variable.$trionesColorPrimaryBg;
49
49
  color: black;
50
50
  }
51
51
  }
@@ -1,15 +1,15 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $calendarDatetimePickerCls: 'triones-antm-calendar-datetime-picker';
4
4
 
5
5
  .#{$calendarDatetimePickerCls} {
6
- border-top-left-radius: $trionesBorderRadius;
7
- border-top-right-radius: $trionesBorderRadius;
6
+ border-top-left-radius: variable.$trionesBorderRadius;
7
+ border-top-right-radius: variable.$trionesBorderRadius;
8
8
 
9
9
  &-header {
10
10
  display: flex;
11
11
  justify-content: space-between;
12
- border-bottom: 1Px solid $trionesBorderColor;
12
+ border-bottom: 1Px solid variable.$trionesBorderColor;
13
13
 
14
14
 
15
15
  &-display {
@@ -31,9 +31,9 @@ $calendarDatetimePickerCls: 'triones-antm-calendar-datetime-picker';
31
31
  }
32
32
 
33
33
  &-active {
34
- color: $trionesColorText;
34
+ color: variable.$trionesColorText;
35
35
  font-weight: bold;
36
- background-color: $trionesColorBgTextActive;
36
+ background-color: variable.$trionesColorBgTextActive;
37
37
  }
38
38
  }
39
39
 
@@ -44,7 +44,7 @@ $calendarDatetimePickerCls: 'triones-antm-calendar-datetime-picker';
44
44
  }
45
45
 
46
46
  &-ok {
47
- color: $trionesColorPrimary;
47
+ color: variable.$trionesColorPrimary;
48
48
  }
49
49
  }
50
50
  }
@@ -1,15 +1,15 @@
1
- @use "../style/variable" as *;
1
+ @use "../style/variable" as variable;
2
2
 
3
3
  $calendarPickerCls: 'triones-antm-calendar-picker';
4
4
 
5
5
  .#{$calendarPickerCls} {
6
- border-top-left-radius: $trionesBorderRadius;
7
- border-top-right-radius: $trionesBorderRadius;
6
+ border-top-left-radius: variable.$trionesBorderRadius;
7
+ border-top-right-radius: variable.$trionesBorderRadius;
8
8
 
9
9
  &-header {
10
10
  display: flex;
11
11
  justify-content: space-between;
12
- border-bottom: 1Px solid $trionesBorderColor;
12
+ border-bottom: 1Px solid variable.$trionesBorderColor;
13
13
  padding: 4Px;
14
14
  &-button {
15
15
  padding: 8Px 12Px;
@@ -18,7 +18,7 @@ $calendarPickerCls: 'triones-antm-calendar-picker';
18
18
  }
19
19
 
20
20
  &-ok {
21
- color: $trionesColorPrimary;
21
+ color: variable.$trionesColorPrimary;
22
22
  }
23
23
  }
24
24
 
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { DemoBlock } from "../../DemoBlock";
3
3
  import Cell from "../index";
4
+ import { Divider } from "@trionesdev/antd-mobile-base-react";
4
5
  export default (function () {
5
6
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DemoBlock, {
6
7
  title: "\u57FA\u7840\u7528\u6CD5"
@@ -8,6 +9,19 @@ export default (function () {
8
9
  title: "\u5206\u7EC4"
9
10
  }, /*#__PURE__*/React.createElement(Cell.Group, {
10
11
  title: '标题',
11
- divider: true
12
- }, /*#__PURE__*/React.createElement(Cell, null, "\u6807\u9898"), /*#__PURE__*/React.createElement(Cell, null, "\u6807\u9898"), /*#__PURE__*/React.createElement(Cell, null, "\u6807\u9898"))));
12
+ divider: /*#__PURE__*/React.createElement(Divider, null)
13
+ }, /*#__PURE__*/React.createElement(Cell, null, "\u6807\u9898"), /*#__PURE__*/React.createElement(Cell, null, "\u6807\u9898"), /*#__PURE__*/React.createElement(Cell, null, "\u6807\u9898"))), /*#__PURE__*/React.createElement(DemoBlock, {
14
+ title: "\u5206\u7EC4\u5E26Label"
15
+ }, /*#__PURE__*/React.createElement(Cell.Group, {
16
+ title: '标题',
17
+ labelCol: {
18
+ flex: 100
19
+ }
20
+ }, /*#__PURE__*/React.createElement(Cell, {
21
+ label: 'Label'
22
+ }, "\u6807\u9898"), /*#__PURE__*/React.createElement(Cell, {
23
+ label: 'Label'
24
+ }, "\u6807\u9898"), /*#__PURE__*/React.createElement(Cell, {
25
+ label: 'Label'
26
+ }, "\u6807\u9898"))));
13
27
  });
@@ -26,18 +26,23 @@ export default (function () {
26
26
  disabled: true
27
27
  }, "\u9999\u8549")), /*#__PURE__*/React.createElement(DemoBlock, {
28
28
  title: "Button"
29
- }, /*#__PURE__*/React.createElement(Checkbox.Button, null, "\u82F9\u679C")), /*#__PURE__*/React.createElement(DemoBlock, {
29
+ }, /*#__PURE__*/React.createElement(Checkbox, {
30
+ shape: "button"
31
+ }, "\u82F9\u679C")), /*#__PURE__*/React.createElement(DemoBlock, {
30
32
  title: "Button \u7981\u7528"
31
- }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Checkbox.Button, {
33
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Checkbox, {
34
+ shape: "button",
32
35
  disabled: true
33
- }, "\u82F9\u679C"), /*#__PURE__*/React.createElement(Checkbox.Button, {
36
+ }, "\u82F9\u679C"), /*#__PURE__*/React.createElement(Checkbox, {
37
+ shape: "button",
34
38
  disabled: true,
35
39
  checked: true
36
40
  }, "\u82F9\u679C"))), /*#__PURE__*/React.createElement(DemoBlock, {
37
41
  title: "\u5206\u7EC4"
38
42
  }, /*#__PURE__*/React.createElement(Checkbox.Group, {
39
43
  defaultValue: ['1']
40
- }, /*#__PURE__*/React.createElement(Checkbox.Button, {
44
+ }, /*#__PURE__*/React.createElement(Checkbox, {
45
+ shape: "button",
41
46
  value: '1'
42
47
  }, "\u82F9\u679C"))));
43
48
  });
@@ -12,7 +12,8 @@ export default (function () {
12
12
  disabled: true
13
13
  }, "\u9999\u8549")), /*#__PURE__*/React.createElement(DemoBlock, {
14
14
  title: "Button"
15
- }, /*#__PURE__*/React.createElement(Checkbox.Button, {
15
+ }, /*#__PURE__*/React.createElement(Checkbox, {
16
+ shape: "button",
16
17
  checked: true,
17
18
  disabled: true
18
19
  }, "\u82F9\u679C")));
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { FC, ReactNode } from 'react';
2
3
  import './index.scss';
3
4
  interface Props {
@@ -5,6 +6,11 @@ interface Props {
5
6
  padding?: string;
6
7
  background?: string;
7
8
  children?: ReactNode;
9
+ className?: string;
10
+ style?: React.CSSProperties;
11
+ styles?: {
12
+ body?: React.CSSProperties;
13
+ };
8
14
  }
9
15
  export declare const DemoBlock: FC<Props>;
10
16
  export {};
@@ -1,15 +1,22 @@
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); }
1
7
  import React from 'react';
2
8
  import "./index.scss";
3
9
  export var DemoBlock = function DemoBlock(props) {
10
+ var _props$styles;
4
11
  return /*#__PURE__*/React.createElement("div", {
5
12
  className: "demoBlock"
6
13
  }, /*#__PURE__*/React.createElement("div", {
7
14
  className: "demoTitle"
8
15
  }, props.title), /*#__PURE__*/React.createElement("div", {
9
16
  className: "demoMain",
10
- style: {
17
+ style: _objectSpread({
11
18
  padding: '12px 12px',
12
19
  background: '#ffffff'
13
- }
20
+ }, (_props$styles = props.styles) === null || _props$styles === void 0 ? void 0 : _props$styles.body)
14
21
  }, props.children));
15
22
  };
@@ -0,0 +1,15 @@
1
+ import { Rule } from 'rc-field-form/lib/interface';
2
+ import React, { FC } from 'react';
3
+ type FormItemInputProps = {
4
+ children?: React.ReactElement;
5
+ className?: string;
6
+ name?: string;
7
+ rules?: Rule[];
8
+ initialValue?: any;
9
+ valuePropName?: string;
10
+ errors?: React.ReactNode[];
11
+ errorRender?: (errors?: any[]) => React.ReactNode;
12
+ hiddenError?: boolean;
13
+ };
14
+ export declare const FormItemInput: FC<FormItemInputProps>;
15
+ export {};
@@ -0,0 +1,39 @@
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 classNames from 'classnames';
8
+ import { isEmpty } from 'lodash-es';
9
+ import { Field } from 'rc-field-form';
10
+ import React, { useState } from 'react';
11
+ export var FormItemInput = function FormItemInput(_ref) {
12
+ var children = _ref.children,
13
+ className = _ref.className,
14
+ name = _ref.name,
15
+ rules = _ref.rules,
16
+ initialValue = _ref.initialValue,
17
+ valuePropName = _ref.valuePropName,
18
+ errorRender = _ref.errorRender,
19
+ hiddenError = _ref.hiddenError;
20
+ var _useState = useState(),
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ meta = _useState2[0],
23
+ setMeta = _useState2[1];
24
+ var clsPrefix = 'triones-antm-form-item';
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ className: classNames(className)
27
+ }, /*#__PURE__*/React.createElement(Field, {
28
+ name: name,
29
+ rules: rules,
30
+ valuePropName: valuePropName,
31
+ trigger: 'onChange',
32
+ onMetaChange: function onMetaChange(meta) {
33
+ setMeta(meta);
34
+ },
35
+ initialValue: initialValue
36
+ }, children), !hiddenError && !isEmpty(meta === null || meta === void 0 ? void 0 : meta.errors) && /*#__PURE__*/React.createElement("div", {
37
+ className: classNames("".concat(clsPrefix, "-error"))
38
+ }, (errorRender === null || errorRender === void 0 ? void 0 : errorRender(meta === null || meta === void 0 ? void 0 : meta.errors)) || (meta === null || meta === void 0 ? void 0 : meta.errors.join(','))));
39
+ };
@@ -0,0 +1,13 @@
1
+ import React, { CSSProperties, FC } from "react";
2
+ import { NamePath } from "rc-field-form/lib/interface";
3
+ import { FormItemLayout } from "@trionesdev/antd-mobile-base-react";
4
+ type FormItemLabelProps = {
5
+ className?: string;
6
+ style?: CSSProperties;
7
+ label?: React.ReactNode;
8
+ layout?: FormItemLayout;
9
+ name?: NamePath;
10
+ required?: boolean;
11
+ };
12
+ export declare const FormItemLabel: FC<FormItemLabelProps>;
13
+ export {};
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+ import { isFunction } from "lodash-es";
4
+ import { useFormContext } from "@trionesdev/antd-mobile-base-react";
5
+ export var FormItemLabel = function FormItemLabel(_ref) {
6
+ var className = _ref.className,
7
+ style = _ref.style,
8
+ label = _ref.label,
9
+ layout = _ref.layout,
10
+ required = _ref.required;
11
+ var _useFormContext = useFormContext(),
12
+ requiredMark = _useFormContext.requiredMark,
13
+ colon = _useFormContext.colon;
14
+ var clsPrefix = "triones-antm-form-item-label";
15
+ return /*#__PURE__*/React.createElement("div", {
16
+ className: classNames(className, {
17
+ required: "".concat(clsPrefix, "-required")
18
+ }),
19
+ style: style
20
+ }, /*#__PURE__*/React.createElement("div", {
21
+ className: classNames("".concat(clsPrefix, "-wrapper"))
22
+ }, required && /*#__PURE__*/React.createElement("div", {
23
+ className: "".concat(clsPrefix, "-required-mark")
24
+ }, isFunction(requiredMark) ? requiredMark(label, {
25
+ required: required
26
+ }) : '*'), label, layout == 'horizontal' && colon && ':'));
27
+ };
@@ -0,0 +1,22 @@
1
+ import React, { CSSProperties, FC, ReactElement, ReactNode } from "react";
2
+ import { NamePath, Rule } from "rc-field-form/lib/interface";
3
+ import { FormItemLayout, FormLayoutAlign } from "@trionesdev/antd-mobile-base-react";
4
+ export type FormItemProps = {
5
+ className?: string;
6
+ style?: CSSProperties;
7
+ children?: ReactElement;
8
+ layout?: FormItemLayout;
9
+ label?: ReactNode;
10
+ labelAlign?: FormLayoutAlign;
11
+ labelWidth?: number;
12
+ name?: NamePath;
13
+ required?: boolean;
14
+ hidden?: boolean;
15
+ noStyle?: boolean;
16
+ rules?: Rule[];
17
+ initialValue?: any;
18
+ valuePropName?: string;
19
+ errorRender?: (errors?: any[]) => React.ReactNode;
20
+ extra?: ReactNode;
21
+ };
22
+ export declare const FormItem: FC<FormItemProps>;
@@ -0,0 +1,73 @@
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 = ["className", "style", "children", "layout", "label", "labelAlign", "labelWidth", "name", "required", "hidden", "noStyle", "rules", "initialValue", "valuePropName", "errorRender", "extra"];
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 _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
+ 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; }
8
+ 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; }
9
+ import React from "react";
10
+ import { FormItemLabel } from "./form-item-label";
11
+ import { FormItemInput } from "./form-item-input";
12
+ import classNames from "classnames";
13
+ import { Field } from "rc-field-form";
14
+ import { useFormContext } from "@trionesdev/antd-mobile-base-react";
15
+ export var FormItem = function FormItem(_ref) {
16
+ var className = _ref.className,
17
+ style = _ref.style,
18
+ children = _ref.children,
19
+ layout = _ref.layout,
20
+ label = _ref.label,
21
+ labelAlign = _ref.labelAlign,
22
+ labelWidth = _ref.labelWidth,
23
+ name = _ref.name,
24
+ required = _ref.required,
25
+ _ref$hidden = _ref.hidden,
26
+ hidden = _ref$hidden === void 0 ? false : _ref$hidden,
27
+ _ref$noStyle = _ref.noStyle,
28
+ noStyle = _ref$noStyle === void 0 ? false : _ref$noStyle,
29
+ rules = _ref.rules,
30
+ initialValue = _ref.initialValue,
31
+ valuePropName = _ref.valuePropName,
32
+ errorRender = _ref.errorRender,
33
+ extra = _ref.extra,
34
+ props = _objectWithoutProperties(_ref, _excluded);
35
+ var _useFormContext = useFormContext(),
36
+ formLayout = _useFormContext.layout,
37
+ formLayoutAlign = _useFormContext.labelAlign,
38
+ formLabelWidth = _useFormContext.labelWidth,
39
+ hiddenError = _useFormContext.hiddenError,
40
+ formExtra = _useFormContext.extra;
41
+ var formItemLayout = layout ? layout : formLayout === 'inline' ? 'horizontal' : formLayout;
42
+ var formItemAlign = labelAlign ? labelAlign : formLayoutAlign || 'left';
43
+ var formItemLabelWidth = labelWidth ? labelWidth : formLabelWidth;
44
+ var itemExtra = extra !== undefined ? extra : formExtra;
45
+ var clsPrefix = "triones-antm-form-item";
46
+ if (noStyle) {
47
+ return /*#__PURE__*/React.createElement(Field, {
48
+ name: name,
49
+ rules: rules,
50
+ trigger: 'onChange',
51
+ initialValue: initialValue
52
+ }, children);
53
+ }
54
+ return /*#__PURE__*/React.createElement("div", {
55
+ className: classNames(clsPrefix, "".concat(clsPrefix, "-").concat(formItemLayout), className, _defineProperty({}, "".concat(clsPrefix, "-hidden"), hidden)),
56
+ style: style
57
+ }, label && /*#__PURE__*/React.createElement(FormItemLabel, {
58
+ className: classNames("".concat(clsPrefix, "-label"), "".concat(clsPrefix, "-label-").concat(formItemAlign)),
59
+ style: {
60
+ width: formItemLabelWidth
61
+ },
62
+ label: label,
63
+ required: required
64
+ }), /*#__PURE__*/React.createElement(FormItemInput, _extends({
65
+ className: "".concat(clsPrefix, "-input")
66
+ }, props, {
67
+ name: name,
68
+ rules: rules,
69
+ errorRender: errorRender,
70
+ initialValue: initialValue,
71
+ hiddenError: hiddenError
72
+ }), children), formExtra);
73
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { FormItemProps } from "./form-item";
3
+ declare const FormItem: import("react").FC<FormItemProps>;
4
+ export type { FormItemProps };
5
+ export default FormItem;
@@ -0,0 +1,3 @@
1
+ import { FormItem as InternalFromItem } from "./form-item";
2
+ var FormItem = InternalFromItem;
3
+ export default FormItem;
@@ -25,7 +25,7 @@ export default (function () {
25
25
  })), /*#__PURE__*/React.createElement(Form.Item, {
26
26
  label: "\u8BF4\u660E",
27
27
  name: "description"
28
- }, /*#__PURE__*/React.createElement(Input.TextArea, {
28
+ }, /*#__PURE__*/React.createElement(Input.Textarea, {
29
29
  placeholder: "\u8BF7\u8F93\u5165\u8BF4\u660E"
30
30
  }))), /*#__PURE__*/React.createElement(Button, {
31
31
  type: "primary",
@@ -1,3 +1,10 @@
1
- import { Form, FormProps, FormItemProps } from "@trionesdev/antd-mobile-base-react";
1
+ import { Form as InternalForm, FormProps } from "@trionesdev/antd-mobile-base-react";
2
+ import FormItem, { FormItemProps } from "./FormItem";
3
+ import "./style.scss";
4
+ type InternalFormType = typeof InternalForm;
5
+ type CompoundedComponent = InternalFormType & {
6
+ Item: typeof FormItem;
7
+ };
8
+ declare const Form: CompoundedComponent;
2
9
  export type { FormProps, FormItemProps };
3
10
  export default Form;
@@ -1,2 +1,6 @@
1
- import { Form } from "@trionesdev/antd-mobile-base-react";
1
+ import { Form as InternalForm } from "@trionesdev/antd-mobile-base-react";
2
+ import FormItem from "./FormItem";
3
+ import "./style.scss";
4
+ var Form = InternalForm;
5
+ Form.Item = FormItem;
2
6
  export default Form;