@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
|
@@ -62,14 +62,6 @@ const parse = (date, formatToken, options) => {
|
|
|
62
62
|
|
|
63
63
|
return toDate(date, options);
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param {string | number | Date} date
|
|
68
|
-
* @param {string} formatToken
|
|
69
|
-
* @param {object} [options]
|
|
70
|
-
* @param {string} [options.timeZone]
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
65
|
/* istanbul ignore next */
|
|
74
66
|
|
|
75
67
|
|
|
@@ -85,21 +77,35 @@ const format = (date, formatToken, options) => {
|
|
|
85
77
|
return dateFnsFormat(date, formatToken, options);
|
|
86
78
|
};
|
|
87
79
|
/**
|
|
80
|
+
* Returns a Date which will format as the local time of any time zone from a specific UTC time
|
|
88
81
|
*
|
|
89
|
-
* @
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```javascript
|
|
84
|
+
* import { utcToZonedTime } from 'date-fns-tz'
|
|
85
|
+
* const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
|
|
86
|
+
* const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
|
|
87
|
+
* renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
|
|
88
|
+
* renderTimeZoneSelect(timeZone) // America/New_York
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @see https://github.com/marnusw/date-fns-tz#utctozonedtime
|
|
93
92
|
*/
|
|
94
93
|
|
|
95
94
|
|
|
96
95
|
const utcToZonedTime = (date, timeZone, options) => dateFnsUtcToZonedTime(date, toIANA(timeZone), options);
|
|
97
96
|
/**
|
|
97
|
+
* Given a date and any time zone, returns a Date with the equivalent UTC time
|
|
98
98
|
*
|
|
99
|
-
* @
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```
|
|
101
|
+
* import { zonedTimeToUtc } from 'date-fns-tz'
|
|
102
|
+
* const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
|
|
103
|
+
* const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
|
|
104
|
+
* const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
|
|
105
|
+
* postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
|
|
103
109
|
*/
|
|
104
110
|
|
|
105
111
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.32.0
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@douyinfe/semi-animation": "2.12.0",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
|
-
"date-fns": "^2.
|
|
14
|
-
"date-fns-tz": "^1.
|
|
13
|
+
"date-fns": "^2.29.3",
|
|
14
|
+
"date-fns-tz": "^1.3.8",
|
|
15
15
|
"lodash": "^4.17.21",
|
|
16
16
|
"memoize-one": "^5.2.1",
|
|
17
17
|
"scroll-into-view-if-needed": "^2.2.24"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "6cf04209adcb1c3ab8d24ba7aec0025394d82d49",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/spin/spin.scss
CHANGED
package/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/table/utils.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/* eslint-disable no-param-reassign */
|
|
3
3
|
/* eslint-disable eqeqeq */
|
|
4
4
|
import {
|
|
5
|
-
cloneDeepWith,
|
|
6
5
|
isEqualWith,
|
|
7
6
|
get,
|
|
8
7
|
filter,
|
|
@@ -21,17 +20,6 @@ import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
|
21
20
|
import Logger from '../utils/Logger';
|
|
22
21
|
|
|
23
22
|
|
|
24
|
-
export function cloneDeep(value: any, customizer?: (v: any) => any) {
|
|
25
|
-
return cloneDeepWith(value, v => {
|
|
26
|
-
if (typeof v === 'function') {
|
|
27
|
-
return v;
|
|
28
|
-
} else if (typeof customizer === 'function') {
|
|
29
|
-
return customizer(v);
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
23
|
export function equalWith(value: any, other: any, customizer?: (...args: any[]) => boolean) {
|
|
36
24
|
return isEqualWith(value, other, (objVal, othVal, ...rest) => {
|
|
37
25
|
if (typeof objVal === 'function' && typeof othVal === 'function') {
|
|
@@ -61,36 +49,6 @@ export function getColumnKey(column: any, keyPropNames: any[]): any {
|
|
|
61
49
|
return key;
|
|
62
50
|
}
|
|
63
51
|
|
|
64
|
-
export function mergeColumns(oldColumns: any[] = [], newColumns: any[] = [], keyPropNames: any[] = null, deep = true) {
|
|
65
|
-
const finalColumns: any[] = [];
|
|
66
|
-
const clone = deep ? cloneDeep : lodashClone;
|
|
67
|
-
|
|
68
|
-
if (deep) {
|
|
69
|
-
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
70
|
-
logger.warn('Should not deep merge columns from foundation since columns may have react elements. Merge columns deep from semi-ui');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
map(newColumns, newColumn => {
|
|
74
|
-
newColumn = { ...newColumn };
|
|
75
|
-
const key = getColumnKey(newColumn, keyPropNames);
|
|
76
|
-
|
|
77
|
-
const oldColumn = key != null && find(oldColumns, item => getColumnKey(item, keyPropNames) === key);
|
|
78
|
-
|
|
79
|
-
if (oldColumn) {
|
|
80
|
-
finalColumns.push(
|
|
81
|
-
clone({
|
|
82
|
-
...oldColumn,
|
|
83
|
-
...newColumn,
|
|
84
|
-
})
|
|
85
|
-
);
|
|
86
|
-
} else {
|
|
87
|
-
finalColumns.push(clone(newColumn));
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
return finalColumns;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
52
|
/**
|
|
95
53
|
*
|
|
96
54
|
* @param {Array<number>} arr
|
|
@@ -437,7 +395,7 @@ export function mergeQueries(query: Record<string, any>, queries: Record<string,
|
|
|
437
395
|
* @param {Object[]} newColumns
|
|
438
396
|
*/
|
|
439
397
|
export function withResizeWidth(columns: Record<string, any>[], newColumns: Record<string, any>[]) {
|
|
440
|
-
const _newColumns =
|
|
398
|
+
const _newColumns = { ...newColumns };
|
|
441
399
|
for (const column of columns) {
|
|
442
400
|
if (!isNullOrUndefined(column.width)) {
|
|
443
401
|
const currentColumn = column.key;
|
package/table/variables.scss
CHANGED
|
@@ -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/tree/tree.scss
CHANGED
package/treeSelect/foundation.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface BasicTriggerRenderProps {
|
|
|
49
49
|
value: BasicTreeNodeData[];
|
|
50
50
|
onClear: (e: any) => void;
|
|
51
51
|
onSearch: (inputValue: string) => void;
|
|
52
|
-
onRemove: (
|
|
52
|
+
onRemove: (key: string) => void
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export type BasicOnChangeWithObject = (node: BasicTreeNodeData[] | BasicTreeNodeData, e: any) => void;
|
package/upload/upload.scss
CHANGED
package/utils/date-fns-extra.ts
CHANGED
|
@@ -100,15 +100,8 @@ const parse = (date: string | number | Date, formatToken: string, options?: any)
|
|
|
100
100
|
return toDate(date, options);
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* @param {string | number | Date} date
|
|
106
|
-
* @param {string} formatToken
|
|
107
|
-
* @param {object} [options]
|
|
108
|
-
* @param {string} [options.timeZone]
|
|
109
|
-
*/
|
|
110
103
|
/* istanbul ignore next */
|
|
111
|
-
const format = (date:
|
|
104
|
+
const format = (date: number | Date, formatToken: string, options?: any) => {
|
|
112
105
|
if (options && options.timeZone != null && options.timeZone !== '') {
|
|
113
106
|
const timeZone = toIANA(options.timeZone);
|
|
114
107
|
options = { ...options, timeZone };
|
|
@@ -120,22 +113,36 @@ const format = (date: string | number | Date, formatToken: string, options?: any
|
|
|
120
113
|
};
|
|
121
114
|
|
|
122
115
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* @
|
|
126
|
-
*
|
|
127
|
-
*
|
|
116
|
+
* Returns a Date which will format as the local time of any time zone from a specific UTC time
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```javascript
|
|
120
|
+
* import { utcToZonedTime } from 'date-fns-tz'
|
|
121
|
+
* const { isoDate, timeZone } = fetchInitialValues() // 2014-06-25T10:00:00.000Z, America/New_York
|
|
122
|
+
* const date = utcToZonedTime(isoDate, timeZone) // In June 10am UTC is 6am in New York (-04:00)
|
|
123
|
+
* renderDatePicker(date) // 2014-06-25 06:00:00 (in the system time zone)
|
|
124
|
+
* renderTimeZoneSelect(timeZone) // America/New_York
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* @see https://github.com/marnusw/date-fns-tz#utctozonedtime
|
|
128
128
|
*/
|
|
129
|
-
const utcToZonedTime = (date: string | number | Date, timeZone: string, options?: OptionsWithTZ) => dateFnsUtcToZonedTime(date, toIANA(timeZone), options);
|
|
129
|
+
const utcToZonedTime = (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => dateFnsUtcToZonedTime(date, toIANA(timeZone), options);
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
* @
|
|
135
|
-
*
|
|
136
|
-
*
|
|
132
|
+
* Given a date and any time zone, returns a Date with the equivalent UTC time
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```
|
|
136
|
+
* import { zonedTimeToUtc } from 'date-fns-tz'
|
|
137
|
+
* const date = getDatePickerValue() // e.g. 2014-06-25 10:00:00 (picked in any time zone)
|
|
138
|
+
* const timeZone = getTimeZoneValue() // e.g. America/Los_Angeles
|
|
139
|
+
* const utcDate = zonedTimeToUtc(date, timeZone) // In June 10am in Los Angeles is 5pm UTC
|
|
140
|
+
* postToServer(utcDate.toISOString(), timeZone) // post 2014-06-25T17:00:00.000Z, America/Los_Angeles
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @see https://github.com/marnusw/date-fns-tz#zonedtimetoutc
|
|
137
144
|
*/
|
|
138
|
-
const zonedTimeToUtc = (date: string | number | Date, timeZone: string, options?: OptionsWithTZ) => dateFnsZonedTimeToUtc(date, toIANA(timeZone), options);
|
|
145
|
+
const zonedTimeToUtc = (date: string | number | Date, timeZone: string | number, options?: OptionsWithTZ) => dateFnsZonedTimeToUtc(date, toIANA(timeZone), options);
|
|
139
146
|
|
|
140
147
|
/**
|
|
141
148
|
* return current system hour offset based on utc:
|