@douyinfe/semi-foundation 2.32.0-beta.0 → 2.32.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 +18 -13
- 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 +12 -1
- package/lib/cjs/datePicker/foundation.js +20 -12
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +0 -1
- package/lib/cjs/datePicker/monthsGridFoundation.js +4 -11
- 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/treeSelect/foundation.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 +12 -1
- package/lib/es/datePicker/foundation.js +19 -12
- package/lib/es/datePicker/monthsGridFoundation.d.ts +0 -1
- package/lib/es/datePicker/monthsGridFoundation.js +4 -11
- 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/treeSelect/foundation.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
|
@@ -18,30 +18,37 @@ export declare const toIANA: (tz: string | number) => any;
|
|
|
18
18
|
* @returns {Date}
|
|
19
19
|
*/
|
|
20
20
|
declare const parse: (date: string | number | Date, formatToken: string, options?: any) => Date;
|
|
21
|
+
declare const format: (date: number | Date, formatToken: string, options?: any) => string;
|
|
21
22
|
/**
|
|
23
|
+
* Returns a Date which will format as the local time of any time zone from a specific UTC time
|
|
22
24
|
*
|
|
23
|
-
* @
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
* @example
|
|
26
|
+
* ```javascript
|
|
27
|
+
* import { utcToZonedTime } from 'date-fns-tz'
|
|
28
|
+
* const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
|
|
29
|
+
* const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
|
|
30
|
+
* renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
|
|
31
|
+
* renderTimeZoneSelect(timeZone) // America/New_York
|
|
32
|
+
* ```
|
|
30
33
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @param {string} timeZone
|
|
33
|
-
* @param {object} options
|
|
34
|
-
* @returns {Date}
|
|
34
|
+
* @see https://github.com/marnusw/date-fns-tz#utctozonedtime
|
|
35
35
|
*/
|
|
36
|
-
declare const utcToZonedTime: (date: string | number | Date, timeZone: string, options?: OptionsWithTZ) => Date;
|
|
36
|
+
declare const utcToZonedTime: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
|
|
37
37
|
/**
|
|
38
|
+
* Given a date and any time zone, returns a Date with the equivalent UTC time
|
|
38
39
|
*
|
|
39
|
-
* @
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```
|
|
42
|
+
* import { zonedTimeToUtc } from 'date-fns-tz'
|
|
43
|
+
* const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
|
|
44
|
+
* const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
|
|
45
|
+
* const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
|
|
46
|
+
* postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
|
|
43
50
|
*/
|
|
44
|
-
declare const zonedTimeToUtc: (date: string | number | Date, timeZone: string, options?: OptionsWithTZ) => Date;
|
|
51
|
+
declare const zonedTimeToUtc: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
|
|
45
52
|
/**
|
|
46
53
|
* return current system hour offset based on utc:
|
|
47
54
|
*
|
|
@@ -75,14 +75,6 @@ const parse = (date, formatToken, options) => {
|
|
|
75
75
|
|
|
76
76
|
return (0, _dateFnsTz.toDate)(date, options);
|
|
77
77
|
};
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param {string | number | Date} date
|
|
81
|
-
* @param {string} formatToken
|
|
82
|
-
* @param {object} [options]
|
|
83
|
-
* @param {string} [options.timeZone]
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
78
|
/* istanbul ignore next */
|
|
87
79
|
|
|
88
80
|
|
|
@@ -100,11 +92,18 @@ const format = (date, formatToken, options) => {
|
|
|
100
92
|
return (0, _dateFnsTz.format)(date, formatToken, options);
|
|
101
93
|
};
|
|
102
94
|
/**
|
|
95
|
+
* Returns a Date which will format as the local time of any time zone from a specific UTC time
|
|
103
96
|
*
|
|
104
|
-
* @
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```javascript
|
|
99
|
+
* import { utcToZonedTime } from 'date-fns-tz'
|
|
100
|
+
* const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
|
|
101
|
+
* const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
|
|
102
|
+
* renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
|
|
103
|
+
* renderTimeZoneSelect(timeZone) // America/New_York
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see https://github.com/marnusw/date-fns-tz#utctozonedtime
|
|
108
107
|
*/
|
|
109
108
|
|
|
110
109
|
|
|
@@ -112,11 +111,18 @@ exports.format = format;
|
|
|
112
111
|
|
|
113
112
|
const utcToZonedTime = (date, timeZone, options) => (0, _dateFnsTz.utcToZonedTime)(date, toIANA(timeZone), options);
|
|
114
113
|
/**
|
|
114
|
+
* Given a date and any time zone, returns a Date with the equivalent UTC time
|
|
115
115
|
*
|
|
116
|
-
* @
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```
|
|
118
|
+
* import { zonedTimeToUtc } from 'date-fns-tz'
|
|
119
|
+
* const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
|
|
120
|
+
* const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
|
|
121
|
+
* const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
|
|
122
|
+
* postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
|
|
120
126
|
*/
|
|
121
127
|
|
|
122
128
|
|
|
@@ -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
|
/**
|
|
@@ -18,6 +18,7 @@ import { strings } from './constants';
|
|
|
18
18
|
import { strings as inputStrings } from '../input/constants';
|
|
19
19
|
import getInsetInputFormatToken from './_utils/getInsetInputFormatToken';
|
|
20
20
|
import getInsetInputValueFromInsetInputStr from './_utils/getInsetInputValueFromInsetInputStr';
|
|
21
|
+
import isValidTimeZone from './_utils/isValidTimeZone';
|
|
21
22
|
/**
|
|
22
23
|
* The datePicker foundation.js is responsible for maintaining the date value and the input box value, as well as the callback of both
|
|
23
24
|
* task 1. Accept the selected date change, update the date value, and update the input box value according to the date = > Notify the change
|
|
@@ -81,14 +82,6 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
81
82
|
this.initPanelOpenStatus(this.getProp('defaultOpen'));
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
isValidTimeZone(timeZone) {
|
|
85
|
-
const propTimeZone = this.getProp('timeZone');
|
|
86
|
-
|
|
87
|
-
const _timeZone = isNullOrUndefined(timeZone) ? propTimeZone : timeZone;
|
|
88
|
-
|
|
89
|
-
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
85
|
initFromProps(_ref) {
|
|
93
86
|
let {
|
|
94
87
|
value,
|
|
@@ -130,6 +123,19 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
130
123
|
this._adapter.setRangeInputFocus('rangeStart');
|
|
131
124
|
}
|
|
132
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* value 可能是 UTC value 也可能是 zoned value
|
|
128
|
+
*
|
|
129
|
+
* UTC value -> 受控传入的 value
|
|
130
|
+
*
|
|
131
|
+
* zoned value -> statue.value,保存的是当前计算机时区下选择的日期
|
|
132
|
+
*
|
|
133
|
+
* 如果是时区变化,则需要将旧 zoned value 转为新时区下的 zoned value
|
|
134
|
+
*
|
|
135
|
+
* 如果是 value 变化,则不需要传入之前的时区,将 UTC value 转为 zoned value 即可
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
|
|
133
139
|
|
|
134
140
|
parseWithTimezone(value, timeZone, prevTimeZone) {
|
|
135
141
|
const result = [];
|
|
@@ -139,11 +145,11 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
139
145
|
let parsedV = (v || v === 0) && this._parseValue(v);
|
|
140
146
|
|
|
141
147
|
if (parsedV) {
|
|
142
|
-
if (
|
|
148
|
+
if (isValidTimeZone(prevTimeZone)) {
|
|
143
149
|
parsedV = zonedTimeToUtc(parsedV, prevTimeZone);
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
result.push(
|
|
152
|
+
result.push(isValidTimeZone(timeZone) ? utcToZonedTime(parsedV, timeZone) : parsedV);
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
}
|
|
@@ -1209,8 +1215,9 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
1209
1215
|
disposeCallbackArgs(value) {
|
|
1210
1216
|
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
1211
1217
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1218
|
+
const timeZone = this.getProp('timeZone');
|
|
1219
|
+
|
|
1220
|
+
if (isValidTimeZone(timeZone)) {
|
|
1214
1221
|
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
1215
1222
|
}
|
|
1216
1223
|
|
|
@@ -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
|
*
|
|
@@ -11,7 +11,7 @@ import { formatFullDate } from './_utils/getMonthTable';
|
|
|
11
11
|
import { compatibleParse } from './_utils/parser';
|
|
12
12
|
import { zonedTimeToUtc } from '../utils/date-fns-extra';
|
|
13
13
|
import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
|
|
14
|
-
import
|
|
14
|
+
import isValidTimeZone from './_utils/isValidTimeZone';
|
|
15
15
|
const dateDiffFns = {
|
|
16
16
|
month: differenceInCalendarMonths,
|
|
17
17
|
year: differenceInCalendarYears
|
|
@@ -417,14 +417,6 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
417
417
|
locale: dateFnsLocale
|
|
418
418
|
});
|
|
419
419
|
}
|
|
420
|
-
|
|
421
|
-
isValidTimeZone(timeZone) {
|
|
422
|
-
const propTimeZone = this.getProp('timeZone');
|
|
423
|
-
|
|
424
|
-
const _timeZone = isNullOrUndefined(timeZone) ? propTimeZone : timeZone;
|
|
425
|
-
|
|
426
|
-
return ['string', 'number'].includes(typeof _timeZone) && _timeZone !== '';
|
|
427
|
-
}
|
|
428
420
|
/**
|
|
429
421
|
* 根据 type 处理 onChange 返回的参数
|
|
430
422
|
*
|
|
@@ -457,8 +449,9 @@ export default class MonthsGridFoundation extends BaseFoundation {
|
|
|
457
449
|
disposeCallbackArgs(value) {
|
|
458
450
|
let _value = Array.isArray(value) ? value : value && [value] || [];
|
|
459
451
|
|
|
460
|
-
|
|
461
|
-
|
|
452
|
+
const timeZone = this.getProp('timeZone');
|
|
453
|
+
|
|
454
|
+
if (isValidTimeZone(timeZone)) {
|
|
462
455
|
_value = _value.map(date => zonedTimeToUtc(date, timeZone));
|
|
463
456
|
}
|
|
464
457
|
|
package/lib/es/spin/spin.css
CHANGED
package/lib/es/spin/spin.scss
CHANGED
package/lib/es/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/es/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/es/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
|
package/lib/es/table/utils.js
CHANGED
|
@@ -4,27 +4,13 @@ import _includes from "lodash/includes";
|
|
|
4
4
|
import _some from "lodash/some";
|
|
5
5
|
import _findIndex from "lodash/findIndex";
|
|
6
6
|
import _each from "lodash/each";
|
|
7
|
-
import _clone from "lodash/clone";
|
|
8
|
-
import _map from "lodash/map";
|
|
9
7
|
import _find from "lodash/find";
|
|
10
8
|
import _filter from "lodash/filter";
|
|
11
9
|
import _get from "lodash/get";
|
|
12
10
|
import _isEqualWith from "lodash/isEqualWith";
|
|
13
|
-
import _cloneDeepWith from "lodash/cloneDeepWith";
|
|
14
11
|
import { strings, numbers } from './constants';
|
|
15
12
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
16
13
|
import Logger from '../utils/Logger';
|
|
17
|
-
export function cloneDeep(value, customizer) {
|
|
18
|
-
return _cloneDeepWith(value, v => {
|
|
19
|
-
if (typeof v === 'function') {
|
|
20
|
-
return v;
|
|
21
|
-
} else if (typeof customizer === 'function') {
|
|
22
|
-
return customizer(v);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return undefined;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
14
|
export function equalWith(value, other, customizer) {
|
|
29
15
|
return _isEqualWith(value, other, function (objVal, othVal) {
|
|
30
16
|
if (typeof objVal === 'function' && typeof othVal === 'function') {
|
|
@@ -59,34 +45,6 @@ export function getColumnKey(column, keyPropNames) {
|
|
|
59
45
|
|
|
60
46
|
return key;
|
|
61
47
|
}
|
|
62
|
-
export function mergeColumns() {
|
|
63
|
-
let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
64
|
-
let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
65
|
-
let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
66
|
-
let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
67
|
-
const finalColumns = [];
|
|
68
|
-
const clone = deep ? cloneDeep : _clone;
|
|
69
|
-
|
|
70
|
-
if (deep) {
|
|
71
|
-
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
72
|
-
logger.warn('Should not deep merge columns from foundation since columns may have react elements. Merge columns deep from semi-ui');
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
_map(newColumns, newColumn => {
|
|
76
|
-
newColumn = Object.assign({}, newColumn);
|
|
77
|
-
const key = getColumnKey(newColumn, keyPropNames);
|
|
78
|
-
|
|
79
|
-
const oldColumn = key != null && _find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
|
|
80
|
-
|
|
81
|
-
if (oldColumn) {
|
|
82
|
-
finalColumns.push(clone(Object.assign(Object.assign({}, oldColumn), newColumn)));
|
|
83
|
-
} else {
|
|
84
|
-
finalColumns.push(clone(newColumn));
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
return finalColumns;
|
|
89
|
-
}
|
|
90
48
|
/**
|
|
91
49
|
*
|
|
92
50
|
* @param {Array<number>} arr
|
|
@@ -445,7 +403,7 @@ export function mergeQueries(query) {
|
|
|
445
403
|
*/
|
|
446
404
|
|
|
447
405
|
export function withResizeWidth(columns, newColumns) {
|
|
448
|
-
const _newColumns =
|
|
406
|
+
const _newColumns = Object.assign({}, newColumns);
|
|
449
407
|
|
|
450
408
|
for (const column of columns) {
|
|
451
409
|
if (!isNullOrUndefined(column.width)) {
|
|
@@ -75,6 +75,8 @@ $color-table_resizer-bg-default: var(--semi-color-primary); // 表格拉伸标
|
|
|
75
75
|
$color-table_selection-bg-default: rgba(var(--semi-grey-0), 1); // 表格分组背景色
|
|
76
76
|
$color-table_placeholder-text-default: var(--semi-color-text-2); // 表格空数据文本颜色
|
|
77
77
|
|
|
78
|
+
$color-table_cell-bg-hover: var(--semi-color-bg-0); // 让表格在 hover 时正确显示 $color-table_body-bg-hover 颜色,如无必要不要修改
|
|
79
|
+
|
|
78
80
|
// Other
|
|
79
81
|
$font-table_base-fontSize: 14px; // 表格默认文本字号
|
|
80
82
|
$border-table_base-borderStyle: solid; // 表格描边样式
|
package/lib/es/tree/tree.css
CHANGED
package/lib/es/tree/tree.scss
CHANGED
|
@@ -21,7 +21,7 @@ export interface BasicTriggerRenderProps {
|
|
|
21
21
|
value: BasicTreeNodeData[];
|
|
22
22
|
onClear: (e: any) => void;
|
|
23
23
|
onSearch: (inputValue: string) => void;
|
|
24
|
-
onRemove: (
|
|
24
|
+
onRemove: (key: string) => void;
|
|
25
25
|
}
|
|
26
26
|
export declare type BasicOnChangeWithObject = (node: BasicTreeNodeData[] | BasicTreeNodeData, e: any) => void;
|
|
27
27
|
export declare type BasicOnChangeWithBasic = (value: BasicTreeNodeData['value'], node: BasicTreeNodeData[] | BasicTreeNodeData, e: any) => void;
|
package/lib/es/upload/upload.css
CHANGED
|
@@ -18,30 +18,37 @@ export declare const toIANA: (tz: string | number) => any;
|
|
|
18
18
|
* @returns {Date}
|
|
19
19
|
*/
|
|
20
20
|
declare const parse: (date: string | number | Date, formatToken: string, options?: any) => Date;
|
|
21
|
+
declare const format: (date: number | Date, formatToken: string, options?: any) => string;
|
|
21
22
|
/**
|
|
23
|
+
* Returns a Date which will format as the local time of any time zone from a specific UTC time
|
|
22
24
|
*
|
|
23
|
-
* @
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
* @example
|
|
26
|
+
* ```javascript
|
|
27
|
+
* import { utcToZonedTime } from 'date-fns-tz'
|
|
28
|
+
* const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
|
|
29
|
+
* const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
|
|
30
|
+
* renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
|
|
31
|
+
* renderTimeZoneSelect(timeZone) // America/New_York
|
|
32
|
+
* ```
|
|
30
33
|
*
|
|
31
|
-
* @
|
|
32
|
-
* @param {string} timeZone
|
|
33
|
-
* @param {object} options
|
|
34
|
-
* @returns {Date}
|
|
34
|
+
* @see https://github.com/marnusw/date-fns-tz#utctozonedtime
|
|
35
35
|
*/
|
|
36
|
-
declare const utcToZonedTime: (date: string | number | Date, timeZone: string, options?: OptionsWithTZ) => Date;
|
|
36
|
+
declare const utcToZonedTime: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
|
|
37
37
|
/**
|
|
38
|
+
* Given a date and any time zone, returns a Date with the equivalent UTC time
|
|
38
39
|
*
|
|
39
|
-
* @
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```
|
|
42
|
+
* import { zonedTimeToUtc } from 'date-fns-tz'
|
|
43
|
+
* const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
|
|
44
|
+
* const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
|
|
45
|
+
* const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
|
|
46
|
+
* postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
|
|
43
50
|
*/
|
|
44
|
-
declare const zonedTimeToUtc: (date: string | number | Date, timeZone: string, options?: OptionsWithTZ) => Date;
|
|
51
|
+
declare const zonedTimeToUtc: (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => Date;
|
|
45
52
|
/**
|
|
46
53
|
* return current system hour offset based on utc:
|
|
47
54
|
*
|