@douyinfe/semi-foundation 2.34.1 → 2.34.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.
@@ -178,7 +178,8 @@ export interface DatePickerFoundationState {
178
178
  /** value of trigger input */
179
179
  inputValue: string;
180
180
  value: Date[];
181
- cachedSelectedValue: Date[];
181
+ // Save last selected date, maybe include null
182
+ cachedSelectedValue: (Date | null)[];
182
183
  prevTimeZone: string | number;
183
184
  rangeInputFocus: RangeType;
184
185
  autofocus: boolean;
@@ -357,41 +358,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
357
358
  }
358
359
  }
359
360
 
360
- /**
361
- * @deprecated
362
- * do these side effects when type is dateRange or dateTimeRange
363
- * 1. trigger input blur, if input value is invalid, set input value and state value to previous status
364
- * 2. set cachedSelectedValue using given dates(in needConfirm mode)
365
- * - directly closePanel without click confirm will set cachedSelectedValue to state value
366
- * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
367
- */
368
- // rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]) {
369
- // if (this._isRangeType()) {
370
- // this._adapter.setRangeInputFocus(false);
371
- // /**
372
- // * inputValue is string when it is not disabled or can't parsed
373
- // * when inputValue is null, picker value will back to last selected value
374
- // */
375
- // this.handleInputBlur(inputValue);
376
- // this.resetCachedSelectedValue(willUpdateDates);
377
- // }
378
- // }
379
-
380
- /**
381
- * @deprecated
382
- * clear input value when selected date is not confirmed
383
- */
384
- // needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined) {
385
- // if (this._adapter.needConfirm() && !this._isRangeType()) {
386
- // /**
387
- // * if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
388
- // * if `` input element will show `` directly
389
- // */
390
- // this._adapter.updateInputValue(null);
391
- // this.resetCachedSelectedValue(willUpdateDates);
392
- // }
393
- // }
394
-
395
361
  /**
396
362
  * clear inset input value when close panel
397
363
  */
@@ -1218,32 +1184,29 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
1218
1184
 
1219
1185
  /**
1220
1186
  * Get the date changed through the date panel or enter
1221
- * @param {Date[]} dates
1222
- * @returns {Date[]}
1223
1187
  */
1224
1188
  _getChangedDates(dates: Date[]) {
1225
1189
  const type = this._adapter.getProp('type');
1226
- const stateValue: Date[] = this._adapter.getState('value');
1227
-
1190
+ const { cachedSelectedValue: lastDate } = this._adapter.getStates();
1228
1191
  const changedDates = [];
1229
1192
 
1230
1193
  switch (type) {
1231
1194
  case 'dateRange':
1232
1195
  case 'dateTimeRange':
1233
- const [stateStart, stateEnd] = stateValue;
1196
+ const [lastStart, lastEnd] = lastDate;
1234
1197
  const [start, end] = dates;
1235
- if (!isDateEqual(start, stateStart)) {
1198
+ if (!isDateEqual(start, lastStart)) {
1236
1199
  changedDates.push(start);
1237
1200
  }
1238
- if (!isDateEqual(end, stateEnd)) {
1201
+ if (!isDateEqual(end, lastEnd)) {
1239
1202
  changedDates.push(end);
1240
1203
  }
1241
1204
  break;
1242
1205
  default:
1243
- const stateValueSet = new Set<number>();
1244
- stateValue.forEach(value => stateValueSet.add(isDate(value) && value.valueOf()));
1206
+ const lastValueSet = new Set<number>();
1207
+ lastDate.forEach(value => lastValueSet.add(isDate(value) && value.valueOf()));
1245
1208
  for (const date of dates) {
1246
- if (!stateValueSet.has(isDate(date) && date.valueOf())) {
1209
+ if (!lastValueSet.has(isDate(date) && date.valueOf())) {
1247
1210
  changedDates.push(date);
1248
1211
  }
1249
1212
  }
package/input/input.scss CHANGED
@@ -462,6 +462,9 @@ $module: #{$prefix}-input;
462
462
  &[type="password"]::-ms-clear {
463
463
  display: none;
464
464
  }
465
+ &[type="search"]::-webkit-search-cancel-button {
466
+ display: none;
467
+ }
465
468
 
466
469
  &::placeholder {
467
470
  color: $color-input_placeholder-text-default;
@@ -147,7 +147,7 @@ export interface DatePickerFoundationState {
147
147
  /** value of trigger input */
148
148
  inputValue: string;
149
149
  value: Date[];
150
- cachedSelectedValue: Date[];
150
+ cachedSelectedValue: (Date | null)[];
151
151
  prevTimeZone: string | number;
152
152
  rangeInputFocus: RangeType;
153
153
  autofocus: boolean;
@@ -231,18 +231,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
231
231
  destroy(): void;
232
232
  initPanelOpenStatus(defaultOpen?: boolean): void;
233
233
  openPanel(): void;
234
- /**
235
- * @deprecated
236
- * do these side effects when type is dateRange or dateTimeRange
237
- * 1. trigger input blur, if input value is invalid, set input value and state value to previous status
238
- * 2. set cachedSelectedValue using given dates(in needConfirm mode)
239
- * - directly closePanel without click confirm will set cachedSelectedValue to state value
240
- * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
241
- */
242
- /**
243
- * @deprecated
244
- * clear input value when selected date is not confirmed
245
- */
246
234
  /**
247
235
  * clear inset input value when close panel
248
236
  */
@@ -470,8 +458,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
470
458
  _notifyChange(value: Date[]): void;
471
459
  /**
472
460
  * Get the date changed through the date panel or enter
473
- * @param {Date[]} dates
474
- * @returns {Date[]}
475
461
  */
476
462
  _getChangedDates(dates: Date[]): any[];
477
463
  /**
@@ -247,41 +247,6 @@ class DatePickerFoundation extends _foundation.default {
247
247
  this._adapter.notifyOpenChange(true);
248
248
  }
249
249
  }
250
- /**
251
- * @deprecated
252
- * do these side effects when type is dateRange or dateTimeRange
253
- * 1. trigger input blur, if input value is invalid, set input value and state value to previous status
254
- * 2. set cachedSelectedValue using given dates(in needConfirm mode)
255
- * - directly closePanel without click confirm will set cachedSelectedValue to state value
256
- * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
257
- */
258
- // rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]) {
259
- // if (this._isRangeType()) {
260
- // this._adapter.setRangeInputFocus(false);
261
- // /**
262
- // * inputValue is string when it is not disabled or can't parsed
263
- // * when inputValue is null, picker value will back to last selected value
264
- // */
265
- // this.handleInputBlur(inputValue);
266
- // this.resetCachedSelectedValue(willUpdateDates);
267
- // }
268
- // }
269
-
270
- /**
271
- * @deprecated
272
- * clear input value when selected date is not confirmed
273
- */
274
- // needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined) {
275
- // if (this._adapter.needConfirm() && !this._isRangeType()) {
276
- // /**
277
- // * if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
278
- // * if `` input element will show `` directly
279
- // */
280
- // this._adapter.updateInputValue(null);
281
- // this.resetCachedSelectedValue(willUpdateDates);
282
- // }
283
- // }
284
-
285
250
  /**
286
251
  * clear inset input value when close panel
287
252
  */
@@ -1304,40 +1269,40 @@ class DatePickerFoundation extends _foundation.default {
1304
1269
  }
1305
1270
  /**
1306
1271
  * Get the date changed through the date panel or enter
1307
- * @param {Date[]} dates
1308
- * @returns {Date[]}
1309
1272
  */
1310
1273
 
1311
1274
 
1312
1275
  _getChangedDates(dates) {
1313
1276
  const type = this._adapter.getProp('type');
1314
1277
 
1315
- const stateValue = this._adapter.getState('value');
1278
+ const {
1279
+ cachedSelectedValue: lastDate
1280
+ } = this._adapter.getStates();
1316
1281
 
1317
1282
  const changedDates = [];
1318
1283
 
1319
1284
  switch (type) {
1320
1285
  case 'dateRange':
1321
1286
  case 'dateTimeRange':
1322
- const [stateStart, stateEnd] = stateValue;
1287
+ const [lastStart, lastEnd] = lastDate;
1323
1288
  const [start, end] = dates;
1324
1289
 
1325
- if (!(0, _dateFns.isEqual)(start, stateStart)) {
1290
+ if (!(0, _dateFns.isEqual)(start, lastStart)) {
1326
1291
  changedDates.push(start);
1327
1292
  }
1328
1293
 
1329
- if (!(0, _dateFns.isEqual)(end, stateEnd)) {
1294
+ if (!(0, _dateFns.isEqual)(end, lastEnd)) {
1330
1295
  changedDates.push(end);
1331
1296
  }
1332
1297
 
1333
1298
  break;
1334
1299
 
1335
1300
  default:
1336
- const stateValueSet = new Set();
1337
- stateValue.forEach(value => stateValueSet.add((0, _dateFns.isDate)(value) && value.valueOf()));
1301
+ const lastValueSet = new Set();
1302
+ lastDate.forEach(value => lastValueSet.add((0, _dateFns.isDate)(value) && value.valueOf()));
1338
1303
 
1339
1304
  for (const date of dates) {
1340
- if (!stateValueSet.has((0, _dateFns.isDate)(date) && date.valueOf())) {
1305
+ if (!lastValueSet.has((0, _dateFns.isDate)(date) && date.valueOf())) {
1341
1306
  changedDates.push(date);
1342
1307
  }
1343
1308
  }
@@ -345,6 +345,9 @@
345
345
  .semi-input[type=password]::-ms-reveal, .semi-input[type=password]::-ms-clear {
346
346
  display: none;
347
347
  }
348
+ .semi-input[type=search]::-webkit-search-cancel-button {
349
+ display: none;
350
+ }
348
351
  .semi-input::placeholder {
349
352
  color: var(--semi-color-text-2);
350
353
  }
@@ -462,6 +462,9 @@ $module: #{$prefix}-input;
462
462
  &[type="password"]::-ms-clear {
463
463
  display: none;
464
464
  }
465
+ &[type="search"]::-webkit-search-cancel-button {
466
+ display: none;
467
+ }
465
468
 
466
469
  &::placeholder {
467
470
  color: $color-input_placeholder-text-default;
@@ -147,7 +147,7 @@ export interface DatePickerFoundationState {
147
147
  /** value of trigger input */
148
148
  inputValue: string;
149
149
  value: Date[];
150
- cachedSelectedValue: Date[];
150
+ cachedSelectedValue: (Date | null)[];
151
151
  prevTimeZone: string | number;
152
152
  rangeInputFocus: RangeType;
153
153
  autofocus: boolean;
@@ -231,18 +231,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
231
231
  destroy(): void;
232
232
  initPanelOpenStatus(defaultOpen?: boolean): void;
233
233
  openPanel(): void;
234
- /**
235
- * @deprecated
236
- * do these side effects when type is dateRange or dateTimeRange
237
- * 1. trigger input blur, if input value is invalid, set input value and state value to previous status
238
- * 2. set cachedSelectedValue using given dates(in needConfirm mode)
239
- * - directly closePanel without click confirm will set cachedSelectedValue to state value
240
- * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
241
- */
242
- /**
243
- * @deprecated
244
- * clear input value when selected date is not confirmed
245
- */
246
234
  /**
247
235
  * clear inset input value when close panel
248
236
  */
@@ -470,8 +458,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
470
458
  _notifyChange(value: Date[]): void;
471
459
  /**
472
460
  * Get the date changed through the date panel or enter
473
- * @param {Date[]} dates
474
- * @returns {Date[]}
475
461
  */
476
462
  _getChangedDates(dates: Date[]): any[];
477
463
  /**
@@ -222,41 +222,6 @@ export default class DatePickerFoundation extends BaseFoundation {
222
222
  this._adapter.notifyOpenChange(true);
223
223
  }
224
224
  }
225
- /**
226
- * @deprecated
227
- * do these side effects when type is dateRange or dateTimeRange
228
- * 1. trigger input blur, if input value is invalid, set input value and state value to previous status
229
- * 2. set cachedSelectedValue using given dates(in needConfirm mode)
230
- * - directly closePanel without click confirm will set cachedSelectedValue to state value
231
- * - select one date(which means that the selection value is incomplete) and click confirm also set cachedSelectedValue to state value
232
- */
233
- // rangeTypeSideEffectsWhenClosePanel(inputValue: string, willUpdateDates: Date[]) {
234
- // if (this._isRangeType()) {
235
- // this._adapter.setRangeInputFocus(false);
236
- // /**
237
- // * inputValue is string when it is not disabled or can't parsed
238
- // * when inputValue is null, picker value will back to last selected value
239
- // */
240
- // this.handleInputBlur(inputValue);
241
- // this.resetCachedSelectedValue(willUpdateDates);
242
- // }
243
- // }
244
-
245
- /**
246
- * @deprecated
247
- * clear input value when selected date is not confirmed
248
- */
249
- // needConfirmSideEffectsWhenClosePanel(willUpdateDates: Date[] | null | undefined) {
250
- // if (this._adapter.needConfirm() && !this._isRangeType()) {
251
- // /**
252
- // * if `null` input element will show `cachedSelectedValue` formatted value(format in DateInput render)
253
- // * if `` input element will show `` directly
254
- // */
255
- // this._adapter.updateInputValue(null);
256
- // this.resetCachedSelectedValue(willUpdateDates);
257
- // }
258
- // }
259
-
260
225
  /**
261
226
  * clear inset input value when close panel
262
227
  */
@@ -1282,40 +1247,40 @@ export default class DatePickerFoundation extends BaseFoundation {
1282
1247
  }
1283
1248
  /**
1284
1249
  * Get the date changed through the date panel or enter
1285
- * @param {Date[]} dates
1286
- * @returns {Date[]}
1287
1250
  */
1288
1251
 
1289
1252
 
1290
1253
  _getChangedDates(dates) {
1291
1254
  const type = this._adapter.getProp('type');
1292
1255
 
1293
- const stateValue = this._adapter.getState('value');
1256
+ const {
1257
+ cachedSelectedValue: lastDate
1258
+ } = this._adapter.getStates();
1294
1259
 
1295
1260
  const changedDates = [];
1296
1261
 
1297
1262
  switch (type) {
1298
1263
  case 'dateRange':
1299
1264
  case 'dateTimeRange':
1300
- const [stateStart, stateEnd] = stateValue;
1265
+ const [lastStart, lastEnd] = lastDate;
1301
1266
  const [start, end] = dates;
1302
1267
 
1303
- if (!isDateEqual(start, stateStart)) {
1268
+ if (!isDateEqual(start, lastStart)) {
1304
1269
  changedDates.push(start);
1305
1270
  }
1306
1271
 
1307
- if (!isDateEqual(end, stateEnd)) {
1272
+ if (!isDateEqual(end, lastEnd)) {
1308
1273
  changedDates.push(end);
1309
1274
  }
1310
1275
 
1311
1276
  break;
1312
1277
 
1313
1278
  default:
1314
- const stateValueSet = new Set();
1315
- stateValue.forEach(value => stateValueSet.add(isDate(value) && value.valueOf()));
1279
+ const lastValueSet = new Set();
1280
+ lastDate.forEach(value => lastValueSet.add(isDate(value) && value.valueOf()));
1316
1281
 
1317
1282
  for (const date of dates) {
1318
- if (!stateValueSet.has(isDate(date) && date.valueOf())) {
1283
+ if (!lastValueSet.has(isDate(date) && date.valueOf())) {
1319
1284
  changedDates.push(date);
1320
1285
  }
1321
1286
  }
@@ -345,6 +345,9 @@
345
345
  .semi-input[type=password]::-ms-reveal, .semi-input[type=password]::-ms-clear {
346
346
  display: none;
347
347
  }
348
+ .semi-input[type=search]::-webkit-search-cancel-button {
349
+ display: none;
350
+ }
348
351
  .semi-input::placeholder {
349
352
  color: var(--semi-color-text-2);
350
353
  }
@@ -462,6 +462,9 @@ $module: #{$prefix}-input;
462
462
  &[type="password"]::-ms-clear {
463
463
  display: none;
464
464
  }
465
+ &[type="search"]::-webkit-search-cancel-button {
466
+ display: none;
467
+ }
465
468
 
466
469
  &::placeholder {
467
470
  color: $color-input_placeholder-text-default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.34.1",
3
+ "version": "2.34.2",
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": "810c998a7c1db1cb824fb3c17353ca94c3df067e",
26
+ "gitHead": "4b6cad1d1798554e24ca0c5330e1d5ec353b8964",
27
27
  "devDependencies": {
28
28
  "@babel/plugin-transform-runtime": "^7.15.8",
29
29
  "@babel/preset-env": "^7.15.8",