dtable-ui-component 6.0.25 → 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.
Files changed (72) hide show
  1. package/lib/DateEditor/mb-date-editor-popover/index.js +3 -3
  2. package/lib/FileFormatter/index.js +98 -38
  3. package/lib/FileItemFormatter/index.js +3 -1
  4. package/lib/index.js +1 -106
  5. package/package.json +3 -12
  6. package/lib/ActionSheet/index.js +0 -194
  7. package/lib/ActionSheet/style/index.css +0 -365
  8. package/lib/ActivityIndicator/index.css +0 -108
  9. package/lib/ActivityIndicator/index.js +0 -76
  10. package/lib/Badge/index.css +0 -96
  11. package/lib/Badge/index.js +0 -65
  12. package/lib/DatePicker/index.js +0 -120
  13. package/lib/DatePicker/locale/en_US.js +0 -14
  14. package/lib/DatePicker/locale/ru_RU.js +0 -14
  15. package/lib/DatePicker/locale/sv_SE.js +0 -14
  16. package/lib/DatePicker/locale/zh_CN.js +0 -14
  17. package/lib/DatePicker/style/index.css +0 -290
  18. package/lib/DatePicker/utils.js +0 -36
  19. package/lib/Drawer/index.css +0 -142
  20. package/lib/Drawer/index.js +0 -21
  21. package/lib/Icon/index.css +0 -50
  22. package/lib/Icon/index.js +0 -34
  23. package/lib/Icon/load-sprite.js +0 -56
  24. package/lib/InputItem/custom-input.js +0 -321
  25. package/lib/InputItem/custom-keyboard.js +0 -162
  26. package/lib/InputItem/index.js +0 -388
  27. package/lib/InputItem/input.js +0 -45
  28. package/lib/InputItem/locale/en_US.js +0 -12
  29. package/lib/InputItem/locale/ru_RU.js +0 -12
  30. package/lib/InputItem/locale/sv_SE.js +0 -12
  31. package/lib/InputItem/locale/zh_CN.js +0 -12
  32. package/lib/InputItem/portal.js +0 -23
  33. package/lib/InputItem/style/index.css +0 -512
  34. package/lib/List/index.css +0 -381
  35. package/lib/List/index.js +0 -41
  36. package/lib/List/list-item.js +0 -169
  37. package/lib/Modal/alert.js +0 -82
  38. package/lib/Modal/index.js +0 -15
  39. package/lib/Modal/modal.js +0 -118
  40. package/lib/Modal/operation.js +0 -77
  41. package/lib/Modal/prompt.js +0 -207
  42. package/lib/Picker/AbstractPicker.js +0 -190
  43. package/lib/Picker/index.js +0 -28
  44. package/lib/Picker/locale/en_US.js +0 -12
  45. package/lib/Picker/locale/ru_RU.js +0 -12
  46. package/lib/Picker/locale/sv_SE.js +0 -12
  47. package/lib/Picker/locale/zh_CN.js +0 -12
  48. package/lib/Picker/popupProps.js +0 -12
  49. package/lib/Picker/style/index.css +0 -141
  50. package/lib/Popover/index.js +0 -62
  51. package/lib/Popover/item.js +0 -55
  52. package/lib/Popover/style/index.css +0 -229
  53. package/lib/Progress/index.css +0 -22
  54. package/lib/Progress/index.js +0 -65
  55. package/lib/Radio/Radio.js +0 -47
  56. package/lib/Radio/RadioItem.js +0 -57
  57. package/lib/Radio/index.css +0 -90
  58. package/lib/Radio/index.js +0 -12
  59. package/lib/TabBar/Tab.js +0 -76
  60. package/lib/TabBar/index.css +0 -138
  61. package/lib/TabBar/index.js +0 -128
  62. package/lib/Tabs/index.css +0 -443
  63. package/lib/Tabs/index.js +0 -38
  64. package/lib/TextareaItem/index.css +0 -231
  65. package/lib/TextareaItem/index.js +0 -231
  66. package/lib/Toast/index.css +0 -65
  67. package/lib/Toast/index.js +0 -131
  68. package/lib/_util/class.js +0 -34
  69. package/lib/_util/closest.js +0 -17
  70. package/lib/_util/exenv.js +0 -8
  71. package/lib/_util/getDataAttr.js +0 -15
  72. package/lib/_util/getLocale.js +0 -42
@@ -1,388 +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 PropTypes = _interopRequireWildcard(require("prop-types"));
11
- var React = _interopRequireWildcard(require("react"));
12
- var _rmcFeedback = _interopRequireDefault(require("rmc-feedback"));
13
- var _getLocale = require("../_util/getLocale");
14
- var _customInput = _interopRequireDefault(require("./custom-input"));
15
- var _input = _interopRequireDefault(require("./input"));
16
- /* tslint:disable:jsx-no-multiline-js */
17
-
18
- function noop() {}
19
- function normalizeValue(value) {
20
- if (typeof value === 'undefined' || value === null) {
21
- return '';
22
- }
23
- return value + '';
24
- }
25
- class InputItem extends React.Component {
26
- constructor(props) {
27
- var _this;
28
- super(props);
29
- _this = this;
30
- this.onInputChange = e => {
31
- const el = e.target;
32
- const {
33
- value: rawVal
34
- } = el;
35
- let prePos = 0;
36
- try {
37
- // some input type do not support selection, see https://html.spec.whatwg.org/multipage/input.html#do-not-apply
38
- prePos = el.selectionEnd || 0;
39
- } catch (error) {
40
- console.warn('Get selection error:', error);
41
- }
42
- const {
43
- value: preCtrlVal = ''
44
- } = this.state;
45
- const {
46
- type
47
- } = this.props;
48
- let ctrlValue = rawVal;
49
- switch (type) {
50
- case 'bankCard':
51
- ctrlValue = rawVal.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ');
52
- break;
53
- case 'phone':
54
- ctrlValue = rawVal.replace(/\D/g, '').substring(0, 11);
55
- const valueLen = ctrlValue.length;
56
- if (valueLen > 3 && valueLen < 8) {
57
- ctrlValue = "".concat(ctrlValue.substr(0, 3), " ").concat(ctrlValue.substr(3));
58
- } else if (valueLen >= 8) {
59
- ctrlValue = "".concat(ctrlValue.substr(0, 3), " ").concat(ctrlValue.substr(3, 4), " ").concat(ctrlValue.substr(7));
60
- }
61
- break;
62
- case 'number':
63
- ctrlValue = rawVal.replace(/\D/g, '');
64
- break;
65
- case 'text':
66
- case 'password':
67
- default:
68
- break;
69
- }
70
- this.handleOnChange(ctrlValue, ctrlValue !== rawVal, () => {
71
- switch (type) {
72
- case 'bankCard':
73
- case 'phone':
74
- case 'number':
75
- // controlled input type needs to adjust the position of the caret
76
- try {
77
- // some input type do not support selection, see https://html.spec.whatwg.org/multipage/input.html#do-not-apply
78
- let pos = this.calcPos(prePos, preCtrlVal, rawVal, ctrlValue, [' '], /\D/g);
79
- if (type === 'phone' && (pos === 4 || pos === 9) || type === 'bankCard' && pos > 0 && pos % 5 === 0) {
80
- pos -= 1;
81
- }
82
- el.selectionStart = el.selectionEnd = pos;
83
- } catch (error) {
84
- console.warn('Set selection error:', error);
85
- }
86
- break;
87
- default:
88
- break;
89
- }
90
- });
91
- };
92
- this.handleOnChange = function (value) {
93
- let isMutated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
94
- let adjustPos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop;
95
- const {
96
- onChange
97
- } = _this.props;
98
- if (!('value' in _this.props)) {
99
- _this.setState({
100
- value
101
- });
102
- } else {
103
- _this.setState({
104
- value: _this.props.value
105
- });
106
- }
107
- if (onChange) {
108
- if (isMutated) {
109
- setTimeout(() => {
110
- onChange(value);
111
- adjustPos();
112
- });
113
- } else {
114
- onChange(value);
115
- adjustPos();
116
- }
117
- } else {
118
- adjustPos();
119
- }
120
- };
121
- this.onInputFocus = value => {
122
- if (this.debounceTimeout) {
123
- clearTimeout(this.debounceTimeout);
124
- this.debounceTimeout = null;
125
- }
126
- this.setState({
127
- focus: true
128
- });
129
- if (this.props.onFocus) {
130
- this.props.onFocus(value);
131
- }
132
- };
133
- this.onInputBlur = value => {
134
- if (this.inputRef) {
135
- // this.inputRef may be null if customKeyboard unmount
136
- this.debounceTimeout = window.setTimeout(() => {
137
- if (document.activeElement !== (this.inputRef && this.inputRef.inputRef)) {
138
- this.setState({
139
- focus: false
140
- });
141
- }
142
- }, 200);
143
- }
144
- if (this.props.onBlur) {
145
- // fix autoFocus item blur with flash
146
- setTimeout(() => {
147
- // fix ios12 wechat browser click failure after input
148
- if (document.body) {
149
- // eslint-disable-next-line no-self-assign
150
- document.body.scrollTop = document.body.scrollTop;
151
- }
152
- }, 100);
153
- this.props.onBlur(value);
154
- }
155
- };
156
- this.clearInput = () => {
157
- if (this.props.type !== 'password' && this.props.updatePlaceholder) {
158
- this.setState({
159
- placeholder: this.props.value
160
- });
161
- }
162
- this.setState({
163
- value: ''
164
- });
165
- if (this.props.onChange) {
166
- this.props.onChange('');
167
- }
168
- this.focus();
169
- };
170
- // this is instance method for user to use
171
- this.focus = () => {
172
- if (this.inputRef) {
173
- this.inputRef.focus();
174
- }
175
- };
176
- // calculate the position of the caret
177
- this.calcPos = (prePos, preCtrlVal, rawVal, ctrlVal, placeholderChars, maskReg) => {
178
- const editLength = rawVal.length - preCtrlVal.length;
179
- const isAddition = editLength > 0;
180
- let pos = prePos;
181
- if (isAddition) {
182
- const additionStr = rawVal.substr(pos - editLength, editLength);
183
- let ctrlCharCount = additionStr.replace(maskReg, '').length;
184
- pos -= editLength - ctrlCharCount;
185
- let placeholderCharCount = 0;
186
- while (ctrlCharCount > 0) {
187
- if (placeholderChars.indexOf(ctrlVal.charAt(pos - ctrlCharCount + placeholderCharCount)) === -1) {
188
- ctrlCharCount--;
189
- } else {
190
- placeholderCharCount++;
191
- }
192
- }
193
- pos += placeholderCharCount;
194
- }
195
- return pos;
196
- };
197
- this.state = {
198
- placeholder: props.placeholder,
199
- value: normalizeValue(props.value || props.defaultValue)
200
- };
201
- }
202
- componentWillReceiveProps(nextProps) {
203
- if ('placeholder' in nextProps && !nextProps.updatePlaceholder) {
204
- this.setState({
205
- placeholder: nextProps.placeholder
206
- });
207
- }
208
- if ('value' in nextProps) {
209
- this.setState({
210
- value: nextProps.value
211
- });
212
- }
213
- }
214
- componentWillUnmount() {
215
- if (this.debounceTimeout) {
216
- window.clearTimeout(this.debounceTimeout);
217
- this.debounceTimeout = null;
218
- }
219
- }
220
- render() {
221
- const props = {
222
- ...this.props
223
- };
224
- delete props.updatePlaceholder;
225
- const {
226
- prefixCls,
227
- prefixListCls,
228
- editable,
229
- style,
230
- clear,
231
- children,
232
- error,
233
- className,
234
- extra,
235
- labelNumber,
236
- type,
237
- onExtraClick,
238
- onErrorClick,
239
- moneyKeyboardAlign,
240
- moneyKeyboardWrapProps,
241
- moneyKeyboardHeader,
242
- onVirtualKeyboardConfirm,
243
- autoAdjustHeight,
244
- disabledKeys,
245
- ...restProps
246
- } = props;
247
- const {
248
- name,
249
- disabled,
250
- maxLength
251
- } = restProps;
252
- const {
253
- value
254
- } = this.state;
255
-
256
- // tslint:disable-next-line:variable-name
257
- const _locale = (0, _getLocale.getComponentLocale)(this.props, this.context, 'InputItem', () => require('./locale/zh_CN'));
258
- const {
259
- confirmLabel,
260
- backspaceLabel,
261
- cancelKeyboardLabel
262
- } = _locale;
263
- const {
264
- focus,
265
- placeholder
266
- } = this.state;
267
- const wrapCls = (0, _classnames.default)("".concat(prefixListCls, "-item"), "".concat(prefixCls, "-item"), "".concat(prefixListCls, "-item-middle"), className, {
268
- ["".concat(prefixCls, "-disabled")]: disabled,
269
- ["".concat(prefixCls, "-error")]: error,
270
- ["".concat(prefixCls, "-focus")]: focus,
271
- ["".concat(prefixCls, "-android")]: focus
272
- });
273
- const labelCls = (0, _classnames.default)("".concat(prefixCls, "-label"), {
274
- ["".concat(prefixCls, "-label-2")]: labelNumber === 2,
275
- ["".concat(prefixCls, "-label-3")]: labelNumber === 3,
276
- ["".concat(prefixCls, "-label-4")]: labelNumber === 4,
277
- ["".concat(prefixCls, "-label-5")]: labelNumber === 5,
278
- ["".concat(prefixCls, "-label-6")]: labelNumber === 6,
279
- ["".concat(prefixCls, "-label-7")]: labelNumber === 7
280
- });
281
- const controlCls = "".concat(prefixCls, "-control");
282
- let inputType = 'text';
283
- if (type === 'bankCard' || type === 'phone') {
284
- inputType = 'tel';
285
- } else if (type === 'password') {
286
- inputType = 'password';
287
- } else if (type === 'digit') {
288
- inputType = 'number';
289
- } else if (type !== 'text' && type !== 'number') {
290
- inputType = type;
291
- }
292
- let patternProps;
293
- if (type === 'number') {
294
- patternProps = {
295
- pattern: '[0-9]*'
296
- };
297
- }
298
- let classNameProps;
299
- if (type === 'digit') {
300
- classNameProps = {
301
- className: 'h5numInput' // the name is bad! todos rename.
302
- };
303
- }
304
- return /*#__PURE__*/React.createElement("div", {
305
- className: wrapCls
306
- }, /*#__PURE__*/React.createElement("div", {
307
- className: "".concat(prefixListCls, "-line")
308
- }, children ? /*#__PURE__*/React.createElement("div", {
309
- className: labelCls
310
- }, children) : null, /*#__PURE__*/React.createElement("div", {
311
- className: controlCls
312
- }, type === 'money' ? /*#__PURE__*/React.createElement(_customInput.default, {
313
- value: normalizeValue(value),
314
- type: type,
315
- ref: el => this.inputRef = el,
316
- maxLength: maxLength,
317
- placeholder: placeholder,
318
- onChange: this.onInputChange,
319
- onFocus: this.onInputFocus,
320
- onBlur: this.onInputBlur,
321
- onVirtualKeyboardConfirm: onVirtualKeyboardConfirm,
322
- disabled: disabled,
323
- editable: editable,
324
- prefixCls: prefixCls,
325
- style: style,
326
- confirmLabel: confirmLabel,
327
- backspaceLabel: backspaceLabel,
328
- cancelKeyboardLabel: cancelKeyboardLabel,
329
- moneyKeyboardAlign: moneyKeyboardAlign,
330
- moneyKeyboardWrapProps: moneyKeyboardWrapProps,
331
- moneyKeyboardHeader: moneyKeyboardHeader,
332
- autoAdjustHeight: autoAdjustHeight,
333
- disabledKeys: disabledKeys
334
- }) : /*#__PURE__*/React.createElement(_input.default, Object.assign({}, patternProps, restProps, classNameProps, {
335
- value: normalizeValue(value),
336
- defaultValue: undefined,
337
- ref: el => this.inputRef = el,
338
- style: style,
339
- type: inputType,
340
- maxLength: maxLength,
341
- name: name,
342
- placeholder: placeholder,
343
- onChange: this.onInputChange,
344
- onFocus: this.onInputFocus,
345
- onBlur: this.onInputBlur,
346
- readOnly: !editable,
347
- disabled: disabled
348
- }))), clear && editable && !disabled && value && "".concat(value).length > 0 ? /*#__PURE__*/React.createElement(_rmcFeedback.default, {
349
- activeClassName: "".concat(prefixCls, "-clear-active")
350
- }, /*#__PURE__*/React.createElement("div", {
351
- className: "".concat(prefixCls, "-clear"),
352
- onClick: this.clearInput
353
- })) : null, error ? /*#__PURE__*/React.createElement("div", {
354
- className: "".concat(prefixCls, "-error-extra"),
355
- onClick: onErrorClick
356
- }) : null, extra !== '' ? /*#__PURE__*/React.createElement("div", {
357
- className: "".concat(prefixCls, "-extra"),
358
- onClick: onExtraClick
359
- }, extra) : null));
360
- }
361
- }
362
- InputItem.defaultProps = {
363
- prefixCls: 'am-input',
364
- prefixListCls: 'am-list',
365
- type: 'text',
366
- editable: true,
367
- disabled: false,
368
- placeholder: '',
369
- clear: false,
370
- onChange: noop,
371
- onBlur: noop,
372
- onFocus: noop,
373
- extra: '',
374
- onExtraClick: noop,
375
- error: false,
376
- onErrorClick: noop,
377
- onVirtualKeyboardConfirm: noop,
378
- labelNumber: 5,
379
- updatePlaceholder: false,
380
- moneyKeyboardAlign: 'right',
381
- moneyKeyboardWrapProps: {},
382
- moneyKeyboardHeader: null,
383
- disabledKeys: null
384
- };
385
- InputItem.contextTypes = {
386
- antLocale: PropTypes.object
387
- };
388
- var _default = exports.default = InputItem;
@@ -1,45 +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 = void 0;
8
- var React = _interopRequireWildcard(require("react"));
9
- require("./style/index.css");
10
- class Input extends React.Component {
11
- constructor() {
12
- super(...arguments);
13
- this.onInputBlur = e => {
14
- const value = e.target.value;
15
- if (this.props.onBlur) {
16
- this.props.onBlur(value);
17
- }
18
- };
19
- this.onInputFocus = e => {
20
- // here should have a value definition but none.
21
- const value = e.target.value;
22
- if (this.props.onFocus) {
23
- this.props.onFocus(value);
24
- }
25
- };
26
- this.focus = () => {
27
- if (this.inputRef) {
28
- this.inputRef.focus();
29
- }
30
- };
31
- }
32
- render() {
33
- const {
34
- onBlur,
35
- onFocus,
36
- ...restProps
37
- } = this.props;
38
- return /*#__PURE__*/React.createElement("input", Object.assign({
39
- ref: el => this.inputRef = el,
40
- onBlur: this.onInputBlur,
41
- onFocus: this.onInputFocus
42
- }, restProps));
43
- }
44
- }
45
- var _default = exports.default = Input;
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- // eslint-disable-next-line import/no-anonymous-default-export
8
- var _default = exports.default = {
9
- confirmLabel: 'Done',
10
- backspaceLabel: 'Backspace',
11
- cancelKeyboardLabel: 'CancelKeyboard'
12
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- // eslint-disable-next-line import/no-anonymous-default-export
8
- var _default = exports.default = {
9
- confirmLabel: 'Ок',
10
- backspaceLabel: 'возврат на одну позицию',
11
- cancelKeyboardLabel: 'Отменить клавиатуру'
12
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- // eslint-disable-next-line import/no-anonymous-default-export
8
- var _default = exports.default = {
9
- confirmLabel: 'Ok',
10
- backspaceLabel: 'Backspace',
11
- cancelKeyboardLabel: 'CancelKeyboard'
12
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- // eslint-disable-next-line import/no-anonymous-default-export
8
- var _default = exports.default = {
9
- confirmLabel: '确定',
10
- backspaceLabel: '退格',
11
- cancelKeyboardLabel: '收起键盘'
12
- };
@@ -1,23 +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 = void 0;
8
- var React = _interopRequireWildcard(require("react"));
9
- var ReactDOM = _interopRequireWildcard(require("react-dom"));
10
- const createPortal = ReactDOM.createPortal;
11
- class Portal extends React.Component {
12
- constructor(props) {
13
- super(props);
14
- this.container = this.props.getContainer();
15
- }
16
- render() {
17
- if (this.props.children) {
18
- return createPortal(this.props.children, this.container);
19
- }
20
- return null;
21
- }
22
- }
23
- exports.default = Portal;