@douyinfe/semi-foundation 2.51.1 → 2.51.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.
@@ -994,26 +994,15 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
994
994
  * 受控时如果输入不完整,由于没有触发 notifyChange
995
995
  * 需要组件内更新一下输入框的值,否则会出现选了一个日期但是输入框没有回显日期的问题 #1357
996
996
  */
997
- if (!this._adapter.needConfirm() || fromPreset) {
998
- if (isRangeTypeAndInputIncomplete) {
999
- // do not change value when selected value is incomplete
1000
- this._adapter.updateInputValue(inputValue);
1001
- this._adapter.updateInsetInputValue(insetInputValue);
1002
- return;
1003
- } else {
1004
- if (!controlled || fromPreset) {
1005
- this._updateValueAndInput(dates, true, inputValue);
1006
- this._adapter.updateInsetInputValue(insetInputValue);
1007
- }
1008
- }
1009
- }
1010
- if (!controlled && this._adapter.needConfirm()) {
1011
- // select date only change inputValue when needConfirm is true
997
+ if (isRangeTypeAndInputIncomplete) {
998
+ // do not change value when selected value is incomplete
1012
999
  this._adapter.updateInputValue(inputValue);
1013
1000
  this._adapter.updateInsetInputValue(insetInputValue);
1014
- // if inputValue is not complete, don't notifyChange
1015
- if (isRangeTypeAndInputIncomplete) {
1016
- return;
1001
+ return;
1002
+ } else {
1003
+ if (!controlled || fromPreset) {
1004
+ this._updateValueAndInput(dates, true, inputValue);
1005
+ this._adapter.updateInsetInputValue(insetInputValue);
1017
1006
  }
1018
1007
  }
1019
1008
  if (!isEqual(value, stateValue)) {
@@ -127,7 +127,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
127
127
  couldClose = false;
128
128
  }
129
129
  if (couldClose && maskClosable) {
130
- this.handlePreviewClose();
130
+ this._adapter.notifyVisibleChange(false);
131
131
  }
132
132
  }
133
133
 
@@ -177,9 +177,10 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
177
177
  this._adapter.notifyDownload(downloadSrc, currentIndex);
178
178
  }
179
179
 
180
- handlePreviewClose = () => {
180
+ handlePreviewClose = (e: any) => {
181
181
  this._adapter.notifyVisibleChange(false);
182
182
  this._adapter.notifyClose();
183
+ handlePrevent(e);
183
184
  }
184
185
 
185
186
  handleAdjustRatio = (type: RatioType) => {
@@ -193,14 +193,13 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
193
193
  }
194
194
  }
195
195
 
196
- resizeTextarea = (cb?: any) => {
196
+ resizeTextarea = () => {
197
197
  const { height } = this.getStates();
198
198
  const { rows, autosize } = this.getProps();
199
199
  const node = this._adapter.getRef();
200
200
  const nodeSizingData = getSizingData(node);
201
201
 
202
202
  if (!nodeSizingData) {
203
- cb && cb();
204
203
  return;
205
204
  }
206
205
 
@@ -221,8 +220,6 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
221
220
  node.style.height = `${newHeight}px`;
222
221
  return;
223
222
  }
224
-
225
- cb && cb();
226
223
  };
227
224
 
228
225
  // e: MouseEvent
@@ -805,26 +805,15 @@ class DatePickerFoundation extends _foundation.default {
805
805
  * 受控时如果输入不完整,由于没有触发 notifyChange
806
806
  * 需要组件内更新一下输入框的值,否则会出现选了一个日期但是输入框没有回显日期的问题 #1357
807
807
  */
808
- if (!this._adapter.needConfirm() || fromPreset) {
809
- if (isRangeTypeAndInputIncomplete) {
810
- // do not change value when selected value is incomplete
811
- this._adapter.updateInputValue(inputValue);
812
- this._adapter.updateInsetInputValue(insetInputValue);
813
- return;
814
- } else {
815
- if (!controlled || fromPreset) {
816
- this._updateValueAndInput(dates, true, inputValue);
817
- this._adapter.updateInsetInputValue(insetInputValue);
818
- }
819
- }
820
- }
821
- if (!controlled && this._adapter.needConfirm()) {
822
- // select date only change inputValue when needConfirm is true
808
+ if (isRangeTypeAndInputIncomplete) {
809
+ // do not change value when selected value is incomplete
823
810
  this._adapter.updateInputValue(inputValue);
824
811
  this._adapter.updateInsetInputValue(insetInputValue);
825
- // if inputValue is not complete, don't notifyChange
826
- if (isRangeTypeAndInputIncomplete) {
827
- return;
812
+ return;
813
+ } else {
814
+ if (!controlled || fromPreset) {
815
+ this._updateValueAndInput(dates, true, inputValue);
816
+ this._adapter.updateInsetInputValue(insetInputValue);
828
817
  }
829
818
  }
830
819
  if (!(0, _isEqual2.default)(value, stateValue)) {
@@ -38,7 +38,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
38
38
  handleKeyDown: (e: any) => void;
39
39
  handleSwitchImage: (direction: string) => void;
40
40
  handleDownload: () => void;
41
- handlePreviewClose: () => void;
41
+ handlePreviewClose: (e: any) => void;
42
42
  handleAdjustRatio: (type: RatioType) => void;
43
43
  handleRotateImage: (direction: string) => void;
44
44
  handleZoomImage: (newZoom: number, notify?: boolean) => void;
@@ -117,7 +117,7 @@ class PreviewInnerFoundation extends _foundation.default {
117
117
  couldClose = false;
118
118
  }
119
119
  if (couldClose && maskClosable) {
120
- this.handlePreviewClose();
120
+ this._adapter.notifyVisibleChange(false);
121
121
  }
122
122
  };
123
123
  this.handleMouseDown = e => {
@@ -176,9 +176,10 @@ class PreviewInnerFoundation extends _foundation.default {
176
176
  (0, _utils.downloadImage)(downloadSrc, downloadName);
177
177
  this._adapter.notifyDownload(downloadSrc, currentIndex);
178
178
  };
179
- this.handlePreviewClose = () => {
179
+ this.handlePreviewClose = e => {
180
180
  this._adapter.notifyVisibleChange(false);
181
181
  this._adapter.notifyClose();
182
+ (0, _a11y.handlePrevent)(e);
182
183
  };
183
184
  this.handleAdjustRatio = type => {
184
185
  this.setState({
@@ -55,7 +55,7 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
55
55
  handleFocus(e: any): void;
56
56
  handleBlur(e: any): void;
57
57
  handleKeyDown(e: any): void;
58
- resizeTextarea: (cb?: any) => void;
58
+ resizeTextarea: () => void;
59
59
  handleMouseEnter(e: any): void;
60
60
  handleMouseLeave(e: any): void;
61
61
  isAllowClear(): boolean;
@@ -27,7 +27,7 @@ class TextAreaFoundation extends _foundation.default {
27
27
  }
28
28
  constructor(adapter) {
29
29
  super(Object.assign(Object.assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
30
- this.resizeTextarea = cb => {
30
+ this.resizeTextarea = () => {
31
31
  var _a;
32
32
  const {
33
33
  height
@@ -39,7 +39,6 @@ class TextAreaFoundation extends _foundation.default {
39
39
  const node = this._adapter.getRef();
40
40
  const nodeSizingData = (0, _getSizingData.default)(node);
41
41
  if (!nodeSizingData) {
42
- cb && cb();
43
42
  return;
44
43
  }
45
44
  const [minRows, maxRows] = autosize !== null && typeof autosize === 'object' ? [(_a = autosize === null || autosize === void 0 ? void 0 : autosize.minRows) !== null && _a !== void 0 ? _a : rows, autosize === null || autosize === void 0 ? void 0 : autosize.maxRows] : [rows];
@@ -49,7 +48,6 @@ class TextAreaFoundation extends _foundation.default {
49
48
  node.style.height = `${newHeight}px`;
50
49
  return;
51
50
  }
52
- cb && cb();
53
51
  };
54
52
  }
55
53
  init() {
@@ -798,26 +798,15 @@ export default class DatePickerFoundation extends BaseFoundation {
798
798
  * 受控时如果输入不完整,由于没有触发 notifyChange
799
799
  * 需要组件内更新一下输入框的值,否则会出现选了一个日期但是输入框没有回显日期的问题 #1357
800
800
  */
801
- if (!this._adapter.needConfirm() || fromPreset) {
802
- if (isRangeTypeAndInputIncomplete) {
803
- // do not change value when selected value is incomplete
804
- this._adapter.updateInputValue(inputValue);
805
- this._adapter.updateInsetInputValue(insetInputValue);
806
- return;
807
- } else {
808
- if (!controlled || fromPreset) {
809
- this._updateValueAndInput(dates, true, inputValue);
810
- this._adapter.updateInsetInputValue(insetInputValue);
811
- }
812
- }
813
- }
814
- if (!controlled && this._adapter.needConfirm()) {
815
- // select date only change inputValue when needConfirm is true
801
+ if (isRangeTypeAndInputIncomplete) {
802
+ // do not change value when selected value is incomplete
816
803
  this._adapter.updateInputValue(inputValue);
817
804
  this._adapter.updateInsetInputValue(insetInputValue);
818
- // if inputValue is not complete, don't notifyChange
819
- if (isRangeTypeAndInputIncomplete) {
820
- return;
805
+ return;
806
+ } else {
807
+ if (!controlled || fromPreset) {
808
+ this._updateValueAndInput(dates, true, inputValue);
809
+ this._adapter.updateInsetInputValue(insetInputValue);
821
810
  }
822
811
  }
823
812
  if (!_isEqual(value, stateValue)) {
@@ -38,7 +38,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
38
38
  handleKeyDown: (e: any) => void;
39
39
  handleSwitchImage: (direction: string) => void;
40
40
  handleDownload: () => void;
41
- handlePreviewClose: () => void;
41
+ handlePreviewClose: (e: any) => void;
42
42
  handleAdjustRatio: (type: RatioType) => void;
43
43
  handleRotateImage: (direction: string) => void;
44
44
  handleZoomImage: (newZoom: number, notify?: boolean) => void;
@@ -110,7 +110,7 @@ export default class PreviewInnerFoundation extends BaseFoundation {
110
110
  couldClose = false;
111
111
  }
112
112
  if (couldClose && maskClosable) {
113
- this.handlePreviewClose();
113
+ this._adapter.notifyVisibleChange(false);
114
114
  }
115
115
  };
116
116
  this.handleMouseDown = e => {
@@ -169,9 +169,10 @@ export default class PreviewInnerFoundation extends BaseFoundation {
169
169
  downloadImage(downloadSrc, downloadName);
170
170
  this._adapter.notifyDownload(downloadSrc, currentIndex);
171
171
  };
172
- this.handlePreviewClose = () => {
172
+ this.handlePreviewClose = e => {
173
173
  this._adapter.notifyVisibleChange(false);
174
174
  this._adapter.notifyClose();
175
+ handlePrevent(e);
175
176
  };
176
177
  this.handleAdjustRatio = type => {
177
178
  this.setState({
@@ -55,7 +55,7 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
55
55
  handleFocus(e: any): void;
56
56
  handleBlur(e: any): void;
57
57
  handleKeyDown(e: any): void;
58
- resizeTextarea: (cb?: any) => void;
58
+ resizeTextarea: () => void;
59
59
  handleMouseEnter(e: any): void;
60
60
  handleMouseLeave(e: any): void;
61
61
  isAllowClear(): boolean;
@@ -20,7 +20,7 @@ export default class TextAreaFoundation extends BaseFoundation {
20
20
  }
21
21
  constructor(adapter) {
22
22
  super(Object.assign(Object.assign({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
23
- this.resizeTextarea = cb => {
23
+ this.resizeTextarea = () => {
24
24
  var _a;
25
25
  const {
26
26
  height
@@ -32,7 +32,6 @@ export default class TextAreaFoundation extends BaseFoundation {
32
32
  const node = this._adapter.getRef();
33
33
  const nodeSizingData = getSizingData(node);
34
34
  if (!nodeSizingData) {
35
- cb && cb();
36
35
  return;
37
36
  }
38
37
  const [minRows, maxRows] = autosize !== null && typeof autosize === 'object' ? [(_a = autosize === null || autosize === void 0 ? void 0 : autosize.minRows) !== null && _a !== void 0 ? _a : rows, autosize === null || autosize === void 0 ? void 0 : autosize.maxRows] : [rows];
@@ -42,7 +41,6 @@ export default class TextAreaFoundation extends BaseFoundation {
42
41
  node.style.height = `${newHeight}px`;
43
42
  return;
44
43
  }
45
- cb && cb();
46
44
  };
47
45
  }
48
46
  init() {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.51.1",
3
+ "version": "2.51.2",
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.51.1",
10
+ "@douyinfe/semi-animation": "2.51.2",
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": "c81cf7801f7c7afd385d63e1e7dd1cf533d7fc83",
26
+ "gitHead": "424e683a18b7d3c2a55e21b625f292e31df13ac2",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",