intable 0.0.22 → 0.0.23
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/LICENSE +21 -21
- package/README.md +378 -378
- package/dist/__uno.css +1 -1
- package/dist/components/AndOr.d.ts +35 -0
- package/dist/components/AndOr.js +188 -0
- package/dist/components/AndOrFields.d.ts +38 -0
- package/dist/components/AndOrFields.js +280 -0
- package/dist/components/Filter.d.ts +10 -0
- package/dist/components/Filter.js +97 -0
- package/dist/filter.js +6 -0
- package/dist/hooks/index.js +4 -1
- package/dist/hooks/useVirtualizer.js +55 -59
- package/dist/index.d.ts +1 -1
- package/dist/index.js +30 -26
- package/dist/plugins/CommandPlugin.js +19 -21
- package/dist/plugins/EditablePlugin.js +6 -10
- package/dist/plugins/FilterPlugin.d.ts +14 -0
- package/dist/plugins/FilterPlugin.js +138 -0
- package/dist/plugins/MenuPlugin.js +4 -3
- package/dist/plugins/RenderPlugin/index.d.ts +1 -0
- package/dist/plugins/RenderPlugin/index.js +1 -1
- package/dist/plugins/ValidatorPlugin.js +36 -35
- package/dist/style.css +2 -2
- package/dist/theme/antd.scss +41 -41
- package/dist/theme/dark.scss +46 -46
- package/dist/theme/element-plus.scss +38 -38
- package/dist/theme/github.scss +80 -80
- package/dist/theme/material.scss +73 -73
- package/dist/theme/shadcn.scss +66 -66
- package/dist/theme/stripe.scss +57 -57
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +42 -31
- package/package.json +1 -1
package/dist/theme/material.scss
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* intable — Material Design 3 Theme
|
|
3
|
-
* Google Material You / M3 surface tones and typography
|
|
4
|
-
* Best for: Android-style web apps, admin panels, data management UIs
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
.data-table {
|
|
8
|
-
--bg: #fffbfe;
|
|
9
|
-
--c-primary: #6750a4;
|
|
10
|
-
|
|
11
|
-
--menu-bg: #ece6f0;
|
|
12
|
-
--li-hover-bg: rgba(103, 80, 164, 0.08);
|
|
13
|
-
|
|
14
|
-
--table-b: 1px solid var(--table-b-c);
|
|
15
|
-
--table-b-c: #cac4d0;
|
|
16
|
-
--table-c: #1c1b1f;
|
|
17
|
-
--table-bg: #fffbfe;
|
|
18
|
-
|
|
19
|
-
--table-header-c: #49454f;
|
|
20
|
-
--table-header-bg: #fffbfe;
|
|
21
|
-
|
|
22
|
-
--table-row-hover-bg: rgba(103, 80, 164, 0.08);
|
|
23
|
-
|
|
24
|
-
--select-area-bg: rgba(103, 80, 164, 0.12);
|
|
25
|
-
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
font-family: 'Roboto', sans-serif;
|
|
28
|
-
|
|
29
|
-
th, td {
|
|
30
|
-
padding: 10px 16px;
|
|
31
|
-
line-height: 20px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
thead th {
|
|
35
|
-
font-size: 12px;
|
|
36
|
-
font-weight: 500;
|
|
37
|
-
letter-spacing: 0.02em;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
tr:not(:last-child) td {
|
|
41
|
-
border-bottom: 1px solid var(--table-b-c);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&--small {
|
|
45
|
-
font-size: 12px;
|
|
46
|
-
|
|
47
|
-
th, td {
|
|
48
|
-
padding: 6px 12px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Dark variant (M3 dark)
|
|
53
|
-
&.dark, [data-theme="dark"] & {
|
|
54
|
-
--bg: #1c1b1f;
|
|
55
|
-
--c-primary: #d0bcff;
|
|
56
|
-
|
|
57
|
-
--menu-bg: #2b2930;
|
|
58
|
-
--li-hover-bg: rgba(208, 188, 255, 0.08);
|
|
59
|
-
|
|
60
|
-
--table-b-c: #49454f;
|
|
61
|
-
--table-c: #e6e1e5;
|
|
62
|
-
--table-bg: #1c1b1f;
|
|
63
|
-
|
|
64
|
-
--table-header-c: #cac4d0;
|
|
65
|
-
--table-header-bg: #1c1b1f;
|
|
66
|
-
|
|
67
|
-
--table-row-hover-bg: rgba(208, 188, 255, 0.08);
|
|
68
|
-
|
|
69
|
-
--select-area-bg: rgba(208, 188, 255, 0.12);
|
|
70
|
-
|
|
71
|
-
color-scheme: dark;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* intable — Material Design 3 Theme
|
|
3
|
+
* Google Material You / M3 surface tones and typography
|
|
4
|
+
* Best for: Android-style web apps, admin panels, data management UIs
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.data-table {
|
|
8
|
+
--bg: #fffbfe;
|
|
9
|
+
--c-primary: #6750a4;
|
|
10
|
+
|
|
11
|
+
--menu-bg: #ece6f0;
|
|
12
|
+
--li-hover-bg: rgba(103, 80, 164, 0.08);
|
|
13
|
+
|
|
14
|
+
--table-b: 1px solid var(--table-b-c);
|
|
15
|
+
--table-b-c: #cac4d0;
|
|
16
|
+
--table-c: #1c1b1f;
|
|
17
|
+
--table-bg: #fffbfe;
|
|
18
|
+
|
|
19
|
+
--table-header-c: #49454f;
|
|
20
|
+
--table-header-bg: #fffbfe;
|
|
21
|
+
|
|
22
|
+
--table-row-hover-bg: rgba(103, 80, 164, 0.08);
|
|
23
|
+
|
|
24
|
+
--select-area-bg: rgba(103, 80, 164, 0.12);
|
|
25
|
+
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
font-family: 'Roboto', sans-serif;
|
|
28
|
+
|
|
29
|
+
th, td {
|
|
30
|
+
padding: 10px 16px;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
thead th {
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
font-weight: 500;
|
|
37
|
+
letter-spacing: 0.02em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
tr:not(:last-child) td {
|
|
41
|
+
border-bottom: 1px solid var(--table-b-c);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&--small {
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
|
|
47
|
+
th, td {
|
|
48
|
+
padding: 6px 12px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Dark variant (M3 dark)
|
|
53
|
+
&.dark, [data-theme="dark"] & {
|
|
54
|
+
--bg: #1c1b1f;
|
|
55
|
+
--c-primary: #d0bcff;
|
|
56
|
+
|
|
57
|
+
--menu-bg: #2b2930;
|
|
58
|
+
--li-hover-bg: rgba(208, 188, 255, 0.08);
|
|
59
|
+
|
|
60
|
+
--table-b-c: #49454f;
|
|
61
|
+
--table-c: #e6e1e5;
|
|
62
|
+
--table-bg: #1c1b1f;
|
|
63
|
+
|
|
64
|
+
--table-header-c: #cac4d0;
|
|
65
|
+
--table-header-bg: #1c1b1f;
|
|
66
|
+
|
|
67
|
+
--table-row-hover-bg: rgba(208, 188, 255, 0.08);
|
|
68
|
+
|
|
69
|
+
--select-area-bg: rgba(208, 188, 255, 0.12);
|
|
70
|
+
|
|
71
|
+
color-scheme: dark;
|
|
72
|
+
}
|
|
73
|
+
}
|
package/dist/theme/shadcn.scss
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* intable — Shadcn/Zinc Theme
|
|
3
|
-
* Neutral zinc/slate tones, clean minimal, matches shadcn/ui palette
|
|
4
|
-
* Best for: modern SaaS dashboards, admin panels, clean productivity tools
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
.data-table {
|
|
8
|
-
--bg: #ffffff;
|
|
9
|
-
--c-primary: #18181b;
|
|
10
|
-
|
|
11
|
-
--menu-bg: #ffffff;
|
|
12
|
-
--li-hover-bg: #f4f4f5;
|
|
13
|
-
|
|
14
|
-
--table-b: 1px solid var(--table-b-c);
|
|
15
|
-
--table-b-c: #e4e4e7;
|
|
16
|
-
--table-c: #09090b;
|
|
17
|
-
--table-bg: #ffffff;
|
|
18
|
-
|
|
19
|
-
--table-header-c: #71717a;
|
|
20
|
-
--table-header-bg: #ffffff;
|
|
21
|
-
|
|
22
|
-
--table-row-hover-bg: #fafafa;
|
|
23
|
-
|
|
24
|
-
--select-area-bg: #18181b14;
|
|
25
|
-
|
|
26
|
-
font-size: 14px;
|
|
27
|
-
|
|
28
|
-
th, td {
|
|
29
|
-
padding: 10px 12px;
|
|
30
|
-
line-height: 20px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
thead th {
|
|
34
|
-
font-weight: 500;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&--small {
|
|
38
|
-
font-size: 13px;
|
|
39
|
-
|
|
40
|
-
th, td {
|
|
41
|
-
padding: 6px 10px;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// Dark mode variant
|
|
46
|
-
&.dark, [data-theme="dark"] & {
|
|
47
|
-
--bg: #09090b;
|
|
48
|
-
--c-primary: #fafafa;
|
|
49
|
-
|
|
50
|
-
--menu-bg: #09090b;
|
|
51
|
-
--li-hover-bg: #27272a;
|
|
52
|
-
|
|
53
|
-
--table-b-c: #27272a;
|
|
54
|
-
--table-c: #fafafa;
|
|
55
|
-
--table-bg: #09090b;
|
|
56
|
-
|
|
57
|
-
--table-header-c: #71717a;
|
|
58
|
-
--table-header-bg: #09090b;
|
|
59
|
-
|
|
60
|
-
--table-row-hover-bg: #18181b;
|
|
61
|
-
|
|
62
|
-
--select-area-bg: #ffffff14;
|
|
63
|
-
|
|
64
|
-
color-scheme: dark;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* intable — Shadcn/Zinc Theme
|
|
3
|
+
* Neutral zinc/slate tones, clean minimal, matches shadcn/ui palette
|
|
4
|
+
* Best for: modern SaaS dashboards, admin panels, clean productivity tools
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.data-table {
|
|
8
|
+
--bg: #ffffff;
|
|
9
|
+
--c-primary: #18181b;
|
|
10
|
+
|
|
11
|
+
--menu-bg: #ffffff;
|
|
12
|
+
--li-hover-bg: #f4f4f5;
|
|
13
|
+
|
|
14
|
+
--table-b: 1px solid var(--table-b-c);
|
|
15
|
+
--table-b-c: #e4e4e7;
|
|
16
|
+
--table-c: #09090b;
|
|
17
|
+
--table-bg: #ffffff;
|
|
18
|
+
|
|
19
|
+
--table-header-c: #71717a;
|
|
20
|
+
--table-header-bg: #ffffff;
|
|
21
|
+
|
|
22
|
+
--table-row-hover-bg: #fafafa;
|
|
23
|
+
|
|
24
|
+
--select-area-bg: #18181b14;
|
|
25
|
+
|
|
26
|
+
font-size: 14px;
|
|
27
|
+
|
|
28
|
+
th, td {
|
|
29
|
+
padding: 10px 12px;
|
|
30
|
+
line-height: 20px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
thead th {
|
|
34
|
+
font-weight: 500;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--small {
|
|
38
|
+
font-size: 13px;
|
|
39
|
+
|
|
40
|
+
th, td {
|
|
41
|
+
padding: 6px 10px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Dark mode variant
|
|
46
|
+
&.dark, [data-theme="dark"] & {
|
|
47
|
+
--bg: #09090b;
|
|
48
|
+
--c-primary: #fafafa;
|
|
49
|
+
|
|
50
|
+
--menu-bg: #09090b;
|
|
51
|
+
--li-hover-bg: #27272a;
|
|
52
|
+
|
|
53
|
+
--table-b-c: #27272a;
|
|
54
|
+
--table-c: #fafafa;
|
|
55
|
+
--table-bg: #09090b;
|
|
56
|
+
|
|
57
|
+
--table-header-c: #71717a;
|
|
58
|
+
--table-header-bg: #09090b;
|
|
59
|
+
|
|
60
|
+
--table-row-hover-bg: #18181b;
|
|
61
|
+
|
|
62
|
+
--select-area-bg: #ffffff14;
|
|
63
|
+
|
|
64
|
+
color-scheme: dark;
|
|
65
|
+
}
|
|
66
|
+
}
|
package/dist/theme/stripe.scss
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* intable — Stripe Theme
|
|
3
|
-
* Ultra-clean minimal white, tight spacing, strong typographic hierarchy
|
|
4
|
-
* Best for: fintech, e-commerce, financial dashboards, data-dense UIs
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
.data-table {
|
|
8
|
-
--bg: #ffffff;
|
|
9
|
-
--c-primary: #635bff;
|
|
10
|
-
|
|
11
|
-
--menu-bg: #ffffff;
|
|
12
|
-
--li-hover-bg: #f6f8fa;
|
|
13
|
-
|
|
14
|
-
--table-b: 1px solid var(--table-b-c);
|
|
15
|
-
--table-b-c: #e3e8ee;
|
|
16
|
-
--table-c: #0a2540;
|
|
17
|
-
--table-bg: #ffffff;
|
|
18
|
-
|
|
19
|
-
--table-header-c: #425466;
|
|
20
|
-
--table-header-bg: #f7fafc;
|
|
21
|
-
|
|
22
|
-
--table-row-hover-bg: #f7fafc;
|
|
23
|
-
|
|
24
|
-
--select-area-bg: #635bff1a;
|
|
25
|
-
|
|
26
|
-
font-size: 13.5px;
|
|
27
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
28
|
-
|
|
29
|
-
th, td {
|
|
30
|
-
padding: 9px 14px;
|
|
31
|
-
line-height: 20px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
thead th {
|
|
35
|
-
font-size: 11.5px;
|
|
36
|
-
font-weight: 600;
|
|
37
|
-
text-transform: uppercase;
|
|
38
|
-
letter-spacing: 0.04em;
|
|
39
|
-
color: var(--table-header-c);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&--small {
|
|
43
|
-
font-size: 12.5px;
|
|
44
|
-
|
|
45
|
-
th, td {
|
|
46
|
-
padding: 5px 10px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
thead th {
|
|
50
|
-
font-size: 11px;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.row-selection {
|
|
55
|
-
width: 38px;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* intable — Stripe Theme
|
|
3
|
+
* Ultra-clean minimal white, tight spacing, strong typographic hierarchy
|
|
4
|
+
* Best for: fintech, e-commerce, financial dashboards, data-dense UIs
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
.data-table {
|
|
8
|
+
--bg: #ffffff;
|
|
9
|
+
--c-primary: #635bff;
|
|
10
|
+
|
|
11
|
+
--menu-bg: #ffffff;
|
|
12
|
+
--li-hover-bg: #f6f8fa;
|
|
13
|
+
|
|
14
|
+
--table-b: 1px solid var(--table-b-c);
|
|
15
|
+
--table-b-c: #e3e8ee;
|
|
16
|
+
--table-c: #0a2540;
|
|
17
|
+
--table-bg: #ffffff;
|
|
18
|
+
|
|
19
|
+
--table-header-c: #425466;
|
|
20
|
+
--table-header-bg: #f7fafc;
|
|
21
|
+
|
|
22
|
+
--table-row-hover-bg: #f7fafc;
|
|
23
|
+
|
|
24
|
+
--select-area-bg: #635bff1a;
|
|
25
|
+
|
|
26
|
+
font-size: 13.5px;
|
|
27
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
28
|
+
|
|
29
|
+
th, td {
|
|
30
|
+
padding: 9px 14px;
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
thead th {
|
|
35
|
+
font-size: 11.5px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
text-transform: uppercase;
|
|
38
|
+
letter-spacing: 0.04em;
|
|
39
|
+
color: var(--table-header-c);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--small {
|
|
43
|
+
font-size: 12.5px;
|
|
44
|
+
|
|
45
|
+
th, td {
|
|
46
|
+
padding: 5px 10px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
thead th {
|
|
50
|
+
font-size: 11px;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.row-selection {
|
|
55
|
+
width: 38px;
|
|
56
|
+
}
|
|
57
|
+
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare function getStyles(el?: ParentNode): string;
|
|
|
15
15
|
export declare const unFn: (fn: any, ...args: any[]) => any;
|
|
16
16
|
export declare const log: (...args: any[]) => any;
|
|
17
17
|
export declare const toArr: (v: any) => any[];
|
|
18
|
+
export declare const isEmpty: (v: any) => boolean;
|
|
18
19
|
export declare const parseStyle: (s: any) => any;
|
|
19
20
|
export declare function findret<T, R>(arr: readonly T[], cb: (e: T, i: number) => R): R | undefined;
|
|
20
21
|
export declare function emptyObject(o: any): any;
|
|
@@ -29,3 +30,4 @@ export declare function resolveOptions(opts: Fnable<Awatable<Record<string, any>
|
|
|
29
30
|
label: any;
|
|
30
31
|
value: any;
|
|
31
32
|
}[];
|
|
33
|
+
export declare function throttlePromise(of: any): () => Promise<unknown>;
|
package/dist/utils.js
CHANGED
|
@@ -2,62 +2,62 @@ import { useMemoAsync } from "./hooks/index.js";
|
|
|
2
2
|
import { tree_exports } from "./tree.js";
|
|
3
3
|
import { delay, isFunction, isPlainObject, isPromise } from "es-toolkit";
|
|
4
4
|
function file2base64(e) {
|
|
5
|
-
return new Promise((
|
|
6
|
-
let
|
|
7
|
-
|
|
5
|
+
return new Promise((x, S) => {
|
|
6
|
+
let C = new FileReader();
|
|
7
|
+
C.readAsDataURL(e), C.onload = () => x(C.result);
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
function chooseFile(e) {
|
|
11
|
-
return new Promise((
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
11
|
+
return new Promise((x, S) => {
|
|
12
|
+
let C = document.createElement("input");
|
|
13
|
+
C.type = "file", C.accept = e?.accept, C.multiple = e?.multiple, C.onchange = () => {
|
|
14
|
+
C.files && C.files.length > 0 && x(C.multiple ? [...C.files] : C.files[0]);
|
|
15
|
+
}, C.oncancel = S, C.click();
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
function chooseImage() {
|
|
19
19
|
return chooseFile({ accept: "image/*" });
|
|
20
20
|
}
|
|
21
21
|
async function print(e) {
|
|
22
|
-
let
|
|
23
|
-
|
|
22
|
+
let x = document.createElement("iframe");
|
|
23
|
+
x.srcdoc = `${[...document.querySelectorAll("style"), ...document.querySelectorAll("link[rel=\"stylesheet\"]")].map((e) => e.outerHTML).join("\n")}\n\n${e}`, Object.assign(x.style, {
|
|
24
24
|
position: "fixed",
|
|
25
25
|
display: "none"
|
|
26
|
-
}), document.body.append(
|
|
26
|
+
}), document.body.append(x), await new Promise((e) => x.contentWindow.addEventListener("load", e, { once: !0 })), await delay(300), x.contentWindow.print(), x.remove();
|
|
27
27
|
}
|
|
28
|
-
function mergeRect(e,
|
|
28
|
+
function mergeRect(e, x) {
|
|
29
29
|
return DOMRect.fromRect({
|
|
30
|
-
x: Math.min(e.x,
|
|
31
|
-
y: Math.min(e.y,
|
|
32
|
-
width: Math.max(e.right,
|
|
33
|
-
height: Math.max(e.bottom,
|
|
30
|
+
x: Math.min(e.x, x.x),
|
|
31
|
+
y: Math.min(e.y, x.y),
|
|
32
|
+
width: Math.max(e.right, x.right) - Math.min(e.x, x.x),
|
|
33
|
+
height: Math.max(e.bottom, x.bottom) - Math.min(e.y, x.y)
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
function getStyles(e = document) {
|
|
37
37
|
return [...e.querySelectorAll("style"), ...e.querySelectorAll("link[rel=\"stylesheet\"]")].map((e) => e.outerHTML).join("\n");
|
|
38
38
|
}
|
|
39
|
-
const unFn = (e, ...
|
|
40
|
-
function findret(e,
|
|
41
|
-
for (let
|
|
42
|
-
let
|
|
43
|
-
if (
|
|
39
|
+
const unFn = (e, ...x) => typeof e == "function" ? e(...x) : e, log = (...e) => (console.log(...e), e[0]), toArr = (e) => Array.isArray(e) ? e : e == null ? [] : [e], isEmpty = (e) => e == null || e === "" || Array.isArray(e) && e.length === 0 || typeof e == "object" && Object.keys(e).length === 0, parseStyle = (e) => e ? e.split(";").reduce((e, x) => ((([x, S]) => e[x.trim()] = S.trim())(x.split(":")), e), {}) : {};
|
|
40
|
+
function findret(e, x) {
|
|
41
|
+
for (let S = 0; S < e.length; S++) {
|
|
42
|
+
let C = x(e[S], S);
|
|
43
|
+
if (C != null) return C;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function emptyObject(e) {
|
|
47
|
-
for (let
|
|
47
|
+
for (let x of Object.keys(e)) delete e[x];
|
|
48
48
|
return e;
|
|
49
49
|
}
|
|
50
|
-
async function findAsync(e,
|
|
51
|
-
for (let
|
|
50
|
+
async function findAsync(e, x) {
|
|
51
|
+
for (let S = 0; S < e.length; S++) if (await x(e[S], S)) return e[S];
|
|
52
52
|
}
|
|
53
53
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
54
|
-
function resolveOptions(
|
|
55
|
-
let
|
|
56
|
-
return isFunction(
|
|
54
|
+
function resolveOptions(x) {
|
|
55
|
+
let S = x;
|
|
56
|
+
return isFunction(S) && (S = S()), isPromise(S) ? (cache.has(S) || cache.set(S, useMemoAsync(() => S.then((e) => e.map((e) => resolveOptions(e))))), cache.get(S)()) : (isPlainObject(S) && (S = Object.entries(S).map(([e, x]) => ({
|
|
57
57
|
value: e,
|
|
58
|
-
label:
|
|
59
|
-
...
|
|
60
|
-
}))),
|
|
58
|
+
label: x,
|
|
59
|
+
...x
|
|
60
|
+
}))), S?.map((e) => resolveOpt(e)) || []);
|
|
61
61
|
}
|
|
62
62
|
function resolveOpt(e) {
|
|
63
63
|
return isPlainObject(e) ? e : Array.isArray(e) ? {
|
|
@@ -68,4 +68,15 @@ function resolveOpt(e) {
|
|
|
68
68
|
value: e
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
function throttlePromise(e) {
|
|
72
|
+
let x = !1, S;
|
|
73
|
+
return () => {
|
|
74
|
+
let C = new Promise(function(e) {
|
|
75
|
+
S = e;
|
|
76
|
+
});
|
|
77
|
+
return x ? C : (x = !0, e(() => {
|
|
78
|
+
S(), x = !1, S = null;
|
|
79
|
+
}), C);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export { chooseFile, chooseImage, emptyObject, file2base64, findAsync, findret, getStyles, isEmpty, log, mergeRect, parseStyle, print, resolveOptions, throttlePromise, toArr, tree_exports as tree, unFn };
|