@trionesdev/antd-mobile-react 0.0.2-beta.15 → 0.0.2-beta.17

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 (122) hide show
  1. package/LICENSE +21 -21
  2. package/dist/ActionSheet/style.scss +52 -52
  3. package/dist/Avatar/demo/base.js +2 -2
  4. package/dist/Avatar/demo/style.scss +6 -6
  5. package/dist/Badge/demo/base.js +2 -2
  6. package/dist/Badge/demo/base.scss +6 -6
  7. package/dist/Button/button.d.ts +2 -1
  8. package/dist/Button/button.js +1 -1
  9. package/dist/Button/demo/base.js +2 -2
  10. package/dist/Button/style.scss +234 -234
  11. package/dist/Calendar/style.scss +85 -85
  12. package/dist/Calendar/touchable-calendar-grid.js +9 -9
  13. package/dist/CalendarDatetimePicker/style.scss +54 -54
  14. package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.d.ts +5 -4
  15. package/dist/CalendarDatetimePickerCell/CalendarDatetimePickerCell.js +7 -6
  16. package/dist/CalendarDatetimePickerCell/demo/base.js +2 -3
  17. package/dist/CalendarDatetimePickerCell/index.d.ts +1 -1
  18. package/dist/CalendarDatetimePickerCell/index.js +1 -1
  19. package/dist/CalendarDatetimePickerCell/style.scss +10 -10
  20. package/dist/CalendarPicker/style.scss +31 -31
  21. package/dist/CalendarPickerCell/CalendarPickerCell.d.ts +2 -2
  22. package/dist/CalendarPickerCell/CalendarPickerCell.js +3 -3
  23. package/dist/CalendarPickerCell/CalendarRangePickerCell.d.ts +2 -2
  24. package/dist/CalendarPickerCell/CalendarRangePickerCell.js +3 -3
  25. package/dist/CalendarPickerCell/demo/base.js +2 -4
  26. package/dist/Card/demo/base.js +2 -2
  27. package/dist/Card/demo/base.scss +18 -18
  28. package/dist/CascaderPicker/style.scss +45 -45
  29. package/dist/CascaderPickerCell/CascaderPickerCell.d.ts +2 -2
  30. package/dist/CascaderPickerCell/CascaderPickerCell.js +3 -3
  31. package/dist/CascaderPickerCell/demo/base.js +1 -2
  32. package/dist/CascaderPickerCell/style.scss +24 -24
  33. package/dist/Cell/demo/base.js +1 -1
  34. package/dist/Checkbox/demo/base.js +2 -2
  35. package/dist/ConfigProvider/demo/base.js +2 -2
  36. package/dist/DemoBlock/index.scss +20 -20
  37. package/dist/DemoDescription/index.scss +3 -3
  38. package/dist/Divider/demo/base.js +2 -2
  39. package/dist/Ellipsis/demo/base.js +2 -2
  40. package/dist/Empty/demo/base.js +2 -2
  41. package/dist/ErrorBlock/demo/base.js +2 -2
  42. package/dist/FloatButton/style.scss +123 -123
  43. package/dist/Footer/demo/base.js +2 -2
  44. package/dist/Form/FormItem/{form-item-input.d.ts → form-item-content.d.ts} +3 -1
  45. package/dist/Form/FormItem/{form-item-input.js → form-item-content.js} +1 -1
  46. package/dist/Form/FormItem/form-item-label.d.ts +3 -3
  47. package/dist/Form/FormItem/form-item-label.js +10 -8
  48. package/dist/Form/FormItem/form-item.d.ts +33 -4
  49. package/dist/Form/FormItem/form-item.js +22 -21
  50. package/dist/Form/demo/input.js +6 -2
  51. package/dist/Form/demo/vertical.js +45 -0
  52. package/dist/Form/index.d.ts +2 -2
  53. package/dist/Form/style.scss +106 -67
  54. package/dist/FormCell/index.d.ts +3 -0
  55. package/dist/FormCell/index.js +2 -0
  56. package/dist/Grid/demo/base.js +2 -2
  57. package/dist/Grid/demo/base.scss +7 -7
  58. package/dist/Icon/demo/base.js +2 -2
  59. package/dist/Image/demo/base.js +2 -2
  60. package/dist/Image/demo/base.scss +4 -4
  61. package/dist/Image/style.scss +30 -30
  62. package/dist/ImagesPreview/style.scss +34 -34
  63. package/dist/ImagesWall/style.scss +70 -70
  64. package/dist/Input/demo/base.js +28 -2
  65. package/dist/Input/index.scss +240 -223
  66. package/dist/Input/input-affix-wrapper.d.ts +3 -1
  67. package/dist/Input/input-affix-wrapper.js +4 -4
  68. package/dist/Input/input.d.ts +3 -1
  69. package/dist/Input/input.js +5 -2
  70. package/dist/Loading/DotLoading.d.ts +1 -0
  71. package/dist/Loading/DotLoading.js +1 -0
  72. package/dist/Loading/SpinLoading.d.ts +1 -0
  73. package/dist/Loading/SpinLoading.js +1 -0
  74. package/dist/Loading/demo/base.d.ts +3 -0
  75. package/dist/{SpinLoading → Loading}/demo/base.js +8 -2
  76. package/dist/Loading/demo/dot-loading.d.ts +3 -0
  77. package/dist/Loading/demo/dot-loading.js +25 -0
  78. package/dist/Loading/index.d.ts +5 -0
  79. package/dist/Loading/index.js +3 -0
  80. package/dist/NavBar/demo/base.scss +5 -5
  81. package/dist/NoticeBar/demo/base.js +2 -2
  82. package/dist/Overlay/style.scss +20 -20
  83. package/dist/PageIndicator/demo/base.js +2 -2
  84. package/dist/Picker/style.scss +44 -44
  85. package/dist/PickerView/style.scss +72 -72
  86. package/dist/Popup/demo/base.js +2 -2
  87. package/dist/Popup/style.scss +129 -129
  88. package/dist/Radio/demo/base.scss +4 -4
  89. package/dist/Result/demo/base.js +2 -2
  90. package/dist/SafeArea/demo/base.scss +18 -18
  91. package/dist/ScrollView/style.scss +19 -19
  92. package/dist/SideBar/side-bar.js +6 -6
  93. package/dist/SideBar/style.scss +85 -85
  94. package/dist/Skeleton/demo/base.d.ts +3 -0
  95. package/dist/Skeleton/demo/base.js +8 -0
  96. package/dist/Skeleton/index.d.ts +3 -0
  97. package/dist/Skeleton/index.js +2 -0
  98. package/dist/Space/demo/base.js +2 -2
  99. package/dist/Stepper/demo/base.d.ts +3 -0
  100. package/dist/Stepper/demo/base.js +23 -0
  101. package/dist/Stepper/index.d.ts +3 -0
  102. package/dist/Stepper/index.js +2 -0
  103. package/dist/Swiper/style.scss +54 -54
  104. package/dist/Switch/demo/base.js +2 -2
  105. package/dist/TabBar/demo/base.js +2 -2
  106. package/dist/Tag/demo/base.js +2 -2
  107. package/dist/Tag/demo/style.scss +8 -8
  108. package/dist/Toast/style.scss +63 -63
  109. package/dist/VerificationCodeInput/style.scss +20 -20
  110. package/dist/WaterMark/demo/demo1.js +2 -2
  111. package/dist/WaterMark/demo/demo1.scss +6 -6
  112. package/dist/WaterMark/demo/demo2.js +2 -2
  113. package/dist/index.d.ts +22 -18
  114. package/dist/index.js +3 -1
  115. package/dist/style/variable.scss +1 -1
  116. package/dist/utils/type.js +36 -36
  117. package/dist/utils/with-default-props.js +4 -4
  118. package/package.json +9 -13
  119. package/readme.md +43 -43
  120. package/dist/SpinLoading/index.d.ts +0 -3
  121. package/dist/SpinLoading/index.js +0 -2
  122. /package/dist/{SpinLoading/demo/base.d.ts → Form/demo/vertical.d.ts} +0 -0
@@ -1,3 +1,3 @@
1
- .demoDescription {
2
- color: var(--triones-antm-color-weak);
3
- }
1
+ .demoDescription {
2
+ color: var(--triones-antm-color-weak);
3
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * compact: true
1
+ /**
2
+ * compact: true
3
3
  */
4
4
  import { DemoBlock } from "../../DemoBlock";
5
5
  import React from "react";
@@ -1,5 +1,5 @@
1
- /**
2
- * compact: true
1
+ /**
2
+ * compact: true
3
3
  */
4
4
  import { DemoBlock } from "../../DemoBlock";
5
5
  import React from 'react';
@@ -1,5 +1,5 @@
1
- /**
2
- * compact: true
1
+ /**
2
+ * compact: true
3
3
  */
4
4
  import { QuestionCircleOutline } from "../../../../antd-mobile-icons-react";
5
5
  import { DemoBlock } from "../../DemoBlock";
@@ -1,5 +1,5 @@
1
- /**
2
- * compact: true
1
+ /**
2
+ * compact: true
3
3
  */
4
4
  import { DemoBlock } from "../../DemoBlock";
5
5
  import React from 'react';
@@ -1,123 +1,123 @@
1
- @use "../style/variable" as variable;
2
-
3
- $floatButtonCls: "triones-antm-float-button";
4
- $floatButtonGroupCls: "triones-antm-float-button-group";
5
-
6
- $floatButtonSize: 48Px;
7
- $floatButtonShadow: 0 6Px 16Px 0 rgba(0, 0, 0, 0.08),
8
- 0 3Px 6Px -4Px rgba(0, 0, 0, 0.12), 0 9Px 28Px 8Px rgba(0, 0, 0, 0.05);
9
-
10
- .#{$floatButtonCls} {
11
- position: fixed;
12
- display: inline-flex;
13
- flex-shrink: 0;
14
- box-sizing: border-box;
15
-
16
- &--embedded {
17
- position: relative;
18
- right: auto;
19
- bottom: auto;
20
- z-index: auto;
21
- }
22
-
23
- &-body {
24
- box-sizing: border-box;
25
- margin: 0;
26
- padding: 0;
27
- display: inline-flex;
28
- align-items: center;
29
- justify-content: center;
30
- gap: 8Px;
31
- min-width: $floatButtonSize;
32
- min-height: $floatButtonSize;
33
- border: none;
34
- border-radius: 50%;
35
- cursor: pointer;
36
- font-size: 20Px;
37
- line-height: 1;
38
- color: rgba(0, 0, 0, 0.88);
39
- background: #fff;
40
- box-shadow: $floatButtonShadow;
41
- transition: color 0.2s, background 0.2s, box-shadow 0.2s;
42
- -webkit-tap-highlight-color: transparent;
43
- text-decoration: none;
44
-
45
- &:active {
46
- filter: brightness(0.95);
47
- }
48
- }
49
-
50
- &--shape-square &-body {
51
- border-radius: variable.$trionesBorderRadius;
52
- }
53
-
54
- &--has-content &-body {
55
- min-height: $floatButtonSize;
56
- display: inline-flex;
57
- flex-direction: column;
58
- align-items: center;
59
- justify-content: center;
60
- }
61
-
62
- &--type-primary &-body {
63
- color: #fff;
64
- background: variable.$trionesColorPrimary;
65
- }
66
-
67
- &-icon {
68
- display: inline-flex;
69
- align-items: center;
70
- justify-content: center;
71
- }
72
-
73
- &-content {
74
- font-size: variable.$trionesFontSizeSm;
75
- font-weight: 500;
76
- white-space: nowrap;
77
- }
78
- }
79
-
80
- .#{$floatButtonGroupCls} {
81
- position: fixed;
82
- z-index: 100;
83
- bottom: calc(24Px + env(safe-area-inset-bottom, 0px));
84
- display: flex;
85
- gap: 12Px;
86
- align-items: flex-end;
87
- box-sizing: border-box;
88
-
89
- &--placement {
90
- &-top {
91
- flex-direction: column;
92
- }
93
- &-bottom {
94
- flex-direction: column;
95
- }
96
- &-left {
97
- flex-direction: row;
98
- }
99
- &-right {
100
- flex-direction: row;
101
- }
102
- }
103
-
104
- &--menu {
105
- align-items: center;
106
- }
107
-
108
- &-list {
109
- display: flex;
110
- flex-direction: column;
111
- gap: 12Px;
112
- align-items: flex-end;
113
-
114
- &--hidden {
115
- display: none;
116
- }
117
- }
118
-
119
- &--placement-left &-list,
120
- &--placement-right &-list {
121
- flex-direction: column;
122
- }
123
- }
1
+ @use "../style/variable" as variable;
2
+
3
+ $floatButtonCls: "triones-antm-float-button";
4
+ $floatButtonGroupCls: "triones-antm-float-button-group";
5
+
6
+ $floatButtonSize: 48Px;
7
+ $floatButtonShadow: 0 6Px 16Px 0 rgba(0, 0, 0, 0.08),
8
+ 0 3Px 6Px -4Px rgba(0, 0, 0, 0.12), 0 9Px 28Px 8Px rgba(0, 0, 0, 0.05);
9
+
10
+ .#{$floatButtonCls} {
11
+ position: fixed;
12
+ display: inline-flex;
13
+ flex-shrink: 0;
14
+ box-sizing: border-box;
15
+
16
+ &--embedded {
17
+ position: relative;
18
+ right: auto;
19
+ bottom: auto;
20
+ z-index: auto;
21
+ }
22
+
23
+ &-body {
24
+ box-sizing: border-box;
25
+ margin: 0;
26
+ padding: 0;
27
+ display: inline-flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ gap: 8Px;
31
+ min-width: $floatButtonSize;
32
+ min-height: $floatButtonSize;
33
+ border: none;
34
+ border-radius: 50%;
35
+ cursor: pointer;
36
+ font-size: 20Px;
37
+ line-height: 1;
38
+ color: rgba(0, 0, 0, 0.88);
39
+ background: #fff;
40
+ box-shadow: $floatButtonShadow;
41
+ transition: color 0.2s, background 0.2s, box-shadow 0.2s;
42
+ -webkit-tap-highlight-color: transparent;
43
+ text-decoration: none;
44
+
45
+ &:active {
46
+ filter: brightness(0.95);
47
+ }
48
+ }
49
+
50
+ &--shape-square &-body {
51
+ border-radius: variable.$trionesBorderRadius;
52
+ }
53
+
54
+ &--has-content &-body {
55
+ min-height: $floatButtonSize;
56
+ display: inline-flex;
57
+ flex-direction: column;
58
+ align-items: center;
59
+ justify-content: center;
60
+ }
61
+
62
+ &--type-primary &-body {
63
+ color: #fff;
64
+ background: variable.$trionesColorPrimary;
65
+ }
66
+
67
+ &-icon {
68
+ display: inline-flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ }
72
+
73
+ &-content {
74
+ font-size: variable.$trionesFontSizeSm;
75
+ font-weight: 500;
76
+ white-space: nowrap;
77
+ }
78
+ }
79
+
80
+ .#{$floatButtonGroupCls} {
81
+ position: fixed;
82
+ z-index: 100;
83
+ bottom: calc(24Px + env(safe-area-inset-bottom, 0px));
84
+ display: flex;
85
+ gap: 12Px;
86
+ align-items: flex-end;
87
+ box-sizing: border-box;
88
+
89
+ &--placement {
90
+ &-top {
91
+ flex-direction: column;
92
+ }
93
+ &-bottom {
94
+ flex-direction: column;
95
+ }
96
+ &-left {
97
+ flex-direction: row;
98
+ }
99
+ &-right {
100
+ flex-direction: row;
101
+ }
102
+ }
103
+
104
+ &--menu {
105
+ align-items: center;
106
+ }
107
+
108
+ &-list {
109
+ display: flex;
110
+ flex-direction: column;
111
+ gap: 12Px;
112
+ align-items: flex-end;
113
+
114
+ &--hidden {
115
+ display: none;
116
+ }
117
+ }
118
+
119
+ &--placement-left &-list,
120
+ &--placement-right &-list {
121
+ flex-direction: column;
122
+ }
123
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * compact: true
1
+ /**
2
+ * compact: true
3
3
  */
4
4
  import React from 'react';
5
5
  import { DemoBlock } from "../../DemoBlock";
@@ -1,15 +1,17 @@
1
1
  import { Rule } from 'rc-field-form/lib/interface';
2
2
  import React, { FC } from 'react';
3
+ import { FormHorizontalAlign } from "@trionesdev/antd-mobile-base-react";
3
4
  type FormItemInputProps = {
4
5
  children?: React.ReactElement;
5
6
  className?: string;
6
7
  name?: string;
7
8
  rules?: Rule[];
8
9
  initialValue?: any;
10
+ contentAlign?: FormHorizontalAlign;
9
11
  valuePropName?: string;
10
12
  errors?: React.ReactNode[];
11
13
  errorRender?: (errors?: any[]) => React.ReactNode;
12
14
  hiddenError?: boolean;
13
15
  };
14
- export declare const FormItemInput: FC<FormItemInputProps>;
16
+ export declare const FormItemContent: FC<FormItemInputProps>;
15
17
  export {};
@@ -8,7 +8,7 @@ import classNames from 'classnames';
8
8
  import { isEmpty } from 'lodash-es';
9
9
  import { Field } from 'rc-field-form';
10
10
  import React, { useState } from 'react';
11
- export var FormItemInput = function FormItemInput(_ref) {
11
+ export var FormItemContent = function FormItemContent(_ref) {
12
12
  var children = _ref.children,
13
13
  className = _ref.className,
14
14
  name = _ref.name,
@@ -1,6 +1,6 @@
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";
1
+ import { FormItemLayout } from '@trionesdev/antd-mobile-base-react';
2
+ import { NamePath } from 'rc-field-form/lib/interface';
3
+ import React, { CSSProperties, FC } from 'react';
4
4
  type FormItemLabelProps = {
5
5
  className?: string;
6
6
  style?: CSSProperties;
@@ -1,7 +1,11 @@
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";
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 _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; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ 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); }
5
+ import { useFormContext } from '@trionesdev/antd-mobile-base-react';
6
+ import classNames from 'classnames';
7
+ import { isFunction } from 'lodash-es';
8
+ import React from 'react';
5
9
  export var FormItemLabel = function FormItemLabel(_ref) {
6
10
  var className = _ref.className,
7
11
  style = _ref.style,
@@ -13,9 +17,7 @@ export var FormItemLabel = function FormItemLabel(_ref) {
13
17
  colon = _useFormContext.colon;
14
18
  var clsPrefix = "triones-antm-form-item-label";
15
19
  return /*#__PURE__*/React.createElement("div", {
16
- className: classNames(className, {
17
- required: "".concat(clsPrefix, "-required")
18
- }),
20
+ className: classNames(className, _defineProperty({}, "".concat(clsPrefix, "-required"), required)),
19
21
  style: style
20
22
  }, /*#__PURE__*/React.createElement("div", {
21
23
  className: classNames("".concat(clsPrefix, "-wrapper"))
@@ -23,5 +25,5 @@ export var FormItemLabel = function FormItemLabel(_ref) {
23
25
  className: "".concat(clsPrefix, "-required-mark")
24
26
  }, isFunction(requiredMark) ? requiredMark(label, {
25
27
  required: required
26
- }) : '*'), label, layout == 'horizontal' && colon && ':'));
28
+ }) : '*'), label, layout === 'horizontal' && colon && ':'));
27
29
  };
@@ -1,14 +1,43 @@
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";
1
+ import { FormHorizontalAlign, FormItemLayout } from '@trionesdev/antd-mobile-base-react';
2
+ import { NamePath, Rule } from 'rc-field-form/lib/interface';
3
+ import React, { CSSProperties, FC, ReactElement, ReactNode } from 'react';
4
4
  export type FormItemProps = {
5
+ /**
6
+ * @description 类
7
+ * @default
8
+ */
5
9
  className?: string;
6
10
  style?: CSSProperties;
7
11
  children?: ReactElement;
12
+ /**
13
+ * @description 布局
14
+ * @default
15
+ */
8
16
  layout?: FormItemLayout;
17
+ /**
18
+ * @description 标签
19
+ * @default
20
+ */
9
21
  label?: ReactNode;
10
- labelAlign?: FormLayoutAlign;
22
+ /**
23
+ * @description 标签对齐方式
24
+ * @default left
25
+ */
26
+ labelAlign?: FormHorizontalAlign;
27
+ /**
28
+ * @description 标签宽度
29
+ * @default
30
+ */
11
31
  labelWidth?: number;
32
+ /**
33
+ * @description 输入框对齐方式
34
+ * @default
35
+ */
36
+ contentAlign?: FormHorizontalAlign;
37
+ /**
38
+ * @description 字段名
39
+ * @default
40
+ */
12
41
  name?: NamePath;
13
42
  required?: boolean;
14
43
  hidden?: boolean;
@@ -1,17 +1,17 @@
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
- var _excluded = ["className", "style", "children", "layout", "label", "labelAlign", "labelWidth", "name", "required", "hidden", "noStyle", "rules", "initialValue", "valuePropName", "errorRender", "extra"];
2
+ var _excluded = ["className", "style", "children", "layout", "label", "labelAlign", "labelWidth", "contentAlign", "name", "required", "hidden", "noStyle", "rules", "initialValue", "valuePropName", "errorRender", "extra"];
3
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
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
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
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
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
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";
9
+ import { useFormContext } from '@trionesdev/antd-mobile-base-react';
10
+ import classNames from 'classnames';
11
+ import { Field } from 'rc-field-form';
12
+ import React from 'react';
13
+ import { FormItemContent } from "./form-item-content";
10
14
  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
15
  export var FormItem = function FormItem(_ref) {
16
16
  var className = _ref.className,
17
17
  style = _ref.style,
@@ -20,6 +20,7 @@ export var FormItem = function FormItem(_ref) {
20
20
  label = _ref.label,
21
21
  labelAlign = _ref.labelAlign,
22
22
  labelWidth = _ref.labelWidth,
23
+ contentAlign = _ref.contentAlign,
23
24
  name = _ref.name,
24
25
  required = _ref.required,
25
26
  _ref$hidden = _ref.hidden,
@@ -32,21 +33,19 @@ export var FormItem = function FormItem(_ref) {
32
33
  errorRender = _ref.errorRender,
33
34
  extra = _ref.extra,
34
35
  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";
36
+ // const { layout: formLayout, labelAlign: formLayoutAlign, labelWidth: formLabelWidth, hiddenError, extra: formExtra } = useFormContext()
37
+ var ctx = useFormContext();
38
+ var formItemLayout = layout ? layout : ctx.layout === 'inline' ? 'horizontal' : ctx.layout;
39
+ var formItemAlign = labelAlign ? labelAlign : ctx.labelAlign || 'left';
40
+ var formItemLabelWidth = labelWidth ? labelWidth : ctx.labelWidth;
41
+ var formItemExtra = extra !== undefined ? extra : ctx.extra;
42
+ var formItemWrapperAlign = contentAlign ? contentAlign : ctx.contentAlign;
43
+ var clsPrefix = 'triones-antm-form-item';
46
44
  if (noStyle) {
47
45
  return /*#__PURE__*/React.createElement(Field, {
48
46
  name: name,
49
47
  rules: rules,
48
+ valuePropName: valuePropName,
50
49
  trigger: 'onChange',
51
50
  initialValue: initialValue
52
51
  }, children);
@@ -59,15 +58,17 @@ export var FormItem = function FormItem(_ref) {
59
58
  style: {
60
59
  width: formItemLabelWidth
61
60
  },
61
+ layout: formItemLayout,
62
62
  label: label,
63
63
  required: required
64
- }), /*#__PURE__*/React.createElement(FormItemInput, _extends({
65
- className: "".concat(clsPrefix, "-input")
64
+ }), /*#__PURE__*/React.createElement(FormItemContent, _extends({
65
+ className: classNames("".concat(clsPrefix, "-content"), _defineProperty({}, "".concat(clsPrefix, "-content-").concat(formItemWrapperAlign), formItemWrapperAlign))
66
66
  }, props, {
67
67
  name: name,
68
68
  rules: rules,
69
69
  errorRender: errorRender,
70
70
  initialValue: initialValue,
71
- hiddenError: hiddenError
72
- }), children), formExtra);
71
+ valuePropName: valuePropName,
72
+ hiddenError: ctx.hiddenError
73
+ }), children), formItemExtra);
73
74
  };
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import React from "react";
8
8
  import { DemoBlock } from "../../DemoBlock";
9
9
  import Form from "../index";
10
- import { Input } from "../../index";
10
+ import { Input, Stepper } from "../../index";
11
11
  import Button from "../../Button";
12
12
  export default (function () {
13
13
  var _Form$useForm = Form.useForm(),
@@ -16,13 +16,17 @@ export default (function () {
16
16
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
17
17
  title: "\u6C34\u5E73\u8868\u5355"
18
18
  }, /*#__PURE__*/React.createElement(Form, {
19
- form: form
19
+ form: form,
20
+ labelWidth: 100
20
21
  }, /*#__PURE__*/React.createElement(Form.Item, {
21
22
  label: "\u7528\u6237\u540D",
22
23
  name: "username"
23
24
  }, /*#__PURE__*/React.createElement(Input, {
24
25
  placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u540D"
25
26
  })), /*#__PURE__*/React.createElement(Form.Item, {
27
+ label: "\u5E74\u9F84",
28
+ name: "age"
29
+ }, /*#__PURE__*/React.createElement(Stepper, null)), /*#__PURE__*/React.createElement(Form.Item, {
26
30
  label: "\u8BF4\u660E",
27
31
  name: "description"
28
32
  }, /*#__PURE__*/React.createElement(Input.Textarea, {
@@ -0,0 +1,45 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React from "react";
8
+ import { DemoBlock } from "../../DemoBlock";
9
+ import Form from "../index";
10
+ import { Input, Switch } from "../../index";
11
+ import Button from "../../Button";
12
+ export default (function () {
13
+ var _Form$useForm = Form.useForm(),
14
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
15
+ form = _Form$useForm2[0];
16
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DemoBlock, {
17
+ title: "\u6C34\u5E73\u8868\u5355"
18
+ }, /*#__PURE__*/React.createElement(Form, {
19
+ form: form,
20
+ layout: 'vertical'
21
+ }, /*#__PURE__*/React.createElement(Form.Item, {
22
+ label: "\u7528\u6237\u540D",
23
+ name: "username"
24
+ }, /*#__PURE__*/React.createElement(Input, {
25
+ placeholder: "\u8BF7\u8F93\u5165\u7528\u6237\u540D"
26
+ })), /*#__PURE__*/React.createElement(Form.Item, {
27
+ label: "\u8BF4\u660E",
28
+ name: "description"
29
+ }, /*#__PURE__*/React.createElement(Input.Textarea, {
30
+ placeholder: "\u8BF7\u8F93\u5165\u8BF4\u660E"
31
+ })), /*#__PURE__*/React.createElement(Form.Item, {
32
+ label: "\u662F\u5426",
33
+ name: "married",
34
+ layout: 'horizontal',
35
+ contentAlign: 'end'
36
+ }, /*#__PURE__*/React.createElement(Switch, null))), /*#__PURE__*/React.createElement(Button, {
37
+ type: "primary",
38
+ block: true,
39
+ onClick: function onClick() {
40
+ form.validateFields().then(function (values) {
41
+ console.log(values);
42
+ });
43
+ }
44
+ }, "\u63D0\u4EA4")));
45
+ });
@@ -1,4 +1,4 @@
1
- import { Form as InternalForm, FormProps } from "@trionesdev/antd-mobile-base-react";
1
+ import { Form as InternalForm, FormProps, FormInstance } from "@trionesdev/antd-mobile-base-react";
2
2
  import FormItem, { FormItemProps } from "./FormItem";
3
3
  import "./style.scss";
4
4
  type InternalFormType = typeof InternalForm;
@@ -6,5 +6,5 @@ type CompoundedComponent = InternalFormType & {
6
6
  Item: typeof FormItem;
7
7
  };
8
8
  declare const Form: CompoundedComponent;
9
- export type { FormProps, FormItemProps };
9
+ export type { FormProps, FormItemProps, FormInstance };
10
10
  export default Form;