@king-design/react 2.0.12 → 2.0.13
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/__tests__/__snapshots__/React Demos.md +59 -59
- package/components/code/index.d.ts +2 -2
- package/components/code/useEditor.js +1 -1
- package/components/drawer/index.spec.js +48 -0
- package/components/dropdown/dropdown.d.ts +2 -1
- package/components/dropdown/dropdown.js +31 -14
- package/components/dropdown/index.spec.js +58 -0
- package/components/portal.js +9 -2
- package/components/select/styles.js +2 -2
- package/components/table/row.d.ts +1 -0
- package/components/table/row.vdt.js +5 -6
- package/components/table/table.d.ts +1 -0
- package/components/table/table.js +4 -2
- package/components/table/table.vdt.js +111 -104
- package/components/timepicker/index.d.ts +1 -0
- package/components/timepicker/index.js +1 -0
- package/components/tooltip/index.d.ts +1 -1
- package/hooks/useDocumentClick.js +29 -2
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +1 -1
|
@@ -8,6 +8,6 @@ export interface TooltipProps extends BaseTooltipProps {
|
|
|
8
8
|
export interface TooltipBlocks extends BaseTooltipBlocks, TooltipContentBlocks {
|
|
9
9
|
content: null;
|
|
10
10
|
}
|
|
11
|
-
declare class _Tooltip extends BaseTooltip<TooltipProps, TooltipEvents, TooltipBlocks> {
|
|
11
|
+
export declare class _Tooltip extends BaseTooltip<TooltipProps, TooltipEvents, TooltipBlocks> {
|
|
12
12
|
}
|
|
13
13
|
export declare const Tooltip: typeof _Tooltip;
|
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
import { onMounted, onUnmounted } from 'intact-react';
|
|
2
|
-
import { isFunction } from 'intact-shared';
|
|
2
|
+
import { isFunction } from 'intact-shared'; // @reference: Vue3.0
|
|
3
|
+
|
|
4
|
+
var getNow = Date.now; // Determine what event timestamp the browser is using. Annoyingly, the
|
|
5
|
+
// timestamp can either be hi-res (relative to page load) or low-res
|
|
6
|
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
|
7
|
+
// same timestamp type when saving the flush timestamp.
|
|
8
|
+
|
|
9
|
+
if (getNow() > document.createEvent('Event').timeStamp) {
|
|
10
|
+
// if the low-res timestamp which is bigger than the event timestamp
|
|
11
|
+
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
12
|
+
// and we need to use the hi-res version for event listeners as well.
|
|
13
|
+
getNow = function getNow() {
|
|
14
|
+
return performance.now();
|
|
15
|
+
};
|
|
16
|
+
} // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
|
|
17
|
+
// and does not fire microtasks in between event propagation, so safe to exclude.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
|
|
21
|
+
var skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
|
|
3
22
|
export function useDocumentClick(ref, callback, manual) {
|
|
4
23
|
if (manual === void 0) {
|
|
5
24
|
manual = false;
|
|
6
25
|
}
|
|
7
26
|
|
|
8
27
|
var onDocumentClick = function onDocumentClick(e) {
|
|
9
|
-
if (e._ignore) return;
|
|
28
|
+
if (e._ignore) return; // https://github.com/ksc-fe/kpc/issues/788
|
|
29
|
+
|
|
30
|
+
var timeStamp = e.timeStamp || getNow();
|
|
31
|
+
|
|
32
|
+
if (!skipTimestampCheck && onDocumentClick.timeStamp > timeStamp + 1) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
10
36
|
var target = e.target;
|
|
11
37
|
var elem = isFunction(ref) ? ref() : ref.value;
|
|
12
38
|
if (containsOrEqual(elem, target)) return;
|
|
@@ -14,6 +40,7 @@ export function useDocumentClick(ref, callback, manual) {
|
|
|
14
40
|
};
|
|
15
41
|
|
|
16
42
|
var add = function add() {
|
|
43
|
+
onDocumentClick.timeStamp = getNow();
|
|
17
44
|
document.addEventListener('click', onDocumentClick);
|
|
18
45
|
document.addEventListener('contextmenu', onDocumentClick);
|
|
19
46
|
};
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.13
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -57,7 +57,7 @@ export * from './components/tree';
|
|
|
57
57
|
export * from './components/treeSelect';
|
|
58
58
|
export * from './components/upload';
|
|
59
59
|
export * from './components/wave';
|
|
60
|
-
export declare const version = "2.0.
|
|
60
|
+
export declare const version = "2.0.13";
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
export {normalize} from 'intact-react';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v2.0.
|
|
2
|
+
* @king-design v2.0.13
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -59,7 +59,7 @@ export * from './components/tree';
|
|
|
59
59
|
export * from './components/treeSelect';
|
|
60
60
|
export * from './components/upload';
|
|
61
61
|
export * from './components/wave';
|
|
62
|
-
export var version = '2.0.
|
|
62
|
+
export var version = '2.0.13';
|
|
63
63
|
/* generate end */
|
|
64
64
|
|
|
65
65
|
export {normalize} from 'intact-react';
|