@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
|
@@ -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
|
}
|
|
@@ -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');
|
|
@@ -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
|
/**
|
|
@@ -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
|
}
|
|
@@ -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
|
|
|
@@ -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
|
package/lib/cjs/table/utils.js
CHANGED
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.arrayAdd = arrayAdd;
|
|
7
7
|
exports.assignColumnKeys = assignColumnKeys;
|
|
8
|
-
exports.cloneDeep = cloneDeep;
|
|
9
8
|
exports.equalWith = equalWith;
|
|
10
9
|
exports.expandBtnShouldInRow = expandBtnShouldInRow;
|
|
11
10
|
exports.filterColumns = filterColumns;
|
|
@@ -38,7 +37,6 @@ exports.isScrollbarColumn = isScrollbarColumn;
|
|
|
38
37
|
exports.isSelected = isSelected;
|
|
39
38
|
exports.isSelectionColumn = isSelectionColumn;
|
|
40
39
|
exports.isTreeTable = isTreeTable;
|
|
41
|
-
exports.mergeColumns = mergeColumns;
|
|
42
40
|
exports.mergeQueries = mergeQueries;
|
|
43
41
|
exports.sliceColumnsByLevel = sliceColumnsByLevel;
|
|
44
42
|
exports.warnIfNoDataIndex = warnIfNoDataIndex;
|
|
@@ -56,10 +54,6 @@ var _findIndex2 = _interopRequireDefault(require("lodash/findIndex"));
|
|
|
56
54
|
|
|
57
55
|
var _each2 = _interopRequireDefault(require("lodash/each"));
|
|
58
56
|
|
|
59
|
-
var _clone2 = _interopRequireDefault(require("lodash/clone"));
|
|
60
|
-
|
|
61
|
-
var _map2 = _interopRequireDefault(require("lodash/map"));
|
|
62
|
-
|
|
63
57
|
var _find2 = _interopRequireDefault(require("lodash/find"));
|
|
64
58
|
|
|
65
59
|
var _filter2 = _interopRequireDefault(require("lodash/filter"));
|
|
@@ -68,8 +62,6 @@ var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
|
68
62
|
|
|
69
63
|
var _isEqualWith2 = _interopRequireDefault(require("lodash/isEqualWith"));
|
|
70
64
|
|
|
71
|
-
var _cloneDeepWith2 = _interopRequireDefault(require("lodash/cloneDeepWith"));
|
|
72
|
-
|
|
73
65
|
var _constants = require("./constants");
|
|
74
66
|
|
|
75
67
|
var _isNullOrUndefined = _interopRequireDefault(require("../utils/isNullOrUndefined"));
|
|
@@ -78,18 +70,6 @@ var _Logger = _interopRequireDefault(require("../utils/Logger"));
|
|
|
78
70
|
|
|
79
71
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
80
72
|
|
|
81
|
-
function cloneDeep(value, customizer) {
|
|
82
|
-
return (0, _cloneDeepWith2.default)(value, v => {
|
|
83
|
-
if (typeof v === 'function') {
|
|
84
|
-
return v;
|
|
85
|
-
} else if (typeof customizer === 'function') {
|
|
86
|
-
return customizer(v);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return undefined;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
73
|
function equalWith(value, other, customizer) {
|
|
94
74
|
return (0, _isEqualWith2.default)(value, other, function (objVal, othVal) {
|
|
95
75
|
if (typeof objVal === 'function' && typeof othVal === 'function') {
|
|
@@ -123,33 +103,6 @@ function getColumnKey(column, keyPropNames) {
|
|
|
123
103
|
});
|
|
124
104
|
return key;
|
|
125
105
|
}
|
|
126
|
-
|
|
127
|
-
function mergeColumns() {
|
|
128
|
-
let oldColumns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
129
|
-
let newColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
130
|
-
let keyPropNames = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
131
|
-
let deep = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
132
|
-
const finalColumns = [];
|
|
133
|
-
const clone = deep ? cloneDeep : _clone2.default;
|
|
134
|
-
|
|
135
|
-
if (deep) {
|
|
136
|
-
const logger = new _Logger.default('[@douyinfe/semi-ui Table]');
|
|
137
|
-
logger.warn('Should not deep merge columns from foundation since columns may have react elements. Merge columns deep from semi-ui');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
(0, _map2.default)(newColumns, newColumn => {
|
|
141
|
-
newColumn = Object.assign({}, newColumn);
|
|
142
|
-
const key = getColumnKey(newColumn, keyPropNames);
|
|
143
|
-
const oldColumn = key != null && (0, _find2.default)(oldColumns, item => getColumnKey(item, keyPropNames) === key);
|
|
144
|
-
|
|
145
|
-
if (oldColumn) {
|
|
146
|
-
finalColumns.push(clone(Object.assign(Object.assign({}, oldColumn), newColumn)));
|
|
147
|
-
} else {
|
|
148
|
-
finalColumns.push(clone(newColumn));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
return finalColumns;
|
|
152
|
-
}
|
|
153
106
|
/**
|
|
154
107
|
*
|
|
155
108
|
* @param {Array<number>} arr
|
|
@@ -529,7 +482,7 @@ function mergeQueries(query) {
|
|
|
529
482
|
|
|
530
483
|
|
|
531
484
|
function withResizeWidth(columns, newColumns) {
|
|
532
|
-
const _newColumns =
|
|
485
|
+
const _newColumns = Object.assign({}, newColumns);
|
|
533
486
|
|
|
534
487
|
for (const column of columns) {
|
|
535
488
|
if (!(0, _isNullOrUndefined.default)(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/cjs/tree/tree.css
CHANGED
package/lib/cjs/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;
|