@douyinfe/semi-foundation 2.39.0 → 2.39.2-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/anchor/foundation.ts +0 -2
- package/anchor/linkFoundation.ts +0 -1
- package/autoComplete/foundation.ts +0 -1
- package/autoComplete/optionFoundation.ts +0 -2
- package/avatar/constants.ts +21 -4
- package/avatar/foundation.ts +3 -3
- package/base/foundation.ts +0 -1
- package/breadcrumb/foundation.ts +0 -1
- package/calendar/eventUtil.ts +0 -2
- package/calendar/foundation.ts +0 -1
- package/cascader/foundation.ts +0 -5
- package/checkbox/checkboxFoundation.ts +1 -2
- package/checkbox/checkboxGroupFoundation.ts +0 -1
- package/datePicker/foundation.ts +1 -4
- package/datePicker/inputFoundation.ts +0 -3
- package/datePicker/monthFoundation.ts +0 -1
- package/datePicker/monthsGridFoundation.ts +0 -2
- package/datePicker/yearAndMonthFoundation.ts +0 -2
- package/form/foundation.ts +6 -4
- package/form/interface.ts +0 -1
- package/form/utils.ts +0 -3
- package/image/previewImageFoundation.ts +1 -1
- package/image/previewInnerFoundation.ts +7 -5
- package/input/foundation.ts +0 -2
- package/input/textareaFoundation.ts +0 -2
- package/inputNumber/foundation.ts +0 -5
- package/lib/cjs/anchor/foundation.js +0 -2
- package/lib/cjs/anchor/linkFoundation.js +0 -1
- package/lib/cjs/autoComplete/foundation.js +0 -2
- package/lib/cjs/autoComplete/optionFoundation.js +0 -2
- package/lib/cjs/avatar/constants.js +0 -1
- package/lib/cjs/avatar/foundation.js +2 -2
- package/lib/cjs/breadcrumb/foundation.js +0 -2
- package/lib/cjs/calendar/eventUtil.js +0 -2
- package/lib/cjs/calendar/foundation.js +0 -1
- package/lib/cjs/cascader/foundation.js +0 -5
- package/lib/cjs/checkbox/checkboxFoundation.js +0 -1
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +0 -1
- package/lib/cjs/datePicker/foundation.js +0 -5
- package/lib/cjs/datePicker/inputFoundation.js +0 -4
- package/lib/cjs/datePicker/monthFoundation.js +0 -1
- package/lib/cjs/datePicker/monthsGridFoundation.js +0 -3
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +0 -2
- package/lib/cjs/form/foundation.js +6 -5
- package/lib/cjs/form/utils.js +0 -3
- package/lib/cjs/image/previewInnerFoundation.d.ts +3 -2
- package/lib/cjs/input/foundation.js +0 -2
- package/lib/cjs/input/textareaFoundation.js +0 -2
- package/lib/cjs/inputNumber/foundation.js +0 -6
- package/lib/cjs/navigation/NavItem.js +0 -2
- package/lib/cjs/navigation/foundation.js +1 -4
- package/lib/cjs/navigation/itemFoundation.js +0 -1
- package/lib/cjs/navigation/subNavFoundation.js +1 -2
- package/lib/cjs/notification/notificationListFoundation.js +0 -2
- package/lib/cjs/pagination/foundation.d.ts +2 -0
- package/lib/cjs/pagination/foundation.js +16 -4
- package/lib/cjs/popconfirm/popconfirmFoundation.js +0 -2
- package/lib/cjs/radio/radioGroupFoundation.js +0 -1
- package/lib/cjs/radio/radioInnerFoundation.js +0 -1
- package/lib/cjs/rating/foundation.js +0 -2
- package/lib/cjs/select/foundation.js +0 -5
- package/lib/cjs/select/optionFoundation.js +0 -2
- package/lib/cjs/slider/foundation.js +0 -8
- package/lib/cjs/switch/foundation.js +0 -1
- package/lib/cjs/table/bodyFoundation.js +0 -1
- package/lib/cjs/table/constants.js +0 -2
- package/lib/cjs/table/foundation.js +0 -9
- package/lib/cjs/table/tableRowFoundation.js +0 -1
- package/lib/cjs/table/utils.js +0 -4
- package/lib/cjs/tag/constants.js +0 -2
- package/lib/cjs/tagInput/foundation.js +0 -2
- package/lib/cjs/timePicker/foundation.js +0 -2
- package/lib/cjs/timePicker/inputFoundation.js +0 -2
- package/lib/cjs/timePicker/utils/index.js +0 -2
- package/lib/cjs/tooltip/foundation.js +0 -11
- package/lib/cjs/transfer/foundation.js +0 -1
- package/lib/cjs/tree/foundation.js +0 -1
- package/lib/cjs/tree/treeUtil.js +0 -9
- package/lib/cjs/treeSelect/foundation.js +0 -1
- package/lib/cjs/utils/Event.js +0 -1
- package/lib/cjs/utils/date-fns-extra.js +0 -3
- package/lib/cjs/utils/function.js +0 -1
- package/lib/cjs/utils/object.js +0 -4
- package/lib/es/anchor/foundation.js +0 -2
- package/lib/es/anchor/linkFoundation.js +0 -1
- package/lib/es/autoComplete/foundation.js +0 -1
- package/lib/es/autoComplete/optionFoundation.js +0 -2
- package/lib/es/avatar/constants.js +0 -1
- package/lib/es/avatar/foundation.js +2 -2
- package/lib/es/breadcrumb/foundation.js +0 -1
- package/lib/es/calendar/eventUtil.js +0 -2
- package/lib/es/calendar/foundation.js +0 -1
- package/lib/es/cascader/foundation.js +0 -5
- package/lib/es/checkbox/checkboxFoundation.js +0 -1
- package/lib/es/checkbox/checkboxGroupFoundation.js +0 -1
- package/lib/es/datePicker/foundation.js +0 -4
- package/lib/es/datePicker/inputFoundation.js +0 -3
- package/lib/es/datePicker/monthFoundation.js +0 -1
- package/lib/es/datePicker/monthsGridFoundation.js +0 -2
- package/lib/es/datePicker/yearAndMonthFoundation.js +0 -2
- package/lib/es/form/foundation.js +6 -4
- package/lib/es/form/utils.js +0 -3
- package/lib/es/image/previewInnerFoundation.d.ts +3 -2
- package/lib/es/input/foundation.js +0 -2
- package/lib/es/input/textareaFoundation.js +0 -2
- package/lib/es/inputNumber/foundation.js +0 -5
- package/lib/es/navigation/NavItem.js +0 -2
- package/lib/es/navigation/foundation.js +1 -3
- package/lib/es/navigation/itemFoundation.js +0 -1
- package/lib/es/navigation/subNavFoundation.js +1 -2
- package/lib/es/notification/notificationListFoundation.js +0 -1
- package/lib/es/pagination/foundation.d.ts +2 -0
- package/lib/es/pagination/foundation.js +16 -3
- package/lib/es/popconfirm/popconfirmFoundation.js +0 -1
- package/lib/es/radio/radioGroupFoundation.js +0 -1
- package/lib/es/radio/radioInnerFoundation.js +0 -1
- package/lib/es/rating/foundation.js +0 -1
- package/lib/es/select/foundation.js +0 -5
- package/lib/es/select/optionFoundation.js +0 -2
- package/lib/es/slider/foundation.js +0 -7
- package/lib/es/switch/foundation.js +0 -1
- package/lib/es/table/bodyFoundation.js +0 -1
- package/lib/es/table/constants.js +0 -1
- package/lib/es/table/foundation.js +0 -8
- package/lib/es/table/tableRowFoundation.js +0 -1
- package/lib/es/table/utils.js +0 -3
- package/lib/es/tag/constants.js +0 -1
- package/lib/es/tagInput/foundation.js +0 -2
- package/lib/es/timePicker/foundation.js +0 -1
- package/lib/es/timePicker/inputFoundation.js +0 -2
- package/lib/es/timePicker/utils/index.js +0 -1
- package/lib/es/tooltip/foundation.js +0 -10
- package/lib/es/transfer/foundation.js +0 -1
- package/lib/es/tree/foundation.js +0 -1
- package/lib/es/tree/treeUtil.js +0 -9
- package/lib/es/treeSelect/foundation.js +0 -1
- package/lib/es/utils/Event.js +0 -1
- package/lib/es/utils/date-fns-extra.js +0 -2
- package/lib/es/utils/function.js +0 -1
- package/lib/es/utils/object.js +0 -3
- package/modal/modalFoundation.ts +3 -4
- package/navigation/NavItem.ts +0 -2
- package/navigation/foundation.ts +1 -3
- package/navigation/itemFoundation.ts +0 -1
- package/navigation/subNavFoundation.ts +1 -2
- package/notification/notificationListFoundation.ts +0 -2
- package/package.json +3 -3
- package/pagination/foundation.ts +13 -3
- package/popconfirm/popconfirmFoundation.ts +0 -1
- package/radio/radioGroupFoundation.ts +0 -1
- package/radio/radioInnerFoundation.ts +0 -1
- package/rating/foundation.ts +0 -1
- package/select/foundation.ts +0 -5
- package/select/optionFoundation.ts +0 -2
- package/slider/foundation.ts +0 -7
- package/switch/foundation.ts +0 -1
- package/table/bodyFoundation.ts +0 -1
- package/table/constants.ts +0 -1
- package/table/foundation.ts +0 -8
- package/table/tableRowFoundation.ts +0 -1
- package/table/utils.ts +0 -3
- package/tag/constants.ts +19 -2
- package/tagInput/foundation.ts +0 -2
- package/timePicker/foundation.ts +0 -1
- package/timePicker/inputFoundation.ts +0 -2
- package/timePicker/utils/index.ts +0 -1
- package/toast/toastFoundation.ts +1 -4
- package/toast/toastListFoundation.ts +0 -1
- package/tooltip/foundation.ts +0 -10
- package/transfer/foundation.ts +0 -1
- package/tree/foundation.ts +0 -1
- package/tree/treeUtil.ts +1 -10
- package/treeSelect/foundation.ts +0 -1
- package/utils/Event.ts +0 -1
- package/utils/date-fns-extra.ts +0 -2
- package/utils/function.ts +0 -1
- package/utils/object.ts +0 -3
package/anchor/foundation.ts
CHANGED
|
@@ -30,10 +30,8 @@ export default class AnchorFoundation<P = Record<string, any>, S = Record<string
|
|
|
30
30
|
super({ ...AnchorFoundation.defaultAdapter, ...adapter });
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
34
33
|
init = () => {};
|
|
35
34
|
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
37
35
|
destroy = () => {};
|
|
38
36
|
|
|
39
37
|
addLink = (link: string) => {
|
package/anchor/linkFoundation.ts
CHANGED
|
@@ -22,10 +22,8 @@ export default class OptionFoundation extends BaseFoundation<OptionDefaultAdapte
|
|
|
22
22
|
super({ ...adapter });
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
26
25
|
init() {}
|
|
27
26
|
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
29
27
|
destroy() {}
|
|
30
28
|
|
|
31
29
|
onOptionClick(option: BasicOptionProps) {
|
package/avatar/constants.ts
CHANGED
|
@@ -7,9 +7,26 @@ const cssClasses = {
|
|
|
7
7
|
const strings = {
|
|
8
8
|
SHAPE: ['circle', 'square'],
|
|
9
9
|
SIZE: ['extra-extra-small', 'extra-small', 'small', 'default', 'medium', 'large', 'extra-large'],
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
COLOR: [
|
|
11
|
+
'grey',
|
|
12
|
+
'red',
|
|
13
|
+
'pink',
|
|
14
|
+
'purple',
|
|
15
|
+
'violet',
|
|
16
|
+
'indigo',
|
|
17
|
+
'blue',
|
|
18
|
+
'light-blue',
|
|
19
|
+
'cyan',
|
|
20
|
+
'teal',
|
|
21
|
+
'green',
|
|
22
|
+
'light-green',
|
|
23
|
+
'lime',
|
|
24
|
+
'yellow',
|
|
25
|
+
'amber',
|
|
26
|
+
'orange',
|
|
27
|
+
'white',
|
|
28
|
+
],
|
|
29
|
+
OVERLAP_FROM: ['start', 'end'],
|
|
13
30
|
};
|
|
14
31
|
|
|
15
|
-
export { cssClasses, strings };
|
|
32
|
+
export { cssClasses, strings };
|
package/avatar/foundation.ts
CHANGED
|
@@ -14,9 +14,9 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
14
14
|
super({ ...adapter });
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
init() { }
|
|
17
|
+
init() { }
|
|
18
18
|
|
|
19
|
-
destroy() { }
|
|
19
|
+
destroy() { }
|
|
20
20
|
|
|
21
21
|
handleImgLoadError() {
|
|
22
22
|
const { onError } = this.getProps();
|
|
@@ -40,7 +40,7 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
40
40
|
if (target.matches(':focus-visible')) {
|
|
41
41
|
this._adapter.setFocusVisible(true);
|
|
42
42
|
}
|
|
43
|
-
} catch (error){
|
|
43
|
+
} catch (error) {
|
|
44
44
|
warning(true, 'Warning: [Semi Avatar] The current browser does not support the focus-visible');
|
|
45
45
|
}
|
|
46
46
|
}
|
package/base/foundation.ts
CHANGED
|
@@ -8,7 +8,6 @@ import log from '../utils/log';
|
|
|
8
8
|
import { noop } from 'lodash';
|
|
9
9
|
|
|
10
10
|
export type noopFunction = (...args: any) => any;
|
|
11
|
-
// eslint-disable-next-line
|
|
12
11
|
export interface DefaultAdapter<P = Record<string, any>, S = Record<string, any>> {
|
|
13
12
|
getContext(key: string): any;
|
|
14
13
|
getContexts(): any;
|
package/breadcrumb/foundation.ts
CHANGED
package/calendar/eventUtil.ts
CHANGED
|
@@ -251,7 +251,6 @@ export const filterEvents = (events: Map<string, EventObject[]>, start: Date, en
|
|
|
251
251
|
* @returns {arr}
|
|
252
252
|
* filter out event that is not in the week range
|
|
253
253
|
*/
|
|
254
|
-
// eslint-disable-next-line max-len
|
|
255
254
|
export const filterWeeklyEvents = (events: Map<string, EventObject[]>, weekStart: Date, weekStartsOn: weekStartsOnEnum ) => filterEvents(events, weekStart, addDays(endOfWeek(weekStart, { weekStartsOn }), 1));
|
|
256
255
|
|
|
257
256
|
/**
|
|
@@ -331,7 +330,6 @@ export const collectDailyEvents = (events: ParsedRangeEvent[][]) => {
|
|
|
331
330
|
};
|
|
332
331
|
|
|
333
332
|
export const renderDailyEvent = (event: EventObject) => {
|
|
334
|
-
// eslint-disable-next-line prefer-const
|
|
335
333
|
let { start, end, allDay, children } = event;
|
|
336
334
|
let startPos,
|
|
337
335
|
endPos;
|
package/calendar/foundation.ts
CHANGED
package/cascader/foundation.ts
CHANGED
|
@@ -226,7 +226,6 @@ export interface CascaderAdapter extends DefaultAdapter<BasicCascaderProps, Basi
|
|
|
226
226
|
updateFocusState: (focus: boolean) => void
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
// eslint-disable-next-line max-len
|
|
230
229
|
export default class CascaderFoundation extends BaseFoundation<CascaderAdapter, BasicCascaderProps, BasicCascaderInnerData> {
|
|
231
230
|
|
|
232
231
|
constructor(adapter: CascaderAdapter) {
|
|
@@ -259,7 +258,6 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
259
258
|
const valueProp: string | any[] = onChangeWithObject ? [] : 'value';
|
|
260
259
|
if (multiple) {
|
|
261
260
|
const valuePath: BasicValue = [];
|
|
262
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
263
261
|
// @ts-ignore
|
|
264
262
|
item.forEach((checkedKey: string) => {
|
|
265
263
|
const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
|
|
@@ -337,9 +335,7 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
337
335
|
if (isEmpty(keyEntities[selectedKey])) {
|
|
338
336
|
if (includes(selectedKey, 'not-exist-')) {
|
|
339
337
|
/* Get the value behind not-exist- */
|
|
340
|
-
// eslint-disable-next-line prefer-destructuring
|
|
341
338
|
const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
|
|
342
|
-
// eslint-disable-next-line max-depth
|
|
343
339
|
if (isEmpty(keyEntities[targetValue])) {
|
|
344
340
|
cacheValue = targetValue;
|
|
345
341
|
} else {
|
|
@@ -974,7 +970,6 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
974
970
|
}
|
|
975
971
|
return (Object.values(keyEntities) as BasicEntity[])
|
|
976
972
|
.filter(item => item.parentKey === null && !item._notExist)
|
|
977
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
978
973
|
// @ts-ignore
|
|
979
974
|
.sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
|
|
980
975
|
}
|
|
@@ -117,7 +117,7 @@ class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> exten
|
|
|
117
117
|
if (target.matches(':focus-visible')) {
|
|
118
118
|
this._adapter.setFocusVisible(true);
|
|
119
119
|
}
|
|
120
|
-
} catch (error){
|
|
120
|
+
} catch (error) {
|
|
121
121
|
warning(true, 'Warning: [Semi Checkbox] The current browser does not support the focus-visible');
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -127,7 +127,6 @@ class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> exten
|
|
|
127
127
|
this._adapter.setFocusVisible(false);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
131
130
|
destroy() {}
|
|
132
131
|
}
|
|
133
132
|
|
package/datePicker/foundation.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
|
-
/* eslint-disable max-len, max-depth, */
|
|
3
1
|
import { format, isValid, isSameSecond, isEqual as isDateEqual, isDate } from 'date-fns';
|
|
4
2
|
import { get, isObject, isString, isEqual, isFunction } from 'lodash';
|
|
5
3
|
|
|
@@ -568,7 +566,6 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
568
566
|
* @param {String} input
|
|
569
567
|
* @param {Event} e
|
|
570
568
|
*/
|
|
571
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
572
569
|
handleInputBlur(input = '', e?: any) {
|
|
573
570
|
}
|
|
574
571
|
|
|
@@ -624,7 +621,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
624
621
|
this._adapter.setRangeInputFocus(false);
|
|
625
622
|
this._adapter.notifyClear(e);
|
|
626
623
|
}
|
|
627
|
-
|
|
624
|
+
|
|
628
625
|
handleRangeInputBlur(value: any, e: any) {
|
|
629
626
|
}
|
|
630
627
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
1
|
import { cloneDeep, isObject, set, get } from 'lodash';
|
|
3
2
|
import { format as formatFn } from 'date-fns';
|
|
4
3
|
|
|
@@ -111,10 +110,8 @@ export default class InputFoundation extends BaseFoundation<DateInputAdapter> {
|
|
|
111
110
|
super({ ...adapter });
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
115
113
|
init() {}
|
|
116
114
|
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
118
115
|
destroy() {}
|
|
119
116
|
|
|
120
117
|
handleClick(e: any) {
|
|
@@ -114,7 +114,6 @@ export default class CalendarMonthFoundation extends BaseFoundation<MonthAdapter
|
|
|
114
114
|
this._adapter.setWeekDays(weekdays);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
118
117
|
destroy() {}
|
|
119
118
|
|
|
120
119
|
handleClick(day: MonthDayInfo) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { strings } from './constants';
|
|
4
3
|
import {
|
|
@@ -305,7 +304,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
305
304
|
this._initDateRangePickerFromValue(values, true);
|
|
306
305
|
}
|
|
307
306
|
|
|
308
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
309
307
|
destroy() { }
|
|
310
308
|
|
|
311
309
|
/**
|
|
@@ -65,10 +65,8 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
|
|
|
65
65
|
super({ ...adapter });
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
69
68
|
init() {}
|
|
70
69
|
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
72
70
|
destroy() {}
|
|
73
71
|
|
|
74
72
|
selectYear(item: YearScrollItem, panelType?: PanelType) {
|
package/form/foundation.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable prefer-const, max-len */
|
|
2
1
|
import BaseFoundation from '../base/foundation';
|
|
3
2
|
import * as ObjectUtil from '../utils/object';
|
|
4
3
|
import isPromise from '../utils/isPromise';
|
|
@@ -175,14 +174,16 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
175
174
|
maybePromisedErrors = errors;
|
|
176
175
|
}
|
|
177
176
|
if (!maybePromisedErrors) {
|
|
178
|
-
|
|
177
|
+
const _values = this._adapter.cloneDeep(values);
|
|
178
|
+
resolve(_values);
|
|
179
179
|
this.injectErrorToField({});
|
|
180
180
|
} else if (isPromise(maybePromisedErrors)) {
|
|
181
181
|
maybePromisedErrors.then(
|
|
182
182
|
(result: any) => {
|
|
183
183
|
// validate success,clear error
|
|
184
184
|
if (!result) {
|
|
185
|
-
|
|
185
|
+
const _values = this._adapter.cloneDeep(values);
|
|
186
|
+
resolve(_values);
|
|
186
187
|
this.injectErrorToField({});
|
|
187
188
|
} else {
|
|
188
189
|
this.data.errors = result;
|
|
@@ -237,7 +238,8 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
237
238
|
this._adapter.forceUpdate();
|
|
238
239
|
const errors = this.getError();
|
|
239
240
|
if (this._isValid(targetFields)) {
|
|
240
|
-
|
|
241
|
+
const _values = this._adapter.cloneDeep(values);
|
|
242
|
+
resolve(_values);
|
|
241
243
|
} else {
|
|
242
244
|
this._autoScroll();
|
|
243
245
|
reject(errors);
|
package/form/interface.ts
CHANGED
package/form/utils.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* eslint-disable prefer-destructuring */
|
|
2
|
-
/* eslint-disable prefer-const */
|
|
3
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
1
|
import AsyncValidator from 'async-validator';
|
|
5
2
|
import { cloneDeep, toPath } from 'lodash';
|
|
6
3
|
import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, WithFieldOption } from './interface';
|
|
@@ -148,7 +148,7 @@ export default class PreviewImageFoundation<P = Record<string, any>, S = Record<
|
|
|
148
148
|
onWheel = throttle((e: any): void => {
|
|
149
149
|
const { onZoom, zoomStep, maxZoom, minZoom } = this.getProps();
|
|
150
150
|
const { currZoom } = this.getStates();
|
|
151
|
-
let _zoom:number;
|
|
151
|
+
let _zoom: number;
|
|
152
152
|
if (e.deltaY < 0) {
|
|
153
153
|
/* zoom in */
|
|
154
154
|
if (currZoom + zoomStep <= maxZoom) {
|
|
@@ -2,13 +2,14 @@ import BaseFoundation, { DefaultAdapter } from "../base/foundation";
|
|
|
2
2
|
import KeyCode from "../utils/keyCode";
|
|
3
3
|
import { getPreloadImagArr, downloadImage, isTargetEmit } from "./utils";
|
|
4
4
|
|
|
5
|
+
export type RatioType = "adaptation" | "realSize";
|
|
5
6
|
export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
6
7
|
getIsInGroup: () => boolean;
|
|
7
8
|
notifyChange: (index: number, direction: string) => void;
|
|
8
9
|
notifyZoom: (zoom: number, increase: boolean) => void;
|
|
9
10
|
notifyClose: () => void;
|
|
10
11
|
notifyVisibleChange: (visible: boolean) => void;
|
|
11
|
-
notifyRatioChange: (type:
|
|
12
|
+
notifyRatioChange: (type: RatioType) => void;
|
|
12
13
|
notifyRotateChange: (angle: number) => void;
|
|
13
14
|
notifyDownload: (src: string, index: number) => void;
|
|
14
15
|
registerKeyDownListener: () => void;
|
|
@@ -23,6 +24,7 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
23
24
|
enabledBodyScroll: () => void
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
|
|
26
28
|
const NOT_CLOSE_TARGETS = ["icon", "footer"];
|
|
27
29
|
const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
|
|
28
30
|
|
|
@@ -138,7 +140,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
138
140
|
this._adapter.notifyClose();
|
|
139
141
|
}
|
|
140
142
|
|
|
141
|
-
handleAdjustRatio = (type:
|
|
143
|
+
handleAdjustRatio = (type: RatioType) => {
|
|
142
144
|
this.setState({
|
|
143
145
|
ratio: type,
|
|
144
146
|
} as any);
|
|
@@ -174,14 +176,14 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
174
176
|
const { preLoad, preLoadGap, infinite, currentIndex } = this.getProps();
|
|
175
177
|
|
|
176
178
|
const { imgSrc }= this.getStates();
|
|
177
|
-
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1){
|
|
179
|
+
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
|
|
178
180
|
return;
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
const preloadImages = getPreloadImagArr(imgSrc, currentIndex, preLoadGap, infinite);
|
|
182
184
|
const Img = new Image();
|
|
183
185
|
let index = 0;
|
|
184
|
-
function callback(e: any){
|
|
186
|
+
function callback(e: any) {
|
|
185
187
|
index++;
|
|
186
188
|
if (index < preloadImages.length) {
|
|
187
189
|
Img.src = preloadImages[index];
|
|
@@ -208,7 +210,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
208
210
|
preloadSingleImage = () => {
|
|
209
211
|
const { preLoad, preLoadGap, infinite } = this.getProps();
|
|
210
212
|
const { imgSrc, currentIndex, direction, imgLoadStatus } = this.getStates();
|
|
211
|
-
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1){
|
|
213
|
+
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
|
|
212
214
|
return;
|
|
213
215
|
}
|
|
214
216
|
// 根据方向决定preload那个index
|
package/input/foundation.ts
CHANGED
|
@@ -51,7 +51,6 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// eslint-disable-next-line
|
|
55
54
|
setDisable() {}
|
|
56
55
|
|
|
57
56
|
_setInitValue() {
|
|
@@ -120,7 +119,6 @@ class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
120
119
|
if (isNumber(maxLength) && maxLength >= 0 && isFunction(getValueLength) && isString(value)) {
|
|
121
120
|
const valueLength = getValueLength(value);
|
|
122
121
|
if (valueLength > maxLength) {
|
|
123
|
-
// eslint-disable-next-line max-len
|
|
124
122
|
console.warn('[Semi Input] The input character is truncated because the input length exceeds the maximum length limit');
|
|
125
123
|
const truncatedValue = this.handleTruncateValue(value, maxLength);
|
|
126
124
|
return truncatedValue;
|
|
@@ -52,7 +52,6 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
|
|
|
52
52
|
this.setInitValue();
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// eslint-disable-next-line
|
|
56
55
|
destroy() { }
|
|
57
56
|
|
|
58
57
|
setInitValue() {
|
|
@@ -117,7 +116,6 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
|
|
|
117
116
|
if (isNumber(maxLength) && maxLength >= 0 && isFunction(getValueLength) && isString(value)) {
|
|
118
117
|
const valueLength = getValueLength(value);
|
|
119
118
|
if (valueLength > maxLength) {
|
|
120
|
-
// eslint-disable-next-line max-len
|
|
121
119
|
console.warn('[Semi TextArea] The input character is truncated because the input length exceeds the maximum length limit');
|
|
122
120
|
const truncatedValue = this.handleTruncateValue(value, maxLength);
|
|
123
121
|
return truncatedValue;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
/* eslint-disable no-param-reassign */
|
|
3
|
-
/* eslint-disable eqeqeq */
|
|
4
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
5
2
|
import keyCode from '../utils/keyCode';
|
|
6
3
|
import { numbers } from './constants';
|
|
@@ -177,7 +174,6 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
177
174
|
const dotBeginStr = dotIndex > -1 ? valueAfterParser.slice(dotIndex) : '';
|
|
178
175
|
formattedNum += dotBeginStr;
|
|
179
176
|
} else if (precLength < lengthAfterDot) {
|
|
180
|
-
// eslint-disable-next-line max-depth
|
|
181
177
|
for (let i = 0; i < lengthAfterDot - precLength; i++) {
|
|
182
178
|
formattedNum += '0';
|
|
183
179
|
}
|
|
@@ -261,7 +257,6 @@ class InputNumberFoundation extends BaseFoundation<InputNumberAdapter> {
|
|
|
261
257
|
}
|
|
262
258
|
|
|
263
259
|
if (willSetNum != null) {
|
|
264
|
-
// eslint-disable-next-line max-depth
|
|
265
260
|
if (!this._isControlledComponent('value')) {
|
|
266
261
|
this._adapter.setNumber(willSetNum);
|
|
267
262
|
}
|
|
@@ -14,11 +14,9 @@ const prefixCls = _constants.cssClasses.PREFIX;
|
|
|
14
14
|
class AnchorFoundation extends _foundation.default {
|
|
15
15
|
constructor(adapter) {
|
|
16
16
|
var _this;
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
18
17
|
super(Object.assign(Object.assign({}, AnchorFoundation.defaultAdapter), adapter));
|
|
19
18
|
_this = this;
|
|
20
19
|
this.init = () => {};
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
22
20
|
this.destroy = () => {};
|
|
23
21
|
this.addLink = link => {
|
|
24
22
|
this._adapter.addLink(link);
|
|
@@ -12,8 +12,6 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
|
12
12
|
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
13
13
|
var _keyCode = _interopRequireDefault(require("../utils/keyCode"));
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
/* eslint-disable prefer-const, max-len */
|
|
16
|
-
|
|
17
15
|
class AutoCompleteFoundation extends _foundation.default {
|
|
18
16
|
constructor(adapter) {
|
|
19
17
|
super(Object.assign({}, adapter));
|
|
@@ -10,9 +10,7 @@ class OptionFoundation extends _foundation.default {
|
|
|
10
10
|
constructor(adapter) {
|
|
11
11
|
super(Object.assign({}, adapter));
|
|
12
12
|
}
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
14
13
|
init() {}
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
16
14
|
destroy() {}
|
|
17
15
|
onOptionClick(option) {
|
|
18
16
|
const isDisabled = this._isDisabled();
|
|
@@ -12,7 +12,6 @@ exports.cssClasses = cssClasses;
|
|
|
12
12
|
const strings = {
|
|
13
13
|
SHAPE: ['circle', 'square'],
|
|
14
14
|
SIZE: ['extra-extra-small', 'extra-small', 'small', 'default', 'medium', 'large', 'extra-large'],
|
|
15
|
-
// eslint-disable-next-line max-len
|
|
16
15
|
COLOR: ['grey', 'red', 'pink', 'purple', 'violet', 'indigo', 'blue', 'light-blue', 'cyan', 'teal', 'green', 'light-green', 'lime', 'yellow', 'amber', 'orange', 'white'],
|
|
17
16
|
OVERLAP_FROM: ['start', 'end']
|
|
18
17
|
};
|
|
@@ -26,8 +26,8 @@ class AvatarFoundation extends _foundation.default {
|
|
|
26
26
|
this._adapter.setFocusVisible(false);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
init() {}
|
|
30
|
-
destroy() {}
|
|
29
|
+
init() {}
|
|
30
|
+
destroy() {}
|
|
31
31
|
handleImgLoadError() {
|
|
32
32
|
const {
|
|
33
33
|
onError
|
|
@@ -7,8 +7,6 @@ exports.default = void 0;
|
|
|
7
7
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
8
8
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
/* eslint-disable prefer-const */
|
|
11
|
-
|
|
12
10
|
class BreadcrumbFoundation extends _foundation.default {
|
|
13
11
|
constructor(adapter) {
|
|
14
12
|
super(Object.assign({}, adapter));
|
|
@@ -237,7 +237,6 @@ const filterEvents = (events, start, end) => {
|
|
|
237
237
|
* @returns {arr}
|
|
238
238
|
* filter out event that is not in the week range
|
|
239
239
|
*/
|
|
240
|
-
// eslint-disable-next-line max-len
|
|
241
240
|
exports.filterEvents = filterEvents;
|
|
242
241
|
const filterWeeklyEvents = (events, weekStart, weekStartsOn) => filterEvents(events, weekStart, (0, _dateFns.addDays)((0, _dateFns.endOfWeek)(weekStart, {
|
|
243
242
|
weekStartsOn
|
|
@@ -306,7 +305,6 @@ const collectDailyEvents = events => {
|
|
|
306
305
|
};
|
|
307
306
|
exports.collectDailyEvents = collectDailyEvents;
|
|
308
307
|
const renderDailyEvent = event => {
|
|
309
|
-
// eslint-disable-next-line prefer-const
|
|
310
308
|
let {
|
|
311
309
|
start,
|
|
312
310
|
end,
|
|
@@ -12,7 +12,6 @@ class CalendarFoundation extends _foundation.default {
|
|
|
12
12
|
constructor(adapter) {
|
|
13
13
|
super(Object.assign({}, adapter));
|
|
14
14
|
}
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
16
15
|
init() {}
|
|
17
16
|
destroy() {
|
|
18
17
|
this.raf && cancelAnimationFrame(this.raf);
|
|
@@ -20,7 +20,6 @@ var _util = require("./util");
|
|
|
20
20
|
var _constants = require("./constants");
|
|
21
21
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
// eslint-disable-next-line max-len
|
|
24
23
|
class CascaderFoundation extends _foundation.default {
|
|
25
24
|
constructor(adapter) {
|
|
26
25
|
super(Object.assign({}, adapter));
|
|
@@ -55,7 +54,6 @@ class CascaderFoundation extends _foundation.default {
|
|
|
55
54
|
const valueProp = onChangeWithObject ? [] : 'value';
|
|
56
55
|
if (multiple) {
|
|
57
56
|
const valuePath = [];
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
59
57
|
// @ts-ignore
|
|
60
58
|
item.forEach(checkedKey => {
|
|
61
59
|
const valuePathItem = this.getItemPropPath(checkedKey, valueProp);
|
|
@@ -122,9 +120,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
122
120
|
if ((0, _isEmpty2.default)(keyEntities[selectedKey])) {
|
|
123
121
|
if ((0, _includes2.default)(selectedKey, 'not-exist-')) {
|
|
124
122
|
/* Get the value behind not-exist- */
|
|
125
|
-
// eslint-disable-next-line prefer-destructuring
|
|
126
123
|
const targetValue = selectedKey.match(/not-exist-(\S*)/)[1];
|
|
127
|
-
// eslint-disable-next-line max-depth
|
|
128
124
|
if ((0, _isEmpty2.default)(keyEntities[targetValue])) {
|
|
129
125
|
cacheValue = targetValue;
|
|
130
126
|
} else {
|
|
@@ -812,7 +808,6 @@ class CascaderFoundation extends _foundation.default {
|
|
|
812
808
|
return this.getFilteredData();
|
|
813
809
|
}
|
|
814
810
|
return Object.values(keyEntities).filter(item => item.parentKey === null && !item._notExist)
|
|
815
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
816
811
|
// @ts-ignore
|
|
817
812
|
.sort((a, b) => parseInt(a.ind, 10) - parseInt(b.ind, 10));
|
|
818
813
|
}
|
|
@@ -96,7 +96,6 @@ class CheckboxFoundation extends _foundation.default {
|
|
|
96
96
|
setChecked(checked) {
|
|
97
97
|
this._adapter.setNativeControlChecked(checked);
|
|
98
98
|
}
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
100
99
|
destroy() {}
|
|
101
100
|
}
|
|
102
101
|
var _default = CheckboxFoundation;
|
|
@@ -66,7 +66,6 @@ class CheckboxGroupFoundation extends _foundation.default {
|
|
|
66
66
|
(0, _warning.default)(true, 'Warning: [Semi CheckboxGroup] value should be an Array');
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
70
69
|
destroy() {}
|
|
71
70
|
}
|
|
72
71
|
var _default = CheckboxGroupFoundation;
|
|
@@ -22,9 +22,6 @@ var _getInsetInputFormatToken = _interopRequireDefault(require("./_utils/getInse
|
|
|
22
22
|
var _getInsetInputValueFromInsetInputStr = _interopRequireDefault(require("./_utils/getInsetInputValueFromInsetInputStr"));
|
|
23
23
|
var _isValidTimeZone = _interopRequireDefault(require("./_utils/isValidTimeZone"));
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
-
/* eslint-disable no-nested-ternary */
|
|
26
|
-
/* eslint-disable max-len, max-depth, */
|
|
27
|
-
|
|
28
25
|
/**
|
|
29
26
|
* The datePicker foundation.js is responsible for maintaining the date value and the input box value, as well as the callback of both
|
|
30
27
|
* task 1. Accept the selected date change, update the date value, and update the input box value according to the date = > Notify the change
|
|
@@ -388,7 +385,6 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
388
385
|
* @param {String} input
|
|
389
386
|
* @param {Event} e
|
|
390
387
|
*/
|
|
391
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
392
388
|
handleInputBlur() {
|
|
393
389
|
let input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
394
390
|
let e = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -441,7 +437,6 @@ class DatePickerFoundation extends _foundation.default {
|
|
|
441
437
|
this._adapter.setRangeInputFocus(false);
|
|
442
438
|
this._adapter.notifyClear(e);
|
|
443
439
|
}
|
|
444
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
445
440
|
handleRangeInputBlur(value, e) {}
|
|
446
441
|
// Parses input only after user returns
|
|
447
442
|
handleInputComplete() {
|
|
@@ -19,17 +19,13 @@ var _getDefaultPickerDate = _interopRequireDefault(require("./_utils/getDefaultP
|
|
|
19
19
|
var _parser = require("./_utils/parser");
|
|
20
20
|
var _utils = require("./_utils");
|
|
21
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
/* eslint-disable max-len */
|
|
23
|
-
|
|
24
22
|
const KEY_CODE_ENTER = 'Enter';
|
|
25
23
|
const KEY_CODE_TAB = 'Tab';
|
|
26
24
|
class InputFoundation extends _foundation.default {
|
|
27
25
|
constructor(adapter) {
|
|
28
26
|
super(Object.assign({}, adapter));
|
|
29
27
|
}
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
31
28
|
init() {}
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
33
29
|
destroy() {}
|
|
34
30
|
handleClick(e) {
|
|
35
31
|
this._adapter.notifyClick(e);
|