@douyinfe/semi-foundation 2.20.5-alpha.2 → 2.20.5
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/foundation.ts +5 -1
- package/lib/cjs/autoComplete/foundation.d.ts +2 -1
- package/lib/cjs/autoComplete/foundation.js +5 -1
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +1 -1
- package/lib/cjs/table/table.css +7 -0
- package/lib/cjs/table/table.scss +9 -0
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/cjs/utils/uuid.js +1 -1
- package/lib/es/autoComplete/foundation.d.ts +2 -1
- package/lib/es/autoComplete/foundation.js +5 -1
- package/lib/es/datePicker/monthsGridFoundation.d.ts +1 -1
- package/lib/es/table/table.css +7 -0
- package/lib/es/table/table.scss +9 -0
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/lib/es/utils/uuid.js +1 -1
- package/package.json +2 -2
- package/table/table.scss +9 -0
- package/utils/uuid.ts +3 -1
|
@@ -8,6 +8,7 @@ interface KeyboardAdapter<P = Record<string, any>, S = Record<string, any>> exte
|
|
|
8
8
|
registerKeyDown: (callback: (event: any) => void) => void;
|
|
9
9
|
unregisterKeyDown: (callback: (event: any) => void) => void;
|
|
10
10
|
updateFocusIndex: (focusIndex: number) => void;
|
|
11
|
+
notifyKeyDown: (e: any) => void;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export interface DataItem {
|
|
@@ -336,6 +337,7 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
336
337
|
default:
|
|
337
338
|
break;
|
|
338
339
|
}
|
|
340
|
+
this._adapter.notifyKeyDown(event);
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
_getEnableFocusIndex(offset: number) {
|
|
@@ -413,7 +415,9 @@ class AutoCompleteFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
413
415
|
this._adapter.notifyFocus(e);
|
|
414
416
|
}
|
|
415
417
|
|
|
416
|
-
handleBlur(e:
|
|
418
|
+
handleBlur(e: any) {
|
|
419
|
+
// https://reactjs.org/docs/legacy-event-pooling.html
|
|
420
|
+
e.persist();
|
|
417
421
|
// In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
|
|
418
422
|
// internal-issues:1231
|
|
419
423
|
setTimeout(() => {
|
|
@@ -3,6 +3,7 @@ interface KeyboardAdapter<P = Record<string, any>, S = Record<string, any>> exte
|
|
|
3
3
|
registerKeyDown: (callback: (event: any) => void) => void;
|
|
4
4
|
unregisterKeyDown: (callback: (event: any) => void) => void;
|
|
5
5
|
updateFocusIndex: (focusIndex: number) => void;
|
|
6
|
+
notifyKeyDown: (e: any) => void;
|
|
6
7
|
}
|
|
7
8
|
export interface DataItem {
|
|
8
9
|
[x: string]: any;
|
|
@@ -59,6 +60,6 @@ declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string,
|
|
|
59
60
|
_handleEnterKeyDown(): void;
|
|
60
61
|
handleOptionMouseEnter(optionIndex: number): void;
|
|
61
62
|
handleFocus(e: FocusEvent): void;
|
|
62
|
-
handleBlur(e:
|
|
63
|
+
handleBlur(e: any): void;
|
|
63
64
|
}
|
|
64
65
|
export default AutoCompleteFoundation;
|
|
@@ -395,6 +395,8 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
395
395
|
default:
|
|
396
396
|
break;
|
|
397
397
|
}
|
|
398
|
+
|
|
399
|
+
this._adapter.notifyKeyDown(event);
|
|
398
400
|
}
|
|
399
401
|
|
|
400
402
|
_getEnableFocusIndex(offset) {
|
|
@@ -497,8 +499,10 @@ class AutoCompleteFoundation extends _foundation.default {
|
|
|
497
499
|
}
|
|
498
500
|
|
|
499
501
|
handleBlur(e) {
|
|
500
|
-
//
|
|
502
|
+
// https://reactjs.org/docs/legacy-event-pooling.html
|
|
503
|
+
e.persist(); // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
|
|
501
504
|
// internal-issues:1231
|
|
505
|
+
|
|
502
506
|
setTimeout(() => {
|
|
503
507
|
this._adapter.notifyBlur(e);
|
|
504
508
|
|
|
@@ -249,6 +249,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
249
249
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
250
250
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
251
251
|
*/
|
|
252
|
-
getYAMOpenType(): "left" | "right" | "
|
|
252
|
+
getYAMOpenType(): "left" | "right" | "none" | "both";
|
|
253
253
|
}
|
|
254
254
|
export {};
|
package/lib/cjs/table/table.css
CHANGED
|
@@ -81,6 +81,13 @@
|
|
|
81
81
|
background-color: transparent;
|
|
82
82
|
border-bottom: 2px solid var(--semi-color-border);
|
|
83
83
|
}
|
|
84
|
+
.semi-table-header-sticky {
|
|
85
|
+
position: sticky;
|
|
86
|
+
z-index: 102;
|
|
87
|
+
}
|
|
88
|
+
.semi-table-header-sticky .semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
89
|
+
background-color: var(--semi-color-bg-2);
|
|
90
|
+
}
|
|
84
91
|
.semi-table-body {
|
|
85
92
|
overflow: auto;
|
|
86
93
|
width: 100%;
|
package/lib/cjs/table/table.scss
CHANGED
|
@@ -64,6 +64,15 @@ $module: #{$prefix}-table;
|
|
|
64
64
|
border-bottom: $width-table_header_border $border-table_base-borderStyle $color-table_th-border-default;
|
|
65
65
|
}
|
|
66
66
|
scrollbar-base-color: transparent;
|
|
67
|
+
|
|
68
|
+
&-sticky {
|
|
69
|
+
position: sticky;
|
|
70
|
+
z-index: $z-table_fixed_column + 1;
|
|
71
|
+
|
|
72
|
+
.semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
73
|
+
background-color: $color-table-bg-default;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
&-body {
|
|
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
|
|
|
74
74
|
export declare function normalizeValue(value: any, withObject: boolean): any;
|
|
75
75
|
export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
|
|
76
76
|
export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
|
|
77
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
77
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
78
78
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
79
79
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("auto" | "custom")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
package/lib/cjs/utils/uuid.js
CHANGED
|
@@ -14,7 +14,7 @@ function getUuid(prefix) {
|
|
|
14
14
|
|
|
15
15
|
function getUuidv4() {
|
|
16
16
|
try {
|
|
17
|
-
return crypto.
|
|
17
|
+
return String(1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));
|
|
18
18
|
} catch (err) {
|
|
19
19
|
return getUuid('semi');
|
|
20
20
|
}
|
|
@@ -3,6 +3,7 @@ interface KeyboardAdapter<P = Record<string, any>, S = Record<string, any>> exte
|
|
|
3
3
|
registerKeyDown: (callback: (event: any) => void) => void;
|
|
4
4
|
unregisterKeyDown: (callback: (event: any) => void) => void;
|
|
5
5
|
updateFocusIndex: (focusIndex: number) => void;
|
|
6
|
+
notifyKeyDown: (e: any) => void;
|
|
6
7
|
}
|
|
7
8
|
export interface DataItem {
|
|
8
9
|
[x: string]: any;
|
|
@@ -59,6 +60,6 @@ declare class AutoCompleteFoundation<P = Record<string, any>, S = Record<string,
|
|
|
59
60
|
_handleEnterKeyDown(): void;
|
|
60
61
|
handleOptionMouseEnter(optionIndex: number): void;
|
|
61
62
|
handleFocus(e: FocusEvent): void;
|
|
62
|
-
handleBlur(e:
|
|
63
|
+
handleBlur(e: any): void;
|
|
63
64
|
}
|
|
64
65
|
export default AutoCompleteFoundation;
|
|
@@ -381,6 +381,8 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
381
381
|
default:
|
|
382
382
|
break;
|
|
383
383
|
}
|
|
384
|
+
|
|
385
|
+
this._adapter.notifyKeyDown(event);
|
|
384
386
|
}
|
|
385
387
|
|
|
386
388
|
_getEnableFocusIndex(offset) {
|
|
@@ -483,8 +485,10 @@ class AutoCompleteFoundation extends BaseFoundation {
|
|
|
483
485
|
}
|
|
484
486
|
|
|
485
487
|
handleBlur(e) {
|
|
486
|
-
//
|
|
488
|
+
// https://reactjs.org/docs/legacy-event-pooling.html
|
|
489
|
+
e.persist(); // In order to handle the problem of losing onClick binding when clicking on the padding area, the onBlur event is triggered first to cause the react view to be updated
|
|
487
490
|
// internal-issues:1231
|
|
491
|
+
|
|
488
492
|
setTimeout(() => {
|
|
489
493
|
this._adapter.notifyBlur(e);
|
|
490
494
|
|
|
@@ -249,6 +249,6 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
249
249
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
250
250
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
251
251
|
*/
|
|
252
|
-
getYAMOpenType(): "left" | "right" | "
|
|
252
|
+
getYAMOpenType(): "left" | "right" | "none" | "both";
|
|
253
253
|
}
|
|
254
254
|
export {};
|
package/lib/es/table/table.css
CHANGED
|
@@ -81,6 +81,13 @@
|
|
|
81
81
|
background-color: transparent;
|
|
82
82
|
border-bottom: 2px solid var(--semi-color-border);
|
|
83
83
|
}
|
|
84
|
+
.semi-table-header-sticky {
|
|
85
|
+
position: sticky;
|
|
86
|
+
z-index: 102;
|
|
87
|
+
}
|
|
88
|
+
.semi-table-header-sticky .semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
89
|
+
background-color: var(--semi-color-bg-2);
|
|
90
|
+
}
|
|
84
91
|
.semi-table-body {
|
|
85
92
|
overflow: auto;
|
|
86
93
|
width: 100%;
|
package/lib/es/table/table.scss
CHANGED
|
@@ -64,6 +64,15 @@ $module: #{$prefix}-table;
|
|
|
64
64
|
border-bottom: $width-table_header_border $border-table_base-borderStyle $color-table_th-border-default;
|
|
65
65
|
}
|
|
66
66
|
scrollbar-base-color: transparent;
|
|
67
|
+
|
|
68
|
+
&-sticky {
|
|
69
|
+
position: sticky;
|
|
70
|
+
z-index: $z-table_fixed_column + 1;
|
|
71
|
+
|
|
72
|
+
.semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
73
|
+
background-color: $color-table-bg-default;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
&-body {
|
|
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
|
|
|
74
74
|
export declare function normalizeValue(value: any, withObject: boolean): any;
|
|
75
75
|
export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
|
|
76
76
|
export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
|
|
77
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
77
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
|
|
78
78
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
79
79
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("auto" | "custom")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
package/lib/es/utils/uuid.js
CHANGED
|
@@ -4,7 +4,7 @@ export default function getUuid(prefix) {
|
|
|
4
4
|
|
|
5
5
|
function getUuidv4() {
|
|
6
6
|
try {
|
|
7
|
-
return crypto.
|
|
7
|
+
return String(1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c => (Number(c) ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> Number(c) / 4).toString(16));
|
|
8
8
|
} catch (err) {
|
|
9
9
|
return getUuid('semi');
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.20.5
|
|
3
|
+
"version": "2.20.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "d3bebd51a3287d8e57d9460f658102bfb9712af4",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/table/table.scss
CHANGED
|
@@ -64,6 +64,15 @@ $module: #{$prefix}-table;
|
|
|
64
64
|
border-bottom: $width-table_header_border $border-table_base-borderStyle $color-table_th-border-default;
|
|
65
65
|
}
|
|
66
66
|
scrollbar-base-color: transparent;
|
|
67
|
+
|
|
68
|
+
&-sticky {
|
|
69
|
+
position: sticky;
|
|
70
|
+
z-index: $z-table_fixed_column + 1;
|
|
71
|
+
|
|
72
|
+
.semi-table-thead > .semi-table-row > .semi-table-row-head {
|
|
73
|
+
background-color: $color-table-bg-default;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
&-body {
|
package/utils/uuid.ts
CHANGED
|
@@ -5,7 +5,9 @@ export default function getUuid(prefix: string) {
|
|
|
5
5
|
// https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
|
|
6
6
|
function getUuidv4() {
|
|
7
7
|
try {
|
|
8
|
-
return
|
|
8
|
+
return String(1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
|
|
9
|
+
(Number(c) ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (Number(c) / 4)))).toString(16)
|
|
10
|
+
);
|
|
9
11
|
} catch (err) {
|
|
10
12
|
return getUuid('semi');
|
|
11
13
|
}
|