dtable-ui-component 6.0.26 → 6.0.27
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/lib/DateEditor/mb-date-editor-popover/index.js +3 -3
- package/lib/FileFormatter/index.js +98 -38
- package/lib/FileItemFormatter/index.js +3 -1
- package/lib/index.js +1 -106
- package/package.json +3 -12
- package/lib/ActionSheet/index.js +0 -194
- package/lib/ActionSheet/style/index.css +0 -365
- package/lib/ActivityIndicator/index.css +0 -108
- package/lib/ActivityIndicator/index.js +0 -76
- package/lib/Badge/index.css +0 -96
- package/lib/Badge/index.js +0 -65
- package/lib/DatePicker/index.js +0 -120
- package/lib/DatePicker/locale/en_US.js +0 -14
- package/lib/DatePicker/locale/ru_RU.js +0 -14
- package/lib/DatePicker/locale/sv_SE.js +0 -14
- package/lib/DatePicker/locale/zh_CN.js +0 -14
- package/lib/DatePicker/style/index.css +0 -290
- package/lib/DatePicker/utils.js +0 -36
- package/lib/Drawer/index.css +0 -142
- package/lib/Drawer/index.js +0 -21
- package/lib/Icon/index.css +0 -50
- package/lib/Icon/index.js +0 -35
- package/lib/Icon/load-sprite.js +0 -56
- package/lib/InputItem/custom-input.js +0 -321
- package/lib/InputItem/custom-keyboard.js +0 -162
- package/lib/InputItem/index.js +0 -389
- package/lib/InputItem/input.js +0 -45
- package/lib/InputItem/locale/en_US.js +0 -12
- package/lib/InputItem/locale/ru_RU.js +0 -12
- package/lib/InputItem/locale/sv_SE.js +0 -12
- package/lib/InputItem/locale/zh_CN.js +0 -12
- package/lib/InputItem/portal.js +0 -23
- package/lib/InputItem/style/index.css +0 -512
- package/lib/List/index.css +0 -381
- package/lib/List/index.js +0 -41
- package/lib/List/list-item.js +0 -169
- package/lib/Modal/alert.js +0 -82
- package/lib/Modal/index.js +0 -16
- package/lib/Modal/modal.js +0 -118
- package/lib/Modal/operation.js +0 -77
- package/lib/Modal/prompt.js +0 -207
- package/lib/Modal/style/index.css +0 -580
- package/lib/Picker/AbstractPicker.js +0 -190
- package/lib/Picker/index.js +0 -28
- package/lib/Picker/locale/en_US.js +0 -12
- package/lib/Picker/locale/ru_RU.js +0 -12
- package/lib/Picker/locale/sv_SE.js +0 -12
- package/lib/Picker/locale/zh_CN.js +0 -12
- package/lib/Picker/popupProps.js +0 -12
- package/lib/Picker/style/index.css +0 -141
- package/lib/Popover/index.js +0 -63
- package/lib/Popover/item.js +0 -55
- package/lib/Popover/style/index.css +0 -229
- package/lib/Progress/index.css +0 -22
- package/lib/Progress/index.js +0 -66
- package/lib/Radio/Radio.js +0 -47
- package/lib/Radio/RadioItem.js +0 -57
- package/lib/Radio/index.css +0 -90
- package/lib/Radio/index.js +0 -12
- package/lib/TabBar/Tab.js +0 -76
- package/lib/TabBar/index.css +0 -138
- package/lib/TabBar/index.js +0 -129
- package/lib/Tabs/index.css +0 -443
- package/lib/Tabs/index.js +0 -39
- package/lib/TextareaItem/index.css +0 -231
- package/lib/TextareaItem/index.js +0 -231
- package/lib/Toast/index.css +0 -65
- package/lib/Toast/index.js +0 -131
- package/lib/_util/class.js +0 -34
- package/lib/_util/closest.js +0 -17
- package/lib/_util/exenv.js +0 -8
- package/lib/_util/getDataAttr.js +0 -15
- package/lib/_util/getLocale.js +0 -42
package/lib/Tabs/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = exports.DefaultTabBar = void 0;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _rmcTabs = require("rmc-tabs");
|
|
10
|
-
require("./index.css");
|
|
11
|
-
class DefaultTabBar extends _rmcTabs.DefaultTabBar {}
|
|
12
|
-
exports.DefaultTabBar = DefaultTabBar;
|
|
13
|
-
DefaultTabBar.defaultProps = {
|
|
14
|
-
..._rmcTabs.DefaultTabBar.defaultProps,
|
|
15
|
-
prefixCls: 'am-tabs-default-bar'
|
|
16
|
-
};
|
|
17
|
-
class Tabs extends React.PureComponent {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.renderTabBar = props => {
|
|
21
|
-
const {
|
|
22
|
-
renderTab
|
|
23
|
-
} = this.props;
|
|
24
|
-
return /*#__PURE__*/React.createElement(DefaultTabBar, Object.assign({}, props, {
|
|
25
|
-
renderTab: renderTab
|
|
26
|
-
}));
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
render() {
|
|
30
|
-
return /*#__PURE__*/React.createElement(_rmcTabs.Tabs, Object.assign({
|
|
31
|
-
renderTabBar: this.renderTabBar
|
|
32
|
-
}, this.props));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.default = Tabs;
|
|
36
|
-
Tabs.DefaultTabBar = DefaultTabBar;
|
|
37
|
-
Tabs.defaultProps = {
|
|
38
|
-
prefixCls: 'am-tabs'
|
|
39
|
-
};
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
.am-list .am-list-item.am-textarea-item {
|
|
2
|
-
display: -webkit-box;
|
|
3
|
-
display: -webkit-flex;
|
|
4
|
-
display: -ms-flexbox;
|
|
5
|
-
display: flex;
|
|
6
|
-
-webkit-box-align: start;
|
|
7
|
-
-webkit-align-items: flex-start;
|
|
8
|
-
-ms-flex-align: start;
|
|
9
|
-
align-items: flex-start;
|
|
10
|
-
-webkit-box-sizing: border-box;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
min-height: 44px;
|
|
13
|
-
padding-left: 15px;
|
|
14
|
-
padding-right: 15px;
|
|
15
|
-
border-bottom: 1PX solid #ddd;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
|
|
19
|
-
html:not([data-scale]) .am-list .am-list-item.am-textarea-item {
|
|
20
|
-
border-bottom: none;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
html:not([data-scale]) .am-list .am-list-item.am-textarea-item::after {
|
|
24
|
-
content: '';
|
|
25
|
-
position: absolute;
|
|
26
|
-
background-color: #ddd;
|
|
27
|
-
display: block;
|
|
28
|
-
z-index: 1;
|
|
29
|
-
top: auto;
|
|
30
|
-
right: auto;
|
|
31
|
-
bottom: 0;
|
|
32
|
-
left: 0;
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 1PX;
|
|
35
|
-
-webkit-transform-origin: 50% 100%;
|
|
36
|
-
-ms-transform-origin: 50% 100%;
|
|
37
|
-
transform-origin: 50% 100%;
|
|
38
|
-
-webkit-transform: scaleY(0.5);
|
|
39
|
-
-ms-transform: scaleY(0.5);
|
|
40
|
-
transform: scaleY(0.5);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@media (-webkit-min-device-pixel-ratio: 2) and (-webkit-min-device-pixel-ratio: 3), (min-resolution: 2dppx) and (min-resolution: 3dppx) {
|
|
45
|
-
html:not([data-scale]) .am-list .am-list-item.am-textarea-item::after {
|
|
46
|
-
-webkit-transform: scaleY(0.33);
|
|
47
|
-
-ms-transform: scaleY(0.33);
|
|
48
|
-
transform: scaleY(0.33);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.am-list .am-list-item.am-textarea-item.am-textarea-item-single-line {
|
|
53
|
-
-webkit-box-align: center;
|
|
54
|
-
-webkit-align-items: center;
|
|
55
|
-
-ms-flex-align: center;
|
|
56
|
-
align-items: center;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.am-list .am-list-item.am-textarea-item.am-textarea-item-single-line .am-textarea-label {
|
|
60
|
-
-webkit-align-self: center;
|
|
61
|
-
-ms-flex-item-align: center;
|
|
62
|
-
align-self: center;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.am-list .am-list-item.am-textarea-item.am-textarea-item-single-line .am-textarea-control {
|
|
66
|
-
padding-top: 0;
|
|
67
|
-
padding-bottom: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.am-list .am-list-item.am-textarea-item.am-textarea-item-single-line .am-textarea-control textarea {
|
|
71
|
-
line-height: 25.5px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.am-list .am-list-item.am-textarea-item.am-textarea-item-single-line .am-textarea-clear {
|
|
75
|
-
margin-top: 0;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.am-list .am-list-item.am-textarea-item.am-textarea-item-single-line.am-textarea-error .am-textarea-error-extra {
|
|
79
|
-
margin-top: 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.am-textarea-label {
|
|
83
|
-
-webkit-align-self: flex-start;
|
|
84
|
-
-ms-flex-item-align: start;
|
|
85
|
-
align-self: flex-start;
|
|
86
|
-
color: #000;
|
|
87
|
-
text-align: left;
|
|
88
|
-
min-height: 44px;
|
|
89
|
-
font-size: 17px;
|
|
90
|
-
line-height: 44px;
|
|
91
|
-
margin-left: 0;
|
|
92
|
-
margin-right: 5px;
|
|
93
|
-
white-space: nowrap;
|
|
94
|
-
overflow: hidden;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.am-textarea-label.am-textarea-label-2 {
|
|
98
|
-
width: 34px;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.am-textarea-label.am-textarea-label-3 {
|
|
102
|
-
width: 51px;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.am-textarea-label.am-textarea-label-4 {
|
|
106
|
-
width: 68px;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.am-textarea-label.am-textarea-label-5 {
|
|
110
|
-
width: 85px;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.am-textarea-label.am-textarea-label-6 {
|
|
114
|
-
width: 102px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.am-textarea-label.am-textarea-label-7 {
|
|
118
|
-
width: 119px;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.am-textarea-control {
|
|
122
|
-
-webkit-box-flex: 1;
|
|
123
|
-
-webkit-flex: 1;
|
|
124
|
-
-ms-flex: 1;
|
|
125
|
-
flex: 1;
|
|
126
|
-
padding-top: 10px;
|
|
127
|
-
padding-bottom: 9px;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.am-textarea-control textarea {
|
|
131
|
-
color: #000;
|
|
132
|
-
font-size: 17px;
|
|
133
|
-
line-height: 25.5px;
|
|
134
|
-
-webkit-appearance: none;
|
|
135
|
-
-moz-appearance: none;
|
|
136
|
-
appearance: none;
|
|
137
|
-
width: 100%;
|
|
138
|
-
padding: 0;
|
|
139
|
-
border: 0;
|
|
140
|
-
background-color: transparent;
|
|
141
|
-
overflow: visible;
|
|
142
|
-
display: block;
|
|
143
|
-
resize: none;
|
|
144
|
-
word-break: break-word;
|
|
145
|
-
word-wrap: break-word;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.am-textarea-control textarea::-webkit-input-placeholder {
|
|
149
|
-
color: #bbb;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.am-textarea-control textarea::-moz-placeholder {
|
|
153
|
-
color: #bbb;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
.am-textarea-control textarea::-ms-input-placeholder {
|
|
157
|
-
color: #bbb;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.am-textarea-control textarea::placeholder {
|
|
161
|
-
color: #bbb;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.am-textarea-control textarea:disabled {
|
|
165
|
-
color: #bbb;
|
|
166
|
-
background-color: #fff;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.am-textarea-clear {
|
|
170
|
-
display: none;
|
|
171
|
-
width: 21px;
|
|
172
|
-
height: 21px;
|
|
173
|
-
margin-top: 12px;
|
|
174
|
-
border-radius: 50%;
|
|
175
|
-
overflow: hidden;
|
|
176
|
-
font-style: normal;
|
|
177
|
-
color: #fff;
|
|
178
|
-
background-color: #ccc;
|
|
179
|
-
background-repeat: no-repeat;
|
|
180
|
-
background-size: 21px auto;
|
|
181
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20fill%3D'%23fff'%20width%3D'24'%20height%3D'24'%20viewBox%3D'0%200%2024%2024'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cpath%20d%3D'M19%206.41L17.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z'%2F%3E%3Cpath%20d%3D'M0%200h24v24H0z'%20fill%3D'none'%2F%3E%3C%2Fsvg%3E");
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.am-textarea-clear-active {
|
|
185
|
-
background-color: #108ee9;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.am-textarea-focus .am-textarea-clear {
|
|
189
|
-
display: block;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.am-textarea-has-count {
|
|
193
|
-
padding-bottom: 14px;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
.am-textarea-count {
|
|
197
|
-
position: absolute;
|
|
198
|
-
bottom: 6px;
|
|
199
|
-
right: 5px;
|
|
200
|
-
color: #bbb;
|
|
201
|
-
font-size: 14px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.am-textarea-count span {
|
|
205
|
-
color: #000;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.am-textarea-error .am-textarea-control textarea {
|
|
209
|
-
color: #f50;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.am-textarea-error .am-textarea-error-extra {
|
|
213
|
-
margin-top: 12px;
|
|
214
|
-
width: 21px;
|
|
215
|
-
height: 21px;
|
|
216
|
-
margin-left: 8px;
|
|
217
|
-
background-size: 21px 21px;
|
|
218
|
-
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20width%3D'18'%20height%3D'18'%20viewBox%3D'0%200%2018%2018'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%3E%3Cg%20stroke%3D'none'%20stroke-width%3D'1'%20fill%3D'none'%20fill-rule%3D'evenodd'%3E%3Cg%20transform%3D'translate(-300.000000%2C%20-1207.000000)'%20fill%3D'%23FF5500'%3E%3Cg%20id%3D'exclamation-circle-o'%20transform%3D'translate(300.000000%2C%201207.000000)'%3E%3Cpath%20d%3D'M9%2C16.734375%20C10.0441406%2C16.734375%2011.0566406%2C16.5304688%2012.009375%2C16.1279297%20C12.9304688%2C15.7376953%2013.7566406%2C15.1804687%2014.4685547%2C14.4703125%20C15.1787109%2C13.7601563%2015.7376953%2C12.9322266%2016.1261719%2C12.0111328%20C16.5304688%2C11.0566406%2016.734375%2C10.0441406%2016.734375%2C9%20C16.734375%2C7.95585938%2016.5304688%2C6.94335938%2016.1279297%2C5.990625%20C15.7376953%2C5.06953125%2015.1804687%2C4.24335938%2014.4703125%2C3.53144531%20C13.7601563%2C2.82128906%2012.9322266%2C2.26230469%2012.0111328%2C1.87382813%20C11.0566406%2C1.46953125%2010.0441406%2C1.265625%209%2C1.265625%20C7.95585938%2C1.265625%206.94335938%2C1.46953125%205.990625%2C1.87207031%20C5.06953125%2C2.26230469%204.24335938%2C2.81953125%203.53144531%2C3.5296875%20C2.82128906%2C4.23984375%202.26230469%2C5.06777344%201.87382813%2C5.98886719%20C1.46953125%2C6.94335938%201.265625%2C7.95585938%201.265625%2C9%20C1.265625%2C10.0441406%201.46953125%2C11.0566406%201.87207031%2C12.009375%20C2.26230469%2C12.9304688%202.81953125%2C13.7566406%203.5296875%2C14.4685547%20C4.23984375%2C15.1787109%205.06777344%2C15.7376953%205.98886719%2C16.1261719%20C6.94335938%2C16.5304688%207.95585938%2C16.734375%209%2C16.734375%20L9%2C16.734375%20Z%20M9%2C18%20C4.02890625%2C18%200%2C13.9710937%200%2C9%20C0%2C4.02890625%204.02890625%2C0%209%2C0%20C13.9710937%2C0%2018%2C4.02890625%2018%2C9%20C18%2C13.9710937%2013.9710937%2C18%209%2C18%20L9%2C18%20L9%2C18%20Z%20M9%2C6.75%20C8.61152344%2C6.75%208.296875%2C7.06464844%208.296875%2C7.453125%20L8.296875%2C13.9394531%20C8.296875%2C14.3279297%208.61152344%2C14.6425781%209%2C14.6425781%20C9.38847656%2C14.6425781%209.703125%2C14.3279297%209.703125%2C13.9394531%20L9.703125%2C7.453125%20C9.703125%2C7.06464844%209.38847656%2C6.75%209%2C6.75%20L9%2C6.75%20Z%20M8.20898438%2C4.83398438%20C8.20898438%2C5.27085024%208.56313413%2C5.625%209%2C5.625%20C9.43686587%2C5.625%209.79101562%2C5.27085024%209.79101562%2C4.83398438%20C9.79101562%2C4.39711851%209.43686587%2C4.04296875%209%2C4.04296875%20C8.56313413%2C4.04296875%208.20898438%2C4.39711851%208.20898438%2C4.83398438%20L8.20898438%2C4.83398438%20Z'%20id%3D'Shape'%20transform%3D'translate(9.000000%2C%209.000000)%20scale(1%2C%20-1)%20translate(-9.000000%2C%20-9.000000)%20'%3E%3C%2Fpath%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.am-textarea-disabled .am-textarea-label {
|
|
222
|
-
color: #bbb;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.am-list-body .am-list-item:last-child {
|
|
226
|
-
border-bottom: 0;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
.am-list-body .am-list-item:last-child:after {
|
|
230
|
-
display: none !important;
|
|
231
|
-
}
|
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _rmcFeedback = _interopRequireDefault(require("rmc-feedback"));
|
|
12
|
-
var _exenv = require("../_util/exenv");
|
|
13
|
-
require("./index.css");
|
|
14
|
-
/* tslint:disable:jsx-no-multiline-js */
|
|
15
|
-
|
|
16
|
-
function noop() {}
|
|
17
|
-
function fixControlledValue(value) {
|
|
18
|
-
if (typeof value === 'undefined' || value === null) {
|
|
19
|
-
return '';
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
const regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]|\n/g;
|
|
24
|
-
function countSymbols() {
|
|
25
|
-
let text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
26
|
-
return text.replace(regexAstralSymbols, '_').length;
|
|
27
|
-
}
|
|
28
|
-
class TextareaItem extends React.Component {
|
|
29
|
-
constructor(props) {
|
|
30
|
-
super(props);
|
|
31
|
-
this.focus = () => {
|
|
32
|
-
this.textareaRef.focus();
|
|
33
|
-
};
|
|
34
|
-
this.reAlignHeight = () => {
|
|
35
|
-
const textareaDom = this.textareaRef;
|
|
36
|
-
textareaDom.style.height = ''; // 字数减少时能自动减小高度
|
|
37
|
-
textareaDom.style.height = "".concat(textareaDom.scrollHeight, "px");
|
|
38
|
-
};
|
|
39
|
-
this.onChange = e => {
|
|
40
|
-
const value = e.target.value;
|
|
41
|
-
if ('value' in this.props) {
|
|
42
|
-
this.setState({
|
|
43
|
-
value: this.props.value
|
|
44
|
-
});
|
|
45
|
-
} else {
|
|
46
|
-
this.setState({
|
|
47
|
-
value
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
const {
|
|
51
|
-
onChange
|
|
52
|
-
} = this.props;
|
|
53
|
-
if (onChange) {
|
|
54
|
-
onChange(value);
|
|
55
|
-
}
|
|
56
|
-
// 设置 defaultValue 时,用户输入不会触发 componentDidUpdate ,此处手工调用
|
|
57
|
-
this.componentDidUpdate();
|
|
58
|
-
};
|
|
59
|
-
this.onBlur = e => {
|
|
60
|
-
this.debounceTimeout = setTimeout(() => {
|
|
61
|
-
if (document.activeElement !== this.textareaRef) {
|
|
62
|
-
this.setState({
|
|
63
|
-
focus: false
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}, 100);
|
|
67
|
-
const value = e.currentTarget.value;
|
|
68
|
-
if (this.props.onBlur) {
|
|
69
|
-
// fix autoFocus item blur with flash
|
|
70
|
-
setTimeout(() => {
|
|
71
|
-
// fix ios12 wechat browser click failure after input
|
|
72
|
-
if (document.body) {
|
|
73
|
-
// eslint-disable-next-line no-self-assign
|
|
74
|
-
document.body.scrollTop = document.body.scrollTop;
|
|
75
|
-
}
|
|
76
|
-
}, 100);
|
|
77
|
-
this.props.onBlur(value);
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
this.onFocus = e => {
|
|
81
|
-
if (this.debounceTimeout) {
|
|
82
|
-
clearTimeout(this.debounceTimeout);
|
|
83
|
-
this.debounceTimeout = null;
|
|
84
|
-
}
|
|
85
|
-
this.setState({
|
|
86
|
-
focus: true
|
|
87
|
-
});
|
|
88
|
-
const value = e.currentTarget.value;
|
|
89
|
-
if (this.props.onFocus) {
|
|
90
|
-
this.props.onFocus(value);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
this.onErrorClick = () => {
|
|
94
|
-
if (this.props.onErrorClick) {
|
|
95
|
-
this.props.onErrorClick();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
this.clearInput = () => {
|
|
99
|
-
this.setState({
|
|
100
|
-
value: ''
|
|
101
|
-
});
|
|
102
|
-
if (this.props.onChange) {
|
|
103
|
-
this.props.onChange('');
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
this.state = {
|
|
107
|
-
focus: false,
|
|
108
|
-
value: props.value || props.defaultValue || ''
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
componentWillReceiveProps(nextProps) {
|
|
112
|
-
if ('value' in nextProps) {
|
|
113
|
-
this.setState({
|
|
114
|
-
value: fixControlledValue(nextProps.value)
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
componentDidMount() {
|
|
119
|
-
if (this.props.autoHeight) {
|
|
120
|
-
this.reAlignHeight();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
componentDidUpdate() {
|
|
124
|
-
if (this.props.autoHeight) {
|
|
125
|
-
this.reAlignHeight();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
componentWillUnmount() {
|
|
129
|
-
if (this.debounceTimeout) {
|
|
130
|
-
clearTimeout(this.debounceTimeout);
|
|
131
|
-
this.debounceTimeout = null;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
render() {
|
|
135
|
-
const {
|
|
136
|
-
prefixCls,
|
|
137
|
-
prefixListCls,
|
|
138
|
-
editable,
|
|
139
|
-
style,
|
|
140
|
-
clear,
|
|
141
|
-
children,
|
|
142
|
-
error,
|
|
143
|
-
className,
|
|
144
|
-
count,
|
|
145
|
-
labelNumber,
|
|
146
|
-
title,
|
|
147
|
-
onErrorClick,
|
|
148
|
-
autoHeight,
|
|
149
|
-
defaultValue,
|
|
150
|
-
...otherProps
|
|
151
|
-
} = this.props;
|
|
152
|
-
const {
|
|
153
|
-
disabled
|
|
154
|
-
} = otherProps;
|
|
155
|
-
const {
|
|
156
|
-
value,
|
|
157
|
-
focus
|
|
158
|
-
} = this.state;
|
|
159
|
-
const hasCount = count > 0 && this.props.rows > 1;
|
|
160
|
-
const wrapCls = (0, _classnames.default)(className, "".concat(prefixListCls, "-item"), "".concat(prefixCls, "-item"), {
|
|
161
|
-
["".concat(prefixCls, "-disabled")]: disabled,
|
|
162
|
-
["".concat(prefixCls, "-item-single-line")]: this.props.rows === 1 && !autoHeight,
|
|
163
|
-
["".concat(prefixCls, "-error")]: error,
|
|
164
|
-
["".concat(prefixCls, "-focus")]: focus,
|
|
165
|
-
["".concat(prefixCls, "-has-count")]: hasCount
|
|
166
|
-
});
|
|
167
|
-
const labelCls = (0, _classnames.default)("".concat(prefixCls, "-label"), {
|
|
168
|
-
["".concat(prefixCls, "-label-2")]: labelNumber === 2,
|
|
169
|
-
["".concat(prefixCls, "-label-3")]: labelNumber === 3,
|
|
170
|
-
["".concat(prefixCls, "-label-4")]: labelNumber === 4,
|
|
171
|
-
["".concat(prefixCls, "-label-5")]: labelNumber === 5,
|
|
172
|
-
["".concat(prefixCls, "-label-6")]: labelNumber === 6,
|
|
173
|
-
["".concat(prefixCls, "-label-7")]: labelNumber === 7
|
|
174
|
-
});
|
|
175
|
-
const characterLength = countSymbols(value);
|
|
176
|
-
const lengthCtrlProps = {};
|
|
177
|
-
if (count > 0) {
|
|
178
|
-
// Note: If in the iOS environment of dev-tools, It will fail.
|
|
179
|
-
if (_exenv.IS_IOS) {
|
|
180
|
-
const entValue = value ? value.replace(regexAstralSymbols, '_') : '';
|
|
181
|
-
const entLen = entValue ? entValue.split('_').length - 1 : 0;
|
|
182
|
-
lengthCtrlProps.maxLength = count + entLen - characterLength + (value ? value.length : 0);
|
|
183
|
-
} else {
|
|
184
|
-
lengthCtrlProps.maxLength = count - characterLength + (value ? value.length : 0);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
188
|
-
className: wrapCls
|
|
189
|
-
}, title && /*#__PURE__*/React.createElement("div", {
|
|
190
|
-
className: labelCls
|
|
191
|
-
}, title), /*#__PURE__*/React.createElement("div", {
|
|
192
|
-
className: "".concat(prefixCls, "-control")
|
|
193
|
-
}, /*#__PURE__*/React.createElement("textarea", Object.assign({
|
|
194
|
-
ref: el => this.textareaRef = el
|
|
195
|
-
}, lengthCtrlProps, otherProps, {
|
|
196
|
-
value: value,
|
|
197
|
-
onChange: this.onChange,
|
|
198
|
-
onBlur: this.onBlur,
|
|
199
|
-
onFocus: this.onFocus,
|
|
200
|
-
readOnly: !editable,
|
|
201
|
-
style: style
|
|
202
|
-
}))), clear && editable && value && characterLength > 0 && /*#__PURE__*/React.createElement(_rmcFeedback.default, {
|
|
203
|
-
activeClassName: "".concat(prefixCls, "-clear-active")
|
|
204
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
205
|
-
className: "".concat(prefixCls, "-clear"),
|
|
206
|
-
onClick: this.clearInput
|
|
207
|
-
})), error && /*#__PURE__*/React.createElement("div", {
|
|
208
|
-
className: "".concat(prefixCls, "-error-extra"),
|
|
209
|
-
onClick: this.onErrorClick
|
|
210
|
-
}), hasCount && /*#__PURE__*/React.createElement("span", {
|
|
211
|
-
className: "".concat(prefixCls, "-count")
|
|
212
|
-
}, /*#__PURE__*/React.createElement("span", null, value ? characterLength : 0), "/", count));
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
exports.default = TextareaItem;
|
|
216
|
-
TextareaItem.defaultProps = {
|
|
217
|
-
prefixCls: 'am-textarea',
|
|
218
|
-
prefixListCls: 'am-list',
|
|
219
|
-
autoHeight: false,
|
|
220
|
-
editable: true,
|
|
221
|
-
disabled: false,
|
|
222
|
-
placeholder: '',
|
|
223
|
-
clear: false,
|
|
224
|
-
rows: 1,
|
|
225
|
-
onChange: noop,
|
|
226
|
-
onBlur: noop,
|
|
227
|
-
onFocus: noop,
|
|
228
|
-
onErrorClick: noop,
|
|
229
|
-
error: false,
|
|
230
|
-
labelNumber: 5
|
|
231
|
-
};
|
package/lib/Toast/index.css
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
.am-toast {
|
|
2
|
-
position: fixed;
|
|
3
|
-
width: 100%;
|
|
4
|
-
z-index: 1999;
|
|
5
|
-
font-size: 14px;
|
|
6
|
-
text-align: center;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.am-toast>span {
|
|
10
|
-
max-width: 50%;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.am-toast.am-toast-mask {
|
|
14
|
-
height: 100%;
|
|
15
|
-
display: -webkit-box;
|
|
16
|
-
display: -webkit-flex;
|
|
17
|
-
display: -ms-flexbox;
|
|
18
|
-
display: flex;
|
|
19
|
-
-webkit-box-pack: center;
|
|
20
|
-
-webkit-justify-content: center;
|
|
21
|
-
-ms-flex-pack: center;
|
|
22
|
-
justify-content: center;
|
|
23
|
-
-webkit-box-align: center;
|
|
24
|
-
-webkit-align-items: center;
|
|
25
|
-
-ms-flex-align: center;
|
|
26
|
-
align-items: center;
|
|
27
|
-
left: 0;
|
|
28
|
-
top: 0;
|
|
29
|
-
-webkit-transform: translateZ(1px);
|
|
30
|
-
transform: translateZ(1px);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.am-toast.am-toast-nomask {
|
|
34
|
-
position: fixed;
|
|
35
|
-
max-width: 50%;
|
|
36
|
-
width: auto;
|
|
37
|
-
left: 50%;
|
|
38
|
-
top: 50%;
|
|
39
|
-
-webkit-transform: translateZ(1px);
|
|
40
|
-
transform: translateZ(1px);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.am-toast.am-toast-nomask .am-toast-notice {
|
|
44
|
-
-webkit-transform: translateX(-50%) translateY(-50%);
|
|
45
|
-
-ms-transform: translateX(-50%) translateY(-50%);
|
|
46
|
-
transform: translateX(-50%) translateY(-50%);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.am-toast-notice-content .am-toast-text {
|
|
50
|
-
min-width: 60px;
|
|
51
|
-
border-radius: 3px;
|
|
52
|
-
color: #fff;
|
|
53
|
-
background-color: rgba(58, 58, 58, 0.9);
|
|
54
|
-
line-height: 1.5;
|
|
55
|
-
padding: 9px 15px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.am-toast-notice-content .am-toast-text.am-toast-text-icon {
|
|
59
|
-
border-radius: 5px;
|
|
60
|
-
padding: 15px 15px;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.am-toast-notice-content .am-toast-text.am-toast-text-icon .am-toast-text-info {
|
|
64
|
-
margin-top: 6px;
|
|
65
|
-
}
|
package/lib/Toast/index.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
-
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _rmcNotification = _interopRequireDefault(require("rmc-notification"));
|
|
12
|
-
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
13
|
-
require("./index.css");
|
|
14
|
-
const SHORT = 3;
|
|
15
|
-
const config = {
|
|
16
|
-
duration: SHORT,
|
|
17
|
-
mask: true
|
|
18
|
-
};
|
|
19
|
-
let messageInstance;
|
|
20
|
-
let messageNeedHide;
|
|
21
|
-
const prefixCls = 'am-toast';
|
|
22
|
-
function getMessageInstance(mask, callback) {
|
|
23
|
-
_rmcNotification.default.newInstance({
|
|
24
|
-
prefixCls,
|
|
25
|
-
style: {},
|
|
26
|
-
// clear rmc-notification default style
|
|
27
|
-
transitionName: 'am-fade',
|
|
28
|
-
className: (0, _classnames.default)({
|
|
29
|
-
["".concat(prefixCls, "-mask")]: mask,
|
|
30
|
-
["".concat(prefixCls, "-nomask")]: !mask
|
|
31
|
-
})
|
|
32
|
-
}, notification => callback && callback(notification));
|
|
33
|
-
}
|
|
34
|
-
function notice(content, type) {
|
|
35
|
-
let duration = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : config.duration;
|
|
36
|
-
let onClose = arguments.length > 3 ? arguments[3] : undefined;
|
|
37
|
-
let mask = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : config.mask;
|
|
38
|
-
const iconTypes = {
|
|
39
|
-
info: '',
|
|
40
|
-
success: 'success',
|
|
41
|
-
fail: 'fail',
|
|
42
|
-
offline: 'dislike',
|
|
43
|
-
loading: 'loading'
|
|
44
|
-
};
|
|
45
|
-
const iconType = iconTypes[type];
|
|
46
|
-
messageNeedHide = false;
|
|
47
|
-
getMessageInstance(mask, notification => {
|
|
48
|
-
if (!notification) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
if (messageInstance) {
|
|
52
|
-
messageInstance.destroy();
|
|
53
|
-
messageInstance = null;
|
|
54
|
-
}
|
|
55
|
-
if (messageNeedHide) {
|
|
56
|
-
notification.destroy();
|
|
57
|
-
messageNeedHide = false;
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
messageInstance = notification;
|
|
61
|
-
notification.notice({
|
|
62
|
-
duration,
|
|
63
|
-
style: {},
|
|
64
|
-
content: iconType ? /*#__PURE__*/React.createElement("div", {
|
|
65
|
-
className: "".concat(prefixCls, "-text ").concat(prefixCls, "-text-icon"),
|
|
66
|
-
role: "alert",
|
|
67
|
-
"aria-live": "assertive"
|
|
68
|
-
}, /*#__PURE__*/React.createElement(_Icon.default, {
|
|
69
|
-
type: iconType,
|
|
70
|
-
size: "lg"
|
|
71
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
72
|
-
className: "".concat(prefixCls, "-text-info")
|
|
73
|
-
}, content)) : /*#__PURE__*/React.createElement("div", {
|
|
74
|
-
className: "".concat(prefixCls, "-text"),
|
|
75
|
-
role: "alert",
|
|
76
|
-
"aria-live": "assertive"
|
|
77
|
-
}, /*#__PURE__*/React.createElement("div", null, content)),
|
|
78
|
-
closable: true,
|
|
79
|
-
onClose() {
|
|
80
|
-
if (onClose) {
|
|
81
|
-
onClose();
|
|
82
|
-
}
|
|
83
|
-
notification.destroy();
|
|
84
|
-
notification = null;
|
|
85
|
-
messageInstance = null;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const Toast = {
|
|
91
|
-
SHORT,
|
|
92
|
-
LONG: 8,
|
|
93
|
-
show(content, duration, mask) {
|
|
94
|
-
return notice(content, 'info', duration, () => {}, mask);
|
|
95
|
-
},
|
|
96
|
-
info(content, duration, onClose, mask) {
|
|
97
|
-
return notice(content, 'info', duration, onClose, mask);
|
|
98
|
-
},
|
|
99
|
-
success(content, duration, onClose, mask) {
|
|
100
|
-
return notice(content, 'success', duration, onClose, mask);
|
|
101
|
-
},
|
|
102
|
-
fail(content, duration, onClose, mask) {
|
|
103
|
-
return notice(content, 'fail', duration, onClose, mask);
|
|
104
|
-
},
|
|
105
|
-
offline(content, duration, onClose, mask) {
|
|
106
|
-
return notice(content, 'offline', duration, onClose, mask);
|
|
107
|
-
},
|
|
108
|
-
loading(content, duration, onClose, mask) {
|
|
109
|
-
return notice(content, 'loading', duration, onClose, mask);
|
|
110
|
-
},
|
|
111
|
-
hide() {
|
|
112
|
-
if (messageInstance) {
|
|
113
|
-
messageInstance.destroy();
|
|
114
|
-
messageInstance = null;
|
|
115
|
-
} else {
|
|
116
|
-
messageNeedHide = true;
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
config() {
|
|
120
|
-
let conf = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
121
|
-
const {
|
|
122
|
-
duration = SHORT,
|
|
123
|
-
mask
|
|
124
|
-
} = conf;
|
|
125
|
-
config.duration = duration;
|
|
126
|
-
if (mask === false) {
|
|
127
|
-
config.mask = false;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
var _default = exports.default = Toast;
|