intable 0.0.49 → 0.0.51
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/dist/index.js +13 -23
- package/dist/plugins/EditablePlugin.js +73 -70
- package/dist/plugins/RenderPlugin/components.d.ts +1 -0
- package/dist/plugins/RenderPlugin/components.js +120 -40
- package/dist/plugins/RenderPlugin/index.d.ts +1 -0
- package/dist/plugins/RenderPlugin/index.js +15 -10
- package/dist/style.css +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +46 -42
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26,11 +26,11 @@ import { TooltipPlugin } from "./plugins/TooltipPlugin.js";
|
|
|
26
26
|
import { KeyEachPlugin } from "./plugins/KeyEachPlugin.js";
|
|
27
27
|
import loading_bold_default from "./loading-bold.js";
|
|
28
28
|
import { createComponent, insert, memo, mergeProps, spread, template, use } from "solid-js/web";
|
|
29
|
-
import { $PROXY, For, batch, createComputed, createContext, createEffect, createMemo, createRenderEffect, createSignal, getOwner, mapArray, mergeProps as mergeProps$1,
|
|
30
|
-
import { createMutable
|
|
29
|
+
import { $PROXY, For, batch, createComputed, createContext, createEffect, createMemo, createRenderEffect, createSignal, getOwner, mapArray, mergeProps as mergeProps$1, onCleanup, onMount, runWithOwner, useContext } from "solid-js";
|
|
30
|
+
import { createMutable } from "solid-js/store";
|
|
31
31
|
import { combineProps } from "@solid-primitives/props";
|
|
32
32
|
import { createLazyMemo } from "@solid-primitives/memo";
|
|
33
|
-
import { createElementSize,
|
|
33
|
+
import { createElementSize, makeResizeObserver } from "@solid-primitives/resize-observer";
|
|
34
34
|
import { createScrollPosition } from "@solid-primitives/scroll";
|
|
35
35
|
import { difference, isEqual, memoize, sumBy, uniq } from "es-toolkit";
|
|
36
36
|
var _tmpl$ = /* @__PURE__ */ template("<div>"), _tmpl$2 = /* @__PURE__ */ template("<table>"), _tmpl$3 = /* @__PURE__ */ template("<thead>"), _tmpl$4 = /* @__PURE__ */ template("<tbody>"), _tmpl$5 = /* @__PURE__ */ template("<tr>"), _tmpl$6 = /* @__PURE__ */ template("<th>"), _tmpl$7 = /* @__PURE__ */ template("<td>"), _tmpl$8 = /* @__PURE__ */ template("<div class=data-table__layers>"), _tmpl$9 = /* @__PURE__ */ template("<div class=\"data-table--scroll-view h-full max-h-inherit\">"), _tmpl$0 = /* @__PURE__ */ template("<div class=data-table__empty>No data"), _tmpl$1 = /* @__PURE__ */ template("<div class=data-table__loading>");
|
|
@@ -287,7 +287,7 @@ function BasePlugin() {
|
|
|
287
287
|
return [
|
|
288
288
|
unFn(Z.cellStyle, J),
|
|
289
289
|
J.col.style,
|
|
290
|
-
J.col.width && `width: ${J.col.width}px; max-width: ${J.col.width}px`
|
|
290
|
+
J.col.width && `width: ${J.col.width}px; min-width: ${J.col.width}px; max-width: ${J.col.width}px`
|
|
291
291
|
].filter(Boolean).join(";");
|
|
292
292
|
}
|
|
293
293
|
});
|
|
@@ -314,7 +314,7 @@ function BasePlugin() {
|
|
|
314
314
|
return [
|
|
315
315
|
unFn(J.cellStyle, K),
|
|
316
316
|
K.col.style,
|
|
317
|
-
K.col.width && `width: ${K.col.width}px; max-width: ${K.col.width}px`,
|
|
317
|
+
K.col.width && `width: ${K.col.width}px; min-width: ${K.col.width}px; max-width: ${K.col.width}px`,
|
|
318
318
|
K.style
|
|
319
319
|
].filter(Boolean).join(";");
|
|
320
320
|
}
|
|
@@ -402,24 +402,14 @@ const defaultsPlugins = [
|
|
|
402
402
|
EditablePlugin,
|
|
403
403
|
CellMergePlugin,
|
|
404
404
|
TreePlugin,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
q.push(...X), J = !1;
|
|
414
|
-
})), {
|
|
415
|
-
name: "fit-col-width",
|
|
416
|
-
priority: -Infinity,
|
|
417
|
-
rewriteProps: { columns: ({ columns: _ }, { store: K }) => (_ = _.map((_, J) => ({
|
|
418
|
-
..._,
|
|
419
|
-
...q?.[J],
|
|
420
|
-
[K.ID]: _[K.ID] ??= Symbol()
|
|
421
|
-
})), untrack(() => batch(() => reconcile(_, { key: K.ID })(K.__fit_col_width__cols ??= [])))) }
|
|
422
|
-
};
|
|
405
|
+
{
|
|
406
|
+
name: "fit-col-width",
|
|
407
|
+
rewriteProps: { Table: ({ Table: _ }, { store: K }) => (q) => {
|
|
408
|
+
let J = createMemo(() => K.props.columns.some((_) => !_.width));
|
|
409
|
+
return q = combineProps(q, { get style() {
|
|
410
|
+
return J() ? "min-width: 100%" : "min-width: unset";
|
|
411
|
+
} }), createComponent(_, q);
|
|
412
|
+
} }
|
|
423
413
|
},
|
|
424
414
|
RowGroupPlugin,
|
|
425
415
|
ResizePlugin,
|
|
@@ -8,111 +8,111 @@ import { createEffect, createMemo, createRoot, createSignal, on, onCleanup, useC
|
|
|
8
8
|
import { createMutable } from "solid-js/store";
|
|
9
9
|
import { createAsyncMemo } from "@solid-primitives/memo";
|
|
10
10
|
import { delay } from "es-toolkit";
|
|
11
|
-
var _tmpl$ = /* @__PURE__ */ template("<div class=in-cell-edit-wrapper tabindex=-1>"), _tmpl$2 = /* @__PURE__ */ template("<span class=cell-validating>"), _tmpl$3 = /* @__PURE__ */ template("<input style=position:absolute;margin-top:1em;width:0;height:0;pointer-events:none;opacity:0>"), _tmpl$4 = /* @__PURE__ */ template("<input>"), _tmpl$5 = /* @__PURE__ */ template("<label class=\"h-full flex items-center\">"), _tmpl$6 = /* @__PURE__ */ template("<select
|
|
11
|
+
var _tmpl$ = /* @__PURE__ */ template("<div class=in-cell-edit-wrapper tabindex=-1>"), _tmpl$2 = /* @__PURE__ */ template("<span class=cell-validating>"), _tmpl$3 = /* @__PURE__ */ template("<input style=position:absolute;margin-top:1em;width:0;height:0;pointer-events:none;opacity:0>"), _tmpl$4 = /* @__PURE__ */ template("<input>"), _tmpl$5 = /* @__PURE__ */ template("<label class=\"h-full flex items-center\">"), _tmpl$6 = /* @__PURE__ */ template("<select>"), _tmpl$7 = /* @__PURE__ */ template("<option value>-"), _tmpl$8 = /* @__PURE__ */ template("<option>");
|
|
12
12
|
const EditablePlugin = {
|
|
13
13
|
name: "editable",
|
|
14
14
|
store: () => ({ editors: { ...editors } }),
|
|
15
15
|
rewriteProps: {
|
|
16
|
-
editable: ({ editable: e }, { store:
|
|
17
|
-
let
|
|
18
|
-
return !!
|
|
16
|
+
editable: ({ editable: e }, { store: h }) => (_) => {
|
|
17
|
+
let v = [_.col.editable, e].filter((e) => e != null);
|
|
18
|
+
return !!v.length && v.every((e) => unFn(e, _)) && !_.data[h.internal] && !_.col[h.internal];
|
|
19
19
|
},
|
|
20
|
-
Td: ({ Td: e }, { store:
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
let e = createMemo(() => JSON.stringify(
|
|
24
|
-
createEffect(on(e, () =>
|
|
25
|
-
let
|
|
26
|
-
props:
|
|
27
|
-
col:
|
|
28
|
-
eventKey:
|
|
29
|
-
data:
|
|
30
|
-
value:
|
|
20
|
+
Td: ({ Td: e }, { store: h }) => (v) => {
|
|
21
|
+
let y, { props: b } = useContext(Ctx), [w, T] = createSignal(!1), D = "", O = () => unFn(b.editable, v), A = () => (([e, h]) => v.x == e && v.y == h)(h.selected.start || []), j = () => A() && O() && !w(), [M, N] = createSignal(!1), P = createAsyncMemo(() => {
|
|
22
|
+
if (w()) {
|
|
23
|
+
let e = createMemo(() => JSON.stringify(h.selected ?? "{}"));
|
|
24
|
+
createEffect(on(e, () => T(!1), { defer: !0 })), L.w = y.getBoundingClientRect().width, L.h = y.getBoundingClientRect().height;
|
|
25
|
+
let g = !1, _ = v.data[v.col.id], x = ((e) => typeof e == "string" ? h.editors[e] : e)(v.col.editor ?? v.col.type ?? (v.col.enum ? "select" : "text")), S = {
|
|
26
|
+
props: v.col.editorProps,
|
|
27
|
+
col: v.col,
|
|
28
|
+
eventKey: D,
|
|
29
|
+
data: v.data,
|
|
30
|
+
value: _,
|
|
31
31
|
ok: async () => {
|
|
32
|
-
await
|
|
32
|
+
await F(C.getValue()), T(!1);
|
|
33
33
|
},
|
|
34
|
-
cancel: () => (
|
|
35
|
-
onChange: (e) =>
|
|
36
|
-
},
|
|
37
|
-
return queueMicrotask(() =>
|
|
38
|
-
!
|
|
39
|
-
...
|
|
40
|
-
[
|
|
41
|
-
}),
|
|
42
|
-
}), [
|
|
34
|
+
cancel: () => (g = !0, T(!1)),
|
|
35
|
+
onChange: (e) => w() && F(e).catch(() => {})
|
|
36
|
+
}, C = x(S);
|
|
37
|
+
return queueMicrotask(() => C.focus?.()), onCleanup(() => {
|
|
38
|
+
!g && C.getValue() !== _ && h.commands.rowChange({
|
|
39
|
+
...b.data[v.y],
|
|
40
|
+
[v.col.id]: C.getValue()
|
|
41
|
+
}), g || F(C.getValue()).catch(() => {}), D = "", C.destroy();
|
|
42
|
+
}), [S, C];
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
async function
|
|
45
|
+
async function F(e) {
|
|
46
46
|
try {
|
|
47
|
-
|
|
47
|
+
N(!0), await h.validateCell(e, v.data, v.col);
|
|
48
48
|
} finally {
|
|
49
|
-
|
|
49
|
+
N(!1);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
let
|
|
52
|
+
let I, L = createMutable({
|
|
53
53
|
w: 0,
|
|
54
54
|
h: 0
|
|
55
|
-
}),
|
|
56
|
-
ref: (e) => (
|
|
55
|
+
}), R = mergeProps$2(v, {
|
|
56
|
+
ref: (e) => (y = e, v.ref?.(e)),
|
|
57
57
|
get class() {
|
|
58
|
-
return [
|
|
58
|
+
return [w() ? "is-editing" : "", v.class].filter(Boolean).join(" ");
|
|
59
59
|
},
|
|
60
60
|
get style() {
|
|
61
|
-
return [
|
|
61
|
+
return [w() ? `width: ${L.w}px; height: ${L.h}px; padding: 0; ` : "", v.style].filter(Boolean).join(" ");
|
|
62
62
|
},
|
|
63
|
-
onClick: (e) => (
|
|
64
|
-
onDblClick: (e) => (
|
|
65
|
-
onKeyDown: (e) => (e.key == "Escape" &&
|
|
63
|
+
onClick: (e) => (I?.focus?.(), v.onClick?.(e)),
|
|
64
|
+
onDblClick: (e) => (T(O()), v.onDblClick?.(e)),
|
|
65
|
+
onKeyDown: (e) => (e.key == "Escape" && P()?.[0].cancel(), v.onKeyDown?.(e))
|
|
66
66
|
});
|
|
67
|
-
return createComponent(e, mergeProps$2(
|
|
68
|
-
return [memo(() => memo(() => !!
|
|
67
|
+
return createComponent(e, mergeProps$2(R, { get children() {
|
|
68
|
+
return [memo(() => memo(() => !!P()?.[1]?.el)() ? (() => {
|
|
69
69
|
var e = _tmpl$();
|
|
70
70
|
return addEventListener(e, "keydown", (e) => {
|
|
71
|
-
e.stopPropagation(), e.key == "Enter" && !e.shiftKey && (
|
|
72
|
-
}), addEventListener(e, "pointerdown", (e) => e.stopPropagation()), insert(e, () =>
|
|
73
|
-
var e = memo(() => !!
|
|
71
|
+
e.stopPropagation(), e.key == "Enter" && !e.shiftKey && (P()?.[0].ok(), e.preventDefault()), e.key == "Escape" && P()?.[0].cancel();
|
|
72
|
+
}), addEventListener(e, "pointerdown", (e) => e.stopPropagation()), insert(e, () => P()?.[1]?.el, null), insert(e, (() => {
|
|
73
|
+
var e = memo(() => !!M());
|
|
74
74
|
return () => e() && _tmpl$2();
|
|
75
75
|
})(), null), e;
|
|
76
|
-
})() :
|
|
76
|
+
})() : v.children), memo(() => memo(() => !!j())() && (() => {
|
|
77
77
|
var e = _tmpl$3();
|
|
78
78
|
return e.addEventListener("compositionend", () => {
|
|
79
|
-
|
|
79
|
+
T(!0);
|
|
80
80
|
}), e.$$input = (e) => {
|
|
81
|
-
|
|
81
|
+
D = e.target.value, T(!e.isComposing);
|
|
82
82
|
}, e.$$keydown = (e) => {
|
|
83
83
|
e.key == " " && e.preventDefault();
|
|
84
84
|
}, use((e) => {
|
|
85
|
-
|
|
85
|
+
I = e, delay(0).then(() => e.focus({ preventScroll: !0 }));
|
|
86
86
|
}, e), e;
|
|
87
87
|
})())];
|
|
88
88
|
} }));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
-
var createEditor = (e,
|
|
93
|
-
let [
|
|
92
|
+
var createEditor = (e, g, v) => ({ eventKey: y, value: b, col: x, ok: S, cancel: w, props: T, onChange: E }) => createRoot((w) => {
|
|
93
|
+
let [D, O] = createSignal(y || b), k;
|
|
94
94
|
return createComponent(e, mergeProps$2({
|
|
95
|
-
ref: (e) =>
|
|
95
|
+
ref: (e) => k = e,
|
|
96
96
|
class: "relative block px-2 size-full z-9 box-border resize-none outline-0",
|
|
97
97
|
get value() {
|
|
98
|
-
return
|
|
98
|
+
return D();
|
|
99
99
|
},
|
|
100
|
-
onInput: (e) => (
|
|
101
|
-
onChange: (e) => (
|
|
100
|
+
onInput: (e) => (O(e instanceof Event ? e.target.value : e), E?.(D())),
|
|
101
|
+
onChange: (e) => (O(e instanceof Event ? e.target.value : e), E?.(D()), v && S()),
|
|
102
102
|
get options() {
|
|
103
|
-
return memo(() => !!
|
|
103
|
+
return memo(() => !!x.enum)() ? resolveOptions(x.enum ?? []) : void 0;
|
|
104
104
|
}
|
|
105
|
-
},
|
|
106
|
-
|
|
105
|
+
}, g, T)), setTimeout(() => {
|
|
106
|
+
v && k?.showPicker?.();
|
|
107
107
|
}, 0), {
|
|
108
|
-
el:
|
|
109
|
-
getValue:
|
|
110
|
-
focus: () =>
|
|
111
|
-
destroy:
|
|
108
|
+
el: k,
|
|
109
|
+
getValue: D,
|
|
110
|
+
focus: () => k.focus(),
|
|
111
|
+
destroy: w
|
|
112
112
|
};
|
|
113
113
|
}), Input = (e) => (() => {
|
|
114
|
-
var
|
|
115
|
-
return spread(
|
|
114
|
+
var h = _tmpl$4();
|
|
115
|
+
return spread(h, e, !1, !1), h;
|
|
116
116
|
})();
|
|
117
117
|
const editors = {
|
|
118
118
|
text: createEditor(Input),
|
|
@@ -130,27 +130,30 @@ const editors = {
|
|
|
130
130
|
color: createEditor(Input, { type: "color" }),
|
|
131
131
|
tel: createEditor(Input, { type: "tel" }),
|
|
132
132
|
password: createEditor(Input, { type: "password" }),
|
|
133
|
-
file: createEditor((
|
|
133
|
+
file: createEditor((h) => createComponent(Files, mergeProps$2(h, {
|
|
134
134
|
class: "relative z-9 outline-2 outline-blue min-h-a! h-a! p-1 bg-#fff",
|
|
135
|
-
onAdd: () => chooseFile({ multiple: !0 }).then((e) =>
|
|
135
|
+
onAdd: () => chooseFile({ multiple: !0 }).then((e) => h.onChange([...h.value || [], ...e.map((e) => ({
|
|
136
136
|
name: e.name,
|
|
137
137
|
size: e.size
|
|
138
138
|
}))]))
|
|
139
139
|
}))),
|
|
140
140
|
checkbox: createEditor((e) => (() => {
|
|
141
|
-
var
|
|
142
|
-
return typeof
|
|
141
|
+
var h = _tmpl$5(), g = e.ref;
|
|
142
|
+
return typeof g == "function" ? use(g, h) : e.ref = h, insert(h, createComponent(Checkbox, mergeProps$2(e, {
|
|
143
143
|
ref: () => {},
|
|
144
144
|
onInput: () => {},
|
|
145
145
|
class: "mx-3!"
|
|
146
|
-
}))),
|
|
146
|
+
}))), h;
|
|
147
147
|
})()),
|
|
148
148
|
select: createEditor((e) => (() => {
|
|
149
|
-
var
|
|
150
|
-
return
|
|
151
|
-
var h =
|
|
152
|
-
return
|
|
153
|
-
})()
|
|
149
|
+
var h = _tmpl$6();
|
|
150
|
+
return spread(h, e, !1, !0), insert(h, (() => {
|
|
151
|
+
var h = memo(() => !e.multiple);
|
|
152
|
+
return () => h() && _tmpl$7();
|
|
153
|
+
})(), null), insert(h, () => e.options?.map((h) => (() => {
|
|
154
|
+
var g = _tmpl$8();
|
|
155
|
+
return insert(g, () => h.label), effect(() => g.selected = h.value === e.value), effect(() => g.value = h.value), g;
|
|
156
|
+
})()), null), h;
|
|
154
157
|
})(), {}, !0)
|
|
155
158
|
};
|
|
156
159
|
delegateEvents(["keydown", "input"]);
|
|
@@ -3,3 +3,4 @@ export declare const Files: import("solid-js").Component<Record<string, any>>;
|
|
|
3
3
|
export declare const Tags: import("solid-js").Component<Record<string, any>>;
|
|
4
4
|
export declare const Tag: import("solid-js").Component<Record<string, any>>;
|
|
5
5
|
export declare const evaluateFormula: (formula: string, data: any) => any;
|
|
6
|
+
export declare const text2colorMap: Record<string, string>;
|
|
@@ -5,83 +5,163 @@ import { For, splitProps } from "solid-js";
|
|
|
5
5
|
import { combineProps } from "@solid-primitives/props";
|
|
6
6
|
var _tmpl$ = /* @__PURE__ */ template("<input type=checkbox>"), _tmpl$2 = /* @__PURE__ */ template("<div>");
|
|
7
7
|
const Checkbox = (e) => {
|
|
8
|
-
let
|
|
9
|
-
return [e,
|
|
8
|
+
let m;
|
|
9
|
+
return [e, m] = splitProps(e, ["value", "onChange"]), m = combineProps({ get class() {
|
|
10
10
|
return `you-checkbox ${e.value && "checked"}`;
|
|
11
|
-
} },
|
|
12
|
-
var
|
|
13
|
-
return
|
|
11
|
+
} }, m), (() => {
|
|
12
|
+
var h = _tmpl$();
|
|
13
|
+
return h.addEventListener("change", (m) => e.onChange?.(m.currentTarget.checked)), spread(h, mergeProps({ get checked() {
|
|
14
14
|
return e.value || !1;
|
|
15
|
-
} },
|
|
15
|
+
} }, m), !1, !1), h;
|
|
16
16
|
})();
|
|
17
17
|
}, Files = (e) => {
|
|
18
|
-
let
|
|
19
|
-
return [e,
|
|
20
|
-
}, Tags = (
|
|
21
|
-
let
|
|
22
|
-
[
|
|
18
|
+
let m;
|
|
19
|
+
return [e, m] = splitProps(e, []), createComponent(Tags, mergeProps(m, { color: "" }));
|
|
20
|
+
}, Tags = (m) => {
|
|
21
|
+
let _;
|
|
22
|
+
[m, _] = splitProps(m, [
|
|
23
23
|
"value",
|
|
24
24
|
"children",
|
|
25
25
|
"disabled",
|
|
26
26
|
"onChange",
|
|
27
|
-
"onAdd"
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
"onAdd",
|
|
28
|
+
"color"
|
|
29
|
+
]), _ = combineProps({ class: "flex flex-wrap items-center gap-2 h-full" }, _);
|
|
30
|
+
let v = (e) => Array.isArray(e) ? e : e == null ? [] : [e];
|
|
30
31
|
return (() => {
|
|
31
|
-
var
|
|
32
|
-
return spread(
|
|
32
|
+
var y = _tmpl$2();
|
|
33
|
+
return spread(y, _, !1, !0), insert(y, createComponent(For, {
|
|
33
34
|
get each() {
|
|
34
|
-
return
|
|
35
|
+
return v(m.value);
|
|
35
36
|
},
|
|
36
37
|
children: (e) => createComponent(Tag, {
|
|
37
|
-
get style() {
|
|
38
|
-
return `background: ${e.color}`;
|
|
39
|
-
},
|
|
40
38
|
get disabled() {
|
|
41
|
-
return
|
|
39
|
+
return m.disabled;
|
|
40
|
+
},
|
|
41
|
+
get value() {
|
|
42
|
+
return e?.text ?? e?.label ?? e?.name ?? e;
|
|
43
|
+
},
|
|
44
|
+
get color() {
|
|
45
|
+
return m.color ?? e?.color;
|
|
42
46
|
},
|
|
43
|
-
onDel: () =>
|
|
47
|
+
onDel: () => m.onChange(v(m.value).filter((m) => m != e)),
|
|
44
48
|
get children() {
|
|
45
|
-
return memo(() => !!
|
|
49
|
+
return memo(() => !!m.children)() ? m.children(e) : e?.text ?? e?.label ?? e?.name ?? e;
|
|
46
50
|
}
|
|
47
51
|
})
|
|
48
|
-
}), null), insert(
|
|
49
|
-
var
|
|
50
|
-
return () =>
|
|
52
|
+
}), null), insert(y, (() => {
|
|
53
|
+
var g = memo(() => !m.disabled);
|
|
54
|
+
return () => g() && createComponent(Tag, {
|
|
51
55
|
disabled: !0,
|
|
52
56
|
get onClick() {
|
|
53
|
-
return
|
|
57
|
+
return m.onAdd;
|
|
54
58
|
},
|
|
55
59
|
get children() {
|
|
56
60
|
return createComponent(plus_default, {});
|
|
57
61
|
}
|
|
58
62
|
});
|
|
59
|
-
})(), null),
|
|
63
|
+
})(), null), y;
|
|
60
64
|
})();
|
|
61
65
|
}, Tag = (e) => {
|
|
62
|
-
let
|
|
63
|
-
|
|
66
|
+
let _;
|
|
67
|
+
[e, _] = splitProps(e, [
|
|
64
68
|
"disabled",
|
|
69
|
+
"value",
|
|
65
70
|
"children",
|
|
71
|
+
"color",
|
|
66
72
|
"onDel"
|
|
67
|
-
])
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return
|
|
73
|
+
]);
|
|
74
|
+
let v = e.color === void 0 && e.value != null ? stringToColor(String(e.value)) : e.color;
|
|
75
|
+
return _ = combineProps({
|
|
76
|
+
get class() {
|
|
77
|
+
return `flex items-center px-2 py-1 rd-sm text-3.5 lh-[1] ${v ? "" : "bg-gray/20"}`;
|
|
78
|
+
},
|
|
79
|
+
get style() {
|
|
80
|
+
return v ? `background: ${v}` : void 0;
|
|
81
|
+
}
|
|
82
|
+
}, _), (() => {
|
|
83
|
+
var v = _tmpl$2();
|
|
84
|
+
return spread(v, _, !1, !0), insert(v, () => e.children, null), insert(v, (() => {
|
|
85
|
+
var g = memo(() => !e.disabled);
|
|
86
|
+
return () => g() && createComponent(x_default, {
|
|
72
87
|
class: "icon-clickable flex-shrink-0 size-4! ml-1 mr--1 op-75",
|
|
73
88
|
get onClick() {
|
|
74
89
|
return e.onDel;
|
|
75
90
|
}
|
|
76
91
|
});
|
|
77
|
-
})(), null),
|
|
92
|
+
})(), null), v;
|
|
78
93
|
})();
|
|
79
|
-
}, evaluateFormula = (e,
|
|
94
|
+
}, evaluateFormula = (e, m) => {
|
|
80
95
|
try {
|
|
81
|
-
let
|
|
82
|
-
return Function(...Object.keys(
|
|
96
|
+
let h = { data: m };
|
|
97
|
+
return Function(...Object.keys(h), "return " + e)(...Object.values(h));
|
|
83
98
|
} catch {
|
|
84
99
|
return "公式错误";
|
|
85
100
|
}
|
|
101
|
+
}, text2colorMap = {
|
|
102
|
+
启用: "#10b981",
|
|
103
|
+
完成: "#10b981",
|
|
104
|
+
成功: "#10b981",
|
|
105
|
+
success: "#10b981",
|
|
106
|
+
done: "#10b981",
|
|
107
|
+
completed: "#10b981",
|
|
108
|
+
错误: "#ef4444",
|
|
109
|
+
失败: "#ef4444",
|
|
110
|
+
异常: "#ef4444",
|
|
111
|
+
error: "#ef4444",
|
|
112
|
+
fail: "#ef4444",
|
|
113
|
+
failed: "#ef4444",
|
|
114
|
+
警告: "#f59e0b",
|
|
115
|
+
warning: "#f59e0b",
|
|
116
|
+
warn: "#f59e0b",
|
|
117
|
+
进行中: "#3b82f6",
|
|
118
|
+
处理中: "#3b82f6",
|
|
119
|
+
执行中: "#3b82f6",
|
|
120
|
+
pending: "#3b82f6",
|
|
121
|
+
processing: "#3b82f6",
|
|
122
|
+
running: "#3b82f6",
|
|
123
|
+
in_progress: "#3b82f6",
|
|
124
|
+
info: "#6366f1",
|
|
125
|
+
暂停: "#f59e0b",
|
|
126
|
+
已暂停: "#f59e0b",
|
|
127
|
+
paused: "#f59e0b",
|
|
128
|
+
禁用: "#d1d5db",
|
|
129
|
+
已禁用: "#d1d5db",
|
|
130
|
+
取消: "#d1d5db",
|
|
131
|
+
已取消: "#d1d5db",
|
|
132
|
+
关闭: "#d1d5db",
|
|
133
|
+
已关闭: "#d1d5db",
|
|
134
|
+
disabled: "#d1d5db",
|
|
135
|
+
cancelled: "#d1d5db",
|
|
136
|
+
canceled: "#d1d5db",
|
|
137
|
+
closed: "#d1d5db",
|
|
138
|
+
草稿: "#9ca3af",
|
|
139
|
+
未开始: "#9ca3af",
|
|
140
|
+
未启用: "#9ca3af",
|
|
141
|
+
draft: "#9ca3af",
|
|
142
|
+
inactive: "#9ca3af",
|
|
143
|
+
审核中: "#8b5cf6",
|
|
144
|
+
审批中: "#8b5cf6",
|
|
145
|
+
待审批: "#8b5cf6",
|
|
146
|
+
review: "#8b5cf6",
|
|
147
|
+
已发布: "#10b981",
|
|
148
|
+
已上线: "#10b981",
|
|
149
|
+
published: "#10b981",
|
|
150
|
+
online: "#10b981",
|
|
151
|
+
active: "#10b981",
|
|
152
|
+
过期: "#d1d5db",
|
|
153
|
+
已过期: "#d1d5db",
|
|
154
|
+
超时: "#ef4444",
|
|
155
|
+
expired: "#d1d5db",
|
|
156
|
+
timeout: "#ef4444",
|
|
157
|
+
归档: "#9ca3af",
|
|
158
|
+
已归档: "#9ca3af",
|
|
159
|
+
archived: "#9ca3af"
|
|
160
|
+
};
|
|
161
|
+
var stringToColor = (e) => {
|
|
162
|
+
if (text2colorMap[e]) return text2colorMap[e];
|
|
163
|
+
let m = 0;
|
|
164
|
+
for (let h = 0; h < e.length; h++) m = (m << 5) - m + e.charCodeAt(h) | 0;
|
|
165
|
+
return `hsl(${Math.abs(m * 137) % 360} 60% 88% / 0.75)`;
|
|
86
166
|
};
|
|
87
|
-
export { Checkbox, Files, Tag, Tags, evaluateFormula };
|
|
167
|
+
export { Checkbox, Files, Tag, Tags, evaluateFormula, text2colorMap };
|
|
@@ -20,6 +20,7 @@ declare module '../../index' {
|
|
|
20
20
|
}
|
|
21
21
|
export type Render = (props: TDProps) => JSX.Element | any;
|
|
22
22
|
export declare const RenderPlugin: Plugin;
|
|
23
|
+
export { text2colorMap } from './components';
|
|
23
24
|
export declare const renders: {
|
|
24
25
|
text: Render;
|
|
25
26
|
number: Render;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { renderComponent, solidComponent } from "../../components/utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { getOpt, toArr } from "../../utils.js";
|
|
3
3
|
import { mergeProps as mergeProps$2 } from "../../mergeProps2.js";
|
|
4
|
-
import { Checkbox, Files } from "./components.js";
|
|
4
|
+
import { Checkbox, Files, Tags, text2colorMap } from "./components.js";
|
|
5
5
|
import { createComponent, insert, template } from "solid-js/web";
|
|
6
6
|
import { createMemo } from "solid-js";
|
|
7
7
|
var _tmpl$ = /* @__PURE__ */ template("<div class=\"flex items-center h-full\">");
|
|
@@ -9,21 +9,26 @@ const RenderPlugin = {
|
|
|
9
9
|
name: "render",
|
|
10
10
|
priority: -Infinity,
|
|
11
11
|
store: () => ({ renders: { ...renders } }),
|
|
12
|
-
rewriteProps: { Td: ({ Td:
|
|
12
|
+
rewriteProps: { Td: ({ Td: m }, { store: h }) => (g) => (h.props.cpu && (g = mergeProps$2(() => ({}), g)), createComponent(m, mergeProps$2(g, { get children() {
|
|
13
13
|
return createMemo(() => {
|
|
14
|
-
let
|
|
15
|
-
return
|
|
14
|
+
let m = ((e) => typeof e == "string" ? h.renders[e] : e)(g.col.render ?? g.col.type ?? text);
|
|
15
|
+
return m == text ? text(g) : renderComponent(m, g, h);
|
|
16
16
|
});
|
|
17
17
|
} }))) }
|
|
18
18
|
};
|
|
19
|
-
var text = (e) => e.col.enum ?
|
|
19
|
+
var text = (e) => e.col.enum ? createComponent(Tags, {
|
|
20
|
+
disabled: !0,
|
|
21
|
+
get value() {
|
|
22
|
+
return toArr(e.value).map((m) => getOpt(e.col.enum, m)?.label ?? m);
|
|
23
|
+
}
|
|
24
|
+
}) : e.value;
|
|
20
25
|
const renders = {
|
|
21
26
|
text,
|
|
22
27
|
number: text,
|
|
23
28
|
date: text,
|
|
24
29
|
checkbox: (e) => (() => {
|
|
25
|
-
var
|
|
26
|
-
return insert(
|
|
30
|
+
var m = _tmpl$();
|
|
31
|
+
return insert(m, createComponent(Checkbox, {
|
|
27
32
|
class: "",
|
|
28
33
|
get value() {
|
|
29
34
|
return e.value;
|
|
@@ -31,7 +36,7 @@ const renders = {
|
|
|
31
36
|
get onChange() {
|
|
32
37
|
return e.onChange;
|
|
33
38
|
}
|
|
34
|
-
})),
|
|
39
|
+
})), m;
|
|
35
40
|
})(),
|
|
36
41
|
file: (e) => createComponent(Files, {
|
|
37
42
|
get value() {
|
|
@@ -44,4 +49,4 @@ const renders = {
|
|
|
44
49
|
})
|
|
45
50
|
};
|
|
46
51
|
for (let e in renders) renders[e] = solidComponent(renders[e]);
|
|
47
|
-
export { RenderPlugin, renders };
|
|
52
|
+
export { RenderPlugin, renders, text2colorMap };
|
package/dist/style.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--un-bg-opacity:100%;--un-leading:initial;--un-content:"";--un-translate-x:initial;--un-translate-y:initial;--un-translate-z:initial;--un-text-opacity:100%;--un-border-opacity:100%;--un-space-y-reverse:initial;--un-space-x-reverse:initial;--un-outline-style:solid;--un-outline-opacity:100%}}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-leading{syntax:"*";inherits:false}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}@property --un-numeric-figure{syntax:"*";inherits:false}@property --un-numeric-fraction{syntax:"*";inherits:false}@property --un-numeric-spacing{syntax:"*";inherits:false}@property --un-ordinal{syntax:"*";inherits:false}@property --un-slashed-zero{syntax:"*";inherits:false}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}:root,:host{--spacing:.25rem;--radius-DEFAULT:.25rem;--colors-gray-DEFAULT:#99a1af;--leading-snug:1.375;--colors-gray-800:#1e2939;--colors-white:#fff;--colors-gray-100:#f3f4f6;--colors-gray-900:#101828;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--text-xs-fontSize:.75rem;--text-xs-lineHeight:1rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-md:.375rem;--radius-xl:.75rem;--fontWeight-medium:500;--fontWeight-semibold:600;--tracking-wide:.025em;--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--colors-red-DEFAULT:#ff6568;--text-2xl-fontSize:1.5rem;--text-2xl-lineHeight:2rem;--colors-green-DEFAULT:#05df72;--colors-black:#000;--font-sans:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--default-font-family:var(--font-sans);--default-monoFont-family:var(--font-mono)}@supports (color:lab(0% 0 0)){:root,:host{--colors-gray-DEFAULT:lab(65.9269% -.832677 -8.17474);--colors-gray-800:lab(16.1051% -1.18239 -11.7533);--colors-gray-100:lab(96.1596% -.082314 -1.13575);--colors-gray-900:lab(8.11897% .811271 -12.254);--colors-blue-DEFAULT:lab(65.0361% -1.42065 -56.9802);--colors-red-DEFAULT:lab(63.7053% 60.745 31.3109);--colors-green-DEFAULT:lab(78.503% -64.9264 39.7492)}}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-featureSettings,normal);font-variation-settings:var(--default-font-variationSettings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-monoFont-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-monoFont-featureSettings,normal);font-variation-settings:var(--default-monoFont-variationSettings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden~=until-found])){display:none!important}.container{width:100%}.aic{align-items:center}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.text-2xl{font-size:var(--text-2xl-fontSize);line-height:var(--un-leading,var(--text-2xl-lineHeight))}.text-3{font-size:.75rem}.text-3\.5{font-size:.875rem}.text-4{font-size:1rem}.text-sm{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight))}.text-xs{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight))}.c-\[--c-primary\]{color:color-mix(in oklab,var(--c-primary)var(--un-text-opacity),transparent)}.c-\#1e3a8a{color:color-mix(in oklab,#1e3a8a var(--un-text-opacity),transparent)}.c-\#7c2d12{color:color-mix(in oklab,#7c2d12 var(--un-text-opacity),transparent)}.c-blue{color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-text-opacity),transparent)}.c-gray\/70{color:color-mix(in srgb,var(--colors-gray-DEFAULT)70%,transparent)}.c-red\/75{color:color-mix(in srgb,var(--colors-red-DEFAULT)75%,transparent)}.leading-5{--un-leading:calc(4px*5);line-height:20px}.lh-\[1\]{--un-leading:1;line-height:1}.tracking-wide{--un-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.font-medium{--un-font-weight:var(--fontWeight-medium);font-weight:var(--fontWeight-medium)}.font-mono{font-family:var(--font-mono)}.font-semibold{--un-font-weight:var(--fontWeight-semibold);font-weight:var(--fontWeight-semibold)}.m9{margin:36px}.mx-1{margin-inline:4px}.mx-2{margin-inline:8px}.mx-3\!{margin-inline:12px!important}.my-1{margin-block:4px}.ml{margin-left:16px}.ml-\.5{margin-left:2px}.ml-1{margin-left:4px}.mr--1{margin-right:-4px}.mr-1{margin-right:4px}.mr-2{margin-right:8px}.mr-2\.5{margin-right:10px}.mt-1{margin-top:4px}.p-0\!{padding:0!important}.p-1{padding:4px}.p-4\!{padding:16px!important}.px,.px-4{padding-inline:16px}.px-1\.5{padding-inline:6px}.px-2{padding-inline:8px}.px-3{padding-inline:12px}.py-1{padding-block:4px}.py-1\.5{padding-block:6px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pl-4{padding-left:16px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.text-center{text-align:center}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-1\.5px{outline-style:var(--un-outline-style);outline-width:1.5px}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-\[--c-primary\]{outline-color:color-mix(in oklab,var(--c-primary)var(--un-outline-opacity),transparent)}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.outline-none{--un-outline-style:none;outline-style:none}.outline-solid{--un-outline-style:solid;outline-style:solid}.b,.b-1,.border{border-width:1px}.b-2px{border-width:2px}.b-r-0{border-right-width:0}.b-\[--table-bg\]{border-color:color-mix(in oklab,var(--table-bg)var(--un-border-opacity),transparent)}.b-\#00000000\!{border-color:color-mix(in oklab,#0000 var(--un-border-opacity),transparent)!important}.b-\#4f7ff0{border-color:color-mix(in oklab,#4f7ff0 var(--un-border-opacity),transparent)}.b-\#f59e0b{border-color:color-mix(in oklab,#f59e0b var(--un-border-opacity),transparent)}.rd-1{border-radius:.25rem}.rd-1\.5{border-radius:.375rem}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rd-l-4{border-top-left-radius:1rem;border-bottom-left-radius:1rem}.b-dashed{--un-border-style:dashed;border-style:dashed}.b-solid{--un-border-style:solid;border-style:solid}.bg-\[--bg\]{background-color:color-mix(in oklab,var(--bg)var(--un-bg-opacity),transparent)}.bg-\[--c-primary\]{background-color:color-mix(in oklab,var(--c-primary)var(--un-bg-opacity),transparent)}.bg-\[--table-bg\]{background-color:color-mix(in oklab,var(--table-bg)var(--un-bg-opacity),transparent)}.bg-\[--table-header-bg\]{background-color:color-mix(in oklab,var(--table-header-bg)var(--un-bg-opacity),transparent)}.bg-\#dbe6ff\/75{background-color:#dbe6ffbf;background-color:lab(91.0303% -.143617 -13.4803/.75)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.bg-\#fff3d6\/85{background-color:#fff3d6d9;background-color:lab(96.236% .744313 15.5662/.85)}.bg-blue\/20\!{background-color:color-mix(in srgb,var(--colors-blue-DEFAULT)20%,transparent)!important}.bg-gray\/20{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)20%,transparent)}.bg-green\!{background-color:color-mix(in srgb,var(--colors-green-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-red\!{background-color:color-mix(in srgb,var(--colors-red-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-transparent{background-color:#0000}.hover\:bg-\[--li-hover-bg\]:hover{background-color:color-mix(in oklab,var(--li-hover-bg)var(--un-bg-opacity),transparent)}.hover\:bg-black\/8:hover{background-color:color-mix(in srgb,var(--colors-black)8%,transparent)}.op-0{opacity:0}.op-15{opacity:.15}.op-60{opacity:.6}.op-75{opacity:.75}.op40{opacity:.4}.opacity-50{opacity:.5}.group:hover .group-hover\:op-100{opacity:1}.hover\:underline:hover{text-decoration-line:underline}.flex{display:flex}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-1{gap:4px}.gap-1\.5{gap:6px}.gap-2{gap:8px}.grid{display:grid}.size-3\.5{width:14px;height:14px}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-2\.5{height:10px}.h-3\.5{height:14px}.h-5{height:20px}.h-6{height:24px}.h-6\.5{height:26px}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.max-h-60{max-height:240px}.max-h-inherit{max-height:inherit}.min-h-16{min-height:64px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.min-w-24{min-width:96px}.min-w-44{min-width:176px}.min-w-52{min-width:208px}.w-10{width:40px}.w-10px\!{width:10px!important}.w-2\.5{width:10px}.w-3\.5{width:14px}.w-6\.5{width:26px}.w-8\!{width:32px!important}.w-a\!{width:auto!important}.w-full{width:100%}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.inline-block{display:inline-block}.contents{display:contents}.hidden{display:none}.visible{visibility:visible}.collapse{visibility:collapse}.cursor-pointer{cursor:pointer}.cursor-crosshair{cursor:crosshair}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.uppercase{text-transform:uppercase}.shadow-sm{--un-shadow:0 1px 3px 0 var(--un-shadow-color,#0000001a),0 1px 2px -1px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.shadow-xl{--un-shadow:0 20px 25px -5px var(--un-shadow-color,#0000001a),0 8px 10px -6px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.translate-x--1\/2{--un-translate-x:-50%;translate:var(--un-translate-x)var(--un-translate-y)}.translate-x-1\/2{--un-translate-x:50%;translate:var(--un-translate-x)var(--un-translate-y)}.translate-y--1\/2{--un-translate-y:-50%;translate:var(--un-translate-x)var(--un-translate-y)}.transform{transform:var(--un-rotate-x)var(--un-rotate-y)var(--un-rotate-z)var(--un-skew-x)var(--un-skew-y)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,--un-gradient-from,--un-gradient-via,--un-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction));transition-duration:var(--un-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--un-ease,var(--default-transition-timingFunction));transition-duration:var(--un-duration,var(--default-transition-duration))}.items-start{align-items:flex-start}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left--0,.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\/2{top:50%}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.z--1{z-index:-1}.z-1{z-index:1}.z-2{z-index:2}.z-9{z-index:9}.overflow-auto{overflow:auto}.of-y-auto{overflow-y:auto}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.filter{filter:var(--un-blur,)var(--un-brightness,)var(--un-contrast,)var(--un-grayscale,)var(--un-hue-rotate,)var(--un-invert,)var(--un-saturate,)var(--un-sepia,)var(--un-drop-shadow,)}.table{display:table}.table-cell{display:table-cell}.tabular-nums{--un-numeric-spacing:tabular-nums;font-variant-numeric:var(--un-ordinal,)var(--un-slashed-zero,)var(--un-numeric-figure,)var(--un-numeric-spacing,)var(--un-numeric-fraction,)}:where(.space-y-5>:not(:last-child)){--un-space-y-reverse:0;margin-block-start:calc(calc(4px*5)*var(--un-space-y-reverse));margin-block-end:calc(calc(4px*5)*calc(1 - var(--un-space-y-reverse)))}@supports (color:color-mix(in lab, red, red)){.c-blue{color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-text-opacity),transparent)}.c-gray\/70{color:color-mix(in oklab,var(--colors-gray-DEFAULT)70%,transparent)}.c-red\/75{color:color-mix(in oklab,var(--colors-red-DEFAULT)75%,transparent)}.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.bg-blue\/20\!{background-color:color-mix(in oklab,var(--colors-blue-DEFAULT)20%,transparent)!important}.bg-gray\/20{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)20%,transparent)}.bg-green\!{background-color:color-mix(in oklab,var(--colors-green-DEFAULT)var(--un-bg-opacity),transparent)!important}.bg-red\!{background-color:color-mix(in oklab,var(--colors-red-DEFAULT)var(--un-bg-opacity),transparent)!important}.hover\:bg-black\/8:hover{background-color:color-mix(in oklab,var(--colors-black)8%,transparent)}}
|
|
2
2
|
|
|
3
|
-
.data-table{--bg:#fff;--c-primary:#51a2ff;--menu-bg:#fff;--li-hover-bg:#99a1af33;--table-b:1px solid var(--table-b-c);--table-b-c:#ebeef5;--table-c:#606266;--table-bg:#fff;--table-header-c:#909399;--table-header-bg:var(--table-bg);--table-row-hover-bg:#f5f7fa;--select-area-bg:#5292f71a;color:color-mix(in oklab,var(--table-c)var(--un-text-opacity),transparent);border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);background-color:color-mix(in oklab,var(--table-bg)var(--un-bg-opacity),transparent);font-size:14px;position:relative}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}.data-table--table{color:color-mix(in oklab,var(--table-c)var(--un-text-opacity),transparent);outline-style:var(--un-outline-style);border-collapse:collapse;table-layout:fixed;border-collapse:separate;border-spacing:0;border-width:0;outline-width:0;width:max-content}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}.data-table thead{color:color-mix(in oklab,var(--table-header-c)var(--un-text-opacity),transparent)}.data-table tr:hover>td{background-color:color-mix(in oklab,var(--table-row-hover-bg)var(--un-bg-opacity),transparent)}.data-table th{background-color:color-mix(in oklab,var(--table-header-bg)var(--un-bg-opacity),transparent)}.data-table td{background-color:color-mix(in oklab,var(--table-bg)var(--un-bg-opacity),transparent)}.data-table td,.data-table th{vertical-align:middle;outline-style:var(--un-outline-style);border-width:0;border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);--un-border-style:solid;box-sizing:border-box;text-align:inherit;background-image:linear-gradient(var(--table-b-c),var(--table-b-c));background-position:100% 100%,100% 0;background-repeat:no-repeat;background-size:100% 1px,1px 100%;border-style:solid;outline-width:0;padding-block:2px;padding-inline:8px}.data-table td:empty:after{content:"ㅤ"!important}.data-table--border{--un-border-style:solid;border-style:solid;border-width:1px}.data-table--border th,.data-table--border td{background-image:linear-gradient(var(--table-b-c),var(--table-b-c)),linear-gradient(var(--table-b-c),var(--table-b-c))}.data-table__empty{--un-leading:calc(4px*15);opacity:.4;justify-content:center;align-items:center;width:100%;line-height:60px;display:flex;position:sticky;left:0}@property --un-leading{syntax:"*";inherits:false}.data-table--scroll-view{overflow:auto}.data-table__layers{pointer-events:none;z-index:99;position:absolute;inset:0}.data-table__layers>*{position:absolute}.data-table__loading{background-color:color-mix(in oklab,var(--table-bg)70%,transparent);pointer-events:auto;z-index:99;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.data-table__load-more{color:color-mix(in srgb,var(--colors-gray-DEFAULT)70%,transparent);text-align:center;padding-block:8px;font-size:.75rem}@supports (color:color-mix(in lab, red, red)){.data-table__load-more{color:color-mix(in oklab,var(--colors-gray-DEFAULT)70%,transparent)}}.range-selected{position:relative}.range-selected>.area{border-width:0;border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--select-area-bg)var(--un-bg-opacity),transparent);pointer-events:none;border-style:solid;position:absolute;inset:0}.range-selected-l>.area{border-left-width:1.5px}.range-selected-r>.area{border-right-width:1.5px}.range-selected-t>.area{border-top-width:1.5px}.range-selected-b>.area{border-bottom-width:1.5px}.row-range-highlight,.col-range-highlight{position:relative}.row-range-highlight>.area,.col-range-highlight>.area{border-width:0;border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--c-primary)10%,transparent);pointer-events:none;border-style:solid;position:absolute;inset:0}.row-range-highlight.index>.area{border-right-width:1px}.col-range-highlight>.area{border-bottom-width:1px}.sticky-header{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent);z-index:9;position:sticky;top:0}.sticky-header:after{pointer-events:none;--un-content:"";content:var(--un-content);width:100%;height:10px;position:absolute;top:100%;box-shadow:inset 0 10px 10px -10px #00000026}@property --un-content{syntax:"*";inherits:false;initial-value:""}.fixed-left,.fixed-right{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent);z-index:2;position:sticky!important}.fixed-left.is-first:after,.fixed-left.is-last:after,.fixed-right.is-first:after,.fixed-right.is-last:after{pointer-events:none;--un-content:"";content:var(--un-content);width:10px;height:100%;position:absolute;top:0}.is-scroll-right .fixed-left.is-last:after,.is-scroll-mid .fixed-left.is-last:after{left:100%;box-shadow:inset 10px 0 10px -10px #00000026}.is-scroll-left .fixed-right.is-first:after,.is-scroll-mid .fixed-right.is-first:after{right:100%;box-shadow:inset -10px 0 10px -10px #00000026}.filter-input{--un-outline-style:none;border-width:1px;border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);border-radius:var(--radius-DEFAULT);box-sizing:border-box;outline-style:none;width:100%;margin-top:4px;padding-inline:6px;font-family:inherit;font-size:12px;display:block}.filter-input:focus{border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent)}.filter-input::placeholder{opacity:.3}.in-input{--un-outline-style:none;border-width:1px;border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);border-radius:var(--radius-DEFAULT);box-sizing:border-box;outline-style:none;padding-block:2px;padding-inline:6px;font-family:inherit;font-size:12px}.in-input:focus{border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent)}.in-input::placeholder{opacity:.3}.copied .range-selected>.area{border-style:dashed}.data-table.virtual{display:block;overflow:auto}.data-table.virtual thead{width:fit-content;display:block}.data-table.virtual thead>tr{display:flex}.data-table.virtual thead>tr>th{flex:none;display:block}.data-table.virtual tbody{width:fit-content;display:block}.data-table.virtual tbody>tr{display:flex}.data-table.virtual tbody>tr>td{flex:none;display:block}.row-selection{width:40px;position:relative}.row-selection>label{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}.icon-clickable{box-sizing:border-box;border-radius:.25rem;justify-content:center;align-items:center;width:20px;height:20px;padding:2px;display:flex}.icon-clickable:hover{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent)}@supports (color:color-mix(in lab, red, red)){.icon-clickable:hover{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}.icon-clickable>svg{width:100%;height:100%}input[type=checkbox].you-checkbox{color:color-mix(in oklab,#2196f3 var(--un-text-opacity),transparent);appearance:none;outline-offset:0px;--un-border-style:solid;border:2px solid;border-radius:.25rem;width:16px;height:16px;margin:4px;position:relative}input[type=checkbox].you-checkbox:focus{outline-style:var(--un-outline-style);--un-outline-style:solid;outline:4px solid oklab(65.8156% -.0610627 -.157539/.4)}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}input[type=checkbox].you-checkbox:checked{background-color:currentColor}input[type=checkbox].you-checkbox.checked:after{color:color-mix(in oklab,#fff var(--un-text-opacity),transparent);--un-content:"✓";content:var(--un-content);--un-translate-x:-50%;--un-translate-y:-50%;translate:var(--un-translate-x)var(--un-translate-y);z-index:1;font-size:.75rem;position:absolute;top:50%;left:50%}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}td.is-editing{position:relative}td.is-invalid{outline-offset:-1.5px;outline:1.5px solid #ff4d4f;position:relative}.in-cell-edit-wrapper{z-index:1;position:absolute;inset:0;box-shadow:0 0 10px -2px #00000050}.cell-validating{border-width:2px;border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent);pointer-events:none;--un-translate-y:-50%;width:12px;height:12px;translate:var(--un-translate-x)var(--un-translate-y);border-top-color:#0000;border-radius:3.40282e38px;animation:1s linear infinite spin;display:block;position:absolute;top:50%;right:4px}.cell-validation-error{z-index:2;color:#ff4d4f;white-space:nowrap;pointer-events:none;background:#fff1f0;border:1px solid #ffccc7;border-radius:4px;padding:2px 8px;font-size:12px;position:absolute;top:100%;left:0;box-shadow:0 2px 8px #00000020}.cell-validation-error:empty{display:none}.in-cell__resize-handle{width:100%;height:100%;position:absolute}.in-cell__resize-handle:hover:after{background-color:color-mix(in oklab,var(--c-primary)40%,transparent)}.in-cell__resize-handle:active:after{background-color:color-mix(in oklab,var(--c-primary)var(--un-bg-opacity),transparent)}.in-cell__resize-handle:after{--un-content:"";content:var(--un-content)}.li{cursor:pointer;position:relative}.li:hover,.li.hover{background-color:color-mix(in oklab,var(--li-hover-bg)var(--un-bg-opacity),transparent)}.li:active:before,.li.selected:before,.li.active:before{content:"";border-radius:inherit;background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)15%,transparent);pointer-events:none;position:absolute;inset:0}@supports (color:color-mix(in lab, red, red)){.li:active:before,.li.selected:before,.li.active:before{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)15%,transparent)}}.li.disabled,.li[disabled]{opacity:.4}.tt-menu{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight));border-width:1px;border-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--menu-bg)var(--un-bg-opacity),transparent);cursor:default;--un-shadow:0 10px 15px -3px var(--un-shadow-color,#0000001a),0 4px 6px -4px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);border-style:solid;border-radius:.5rem;padding-block:4px}@supports (color:color-mix(in lab, red, red)){.tt-menu{border-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}:where(.tt-menu>:not(:last-child)){--un-space-y-reverse:0;margin-block-start:calc(calc(4px*.5)*var(--un-space-y-reverse));margin-block-end:calc(calc(4px*.5)*calc(1 - var(--un-space-y-reverse)))}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}.tt-menu-x{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight));border-width:1px;border-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--menu-bg)var(--un-bg-opacity),transparent);cursor:default;--un-shadow:0 10px 15px -3px var(--un-shadow-color,#0000001a),0 4px 6px -4px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);border-style:solid;border-radius:.5rem;padding-inline:4px}@supports (color:color-mix(in lab, red, red)){.tt-menu-x{border-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}:where(.tt-menu-x>:not(:last-child)){--un-space-x-reverse:0;margin-inline-start:calc(calc(4px*.5)*var(--un-space-x-reverse));margin-inline-end:calc(calc(4px*.5)*calc(1 - var(--un-space-x-reverse)))}@property --un-space-x-reverse{syntax:"*";inherits:false;initial-value:0}.tt-menu-x>.hr{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent);width:1px;margin-block:6px}@supports (color:color-mix(in lab, red, red)){.tt-menu-x>.hr{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}.tt-tooltip{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight));color:color-mix(in srgb,var(--colors-white)var(--un-text-opacity),transparent);--un-leading:var(--leading-snug);line-height:var(--leading-snug);background-color:color-mix(in srgb,var(--colors-gray-800)var(--un-bg-opacity),transparent);-webkit-user-select:text;user-select:text;overflow-wrap:break-word;--un-shadow:0 4px 6px -1px var(--un-shadow-color,#0000001a),0 2px 4px -2px var(--un-shadow-color,#0000001a);width:max-content;box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);z-index:50;border-radius:.25rem;padding-block:8px;padding-inline:12px}@supports (color:color-mix(in lab, red, red)){.tt-tooltip{color:color-mix(in oklab,var(--colors-white)var(--un-text-opacity),transparent);background-color:color-mix(in oklab,var(--colors-gray-800)var(--un-bg-opacity),transparent)}}.dark .tt-tooltip{color:color-mix(in srgb,var(--colors-gray-900)var(--un-text-opacity),transparent);background-color:color-mix(in srgb,var(--colors-gray-100)var(--un-bg-opacity),transparent)}@supports (color:color-mix(in lab, red, red)){.dark .tt-tooltip{color:color-mix(in oklab,var(--colors-gray-900)var(--un-text-opacity),transparent);background-color:color-mix(in oklab,var(--colors-gray-100)var(--un-bg-opacity),transparent)}}.col__guide-line,.row__guide-line{background-color:color-mix(in oklab,var(--c-primary)var(--un-bg-opacity),transparent);pointer-events:none;z-index:9;position:fixed;top:0;left:0}th[draggable=true],td[draggable=true]{cursor:move}.input-no-spin::-webkit-outer-spin-button{appearance:none}.input-no-spin::-webkit-inner-spin-button{appearance:none}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
|
3
|
+
.data-table{--bg:#fff;--c-primary:#51a2ff;--menu-bg:#fff;--li-hover-bg:#99a1af33;--table-b:1px solid var(--table-b-c);--table-b-c:#ebeef5;--table-c:#606266;--table-bg:#fff;--table-header-c:#909399;--table-header-bg:var(--table-bg);--table-row-hover-bg:#f5f7fa;--select-area-bg:#5292f71a;color:color-mix(in oklab,var(--table-c)var(--un-text-opacity),transparent);border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);background-color:color-mix(in oklab,var(--table-bg)var(--un-bg-opacity),transparent);font-size:14px;position:relative}@property --un-text-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-border-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}.data-table--table{color:color-mix(in oklab,var(--table-c)var(--un-text-opacity),transparent);outline-style:var(--un-outline-style);border-collapse:collapse;table-layout:fixed;border-collapse:separate;border-spacing:0;border-width:0;outline-width:0;width:auto}@property --un-outline-style{syntax:"*";inherits:false;initial-value:solid}.data-table thead{color:color-mix(in oklab,var(--table-header-c)var(--un-text-opacity),transparent)}.data-table tr:hover>td{background-color:color-mix(in oklab,var(--table-row-hover-bg)var(--un-bg-opacity),transparent)}.data-table th{background-color:color-mix(in oklab,var(--table-header-bg)var(--un-bg-opacity),transparent)}.data-table td{background-color:color-mix(in oklab,var(--table-bg)var(--un-bg-opacity),transparent)}.data-table td,.data-table th{vertical-align:middle;outline-style:var(--un-outline-style);border-width:0;border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);--un-border-style:solid;box-sizing:border-box;text-align:inherit;background-image:linear-gradient(var(--table-b-c),var(--table-b-c));background-position:100% 100%,100% 0;background-repeat:no-repeat;background-size:100% 1px,1px 100%;border-style:solid;outline-width:0;padding-block:2px;padding-inline:8px}.data-table td:empty:after{content:"ㅤ"!important}.data-table--border{--un-border-style:solid;border-style:solid;border-width:1px}.data-table--border th,.data-table--border td{background-image:linear-gradient(var(--table-b-c),var(--table-b-c)),linear-gradient(var(--table-b-c),var(--table-b-c))}.data-table__empty{--un-leading:calc(4px*15);opacity:.4;justify-content:center;align-items:center;width:100%;line-height:60px;display:flex;position:sticky;left:0}@property --un-leading{syntax:"*";inherits:false}.data-table--scroll-view{overflow:auto}.data-table__layers{pointer-events:none;z-index:99;position:absolute;inset:0}.data-table__layers>*{position:absolute}.data-table__loading{background-color:color-mix(in oklab,var(--table-bg)70%,transparent);pointer-events:auto;z-index:99;justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.data-table__load-more{color:color-mix(in srgb,var(--colors-gray-DEFAULT)70%,transparent);text-align:center;padding-block:8px;font-size:.75rem}@supports (color:color-mix(in lab, red, red)){.data-table__load-more{color:color-mix(in oklab,var(--colors-gray-DEFAULT)70%,transparent)}}.range-selected{position:relative}.range-selected>.area{border-width:0;border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--select-area-bg)var(--un-bg-opacity),transparent);pointer-events:none;border-style:solid;position:absolute;inset:0}.range-selected-l>.area{border-left-width:1.5px}.range-selected-r>.area{border-right-width:1.5px}.range-selected-t>.area{border-top-width:1.5px}.range-selected-b>.area{border-bottom-width:1.5px}.row-range-highlight,.col-range-highlight{position:relative}.row-range-highlight>.area,.col-range-highlight>.area{border-width:0;border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--c-primary)10%,transparent);pointer-events:none;border-style:solid;position:absolute;inset:0}.row-range-highlight.index>.area{border-right-width:1px}.col-range-highlight>.area{border-bottom-width:1px}.sticky-header{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent);z-index:9;position:sticky;top:0}.sticky-header:after{pointer-events:none;--un-content:"";content:var(--un-content);width:100%;height:10px;position:absolute;top:100%;box-shadow:inset 0 10px 10px -10px #00000026}@property --un-content{syntax:"*";inherits:false;initial-value:""}.fixed-left,.fixed-right{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent);z-index:2;position:sticky!important}.fixed-left.is-first:after,.fixed-left.is-last:after,.fixed-right.is-first:after,.fixed-right.is-last:after{pointer-events:none;--un-content:"";content:var(--un-content);width:10px;height:100%;position:absolute;top:0}.is-scroll-right .fixed-left.is-last:after,.is-scroll-mid .fixed-left.is-last:after{left:100%;box-shadow:inset 10px 0 10px -10px #00000026}.is-scroll-left .fixed-right.is-first:after,.is-scroll-mid .fixed-right.is-first:after{right:100%;box-shadow:inset -10px 0 10px -10px #00000026}.filter-input{--un-outline-style:none;border-width:1px;border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);border-radius:var(--radius-DEFAULT);box-sizing:border-box;outline-style:none;width:100%;margin-top:4px;padding-inline:6px;font-family:inherit;font-size:12px;display:block}.filter-input:focus{border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent)}.filter-input::placeholder{opacity:.3}.in-input{--un-outline-style:none;border-width:1px;border-color:color-mix(in oklab,var(--table-b-c)var(--un-border-opacity),transparent);border-radius:var(--radius-DEFAULT);box-sizing:border-box;outline-style:none;padding-block:2px;padding-inline:6px;font-family:inherit;font-size:12px}.in-input:focus{border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent)}.in-input::placeholder{opacity:.3}.copied .range-selected>.area{border-style:dashed}.data-table.virtual{display:block;overflow:auto}.data-table.virtual thead{width:fit-content;display:block}.data-table.virtual thead>tr{display:flex}.data-table.virtual thead>tr>th{flex:none;display:block}.data-table.virtual tbody{width:fit-content;display:block}.data-table.virtual tbody>tr{display:flex}.data-table.virtual tbody>tr>td{flex:none;display:block}.row-selection{width:40px;position:relative}.row-selection>label{justify-content:center;align-items:center;width:100%;height:100%;display:flex;position:absolute;inset:0}.icon-clickable{box-sizing:border-box;border-radius:.25rem;justify-content:center;align-items:center;width:20px;height:20px;padding:2px;display:flex}.icon-clickable:hover{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent)}@supports (color:color-mix(in lab, red, red)){.icon-clickable:hover{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}.icon-clickable>svg{width:100%;height:100%}input[type=checkbox].you-checkbox{color:color-mix(in oklab,#2196f3 var(--un-text-opacity),transparent);appearance:none;outline-offset:0px;--un-border-style:solid;border:2px solid;border-radius:.25rem;width:16px;height:16px;margin:4px;position:relative}input[type=checkbox].you-checkbox:focus{outline-style:var(--un-outline-style);--un-outline-style:solid;outline:4px solid oklab(65.8156% -.0610627 -.157539/.4)}@property --un-outline-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}input[type=checkbox].you-checkbox:checked{background-color:currentColor}input[type=checkbox].you-checkbox.checked:after{color:color-mix(in oklab,#fff var(--un-text-opacity),transparent);--un-content:"✓";content:var(--un-content);--un-translate-x:-50%;--un-translate-y:-50%;translate:var(--un-translate-x)var(--un-translate-y);z-index:1;font-size:.75rem;position:absolute;top:50%;left:50%}@property --un-translate-x{syntax:"*";inherits:false;initial-value:0}@property --un-translate-y{syntax:"*";inherits:false;initial-value:0}@property --un-translate-z{syntax:"*";inherits:false;initial-value:0}td.is-editing{position:relative}td.is-invalid{outline-offset:-1.5px;outline:1.5px solid #ff4d4f;position:relative}.in-cell-edit-wrapper{z-index:1;position:absolute;inset:0;box-shadow:0 0 10px -2px #00000050}.cell-validating{border-width:2px;border-color:color-mix(in oklab,var(--c-primary)var(--un-border-opacity),transparent);pointer-events:none;--un-translate-y:-50%;width:12px;height:12px;translate:var(--un-translate-x)var(--un-translate-y);border-top-color:#0000;border-radius:3.40282e38px;animation:1s linear infinite spin;display:block;position:absolute;top:50%;right:4px}.cell-validation-error{z-index:2;color:#ff4d4f;white-space:nowrap;pointer-events:none;background:#fff1f0;border:1px solid #ffccc7;border-radius:4px;padding:2px 8px;font-size:12px;position:absolute;top:100%;left:0;box-shadow:0 2px 8px #00000020}.cell-validation-error:empty{display:none}.in-cell__resize-handle{width:100%;height:100%;position:absolute}.in-cell__resize-handle:hover:after{background-color:color-mix(in oklab,var(--c-primary)40%,transparent)}.in-cell__resize-handle:active:after{background-color:color-mix(in oklab,var(--c-primary)var(--un-bg-opacity),transparent)}.in-cell__resize-handle:after{--un-content:"";content:var(--un-content)}.li{cursor:pointer;position:relative}.li:hover,.li.hover{background-color:color-mix(in oklab,var(--li-hover-bg)var(--un-bg-opacity),transparent)}.li:active:before,.li.selected:before,.li.active:before{content:"";border-radius:inherit;background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)15%,transparent);pointer-events:none;position:absolute;inset:0}@supports (color:color-mix(in lab, red, red)){.li:active:before,.li.selected:before,.li.active:before{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)15%,transparent)}}.li.disabled,.li[disabled]{opacity:.4}.tt-menu{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight));border-width:1px;border-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--menu-bg)var(--un-bg-opacity),transparent);cursor:default;--un-shadow:0 10px 15px -3px var(--un-shadow-color,#0000001a),0 4px 6px -4px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);border-style:solid;border-radius:.5rem;padding-block:4px}@supports (color:color-mix(in lab, red, red)){.tt-menu{border-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}@property --un-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-shadow-color{syntax:"*";inherits:false}@property --un-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-shadow-color{syntax:"*";inherits:false}@property --un-ring-color{syntax:"*";inherits:false}@property --un-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-inset-ring-color{syntax:"*";inherits:false}@property --un-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --un-ring-inset{syntax:"*";inherits:false}@property --un-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --un-ring-offset-color{syntax:"*";inherits:false}@property --un-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}:where(.tt-menu>:not(:last-child)){--un-space-y-reverse:0;margin-block-start:calc(calc(4px*.5)*var(--un-space-y-reverse));margin-block-end:calc(calc(4px*.5)*calc(1 - var(--un-space-y-reverse)))}@property --un-space-y-reverse{syntax:"*";inherits:false;initial-value:0}.tt-menu-x{font-size:var(--text-sm-fontSize);line-height:var(--un-leading,var(--text-sm-lineHeight));border-width:1px;border-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent);--un-border-style:solid;background-color:color-mix(in oklab,var(--menu-bg)var(--un-bg-opacity),transparent);cursor:default;--un-shadow:0 10px 15px -3px var(--un-shadow-color,#0000001a),0 4px 6px -4px var(--un-shadow-color,#0000001a);box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);border-style:solid;border-radius:.5rem;padding-inline:4px}@supports (color:color-mix(in lab, red, red)){.tt-menu-x{border-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}:where(.tt-menu-x>:not(:last-child)){--un-space-x-reverse:0;margin-inline-start:calc(calc(4px*.5)*var(--un-space-x-reverse));margin-inline-end:calc(calc(4px*.5)*calc(1 - var(--un-space-x-reverse)))}@property --un-space-x-reverse{syntax:"*";inherits:false;initial-value:0}.tt-menu-x>.hr{background-color:color-mix(in srgb,var(--colors-gray-DEFAULT)30%,transparent);width:1px;margin-block:6px}@supports (color:color-mix(in lab, red, red)){.tt-menu-x>.hr{background-color:color-mix(in oklab,var(--colors-gray-DEFAULT)30%,transparent)}}.tt-tooltip{font-size:var(--text-xs-fontSize);line-height:var(--un-leading,var(--text-xs-lineHeight));color:color-mix(in srgb,var(--colors-white)var(--un-text-opacity),transparent);--un-leading:var(--leading-snug);line-height:var(--leading-snug);background-color:color-mix(in srgb,var(--colors-gray-800)var(--un-bg-opacity),transparent);-webkit-user-select:text;user-select:text;overflow-wrap:break-word;--un-shadow:0 4px 6px -1px var(--un-shadow-color,#0000001a),0 2px 4px -2px var(--un-shadow-color,#0000001a);width:max-content;box-shadow:var(--un-inset-shadow),var(--un-inset-ring-shadow),var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);z-index:50;border-radius:.25rem;padding-block:8px;padding-inline:12px}@supports (color:color-mix(in lab, red, red)){.tt-tooltip{color:color-mix(in oklab,var(--colors-white)var(--un-text-opacity),transparent);background-color:color-mix(in oklab,var(--colors-gray-800)var(--un-bg-opacity),transparent)}}.dark .tt-tooltip{color:color-mix(in srgb,var(--colors-gray-900)var(--un-text-opacity),transparent);background-color:color-mix(in srgb,var(--colors-gray-100)var(--un-bg-opacity),transparent)}@supports (color:color-mix(in lab, red, red)){.dark .tt-tooltip{color:color-mix(in oklab,var(--colors-gray-900)var(--un-text-opacity),transparent);background-color:color-mix(in oklab,var(--colors-gray-100)var(--un-bg-opacity),transparent)}}.col__guide-line,.row__guide-line{background-color:color-mix(in oklab,var(--c-primary)var(--un-bg-opacity),transparent);pointer-events:none;z-index:9;position:fixed;top:0;left:0}th[draggable=true],td[draggable=true]{cursor:move}.input-no-spin::-webkit-outer-spin-button{appearance:none}.input-no-spin::-webkit-inner-spin-button{appearance:none}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
package/dist/utils.d.ts
CHANGED
|
@@ -30,5 +30,6 @@ export declare function resolveOptions(opts: Fnable<Awatable<Record<string, any>
|
|
|
30
30
|
label: any;
|
|
31
31
|
value: any;
|
|
32
32
|
}[];
|
|
33
|
+
export declare const getOpt: (opts: any, value: any) => any;
|
|
33
34
|
export declare function throttlePromise(of: any): () => Promise<unknown>;
|
|
34
35
|
export declare function change2(o1: any, o2: any): any;
|
package/dist/utils.js
CHANGED
|
@@ -1,64 +1,68 @@
|
|
|
1
1
|
import { useMemoAsync } from "./hooks/index.js";
|
|
2
2
|
import { tree_exports } from "./tree.js";
|
|
3
|
-
import { delay, isFunction, isPlainObject, isPromise } from "es-toolkit";
|
|
3
|
+
import { delay, isFunction, isPlainObject, isPromise, keyBy } from "es-toolkit";
|
|
4
4
|
function file2base64(e) {
|
|
5
|
-
return new Promise((
|
|
6
|
-
let
|
|
7
|
-
|
|
5
|
+
return new Promise((T, E) => {
|
|
6
|
+
let D = new FileReader();
|
|
7
|
+
D.readAsDataURL(e), D.onload = () => T(D.result);
|
|
8
8
|
});
|
|
9
9
|
}
|
|
10
10
|
function chooseFile(e) {
|
|
11
|
-
return new Promise((
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
11
|
+
return new Promise((T, E) => {
|
|
12
|
+
let D = document.createElement("input");
|
|
13
|
+
D.type = "file", D.accept = e?.accept, D.multiple = e?.multiple, D.onchange = () => {
|
|
14
|
+
D.files && D.files.length > 0 && T(D.multiple ? [...D.files] : D.files[0]);
|
|
15
|
+
}, D.oncancel = E, D.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 T = document.createElement("iframe");
|
|
23
|
+
T.srcdoc = `${[...document.querySelectorAll("style"), ...document.querySelectorAll("link[rel=\"stylesheet\"]")].map((e) => e.outerHTML).join("\n")}\n\n${e}`, Object.assign(T.style, {
|
|
24
24
|
position: "fixed",
|
|
25
25
|
display: "none"
|
|
26
|
-
}), document.body.append(
|
|
26
|
+
}), document.body.append(T), await new Promise((e) => T.contentWindow.addEventListener("load", e, { once: !0 })), await delay(300), T.contentWindow.print(), T.remove();
|
|
27
27
|
}
|
|
28
|
-
function mergeRect(e,
|
|
28
|
+
function mergeRect(e, T) {
|
|
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, T.x),
|
|
31
|
+
y: Math.min(e.y, T.y),
|
|
32
|
+
width: Math.max(e.right, T.right) - Math.min(e.x, T.x),
|
|
33
|
+
height: Math.max(e.bottom, T.bottom) - Math.min(e.y, T.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, ...T) => typeof e == "function" ? e(...T) : 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, T) => ((([T, E]) => e[T.trim()] = E.trim())(T.split(":")), e), {}) : {};
|
|
40
|
+
function findret(e, T) {
|
|
41
|
+
for (let E = 0; E < e.length; E++) {
|
|
42
|
+
let D = T(e[E], E);
|
|
43
|
+
if (D != null) return D;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function emptyObject(e) {
|
|
47
|
-
for (let
|
|
47
|
+
for (let T of Object.keys(e)) delete e[T];
|
|
48
48
|
return e;
|
|
49
49
|
}
|
|
50
|
-
async function findAsync(e,
|
|
51
|
-
for (let
|
|
50
|
+
async function findAsync(e, T) {
|
|
51
|
+
for (let E = 0; E < e.length; E++) if (await T(e[E], E)) return e[E];
|
|
52
52
|
}
|
|
53
|
-
var cache = /* @__PURE__ */ new WeakMap();
|
|
54
|
-
function resolveOptions(
|
|
55
|
-
let
|
|
56
|
-
return isFunction(
|
|
53
|
+
var cache = /* @__PURE__ */ new WeakMap(), cache2 = /* @__PURE__ */ new WeakMap();
|
|
54
|
+
function resolveOptions(T) {
|
|
55
|
+
let E = T;
|
|
56
|
+
return isFunction(E) && (E = E()), isPromise(E) ? (cache.has(T) || cache.set(T, useMemoAsync(() => E.then((e) => e.map((e) => resolveOptions(e))))), cache.get(T)()) : cache2.has(T) ? cache2.get(T) : (isPlainObject(E) && (E = Object.entries(E).map(([e, T]) => ({
|
|
57
57
|
value: e,
|
|
58
|
-
label:
|
|
59
|
-
...
|
|
60
|
-
}))),
|
|
58
|
+
label: T,
|
|
59
|
+
...T
|
|
60
|
+
}))), E = E?.map((e) => resolveOpt(e)) || [], cache2.set(T, E), E);
|
|
61
61
|
}
|
|
62
|
+
const getOpt = (() => {
|
|
63
|
+
let e = /* @__PURE__ */ new WeakMap();
|
|
64
|
+
return (T, E) => (e.get(T) ?? e.set(T, keyBy(resolveOptions(T), (e) => e.value)).get(T))[E];
|
|
65
|
+
})();
|
|
62
66
|
function resolveOpt(e) {
|
|
63
67
|
return isPlainObject(e) ? e : Array.isArray(e) ? {
|
|
64
68
|
label: e[0],
|
|
@@ -69,18 +73,18 @@ function resolveOpt(e) {
|
|
|
69
73
|
};
|
|
70
74
|
}
|
|
71
75
|
function throttlePromise(e) {
|
|
72
|
-
let
|
|
76
|
+
let T = !1, E;
|
|
73
77
|
return () => {
|
|
74
|
-
let
|
|
75
|
-
|
|
78
|
+
let D = new Promise(function(e) {
|
|
79
|
+
E = e;
|
|
76
80
|
});
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
}),
|
|
81
|
+
return T ? D : (T = !0, e(() => {
|
|
82
|
+
E(), T = !1, E = null;
|
|
83
|
+
}), D);
|
|
80
84
|
};
|
|
81
85
|
}
|
|
82
|
-
function change2(e,
|
|
83
|
-
for (let
|
|
84
|
-
return Object.assign(e,
|
|
86
|
+
function change2(e, T) {
|
|
87
|
+
for (let E in e) E in T || delete e[E];
|
|
88
|
+
return Object.assign(e, T), e;
|
|
85
89
|
}
|
|
86
|
-
export { change2, chooseFile, chooseImage, emptyObject, file2base64, findAsync, findret, getStyles, isEmpty, log, mergeRect, parseStyle, print, resolveOptions, throttlePromise, toArr, tree_exports as tree, unFn };
|
|
90
|
+
export { change2, chooseFile, chooseImage, emptyObject, file2base64, findAsync, findret, getOpt, getStyles, isEmpty, log, mergeRect, parseStyle, print, resolveOptions, throttlePromise, toArr, tree_exports as tree, unFn };
|