@douyinfe/semi-foundation 2.47.0 → 2.48.0-beta.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/avatar/foundation.ts +19 -2
- package/input/input.scss +0 -1
- package/lib/cjs/avatar/foundation.d.ts +3 -0
- package/lib/cjs/avatar/foundation.js +20 -1
- package/lib/cjs/input/input.css +0 -1
- package/lib/cjs/input/input.scss +0 -1
- package/lib/cjs/slider/foundation.d.ts +3 -0
- package/lib/cjs/table/table.css +3 -0
- package/lib/cjs/table/table.scss +4 -0
- package/lib/es/avatar/foundation.d.ts +3 -0
- package/lib/es/avatar/foundation.js +20 -1
- package/lib/es/input/input.css +0 -1
- package/lib/es/input/input.scss +0 -1
- package/lib/es/slider/foundation.d.ts +3 -0
- package/lib/es/table/table.css +3 -0
- package/lib/es/table/table.scss +4 -0
- package/package.json +3 -3
- package/slider/foundation.ts +3 -0
- package/table/table.scss +4 -0
package/avatar/foundation.ts
CHANGED
|
@@ -5,7 +5,9 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
5
5
|
notifyImgState(isImgExist: boolean): void;
|
|
6
6
|
notifyLeave(event: any): void;
|
|
7
7
|
notifyEnter(event: any): void;
|
|
8
|
-
setFocusVisible: (focusVisible: boolean) => void
|
|
8
|
+
setFocusVisible: (focusVisible: boolean) => void;
|
|
9
|
+
setScale: (scale: number) => void;
|
|
10
|
+
getAvatarNode: () => HTMLSpanElement
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
|
|
@@ -14,7 +16,12 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
14
16
|
super({ ...adapter });
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
init() {
|
|
19
|
+
init() {
|
|
20
|
+
const { children } = this.getProps();
|
|
21
|
+
if (typeof children === "string") {
|
|
22
|
+
this.changeScale();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
destroy() { }
|
|
20
27
|
|
|
@@ -49,4 +56,14 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
49
56
|
this._adapter.setFocusVisible(false);
|
|
50
57
|
}
|
|
51
58
|
|
|
59
|
+
changeScale = () => {
|
|
60
|
+
const { gap } = this.getProps();
|
|
61
|
+
const node = this._adapter.getAvatarNode();
|
|
62
|
+
const stringNode = node?.firstChild as HTMLSpanElement;
|
|
63
|
+
const [nodeWidth, stringNodeWidth] = [node?.offsetWidth || 0, stringNode?.offsetWidth || 0];
|
|
64
|
+
if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
|
|
65
|
+
const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
|
|
66
|
+
this._adapter.setScale(scale);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
52
69
|
}
|
package/input/input.scss
CHANGED
|
@@ -4,6 +4,8 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
4
4
|
notifyLeave(event: any): void;
|
|
5
5
|
notifyEnter(event: any): void;
|
|
6
6
|
setFocusVisible: (focusVisible: boolean) => void;
|
|
7
|
+
setScale: (scale: number) => void;
|
|
8
|
+
getAvatarNode: () => HTMLSpanElement;
|
|
7
9
|
}
|
|
8
10
|
export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
|
|
9
11
|
constructor(adapter: AvatarAdapter<P, S>);
|
|
@@ -14,4 +16,5 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
14
16
|
handleLeave(e: any): void;
|
|
15
17
|
handleFocusVisible: (event: any) => void;
|
|
16
18
|
handleBlur: () => void;
|
|
19
|
+
changeScale: () => void;
|
|
17
20
|
}
|
|
@@ -25,8 +25,27 @@ class AvatarFoundation extends _foundation.default {
|
|
|
25
25
|
this.handleBlur = () => {
|
|
26
26
|
this._adapter.setFocusVisible(false);
|
|
27
27
|
};
|
|
28
|
+
this.changeScale = () => {
|
|
29
|
+
const {
|
|
30
|
+
gap
|
|
31
|
+
} = this.getProps();
|
|
32
|
+
const node = this._adapter.getAvatarNode();
|
|
33
|
+
const stringNode = node === null || node === void 0 ? void 0 : node.firstChild;
|
|
34
|
+
const [nodeWidth, stringNodeWidth] = [(node === null || node === void 0 ? void 0 : node.offsetWidth) || 0, (stringNode === null || stringNode === void 0 ? void 0 : stringNode.offsetWidth) || 0];
|
|
35
|
+
if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
|
|
36
|
+
const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
|
|
37
|
+
this._adapter.setScale(scale);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
init() {
|
|
42
|
+
const {
|
|
43
|
+
children
|
|
44
|
+
} = this.getProps();
|
|
45
|
+
if (typeof children === "string") {
|
|
46
|
+
this.changeScale();
|
|
47
|
+
}
|
|
28
48
|
}
|
|
29
|
-
init() {}
|
|
30
49
|
destroy() {}
|
|
31
50
|
handleImgLoadError() {
|
|
32
51
|
const {
|
package/lib/cjs/input/input.css
CHANGED
|
@@ -179,7 +179,6 @@
|
|
|
179
179
|
}
|
|
180
180
|
.semi-input-wrapper.semi-input-wrapper__with-prepend-only .semi-input:not(:last-child) {
|
|
181
181
|
border-right-style: none;
|
|
182
|
-
border-radius: 0;
|
|
183
182
|
}
|
|
184
183
|
.semi-input-wrapper.semi-input-wrapper__with-prepend, .semi-input-wrapper.semi-input-wrapper__with-append {
|
|
185
184
|
display: inline-flex;
|
package/lib/cjs/input/input.scss
CHANGED
|
@@ -6,6 +6,7 @@ export type tipFormatterBasicType = string | number | boolean | null;
|
|
|
6
6
|
export interface SliderProps {
|
|
7
7
|
defaultValue?: number | number[];
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
showMarkLabel?: boolean;
|
|
9
10
|
included?: boolean;
|
|
10
11
|
marks?: Marks;
|
|
11
12
|
max?: number;
|
|
@@ -18,8 +19,10 @@ export interface SliderProps {
|
|
|
18
19
|
onAfterChange?: (value: SliderProps['value']) => void;
|
|
19
20
|
onChange?: (value: SliderProps['value']) => void;
|
|
20
21
|
onMouseUp?: (e: any) => void;
|
|
22
|
+
tooltipOnMark?: boolean;
|
|
21
23
|
tooltipVisible?: boolean;
|
|
22
24
|
style?: Record<string, any>;
|
|
25
|
+
showArrow?: boolean;
|
|
23
26
|
className?: string;
|
|
24
27
|
showBoundary?: boolean;
|
|
25
28
|
railStyle?: Record<string, any>;
|
package/lib/cjs/table/table.css
CHANGED
|
@@ -94,6 +94,9 @@
|
|
|
94
94
|
.semi-table-header-sticky .semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
95
95
|
background-color: var(--semi-color-bg-1);
|
|
96
96
|
}
|
|
97
|
+
.semi-table-header-hidden {
|
|
98
|
+
height: 0;
|
|
99
|
+
}
|
|
97
100
|
.semi-table-align-center .semi-table-operate-wrapper {
|
|
98
101
|
justify-content: center;
|
|
99
102
|
}
|
package/lib/cjs/table/table.scss
CHANGED
|
@@ -4,6 +4,8 @@ export interface AvatarAdapter<P = Record<string, any>, S = Record<string, any>>
|
|
|
4
4
|
notifyLeave(event: any): void;
|
|
5
5
|
notifyEnter(event: any): void;
|
|
6
6
|
setFocusVisible: (focusVisible: boolean) => void;
|
|
7
|
+
setScale: (scale: number) => void;
|
|
8
|
+
getAvatarNode: () => HTMLSpanElement;
|
|
7
9
|
}
|
|
8
10
|
export default class AvatarFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<AvatarAdapter<P, S>, P, S> {
|
|
9
11
|
constructor(adapter: AvatarAdapter<P, S>);
|
|
@@ -14,4 +16,5 @@ export default class AvatarFoundation<P = Record<string, any>, S = Record<string
|
|
|
14
16
|
handleLeave(e: any): void;
|
|
15
17
|
handleFocusVisible: (event: any) => void;
|
|
16
18
|
handleBlur: () => void;
|
|
19
|
+
changeScale: () => void;
|
|
17
20
|
}
|
|
@@ -18,8 +18,27 @@ export default class AvatarFoundation extends BaseFoundation {
|
|
|
18
18
|
this.handleBlur = () => {
|
|
19
19
|
this._adapter.setFocusVisible(false);
|
|
20
20
|
};
|
|
21
|
+
this.changeScale = () => {
|
|
22
|
+
const {
|
|
23
|
+
gap
|
|
24
|
+
} = this.getProps();
|
|
25
|
+
const node = this._adapter.getAvatarNode();
|
|
26
|
+
const stringNode = node === null || node === void 0 ? void 0 : node.firstChild;
|
|
27
|
+
const [nodeWidth, stringNodeWidth] = [(node === null || node === void 0 ? void 0 : node.offsetWidth) || 0, (stringNode === null || stringNode === void 0 ? void 0 : stringNode.offsetWidth) || 0];
|
|
28
|
+
if (nodeWidth !== 0 && stringNodeWidth !== 0 && gap * 2 < nodeWidth) {
|
|
29
|
+
const scale = nodeWidth - gap * 2 > stringNodeWidth ? 1 : (nodeWidth - gap * 2) / stringNodeWidth;
|
|
30
|
+
this._adapter.setScale(scale);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
init() {
|
|
35
|
+
const {
|
|
36
|
+
children
|
|
37
|
+
} = this.getProps();
|
|
38
|
+
if (typeof children === "string") {
|
|
39
|
+
this.changeScale();
|
|
40
|
+
}
|
|
21
41
|
}
|
|
22
|
-
init() {}
|
|
23
42
|
destroy() {}
|
|
24
43
|
handleImgLoadError() {
|
|
25
44
|
const {
|
package/lib/es/input/input.css
CHANGED
|
@@ -179,7 +179,6 @@
|
|
|
179
179
|
}
|
|
180
180
|
.semi-input-wrapper.semi-input-wrapper__with-prepend-only .semi-input:not(:last-child) {
|
|
181
181
|
border-right-style: none;
|
|
182
|
-
border-radius: 0;
|
|
183
182
|
}
|
|
184
183
|
.semi-input-wrapper.semi-input-wrapper__with-prepend, .semi-input-wrapper.semi-input-wrapper__with-append {
|
|
185
184
|
display: inline-flex;
|
package/lib/es/input/input.scss
CHANGED
|
@@ -6,6 +6,7 @@ export type tipFormatterBasicType = string | number | boolean | null;
|
|
|
6
6
|
export interface SliderProps {
|
|
7
7
|
defaultValue?: number | number[];
|
|
8
8
|
disabled?: boolean;
|
|
9
|
+
showMarkLabel?: boolean;
|
|
9
10
|
included?: boolean;
|
|
10
11
|
marks?: Marks;
|
|
11
12
|
max?: number;
|
|
@@ -18,8 +19,10 @@ export interface SliderProps {
|
|
|
18
19
|
onAfterChange?: (value: SliderProps['value']) => void;
|
|
19
20
|
onChange?: (value: SliderProps['value']) => void;
|
|
20
21
|
onMouseUp?: (e: any) => void;
|
|
22
|
+
tooltipOnMark?: boolean;
|
|
21
23
|
tooltipVisible?: boolean;
|
|
22
24
|
style?: Record<string, any>;
|
|
25
|
+
showArrow?: boolean;
|
|
23
26
|
className?: string;
|
|
24
27
|
showBoundary?: boolean;
|
|
25
28
|
railStyle?: Record<string, any>;
|
package/lib/es/table/table.css
CHANGED
|
@@ -94,6 +94,9 @@
|
|
|
94
94
|
.semi-table-header-sticky .semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
95
95
|
background-color: var(--semi-color-bg-1);
|
|
96
96
|
}
|
|
97
|
+
.semi-table-header-hidden {
|
|
98
|
+
height: 0;
|
|
99
|
+
}
|
|
97
100
|
.semi-table-align-center .semi-table-operate-wrapper {
|
|
98
101
|
justify-content: center;
|
|
99
102
|
}
|
package/lib/es/table/table.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.48.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@douyinfe/semi-animation": "2.
|
|
10
|
+
"@douyinfe/semi-animation": "2.48.0-beta.0",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
13
|
"date-fns": "^2.29.3",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "2eb75459ef1df87a83949a2f609da9468cd200c6",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/slider/foundation.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type tipFormatterBasicType = string | number | boolean | null;
|
|
|
12
12
|
export interface SliderProps{
|
|
13
13
|
defaultValue?: number | number[];
|
|
14
14
|
disabled?: boolean;
|
|
15
|
+
showMarkLabel?: boolean;
|
|
15
16
|
included?: boolean; // Whether to juxtapose. Allow dragging
|
|
16
17
|
marks?: Marks; // Scale
|
|
17
18
|
max?: number;
|
|
@@ -24,8 +25,10 @@ export interface SliderProps{
|
|
|
24
25
|
onAfterChange?: (value: SliderProps['value']) => void; // triggered when mouse up and clicked
|
|
25
26
|
onChange?: (value: SliderProps['value']) => void;
|
|
26
27
|
onMouseUp?: (e: any) => void;
|
|
28
|
+
tooltipOnMark?: boolean;
|
|
27
29
|
tooltipVisible?: boolean;
|
|
28
30
|
style?: Record<string, any>;
|
|
31
|
+
showArrow?: boolean;
|
|
29
32
|
className?: string;
|
|
30
33
|
showBoundary?: boolean;
|
|
31
34
|
railStyle?: Record<string, any>;
|