shineout 1.8.3 → 1.9.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/Button/Button.js +1 -1
- package/css/DatePicker/Container.js +33 -12
- package/css/DatePicker/Text.js +3 -3
- package/css/DatePicker/index.d.ts +9 -0
- package/css/DatePicker/styles/datepicker.css +28 -1
- package/css/EditableArea/EditableArea.js +93 -21
- package/css/EditableArea/index.d.ts +37 -1
- package/css/Form/styles/form.css +62 -5
- package/css/Input/Group.js +2 -1
- package/css/Input/Input.js +21 -7
- package/css/Input/index.d.ts +19 -0
- package/css/InputTitle/index.js +11 -0
- package/css/InputTitle/inputTitle.js +51 -0
- package/css/InputTitle/styles/index.js +13 -0
- package/css/InputTitle/styles/inputTitle.css +78 -0
- package/css/Menu/Item.js +9 -1
- package/css/Select/Result.js +21 -13
- package/css/Select/Select.js +6 -3
- package/css/Select/index.d.ts +9 -0
- package/css/Select/styles/select.css +227 -148
- package/css/Table/SeperateTable.js +5 -3
- package/css/Table/SimpleTable.js +13 -7
- package/css/Table/Table.js +3 -1
- package/css/Table/styles/table.css +8 -8
- package/css/Textarea/Textarea.js +45 -13
- package/css/Textarea/index.d.ts +34 -0
- package/css/Textarea/index.js +15 -1
- package/css/hoc/inputBorder.js +2 -1
- package/css/index.d.ts +2 -1
- package/css/index.js +6 -2
- package/css/utils/cleanProps.js +1 -1
- package/dist/shineout.js +621 -218
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/dist/theme.antd.css +1 -1
- package/dist/theme.antd2.css +1 -1
- package/dist/theme.default.css +1 -1
- package/dist/theme.shineout.css +1 -1
- package/es/Button/Button.js +1 -1
- package/es/DatePicker/Container.js +31 -12
- package/es/DatePicker/Text.js +3 -3
- package/es/DatePicker/index.d.ts +9 -0
- package/es/DatePicker/styles/datepicker.less +37 -1
- package/es/EditableArea/EditableArea.js +89 -21
- package/es/EditableArea/index.d.ts +37 -1
- package/es/Form/styles/form.less +60 -5
- package/es/Input/Group.js +2 -1
- package/es/Input/Input.js +17 -5
- package/es/Input/index.d.ts +19 -0
- package/es/InputTitle/index.js +2 -0
- package/es/InputTitle/inputTitle.js +40 -0
- package/es/InputTitle/styles/index.js +3 -0
- package/es/InputTitle/styles/inputTitle.less +84 -0
- package/es/Menu/Item.js +9 -1
- package/es/Select/Result.js +20 -13
- package/es/Select/Select.js +6 -3
- package/es/Select/index.d.ts +9 -0
- package/es/Select/styles/select.less +222 -144
- package/es/Table/SeperateTable.js +5 -3
- package/es/Table/SimpleTable.js +13 -7
- package/es/Table/Table.js +3 -1
- package/es/Table/styles/table.less +1 -1
- package/es/Textarea/Textarea.js +42 -13
- package/es/Textarea/index.d.ts +34 -0
- package/es/Textarea/index.js +14 -1
- package/es/hoc/inputBorder.js +2 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/styles/themes/base.less +10 -0
- package/es/styles/themes/shineout.less +1 -1
- package/es/utils/cleanProps.js +1 -1
- package/lib/Button/Button.js +1 -1
- package/lib/DatePicker/Container.js +33 -12
- package/lib/DatePicker/Text.js +3 -3
- package/lib/DatePicker/index.d.ts +9 -0
- package/lib/DatePicker/styles/datepicker.less +37 -1
- package/lib/EditableArea/EditableArea.js +93 -21
- package/lib/EditableArea/index.d.ts +37 -1
- package/lib/Form/styles/form.less +60 -5
- package/lib/Input/Group.js +2 -1
- package/lib/Input/Input.js +21 -7
- package/lib/Input/index.d.ts +19 -0
- package/lib/InputTitle/index.js +11 -0
- package/lib/InputTitle/inputTitle.js +51 -0
- package/lib/InputTitle/styles/index.js +13 -0
- package/lib/InputTitle/styles/inputTitle.less +84 -0
- package/lib/Menu/Item.js +9 -1
- package/lib/Select/Result.js +21 -13
- package/lib/Select/Select.js +6 -3
- package/lib/Select/index.d.ts +9 -0
- package/lib/Select/styles/select.less +222 -144
- package/lib/Table/SeperateTable.js +5 -3
- package/lib/Table/SimpleTable.js +13 -7
- package/lib/Table/Table.js +3 -1
- package/lib/Table/styles/table.less +1 -1
- package/lib/Textarea/Textarea.js +45 -13
- package/lib/Textarea/index.d.ts +34 -0
- package/lib/Textarea/index.js +15 -1
- package/lib/hoc/inputBorder.js +2 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -2
- package/lib/styles/themes/base.less +10 -0
- package/lib/styles/themes/shineout.less +1 -1
- package/lib/utils/cleanProps.js +1 -1
- package/package.json +1 -1
package/css/Button/Button.js
CHANGED
|
@@ -55,6 +55,10 @@ var _locale = require("../locale");
|
|
|
55
55
|
|
|
56
56
|
var _config = require("../config");
|
|
57
57
|
|
|
58
|
+
var _InputTitle = _interopRequireDefault(require("../InputTitle"));
|
|
59
|
+
|
|
60
|
+
var _styles3 = require("../InputTitle/styles");
|
|
61
|
+
|
|
58
62
|
var FadeList = (0, _AnimationList.default)(['fade'], 'fast');
|
|
59
63
|
var OptionList = (0, _AbsoluteList.default)(function (_ref) {
|
|
60
64
|
var focus = _ref.focus,
|
|
@@ -324,14 +328,15 @@ function (_PureComponent) {
|
|
|
324
328
|
}
|
|
325
329
|
};
|
|
326
330
|
|
|
327
|
-
_proto.handleTextChange = function handleTextChange(date, index) {
|
|
331
|
+
_proto.handleTextChange = function handleTextChange(date, index, e) {
|
|
328
332
|
var _this4 = this;
|
|
329
333
|
|
|
330
334
|
var format = this.getFormat();
|
|
331
335
|
var val = date ? _utils.default.format(date, format) : '';
|
|
332
336
|
|
|
333
337
|
if (!this.props.range) {
|
|
334
|
-
|
|
338
|
+
var close = !(e && e.target && this.element.contains(e.target));
|
|
339
|
+
this.props.onChange(val, close ? this.triggerValueBlur.bind(this, this.handleBlur) : undefined);
|
|
335
340
|
return;
|
|
336
341
|
}
|
|
337
342
|
|
|
@@ -416,7 +421,7 @@ function (_PureComponent) {
|
|
|
416
421
|
var className = (0, _classnames.default)((0, _styles.datepickerClass)('txt', this.state["picker" + key] && 'text-focus'), _utils.default.isInvalid(date) && (0, _styles2.inputClass)('placeholder'));
|
|
417
422
|
var resultFormat = formatResult || this.getFormat();
|
|
418
423
|
return _react.default.createElement(_Text.default, {
|
|
419
|
-
key: key,
|
|
424
|
+
key: key || 'single',
|
|
420
425
|
onTextSpanRef: this.bindTextSpan,
|
|
421
426
|
focusElement: this.textSpan,
|
|
422
427
|
className: className,
|
|
@@ -433,22 +438,36 @@ function (_PureComponent) {
|
|
|
433
438
|
};
|
|
434
439
|
|
|
435
440
|
_proto.renderResult = function renderResult() {
|
|
441
|
+
var _this6 = this;
|
|
442
|
+
|
|
436
443
|
var _this$props4 = this.props,
|
|
437
444
|
disabled = _this$props4.disabled,
|
|
438
445
|
range = _this$props4.range,
|
|
439
446
|
placeholder = _this$props4.placeholder,
|
|
440
|
-
type = _this$props4.type
|
|
447
|
+
type = _this$props4.type,
|
|
448
|
+
innerTitle = _this$props4.innerTitle,
|
|
449
|
+
inputable = _this$props4.inputable;
|
|
441
450
|
var value = this.props.value;
|
|
442
|
-
if (!value && range) value = [];
|
|
443
|
-
|
|
451
|
+
if (!value && range) value = []; // const isEmpty = !value || value.length === 0
|
|
452
|
+
|
|
444
453
|
var clearable = this.props.clearable;
|
|
445
454
|
if (disabled === true) clearable = false;
|
|
455
|
+
var isEmpty = (range ? value : [value]).reduce(function (result, str) {
|
|
456
|
+
var date = _this6.parseDate(str);
|
|
457
|
+
|
|
458
|
+
return result && _utils.default.isInvalid(date);
|
|
459
|
+
}, true);
|
|
446
460
|
return _react.default.createElement("div", {
|
|
447
461
|
className: (0, _styles.datepickerClass)('result')
|
|
462
|
+
}, _react.default.createElement(_InputTitle.default, {
|
|
463
|
+
className: (0, _styles.datepickerClass)('title-box'),
|
|
464
|
+
contentClass: (0, _styles3.inputTitleClass)('hidable'),
|
|
465
|
+
innerTitle: innerTitle,
|
|
466
|
+
open: !isEmpty || inputable && this.state.focus
|
|
448
467
|
}, range ? [this.renderText(value[0], placeholder[0], 0), _react.default.createElement("span", {
|
|
449
468
|
key: "-",
|
|
450
469
|
className: (0, _styles.datepickerClass)('separate')
|
|
451
|
-
}, "~"), this.renderText(value[1], placeholder[1], 1)] : this.renderText(value, placeholder), _react.default.createElement(_Icon.default, {
|
|
470
|
+
}, "~"), this.renderText(value[1], placeholder[1], 1)] : this.renderText(value, placeholder)), _react.default.createElement(_Icon.default, {
|
|
452
471
|
className: isEmpty || !clearable ? '' : 'indecator',
|
|
453
472
|
name: type === 'time' ? 'Clock' : 'Calendar'
|
|
454
473
|
}), !isEmpty && clearable && _react.default.createElement(_Icon.default, {
|
|
@@ -488,7 +507,7 @@ function (_PureComponent) {
|
|
|
488
507
|
};
|
|
489
508
|
|
|
490
509
|
_proto.renderPicker = function renderPicker() {
|
|
491
|
-
var
|
|
510
|
+
var _this7 = this;
|
|
492
511
|
|
|
493
512
|
if (!this.firstRender) return undefined;
|
|
494
513
|
var _this$props6 = this.props,
|
|
@@ -517,7 +536,7 @@ function (_PureComponent) {
|
|
|
517
536
|
range: range,
|
|
518
537
|
quicks: quicks,
|
|
519
538
|
value: range ? (value || []).map(function (v) {
|
|
520
|
-
return
|
|
539
|
+
return _this7.parseDate(v);
|
|
521
540
|
}) : this.parseDate(value),
|
|
522
541
|
showTimePicker: !!value,
|
|
523
542
|
allowSingle: allowSingle,
|
|
@@ -536,10 +555,11 @@ function (_PureComponent) {
|
|
|
536
555
|
range = _this$props7.range,
|
|
537
556
|
size = _this$props7.size,
|
|
538
557
|
disabled = _this$props7.disabled,
|
|
539
|
-
align = _this$props7.align
|
|
558
|
+
align = _this$props7.align,
|
|
559
|
+
innerTitle = _this$props7.innerTitle;
|
|
540
560
|
var focus = this.state.focus;
|
|
541
561
|
var rtl = (0, _config.isRTL)();
|
|
542
|
-
var className = (0, _styles.datepickerClass)('inner', range && 'range', size && "size-" + size, focus && 'focus', disabled === true && 'disabled', align && "align-" + align, getCurrentPosition(this.state.position), rtl && 'rtl');
|
|
562
|
+
var className = (0, _styles.datepickerClass)('inner', range && 'range', size && "size-" + size, focus && 'focus', disabled === true && 'disabled', align && "align-" + align, getCurrentPosition(this.state.position), rtl && 'rtl', innerTitle && 'inner-title');
|
|
543
563
|
return _react.default.createElement("div", {
|
|
544
564
|
// eslint-disable-next-line
|
|
545
565
|
tabIndex: disabled === true ? -1 : 0,
|
|
@@ -587,7 +607,8 @@ Container.propTypes = {
|
|
|
587
607
|
onPickerChange: _propTypes.default.func,
|
|
588
608
|
disabledTime: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.func]),
|
|
589
609
|
align: _propTypes.default.oneOf(['left', 'right', 'center']),
|
|
590
|
-
clearWithUndefined: _propTypes.default.bool
|
|
610
|
+
clearWithUndefined: _propTypes.default.bool,
|
|
611
|
+
innerTitle: _propTypes.default.string
|
|
591
612
|
};
|
|
592
613
|
Container.defaultProps = {
|
|
593
614
|
clearable: true,
|
package/css/DatePicker/Text.js
CHANGED
|
@@ -46,7 +46,7 @@ function (_PureComponent) {
|
|
|
46
46
|
var _proto = Text.prototype;
|
|
47
47
|
|
|
48
48
|
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
49
|
-
if (prevProps.focus !== this.props.focus && this.props.focus && this.element && this.props.focusElement === this.element) {
|
|
49
|
+
if (prevProps.focus !== this.props.focus && this.props.focus && this.element && (this.props.focusElement === this.element || !this.props.focusElement)) {
|
|
50
50
|
_element.focusElement.end(this.element);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
@@ -68,7 +68,7 @@ function (_PureComponent) {
|
|
|
68
68
|
if (txt === value) return;
|
|
69
69
|
|
|
70
70
|
if (txt.trim().length === 0) {
|
|
71
|
-
onChange(undefined, index);
|
|
71
|
+
onChange(undefined, index, e);
|
|
72
72
|
} else {
|
|
73
73
|
var newValue = _utils.default.toDateWithFormat(txt, format, undefined); // if translate fail, clear
|
|
74
74
|
|
|
@@ -77,7 +77,7 @@ function (_PureComponent) {
|
|
|
77
77
|
this.element.innerText = null;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
onChange(newValue, index);
|
|
80
|
+
onChange(newValue, index, e);
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
|
|
@@ -251,6 +251,15 @@ FormItemStandardProps<T>,
|
|
|
251
251
|
* default: none
|
|
252
252
|
*/
|
|
253
253
|
onPickerChange?: (value: DatePickerValue, quickSelect: QuickSelect | void, areaType: AreaType) => void;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* inner title
|
|
257
|
+
*
|
|
258
|
+
* 内嵌标题
|
|
259
|
+
*
|
|
260
|
+
* default: -
|
|
261
|
+
*/
|
|
262
|
+
innerTitle?: string;
|
|
254
263
|
}
|
|
255
264
|
|
|
256
265
|
declare class DatePicker extends React.Component<DatePickerProps, {}> {
|
|
@@ -26,6 +26,15 @@ label.so-datepicker-r-time {
|
|
|
26
26
|
padding: 0 0 8px 0;
|
|
27
27
|
text-align: center;
|
|
28
28
|
}
|
|
29
|
+
.so-datepicker-title-box > .so-input-title-box-content {
|
|
30
|
+
display: -webkit-box;
|
|
31
|
+
display: -ms-flexbox;
|
|
32
|
+
display: flex;
|
|
33
|
+
}
|
|
34
|
+
.so-datepicker-range .so-datepicker-title-box .so-datepicker-txt:not(.so-datepicker-text-focus) {
|
|
35
|
+
background: var(--primary-color-fade-10, rgba(51, 153, 255, 0.1));
|
|
36
|
+
border-radius: 50px;
|
|
37
|
+
}
|
|
29
38
|
.so-datepicker-inner {
|
|
30
39
|
width: 100%;
|
|
31
40
|
padding: 6px 24px 6px 12px;
|
|
@@ -38,6 +47,15 @@ label.so-datepicker-r-time {
|
|
|
38
47
|
.so-datepicker-size-large.so-datepicker-inner {
|
|
39
48
|
padding: 8px 28px 8px 16px;
|
|
40
49
|
}
|
|
50
|
+
.so-datepicker-inner-title {
|
|
51
|
+
padding: 4px 20px 4px 8px;
|
|
52
|
+
}
|
|
53
|
+
.so-datepicker-size-small.so-datepicker-inner-title {
|
|
54
|
+
padding: 2px 20px 2px 8px;
|
|
55
|
+
}
|
|
56
|
+
.so-datepicker-size-large.so-datepicker-inner-title {
|
|
57
|
+
padding: 4px 20px 4px 8px;
|
|
58
|
+
}
|
|
41
59
|
.so-datepicker-result {
|
|
42
60
|
position: relative;
|
|
43
61
|
display: -webkit-box;
|
|
@@ -86,7 +104,7 @@ label.so-datepicker-r-time {
|
|
|
86
104
|
.so-datepicker-separate {
|
|
87
105
|
margin: 0 8px;
|
|
88
106
|
}
|
|
89
|
-
.so-datepicker-text-focus {
|
|
107
|
+
.so-datepicker-txt.so-datepicker-text-focus {
|
|
90
108
|
background: var(--primary-color, #3399ff);
|
|
91
109
|
color: #fff;
|
|
92
110
|
border-radius: 50px;
|
|
@@ -492,6 +510,15 @@ label.so-datepicker-r-time {
|
|
|
492
510
|
margin-right: 0;
|
|
493
511
|
margin-left: -16px;
|
|
494
512
|
}
|
|
513
|
+
.so-datepicker-rtl.so-datepicker-inner-title {
|
|
514
|
+
padding: 4px 8px 4px 20px;
|
|
515
|
+
}
|
|
516
|
+
.so-datepicker-rtl.so-datepicker-size-small.so-datepicker-inner-title {
|
|
517
|
+
padding: 2px 8px 2px 20px;
|
|
518
|
+
}
|
|
519
|
+
.so-datepicker-rtl.so-datepicker-size-large.so-datepicker-inner-title {
|
|
520
|
+
padding: 4px 8px 4px 20px;
|
|
521
|
+
}
|
|
495
522
|
.so-datepicker-rtl .so-datepicker-picker .so-datepicker-header .so-datepicker-left,
|
|
496
523
|
.so-datepicker-rtl .so-datepicker-picker .so-datepicker-header .so-datepicker-right {
|
|
497
524
|
-webkit-transform: rotate(180deg);
|
|
@@ -5,6 +5,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
8
10
|
var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
|
|
9
11
|
|
|
10
12
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
@@ -27,6 +29,14 @@ var _icons = _interopRequireDefault(require("../icons"));
|
|
|
27
29
|
|
|
28
30
|
var _element = require("../utils/dom/element");
|
|
29
31
|
|
|
32
|
+
var _styles2 = require("../Input/styles");
|
|
33
|
+
|
|
34
|
+
var _InputTitle = _interopRequireDefault(require("../InputTitle"));
|
|
35
|
+
|
|
36
|
+
var _styles3 = require("../InputTitle/styles");
|
|
37
|
+
|
|
38
|
+
var noop = function noop() {};
|
|
39
|
+
|
|
30
40
|
function formatShowValue(value) {
|
|
31
41
|
if (!value && value !== 0) return '';
|
|
32
42
|
var arr = String(value).split('\n');
|
|
@@ -50,6 +60,7 @@ function (_React$PureComponent) {
|
|
|
50
60
|
_this.bindContainer = _this.bindElement.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), 'container');
|
|
51
61
|
_this.bindInput = _this.bindElement.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), 'input');
|
|
52
62
|
_this.renderInput = _this.renderInput.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
63
|
+
_this.renderPlace = _this.renderPlace.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
53
64
|
_this.renderTextarea = _this.renderTextarea.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
54
65
|
_this.onChange = _this.onChange.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
55
66
|
_this.onBlur = _this.onBlur.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
|
|
@@ -82,6 +93,12 @@ function (_React$PureComponent) {
|
|
|
82
93
|
if (typeof onBlur === 'function') onBlur(e);
|
|
83
94
|
};
|
|
84
95
|
|
|
96
|
+
_proto.getErrorProps = function getErrorProps() {
|
|
97
|
+
var p = {};
|
|
98
|
+
if ('error' in this.props) p.error = this.props.error;
|
|
99
|
+
return p;
|
|
100
|
+
};
|
|
101
|
+
|
|
85
102
|
_proto.updateShowTextarea = function updateShowTextarea(flag) {
|
|
86
103
|
if (flag && this.input) {
|
|
87
104
|
this.width = (0, _element.getParent)(this.input, "." + (0, _styles.editableAreaClass)('input')).offsetWidth;
|
|
@@ -90,6 +107,10 @@ function (_React$PureComponent) {
|
|
|
90
107
|
this.setState({
|
|
91
108
|
showTextarea: flag
|
|
92
109
|
});
|
|
110
|
+
|
|
111
|
+
if (this.props.onShowTextareaChange) {
|
|
112
|
+
this.props.onShowTextareaChange(flag);
|
|
113
|
+
}
|
|
93
114
|
};
|
|
94
115
|
|
|
95
116
|
_proto.handleFocus = function handleFocus(e) {
|
|
@@ -110,52 +131,98 @@ function (_React$PureComponent) {
|
|
|
110
131
|
_proto.renderTextarea = function renderTextarea() {
|
|
111
132
|
var showTextarea = this.state.showTextarea;
|
|
112
133
|
var _this$props = this.props,
|
|
113
|
-
delay = _this$props.delay,
|
|
114
134
|
placeholder = _this$props.placeholder,
|
|
115
135
|
maxHeight = _this$props.maxHeight,
|
|
116
|
-
value = _this$props.value
|
|
136
|
+
value = _this$props.value,
|
|
137
|
+
innerTitle = _this$props.innerTitle,
|
|
138
|
+
placeTitle = _this$props.placeTitle,
|
|
139
|
+
renderFooter = _this$props.renderFooter;
|
|
117
140
|
if (!showTextarea) return null;
|
|
118
141
|
return _react.default.createElement("div", {
|
|
119
142
|
ref: this.bindContainer
|
|
120
|
-
}, _react.default.createElement(_Textarea.default, {
|
|
143
|
+
}, _react.default.createElement(_Textarea.default, (0, _extends2.default)({
|
|
121
144
|
className: (0, _styles.editableAreaClass)('text-area'),
|
|
122
145
|
autosize: true,
|
|
146
|
+
innerTitle: innerTitle,
|
|
147
|
+
placeTitle: placeTitle,
|
|
123
148
|
value: value,
|
|
124
149
|
rows: 1,
|
|
125
|
-
delay:
|
|
150
|
+
delay: 0,
|
|
126
151
|
onChange: this.onChange,
|
|
127
152
|
onBlur: this.onBlur,
|
|
128
153
|
onFocus: this.handleFocus,
|
|
129
154
|
placeholder: placeholder,
|
|
130
|
-
maxHeight: maxHeight
|
|
131
|
-
|
|
155
|
+
maxHeight: maxHeight,
|
|
156
|
+
renderFooter: renderFooter
|
|
157
|
+
}, this.getErrorProps())));
|
|
132
158
|
};
|
|
133
159
|
|
|
134
|
-
_proto.
|
|
160
|
+
_proto.renderResult = function renderResult() {
|
|
135
161
|
var _this$props2 = this.props,
|
|
136
162
|
placeholder = _this$props2.placeholder,
|
|
137
163
|
disabled = _this$props2.disabled,
|
|
138
|
-
value = _this$props2.value
|
|
139
|
-
|
|
164
|
+
value = _this$props2.value,
|
|
165
|
+
renderResult = _this$props2.renderResult,
|
|
166
|
+
placeTitle = _this$props2.placeTitle,
|
|
167
|
+
innerTitle = _this$props2.innerTitle,
|
|
168
|
+
error = _this$props2.error;
|
|
169
|
+
var result = renderResult(value);
|
|
170
|
+
return _react.default.createElement("div", {
|
|
171
|
+
tabIndex: disabled ? -1 : 0,
|
|
172
|
+
className: (0, _classnames.default)((0, _styles.editableAreaClass)('input'), (0, _styles2.inputClass)('_', error && 'invalid')),
|
|
173
|
+
onFocus: this.showPop
|
|
174
|
+
}, _react.default.createElement(_InputTitle.default, {
|
|
175
|
+
placeTitle: placeTitle,
|
|
176
|
+
innerTitle: innerTitle,
|
|
177
|
+
open: !!value
|
|
178
|
+
}, _react.default.createElement("div", {
|
|
179
|
+
className: (0, _classnames.default)((0, _styles2.inputClass)('spare'), innerTitle && (0, _styles3.inputTitleClass)('hidable')),
|
|
180
|
+
ref: this.bindInput
|
|
181
|
+
}, result || _react.default.createElement("div", {
|
|
182
|
+
className: (0, _styles2.inputClass)('placeholder')
|
|
183
|
+
}, placeholder || _react.default.createElement("br", null)))));
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
_proto.renderInput = function renderInput() {
|
|
187
|
+
var _this$props3 = this.props,
|
|
188
|
+
placeholder = _this$props3.placeholder,
|
|
189
|
+
disabled = _this$props3.disabled,
|
|
190
|
+
value = _this$props3.value,
|
|
191
|
+
innerTitle = _this$props3.innerTitle,
|
|
192
|
+
placeTitle = _this$props3.placeTitle;
|
|
193
|
+
return _react.default.createElement(_Input.default, (0, _extends2.default)({
|
|
194
|
+
innerTitle: innerTitle,
|
|
195
|
+
placeTitle: placeTitle,
|
|
140
196
|
forwardedRef: this.bindInput,
|
|
141
197
|
placeholder: placeholder,
|
|
142
198
|
value: formatShowValue(value),
|
|
199
|
+
onChange: noop,
|
|
143
200
|
className: (0, _styles.editableAreaClass)('input'),
|
|
144
201
|
onFocus: this.showPop,
|
|
145
202
|
disabled: disabled
|
|
146
|
-
});
|
|
203
|
+
}, this.getErrorProps()));
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
_proto.renderPlace = function renderPlace() {
|
|
207
|
+
var renderResult = this.props.renderResult;
|
|
208
|
+
|
|
209
|
+
if (renderResult && typeof renderResult === 'function') {
|
|
210
|
+
return this.renderResult();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return this.renderInput();
|
|
147
214
|
};
|
|
148
215
|
|
|
149
216
|
_proto.render = function render() {
|
|
150
217
|
var showTextarea = this.state.showTextarea;
|
|
151
|
-
var _this$
|
|
152
|
-
width = _this$
|
|
153
|
-
style = _this$
|
|
154
|
-
className = _this$
|
|
155
|
-
bordered = _this$
|
|
156
|
-
clearable = _this$
|
|
157
|
-
getPopupContainer = _this$
|
|
158
|
-
value = _this$
|
|
218
|
+
var _this$props4 = this.props,
|
|
219
|
+
width = _this$props4.width,
|
|
220
|
+
style = _this$props4.style,
|
|
221
|
+
className = _this$props4.className,
|
|
222
|
+
bordered = _this$props4.bordered,
|
|
223
|
+
clearable = _this$props4.clearable,
|
|
224
|
+
getPopupContainer = _this$props4.getPopupContainer,
|
|
225
|
+
value = _this$props4.value;
|
|
159
226
|
var cls = (0, _classnames.default)(className, (0, _styles.editableAreaClass)('_', !bordered && 'none-bordered'));
|
|
160
227
|
var ms = Object.assign({
|
|
161
228
|
width: width
|
|
@@ -166,7 +233,7 @@ function (_React$PureComponent) {
|
|
|
166
233
|
return _react.default.createElement("div", {
|
|
167
234
|
className: cls,
|
|
168
235
|
style: ms
|
|
169
|
-
}, this.
|
|
236
|
+
}, this.renderPlace(), _react.default.createElement(_Popover.default, {
|
|
170
237
|
visible: showTextarea,
|
|
171
238
|
showArrow: false,
|
|
172
239
|
className: (0, _styles.editableAreaClass)('popover'),
|
|
@@ -191,7 +258,6 @@ Editable.propTypes = {
|
|
|
191
258
|
value: _propTypes.default.string,
|
|
192
259
|
style: _propTypes.default.object,
|
|
193
260
|
className: _propTypes.default.string,
|
|
194
|
-
delay: _propTypes.default.number,
|
|
195
261
|
bordered: _propTypes.default.bool,
|
|
196
262
|
placeholder: _propTypes.default.string,
|
|
197
263
|
onFocus: _propTypes.default.func,
|
|
@@ -199,7 +265,13 @@ Editable.propTypes = {
|
|
|
199
265
|
clearable: _propTypes.default.bool,
|
|
200
266
|
getPopupContainer: _propTypes.default.func,
|
|
201
267
|
maxHeight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
202
|
-
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
268
|
+
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
269
|
+
innerTitle: _propTypes.default.node,
|
|
270
|
+
placeTitle: _propTypes.default.node,
|
|
271
|
+
renderFooter: _propTypes.default.func,
|
|
272
|
+
renderResult: _propTypes.default.func,
|
|
273
|
+
onShowTextareaChange: _propTypes.default.func,
|
|
274
|
+
error: _propTypes.default.object
|
|
203
275
|
};
|
|
204
276
|
var _default = Editable;
|
|
205
277
|
exports.default = _default;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React, { ReactNode } from "react"
|
|
2
2
|
import {StandardProps, FormItemStandardProps} from '../@types/common'
|
|
3
3
|
|
|
4
4
|
export interface EditableAreaProps extends StandardProps, FormItemStandardProps<string> {
|
|
@@ -92,6 +92,42 @@ export interface EditableAreaProps extends StandardProps, FormItemStandardProps<
|
|
|
92
92
|
* default: none
|
|
93
93
|
*/
|
|
94
94
|
width?: number | string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* inner title
|
|
98
|
+
*
|
|
99
|
+
* 内嵌标题
|
|
100
|
+
*
|
|
101
|
+
* default: -
|
|
102
|
+
*/
|
|
103
|
+
innerTitle?: ReactNode,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Placeholder title, which needs to be used together with innerTitle
|
|
107
|
+
*
|
|
108
|
+
* 占位标题,需要配合 innerTitle 一起使用
|
|
109
|
+
*
|
|
110
|
+
* default: -
|
|
111
|
+
*/
|
|
112
|
+
placeTitle?: ReactNode,
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* render textarea footer
|
|
116
|
+
*
|
|
117
|
+
* 渲染 textarea footer
|
|
118
|
+
*
|
|
119
|
+
* default: -
|
|
120
|
+
*/
|
|
121
|
+
renderFooter?: (value: string)=> ReactNode,
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Customize display results
|
|
125
|
+
*
|
|
126
|
+
* 自定义显示结果
|
|
127
|
+
*
|
|
128
|
+
* default: -
|
|
129
|
+
*/
|
|
130
|
+
renderResult?: (value: string)=> ReactNode,
|
|
95
131
|
}
|
|
96
132
|
|
|
97
133
|
declare class EditableArea extends React.PureComponent<EditableAreaProps, any>{}
|
package/css/Form/styles/form.css
CHANGED
|
@@ -594,7 +594,8 @@
|
|
|
594
594
|
overflow: hidden;
|
|
595
595
|
}
|
|
596
596
|
.so-input input,
|
|
597
|
-
.so-input textarea
|
|
597
|
+
.so-input textarea,
|
|
598
|
+
.so-input-spare {
|
|
598
599
|
display: block;
|
|
599
600
|
width: 100%;
|
|
600
601
|
padding: 6px 12px;
|
|
@@ -642,12 +643,32 @@
|
|
|
642
643
|
line-height: var(--common-line-height, 1.42857143);
|
|
643
644
|
resize: none;
|
|
644
645
|
}
|
|
645
|
-
.so-input input.so-input-number {
|
|
646
|
+
.so-input input.so-input-number:not(.so-input-rtl *) {
|
|
647
|
+
padding-right: 22px;
|
|
648
|
+
}
|
|
649
|
+
.so-input input.so-input-number + .so-input-clear-wrapper .so-input-clear:not(.so-input-rtl *) {
|
|
650
|
+
right: 22px;
|
|
651
|
+
}
|
|
652
|
+
.so-input-rtl input.so-input-number {
|
|
653
|
+
padding-left: 22px;
|
|
654
|
+
}
|
|
655
|
+
.so-input-rtl input.so-input-number + .so-input-clear-wrapper .so-input-clear {
|
|
656
|
+
left: 22px;
|
|
657
|
+
right: auto;
|
|
658
|
+
}
|
|
659
|
+
.so-input:not(.so-input-rtl) .so-input-number-title-box .so-input-title-box-title {
|
|
646
660
|
padding-right: 22px;
|
|
647
661
|
}
|
|
648
|
-
.so-input
|
|
662
|
+
.so-input-rtl .so-input-number-title-box .so-input-title-box-title {
|
|
663
|
+
padding-left: 22px;
|
|
664
|
+
}
|
|
665
|
+
.so-input:not(.so-input-rtl) .so-input-number-title-box + .so-input-clear-wrapper .so-input-clear {
|
|
649
666
|
right: 22px;
|
|
650
667
|
}
|
|
668
|
+
.so-input-rtl .so-input-number-title-box + .so-input-clear-wrapper .so-input-clear {
|
|
669
|
+
left: 22px;
|
|
670
|
+
right: auto;
|
|
671
|
+
}
|
|
651
672
|
textarea.so-input-shadow {
|
|
652
673
|
position: absolute;
|
|
653
674
|
z-index: 0;
|
|
@@ -661,19 +682,55 @@ textarea.so-input-auto-size {
|
|
|
661
682
|
textarea.so-input-textarea-resize {
|
|
662
683
|
resize: vertical;
|
|
663
684
|
}
|
|
685
|
+
.so-input-with-footer {
|
|
686
|
+
-webkit-box-orient: vertical;
|
|
687
|
+
-webkit-box-direction: normal;
|
|
688
|
+
-ms-flex-direction: column;
|
|
689
|
+
flex-direction: column;
|
|
690
|
+
}
|
|
691
|
+
.so-input-with-footer .so-input-footer {
|
|
692
|
+
padding: 12px 6px;
|
|
693
|
+
border-top: 1px solid var(--input-border-color, #ced4da);
|
|
694
|
+
}
|
|
664
695
|
.so-input-small {
|
|
665
696
|
font-size: var(--font-size-small, 12px);
|
|
666
697
|
line-height: 1.5;
|
|
667
698
|
}
|
|
668
|
-
.so-input-small input
|
|
699
|
+
.so-input-small input,
|
|
700
|
+
.so-input-small .so-input-spare {
|
|
669
701
|
padding: 5px 10px;
|
|
670
702
|
}
|
|
703
|
+
.so-input-small ::-webkit-input-placeholder,
|
|
704
|
+
.so-input-small .so-input-placeholder {
|
|
705
|
+
font-size: var(--font-size-small, 12px);
|
|
706
|
+
}
|
|
707
|
+
.so-input-small ::-ms-input-placeholder,
|
|
708
|
+
.so-input-small .so-input-placeholder {
|
|
709
|
+
font-size: var(--font-size-small, 12px);
|
|
710
|
+
}
|
|
711
|
+
.so-input-small ::placeholder,
|
|
712
|
+
.so-input-small .so-input-placeholder {
|
|
713
|
+
font-size: var(--font-size-small, 12px);
|
|
714
|
+
}
|
|
671
715
|
.so-input-large {
|
|
672
716
|
font-size: var(--font-size-large, 18px);
|
|
673
717
|
}
|
|
674
|
-
.so-input-large input
|
|
718
|
+
.so-input-large input,
|
|
719
|
+
.so-input-large .so-input-spare {
|
|
675
720
|
padding: 8px 12px;
|
|
676
721
|
}
|
|
722
|
+
.so-input-large ::-webkit-input-placeholder,
|
|
723
|
+
.so-input-large .so-input-placeholder {
|
|
724
|
+
font-size: var(--font-size-large, 18px);
|
|
725
|
+
}
|
|
726
|
+
.so-input-large ::-ms-input-placeholder,
|
|
727
|
+
.so-input-large .so-input-placeholder {
|
|
728
|
+
font-size: var(--font-size-large, 18px);
|
|
729
|
+
}
|
|
730
|
+
.so-input-large ::placeholder,
|
|
731
|
+
.so-input-large .so-input-placeholder {
|
|
732
|
+
font-size: var(--font-size-large, 18px);
|
|
733
|
+
}
|
|
677
734
|
.so-input.so-input-rtl {
|
|
678
735
|
direction: rtl;
|
|
679
736
|
}
|
package/css/Input/Group.js
CHANGED
|
@@ -16,7 +16,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
16
16
|
function Group(props) {
|
|
17
17
|
var children = props.children,
|
|
18
18
|
style = props.style,
|
|
19
|
-
|
|
19
|
+
inputFocus = props.inputFocus,
|
|
20
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, ["children", "style", "inputFocus"]);
|
|
20
21
|
return _react.Children.toArray(children).map(function (child, i) {
|
|
21
22
|
if (typeof child === 'string') {
|
|
22
23
|
return _react.default.createElement("span", {
|
package/css/Input/Input.js
CHANGED
|
@@ -23,11 +23,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
23
23
|
|
|
24
24
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
25
|
|
|
26
|
+
var _styles = require("../InputTitle/styles");
|
|
27
|
+
|
|
26
28
|
var _cleanProps = _interopRequireDefault(require("../utils/cleanProps"));
|
|
27
29
|
|
|
28
30
|
var _clear = _interopRequireDefault(require("./clear"));
|
|
29
31
|
|
|
30
|
-
var
|
|
32
|
+
var _styles2 = require("./styles");
|
|
33
|
+
|
|
34
|
+
var _InputTitle = _interopRequireDefault(require("../InputTitle"));
|
|
31
35
|
|
|
32
36
|
var Input =
|
|
33
37
|
/*#__PURE__*/
|
|
@@ -155,7 +159,7 @@ function (_PureComponent) {
|
|
|
155
159
|
style: {
|
|
156
160
|
minWidth: 'auto'
|
|
157
161
|
},
|
|
158
|
-
className: (0,
|
|
162
|
+
className: (0, _styles2.inputClass)('bottom-right', isError ? 'error' : 'tip')
|
|
159
163
|
}, text);
|
|
160
164
|
};
|
|
161
165
|
|
|
@@ -170,11 +174,19 @@ function (_PureComponent) {
|
|
|
170
174
|
forceChange = _this$props5.forceChange,
|
|
171
175
|
onEnterPress = _this$props5.onEnterPress,
|
|
172
176
|
forwardedRef = _this$props5.forwardedRef,
|
|
173
|
-
|
|
177
|
+
innerTitle = _this$props5.innerTitle,
|
|
178
|
+
inputFocus = _this$props5.inputFocus,
|
|
179
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_this$props5, ["type", "defaultValue", "digits", "className", "clearable", "htmlName", "forceChange", "onEnterPress", "forwardedRef", "innerTitle", "inputFocus"]);
|
|
174
180
|
var value = this.props.value == null ? '' : this.props.value;
|
|
175
181
|
var showClear = !other.disabled && clearable && value !== '';
|
|
176
|
-
var mc = (0, _classnames.default)(className, showClear && (0,
|
|
177
|
-
|
|
182
|
+
var mc = (0, _classnames.default)(className, showClear && (0, _styles2.inputClass)('clearable'), innerTitle && (0, _styles.inputTitleClass)('hidable'));
|
|
183
|
+
var isNumber = className && className.indexOf((0, _styles2.inputClass)('number')) > -1;
|
|
184
|
+
return [_react.default.createElement(_InputTitle.default, {
|
|
185
|
+
className: isNumber ? (0, _styles2.inputClass)('number-title-box') : undefined,
|
|
186
|
+
key: "input",
|
|
187
|
+
innerTitle: innerTitle,
|
|
188
|
+
open: !!inputFocus || !!value
|
|
189
|
+
}, _react.default.createElement("input", (0, _extends2.default)({}, (0, _cleanProps.default)(other), {
|
|
178
190
|
className: mc || undefined,
|
|
179
191
|
name: other.name || htmlName,
|
|
180
192
|
type: type === 'password' ? type : 'text',
|
|
@@ -185,7 +197,7 @@ function (_PureComponent) {
|
|
|
185
197
|
onKeyDown: this.handleKeyDown,
|
|
186
198
|
onKeyUp: this.handleKeyUp,
|
|
187
199
|
onBlur: this.handleBlur
|
|
188
|
-
})), showClear && _react.default.createElement(_clear.default, {
|
|
200
|
+
}))), showClear && _react.default.createElement(_clear.default, {
|
|
189
201
|
onClick: this.handleChange,
|
|
190
202
|
key: "close"
|
|
191
203
|
}), this.renderInfo()];
|
|
@@ -210,7 +222,9 @@ Input.propTypes = {
|
|
|
210
222
|
info: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.number]),
|
|
211
223
|
forwardedRef: _propTypes.default.func,
|
|
212
224
|
onKeyDown: _propTypes.default.func,
|
|
213
|
-
onKeyUp: _propTypes.default.func
|
|
225
|
+
onKeyUp: _propTypes.default.func,
|
|
226
|
+
innerTitle: _propTypes.default.string,
|
|
227
|
+
inputFocus: _propTypes.default.bool
|
|
214
228
|
};
|
|
215
229
|
Input.defaultProps = {
|
|
216
230
|
type: 'text'
|