@douyinfe/semi-foundation 2.38.3-alpha.2-patch-modal → 2.38.3-alpha.2-patch-select-max

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.
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("start" | "end")[];
5
+ BOUNDARY_SET: ("end" | "start")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -439,7 +439,7 @@ class SelectFoundation extends _foundation.default {
439
439
  label
440
440
  }, rest));
441
441
  selections.delete(label);
442
- } else if (maxLimit && selections.size === maxLimit) {
442
+ } else if (maxLimit && selections.size >= maxLimit) {
443
443
  this._adapter.notifyMaxLimit(Object.assign({
444
444
  value,
445
445
  label
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
75
75
  export declare function normalizeValue(value: any, withObject: boolean): any;
76
76
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
77
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
78
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
78
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
79
79
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
80
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -135,7 +135,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
135
135
  focusInput(bool: boolean): void;
136
136
  _notifyMultipleChange(key: string[], e: any): void;
137
137
  _notifyChange(key: any, e: any): void;
138
- _registerClickOutsideHandler: (e: any) => void;
138
+ _registerClickOutsideHandler: () => void;
139
139
  _notifyFocus(e: any): void;
140
140
  handleTriggerFocus(e: any): void;
141
141
  _notifyBlur(e: any): void;
@@ -21,7 +21,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
21
21
  class TreeSelectFoundation extends _foundation.default {
22
22
  constructor(adapter) {
23
23
  super(Object.assign({}, adapter));
24
- this._registerClickOutsideHandler = e => {
24
+ this._registerClickOutsideHandler = () => {
25
25
  this._adapter.registerClickOutsideHandler(e => {
26
26
  this.handlerTriggerBlur(e);
27
27
  this.close(e);
@@ -37,11 +37,13 @@ class TreeSelectFoundation extends _foundation.default {
37
37
  const triggerSearch = searchPosition === _constants.strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
38
38
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
39
39
  this._setDropdownWidth();
40
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
40
+ const able = !this._isDisabled();
41
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
41
42
  if (isOpen) {
42
43
  this.open();
44
+ this._registerClickOutsideHandler();
43
45
  }
44
- if (triggerSearchAutoFocus) {
46
+ if (triggerSearchAutoFocus && able) {
45
47
  this.handleTriggerFocus(null);
46
48
  }
47
49
  }
@@ -272,7 +274,7 @@ class TreeSelectFoundation extends _foundation.default {
272
274
  handleTriggerFocus(e) {
273
275
  this._adapter.updateIsFocus(true);
274
276
  this._notifyFocus(e);
275
- this._registerClickOutsideHandler(e);
277
+ this._registerClickOutsideHandler();
276
278
  }
277
279
  // Scenes that may trigger blur
278
280
  // 1、clickOutSide
@@ -282,6 +284,10 @@ class TreeSelectFoundation extends _foundation.default {
282
284
  this._adapter.notifyBlur(e);
283
285
  }
284
286
  handlerTriggerBlur(e) {
287
+ const isFocus = this.getState('isFocus');
288
+ if (!isFocus) {
289
+ return;
290
+ }
285
291
  this._adapter.updateIsFocus(false);
286
292
  this._notifyBlur(e);
287
293
  this._adapter.unregisterClickOutsideHandler();
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("custom" | "auto")[];
21
+ UPLOAD_TRIGGER: ("auto" | "custom")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("start" | "end")[];
5
+ BOUNDARY_SET: ("end" | "start")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -430,7 +430,7 @@ export default class SelectFoundation extends BaseFoundation {
430
430
  label
431
431
  }, rest));
432
432
  selections.delete(label);
433
- } else if (maxLimit && selections.size === maxLimit) {
433
+ } else if (maxLimit && selections.size >= maxLimit) {
434
434
  this._adapter.notifyMaxLimit(Object.assign({
435
435
  value,
436
436
  label
@@ -75,6 +75,6 @@ export declare function getValueOrKey(data: any): any;
75
75
  export declare function normalizeValue(value: any, withObject: boolean): any;
76
76
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
77
77
  export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
78
- export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
78
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
79
79
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
80
80
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -135,7 +135,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
135
135
  focusInput(bool: boolean): void;
136
136
  _notifyMultipleChange(key: string[], e: any): void;
137
137
  _notifyChange(key: any, e: any): void;
138
- _registerClickOutsideHandler: (e: any) => void;
138
+ _registerClickOutsideHandler: () => void;
139
139
  _notifyFocus(e: any): void;
140
140
  handleTriggerFocus(e: any): void;
141
141
  _notifyBlur(e: any): void;
@@ -14,7 +14,7 @@ import isEnterPress from '../utils/isEnterPress';
14
14
  export default class TreeSelectFoundation extends BaseFoundation {
15
15
  constructor(adapter) {
16
16
  super(Object.assign({}, adapter));
17
- this._registerClickOutsideHandler = e => {
17
+ this._registerClickOutsideHandler = () => {
18
18
  this._adapter.registerClickOutsideHandler(e => {
19
19
  this.handlerTriggerBlur(e);
20
20
  this.close(e);
@@ -30,11 +30,13 @@ export default class TreeSelectFoundation extends BaseFoundation {
30
30
  const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
31
31
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
32
32
  this._setDropdownWidth();
33
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
33
+ const able = !this._isDisabled();
34
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
34
35
  if (isOpen) {
35
36
  this.open();
37
+ this._registerClickOutsideHandler();
36
38
  }
37
- if (triggerSearchAutoFocus) {
39
+ if (triggerSearchAutoFocus && able) {
38
40
  this.handleTriggerFocus(null);
39
41
  }
40
42
  }
@@ -265,7 +267,7 @@ export default class TreeSelectFoundation extends BaseFoundation {
265
267
  handleTriggerFocus(e) {
266
268
  this._adapter.updateIsFocus(true);
267
269
  this._notifyFocus(e);
268
- this._registerClickOutsideHandler(e);
270
+ this._registerClickOutsideHandler();
269
271
  }
270
272
  // Scenes that may trigger blur
271
273
  // 1、clickOutSide
@@ -275,6 +277,10 @@ export default class TreeSelectFoundation extends BaseFoundation {
275
277
  this._adapter.notifyBlur(e);
276
278
  }
277
279
  handlerTriggerBlur(e) {
280
+ const isFocus = this.getState('isFocus');
281
+ if (!isFocus) {
282
+ return;
283
+ }
278
284
  this._adapter.updateIsFocus(false);
279
285
  this._notifyBlur(e);
280
286
  this._adapter.unregisterClickOutsideHandler();
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("custom" | "auto")[];
21
+ UPLOAD_TRIGGER: ("auto" | "custom")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.38.3-alpha.2-patch-modal",
3
+ "version": "2.38.3-alpha.2-patch-select-max",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
7
7
  "prepublishOnly": "npm run build:lib"
8
8
  },
9
9
  "dependencies": {
10
- "@douyinfe/semi-animation": "2.38.3-alpha.2-patch-modal",
10
+ "@douyinfe/semi-animation": "2.38.3-alpha.2-patch-select-max",
11
11
  "async-validator": "^3.5.0",
12
12
  "classnames": "^2.2.6",
13
13
  "date-fns": "^2.29.3",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "7fe24e6347b1b4ca706ccce160e2b7e3c7f10c4a",
26
+ "gitHead": "8728fb091f1dfcae5d64d6ef912493b0911a1de7",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -455,7 +455,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
455
455
  if (selections.has(label)) {
456
456
  this._notifyDeselect(value, { value, label, ...rest });
457
457
  selections.delete(label);
458
- } else if (maxLimit && selections.size === maxLimit) {
458
+ } else if (maxLimit && selections.size >= maxLimit) {
459
459
  this._adapter.notifyMaxLimit({ value, label, ...omit(rest, '_scrollIndex') });
460
460
  return;
461
461
  } else {
@@ -212,11 +212,13 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
212
212
  const triggerSearch = searchPosition === strings.SEARCH_POSITION_TRIGGER && filterTreeNode;
213
213
  const triggerSearchAutoFocus = searchAutoFocus && triggerSearch;
214
214
  this._setDropdownWidth();
215
- const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && !this._isDisabled();
215
+ const able = !this._isDisabled();
216
+ const isOpen = (this.getProp('defaultOpen') || triggerSearchAutoFocus) && able;
216
217
  if (isOpen) {
217
218
  this.open();
219
+ this._registerClickOutsideHandler();
218
220
  }
219
- if (triggerSearchAutoFocus) {
221
+ if (triggerSearchAutoFocus && able) {
220
222
  this.handleTriggerFocus(null);
221
223
  }
222
224
  }
@@ -433,7 +435,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
433
435
  }
434
436
  }
435
437
 
436
- _registerClickOutsideHandler = (e) => {
438
+ _registerClickOutsideHandler = () => {
437
439
  this._adapter.registerClickOutsideHandler(e => {
438
440
  this.handlerTriggerBlur(e);
439
441
  this.close(e);
@@ -449,7 +451,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
449
451
  handleTriggerFocus(e: any) {
450
452
  this._adapter.updateIsFocus(true);
451
453
  this._notifyFocus(e);
452
- this._registerClickOutsideHandler(e);
454
+ this._registerClickOutsideHandler();
453
455
  }
454
456
 
455
457
  // Scenes that may trigger blur
@@ -461,6 +463,10 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
461
463
  }
462
464
 
463
465
  handlerTriggerBlur(e) {
466
+ const isFocus = this.getState('isFocus');
467
+ if (!isFocus) {
468
+ return;
469
+ }
464
470
  this._adapter.updateIsFocus(false);
465
471
  this._notifyBlur(e);
466
472
  this._adapter.unregisterClickOutsideHandler();