shineout 1.8.2 → 1.9.0-rc.2

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 (114) hide show
  1. package/css/AnimationList/AbsoluteList.js +1 -1
  2. package/css/Button/Button.js +1 -1
  3. package/css/DatePicker/Container.js +33 -12
  4. package/css/DatePicker/Text.js +3 -3
  5. package/css/DatePicker/index.d.ts +9 -0
  6. package/css/DatePicker/styles/datepicker.css +28 -1
  7. package/css/EditableArea/EditableArea.js +79 -15
  8. package/css/EditableArea/index.d.ts +37 -1
  9. package/css/Form/styles/form.css +62 -5
  10. package/css/Input/Group.js +2 -1
  11. package/css/Input/Input.js +21 -7
  12. package/css/Input/index.d.ts +19 -0
  13. package/css/InputTitle/index.js +11 -0
  14. package/css/InputTitle/inputTitle.js +51 -0
  15. package/css/InputTitle/styles/index.js +13 -0
  16. package/css/InputTitle/styles/inputTitle.css +78 -0
  17. package/css/Menu/Item.js +9 -1
  18. package/css/Scroll/Scroll.js +31 -11
  19. package/css/Select/Result.js +21 -13
  20. package/css/Select/Select.js +6 -3
  21. package/css/Select/index.d.ts +9 -0
  22. package/css/Select/styles/select.css +227 -148
  23. package/css/Table/SeperateTable.js +5 -3
  24. package/css/Table/SimpleTable.js +13 -7
  25. package/css/Table/Table.js +3 -1
  26. package/css/Table/resizable.js +1 -1
  27. package/css/Table/styles/table.css +8 -8
  28. package/css/Textarea/Textarea.js +45 -13
  29. package/css/Textarea/index.d.ts +34 -0
  30. package/css/Textarea/index.js +15 -1
  31. package/css/hoc/inputBorder.js +2 -1
  32. package/css/index.d.ts +2 -1
  33. package/css/index.js +6 -2
  34. package/css/utils/cleanProps.js +1 -1
  35. package/dist/shineout.js +647 -232
  36. package/dist/shineout.js.map +1 -1
  37. package/dist/shineout.min.js +1 -1
  38. package/dist/theme.antd.css +1 -1
  39. package/dist/theme.antd2.css +1 -1
  40. package/dist/theme.default.css +1 -1
  41. package/dist/theme.shineout.css +1 -1
  42. package/es/AnimationList/AbsoluteList.js +1 -1
  43. package/es/Button/Button.js +1 -1
  44. package/es/DatePicker/Container.js +31 -12
  45. package/es/DatePicker/Text.js +3 -3
  46. package/es/DatePicker/index.d.ts +9 -0
  47. package/es/DatePicker/styles/datepicker.less +37 -1
  48. package/es/EditableArea/EditableArea.js +76 -15
  49. package/es/EditableArea/index.d.ts +37 -1
  50. package/es/Form/styles/form.less +60 -5
  51. package/es/Input/Group.js +2 -1
  52. package/es/Input/Input.js +17 -5
  53. package/es/Input/index.d.ts +19 -0
  54. package/es/InputTitle/index.js +2 -0
  55. package/es/InputTitle/inputTitle.js +40 -0
  56. package/es/InputTitle/styles/index.js +3 -0
  57. package/es/InputTitle/styles/inputTitle.less +84 -0
  58. package/es/Menu/Item.js +9 -1
  59. package/es/Scroll/Scroll.js +31 -11
  60. package/es/Select/Result.js +20 -13
  61. package/es/Select/Select.js +6 -3
  62. package/es/Select/index.d.ts +9 -0
  63. package/es/Select/styles/select.less +222 -144
  64. package/es/Table/SeperateTable.js +5 -3
  65. package/es/Table/SimpleTable.js +13 -7
  66. package/es/Table/Table.js +3 -1
  67. package/es/Table/resizable.js +1 -1
  68. package/es/Table/styles/table.less +1 -1
  69. package/es/Textarea/Textarea.js +42 -13
  70. package/es/Textarea/index.d.ts +34 -0
  71. package/es/Textarea/index.js +14 -1
  72. package/es/hoc/inputBorder.js +2 -1
  73. package/es/index.d.ts +2 -1
  74. package/es/index.js +2 -1
  75. package/es/styles/themes/base.less +10 -0
  76. package/es/styles/themes/shineout.less +1 -1
  77. package/es/utils/cleanProps.js +1 -1
  78. package/lib/AnimationList/AbsoluteList.js +1 -1
  79. package/lib/Button/Button.js +1 -1
  80. package/lib/DatePicker/Container.js +33 -12
  81. package/lib/DatePicker/Text.js +3 -3
  82. package/lib/DatePicker/index.d.ts +9 -0
  83. package/lib/DatePicker/styles/datepicker.less +37 -1
  84. package/lib/EditableArea/EditableArea.js +79 -15
  85. package/lib/EditableArea/index.d.ts +37 -1
  86. package/lib/Form/styles/form.less +60 -5
  87. package/lib/Input/Group.js +2 -1
  88. package/lib/Input/Input.js +21 -7
  89. package/lib/Input/index.d.ts +19 -0
  90. package/lib/InputTitle/index.js +11 -0
  91. package/lib/InputTitle/inputTitle.js +51 -0
  92. package/lib/InputTitle/styles/index.js +13 -0
  93. package/lib/InputTitle/styles/inputTitle.less +84 -0
  94. package/lib/Menu/Item.js +9 -1
  95. package/lib/Scroll/Scroll.js +31 -11
  96. package/lib/Select/Result.js +21 -13
  97. package/lib/Select/Select.js +6 -3
  98. package/lib/Select/index.d.ts +9 -0
  99. package/lib/Select/styles/select.less +222 -144
  100. package/lib/Table/SeperateTable.js +5 -3
  101. package/lib/Table/SimpleTable.js +13 -7
  102. package/lib/Table/Table.js +3 -1
  103. package/lib/Table/resizable.js +1 -1
  104. package/lib/Table/styles/table.less +1 -1
  105. package/lib/Textarea/Textarea.js +45 -13
  106. package/lib/Textarea/index.d.ts +34 -0
  107. package/lib/Textarea/index.js +15 -1
  108. package/lib/hoc/inputBorder.js +2 -1
  109. package/lib/index.d.ts +2 -1
  110. package/lib/index.js +6 -2
  111. package/lib/styles/themes/base.less +10 -0
  112. package/lib/styles/themes/shineout.less +1 -1
  113. package/lib/utils/cleanProps.js +1 -1
  114. package/package.json +1 -1
@@ -115,8 +115,8 @@ function _default(List) {
115
115
  _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
116
116
  var _this2 = this;
117
117
 
118
- if ((0, _shallowEqual.default)(prevProps.value, this.props.value)) return;
119
118
  if (!this.props.focus) this.ajustdoc = false;
119
+ if ((0, _shallowEqual.default)(prevProps.value, this.props.value)) return;
120
120
  setTimeout(function () {
121
121
  _this2.forceUpdate();
122
122
  });
@@ -83,7 +83,7 @@ function (_PureComponent) {
83
83
  disabled: disabled
84
84
  }), this.props.className);
85
85
 
86
- if (href) {
86
+ if (href && !disabled) {
87
87
  return _react.default.createElement("a", (0, _extends2.default)({
88
88
  href: href
89
89
  }, others, {
@@ -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
- this.props.onChange(val, this.triggerValueBlur.bind(this, this.handleBlur));
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
- var isEmpty = !value || value.length === 0;
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 _this6 = this;
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 _this6.parseDate(v);
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,
@@ -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);
@@ -27,6 +27,14 @@ var _icons = _interopRequireDefault(require("../icons"));
27
27
 
28
28
  var _element = require("../utils/dom/element");
29
29
 
30
+ var _styles2 = require("../Input/styles");
31
+
32
+ var _InputTitle = _interopRequireDefault(require("../InputTitle"));
33
+
34
+ var _styles3 = require("../InputTitle/styles");
35
+
36
+ var noop = function noop() {};
37
+
30
38
  function formatShowValue(value) {
31
39
  if (!value && value !== 0) return '';
32
40
  var arr = String(value).split('\n');
@@ -50,6 +58,7 @@ function (_React$PureComponent) {
50
58
  _this.bindContainer = _this.bindElement.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), 'container');
51
59
  _this.bindInput = _this.bindElement.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), 'input');
52
60
  _this.renderInput = _this.renderInput.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
61
+ _this.renderPlace = _this.renderPlace.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
53
62
  _this.renderTextarea = _this.renderTextarea.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
54
63
  _this.onChange = _this.onChange.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
55
64
  _this.onBlur = _this.onBlur.bind((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)));
@@ -90,6 +99,10 @@ function (_React$PureComponent) {
90
99
  this.setState({
91
100
  showTextarea: flag
92
101
  });
102
+
103
+ if (this.props.onShowTextareaChange) {
104
+ this.props.onShowTextareaChange(flag);
105
+ }
93
106
  };
94
107
 
95
108
  _proto.handleFocus = function handleFocus(e) {
@@ -113,49 +126,95 @@ function (_React$PureComponent) {
113
126
  delay = _this$props.delay,
114
127
  placeholder = _this$props.placeholder,
115
128
  maxHeight = _this$props.maxHeight,
116
- value = _this$props.value;
129
+ value = _this$props.value,
130
+ innerTitle = _this$props.innerTitle,
131
+ placeTitle = _this$props.placeTitle,
132
+ renderFooter = _this$props.renderFooter;
117
133
  if (!showTextarea) return null;
118
134
  return _react.default.createElement("div", {
119
135
  ref: this.bindContainer
120
136
  }, _react.default.createElement(_Textarea.default, {
121
137
  className: (0, _styles.editableAreaClass)('text-area'),
122
138
  autosize: true,
139
+ innerTitle: innerTitle,
140
+ placeTitle: placeTitle,
123
141
  value: value,
124
142
  rows: 1,
125
- delay: delay,
143
+ delay: 0,
126
144
  onChange: this.onChange,
127
145
  onBlur: this.onBlur,
128
146
  onFocus: this.handleFocus,
129
147
  placeholder: placeholder,
130
- maxHeight: maxHeight
148
+ maxHeight: maxHeight,
149
+ renderFooter: renderFooter
131
150
  }));
132
151
  };
133
152
 
134
- _proto.renderInput = function renderInput() {
153
+ _proto.renderResult = function renderResult() {
135
154
  var _this$props2 = this.props,
136
155
  placeholder = _this$props2.placeholder,
137
156
  disabled = _this$props2.disabled,
138
- value = _this$props2.value;
157
+ value = _this$props2.value,
158
+ renderResult = _this$props2.renderResult,
159
+ placeTitle = _this$props2.placeTitle,
160
+ innerTitle = _this$props2.innerTitle;
161
+ var result = renderResult(value);
162
+ return _react.default.createElement("div", {
163
+ tabIndex: disabled ? -1 : 0,
164
+ className: (0, _classnames.default)((0, _styles.editableAreaClass)('input'), (0, _styles2.inputClass)('_')),
165
+ onFocus: this.showPop
166
+ }, _react.default.createElement(_InputTitle.default, {
167
+ placeTitle: placeTitle,
168
+ innerTitle: innerTitle,
169
+ open: !!value
170
+ }, _react.default.createElement("div", {
171
+ className: (0, _classnames.default)((0, _styles2.inputClass)('spare'), (0, _styles3.inputTitleClass)('hidable')),
172
+ ref: this.bindInput
173
+ }, result || _react.default.createElement("div", {
174
+ className: (0, _styles2.inputClass)('placeholder')
175
+ }, placeholder || _react.default.createElement("br", null)))));
176
+ };
177
+
178
+ _proto.renderInput = function renderInput() {
179
+ var _this$props3 = this.props,
180
+ placeholder = _this$props3.placeholder,
181
+ disabled = _this$props3.disabled,
182
+ value = _this$props3.value,
183
+ innerTitle = _this$props3.innerTitle,
184
+ placeTitle = _this$props3.placeTitle;
139
185
  return _react.default.createElement(_Input.default, {
186
+ innerTitle: innerTitle,
187
+ placeTitle: placeTitle,
140
188
  forwardedRef: this.bindInput,
141
189
  placeholder: placeholder,
142
190
  value: formatShowValue(value),
191
+ onChange: noop,
143
192
  className: (0, _styles.editableAreaClass)('input'),
144
193
  onFocus: this.showPop,
145
194
  disabled: disabled
146
195
  });
147
196
  };
148
197
 
198
+ _proto.renderPlace = function renderPlace() {
199
+ var renderResult = this.props.renderResult;
200
+
201
+ if (renderResult && typeof renderResult === 'function') {
202
+ return this.renderResult();
203
+ }
204
+
205
+ return this.renderInput();
206
+ };
207
+
149
208
  _proto.render = function render() {
150
209
  var showTextarea = this.state.showTextarea;
151
- var _this$props3 = this.props,
152
- width = _this$props3.width,
153
- style = _this$props3.style,
154
- className = _this$props3.className,
155
- bordered = _this$props3.bordered,
156
- clearable = _this$props3.clearable,
157
- getPopupContainer = _this$props3.getPopupContainer,
158
- value = _this$props3.value;
210
+ var _this$props4 = this.props,
211
+ width = _this$props4.width,
212
+ style = _this$props4.style,
213
+ className = _this$props4.className,
214
+ bordered = _this$props4.bordered,
215
+ clearable = _this$props4.clearable,
216
+ getPopupContainer = _this$props4.getPopupContainer,
217
+ value = _this$props4.value;
159
218
  var cls = (0, _classnames.default)(className, (0, _styles.editableAreaClass)('_', !bordered && 'none-bordered'));
160
219
  var ms = Object.assign({
161
220
  width: width
@@ -166,7 +225,7 @@ function (_React$PureComponent) {
166
225
  return _react.default.createElement("div", {
167
226
  className: cls,
168
227
  style: ms
169
- }, this.renderInput(), _react.default.createElement(_Popover.default, {
228
+ }, this.renderPlace(), _react.default.createElement(_Popover.default, {
170
229
  visible: showTextarea,
171
230
  showArrow: false,
172
231
  className: (0, _styles.editableAreaClass)('popover'),
@@ -199,7 +258,12 @@ Editable.propTypes = {
199
258
  clearable: _propTypes.default.bool,
200
259
  getPopupContainer: _propTypes.default.func,
201
260
  maxHeight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
202
- width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
261
+ width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
262
+ innerTitle: _propTypes.default.node,
263
+ placeTitle: _propTypes.default.node,
264
+ renderFooter: _propTypes.default.func,
265
+ renderResult: _propTypes.default.func,
266
+ onShowTextareaChange: _propTypes.default.func
203
267
  };
204
268
  var _default = Editable;
205
269
  exports.default = _default;
@@ -1,4 +1,4 @@
1
- import React from 'react'
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>{}
@@ -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 input.so-input-number + .so-input-clear-wrapper .so-input-clear {
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
  }
@@ -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
- other = (0, _objectWithoutPropertiesLoose2.default)(props, ["children", "style"]);
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", {
@@ -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 _styles = require("./styles");
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, _styles.inputClass)('bottom-right', isError ? 'error' : 'tip')
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
- other = (0, _objectWithoutPropertiesLoose2.default)(_this$props5, ["type", "defaultValue", "digits", "className", "clearable", "htmlName", "forceChange", "onEnterPress", "forwardedRef"]);
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, _styles.inputClass)('clearable'));
177
- return [_react.default.createElement("input", (0, _extends2.default)({}, (0, _cleanProps.default)(other), {
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'
@@ -171,6 +171,25 @@ FormItemStandardProps<Value> {
171
171
  */
172
172
  underline?: boolean;
173
173
 
174
+ /**
175
+ * inner title
176
+ *
177
+ * 内嵌标题
178
+ *
179
+ * default: -
180
+ */
181
+ innerTitle?: string;
182
+
183
+
184
+ /**
185
+ * Placeholder title, which needs to be used together with innerTitle
186
+ *
187
+ * 占位标题,需要配合 innerTitle 一起使用
188
+ *
189
+ * default: -
190
+ */
191
+ placeTitle?: ReactNode,
192
+
174
193
  }
175
194
 
176
195
  export interface InputNumberProps <Value> extends InputProps<Value> {
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+
8
+ var _inputTitle = _interopRequireDefault(require("./inputTitle"));
9
+
10
+ var _default = _inputTitle.default;
11
+ exports.default = _default;