@douyinfe/semi-foundation 2.33.0-beta.0 → 2.33.0

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.
@@ -547,7 +547,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
547
547
  this._updateValueAndInput(result, input === '', input);
548
548
  // Updates the selected value when entering a valid date
549
549
  const changedDates = this._getChangedDates(result);
550
- if (!this._someDateDisabled(changedDates)) {
550
+ if (!this._someDateDisabled(changedDates, result)) {
551
551
  if (!isEqual(result, stateValue)) {
552
552
  this._notifyChange(result);
553
553
  }
@@ -572,7 +572,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
572
572
 
573
573
  if ((result && result.length)) {
574
574
  const changedDates = this._getChangedDates(result);
575
- if (!this._someDateDisabled(changedDates)) {
575
+ if (!this._someDateDisabled(changedDates, result)) {
576
576
  if (!isEqual(result, stateValue)) {
577
577
  if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
578
578
  this._adapter.updateValue(result);
@@ -592,7 +592,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
592
592
  _updateCachedSelectedValueFromInput(input: string) {
593
593
  const looseResult = this.getLooseDateFromInput(input);
594
594
  const changedLooseResult = this._getChangedDates(looseResult);
595
- if (!this._someDateDisabled(changedLooseResult)) {
595
+ if (!this._someDateDisabled(changedLooseResult, looseResult)) {
596
596
  this.resetCachedSelectedValue(looseResult);
597
597
  }
598
598
  }
@@ -684,7 +684,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
684
684
  this._updateValueAndInput(parsedResult);
685
685
  const { value: stateValue } = this.getStates();
686
686
  const changedDates = this._getChangedDates(parsedResult);
687
- if (!this._someDateDisabled(changedDates) && !isEqual(parsedResult, stateValue)) {
687
+ if (!this._someDateDisabled(changedDates, parsedResult) && !isEqual(parsedResult, stateValue)) {
688
688
  this._notifyChange(parsedResult);
689
689
  }
690
690
  }
@@ -984,7 +984,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
984
984
 
985
985
  const changedDates = this._getChangedDates(_value);
986
986
  // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
987
- if (!this._isControlledComponent() && !this._someDateDisabled(changedDates) && !this._adapter.needConfirm()) {
987
+ if (!this._isControlledComponent() && !this._someDateDisabled(changedDates, _value) && !this._adapter.needConfirm()) {
988
988
  this._adapter.updateValue(_value);
989
989
  }
990
990
  }
@@ -1013,7 +1013,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
1013
1013
  const changedDates = this._getChangedDates(dates);
1014
1014
 
1015
1015
  let inputValue, insetInputValue;
1016
- if (!this._someDateDisabled(changedDates)) {
1016
+ if (!this._someDateDisabled(changedDates, dates)) {
1017
1017
  this.resetCachedSelectedValue(dates);
1018
1018
  inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
1019
1019
  if (insetInput) {
@@ -1253,22 +1253,22 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
1253
1253
 
1254
1254
  /**
1255
1255
  * Whether a date is disabled
1256
- * @param {Array} value
1256
+ * @param value The date that needs to be judged whether to disable
1257
+ * @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
1257
1258
  */
1258
- _someDateDisabled(value: Date[]) {
1259
- const stateValue = this.getState('value');
1259
+ _someDateDisabled(value: Date[], selectedValue: Date[]) {
1260
1260
  const { rangeInputFocus } = this.getStates();
1261
1261
  const disabledOptions = { rangeStart: '', rangeEnd: '', rangeInputFocus };
1262
1262
 
1263
1263
  // DisabledDate needs to pass the second parameter
1264
- if (this._isRangeType() && Array.isArray(stateValue)) {
1265
- if (isValid(stateValue[0])) {
1266
- const rangeStart = format(stateValue[0], 'yyyy-MM-dd');
1264
+ if (this._isRangeType() && Array.isArray(selectedValue)) {
1265
+ if (isValid(selectedValue[0])) {
1266
+ const rangeStart = format(selectedValue[0], 'yyyy-MM-dd');
1267
1267
  disabledOptions.rangeStart = rangeStart;
1268
1268
  }
1269
1269
 
1270
- if (isValid(stateValue[1])) {
1271
- const rangeEnd = format(stateValue[1], 'yyyy-MM-dd');
1270
+ if (isValid(selectedValue[1])) {
1271
+ const rangeEnd = format(selectedValue[1], 'yyyy-MM-dd');
1272
1272
  disabledOptions.rangeEnd = rangeEnd;
1273
1273
  }
1274
1274
  }
@@ -476,9 +476,10 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
476
476
  _getChangedDates(dates: Date[]): any[];
477
477
  /**
478
478
  * Whether a date is disabled
479
- * @param {Array} value
479
+ * @param value The date that needs to be judged whether to disable
480
+ * @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
480
481
  */
481
- _someDateDisabled(value: Date[]): boolean;
482
+ _someDateDisabled(value: Date[], selectedValue: Date[]): boolean;
482
483
  /**
483
484
  * Format locale date
484
485
  * locale get from LocaleProvider
@@ -476,7 +476,7 @@ class DatePickerFoundation extends _foundation.default {
476
476
 
477
477
  const changedDates = this._getChangedDates(result);
478
478
 
479
- if (!this._someDateDisabled(changedDates)) {
479
+ if (!this._someDateDisabled(changedDates, result)) {
480
480
  if (!(0, _isEqual2.default)(result, stateValue)) {
481
481
  this._notifyChange(result);
482
482
  }
@@ -512,7 +512,7 @@ class DatePickerFoundation extends _foundation.default {
512
512
  if (result && result.length) {
513
513
  const changedDates = this._getChangedDates(result);
514
514
 
515
- if (!this._someDateDisabled(changedDates)) {
515
+ if (!this._someDateDisabled(changedDates, result)) {
516
516
  if (!(0, _isEqual2.default)(result, stateValue)) {
517
517
  if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
518
518
  this._adapter.updateValue(result);
@@ -539,7 +539,7 @@ class DatePickerFoundation extends _foundation.default {
539
539
 
540
540
  const changedLooseResult = this._getChangedDates(looseResult);
541
541
 
542
- if (!this._someDateDisabled(changedLooseResult)) {
542
+ if (!this._someDateDisabled(changedLooseResult, looseResult)) {
543
543
  this.resetCachedSelectedValue(looseResult);
544
544
  }
545
545
  }
@@ -644,7 +644,7 @@ class DatePickerFoundation extends _foundation.default {
644
644
 
645
645
  const changedDates = this._getChangedDates(parsedResult);
646
646
 
647
- if (!this._someDateDisabled(changedDates) && !(0, _isEqual2.default)(parsedResult, stateValue)) {
647
+ if (!this._someDateDisabled(changedDates, parsedResult) && !(0, _isEqual2.default)(parsedResult, stateValue)) {
648
648
  this._notifyChange(parsedResult);
649
649
  }
650
650
  }
@@ -998,7 +998,7 @@ class DatePickerFoundation extends _foundation.default {
998
998
  const changedDates = this._getChangedDates(_value); // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
999
999
 
1000
1000
 
1001
- if (!this._isControlledComponent() && !this._someDateDisabled(changedDates) && !this._adapter.needConfirm()) {
1001
+ if (!this._isControlledComponent() && !this._someDateDisabled(changedDates, _value) && !this._adapter.needConfirm()) {
1002
1002
  this._adapter.updateValue(_value);
1003
1003
  }
1004
1004
  }
@@ -1041,7 +1041,7 @@ class DatePickerFoundation extends _foundation.default {
1041
1041
 
1042
1042
  let inputValue, insetInputValue;
1043
1043
 
1044
- if (!this._someDateDisabled(changedDates)) {
1044
+ if (!this._someDateDisabled(changedDates, dates)) {
1045
1045
  this.resetCachedSelectedValue(dates);
1046
1046
  inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
1047
1047
 
@@ -1348,12 +1348,12 @@ class DatePickerFoundation extends _foundation.default {
1348
1348
  }
1349
1349
  /**
1350
1350
  * Whether a date is disabled
1351
- * @param {Array} value
1351
+ * @param value The date that needs to be judged whether to disable
1352
+ * @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
1352
1353
  */
1353
1354
 
1354
1355
 
1355
- _someDateDisabled(value) {
1356
- const stateValue = this.getState('value');
1356
+ _someDateDisabled(value, selectedValue) {
1357
1357
  const {
1358
1358
  rangeInputFocus
1359
1359
  } = this.getStates();
@@ -1363,14 +1363,14 @@ class DatePickerFoundation extends _foundation.default {
1363
1363
  rangeInputFocus
1364
1364
  }; // DisabledDate needs to pass the second parameter
1365
1365
 
1366
- if (this._isRangeType() && Array.isArray(stateValue)) {
1367
- if ((0, _dateFns.isValid)(stateValue[0])) {
1368
- const rangeStart = (0, _dateFns.format)(stateValue[0], 'yyyy-MM-dd');
1366
+ if (this._isRangeType() && Array.isArray(selectedValue)) {
1367
+ if ((0, _dateFns.isValid)(selectedValue[0])) {
1368
+ const rangeStart = (0, _dateFns.format)(selectedValue[0], 'yyyy-MM-dd');
1369
1369
  disabledOptions.rangeStart = rangeStart;
1370
1370
  }
1371
1371
 
1372
- if ((0, _dateFns.isValid)(stateValue[1])) {
1373
- const rangeEnd = (0, _dateFns.format)(stateValue[1], 'yyyy-MM-dd');
1372
+ if ((0, _dateFns.isValid)(selectedValue[1])) {
1373
+ const rangeEnd = (0, _dateFns.format)(selectedValue[1], 'yyyy-MM-dd');
1374
1374
  disabledOptions.rangeEnd = rangeEnd;
1375
1375
  }
1376
1376
  }
@@ -92,6 +92,15 @@
92
92
  .semi-sidesheet-size-large {
93
93
  width: 920px;
94
94
  }
95
+ .semi-sidesheet-size-small.semi-sidesheet {
96
+ width: 448px;
97
+ }
98
+ .semi-sidesheet-size-medium.semi-sidesheet {
99
+ width: 684px;
100
+ }
101
+ .semi-sidesheet-size-large.semi-sidesheet {
102
+ width: 920px;
103
+ }
95
104
  .semi-sidesheet-content {
96
105
  height: 100%;
97
106
  display: flex;
@@ -116,6 +116,18 @@ $module: #{$prefix}-sidesheet;
116
116
  width: $width-sideSheet_size-large;
117
117
  }
118
118
 
119
+ &-size-small.#{$module} {
120
+ width: $width-sideSheet_size-small;
121
+ }
122
+
123
+ &-size-medium.#{$module} {
124
+ width: $width-sideSheet_size-medium;
125
+ }
126
+
127
+ &-size-large.#{$module} {
128
+ width: $width-sideSheet_size-large;
129
+ }
130
+
119
131
 
120
132
 
121
133
  &-content {
@@ -476,9 +476,10 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
476
476
  _getChangedDates(dates: Date[]): any[];
477
477
  /**
478
478
  * Whether a date is disabled
479
- * @param {Array} value
479
+ * @param value The date that needs to be judged whether to disable
480
+ * @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
480
481
  */
481
- _someDateDisabled(value: Date[]): boolean;
482
+ _someDateDisabled(value: Date[], selectedValue: Date[]): boolean;
482
483
  /**
483
484
  * Format locale date
484
485
  * locale get from LocaleProvider
@@ -451,7 +451,7 @@ export default class DatePickerFoundation extends BaseFoundation {
451
451
 
452
452
  const changedDates = this._getChangedDates(result);
453
453
 
454
- if (!this._someDateDisabled(changedDates)) {
454
+ if (!this._someDateDisabled(changedDates, result)) {
455
455
  if (!_isEqual(result, stateValue)) {
456
456
  this._notifyChange(result);
457
457
  }
@@ -487,7 +487,7 @@ export default class DatePickerFoundation extends BaseFoundation {
487
487
  if (result && result.length) {
488
488
  const changedDates = this._getChangedDates(result);
489
489
 
490
- if (!this._someDateDisabled(changedDates)) {
490
+ if (!this._someDateDisabled(changedDates, result)) {
491
491
  if (!_isEqual(result, stateValue)) {
492
492
  if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
493
493
  this._adapter.updateValue(result);
@@ -514,7 +514,7 @@ export default class DatePickerFoundation extends BaseFoundation {
514
514
 
515
515
  const changedLooseResult = this._getChangedDates(looseResult);
516
516
 
517
- if (!this._someDateDisabled(changedLooseResult)) {
517
+ if (!this._someDateDisabled(changedLooseResult, looseResult)) {
518
518
  this.resetCachedSelectedValue(looseResult);
519
519
  }
520
520
  }
@@ -619,7 +619,7 @@ export default class DatePickerFoundation extends BaseFoundation {
619
619
 
620
620
  const changedDates = this._getChangedDates(parsedResult);
621
621
 
622
- if (!this._someDateDisabled(changedDates) && !_isEqual(parsedResult, stateValue)) {
622
+ if (!this._someDateDisabled(changedDates, parsedResult) && !_isEqual(parsedResult, stateValue)) {
623
623
  this._notifyChange(parsedResult);
624
624
  }
625
625
  }
@@ -973,7 +973,7 @@ export default class DatePickerFoundation extends BaseFoundation {
973
973
  const changedDates = this._getChangedDates(_value); // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
974
974
 
975
975
 
976
- if (!this._isControlledComponent() && !this._someDateDisabled(changedDates) && !this._adapter.needConfirm()) {
976
+ if (!this._isControlledComponent() && !this._someDateDisabled(changedDates, _value) && !this._adapter.needConfirm()) {
977
977
  this._adapter.updateValue(_value);
978
978
  }
979
979
  }
@@ -1019,7 +1019,7 @@ export default class DatePickerFoundation extends BaseFoundation {
1019
1019
 
1020
1020
  let inputValue, insetInputValue;
1021
1021
 
1022
- if (!this._someDateDisabled(changedDates)) {
1022
+ if (!this._someDateDisabled(changedDates, dates)) {
1023
1023
  this.resetCachedSelectedValue(dates);
1024
1024
  inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
1025
1025
 
@@ -1326,12 +1326,12 @@ export default class DatePickerFoundation extends BaseFoundation {
1326
1326
  }
1327
1327
  /**
1328
1328
  * Whether a date is disabled
1329
- * @param {Array} value
1329
+ * @param value The date that needs to be judged whether to disable
1330
+ * @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
1330
1331
  */
1331
1332
 
1332
1333
 
1333
- _someDateDisabled(value) {
1334
- const stateValue = this.getState('value');
1334
+ _someDateDisabled(value, selectedValue) {
1335
1335
  const {
1336
1336
  rangeInputFocus
1337
1337
  } = this.getStates();
@@ -1341,14 +1341,14 @@ export default class DatePickerFoundation extends BaseFoundation {
1341
1341
  rangeInputFocus
1342
1342
  }; // DisabledDate needs to pass the second parameter
1343
1343
 
1344
- if (this._isRangeType() && Array.isArray(stateValue)) {
1345
- if (isValid(stateValue[0])) {
1346
- const rangeStart = format(stateValue[0], 'yyyy-MM-dd');
1344
+ if (this._isRangeType() && Array.isArray(selectedValue)) {
1345
+ if (isValid(selectedValue[0])) {
1346
+ const rangeStart = format(selectedValue[0], 'yyyy-MM-dd');
1347
1347
  disabledOptions.rangeStart = rangeStart;
1348
1348
  }
1349
1349
 
1350
- if (isValid(stateValue[1])) {
1351
- const rangeEnd = format(stateValue[1], 'yyyy-MM-dd');
1350
+ if (isValid(selectedValue[1])) {
1351
+ const rangeEnd = format(selectedValue[1], 'yyyy-MM-dd');
1352
1352
  disabledOptions.rangeEnd = rangeEnd;
1353
1353
  }
1354
1354
  }
@@ -92,6 +92,15 @@
92
92
  .semi-sidesheet-size-large {
93
93
  width: 920px;
94
94
  }
95
+ .semi-sidesheet-size-small.semi-sidesheet {
96
+ width: 448px;
97
+ }
98
+ .semi-sidesheet-size-medium.semi-sidesheet {
99
+ width: 684px;
100
+ }
101
+ .semi-sidesheet-size-large.semi-sidesheet {
102
+ width: 920px;
103
+ }
95
104
  .semi-sidesheet-content {
96
105
  height: 100%;
97
106
  display: flex;
@@ -116,6 +116,18 @@ $module: #{$prefix}-sidesheet;
116
116
  width: $width-sideSheet_size-large;
117
117
  }
118
118
 
119
+ &-size-small.#{$module} {
120
+ width: $width-sideSheet_size-small;
121
+ }
122
+
123
+ &-size-medium.#{$module} {
124
+ width: $width-sideSheet_size-medium;
125
+ }
126
+
127
+ &-size-large.#{$module} {
128
+ width: $width-sideSheet_size-large;
129
+ }
130
+
119
131
 
120
132
 
121
133
  &-content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.33.0-beta.0",
3
+ "version": "2.33.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -23,7 +23,7 @@
23
23
  "*.scss",
24
24
  "*.css"
25
25
  ],
26
- "gitHead": "270966db4a563cf7b8670dc7d6b568858c5f9060",
26
+ "gitHead": "0fdea7209b852a6d18f2139013d2da13dc111244",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",
@@ -116,6 +116,18 @@ $module: #{$prefix}-sidesheet;
116
116
  width: $width-sideSheet_size-large;
117
117
  }
118
118
 
119
+ &-size-small.#{$module} {
120
+ width: $width-sideSheet_size-small;
121
+ }
122
+
123
+ &-size-medium.#{$module} {
124
+ width: $width-sideSheet_size-medium;
125
+ }
126
+
127
+ &-size-large.#{$module} {
128
+ width: $width-sideSheet_size-large;
129
+ }
130
+
119
131
 
120
132
 
121
133
  &-content {