@douyinfe/semi-foundation 2.40.0-alpha.0 → 2.40.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/button/button.scss +0 -1
- package/calendar/eventUtil.ts +0 -2
- package/calendar/foundation.ts +0 -1
- package/cascader/foundation.ts +0 -5
- package/checkbox/checkbox.scss +0 -1
- 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 +12 -10
- package/form/interface.ts +4 -5
- package/form/utils.ts +0 -3
- package/image/image.scss +8 -4
- package/image/previewImageFoundation.ts +1 -1
- package/image/previewInnerFoundation.ts +11 -7
- package/image/variables.scss +1 -1
- 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/button/button.css +0 -1
- package/lib/cjs/button/button.scss +0 -1
- 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/checkbox.css +0 -1
- package/lib/cjs/checkbox/checkbox.scss +0 -1
- 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.d.ts +4 -4
- package/lib/cjs/form/foundation.js +9 -8
- package/lib/cjs/form/interface.d.ts +4 -4
- package/lib/cjs/form/utils.js +0 -3
- package/lib/cjs/image/image.css +3 -1
- package/lib/cjs/image/image.scss +8 -4
- package/lib/cjs/image/previewInnerFoundation.d.ts +4 -2
- package/lib/cjs/image/previewInnerFoundation.js +2 -1
- package/lib/cjs/image/variables.scss +1 -1
- 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/radio.css +1 -0
- package/lib/cjs/radio/radio.scss +1 -0
- package/lib/cjs/radio/radioGroupFoundation.js +0 -1
- package/lib/cjs/radio/radioInnerFoundation.js +0 -1
- package/lib/cjs/radio/variables.scss +1 -0
- 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/select/select.css +0 -35
- package/lib/cjs/select/select.scss +11 -63
- package/lib/cjs/select/variables.scss +0 -10
- package/lib/cjs/skeleton/skeleton.css +2 -2
- package/lib/cjs/skeleton/variables.scss +2 -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 +6 -8
- package/lib/cjs/timePicker/inputFoundation.js +0 -2
- package/lib/cjs/timePicker/utils/index.js +2 -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/upload/foundation.js +3 -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/button/button.css +0 -1
- package/lib/es/button/button.scss +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/checkbox.css +0 -1
- package/lib/es/checkbox/checkbox.scss +0 -1
- 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.d.ts +4 -4
- package/lib/es/form/foundation.js +9 -7
- package/lib/es/form/interface.d.ts +4 -4
- package/lib/es/form/utils.js +0 -3
- package/lib/es/image/image.css +3 -1
- package/lib/es/image/image.scss +8 -4
- package/lib/es/image/previewInnerFoundation.d.ts +4 -2
- package/lib/es/image/previewInnerFoundation.js +2 -1
- package/lib/es/image/variables.scss +1 -1
- 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/radio.css +1 -0
- package/lib/es/radio/radio.scss +1 -0
- package/lib/es/radio/radioGroupFoundation.js +0 -1
- package/lib/es/radio/radioInnerFoundation.js +0 -1
- package/lib/es/radio/variables.scss +1 -0
- 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/select/select.css +0 -35
- package/lib/es/select/select.scss +11 -63
- package/lib/es/select/variables.scss +0 -10
- package/lib/es/skeleton/skeleton.css +2 -2
- package/lib/es/skeleton/variables.scss +2 -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 +6 -7
- package/lib/es/timePicker/inputFoundation.js +0 -2
- package/lib/es/timePicker/utils/index.js +2 -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/upload/foundation.js +3 -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/radio.scss +1 -0
- package/radio/radioGroupFoundation.ts +0 -1
- package/radio/radioInnerFoundation.ts +0 -1
- package/radio/variables.scss +1 -0
- package/rating/foundation.ts +0 -1
- package/select/foundation.ts +0 -5
- package/select/optionFoundation.ts +0 -2
- package/select/select.scss +11 -63
- package/select/variables.scss +0 -10
- package/skeleton/variables.scss +2 -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 +7 -8
- package/timePicker/inputFoundation.ts +0 -2
- package/timePicker/utils/index.ts +2 -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/upload/foundation.ts +3 -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/button/button.scss
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
|
}
|
package/checkbox/checkbox.scss
CHANGED
|
@@ -12,7 +12,6 @@ $module: #{$prefix}-checkbox;
|
|
|
12
12
|
position: relative;
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: flex-start;
|
|
15
|
-
flex-wrap: wrap;
|
|
16
15
|
@include font-size-regular;
|
|
17
16
|
cursor: pointer;
|
|
18
17
|
transition: background-color $transition_duration-checkbox-bg $transition_function-checkbox-bg $transition_delay-checkbox-bg,
|
|
@@ -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,10 +1,9 @@
|
|
|
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';
|
|
5
4
|
import { isValid } from './utils';
|
|
6
5
|
import { isUndefined, isFunction, toPath } from 'lodash';
|
|
7
|
-
import scrollIntoView, { Options as
|
|
6
|
+
import scrollIntoView, { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
|
8
7
|
|
|
9
8
|
import { BaseFormAdapter, FormState, CallOpts, FieldState, FieldStaff, ComponentProps, setValuesConfig, ArrayFieldStaff } from './interface';
|
|
10
9
|
|
|
@@ -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);
|
|
@@ -246,19 +248,19 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
246
248
|
});
|
|
247
249
|
}
|
|
248
250
|
|
|
249
|
-
submit(): void {
|
|
251
|
+
submit(e?: any): void {
|
|
250
252
|
const { values } = this.data;
|
|
251
253
|
// validate form
|
|
252
254
|
this.validate()
|
|
253
255
|
.then((resolveValues: any) => {
|
|
254
256
|
// if valid do submit
|
|
255
257
|
const _values = this._adapter.cloneDeep(resolveValues);
|
|
256
|
-
this._adapter.notifySubmit(_values);
|
|
258
|
+
this._adapter.notifySubmit(_values, e);
|
|
257
259
|
})
|
|
258
260
|
.catch(errors => {
|
|
259
261
|
const _errors = this._adapter.cloneDeep(errors);
|
|
260
262
|
const _values = this._adapter.cloneDeep(values);
|
|
261
|
-
this._adapter.notifySubmitFail(_errors, _values);
|
|
263
|
+
this._adapter.notifySubmitFail(_errors, _values, e);
|
|
262
264
|
});
|
|
263
265
|
}
|
|
264
266
|
|
|
@@ -694,7 +696,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
694
696
|
}
|
|
695
697
|
}
|
|
696
698
|
|
|
697
|
-
_getErrorFieldAndScroll(scrollOpts?:
|
|
699
|
+
_getErrorFieldAndScroll(scrollOpts?: ScrollIntoViewOptions | boolean): void {
|
|
698
700
|
const errorDOM = this._adapter.getAllErrorDOM();
|
|
699
701
|
if (errorDOM && errorDOM.length) {
|
|
700
702
|
try {
|
|
@@ -704,7 +706,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
|
|
|
704
706
|
}
|
|
705
707
|
}
|
|
706
708
|
|
|
707
|
-
scrollToField(field: string, scrollOpts = { behavior: 'smooth', block: 'start' } as
|
|
709
|
+
scrollToField(field: string, scrollOpts = { behavior: 'smooth', block: 'start' } as ScrollIntoViewOptions): void {
|
|
708
710
|
if (this.getFieldExist(field)) {
|
|
709
711
|
const fieldDOM = this._adapter.getFieldDOM(field);
|
|
710
712
|
scrollIntoView(fieldDOM as Element, scrollOpts);
|
package/form/interface.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
2
|
-
/* eslint-disable max-len */
|
|
3
2
|
import { DefaultAdapter } from '../base/foundation';
|
|
4
|
-
import { Options as
|
|
3
|
+
import { Options as ScrollIntoViewOptions } from 'scroll-into-view-if-needed';
|
|
5
4
|
|
|
6
5
|
export type BasicTriggerType = 'blur' | 'change' | 'custom' | 'mount';
|
|
7
6
|
|
|
@@ -13,8 +12,8 @@ export type BasicFieldError = Array<any>;
|
|
|
13
12
|
|
|
14
13
|
export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any>, Values extends object = any> extends DefaultAdapter<P, S> {
|
|
15
14
|
cloneDeep: (val: any, ...rest: any[]) => any;
|
|
16
|
-
notifySubmit: (values: any) => void;
|
|
17
|
-
notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values
|
|
15
|
+
notifySubmit: (values: any, e?: any) => void;
|
|
16
|
+
notifySubmitFail: (errors: Record<keyof Values, BasicFieldError>, values: Partial<Values>, e?: any) => void;
|
|
18
17
|
forceUpdate: (callback?: () => void) => void;
|
|
19
18
|
notifyChange: (formState: FormState) => void;
|
|
20
19
|
notifyValueChange: (values: any, changedValues: any) => void;
|
|
@@ -66,7 +65,7 @@ export interface BaseFormApi<T extends object = any> {
|
|
|
66
65
|
getValues: () => T;
|
|
67
66
|
/** set value of multiple fields */
|
|
68
67
|
setValues: (fieldsValue: Partial<T>, config?: setValuesConfig) => void;
|
|
69
|
-
scrollToField: <K extends keyof T>(field: K, scrollConfig?:
|
|
68
|
+
scrollToField: <K extends keyof T>(field: K, scrollConfig?: ScrollIntoViewOptions) => void
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
export interface CallOpts {
|
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';
|
package/image/image.scss
CHANGED
|
@@ -123,10 +123,14 @@ $module: #{$prefix}-image;
|
|
|
123
123
|
&-footer {
|
|
124
124
|
display: flex;
|
|
125
125
|
align-items: center;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
|
|
127
|
+
&-content {
|
|
128
|
+
padding: $spacing-image_preview_footer-paddingY $spacing-image_preview_footer-paddingX;
|
|
129
|
+
background: $color-image_preview_footer-bg;
|
|
130
|
+
border-radius: $radius-image_preview_footer;
|
|
131
|
+
height: $height-image_preview_footer;
|
|
132
|
+
}
|
|
133
|
+
|
|
130
134
|
|
|
131
135
|
&-wrapper {
|
|
132
136
|
position: absolute;
|
|
@@ -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;
|
|
@@ -20,9 +21,11 @@ export interface PreviewInnerAdapter<P = Record<string, any>, S = Record<string,
|
|
|
20
21
|
setStartMouseDown: (x: number, y: number) => void;
|
|
21
22
|
setMouseActiveTime: (time: number) => void;
|
|
22
23
|
disabledBodyScroll: () => void;
|
|
23
|
-
enabledBodyScroll: () => void
|
|
24
|
+
enabledBodyScroll: () => void;
|
|
25
|
+
getSetDownloadFunc: () => (src: string) => string
|
|
24
26
|
}
|
|
25
27
|
|
|
28
|
+
|
|
26
29
|
const NOT_CLOSE_TARGETS = ["icon", "footer"];
|
|
27
30
|
const STOP_CLOSE_TARGET = ["icon", "footer", "header"];
|
|
28
31
|
|
|
@@ -127,8 +130,9 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
127
130
|
|
|
128
131
|
handleDownload = () => {
|
|
129
132
|
const { currentIndex, imgSrc } = this.getStates();
|
|
133
|
+
const setDownloadName = this._adapter.getSetDownloadFunc();
|
|
130
134
|
const downloadSrc = imgSrc[currentIndex];
|
|
131
|
-
const downloadName = downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
|
|
135
|
+
const downloadName = setDownloadName ? setDownloadName(downloadSrc) : downloadSrc.slice(downloadSrc.lastIndexOf("/") + 1);
|
|
132
136
|
downloadImage(downloadSrc, downloadName);
|
|
133
137
|
this._adapter.notifyDownload(downloadSrc, currentIndex);
|
|
134
138
|
}
|
|
@@ -138,7 +142,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
138
142
|
this._adapter.notifyClose();
|
|
139
143
|
}
|
|
140
144
|
|
|
141
|
-
handleAdjustRatio = (type:
|
|
145
|
+
handleAdjustRatio = (type: RatioType) => {
|
|
142
146
|
this.setState({
|
|
143
147
|
ratio: type,
|
|
144
148
|
} as any);
|
|
@@ -174,14 +178,14 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
174
178
|
const { preLoad, preLoadGap, infinite, currentIndex } = this.getProps();
|
|
175
179
|
|
|
176
180
|
const { imgSrc }= this.getStates();
|
|
177
|
-
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1){
|
|
181
|
+
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
|
|
178
182
|
return;
|
|
179
183
|
}
|
|
180
184
|
|
|
181
185
|
const preloadImages = getPreloadImagArr(imgSrc, currentIndex, preLoadGap, infinite);
|
|
182
186
|
const Img = new Image();
|
|
183
187
|
let index = 0;
|
|
184
|
-
function callback(e: any){
|
|
188
|
+
function callback(e: any) {
|
|
185
189
|
index++;
|
|
186
190
|
if (index < preloadImages.length) {
|
|
187
191
|
Img.src = preloadImages[index];
|
|
@@ -208,7 +212,7 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
208
212
|
preloadSingleImage = () => {
|
|
209
213
|
const { preLoad, preLoadGap, infinite } = this.getProps();
|
|
210
214
|
const { imgSrc, currentIndex, direction, imgLoadStatus } = this.getStates();
|
|
211
|
-
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1){
|
|
215
|
+
if (!preLoad || typeof preLoadGap !== "number" || preLoadGap < 1) {
|
|
212
216
|
return;
|
|
213
217
|
}
|
|
214
218
|
// 根据方向决定preload那个index
|
package/image/variables.scss
CHANGED
|
@@ -27,7 +27,7 @@ $height-image_preview_icon: 40px; // 图像预览footer操作区icon高度
|
|
|
27
27
|
$height-image_preview_header_close: 30px; // 图像预览header部分的关闭热区高度
|
|
28
28
|
|
|
29
29
|
$radius-image: var(--semi-border-radius-small); // 图像圆角
|
|
30
|
-
$radius-image_preview_footer:
|
|
30
|
+
$radius-image_preview_footer: var(--semi-border-radius-medium); // 图像预览footer操作区圆角
|
|
31
31
|
|
|
32
32
|
$color-image_mask-bg: var(--semi-color-overlay-bg); // 图像蒙层背景色
|
|
33
33
|
$color-image_mask_info_text: var(--semi-color-white); // 图像蒙层文字颜色
|
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
|