@douyinfe/semi-foundation 2.32.0-beta.0 → 2.32.1-alpha.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.
- package/autoComplete/autoComplete.scss +2 -0
- package/datePicker/_utils/isValidTimeZone.ts +3 -0
- package/datePicker/foundation.ts +32 -27
- package/datePicker/inputFoundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +3 -9
- package/lib/cjs/autoComplete/autoComplete.css +1 -0
- package/lib/cjs/autoComplete/autoComplete.scss +2 -0
- package/lib/cjs/datePicker/_utils/isValidTimeZone.d.ts +1 -0
- package/lib/cjs/datePicker/_utils/isValidTimeZone.js +10 -0
- package/lib/cjs/datePicker/foundation.d.ts +15 -3
- package/lib/cjs/datePicker/foundation.js +34 -26
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +0 -1
- package/lib/cjs/datePicker/monthsGridFoundation.js +4 -11
- package/lib/cjs/overflowList/constants.d.ts +1 -1
- package/lib/cjs/spin/spin.css +1 -0
- package/lib/cjs/spin/spin.scss +1 -0
- package/lib/cjs/table/table.css +4 -3
- package/lib/cjs/table/table.scss +6 -3
- package/lib/cjs/table/utils.d.ts +52 -3
- package/lib/cjs/table/utils.js +1 -48
- package/lib/cjs/table/variables.scss +2 -0
- package/lib/cjs/tree/tree.css +1 -0
- package/lib/cjs/tree/tree.scss +1 -0
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +1 -1
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/cjs/upload/upload.css +3 -0
- package/lib/cjs/upload/upload.scss +1 -0
- package/lib/cjs/utils/date-fns-extra.d.ts +24 -17
- package/lib/cjs/utils/date-fns-extra.js +22 -16
- package/lib/es/autoComplete/autoComplete.css +1 -0
- package/lib/es/autoComplete/autoComplete.scss +2 -0
- package/lib/es/datePicker/_utils/isValidTimeZone.d.ts +1 -0
- package/lib/es/datePicker/_utils/isValidTimeZone.js +3 -0
- package/lib/es/datePicker/foundation.d.ts +15 -3
- package/lib/es/datePicker/foundation.js +33 -26
- package/lib/es/datePicker/monthsGridFoundation.d.ts +0 -1
- package/lib/es/datePicker/monthsGridFoundation.js +4 -11
- package/lib/es/overflowList/constants.d.ts +1 -1
- package/lib/es/spin/spin.css +1 -0
- package/lib/es/spin/spin.scss +1 -0
- package/lib/es/table/table.css +4 -3
- package/lib/es/table/table.scss +6 -3
- package/lib/es/table/utils.d.ts +52 -3
- package/lib/es/table/utils.js +1 -43
- package/lib/es/table/variables.scss +2 -0
- package/lib/es/tree/tree.css +1 -0
- package/lib/es/tree/tree.scss +1 -0
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/treeSelect/foundation.d.ts +1 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/lib/es/upload/upload.css +3 -0
- package/lib/es/upload/upload.scss +1 -0
- package/lib/es/utils/date-fns-extra.d.ts +24 -17
- package/lib/es/utils/date-fns-extra.js +22 -16
- package/package.json +4 -4
- package/spin/spin.scss +1 -0
- package/table/table.scss +6 -3
- package/table/utils.ts +1 -43
- package/table/variables.scss +2 -0
- package/tree/tree.scss +1 -0
- package/treeSelect/foundation.ts +1 -1
- package/upload/upload.scss +1 -0
- package/utils/date-fns-extra.ts +27 -20
|
@@ -27,6 +27,8 @@ $module: #{$prefix}-autocomplete;
|
|
|
27
27
|
padding-top: $spacing-autoComplete_loading_wrapper-paddingTop;
|
|
28
28
|
padding-bottom: $spacing-autoComplete_loading_wrapper-paddingBottom;
|
|
29
29
|
cursor: not-allowed;
|
|
30
|
+
// make sure that spin align vertical, no need to make 20px as a spacing token here
|
|
31
|
+
height: 20px;
|
|
30
32
|
// height: $spacing-extra-loose;
|
|
31
33
|
// @include all-center;
|
|
32
34
|
.#{$prefix}-spin {
|
package/datePicker/foundation.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type { ArrayElement, Motion } from '../utils/type';
|
|
|
19
19
|
import type { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
|
|
20
20
|
import type { MonthsGridFoundationProps } from './monthsGridFoundation';
|
|
21
21
|
import type { WeekStartNumber } from './_utils/getMonthTable';
|
|
22
|
+
import isValidTimeZone from './_utils/isValidTimeZone';
|
|
22
23
|
|
|
23
24
|
export type ValidateStatus = ArrayElement<typeof strings.STATUS>;
|
|
24
25
|
export type InputSize = ArrayElement<typeof strings.SIZE_SET>;
|
|
@@ -240,13 +241,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
240
241
|
this.initPanelOpenStatus(this.getProp('defaultOpen'));
|
|
241
242
|
}
|
|
242
243
|
|
|
243
|
-
isValidTimeZone(timeZone?: string | number) {
|
|
244
|
-
const propTimeZone = this.getProp('timeZone');
|
|
245
|
-
const _timeZone = isNullOrUndefined(timeZone) ? propTimeZone : timeZone;
|
|
246
|
-
|
|
247
|
-
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
248
|
-
}
|
|
249
|
-
|
|
250
244
|
initFromProps({ value, timeZone, prevTimeZone }: Pick<DatePickerFoundationProps, 'value' | 'timeZone'> & { prevTimeZone?: string | number }) {
|
|
251
245
|
const _value = (Array.isArray(value) ? [...value] : (value || value === 0) && [value]) || [];
|
|
252
246
|
|
|
@@ -275,17 +269,28 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
275
269
|
}
|
|
276
270
|
}
|
|
277
271
|
|
|
272
|
+
/**
|
|
273
|
+
* value 可能是 UTC value 也可能是 zoned value
|
|
274
|
+
*
|
|
275
|
+
* UTC value -> 受控传入的 value
|
|
276
|
+
*
|
|
277
|
+
* zoned value -> statue.value,保存的是当前计算机时区下选择的日期
|
|
278
|
+
*
|
|
279
|
+
* 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
|
|
280
|
+
*
|
|
281
|
+
* 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
|
|
282
|
+
*
|
|
283
|
+
*/
|
|
278
284
|
parseWithTimezone(value: ValueType, timeZone: string | number, prevTimeZone: string | number) {
|
|
279
285
|
const result: Date[] = [];
|
|
280
286
|
if (Array.isArray(value) && value.length) {
|
|
281
287
|
for (const v of value) {
|
|
282
288
|
let parsedV = (v || v === 0) && this._parseValue(v);
|
|
283
289
|
if (parsedV) {
|
|
284
|
-
if (
|
|
285
|
-
parsedV = zonedTimeToUtc(parsedV, prevTimeZone
|
|
290
|
+
if (isValidTimeZone(prevTimeZone)) {
|
|
291
|
+
parsedV = zonedTimeToUtc(parsedV, prevTimeZone);
|
|
286
292
|
}
|
|
287
|
-
|
|
288
|
-
result.push(this.isValidTimeZone(timeZone) ? utcToZonedTime(parsedV, timeZone as string) : parsedV);
|
|
293
|
+
result.push(isValidTimeZone(timeZone) ? utcToZonedTime(parsedV, timeZone) : parsedV);
|
|
289
294
|
}
|
|
290
295
|
}
|
|
291
296
|
}
|
|
@@ -541,7 +546,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
541
546
|
this._updateValueAndInput(result, input === '', input);
|
|
542
547
|
// Updates the selected value when entering a valid date
|
|
543
548
|
const changedDates = this._getChangedDates(result);
|
|
544
|
-
if (!this._someDateDisabled(changedDates)) {
|
|
549
|
+
if (!this._someDateDisabled(changedDates, result)) {
|
|
545
550
|
if (!isEqual(result, stateValue)) {
|
|
546
551
|
this._notifyChange(result);
|
|
547
552
|
}
|
|
@@ -566,7 +571,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
566
571
|
|
|
567
572
|
if ((result && result.length)) {
|
|
568
573
|
const changedDates = this._getChangedDates(result);
|
|
569
|
-
if (!this._someDateDisabled(changedDates)) {
|
|
574
|
+
if (!this._someDateDisabled(changedDates, result)) {
|
|
570
575
|
if (!isEqual(result, stateValue)) {
|
|
571
576
|
if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
|
|
572
577
|
this._adapter.updateValue(result);
|
|
@@ -586,7 +591,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
586
591
|
_updateCachedSelectedValueFromInput(input: string) {
|
|
587
592
|
const looseResult = this.getLooseDateFromInput(input);
|
|
588
593
|
const changedLooseResult = this._getChangedDates(looseResult);
|
|
589
|
-
if (!this._someDateDisabled(changedLooseResult)) {
|
|
594
|
+
if (!this._someDateDisabled(changedLooseResult, looseResult)) {
|
|
590
595
|
this.resetCachedSelectedValue(looseResult);
|
|
591
596
|
}
|
|
592
597
|
}
|
|
@@ -678,7 +683,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
678
683
|
this._updateValueAndInput(parsedResult);
|
|
679
684
|
const { value: stateValue } = this.getStates();
|
|
680
685
|
const changedDates = this._getChangedDates(parsedResult);
|
|
681
|
-
if (!this._someDateDisabled(changedDates) && !isEqual(parsedResult, stateValue)) {
|
|
686
|
+
if (!this._someDateDisabled(changedDates, parsedResult) && !isEqual(parsedResult, stateValue)) {
|
|
682
687
|
this._notifyChange(parsedResult);
|
|
683
688
|
}
|
|
684
689
|
}
|
|
@@ -978,7 +983,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
978
983
|
|
|
979
984
|
const changedDates = this._getChangedDates(_value);
|
|
980
985
|
// You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
|
|
981
|
-
if (!this._isControlledComponent() && !this._someDateDisabled(changedDates) && !this._adapter.needConfirm()) {
|
|
986
|
+
if (!this._isControlledComponent() && !this._someDateDisabled(changedDates, _value) && !this._adapter.needConfirm()) {
|
|
982
987
|
this._adapter.updateValue(_value);
|
|
983
988
|
}
|
|
984
989
|
}
|
|
@@ -1007,7 +1012,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
1007
1012
|
const changedDates = this._getChangedDates(dates);
|
|
1008
1013
|
|
|
1009
1014
|
let inputValue, insetInputValue;
|
|
1010
|
-
if (!this._someDateDisabled(changedDates)) {
|
|
1015
|
+
if (!this._someDateDisabled(changedDates, dates)) {
|
|
1011
1016
|
this.resetCachedSelectedValue(dates);
|
|
1012
1017
|
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
1013
1018
|
if (insetInput) {
|
|
@@ -1155,9 +1160,9 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
1155
1160
|
*/
|
|
1156
1161
|
disposeCallbackArgs(value: Date | Date[]) {
|
|
1157
1162
|
let _value = Array.isArray(value) ? value : (value && [value]) || [];
|
|
1163
|
+
const timeZone = this.getProp('timeZone');
|
|
1158
1164
|
|
|
1159
|
-
if (
|
|
1160
|
-
const timeZone = this.getProp('timeZone');
|
|
1165
|
+
if (isValidTimeZone(timeZone)) {
|
|
1161
1166
|
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
1162
1167
|
}
|
|
1163
1168
|
const type = this.getProp('type');
|
|
@@ -1247,22 +1252,22 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
1247
1252
|
|
|
1248
1253
|
/**
|
|
1249
1254
|
* Whether a date is disabled
|
|
1250
|
-
* @param
|
|
1255
|
+
* @param value The date that needs to be judged whether to disable
|
|
1256
|
+
* @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
|
|
1251
1257
|
*/
|
|
1252
|
-
_someDateDisabled(value: Date[]) {
|
|
1253
|
-
const stateValue = this.getState('value');
|
|
1258
|
+
_someDateDisabled(value: Date[], selectedValue: Date[]) {
|
|
1254
1259
|
const { rangeInputFocus } = this.getStates();
|
|
1255
1260
|
const disabledOptions = { rangeStart: '', rangeEnd: '', rangeInputFocus };
|
|
1256
1261
|
|
|
1257
1262
|
// DisabledDate needs to pass the second parameter
|
|
1258
|
-
if (this._isRangeType() && Array.isArray(
|
|
1259
|
-
if (isValid(
|
|
1260
|
-
const rangeStart = format(
|
|
1263
|
+
if (this._isRangeType() && Array.isArray(selectedValue)) {
|
|
1264
|
+
if (isValid(selectedValue[0])) {
|
|
1265
|
+
const rangeStart = format(selectedValue[0], 'yyyy-MM-dd');
|
|
1261
1266
|
disabledOptions.rangeStart = rangeStart;
|
|
1262
1267
|
}
|
|
1263
1268
|
|
|
1264
|
-
if (isValid(
|
|
1265
|
-
const rangeEnd = format(
|
|
1269
|
+
if (isValid(selectedValue[1])) {
|
|
1270
|
+
const rangeEnd = format(selectedValue[1], 'yyyy-MM-dd');
|
|
1266
1271
|
disabledOptions.rangeEnd = rangeEnd;
|
|
1267
1272
|
}
|
|
1268
1273
|
}
|
|
@@ -276,7 +276,7 @@ export default class InputFoundation extends BaseFoundation<DateInputAdapter> {
|
|
|
276
276
|
*
|
|
277
277
|
* Parse out insetInputValue from current date value or inputValue
|
|
278
278
|
*/
|
|
279
|
-
getInsetInputValue({ value, insetInputValue }
|
|
279
|
+
getInsetInputValue({ value, insetInputValue }: { value: BaseValueType[]; insetInputValue: InsetInputValue }) {
|
|
280
280
|
const { type, rangeSeparator, format } = this._adapter.getProps();
|
|
281
281
|
|
|
282
282
|
let inputValueStr = '';
|
|
@@ -23,6 +23,7 @@ import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
|
23
23
|
import { BaseValueType, DateInputFoundationProps, PresetPosition, ValueType } from './foundation';
|
|
24
24
|
import { MonthDayInfo } from './monthFoundation';
|
|
25
25
|
import { ArrayElement } from '../utils/type';
|
|
26
|
+
import isValidTimeZone from './_utils/isValidTimeZone';
|
|
26
27
|
|
|
27
28
|
const dateDiffFns = {
|
|
28
29
|
month: differenceInCalendarMonths,
|
|
@@ -448,13 +449,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
448
449
|
return format(date, token, { locale: dateFnsLocale });
|
|
449
450
|
}
|
|
450
451
|
|
|
451
|
-
isValidTimeZone(timeZone?: string | number) {
|
|
452
|
-
const propTimeZone = this.getProp('timeZone');
|
|
453
|
-
const _timeZone = isNullOrUndefined(timeZone) ? propTimeZone : timeZone;
|
|
454
|
-
|
|
455
|
-
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
456
|
-
}
|
|
457
|
-
|
|
458
452
|
/**
|
|
459
453
|
* 根据 type 处理 onChange 返回的参数
|
|
460
454
|
*
|
|
@@ -484,9 +478,9 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
484
478
|
*/
|
|
485
479
|
disposeCallbackArgs(value: Date | Date[]) {
|
|
486
480
|
let _value = Array.isArray(value) ? value : (value && [value]) || [];
|
|
481
|
+
const timeZone = this.getProp('timeZone');
|
|
487
482
|
|
|
488
|
-
if (
|
|
489
|
-
const timeZone = this.getProp('timeZone');
|
|
483
|
+
if (isValidTimeZone(timeZone)) {
|
|
490
484
|
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
491
485
|
}
|
|
492
486
|
const type = this.getProp('type');
|
|
@@ -27,6 +27,8 @@ $module: #{$prefix}-autocomplete;
|
|
|
27
27
|
padding-top: $spacing-autoComplete_loading_wrapper-paddingTop;
|
|
28
28
|
padding-bottom: $spacing-autoComplete_loading_wrapper-paddingBottom;
|
|
29
29
|
cursor: not-allowed;
|
|
30
|
+
// make sure that spin align vertical, no need to make 20px as a spacing token here
|
|
31
|
+
height: 20px;
|
|
30
32
|
// height: $spacing-extra-loose;
|
|
31
33
|
// @include all-center;
|
|
32
34
|
.#{$prefix}-spin {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isValidTimeZone(timeZone?: string | number): boolean;
|
|
@@ -192,7 +192,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
192
192
|
clickConfirmButton: boolean;
|
|
193
193
|
constructor(adapter: DatePickerAdapter);
|
|
194
194
|
init(): void;
|
|
195
|
-
isValidTimeZone(timeZone?: string | number): boolean;
|
|
196
195
|
initFromProps({ value, timeZone, prevTimeZone }: Pick<DatePickerFoundationProps, 'value' | 'timeZone'> & {
|
|
197
196
|
prevTimeZone?: string | number;
|
|
198
197
|
}): void;
|
|
@@ -202,6 +201,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
202
201
|
* If the user passes an empty value, you need to set the range input focus to rangeStart, so that the user can continue to select from the beginning after clearing
|
|
203
202
|
*/
|
|
204
203
|
initRangeInputFocus(result: Date[]): void;
|
|
204
|
+
/**
|
|
205
|
+
* value 可能是 UTC value 也可能是 zoned value
|
|
206
|
+
*
|
|
207
|
+
* UTC value -> 受控传入的 value
|
|
208
|
+
*
|
|
209
|
+
* zoned value -> statue.value,保存的是当前计算机时区下选择的日期
|
|
210
|
+
*
|
|
211
|
+
* 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
|
|
212
|
+
*
|
|
213
|
+
* 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
|
|
214
|
+
*
|
|
215
|
+
*/
|
|
205
216
|
parseWithTimezone(value: ValueType, timeZone: string | number, prevTimeZone: string | number): Date[];
|
|
206
217
|
_isMultiple(): boolean;
|
|
207
218
|
/**
|
|
@@ -464,9 +475,10 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
464
475
|
_getChangedDates(dates: Date[]): any[];
|
|
465
476
|
/**
|
|
466
477
|
* Whether a date is disabled
|
|
467
|
-
* @param
|
|
478
|
+
* @param value The date that needs to be judged whether to disable
|
|
479
|
+
* @param selectedValue Selected date, when selecting a range, pass this date to the second parameter of `disabledDate`
|
|
468
480
|
*/
|
|
469
|
-
_someDateDisabled(value: Date[]): boolean;
|
|
481
|
+
_someDateDisabled(value: Date[], selectedValue: Date[]): boolean;
|
|
470
482
|
/**
|
|
471
483
|
* Format locale date
|
|
472
484
|
* locale get from LocaleProvider
|
|
@@ -37,6 +37,8 @@ var _getInsetInputFormatToken = _interopRequireDefault(require("./_utils/getInse
|
|
|
37
37
|
|
|
38
38
|
var _getInsetInputValueFromInsetInputStr = _interopRequireDefault(require("./_utils/getInsetInputValueFromInsetInputStr"));
|
|
39
39
|
|
|
40
|
+
var _isValidTimeZone = _interopRequireDefault(require("./_utils/isValidTimeZone"));
|
|
41
|
+
|
|
40
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
43
|
|
|
42
44
|
/* eslint-disable no-nested-ternary */
|
|
@@ -105,14 +107,6 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
105
107
|
this.initPanelOpenStatus(this.getProp('defaultOpen'));
|
|
106
108
|
}
|
|
107
109
|
|
|
108
|
-
isValidTimeZone(timeZone) {
|
|
109
|
-
const propTimeZone = this.getProp('timeZone');
|
|
110
|
-
|
|
111
|
-
const _timeZone = (0, _isNullOrUndefined.default)(timeZone) ? propTimeZone : timeZone;
|
|
112
|
-
|
|
113
|
-
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
114
|
-
}
|
|
115
|
-
|
|
116
110
|
initFromProps(_ref) {
|
|
117
111
|
let {
|
|
118
112
|
value,
|
|
@@ -154,6 +148,19 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
154
148
|
this._adapter.setRangeInputFocus('rangeStart');
|
|
155
149
|
}
|
|
156
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* value 可能是 UTC value 也可能是 zoned value
|
|
153
|
+
*
|
|
154
|
+
* UTC value -> 受控传入的 value
|
|
155
|
+
*
|
|
156
|
+
* zoned value -> statue.value,保存的是当前计算机时区下选择的日期
|
|
157
|
+
*
|
|
158
|
+
* 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
|
|
159
|
+
*
|
|
160
|
+
* 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
|
|
161
|
+
*
|
|
162
|
+
*/
|
|
163
|
+
|
|
157
164
|
|
|
158
165
|
parseWithTimezone(value, timeZone, prevTimeZone) {
|
|
159
166
|
const result = [];
|
|
@@ -163,11 +170,11 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
163
170
|
let parsedV = (v || v === 0) && this._parseValue(v);
|
|
164
171
|
|
|
165
172
|
if (parsedV) {
|
|
166
|
-
if (
|
|
173
|
+
if ((0, _isValidTimeZone.default)(prevTimeZone)) {
|
|
167
174
|
parsedV = (0, _dateFnsExtra.zonedTimeToUtc)(parsedV, prevTimeZone);
|
|
168
175
|
}
|
|
169
176
|
|
|
170
|
-
result.push(
|
|
177
|
+
result.push((0, _isValidTimeZone.default)(timeZone) ? (0, _dateFnsExtra.utcToZonedTime)(parsedV, timeZone) : parsedV);
|
|
171
178
|
}
|
|
172
179
|
}
|
|
173
180
|
}
|
|
@@ -469,7 +476,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
469
476
|
|
|
470
477
|
const changedDates = this._getChangedDates(result);
|
|
471
478
|
|
|
472
|
-
if (!this._someDateDisabled(changedDates)) {
|
|
479
|
+
if (!this._someDateDisabled(changedDates, result)) {
|
|
473
480
|
if (!(0, _isEqual2.default)(result, stateValue)) {
|
|
474
481
|
this._notifyChange(result);
|
|
475
482
|
}
|
|
@@ -505,7 +512,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
505
512
|
if (result && result.length) {
|
|
506
513
|
const changedDates = this._getChangedDates(result);
|
|
507
514
|
|
|
508
|
-
if (!this._someDateDisabled(changedDates)) {
|
|
515
|
+
if (!this._someDateDisabled(changedDates, result)) {
|
|
509
516
|
if (!(0, _isEqual2.default)(result, stateValue)) {
|
|
510
517
|
if (!this._isControlledComponent() && !this._adapter.needConfirm()) {
|
|
511
518
|
this._adapter.updateValue(result);
|
|
@@ -532,7 +539,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
532
539
|
|
|
533
540
|
const changedLooseResult = this._getChangedDates(looseResult);
|
|
534
541
|
|
|
535
|
-
if (!this._someDateDisabled(changedLooseResult)) {
|
|
542
|
+
if (!this._someDateDisabled(changedLooseResult, looseResult)) {
|
|
536
543
|
this.resetCachedSelectedValue(looseResult);
|
|
537
544
|
}
|
|
538
545
|
}
|
|
@@ -637,7 +644,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
637
644
|
|
|
638
645
|
const changedDates = this._getChangedDates(parsedResult);
|
|
639
646
|
|
|
640
|
-
if (!this._someDateDisabled(changedDates) && !(0, _isEqual2.default)(parsedResult, stateValue)) {
|
|
647
|
+
if (!this._someDateDisabled(changedDates, parsedResult) && !(0, _isEqual2.default)(parsedResult, stateValue)) {
|
|
641
648
|
this._notifyChange(parsedResult);
|
|
642
649
|
}
|
|
643
650
|
}
|
|
@@ -991,7 +998,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
991
998
|
const changedDates = this._getChangedDates(_value); // You cannot update the value directly when needConfirm, you can only change the value through handleConfirm
|
|
992
999
|
|
|
993
1000
|
|
|
994
|
-
if (!this._isControlledComponent() && !this._someDateDisabled(changedDates) && !this._adapter.needConfirm()) {
|
|
1001
|
+
if (!this._isControlledComponent() && !this._someDateDisabled(changedDates, _value) && !this._adapter.needConfirm()) {
|
|
995
1002
|
this._adapter.updateValue(_value);
|
|
996
1003
|
}
|
|
997
1004
|
}
|
|
@@ -1034,7 +1041,7 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
1034
1041
|
|
|
1035
1042
|
let inputValue, insetInputValue;
|
|
1036
1043
|
|
|
1037
|
-
if (!this._someDateDisabled(changedDates)) {
|
|
1044
|
+
if (!this._someDateDisabled(changedDates, dates)) {
|
|
1038
1045
|
this.resetCachedSelectedValue(dates);
|
|
1039
1046
|
inputValue = this._isMultiple() ? this.formatMultipleDates(dates) : this.formatDates(dates);
|
|
1040
1047
|
|
|
@@ -1230,8 +1237,9 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
1230
1237
|
disposeCallbackArgs(value) {
|
|
1231
1238
|
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
1232
1239
|
|
|
1233
|
-
|
|
1234
|
-
|
|
1240
|
+
const timeZone = this.getProp('timeZone');
|
|
1241
|
+
|
|
1242
|
+
if ((0, _isValidTimeZone.default)(timeZone)) {
|
|
1235
1243
|
_value = _value.map(date => (0, _dateFnsExtra.zonedTimeToUtc)(date, timeZone));
|
|
1236
1244
|
}
|
|
1237
1245
|
|
|
@@ -1340,12 +1348,12 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
1340
1348
|
}
|
|
1341
1349
|
/**
|
|
1342
1350
|
* Whether a date is disabled
|
|
1343
|
-
* @param
|
|
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`
|
|
1344
1353
|
*/
|
|
1345
1354
|
|
|
1346
1355
|
|
|
1347
|
-
_someDateDisabled(value) {
|
|
1348
|
-
const stateValue = this.getState('value');
|
|
1356
|
+
_someDateDisabled(value, selectedValue) {
|
|
1349
1357
|
const {
|
|
1350
1358
|
rangeInputFocus
|
|
1351
1359
|
} = this.getStates();
|
|
@@ -1355,14 +1363,14 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
1355
1363
|
rangeInputFocus
|
|
1356
1364
|
}; // DisabledDate needs to pass the second parameter
|
|
1357
1365
|
|
|
1358
|
-
if (this._isRangeType() && Array.isArray(
|
|
1359
|
-
if ((0, _dateFns.isValid)(
|
|
1360
|
-
const rangeStart = (0, _dateFns.format)(
|
|
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');
|
|
1361
1369
|
disabledOptions.rangeStart = rangeStart;
|
|
1362
1370
|
}
|
|
1363
1371
|
|
|
1364
|
-
if ((0, _dateFns.isValid)(
|
|
1365
|
-
const rangeEnd = (0, _dateFns.format)(
|
|
1372
|
+
if ((0, _dateFns.isValid)(selectedValue[1])) {
|
|
1373
|
+
const rangeEnd = (0, _dateFns.format)(selectedValue[1], 'yyyy-MM-dd');
|
|
1366
1374
|
disabledOptions.rangeEnd = rangeEnd;
|
|
1367
1375
|
}
|
|
1368
1376
|
}
|
|
@@ -158,7 +158,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
158
158
|
* @returns
|
|
159
159
|
*/
|
|
160
160
|
localeFormat(date: Date, token: string): string;
|
|
161
|
-
isValidTimeZone(timeZone?: string | number): boolean;
|
|
162
161
|
/**
|
|
163
162
|
* 根据 type 处理 onChange 返回的参数
|
|
164
163
|
*
|
|
@@ -27,7 +27,7 @@ var _dateFnsExtra = require("../utils/date-fns-extra");
|
|
|
27
27
|
|
|
28
28
|
var _getDefaultFormatToken = require("./_utils/getDefaultFormatToken");
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _isValidTimeZone = _interopRequireDefault(require("./_utils/isValidTimeZone"));
|
|
31
31
|
|
|
32
32
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
33
|
|
|
@@ -438,14 +438,6 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
438
438
|
locale: dateFnsLocale
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
-
|
|
442
|
-
isValidTimeZone(timeZone) {
|
|
443
|
-
const propTimeZone = this.getProp('timeZone');
|
|
444
|
-
|
|
445
|
-
const _timeZone = (0, _isNullOrUndefined.default)(timeZone) ? propTimeZone : timeZone;
|
|
446
|
-
|
|
447
|
-
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
448
|
-
}
|
|
449
441
|
/**
|
|
450
442
|
* 根据 type 处理 onChange 返回的参数
|
|
451
443
|
*
|
|
@@ -478,8 +470,9 @@ class MonthsGridFoundation extends _foundation.default {
|
|
|
478
470
|
disposeCallbackArgs(value) {
|
|
479
471
|
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
480
472
|
|
|
481
|
-
|
|
482
|
-
|
|
473
|
+
const timeZone = this.getProp('timeZone');
|
|
474
|
+
|
|
475
|
+
if ((0, _isValidTimeZone.default)(timeZone)) {
|
|
483
476
|
_value = _value.map(date => (0, _dateFnsExtra.zonedTimeToUtc)(date, timeZone));
|
|
484
477
|
}
|
|
485
478
|
|
package/lib/cjs/spin/spin.css
CHANGED
package/lib/cjs/spin/spin.scss
CHANGED
package/lib/cjs/table/table.css
CHANGED
|
@@ -201,12 +201,14 @@
|
|
|
201
201
|
}
|
|
202
202
|
.semi-table-tbody > .semi-table-row {
|
|
203
203
|
display: table-row;
|
|
204
|
+
background-color: var(--semi-color-bg-1);
|
|
204
205
|
}
|
|
205
206
|
.semi-table-tbody > .semi-table-row:hover > .semi-table-row-cell {
|
|
206
|
-
background-
|
|
207
|
+
background-image: linear-gradient(0deg, var(--semi-color-fill-0), var(--semi-color-fill-0));
|
|
208
|
+
background-color: var(--semi-color-bg-0);
|
|
207
209
|
}
|
|
208
210
|
.semi-table-tbody > .semi-table-row:hover > .semi-table-row-cell.semi-table-cell-fixed-left, .semi-table-tbody > .semi-table-row:hover > .semi-table-row-cell.semi-table-cell-fixed-right {
|
|
209
|
-
background-
|
|
211
|
+
background-image: linear-gradient(0deg, var(--semi-color-bg-1), var(--semi-color-bg-1));
|
|
210
212
|
}
|
|
211
213
|
.semi-table-tbody > .semi-table-row:hover > .semi-table-row-cell.semi-table-cell-fixed-left::before, .semi-table-tbody > .semi-table-row:hover > .semi-table-row-cell.semi-table-cell-fixed-right::before {
|
|
212
214
|
background-color: var(--semi-color-fill-0);
|
|
@@ -230,7 +232,6 @@
|
|
|
230
232
|
box-sizing: border-box;
|
|
231
233
|
position: relative;
|
|
232
234
|
vertical-align: middle;
|
|
233
|
-
background-color: var(--semi-color-bg-1);
|
|
234
235
|
}
|
|
235
236
|
.semi-table-tbody > .semi-table-row > .semi-table-row-cell.resizing {
|
|
236
237
|
border-right: 2px solid var(--semi-color-primary);
|
package/lib/cjs/table/table.scss
CHANGED
|
@@ -209,15 +209,19 @@ $module: #{$prefix}-table;
|
|
|
209
209
|
display: table-row-group;
|
|
210
210
|
& > .#{$module}-row {
|
|
211
211
|
display: table-row;
|
|
212
|
+
background-color: $color-table_body-bg-default;
|
|
212
213
|
|
|
213
214
|
&:hover {
|
|
214
215
|
& > .#{$module}-row-cell {
|
|
215
|
-
background
|
|
216
|
+
// $color-table_body-bg-hover has transparency,will reveal the background color $color-table_body-bg-default\
|
|
217
|
+
// combine background-image and background-color to make the non-fixed column color does not show through the bottom color
|
|
218
|
+
background-image: linear-gradient(0deg, $color-table_body-bg-hover, $color-table_body-bg-hover);
|
|
219
|
+
background-color: $color-table_cell-bg-hover;
|
|
216
220
|
|
|
217
221
|
&.#{$module}-cell-fixed {
|
|
218
222
|
&-left,
|
|
219
223
|
&-right {
|
|
220
|
-
background-
|
|
224
|
+
background-image: linear-gradient(0deg, $color-table_body-bg-default, $color-table_body-bg-default);
|
|
221
225
|
|
|
222
226
|
&::before {
|
|
223
227
|
background-color: $color-table_body-bg-hover;
|
|
@@ -246,7 +250,6 @@ $module: #{$prefix}-table;
|
|
|
246
250
|
box-sizing: border-box;
|
|
247
251
|
position: relative;
|
|
248
252
|
vertical-align: middle;
|
|
249
|
-
background-color: $color-table_body-bg-default;
|
|
250
253
|
|
|
251
254
|
&.resizing {
|
|
252
255
|
border-right: $width-table_resizer_border solid $color-table_resizer-bg-default;
|
package/lib/cjs/table/utils.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { strings } from './constants';
|
|
2
|
-
export declare function cloneDeep(value: any, customizer?: (v: any) => any): any;
|
|
3
2
|
export declare function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean): boolean;
|
|
4
3
|
export declare function getColumnKey(column: any, keyPropNames: any[]): any;
|
|
5
|
-
export declare function mergeColumns(oldColumns?: any[], newColumns?: any[], keyPropNames?: any[], deep?: boolean): any[];
|
|
6
4
|
/**
|
|
7
5
|
*
|
|
8
6
|
* @param {Array<number>} arr
|
|
@@ -81,7 +79,58 @@ export declare function mergeQueries(query: Record<string, any>, queries?: Recor
|
|
|
81
79
|
* @param {Object[]} columns columns retain the column width after resize
|
|
82
80
|
* @param {Object[]} newColumns
|
|
83
81
|
*/
|
|
84
|
-
export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]):
|
|
82
|
+
export declare function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]): {
|
|
83
|
+
[x: number]: Record<string, any>;
|
|
84
|
+
length: number;
|
|
85
|
+
toString(): string;
|
|
86
|
+
toLocaleString(): string;
|
|
87
|
+
pop(): Record<string, any>;
|
|
88
|
+
push(...items: Record<string, any>[]): number;
|
|
89
|
+
concat(...items: ConcatArray<Record<string, any>>[]): Record<string, any>[];
|
|
90
|
+
concat(...items: (Record<string, any> | ConcatArray<Record<string, any>>)[]): Record<string, any>[];
|
|
91
|
+
join(separator?: string): string;
|
|
92
|
+
reverse(): Record<string, any>[];
|
|
93
|
+
shift(): Record<string, any>;
|
|
94
|
+
slice(start?: number, end?: number): Record<string, any>[];
|
|
95
|
+
sort(compareFn?: (a: Record<string, any>, b: Record<string, any>) => number): Record<string, any>[];
|
|
96
|
+
splice(start: number, deleteCount?: number): Record<string, any>[];
|
|
97
|
+
splice(start: number, deleteCount: number, ...items: Record<string, any>[]): Record<string, any>[];
|
|
98
|
+
unshift(...items: Record<string, any>[]): number;
|
|
99
|
+
indexOf(searchElement: Record<string, any>, fromIndex?: number): number;
|
|
100
|
+
lastIndexOf(searchElement: Record<string, any>, fromIndex?: number): number;
|
|
101
|
+
every<S extends Record<string, any>>(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => value is S, thisArg?: any): this is S[];
|
|
102
|
+
every(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): boolean;
|
|
103
|
+
some(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): boolean;
|
|
104
|
+
forEach(callbackfn: (value: Record<string, any>, index: number, array: Record<string, any>[]) => void, thisArg?: any): void;
|
|
105
|
+
map<U>(callbackfn: (value: Record<string, any>, index: number, array: Record<string, any>[]) => U, thisArg?: any): U[];
|
|
106
|
+
filter<S_1 extends Record<string, any>>(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => value is S_1, thisArg?: any): S_1[];
|
|
107
|
+
filter(predicate: (value: Record<string, any>, index: number, array: Record<string, any>[]) => unknown, thisArg?: any): Record<string, any>[];
|
|
108
|
+
reduce(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>): Record<string, any>;
|
|
109
|
+
reduce(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>, initialValue: Record<string, any>): Record<string, any>;
|
|
110
|
+
reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => U_1, initialValue: U_1): U_1;
|
|
111
|
+
reduceRight(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>): Record<string, any>;
|
|
112
|
+
reduceRight(callbackfn: (previousValue: Record<string, any>, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => Record<string, any>, initialValue: Record<string, any>): Record<string, any>;
|
|
113
|
+
reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: Record<string, any>, currentIndex: number, array: Record<string, any>[]) => U_2, initialValue: U_2): U_2;
|
|
114
|
+
find<S_2 extends Record<string, any>>(predicate: (this: void, value: Record<string, any>, index: number, obj: Record<string, any>[]) => value is S_2, thisArg?: any): S_2;
|
|
115
|
+
find(predicate: (value: Record<string, any>, index: number, obj: Record<string, any>[]) => unknown, thisArg?: any): Record<string, any>;
|
|
116
|
+
findIndex(predicate: (value: Record<string, any>, index: number, obj: Record<string, any>[]) => unknown, thisArg?: any): number;
|
|
117
|
+
fill(value: Record<string, any>, start?: number, end?: number): Record<string, any>[];
|
|
118
|
+
copyWithin(target: number, start: number, end?: number): Record<string, any>[];
|
|
119
|
+
entries(): IterableIterator<[number, Record<string, any>]>;
|
|
120
|
+
keys(): IterableIterator<number>;
|
|
121
|
+
values(): IterableIterator<Record<string, any>>;
|
|
122
|
+
includes(searchElement: Record<string, any>, fromIndex?: number): boolean;
|
|
123
|
+
[Symbol.iterator](): IterableIterator<Record<string, any>>;
|
|
124
|
+
[Symbol.unscopables](): {
|
|
125
|
+
copyWithin: boolean;
|
|
126
|
+
entries: boolean;
|
|
127
|
+
fill: boolean;
|
|
128
|
+
find: boolean;
|
|
129
|
+
findIndex: boolean;
|
|
130
|
+
keys: boolean;
|
|
131
|
+
values: boolean;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
85
134
|
/**
|
|
86
135
|
* Pure function version of the same function in table foundation
|
|
87
136
|
* This is not accessible in getDerivedStateFromProps, so fork one out
|