shineout 1.9.6 → 1.9.7

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.
@@ -103,21 +103,7 @@ function (_PureComponent) {
103
103
  };
104
104
 
105
105
  _proto.componentDidUpdate = function componentDidUpdate(preProps) {
106
- var _this$props = this.props,
107
- compressed = _this$props.compressed,
108
- _this$props$value = _this$props.value,
109
- value = _this$props$value === void 0 ? [] : _this$props$value,
110
- onFilter = _this$props.onFilter;
111
-
112
- if (compressed) {
113
- if ((preProps.value || []).join('') !== (value || []).join('')) {
114
- this.resetMore();
115
- } else if (value.length && this.shouldResetMore) {
116
- this.shouldResetMore = false;
117
- this.state.more = (0, _More.getResetMore)(onFilter, this.resultEl, this.resultEl.querySelectorAll("." + (0, _styles3.cascaderClass)('item')));
118
- this.forceUpdate();
119
- }
120
- }
106
+ this.updateMore(preProps);
121
107
  };
122
108
 
123
109
  _proto.componentWillUnmount = function componentWillUnmount() {
@@ -134,6 +120,27 @@ function (_PureComponent) {
134
120
  this.resultEl = el;
135
121
  };
136
122
 
123
+ _proto.updateMore = function updateMore(preProps) {
124
+ var _this$props = this.props,
125
+ compressed = _this$props.compressed,
126
+ _this$props$value = _this$props.value,
127
+ value = _this$props$value === void 0 ? [] : _this$props$value,
128
+ onFilter = _this$props.onFilter,
129
+ data = _this$props.data;
130
+
131
+ if (compressed) {
132
+ if ((preProps.value || []).join('') !== (value || []).join('')) {
133
+ this.resetMore();
134
+ } else if ((preProps.data || []).length !== (data || []).length) {
135
+ this.resetMore();
136
+ } else if (value.length && this.shouldResetMore) {
137
+ this.shouldResetMore = false;
138
+ this.state.more = (0, _More.getResetMore)(onFilter, this.resultEl, this.resultEl.querySelectorAll("." + (0, _styles3.cascaderClass)('item')));
139
+ this.forceUpdate();
140
+ }
141
+ }
142
+ };
143
+
137
144
  _proto.resetMore = function resetMore() {
138
145
  if (!this.props.compressed) return;
139
146
  this.shouldResetMore = true;
@@ -386,7 +393,8 @@ Result.propTypes = {
386
393
  selectId: _propTypes.default.string,
387
394
  showList: _propTypes.default.func,
388
395
  size: _propTypes.default.string,
389
- showArrow: _propTypes.default.bool
396
+ showArrow: _propTypes.default.bool,
397
+ data: _propTypes.default.array
390
398
  };
391
399
  Result.defaultProps = {
392
400
  value: []
@@ -263,7 +263,14 @@ export interface DatePickerProps<T =DatePickerValue > extends StandardProps,
263
263
  * default: -
264
264
  */
265
265
  innerTitle?: ReactNode;
266
- name: string | string[]
266
+ /**
267
+ * The name of a Form that accesses data
268
+ *
269
+ * Form 存取数据的名称
270
+ *
271
+ * default: -
272
+ */
273
+ name?: string | string[]
267
274
  }
268
275
 
269
276
  declare class DatePicker extends React.Component<DatePickerProps, {}> {
@@ -62,7 +62,7 @@ export interface RuleResult {
62
62
 
63
63
  range(min?: number, max?: number, message?: string): Range;
64
64
 
65
- regExp(reg?: RegExp | string): RegExpParams;
65
+ regExp(reg?: RegExp | string, message?: string): RegExpParams;
66
66
 
67
67
  email(message?: string): Type;
68
68
 
@@ -22,6 +22,7 @@ var _element = require("../utils/dom/element");
22
22
 
23
23
  var _Popover = _interopRequireDefault(require("../Popover"));
24
24
 
25
+ // if num = -1 display all else display num
25
26
  function getResetMore(onFilter, container, doms) {
26
27
  if (!container || !doms || !doms.length) return -1;
27
28
  var items = Array.from(doms);
@@ -51,10 +52,18 @@ function getResetMore(onFilter, container, doms) {
51
52
  for (var i = 0; i < itemWidthArr.length; i++) {
52
53
  var itemLen = itemWidthArr[i]; // number length
53
54
 
54
- var reset = "+" + (items.length - 1 - i);
55
- hideEl.childNodes[0].innerText = reset; // (+num) width
55
+ var resetNum = items.length - 1 - i;
56
+ var moreWidth = void 0;
57
+
58
+ if (resetNum <= 0) {
59
+ moreWidth = 0;
60
+ } else {
61
+ var reset = "+" + resetNum;
62
+ hideEl.childNodes[0].innerText = reset; // (+num) width
63
+
64
+ moreWidth = hideEl.offsetWidth + hideMargin;
65
+ }
56
66
 
57
- var moreWidth = hideEl.offsetWidth + hideMargin;
58
67
  len += itemLen;
59
68
 
60
69
  if (len > contentWidth - moreWidth) {
@@ -114,7 +123,7 @@ function (_Component) {
114
123
  cls = _this$props.cls,
115
124
  showNum = _this$props.showNum;
116
125
  var status = this.state.status;
117
- if (showNum < 0 || showNum > data.length) return _react.default.createElement(_react.default.Fragment, null, data, _react.default.createElement("a", {
126
+ if (showNum < 0 || showNum >= data.length) return _react.default.createElement(_react.default.Fragment, null, data, _react.default.createElement("a", {
118
127
  key: "hidden",
119
128
  className: className,
120
129
  style: {
@@ -125,13 +125,47 @@ function (_PureComponent) {
125
125
  };
126
126
 
127
127
  _proto.componentDidUpdate = function componentDidUpdate(preProps) {
128
+ this.updateMore(preProps);
129
+ };
130
+
131
+ _proto.componentWillUnmount = function componentWillUnmount() {
132
+ if (this.cancelResizeObserver) this.cancelResizeObserver();
133
+ };
134
+
135
+ _proto.bindResult = function bindResult(el) {
136
+ this.resultEl = el;
137
+ };
138
+
139
+ _proto.updateMore = function updateMore(preProps) {
128
140
  var _this$props = this.props,
129
141
  result = _this$props.result,
130
142
  compressed = _this$props.compressed,
131
- onFilter = _this$props.onFilter;
143
+ onFilter = _this$props.onFilter,
144
+ renderResult = _this$props.renderResult,
145
+ renderUnmatched = _this$props.renderUnmatched;
132
146
 
133
147
  if (compressed) {
134
- if ((preProps.result || []).join('') !== (result || []).join('')) {
148
+ var shouldRest = false;
149
+
150
+ if (preProps.result.length !== result.length) {
151
+ shouldRest = true;
152
+ } else {
153
+ var i = preProps.result.length - 1;
154
+
155
+ while (i >= 0) {
156
+ var before = getResultContent(preProps.result[i], preProps.renderResult, preProps.renderUnmatched);
157
+ var now = getResultContent(result[i], renderResult, renderUnmatched);
158
+
159
+ if (before !== now) {
160
+ shouldRest = true;
161
+ break;
162
+ }
163
+
164
+ i -= 1;
165
+ }
166
+ }
167
+
168
+ if (shouldRest) {
135
169
  this.resetMore();
136
170
  } else if (result.length && this.shouldResetMore) {
137
171
  this.shouldResetMore = false;
@@ -141,14 +175,6 @@ function (_PureComponent) {
141
175
  }
142
176
  };
143
177
 
144
- _proto.componentWillUnmount = function componentWillUnmount() {
145
- if (this.cancelResizeObserver) this.cancelResizeObserver();
146
- };
147
-
148
- _proto.bindResult = function bindResult(el) {
149
- this.resultEl = el;
150
- };
151
-
152
178
  _proto.resetMore = function resetMore() {
153
179
  if (!this.props.compressed) return;
154
180
  this.shouldResetMore = true;
@@ -124,7 +124,7 @@ export interface ColumnItem<T> {
124
124
  *
125
125
  * default: none
126
126
  */
127
- sorter?: ((order: ColumnOrder) => (prevRowData: T, nextRowData: T) => boolean) | string;
127
+ sorter?: ((order: ColumnOrder) => (prevRowData: T, nextRowData: T) => number) | string;
128
128
 
129
129
  /**
130
130
  * The content of the header
@@ -552,7 +552,7 @@ export interface TableProps<Value, TRD> extends StandardProps, ListItemStandardP
552
552
  * default: false
553
553
  */
554
554
  changedByExpand?: boolean
555
-
555
+
556
556
  /*
557
557
  * customize sort icons
558
558
  *
@@ -100,13 +100,47 @@ function (_PureComponent) {
100
100
  };
101
101
 
102
102
  _proto.componentDidUpdate = function componentDidUpdate(preProps) {
103
+ this.updateMore(preProps);
104
+ };
105
+
106
+ _proto.componentWillUnmount = function componentWillUnmount() {
107
+ if (this.cancelResizeObserver) this.cancelResizeObserver();
108
+ };
109
+
110
+ _proto.bindResult = function bindResult(el) {
111
+ this.resultEl = el;
112
+ };
113
+
114
+ _proto.updateMore = function updateMore(preProps) {
103
115
  var _this$props = this.props,
104
116
  result = _this$props.result,
105
117
  compressed = _this$props.compressed,
106
- onFilter = _this$props.onFilter;
118
+ onFilter = _this$props.onFilter,
119
+ renderResult = _this$props.renderResult,
120
+ renderUnmatched = _this$props.renderUnmatched;
107
121
 
108
122
  if (compressed) {
109
- if ((preProps.result || []).join('') !== (result || []).join('')) {
123
+ var shouldRest = false;
124
+
125
+ if (preProps.result.length !== result.length) {
126
+ shouldRest = true;
127
+ } else {
128
+ var i = preProps.result.length - 1;
129
+
130
+ while (i >= 0) {
131
+ var before = getResultContent(preProps.result[i], preProps.renderResult, preProps.renderUnmatched);
132
+ var now = getResultContent(result[i], renderResult, renderUnmatched);
133
+
134
+ if (before !== now) {
135
+ shouldRest = true;
136
+ break;
137
+ }
138
+
139
+ i -= 1;
140
+ }
141
+ }
142
+
143
+ if (shouldRest) {
110
144
  this.resetMore();
111
145
  } else if (result.length && this.shouldResetMore) {
112
146
  this.shouldResetMore = false;
@@ -116,14 +150,6 @@ function (_PureComponent) {
116
150
  }
117
151
  };
118
152
 
119
- _proto.componentWillUnmount = function componentWillUnmount() {
120
- if (this.cancelResizeObserver) this.cancelResizeObserver();
121
- };
122
-
123
- _proto.bindResult = function bindResult(el) {
124
- this.resultEl = el;
125
- };
126
-
127
153
  _proto.resetMore = function resetMore() {
128
154
  if (!this.props.compressed) return;
129
155
  this.shouldResetMore = true;
package/css/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Created by scripts/src-index.js.
2
2
  import * as utils from './utils'
3
3
 
4
- export default { utils, version: '1.9.6' }
4
+ export default { utils, version: '1.9.7' }
5
5
  export { utils }
6
6
  export { setLocale } from './locale'
7
7
  export { color, style } from './utils/expose'
package/css/index.js CHANGED
@@ -224,6 +224,6 @@ exports.Upload = _Upload.default;
224
224
  // Created by scripts/src-index.js.
225
225
  var _default = {
226
226
  utils: utils,
227
- version: '1.9.6'
227
+ version: '1.9.7'
228
228
  };
229
229
  exports.default = _default;