@teselagen/ui 0.8.6-beta.24 → 0.8.6-beta.26
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/DataTable/utils/formatPasteData.d.ts +11 -5
- package/DataTable/utils/getAllRows.d.ts +4 -1
- package/DataTable/utils/getCellCopyText.d.ts +1 -1
- package/DataTable/utils/getCellInfo.d.ts +20 -15
- package/DataTable/utils/getFieldPathToField.d.ts +5 -1
- package/DataTable/utils/getIdOrCodeOrIndex.d.ts +2 -1
- package/DataTable/utils/getLastSelectedEntity.d.ts +7 -1
- package/DataTable/utils/getNewEntToSelect.d.ts +7 -6
- package/DataTable/utils/getRowCopyText.d.ts +1 -1
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +22 -1
- package/DataTable/utils/types/Entity.d.ts +5 -0
- package/DataTable/utils/types/Field.d.ts +4 -0
- package/DataTable/utils/types/OrderBy.d.ts +11 -0
- package/DataTable/utils/types/Schema.d.ts +4 -0
- package/DataTable/utils/utils.d.ts +16 -5
- package/MenuBar/index.d.ts +3 -1
- package/Timeline/TimelineEvent.d.ts +7 -4
- package/Timeline/index.d.ts +5 -1
- package/index.cjs.js +1638 -1806
- package/index.d.ts +0 -1
- package/index.es.js +1638 -1806
- package/package.json +3 -3
- package/src/DataTable/utils/formatPasteData.ts +34 -0
- package/src/DataTable/utils/getAllRows.ts +11 -0
- package/src/DataTable/utils/getCellCopyText.ts +7 -0
- package/src/DataTable/utils/getCellInfo.ts +46 -0
- package/src/DataTable/utils/getFieldPathToField.ts +10 -0
- package/src/DataTable/utils/getIdOrCodeOrIndex.ts +14 -0
- package/src/DataTable/utils/getLastSelectedEntity.ts +15 -0
- package/src/DataTable/utils/getNewEntToSelect.ts +32 -0
- package/src/DataTable/utils/initializeHasuraWhereAndFilter.ts +35 -0
- package/src/DataTable/utils/types/Entity.ts +7 -0
- package/src/DataTable/utils/types/Field.ts +4 -0
- package/src/DataTable/utils/types/OrderBy.ts +15 -0
- package/src/DataTable/utils/types/Schema.ts +5 -0
- package/src/DataTable/utils/utils.ts +39 -0
- package/src/Timeline/TimelineEvent.tsx +36 -0
- package/src/Timeline/index.tsx +21 -0
- package/src/index.js +0 -1
- package/src/utils/browserUtils.ts +3 -0
- package/src/utils/determineBlackOrWhiteTextColor.ts +11 -0
- package/src/utils/getTextFromEl.ts +45 -0
- package/src/utils/handlerHelpers.ts +32 -0
- package/src/utils/hooks/index.ts +1 -0
- package/src/utils/hooks/useDeepEqualMemo.ts +10 -0
- package/src/utils/hooks/useStableReference.ts +9 -0
- package/src/utils/hotkeyUtils.tsx +155 -0
- package/src/utils/isBeingCalledExcessively.ts +37 -0
- package/utils/browserUtils.d.ts +1 -1
- package/utils/determineBlackOrWhiteTextColor.d.ts +1 -1
- package/utils/getTextFromEl.d.ts +8 -1
- package/utils/handlerHelpers.d.ts +7 -7
- package/utils/hooks/useDeepEqualMemo.d.ts +1 -2
- package/utils/hooks/useStableReference.d.ts +1 -1
- package/utils/hotkeyUtils.d.ts +21 -4
- package/utils/isBeingCalledExcessively.d.ts +3 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const keyCount: { [key: string]: number | null } = {};
|
|
2
|
+
const timeout: { [key: string]: NodeJS.Timeout | null } = {};
|
|
3
|
+
|
|
4
|
+
// if this function is hit more than 20 times in a row in 2 seconds with the same uniqName then throw an error
|
|
5
|
+
export const isBeingCalledExcessively = ({
|
|
6
|
+
uniqName
|
|
7
|
+
}: {
|
|
8
|
+
uniqName: string;
|
|
9
|
+
}) => {
|
|
10
|
+
if (process.env["NODE_ENV"] !== "development") {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!uniqName) {
|
|
14
|
+
throw new Error("uniqName is required");
|
|
15
|
+
}
|
|
16
|
+
// Initialize the count if it doesn't exist
|
|
17
|
+
keyCount[uniqName] = keyCount[uniqName] || 0;
|
|
18
|
+
(keyCount[uniqName] as number)++;
|
|
19
|
+
|
|
20
|
+
// Only set the timeout if it doesn't exist already to ensure it runs exactly once every 2 seconds
|
|
21
|
+
if (!timeout[uniqName]) {
|
|
22
|
+
timeout[uniqName] = setTimeout(() => {
|
|
23
|
+
keyCount[uniqName] = 0;
|
|
24
|
+
timeout[uniqName] = null;
|
|
25
|
+
}, 2000);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if ((keyCount[uniqName] as number) > 20) {
|
|
29
|
+
keyCount[uniqName] = 0;
|
|
30
|
+
// Also clear the timeout when throwing an error
|
|
31
|
+
if (timeout[uniqName]) {
|
|
32
|
+
clearTimeout(timeout[uniqName]);
|
|
33
|
+
timeout[uniqName] = null;
|
|
34
|
+
}
|
|
35
|
+
throw new Error(`isBeingCalledExcessively: ${uniqName}`);
|
|
36
|
+
}
|
|
37
|
+
};
|
package/utils/browserUtils.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const isSafari: boolean;
|
|
1
|
+
export declare const isSafari: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function determineBlackOrWhiteTextColor(c:
|
|
1
|
+
export default function determineBlackOrWhiteTextColor(c: string): "#000000" | "#FFFFFF";
|
package/utils/getTextFromEl.d.ts
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { default as React } from '../../../../node_modules/react';
|
|
2
|
+
type Node = React.ReactElement<{
|
|
3
|
+
children?: Node[] | Node;
|
|
4
|
+
}> | string | number;
|
|
5
|
+
export default function getTextFromEl<T extends Node>(el: T, options?: {
|
|
6
|
+
lowerCase?: boolean;
|
|
7
|
+
}): string;
|
|
8
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
onKeyDown: (event:
|
|
1
|
+
export declare const onEnterHelper: (callback: (event: React.KeyboardEvent<Element>) => void) => {
|
|
2
|
+
onKeyDown: (event: React.KeyboardEvent<Element>) => void;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
5
|
-
onBlur: (event:
|
|
4
|
+
export declare const onBlurHelper: (callback: (event: React.FocusEvent<Element>) => void) => {
|
|
5
|
+
onBlur: (event: React.FocusEvent<Element>) => void;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
onKeyDown: (event:
|
|
9
|
-
onBlur: (event:
|
|
7
|
+
export declare const onEnterOrBlurHelper: (callback: (event: React.KeyboardEvent<Element> | React.FocusEvent<Element>) => void) => {
|
|
8
|
+
onKeyDown: (event: React.KeyboardEvent<Element>) => void;
|
|
9
|
+
onBlur: (event: React.FocusEvent<Element>) => void;
|
|
10
10
|
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export function useDeepEqualEffect(effect: any, deps: any): void;
|
|
1
|
+
export declare const useDeepEqualMemo: (value: unknown) => unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const useStableReference: (value: unknown) => import('../../../../../node_modules/react').MutableRefObject<unknown>;
|
package/utils/hotkeyUtils.d.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { default as React } from '../../../../node_modules/react';
|
|
2
|
+
type Out = {
|
|
3
|
+
combo: string;
|
|
4
|
+
label: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
global?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type Hotkeys = {
|
|
9
|
+
[key: string]: string | [string, string, object] | Out;
|
|
10
|
+
};
|
|
11
|
+
export declare function comboToLabel(def: string | {
|
|
12
|
+
combo: string;
|
|
13
|
+
}, useSymbols?: boolean): string;
|
|
14
|
+
export declare const hotkeysById: (hotkeys: Hotkeys, mode?: string) => (id: string) => string;
|
|
15
|
+
export declare const getHotkeyProps: (def: string | [string, string, object] | Out, id?: string) => Out;
|
|
16
|
+
export declare const withHotkeys: (hotkeys: Hotkeys, handlers: {
|
|
17
|
+
[key: string]: (e: KeyboardEvent) => void;
|
|
18
|
+
}) => ({ children }?: {
|
|
19
|
+
children?: React.ReactElement;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
uniqName:
|
|
3
|
-
})
|
|
1
|
+
export declare const isBeingCalledExcessively: ({ uniqName }: {
|
|
2
|
+
uniqName: string;
|
|
3
|
+
}) => void;
|