@arco-design/mobile-react 2.31.2 → 2.31.4
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.
- package/CHANGELOG.md +22 -0
- package/README.en-US.md +3 -3
- package/README.md +3 -3
- package/cjs/action-sheet/style/css/index.css +2 -2
- package/cjs/avatar/style/css/index.css +2 -2
- package/cjs/badge/style/css/index.css +2 -2
- package/cjs/button/style/css/index.css +2 -2
- package/cjs/carousel/style/css/index.css +2 -2
- package/cjs/cell/style/css/index.css +2 -2
- package/cjs/checkbox/style/css/index.css +2 -2
- package/cjs/circle-progress/style/css/index.css +2 -2
- package/cjs/collapse/style/css/index.css +2 -2
- package/cjs/count-down/style/css/index.css +2 -2
- package/cjs/date-picker/index.js +7 -7
- package/cjs/date-picker/style/css/index.css +2 -2
- package/cjs/date-picker/type.d.ts +7 -1
- package/cjs/dialog/style/css/index.css +2 -2
- package/cjs/divider/style/css/index.css +2 -2
- package/cjs/dropdown/style/css/index.css +2 -2
- package/cjs/dropdown-menu/style/css/index.css +2 -2
- package/cjs/ellipsis/style/css/index.css +2 -2
- package/cjs/form/form-item.d.ts +0 -3
- package/cjs/form/form-item.js +19 -30
- package/cjs/form/index.js +6 -2
- package/cjs/form/linked-container.d.ts +8 -0
- package/cjs/form/linked-container.js +72 -0
- package/cjs/form/style/css/index.css +2 -2
- package/cjs/form/style/index.less +3 -3
- package/cjs/form/type.d.ts +7 -11
- package/cjs/form/useForm.js +36 -48
- package/cjs/grid/style/css/index.css +2 -2
- package/cjs/image/style/css/index.css +2 -2
- package/cjs/image-picker/style/css/index.css +2 -2
- package/cjs/image-preview/style/css/index.css +2 -2
- package/cjs/index-bar/style/css/index.css +2 -2
- package/cjs/input/style/css/index.css +2 -2
- package/cjs/keyboard/style/css/index.css +2 -2
- package/cjs/load-more/style/css/index.css +2 -2
- package/cjs/loading/style/css/index.css +2 -2
- package/cjs/masking/style/css/index.css +2 -2
- package/cjs/nav-bar/style/css/index.css +2 -2
- package/cjs/notice-bar/style/css/index.css +2 -2
- package/cjs/notify/style/css/index.css +2 -2
- package/cjs/pagination/style/css/index.css +2 -2
- package/cjs/picker/index.js +1 -1
- package/cjs/picker/style/css/index.css +2 -2
- package/cjs/picker-view/style/css/index.css +2 -2
- package/cjs/popover/style/css/index.css +2 -2
- package/cjs/popover/style/css/menu.css +2 -2
- package/cjs/popup/style/css/index.css +2 -2
- package/cjs/popup-swiper/style/css/index.css +2 -2
- package/cjs/progress/style/css/index.css +2 -2
- package/cjs/pull-refresh/style/css/index.css +2 -2
- package/cjs/radio/style/css/index.css +2 -2
- package/cjs/rate/style/css/index.css +2 -2
- package/cjs/search-bar/style/css/index.css +2 -2
- package/cjs/skeleton/style/css/index.css +2 -2
- package/cjs/slider/style/css/index.css +2 -2
- package/cjs/stepper/hooks/useInputEvent.d.ts +1 -0
- package/cjs/stepper/hooks/useInputEvent.js +3 -2
- package/cjs/stepper/hooks/useValue.d.ts +1 -0
- package/cjs/stepper/hooks/useValue.js +2 -1
- package/cjs/stepper/index.js +3 -1
- package/cjs/stepper/style/css/index.css +2 -2
- package/cjs/steps/style/css/index.css +2 -2
- package/cjs/sticky/style/css/index.css +2 -2
- package/cjs/swipe-action/style/css/index.css +2 -2
- package/cjs/swipe-load/style/css/index.css +2 -2
- package/cjs/switch/style/css/index.css +2 -2
- package/cjs/tab-bar/style/css/index.css +2 -2
- package/cjs/tabs/style/css/index.css +2 -2
- package/cjs/tag/style/css/index.css +2 -2
- package/cjs/textarea/style/css/index.css +2 -2
- package/cjs/toast/style/css/index.css +2 -2
- package/cjs/transition/style/css/index.css +2 -2
- package/cjs/uploader/style/css/index.css +2 -2
- package/dist/index.js +1832 -1831
- package/dist/index.min.js +4 -4
- package/dist/style.css +114 -114
- package/esm/action-sheet/style/css/index.css +2 -2
- package/esm/avatar/style/css/index.css +2 -2
- package/esm/badge/style/css/index.css +2 -2
- package/esm/button/style/css/index.css +2 -2
- package/esm/carousel/style/css/index.css +2 -2
- package/esm/cell/style/css/index.css +2 -2
- package/esm/checkbox/style/css/index.css +2 -2
- package/esm/circle-progress/style/css/index.css +2 -2
- package/esm/collapse/style/css/index.css +2 -2
- package/esm/count-down/style/css/index.css +2 -2
- package/esm/date-picker/index.js +8 -8
- package/esm/date-picker/style/css/index.css +2 -2
- package/esm/date-picker/type.d.ts +7 -1
- package/esm/dialog/style/css/index.css +2 -2
- package/esm/divider/style/css/index.css +2 -2
- package/esm/dropdown/style/css/index.css +2 -2
- package/esm/dropdown-menu/style/css/index.css +2 -2
- package/esm/ellipsis/style/css/index.css +2 -2
- package/esm/form/form-item.d.ts +0 -3
- package/esm/form/form-item.js +14 -25
- package/esm/form/index.js +7 -3
- package/esm/form/linked-container.d.ts +8 -0
- package/esm/form/linked-container.js +54 -0
- package/esm/form/style/css/index.css +2 -2
- package/esm/form/style/index.less +3 -3
- package/esm/form/type.d.ts +7 -11
- package/esm/form/useForm.js +31 -42
- package/esm/grid/style/css/index.css +2 -2
- package/esm/image/style/css/index.css +2 -2
- package/esm/image-picker/style/css/index.css +2 -2
- package/esm/image-preview/style/css/index.css +2 -2
- package/esm/index-bar/style/css/index.css +2 -2
- package/esm/input/style/css/index.css +2 -2
- package/esm/keyboard/style/css/index.css +2 -2
- package/esm/load-more/style/css/index.css +2 -2
- package/esm/loading/style/css/index.css +2 -2
- package/esm/masking/style/css/index.css +2 -2
- package/esm/nav-bar/style/css/index.css +2 -2
- package/esm/notice-bar/style/css/index.css +2 -2
- package/esm/notify/style/css/index.css +2 -2
- package/esm/pagination/style/css/index.css +2 -2
- package/esm/picker/index.js +1 -1
- package/esm/picker/style/css/index.css +2 -2
- package/esm/picker-view/style/css/index.css +2 -2
- package/esm/popover/style/css/index.css +2 -2
- package/esm/popover/style/css/menu.css +2 -2
- package/esm/popup/style/css/index.css +2 -2
- package/esm/popup-swiper/style/css/index.css +2 -2
- package/esm/progress/style/css/index.css +2 -2
- package/esm/pull-refresh/style/css/index.css +2 -2
- package/esm/radio/style/css/index.css +2 -2
- package/esm/rate/style/css/index.css +2 -2
- package/esm/search-bar/style/css/index.css +2 -2
- package/esm/skeleton/style/css/index.css +2 -2
- package/esm/slider/style/css/index.css +2 -2
- package/esm/stepper/hooks/useInputEvent.d.ts +1 -0
- package/esm/stepper/hooks/useInputEvent.js +3 -2
- package/esm/stepper/hooks/useValue.d.ts +1 -0
- package/esm/stepper/hooks/useValue.js +2 -1
- package/esm/stepper/index.js +3 -1
- package/esm/stepper/style/css/index.css +2 -2
- package/esm/steps/style/css/index.css +2 -2
- package/esm/sticky/style/css/index.css +2 -2
- package/esm/swipe-action/style/css/index.css +2 -2
- package/esm/swipe-load/style/css/index.css +2 -2
- package/esm/switch/style/css/index.css +2 -2
- package/esm/tab-bar/style/css/index.css +2 -2
- package/esm/tabs/style/css/index.css +2 -2
- package/esm/tag/style/css/index.css +2 -2
- package/esm/textarea/style/css/index.css +2 -2
- package/esm/toast/style/css/index.css +2 -2
- package/esm/transition/style/css/index.css +2 -2
- package/esm/uploader/style/css/index.css +2 -2
- package/package.json +3 -3
- package/style/css/public.css +2 -2
- package/tokens/mixin/index.less +2 -2
- package/umd/action-sheet/style/css/index.css +2 -2
- package/umd/avatar/style/css/index.css +2 -2
- package/umd/badge/style/css/index.css +2 -2
- package/umd/button/style/css/index.css +2 -2
- package/umd/carousel/style/css/index.css +2 -2
- package/umd/cell/style/css/index.css +2 -2
- package/umd/checkbox/style/css/index.css +2 -2
- package/umd/circle-progress/style/css/index.css +2 -2
- package/umd/collapse/style/css/index.css +2 -2
- package/umd/count-down/style/css/index.css +2 -2
- package/umd/date-picker/index.js +7 -7
- package/umd/date-picker/style/css/index.css +2 -2
- package/umd/date-picker/type.d.ts +7 -1
- package/umd/dialog/style/css/index.css +2 -2
- package/umd/divider/style/css/index.css +2 -2
- package/umd/dropdown/style/css/index.css +2 -2
- package/umd/dropdown-menu/style/css/index.css +2 -2
- package/umd/ellipsis/style/css/index.css +2 -2
- package/umd/form/form-item.d.ts +0 -3
- package/umd/form/form-item.js +19 -34
- package/umd/form/index.js +6 -2
- package/umd/form/linked-container.d.ts +8 -0
- package/umd/form/linked-container.js +78 -0
- package/umd/form/style/css/index.css +2 -2
- package/umd/form/style/index.less +3 -3
- package/umd/form/type.d.ts +7 -11
- package/umd/form/useForm.js +38 -50
- package/umd/grid/style/css/index.css +2 -2
- package/umd/image/style/css/index.css +2 -2
- package/umd/image-picker/style/css/index.css +2 -2
- package/umd/image-preview/style/css/index.css +2 -2
- package/umd/index-bar/style/css/index.css +2 -2
- package/umd/input/style/css/index.css +2 -2
- package/umd/keyboard/style/css/index.css +2 -2
- package/umd/load-more/style/css/index.css +2 -2
- package/umd/loading/style/css/index.css +2 -2
- package/umd/masking/style/css/index.css +2 -2
- package/umd/nav-bar/style/css/index.css +2 -2
- package/umd/notice-bar/style/css/index.css +2 -2
- package/umd/notify/style/css/index.css +2 -2
- package/umd/pagination/style/css/index.css +2 -2
- package/umd/picker/index.js +1 -1
- package/umd/picker/style/css/index.css +2 -2
- package/umd/picker-view/style/css/index.css +2 -2
- package/umd/popover/style/css/index.css +2 -2
- package/umd/popover/style/css/menu.css +2 -2
- package/umd/popup/style/css/index.css +2 -2
- package/umd/popup-swiper/style/css/index.css +2 -2
- package/umd/progress/style/css/index.css +2 -2
- package/umd/pull-refresh/style/css/index.css +2 -2
- package/umd/radio/style/css/index.css +2 -2
- package/umd/rate/style/css/index.css +2 -2
- package/umd/search-bar/style/css/index.css +2 -2
- package/umd/skeleton/style/css/index.css +2 -2
- package/umd/slider/style/css/index.css +2 -2
- package/umd/stepper/hooks/useInputEvent.d.ts +1 -0
- package/umd/stepper/hooks/useInputEvent.js +3 -2
- package/umd/stepper/hooks/useValue.d.ts +1 -0
- package/umd/stepper/hooks/useValue.js +2 -1
- package/umd/stepper/index.js +3 -1
- package/umd/stepper/style/css/index.css +2 -2
- package/umd/steps/style/css/index.css +2 -2
- package/umd/sticky/style/css/index.css +2 -2
- package/umd/swipe-action/style/css/index.css +2 -2
- package/umd/swipe-load/style/css/index.css +2 -2
- package/umd/switch/style/css/index.css +2 -2
- package/umd/tab-bar/style/css/index.css +2 -2
- package/umd/tabs/style/css/index.css +2 -2
- package/umd/tag/style/css/index.css +2 -2
- package/umd/textarea/style/css/index.css +2 -2
- package/umd/toast/style/css/index.css +2 -2
- package/umd/transition/style/css/index.css +2 -2
- package/umd/uploader/style/css/index.css +2 -2
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
package/esm/date-picker/index.js
CHANGED
@@ -1,18 +1,14 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
3
|
-
var _excluded = ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC"];
|
3
|
+
var _excluded = ["currentTs", "className", "visible", "onOk", "onChange", "onValueChange", "mode", "typeArr", "minTs", "maxTs", "formatter", "valueFilter", "columnsProcessor", "touchToStop", "useUTC", "renderLinkedContainer"];
|
4
4
|
import React, { useEffect, useRef, useState, useMemo, forwardRef, useImperativeHandle } from 'react';
|
5
|
-
import { cls, componentWrapper } from '@arco-design/mobile-utils';
|
5
|
+
import { cls, componentWrapper, formatDateNumber } from '@arco-design/mobile-utils';
|
6
6
|
import Picker from '../picker';
|
7
7
|
import { ContextLayout } from '../context-provider';
|
8
8
|
import { convertTsToDateObj, oneOf, judgeObj, convertObjToTs } from './helper';
|
9
9
|
export * from './type';
|
10
10
|
var allTypes = ['year', 'month', 'date', 'hour', 'minute', 'second'];
|
11
|
-
|
12
|
-
var defaultFormatter = function defaultFormatter(value) {
|
13
|
-
return value < 10 ? "0" + value : String(value);
|
14
|
-
};
|
15
|
-
|
11
|
+
var defaultFormatter = formatDateNumber;
|
16
12
|
export var YEAR = 12 * 30 * 24 * 60 * 60 * 1000;
|
17
13
|
var initMinDate = Date.now() - 10 * YEAR;
|
18
14
|
var initMaxDate = Date.now() + 10 * YEAR;
|
@@ -45,6 +41,7 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
45
41
|
touchToStop = props.touchToStop,
|
46
42
|
_props$useUTC = props.useUTC,
|
47
43
|
useUTC = _props$useUTC === void 0 ? false : _props$useUTC,
|
44
|
+
renderLinkedContainer = props.renderLinkedContainer,
|
48
45
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
49
46
|
|
50
47
|
var currentTs = Math.min(maxTs, Math.max(minTs, userSetCurrentTs));
|
@@ -318,7 +315,10 @@ var DatePicker = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
318
315
|
value: value,
|
319
316
|
onPickerChange: _handlePickerChange,
|
320
317
|
onOk: _handlePickerConfirm,
|
321
|
-
touchToStop: touchToStop
|
318
|
+
touchToStop: touchToStop,
|
319
|
+
renderLinkedContainer: renderLinkedContainer ? function () {
|
320
|
+
return renderLinkedContainer(currentTs, keyOptions);
|
321
|
+
} : undefined
|
322
322
|
}));
|
323
323
|
});
|
324
324
|
});
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { ReactNode } from 'react';
|
1
2
|
import { PickerProps } from '../picker';
|
2
3
|
import { PickerData } from '../picker-view';
|
3
4
|
export declare type ItemType = 'year' | 'month' | 'date' | 'hour' | 'minute' | 'second';
|
@@ -34,7 +35,7 @@ export interface IDateObj {
|
|
34
35
|
second: number;
|
35
36
|
}
|
36
37
|
export declare type mode = 'date' | 'time' | 'datetime';
|
37
|
-
export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' | 'cols' | 'value' | 'onChange' | 'onPickerChange' | 'onOk'> {
|
38
|
+
export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' | 'cols' | 'value' | 'onChange' | 'onPickerChange' | 'onOk' | 'renderLinkedContainer'> {
|
38
39
|
/**
|
39
40
|
* 点击选中时执行的回调
|
40
41
|
* @en Callback when clicking OK
|
@@ -105,4 +106,9 @@ export interface DatePickerProps extends Omit<PickerProps, 'data' | 'cascade' |
|
|
105
106
|
* @en Selector list item intervention to insert custom options.
|
106
107
|
*/
|
107
108
|
columnsProcessor?: (columns: PickerData[][], currentDateObj: IDateObj) => PickerData[][];
|
109
|
+
/**
|
110
|
+
* 将选择器的展现隐藏状态及选中值的展示与某个容器关联,传入后将同时渲染该容器和选择器组件,此时选择器组件的 visible 和 onHide 属性可不传,点击该容器会唤起选择器
|
111
|
+
* @en Associate the hidden state of the picker and the display of the selected value with a container. After passing it in, the container and the picker component will be rendered at the same time. At this time, the visible and onHide attributes of the picker component are optional values. Clicking the container will evoke the picker
|
112
|
+
*/
|
113
|
+
renderLinkedContainer?: (currentTs: number, itemTypes: ItemType[]) => ReactNode;
|
108
114
|
}
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
package/esm/form/form-item.d.ts
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { FormItemProps, FormItemRef } from './type';
|
3
|
-
export declare function DefaultPickerLinkedContainer({ value }: {
|
4
|
-
value: (string | number)[];
|
5
|
-
}): JSX.Element;
|
6
3
|
declare const _default: React.ForwardRefExoticComponent<FormItemProps & React.RefAttributes<FormItemRef>>;
|
7
4
|
export default _default;
|
package/esm/form/form-item.js
CHANGED
@@ -6,24 +6,12 @@ var _excluded = ["label", "field", "disabled", "layout", "style", "extra", "requ
|
|
6
6
|
/* eslint-disable react/no-unused-class-component-methods */
|
7
7
|
import React, { forwardRef, PureComponent, useContext, useImperativeHandle, useRef, useState } from 'react';
|
8
8
|
import { cls, Validator, ValidatorType } from '@arco-design/mobile-utils';
|
9
|
+
import { Promise } from 'es6-promise';
|
9
10
|
import { FormItemContext } from './form-item-context';
|
10
11
|
import { GlobalContext } from '../context-provider';
|
11
12
|
import { FormInternalComponentType } from './type';
|
12
13
|
import { getErrorAndWarnings, isFieldRequired } from './utils';
|
13
|
-
|
14
|
-
var value = _ref.value;
|
15
|
-
|
16
|
-
var _useContext = useContext(GlobalContext),
|
17
|
-
prefixCls = _useContext.prefixCls,
|
18
|
-
locale = _useContext.locale;
|
19
|
-
|
20
|
-
var className = prefixCls + "-form-picker-link-container";
|
21
|
-
return /*#__PURE__*/React.createElement("div", {
|
22
|
-
className: className
|
23
|
-
}, value && value.length ? value.join('-') : /*#__PURE__*/React.createElement("span", {
|
24
|
-
className: className + "-placeholder"
|
25
|
-
}, locale == null ? void 0 : locale.Form.pickerDefaultHint));
|
26
|
-
}
|
14
|
+
import { DefaultDatePickerLinkedContainer, DefaultPickerLinkedContainer } from './linked-container';
|
27
15
|
|
28
16
|
var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
29
17
|
_inheritsLoose(FormItemInner, _PureComponent);
|
@@ -38,14 +26,14 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
38
26
|
_this._errors = [];
|
39
27
|
_this._touched = false;
|
40
28
|
|
41
|
-
_this.onValueChange = function (
|
29
|
+
_this.onValueChange = function (curValue, preValue) {
|
42
30
|
_this._touched = true;
|
43
31
|
var shouldUpdate = _this.props.shouldUpdate;
|
44
32
|
|
45
33
|
if (typeof shouldUpdate === 'function') {
|
46
34
|
shouldUpdate({
|
47
|
-
|
48
|
-
|
35
|
+
preValue: preValue,
|
36
|
+
curValue: curValue
|
49
37
|
}) && _this.forceUpdate();
|
50
38
|
return;
|
51
39
|
}
|
@@ -255,9 +243,10 @@ var FormItemInner = /*#__PURE__*/function (_PureComponent) {
|
|
255
243
|
currentTs: getFieldValue(field),
|
256
244
|
onChange: this.innerTriggerFunctionWithValueFirst,
|
257
245
|
disabled: this.props.disabled,
|
258
|
-
renderLinkedContainer: ((_children$props7 = children.props) == null ? void 0 : _children$props7.renderLinkedContainer) || function (
|
259
|
-
return /*#__PURE__*/React.createElement(
|
260
|
-
|
246
|
+
renderLinkedContainer: ((_children$props7 = children.props) == null ? void 0 : _children$props7.renderLinkedContainer) || function (ts, types) {
|
247
|
+
return /*#__PURE__*/React.createElement(DefaultDatePickerLinkedContainer, {
|
248
|
+
ts: ts,
|
249
|
+
types: types
|
261
250
|
});
|
262
251
|
}
|
263
252
|
};
|
@@ -336,12 +325,12 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
|
|
336
325
|
className = _props$className === void 0 ? '' : _props$className,
|
337
326
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
338
327
|
|
339
|
-
var
|
340
|
-
prefixCls =
|
328
|
+
var _useContext = useContext(GlobalContext),
|
329
|
+
prefixCls = _useContext.prefixCls;
|
341
330
|
|
342
|
-
var
|
343
|
-
layout =
|
344
|
-
propsDisabled =
|
331
|
+
var _useContext2 = useContext(FormItemContext),
|
332
|
+
layout = _useContext2.layout,
|
333
|
+
propsDisabled = _useContext2.disabled;
|
345
334
|
|
346
335
|
var _useState = useState(null),
|
347
336
|
errors = _useState[0],
|
package/esm/form/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import { componentWrapper, defaultLocale } from '@arco-design/mobile-utils';
|
3
|
-
import React, { useRef, forwardRef, useImperativeHandle
|
3
|
+
import React, { useRef, forwardRef, useImperativeHandle } from 'react';
|
4
4
|
import { ContextLayout } from '../context-provider';
|
5
5
|
import Item from './form-item';
|
6
6
|
import { FormItemContext } from './form-item-context';
|
@@ -21,6 +21,7 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
21
21
|
onSubmitFailed = props.onSubmitFailed,
|
22
22
|
disabled = props.disabled;
|
23
23
|
var domRef = useRef(null);
|
24
|
+
var initRef = useRef(false);
|
24
25
|
|
25
26
|
var _useForm = useForm(formInstance),
|
26
27
|
form = _useForm[0];
|
@@ -34,9 +35,12 @@ var Form = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
34
35
|
onSubmit: onSubmit,
|
35
36
|
onSubmitFailed: onSubmitFailed
|
36
37
|
});
|
37
|
-
|
38
|
+
|
39
|
+
if (!initRef.current) {
|
38
40
|
setInitialValues(initialValues || {});
|
39
|
-
|
41
|
+
initRef.current = true;
|
42
|
+
}
|
43
|
+
|
40
44
|
useImperativeHandle(ref, function () {
|
41
45
|
return {
|
42
46
|
dom: domRef.current,
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare function DefaultPickerLinkedContainer({ value }: {
|
3
|
+
value: (string | number)[];
|
4
|
+
}): JSX.Element;
|
5
|
+
export declare function DefaultDatePickerLinkedContainer({ ts, types }: {
|
6
|
+
ts: number;
|
7
|
+
types: string[];
|
8
|
+
}): JSX.Element;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import React, { useContext, useMemo } from 'react';
|
3
|
+
import { formatDateNumber } from '@arco-design/mobile-utils';
|
4
|
+
import { convertTsToDateObj } from '../date-picker/helper';
|
5
|
+
import { GlobalContext } from '../context-provider';
|
6
|
+
export function DefaultPickerLinkedContainer(_ref) {
|
7
|
+
var value = _ref.value;
|
8
|
+
|
9
|
+
var _useContext = useContext(GlobalContext),
|
10
|
+
prefixCls = _useContext.prefixCls,
|
11
|
+
locale = _useContext.locale;
|
12
|
+
|
13
|
+
var className = prefixCls + "-form-picker-link-container";
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
15
|
+
className: className
|
16
|
+
}, value && value.length ? value.join('-') : /*#__PURE__*/React.createElement("span", {
|
17
|
+
className: className + "-placeholder"
|
18
|
+
}, locale == null ? void 0 : locale.Form.pickerDefaultHint));
|
19
|
+
}
|
20
|
+
export function DefaultDatePickerLinkedContainer(_ref2) {
|
21
|
+
var ts = _ref2.ts,
|
22
|
+
types = _ref2.types;
|
23
|
+
|
24
|
+
var _useContext2 = useContext(GlobalContext),
|
25
|
+
prefixCls = _useContext2.prefixCls,
|
26
|
+
locale = _useContext2.locale;
|
27
|
+
|
28
|
+
var className = prefixCls + "-form-picker-link-container";
|
29
|
+
var dateTimeStr = useMemo(function () {
|
30
|
+
return formatDateTimeStr(ts, types);
|
31
|
+
}, [ts, types]);
|
32
|
+
|
33
|
+
function formatDateTimeStr(timestamp, itemTypes) {
|
34
|
+
var dateObj = convertTsToDateObj(timestamp);
|
35
|
+
var validDateObj = Object.keys(dateObj).reduce(function (acc, key) {
|
36
|
+
var _ref3;
|
37
|
+
|
38
|
+
return _extends({}, acc, itemTypes.includes(key) ? (_ref3 = {}, _ref3[key] = formatDateNumber(dateObj[key]), _ref3) : {});
|
39
|
+
}, {});
|
40
|
+
var dateStr = [validDateObj.year, validDateObj.month, validDateObj.date].filter(function (v) {
|
41
|
+
return v;
|
42
|
+
}).join('-');
|
43
|
+
var timeStr = [validDateObj.hour, validDateObj.minute, validDateObj.second].filter(function (v) {
|
44
|
+
return v;
|
45
|
+
}).join(':');
|
46
|
+
return dateStr + " " + timeStr;
|
47
|
+
}
|
48
|
+
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
50
|
+
className: className
|
51
|
+
}, ts ? dateTimeStr : /*#__PURE__*/React.createElement("span", {
|
52
|
+
className: className + "-placeholder"
|
53
|
+
}, locale == null ? void 0 : locale.Form.pickerDefaultHint));
|
54
|
+
}
|
@@ -106,7 +106,7 @@
|
|
106
106
|
* @param @rules {en} customized rewrite rules, default to initial
|
107
107
|
* @example
|
108
108
|
* ```
|
109
|
-
* @import '@arco-design/mobile-
|
109
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
110
110
|
*
|
111
111
|
* .demo {
|
112
112
|
* .set-prop-with-rtl(right, auto);
|
@@ -122,7 +122,7 @@
|
|
122
122
|
* @param @value {en} css property value
|
123
123
|
* @example
|
124
124
|
* ```
|
125
|
-
* @import '@arco-design/mobile-
|
125
|
+
* @import '@arco-design/mobile-react/style/mixin.less';
|
126
126
|
*
|
127
127
|
* .demo {
|
128
128
|
* .set-value-with-rtl(text-align, left);
|
@@ -39,14 +39,14 @@
|
|
39
39
|
}
|
40
40
|
&-item-control {
|
41
41
|
padding: 16px 0;
|
42
|
-
|
42
|
+
.@{prefix}-input-wrap, .@{prefix}-input {
|
43
43
|
padding: 0;
|
44
44
|
}
|
45
45
|
&-wrapper {
|
46
46
|
width: 100%;
|
47
47
|
flex: 1;
|
48
48
|
position: relative;
|
49
|
-
|
49
|
+
.@{prefix}-input-wrap {
|
50
50
|
.use-var(height, input-text-line-height);
|
51
51
|
}
|
52
52
|
}
|
@@ -75,7 +75,7 @@
|
|
75
75
|
|
76
76
|
&-item.@{prefix}-form-item-vertical {
|
77
77
|
display: block;
|
78
|
-
|
78
|
+
.@{prefix}-input-wrap {
|
79
79
|
.set-prop-with-rtl(padding-left, 0);
|
80
80
|
}
|
81
81
|
.@{prefix}-form-label-item {
|
package/esm/form/type.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { IRules } from '@arco-design/mobile-utils';
|
2
2
|
import { ReactNode } from 'react';
|
3
|
+
import { Promise } from 'es6-promise';
|
3
4
|
export declare type FieldValue = any;
|
4
5
|
export declare type FieldItem = Record<string, any>;
|
5
6
|
export declare type ILayout = 'horizontal' | 'vertical' | 'inline';
|
@@ -169,19 +170,14 @@ export interface IFormInstance {
|
|
169
170
|
* 校验所有表单项
|
170
171
|
* @en Validate all fields
|
171
172
|
*/
|
172
|
-
validateFields: () => Promise<
|
173
|
+
validateFields: () => Promise<IFieldError[]>;
|
173
174
|
/**
|
174
175
|
* 提交表单
|
175
176
|
* @en Submit all fields
|
176
177
|
*/
|
177
178
|
submit: () => void;
|
178
179
|
}
|
179
|
-
export declare type InternalFormInstance =
|
180
|
-
/**
|
181
|
-
* 校验所有表单项
|
182
|
-
* @en Validate all fields
|
183
|
-
*/
|
184
|
-
validateFields: () => Promise<FieldItem>;
|
180
|
+
export declare type InternalFormInstance = IFormInstance & {
|
185
181
|
/**
|
186
182
|
* 获取内部方法
|
187
183
|
* @en Get internal methods
|
@@ -223,8 +219,8 @@ export interface IFormItemContext {
|
|
223
219
|
validateMessages?: Record<string, unknown>;
|
224
220
|
}
|
225
221
|
export declare type IShouldUpdateFunc = (data: {
|
226
|
-
|
227
|
-
|
222
|
+
preValue: any;
|
223
|
+
curValue: any;
|
228
224
|
}) => boolean;
|
229
225
|
export interface FormItemProps {
|
230
226
|
/**
|
@@ -272,7 +268,7 @@ export interface FormItemProps {
|
|
272
268
|
* 表单项是否刷新
|
273
269
|
* @en Form item is updated
|
274
270
|
*/
|
275
|
-
shouldUpdate?:
|
271
|
+
shouldUpdate?: IShouldUpdateFunc;
|
276
272
|
/**
|
277
273
|
* 表单项规则
|
278
274
|
* @en Form item rules
|
@@ -327,7 +323,7 @@ export interface IFormItemInnerProps {
|
|
327
323
|
* 表单项是否刷新
|
328
324
|
* @en Form item is updated
|
329
325
|
*/
|
330
|
-
shouldUpdate?:
|
326
|
+
shouldUpdate?: IShouldUpdateFunc;
|
331
327
|
/**
|
332
328
|
* 表单项下方节点
|
333
329
|
* @en Form item extra node
|