shineout 2.0.0-rc.13 → 2.0.0-rc.14

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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  /// <reference types="react" />
2
3
  import { PureComponent } from '../component';
3
4
  import DatumTree from '../Datum/Tree';
@@ -18,6 +19,7 @@ declare class Cascader<DataItem, Value extends CascaderBaseValue> extends PureCo
18
19
  expandTrigger: string;
19
20
  childrenKey: string;
20
21
  };
22
+ pathChangeTimer: NodeJS.Timeout | null;
21
23
  datum: DatumTree<DataItem>;
22
24
  selectId: string;
23
25
  isRendered: boolean;
@@ -82,6 +82,7 @@ function (_PureComponent) {
82
82
  var _this;
83
83
 
84
84
  _this = _PureComponent.call(this, props) || this;
85
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "pathChangeTimer", void 0);
85
86
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "datum", void 0);
86
87
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "selectId", void 0);
87
88
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)((0, _assertThisInitialized2.default)(_this)), "isRendered", void 0);
@@ -296,7 +297,12 @@ function (_PureComponent) {
296
297
  if (finalDismiss && leaf) this.handleState(false);
297
298
  }
298
299
 
299
- setTimeout(function () {
300
+ if (this.pathChangeTimer) {
301
+ clearTimeout(this.pathChangeTimer);
302
+ this.pathChangeTimer = null;
303
+ }
304
+
305
+ this.pathChangeTimer = setTimeout(function () {
300
306
  _this2.setState({
301
307
  path: [].concat(path, [id])
302
308
  });
@@ -65,7 +65,7 @@ export default class<Item> {
65
65
  IS_NOT_MATCHED_VALUE: boolean;
66
66
  value: KeygenResult;
67
67
  } | null;
68
- getPath(id: KeygenResult): TreePathType;
68
+ getPath(id: KeygenResult): TreePathType | undefined;
69
69
  getChecked(id: KeygenResult): boolean | "indeterminate";
70
70
  getKey(data: Item, id?: KeygenResult, index?: number): KeygenResult;
71
71
  initValue(ids?: KeygenResult[], forceCheck?: boolean): CheckedStatus | undefined;
@@ -142,7 +142,7 @@ function (_Component) {
142
142
  };
143
143
 
144
144
  _proto.getShouldSticky = function getShouldSticky() {
145
- return this.props.sticky && this.state.inView;
145
+ return this.state.inView && this.props.sticky;
146
146
  };
147
147
 
148
148
  _proto.bindTable = function bindTable(el) {
@@ -195,7 +195,8 @@ function (_PureComponent) {
195
195
  onSearch = _this$props7.onSearch,
196
196
  renderFilter = _this$props7.renderFilter,
197
197
  filterText = _this$props7.filterText,
198
- disabled = _this$props7.disabled;
198
+ disabled = _this$props7.disabled,
199
+ index = _this$props7.index;
199
200
  if (!onFilter && !onSearch) return null;
200
201
 
201
202
  if (renderFilter && typeof renderFilter === 'function') {
@@ -205,7 +206,8 @@ function (_PureComponent) {
205
206
  value: filterText,
206
207
  disabled: disabled === true,
207
208
  onFilter: onFilter,
208
- placeholder: (0, _locale.getLocale)('search')
209
+ placeholder: (0, _locale.getLocale)('search'),
210
+ isSource: index === 0
209
211
  }));
210
212
  }
211
213
 
@@ -9,6 +9,7 @@ declare type filterProps = {
9
9
  disabled: boolean;
10
10
  onFilter?: (value: string) => void;
11
11
  placeholder?: string;
12
+ isSource: boolean;
12
13
  };
13
14
  export declare type SelectedArr = [KeygenResult[], KeygenResult[]];
14
15
  export declare type IndexType = 1 | 0;
package/css/Tree/Node.js CHANGED
@@ -170,6 +170,7 @@ function (_PureComponent) {
170
170
  var startId = placeInfo.start;
171
171
  var current = datum.getPath(startId);
172
172
  var target = datum.getPath(this.props.id);
173
+ if (!current || !target) return;
173
174
  var currentPathStr = current.path.join('/');
174
175
  var targetPathStr = target.path.join('/');
175
176
  if (dragSibling && targetPathStr !== currentPathStr) return;
package/css/Tree/Tree.js CHANGED
@@ -222,6 +222,7 @@ function (_PureComponent) {
222
222
  var childrenKey = this.props.childrenKey;
223
223
  var current = this.datum.getPath(id);
224
224
  var target = this.datum.getPath(targetId);
225
+ if (!current || !target) return;
225
226
  var data = (0, _immer.default)(this.props.data, function (draft) {
226
227
  var node = draft;
227
228
  var temp;
@@ -318,7 +318,7 @@ function (_PureComponent) {
318
318
  }
319
319
 
320
320
  var value = this.getValue();
321
- if (onChange) onChange(value, current, id ? datum.getPath(id).path : undefined);
321
+ if (onChange) onChange(value, current, id ? (datum.getPath(id) || {}).path : undefined);
322
322
 
323
323
  if (typeof onChangeAddition === 'function') {
324
324
  onChangeAddition({
package/css/index.js CHANGED
@@ -220,6 +220,6 @@ exports.Upload = _Upload.default;
220
220
  // Created by scripts/src-index.js.
221
221
  var _default = {
222
222
  utils: utils,
223
- version: '2.0.0-rc.13'
223
+ version: '2.0.0-rc.14'
224
224
  };
225
225
  exports.default = _default;