intable 0.0.15 → 0.0.16
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/__uno.css +1 -1
- package/dist/components/utils.d.ts +2 -1
- package/dist/components/utils.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -14
- package/dist/plugins/DiffPlugin.d.ts +1 -1
- package/dist/plugins/DiffPlugin.js +47 -38
- package/dist/plugins/EditablePlugin.d.ts +0 -4
- package/dist/plugins/EditablePlugin.js +93 -112
- package/dist/plugins/ExpandPlugin.js +1 -1
- package/dist/plugins/MenuPlugin.js +1 -1
- package/dist/plugins/RenderPlugin/index.js +6 -6
- package/dist/plugins/ValidatorPlugin.d.ts +21 -0
- package/dist/plugins/ValidatorPlugin.js +38 -0
- package/dist/plugins/ZodValidatorPlugin.d.ts +1 -1
- package/dist/plugins/ZodValidatorPlugin.js +2 -2
- package/dist/style.css +2 -2
- package/package.json +1 -1
package/dist/__uno.css
CHANGED
|
@@ -1 +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-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%;--un-leading:initial}}@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-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@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}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--
|
|
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-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%;--un-leading:initial}}@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-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@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}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--colors-green-DEFAULT:#05df72;--colors-red-DEFAULT:#ff6568;--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";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--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-blue-DEFAULT:lab(65.0361% -1.42065 -56.9802);--colors-green-DEFAULT:lab(78.503% -64.9264 39.7492);--colors-red-DEFAULT:lab(63.7053% 60.745 31.3109)}}*,: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-3\.5{font-size:.875rem}.lh-\[1\]{--un-leading:1;line-height:1}.m9{margin:36px}.mx-1{margin-inline:4px}.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}.p-1{padding:4px}.px,.px-4{padding-inline:16px}.px-2{padding-inline:8px}.py-1{padding-block:4px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.b{border-width:1px}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.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}.op-20{opacity:.2}.op-75{opacity:.75}.op40{opacity:.4}.flex{display:flex}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:8px}.grid{display:grid}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.w-10px\!{width:10px!important}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.hidden{display:none}.visible{visibility:visible}.collapse{visibility:collapse}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.translate-x-1\/2{--un-translate-x: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))}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z--1{z-index:-1}.z-1{z-index:1}.z-9{z-index:9}.overflow-auto{overflow:auto}.table{display:table}.table-cell{display:table-cell}@supports (color:color-mix(in lab, red, red)){.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.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}}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { JSX } from 'solid-js';
|
|
2
|
+
import type { TableStore } from '..';
|
|
2
3
|
export declare function solidComponent<T extends (...arg: any[]) => JSX.Element>(comp: T): T;
|
|
3
|
-
export declare function renderComponent(Comp: any, props: any,
|
|
4
|
+
export declare function renderComponent(Comp: any, props: any, store: TableStore): any;
|
package/dist/components/utils.js
CHANGED
|
@@ -3,6 +3,6 @@ function solidComponent(e) {
|
|
|
3
3
|
return e.__solid = 1, e;
|
|
4
4
|
}
|
|
5
5
|
function renderComponent(t, n, r) {
|
|
6
|
-
return t ? (t.__solid || (t = r(t)), createComponent(t, n)) : null;
|
|
6
|
+
return t ? (t.__solid || (t = r.props.renderer(t)), typeof t == "function" ? createComponent(t, n) : t) : null;
|
|
7
7
|
}
|
|
8
8
|
export { renderComponent, solidComponent };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import './plugins/ExpandPlugin';
|
|
|
15
15
|
import './plugins/CellMergePlugin';
|
|
16
16
|
import './plugins/TreePlugin';
|
|
17
17
|
import './plugins/HeaderGroup';
|
|
18
|
+
import './plugins/ValidatorPlugin';
|
|
18
19
|
export declare const Ctx: import("solid-js").Context<{
|
|
19
20
|
props: TableProps2;
|
|
20
21
|
store: TableStore;
|
|
@@ -26,7 +27,7 @@ type Pri<T> = {
|
|
|
26
27
|
type TableProps2 = Requireds<TableProps, ('Table' | 'Thead' | 'Tbody' | 'Tr' | 'Th' | 'Td' | 'EachRows' | 'EachCells' | 'rowKey' | 'data' | 'columns' | 'newRow')>;
|
|
27
28
|
type Each<T = any> = (props: {
|
|
28
29
|
each: T[];
|
|
29
|
-
children: (e: () =>
|
|
30
|
+
children: (e: () => T, i: () => number) => JSX.Element;
|
|
30
31
|
}) => JSX.Element;
|
|
31
32
|
type ProcessProps = {
|
|
32
33
|
[K in keyof TableProps]?: (prev: TableProps2, ctx: {
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import './style.css';;/* empty css */
|
|
|
4
4
|
import { CellSelectionPlugin } from "./plugins/CellSelectionPlugin.js";
|
|
5
5
|
import { ClipboardPlugin } from "./plugins/CopyPastePlugin.js";
|
|
6
6
|
import { EditablePlugin } from "./plugins/EditablePlugin.js";
|
|
7
|
-
import { solidComponent } from "./components/utils.js";
|
|
7
|
+
import { renderComponent, solidComponent } from "./components/utils.js";
|
|
8
8
|
import { RenderPlugin } from "./plugins/RenderPlugin/index.js";
|
|
9
9
|
import { MenuPlugin } from "./plugins/MenuPlugin.js";
|
|
10
10
|
import { CommandPlugin } from "./plugins/CommandPlugin.js";
|
|
@@ -16,6 +16,7 @@ import { ExpandPlugin } from "./plugins/ExpandPlugin.js";
|
|
|
16
16
|
import { CellMergePlugin } from "./plugins/CellMergePlugin.js";
|
|
17
17
|
import { TreePlugin } from "./plugins/TreePlugin.js";
|
|
18
18
|
import { HeaderGroupPlugin } from "./plugins/HeaderGroup.js";
|
|
19
|
+
import { ValidatorPlugin } from "./plugins/ValidatorPlugin.js";
|
|
19
20
|
import { createComponent, insert, memo, mergeProps, spread, template, use } from "solid-js/web";
|
|
20
21
|
import { $PROXY, For, batch, createComputed, createContext, createEffect, createMemo, createSignal, getOwner, mapArray, mergeProps as mergeProps$1, on, onCleanup, onMount, runWithOwner, untrack, useContext } from "solid-js";
|
|
21
22
|
import { createMutable, reconcile } from "solid-js/store";
|
|
@@ -35,28 +36,28 @@ const Ctx = createContext({
|
|
|
35
36
|
return q;
|
|
36
37
|
},
|
|
37
38
|
get plugins() {
|
|
38
|
-
return
|
|
39
|
+
return Z();
|
|
39
40
|
}
|
|
40
|
-
}), X = memoize((q) => runWithOwner(J, () => unFn(q, Y))),
|
|
41
|
+
}), X = memoize((q) => runWithOwner(J, () => unFn(q, Y))), Z = createMemo(() => [
|
|
41
42
|
...defaultsPlugins,
|
|
42
43
|
...q.plugins || [],
|
|
43
44
|
RenderPlugin
|
|
44
45
|
].map(X).sort((v, q) => (q.priority || 0) - (v.priority || 0)));
|
|
45
46
|
createComputed((v) => {
|
|
46
|
-
let q = difference(
|
|
47
|
+
let q = difference(Z(), v);
|
|
47
48
|
return runWithOwner(J, () => {
|
|
48
49
|
q.forEach((v) => Object.assign(Y, v.store?.(Y)));
|
|
49
|
-
}),
|
|
50
|
+
}), Z();
|
|
50
51
|
}, []), Y.props = (() => {
|
|
51
|
-
let v = getOwner(), J = {}, X = (q) => J[q] ??= runWithOwner(v, () => createMemo(() =>
|
|
52
|
-
function
|
|
53
|
-
return createMemo(() =>
|
|
52
|
+
let v = getOwner(), J = {}, X = (q) => J[q] ??= runWithOwner(v, () => createMemo(() => Q(q)));
|
|
53
|
+
function Q(v) {
|
|
54
|
+
return createMemo(() => Z().map((q) => q.rewriteProps?.[v]).filter((v) => v), void 0, { equals: isEqual })().reduce((q, J) => J({ [v]: q }, { store: Y }), q[v]);
|
|
54
55
|
}
|
|
55
56
|
return new Proxy({}, { get(v, q, J) {
|
|
56
57
|
return q == $PROXY ? J : X(q)();
|
|
57
58
|
} });
|
|
58
59
|
})(), onMount(() => {
|
|
59
|
-
createEffect(mapArray(
|
|
60
|
+
createEffect(mapArray(Z, (v) => v.onMount?.(Y)));
|
|
60
61
|
});
|
|
61
62
|
let $ = createMutable({
|
|
62
63
|
props: Y.props,
|
|
@@ -72,22 +73,22 @@ const Ctx = createContext({
|
|
|
72
73
|
});
|
|
73
74
|
};
|
|
74
75
|
var THead = () => {
|
|
75
|
-
let { props: v } = useContext(Ctx);
|
|
76
|
+
let { props: v, store: q } = useContext(Ctx);
|
|
76
77
|
return createComponent(v.Thead, { get children() {
|
|
77
78
|
return createComponent(v.Tr, { get children() {
|
|
78
79
|
return createComponent(v.EachCells, {
|
|
79
80
|
get each() {
|
|
80
81
|
return v.columns || [];
|
|
81
82
|
},
|
|
82
|
-
children: (
|
|
83
|
+
children: (J, Y) => createComponent(v.Th, {
|
|
83
84
|
get col() {
|
|
84
|
-
return
|
|
85
|
+
return J();
|
|
85
86
|
},
|
|
86
87
|
get x() {
|
|
87
|
-
return
|
|
88
|
+
return Y();
|
|
88
89
|
},
|
|
89
90
|
get children() {
|
|
90
|
-
return
|
|
91
|
+
return renderComponent(J().name, void 0, q);
|
|
91
92
|
}
|
|
92
93
|
})
|
|
93
94
|
});
|
|
@@ -379,6 +380,7 @@ const ScrollPlugin = {
|
|
|
379
380
|
ExpandPlugin,
|
|
380
381
|
RowSelectionPlugin,
|
|
381
382
|
IndexPlugin,
|
|
383
|
+
ValidatorPlugin,
|
|
382
384
|
EditablePlugin,
|
|
383
385
|
CellMergePlugin,
|
|
384
386
|
TreePlugin,
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
import { createComponent } from "solid-js/web";
|
|
1
|
+
import { className, createComponent, effect, memo, mergeProps, template } from "solid-js/web";
|
|
2
|
+
import { createMemo } from "solid-js";
|
|
2
3
|
import { unwrap } from "solid-js/store";
|
|
3
|
-
import { combineProps } from "@solid-primitives/props";
|
|
4
4
|
import { createLazyMemo } from "@solid-primitives/memo";
|
|
5
5
|
import { isEqual, keyBy } from "es-toolkit";
|
|
6
6
|
import { v4 } from "uuid";
|
|
7
7
|
import { diffArrays } from "diff";
|
|
8
|
-
var DEL = Symbol("del"), NEW = Symbol("new");
|
|
8
|
+
var _tmpl$ = /* @__PURE__ */ template("<div>"), DEL = Symbol("del"), NEW = Symbol("new");
|
|
9
9
|
const DiffPlugin = {
|
|
10
10
|
name: "diff",
|
|
11
11
|
priority: Infinity,
|
|
12
|
-
store: (e) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
let c = [], l = [], u = [], d = keyBy(a, (e) => e[o]);
|
|
24
|
-
for (let i of a) {
|
|
25
|
-
let a = e.diffDataKeyed()[i[o]];
|
|
26
|
-
a ? isEqual(i, a) || u.push(i) : c.push(i);
|
|
12
|
+
store: (e) => ((e.rawProps.data || []).forEach((c) => unwrap(c)[e.rawProps.rowKey] ??= v4()), {
|
|
13
|
+
diffData: () => e.props.diff?.data ?? [],
|
|
14
|
+
diffDataKeyed: createLazyMemo(() => keyBy(e.diffData(), (c) => c[e.props.rowKey]))
|
|
15
|
+
}),
|
|
16
|
+
commands: (e) => ({ async diffCommit(c = e.rawProps.data || []) {
|
|
17
|
+
let { rowKey: l } = e.props || {};
|
|
18
|
+
c.forEach((e) => unwrap(e)[l] ??= v4()), c = structuredClone(unwrap(c));
|
|
19
|
+
let u = [], d = [], f = [], p = keyBy(c, (e) => e[l]);
|
|
20
|
+
for (let d of c) {
|
|
21
|
+
let c = e.diffDataKeyed()[d[l]];
|
|
22
|
+
c ? isEqual(d, c) || f.push(d) : u.push(d);
|
|
27
23
|
}
|
|
28
|
-
for (let
|
|
29
|
-
await e.props.diff?.onCommit?.(
|
|
30
|
-
added:
|
|
31
|
-
removed:
|
|
32
|
-
changed:
|
|
33
|
-
}),
|
|
24
|
+
for (let c of e.diffData()) !p[c[l]] && d.push(c);
|
|
25
|
+
await e.props.diff?.onCommit?.(c, {
|
|
26
|
+
added: u,
|
|
27
|
+
removed: d,
|
|
28
|
+
changed: f
|
|
29
|
+
}), u[NEW] = 0;
|
|
34
30
|
} }),
|
|
35
31
|
rewriteProps: {
|
|
36
32
|
diff: ({ diff: e }) => ({
|
|
@@ -40,27 +36,40 @@ const DiffPlugin = {
|
|
|
40
36
|
changed: !0,
|
|
41
37
|
...e
|
|
42
38
|
}),
|
|
43
|
-
data: ({ data: e }, { store:
|
|
44
|
-
if (!
|
|
45
|
-
let { rowKey:
|
|
46
|
-
if (e.length ===
|
|
47
|
-
let
|
|
48
|
-
for (let
|
|
49
|
-
|
|
39
|
+
data: ({ data: e }, { store: c }) => {
|
|
40
|
+
if (!c.props.diff?.enable) return e;
|
|
41
|
+
let { rowKey: l, diff: u } = c.props || {}, d = c.diffData();
|
|
42
|
+
if (e.length === d.length && e.length > 0) {
|
|
43
|
+
let c = !0;
|
|
44
|
+
for (let u = 0; u < e.length; u++) if (e[u]?.[l] !== d[u]?.[l]) {
|
|
45
|
+
c = !1;
|
|
50
46
|
break;
|
|
51
47
|
}
|
|
52
|
-
if (
|
|
48
|
+
if (c) return e;
|
|
53
49
|
}
|
|
54
|
-
return diffArrays(
|
|
50
|
+
return diffArrays(d, e, { comparator: (e, c) => e == c || e[l] == c[l] }).flatMap((e) => e.added ? e.value.map((e) => (e[NEW] = 1, e)) : e.removed ? u.removed ? e.value.map((e) => ({
|
|
55
51
|
...e,
|
|
56
52
|
[DEL]: 1,
|
|
57
|
-
[
|
|
53
|
+
[c.internal]: 1
|
|
58
54
|
})) : [] : e.value);
|
|
59
55
|
},
|
|
60
|
-
Td: ({ Td:
|
|
61
|
-
let
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
Td: ({ Td: f }, { store: m }) => m.props.diff?.enable ? (h) => {
|
|
57
|
+
let g = createMemo(() => {
|
|
58
|
+
let { diff: e } = m.props, c = h.data[m.props.rowKey];
|
|
59
|
+
return [h.data[NEW] ? "bg-green!" : h.data[DEL] ? "bg-red!" : h.data[m.internal] ? "" : e.changed && h.data[h.col.id] != m.diffDataKeyed()[c]?.[h.col.id] ? "bg-green!" : ""].join(" ");
|
|
60
|
+
});
|
|
61
|
+
return createComponent(f, mergeProps(h, {
|
|
62
|
+
get class() {
|
|
63
|
+
return h.class + (g() ? " relative z-1" : "");
|
|
64
|
+
},
|
|
65
|
+
get children() {
|
|
66
|
+
return [memo(() => h.children), memo(() => memo(() => !!g())() && (() => {
|
|
67
|
+
var c = _tmpl$();
|
|
68
|
+
return effect(() => className(c, g() + " absolute inset-0 z--1 op-20 pointer-events-none")), c;
|
|
69
|
+
})())];
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
} : f
|
|
64
73
|
},
|
|
65
74
|
keybindings: (e) => ({ "$mod+S": () => e.commands.diffCommit() })
|
|
66
75
|
};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import { type Plugin, type TableColumn } from '..';
|
|
3
3
|
declare module '../index' {
|
|
4
|
-
interface TableProps {
|
|
5
|
-
validator?: (value: any, data: any, col: TableColumn) => string | boolean | Promise<string | boolean>;
|
|
6
|
-
}
|
|
7
4
|
interface TableColumn {
|
|
8
5
|
editable?: boolean;
|
|
9
6
|
editor?: string | Editor;
|
|
10
7
|
editorProps?: any;
|
|
11
8
|
editorPopup?: boolean;
|
|
12
|
-
validator?: (value: any, rowData: any, col: TableColumn) => boolean | string | Promise<boolean | string>;
|
|
13
9
|
}
|
|
14
10
|
interface TableStore {
|
|
15
11
|
editors: {
|
|
@@ -7,157 +7,138 @@ import { createMutable } from "solid-js/store";
|
|
|
7
7
|
import { combineProps } from "@solid-primitives/props";
|
|
8
8
|
import { createAsyncMemo } from "@solid-primitives/memo";
|
|
9
9
|
import { delay } from "es-toolkit";
|
|
10
|
-
var _tmpl$ = /* @__PURE__ */ template("<input style=position:absolute;margin-top:1em;width:0;height:0;pointer-events:none;opacity:0>"), _tmpl$2 = /* @__PURE__ */ template("<div class=in-cell-edit-wrapper>"), _tmpl$3 = /* @__PURE__ */ template("<span class=cell-validating>"), _tmpl$4 = /* @__PURE__ */ template("<
|
|
10
|
+
var _tmpl$ = /* @__PURE__ */ template("<input style=position:absolute;margin-top:1em;width:0;height:0;pointer-events:none;opacity:0>"), _tmpl$2 = /* @__PURE__ */ template("<div class=in-cell-edit-wrapper>"), _tmpl$3 = /* @__PURE__ */ template("<span class=cell-validating>"), _tmpl$4 = /* @__PURE__ */ template("<input>"), _tmpl$5 = /* @__PURE__ */ template("<select>"), _tmpl$6 = /* @__PURE__ */ template("<option>"), _tmpl$7 = /* @__PURE__ */ template("<label class=\"h-full flex items-center\">");
|
|
11
11
|
const EditablePlugin = {
|
|
12
12
|
name: "editable",
|
|
13
13
|
store: () => ({ editors: { ...editors } }),
|
|
14
|
-
rewriteProps: { Td: ({ Td:
|
|
15
|
-
let
|
|
14
|
+
rewriteProps: { Td: ({ Td: n }, { store: E }) => (D) => {
|
|
15
|
+
let O, { props: j } = useContext(Ctx), M = createMemo(() => !!D.col.editable && !D.data[E.internal] && !D.col[E.internal]), [P, F] = createSignal(!1), B = "", V = createMemo(() => (([n, E]) => D.x == n && D.y == E)(E.selected.start || [])), H = createMemo(() => V() && M() && !P()), [U, W] = createSignal(!1);
|
|
16
16
|
createEffect(() => {
|
|
17
|
-
|
|
17
|
+
P() || (E.clearCellValidation?.(D.data, D.col), W(!1));
|
|
18
18
|
});
|
|
19
|
-
let
|
|
20
|
-
if (
|
|
21
|
-
let
|
|
22
|
-
props:
|
|
23
|
-
col:
|
|
24
|
-
eventKey:
|
|
25
|
-
data:
|
|
26
|
-
value:
|
|
19
|
+
let G = createAsyncMemo(async () => {
|
|
20
|
+
if (P()) {
|
|
21
|
+
let n = !1, O = ((n) => typeof n == "string" ? E.editors[n] : n)(D.col.editor || "text"), k = {
|
|
22
|
+
props: D.col.editorProps,
|
|
23
|
+
col: D.col,
|
|
24
|
+
eventKey: B,
|
|
25
|
+
data: D.data,
|
|
26
|
+
value: D.data[D.col.id],
|
|
27
27
|
ok: async () => {
|
|
28
|
-
await
|
|
28
|
+
await K(A.getValue()), F(!1);
|
|
29
29
|
},
|
|
30
|
-
cancel: () => (
|
|
31
|
-
onChange: (
|
|
32
|
-
},
|
|
30
|
+
cancel: () => (n = !0, E.clearCellValidation?.(D.x, D.y), F(!1)),
|
|
31
|
+
onChange: (n) => K(n).catch(() => {})
|
|
32
|
+
}, A = O(k);
|
|
33
33
|
return onCleanup(() => {
|
|
34
|
-
if (!
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
...
|
|
38
|
-
[
|
|
39
|
-
},
|
|
34
|
+
if (!n && A.getValue() !== D.data[D.col.id]) {
|
|
35
|
+
let n = [...j.data];
|
|
36
|
+
n[D.y] = {
|
|
37
|
+
...n[D.y],
|
|
38
|
+
[D.col.id]: A.getValue()
|
|
39
|
+
}, j.onDataChange?.(n);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
}), [
|
|
41
|
+
n || K(A.getValue()), A.destroy();
|
|
42
|
+
}), [k, A];
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
|
-
async function
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
for (let T of [A.validator, E.col.validator]) {
|
|
51
|
-
if (!T) continue;
|
|
52
|
-
let D = await T(e, E.data, E.col);
|
|
53
|
-
if (D !== !0) return D;
|
|
54
|
-
}
|
|
55
|
-
return !0;
|
|
56
|
-
})();
|
|
57
|
-
G(!1), U(T === !0 ? null : typeof T == "string" ? T : "Error");
|
|
58
|
-
} catch (e) {
|
|
59
|
-
G(!1), U(e.message || "Error");
|
|
60
|
-
}
|
|
61
|
-
if (H() != null) throw Error(H() || "Error");
|
|
45
|
+
async function K(n) {
|
|
46
|
+
if (E.validateCell) try {
|
|
47
|
+
W(!0), await E.validateCell(n, D.data, D.col);
|
|
48
|
+
} finally {
|
|
49
|
+
W(!1);
|
|
62
50
|
}
|
|
63
51
|
}
|
|
64
52
|
createEffect(() => {
|
|
65
|
-
|
|
53
|
+
G()?.[1]?.focus?.();
|
|
66
54
|
}), createEffect(() => {
|
|
67
|
-
if (
|
|
68
|
-
let
|
|
69
|
-
createEffect(on(
|
|
55
|
+
if (P()) {
|
|
56
|
+
let n = createMemo(() => JSON.stringify(E.selected));
|
|
57
|
+
createEffect(on(n, () => F(!1), { defer: !0 }));
|
|
70
58
|
}
|
|
71
59
|
});
|
|
72
|
-
let
|
|
60
|
+
let q, J = createMutable({
|
|
73
61
|
w: 0,
|
|
74
62
|
h: 0
|
|
75
63
|
});
|
|
76
|
-
return createComputed(() =>
|
|
77
|
-
ref: (
|
|
64
|
+
return createComputed(() => P() && (J.w = O.getBoundingClientRect().width, J.h = O.getBoundingClientRect().height)), D = combineProps(D, {
|
|
65
|
+
ref: (n) => O = n,
|
|
78
66
|
get class() {
|
|
79
|
-
return
|
|
67
|
+
return P() ? "is-editing" : "";
|
|
80
68
|
},
|
|
81
69
|
get style() {
|
|
82
|
-
return
|
|
70
|
+
return P() ? `width: ${J.w}px; height: ${J.h}px; padding: 0; ` : "";
|
|
83
71
|
},
|
|
84
|
-
onClick: () =>
|
|
85
|
-
onDblClick: () =>
|
|
86
|
-
onKeyDown: (
|
|
87
|
-
}), createComponent(
|
|
88
|
-
return [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
return
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
})(), null), e;
|
|
107
|
-
})() : E.children),
|
|
108
|
-
memo(() => memo(() => H() !== null)() && (() => {
|
|
109
|
-
var e = _tmpl$4();
|
|
110
|
-
return insert(e, H), e;
|
|
111
|
-
})())
|
|
112
|
-
];
|
|
72
|
+
onClick: () => q?.focus?.(),
|
|
73
|
+
onDblClick: () => F(M()),
|
|
74
|
+
onKeyDown: (n) => n.key == "Escape" && G()?.[0].cancel()
|
|
75
|
+
}), createComponent(n, mergeProps(D, { get children() {
|
|
76
|
+
return [memo(() => memo(() => !!H())() && (() => {
|
|
77
|
+
var n = _tmpl$();
|
|
78
|
+
return n.addEventListener("compositionend", () => {
|
|
79
|
+
F(!0);
|
|
80
|
+
}), n.$$input = (n) => {
|
|
81
|
+
B = n.target.value, F(!n.isComposing);
|
|
82
|
+
}, n.$$keydown = (n) => {
|
|
83
|
+
n.key == " " && n.preventDefault();
|
|
84
|
+
}, use((n) => {
|
|
85
|
+
q = n, delay(0).then(() => n.focus({ preventScroll: !0 }));
|
|
86
|
+
}, n), n;
|
|
87
|
+
})()), memo(() => memo(() => !!G()?.[1]?.el)() ? (() => {
|
|
88
|
+
var n = _tmpl$2();
|
|
89
|
+
return insert(n, () => G()?.[1]?.el, null), insert(n, (() => {
|
|
90
|
+
var n = memo(() => !!U());
|
|
91
|
+
return () => n() && _tmpl$3();
|
|
92
|
+
})(), null), n;
|
|
93
|
+
})() : D.children)];
|
|
113
94
|
} }));
|
|
114
95
|
} }
|
|
115
96
|
};
|
|
116
|
-
var createEditor = (
|
|
117
|
-
let [
|
|
118
|
-
return createComponent(
|
|
119
|
-
ref: (
|
|
97
|
+
var createEditor = (n, D, O) => ({ eventKey: k, value: j, col: M, ok: N, cancel: P, props: F, onChange: I }) => createRoot((L) => {
|
|
98
|
+
let [R, z] = createSignal(k || j), B;
|
|
99
|
+
return createComponent(n, mergeProps({
|
|
100
|
+
ref: (n) => B = n,
|
|
120
101
|
class: "relative block px-2 size-full z-9 box-border resize-none outline-0",
|
|
121
102
|
get value() {
|
|
122
|
-
return
|
|
103
|
+
return R();
|
|
123
104
|
},
|
|
124
|
-
onInput: (
|
|
125
|
-
onChange: (
|
|
126
|
-
"on:pointerdown": (
|
|
127
|
-
"on:keydown": (
|
|
128
|
-
|
|
105
|
+
onInput: (n) => (z(n instanceof Event ? n.target.value : n), I?.(R())),
|
|
106
|
+
onChange: (n) => (z(n instanceof Event ? n.target.value : n), I?.(R()), O && N()),
|
|
107
|
+
"on:pointerdown": (n) => n.stopPropagation(),
|
|
108
|
+
"on:keydown": (n) => {
|
|
109
|
+
n.stopPropagation(), n.key == "Enter" && N(), n.key == "Escape" && P();
|
|
129
110
|
},
|
|
130
111
|
get options() {
|
|
131
|
-
return memo(() => !!
|
|
112
|
+
return memo(() => !!M.enum)() ? resolveOptions(M.enum ?? []) : void 0;
|
|
132
113
|
}
|
|
133
|
-
},
|
|
134
|
-
el:
|
|
135
|
-
getValue:
|
|
136
|
-
focus: () =>
|
|
137
|
-
destroy:
|
|
114
|
+
}, D, F)), {
|
|
115
|
+
el: B,
|
|
116
|
+
getValue: R,
|
|
117
|
+
focus: () => B.focus(),
|
|
118
|
+
destroy: L
|
|
138
119
|
};
|
|
139
|
-
}), Input = (
|
|
140
|
-
var
|
|
141
|
-
return spread(
|
|
142
|
-
})(), text = createEditor(Input), number = createEditor(Input, { type: "number" }), range$1 = createEditor(Input, { type: "range" }), color = createEditor(Input, { type: "color" }), tel = createEditor(Input, { type: "tel" }), password = createEditor(Input, { type: "password" }), date = createEditor(Input, { type: "date" }, !0), time = createEditor(Input, { type: "time" }, !0), datetime = createEditor(Input, { type: "datetime-local" }, !0), select = createEditor((
|
|
143
|
-
var
|
|
144
|
-
return spread(
|
|
145
|
-
var
|
|
146
|
-
return insert(
|
|
147
|
-
})())),
|
|
148
|
-
})(), {}, !0), file = createEditor((
|
|
120
|
+
}), Input = (n) => (() => {
|
|
121
|
+
var E = _tmpl$4();
|
|
122
|
+
return spread(E, n, !1, !1), E;
|
|
123
|
+
})(), text = createEditor(Input), number = createEditor(Input, { type: "number" }), range$1 = createEditor(Input, { type: "range" }), color = createEditor(Input, { type: "color" }), tel = createEditor(Input, { type: "tel" }), password = createEditor(Input, { type: "password" }), date = createEditor(Input, { type: "date" }, !0), time = createEditor(Input, { type: "time" }, !0), datetime = createEditor(Input, { type: "datetime-local" }, !0), select = createEditor((n) => (() => {
|
|
124
|
+
var E = _tmpl$5();
|
|
125
|
+
return spread(E, n, !1, !0), insert(E, () => n.options?.map((n) => (() => {
|
|
126
|
+
var E = _tmpl$6();
|
|
127
|
+
return insert(E, () => n.label), effect(() => E.value = n.value), E;
|
|
128
|
+
})())), E;
|
|
129
|
+
})(), {}, !0), file = createEditor((E) => createComponent(Files, mergeProps(E, {
|
|
149
130
|
class: "relative z-9 outline-2 outline-blue min-h-a! h-a! p-1 bg-#fff",
|
|
150
|
-
onAdd: () => chooseFile({ multiple: !0 }).then((
|
|
151
|
-
name:
|
|
152
|
-
size:
|
|
131
|
+
onAdd: () => chooseFile({ multiple: !0 }).then((n) => E.onChange([...E.value || [], ...n.map((n) => ({
|
|
132
|
+
name: n.name,
|
|
133
|
+
size: n.size
|
|
153
134
|
}))]))
|
|
154
|
-
}))), checkbox = createEditor((
|
|
155
|
-
var
|
|
156
|
-
return typeof
|
|
135
|
+
}))), checkbox = createEditor((n) => (() => {
|
|
136
|
+
var E = _tmpl$7(), O = n.ref;
|
|
137
|
+
return typeof O == "function" ? use(O, E) : n.ref = E, insert(E, createComponent(Checkbox, mergeProps(n, {
|
|
157
138
|
ref: () => {},
|
|
158
139
|
onInput: () => {},
|
|
159
140
|
class: "mx-3!"
|
|
160
|
-
}))),
|
|
141
|
+
}))), E;
|
|
161
142
|
})());
|
|
162
143
|
const editors = {
|
|
163
144
|
text,
|
|
@@ -30,7 +30,7 @@ const ExpandPlugin = {
|
|
|
30
30
|
return insert(m, () => renderComponent(h.props.expand?.render, {
|
|
31
31
|
...g,
|
|
32
32
|
data: g.data[h.expandCol.id]
|
|
33
|
-
}, h
|
|
33
|
+
}, h)), effect(() => setAttribute(m, "colspan", h.props.columns?.length)), m;
|
|
34
34
|
})();
|
|
35
35
|
} })) : m,
|
|
36
36
|
Td: ({ Td: e }, { store: m }) => (h) => (h = combineProps(h, { onClick: () => h.col.id == m.expandCol.id && m.commands.expand.toggle(h.data) }), createComponent(e, h)),
|
|
@@ -15,7 +15,7 @@ const MenuPlugin = {
|
|
|
15
15
|
rewriteProps: { Table: ({ Table: n }, { store: s }) => (f) => {
|
|
16
16
|
let [p, g] = createSignal(), _ = mapArray(() => s.plugins || [], (e) => createMemo(() => e.menus?.(s))), v = createMemo(() => _().flatMap((e) => e() || [])), [y, b] = createSignal();
|
|
17
17
|
function x(e) {
|
|
18
|
-
e.preventDefault(), b({
|
|
18
|
+
e.preventDefault(), s.table.contains(e.target) && b({
|
|
19
19
|
x: e.x,
|
|
20
20
|
y: e.y
|
|
21
21
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveOptions } from "../../utils.js";
|
|
1
|
+
import { resolveOptions, toArr } from "../../utils.js";
|
|
2
2
|
import { Checkbox, Files } from "./components.js";
|
|
3
3
|
import { renderComponent, solidComponent } from "../../components/utils.js";
|
|
4
4
|
import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
|
|
@@ -14,18 +14,18 @@ const RenderPlugin = {
|
|
|
14
14
|
return renderComponent(e, mergeProps$1(m, { onChange: (e) => p.commands.rowChange({
|
|
15
15
|
...m.data,
|
|
16
16
|
[m.col.id]: e
|
|
17
|
-
}, m.y) }), p
|
|
17
|
+
}, m.y) }), p);
|
|
18
18
|
})();
|
|
19
19
|
} })) }
|
|
20
20
|
};
|
|
21
|
-
var text = (
|
|
21
|
+
var text = (m) => memo(() => ((h) => m.col.enum ? toArr(h).map((p) => resolveOptions(m.col.enum).find((e) => e.value == p)?.label ?? p).join(", ") : h)(m.data[m.col.id]));
|
|
22
22
|
const renders = {
|
|
23
23
|
text,
|
|
24
24
|
number: text,
|
|
25
25
|
date: text,
|
|
26
26
|
checkbox: (e) => (() => {
|
|
27
|
-
var
|
|
28
|
-
return insert(
|
|
27
|
+
var p = _tmpl$();
|
|
28
|
+
return insert(p, createComponent(Checkbox, {
|
|
29
29
|
class: "",
|
|
30
30
|
get value() {
|
|
31
31
|
return e.data[e.col.id];
|
|
@@ -33,7 +33,7 @@ const renders = {
|
|
|
33
33
|
get onChange() {
|
|
34
34
|
return e.onChange;
|
|
35
35
|
}
|
|
36
|
-
})),
|
|
36
|
+
})), p;
|
|
37
37
|
})(),
|
|
38
38
|
file: (e) => createComponent(Files, {
|
|
39
39
|
get value() {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Plugin } from '..';
|
|
2
|
+
type Key = string | symbol;
|
|
3
|
+
declare module '../index' {
|
|
4
|
+
interface TableProps {
|
|
5
|
+
validator?: (value: any, data: any, col: TableColumn) => void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
interface TableColumn {
|
|
8
|
+
validator?: (value: any, rowData: any, col: TableColumn) => void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
interface TableStore {
|
|
11
|
+
validateCell: (value: any, data: any, col: TableColumn) => Promise<void>;
|
|
12
|
+
clearCellValidation: (data: any, col: TableColumn) => void;
|
|
13
|
+
cellValidationErrors: {
|
|
14
|
+
[row: Key]: {
|
|
15
|
+
[col: Key]: string | null;
|
|
16
|
+
} | null;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const ValidatorPlugin: Plugin;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createComponent, insert, memo, mergeProps, template } from "solid-js/web";
|
|
2
|
+
import { combineProps } from "@solid-primitives/props";
|
|
3
|
+
var _tmpl$ = /* @__PURE__ */ template("<div class=cell-validation-error>");
|
|
4
|
+
const ValidatorPlugin = {
|
|
5
|
+
name: "validator",
|
|
6
|
+
store: (e) => ({
|
|
7
|
+
cellValidationErrors: {},
|
|
8
|
+
validateCell: async (t, n, r) => {
|
|
9
|
+
let i = [e.props.validator, r.validator], a = n[e.props.rowKey];
|
|
10
|
+
for (let o of i) {
|
|
11
|
+
if (!o) continue;
|
|
12
|
+
try {
|
|
13
|
+
await o(t, n, r);
|
|
14
|
+
} catch (t) {
|
|
15
|
+
let n = t.message || "Error";
|
|
16
|
+
throw e.cellValidationErrors[a] ??= {}, e.cellValidationErrors[a][r.id] = n, Error(n);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
e.cellValidationErrors[a] ??= {}, e.cellValidationErrors[a][r.id] = null;
|
|
20
|
+
},
|
|
21
|
+
clearCellValidation: (t, n) => {
|
|
22
|
+
let r = t[e.props.rowKey];
|
|
23
|
+
e.cellValidationErrors[r] && (e.cellValidationErrors[r][n.id] = null);
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
rewriteProps: { Td: ({ Td: i }, { store: s }) => (c) => {
|
|
27
|
+
let l = () => s.cellValidationErrors[c.data[s.props.rowKey]]?.[c.col.id], u = combineProps(c, { get class() {
|
|
28
|
+
return l() == null ? "" : "is-invalid";
|
|
29
|
+
} });
|
|
30
|
+
return createComponent(i, mergeProps(u, { get children() {
|
|
31
|
+
return [memo(() => c.children), memo(() => memo(() => l() != null)() && (() => {
|
|
32
|
+
var e = _tmpl$();
|
|
33
|
+
return insert(e, l), e;
|
|
34
|
+
})())];
|
|
35
|
+
} }));
|
|
36
|
+
} }
|
|
37
|
+
};
|
|
38
|
+
export { ValidatorPlugin };
|
|
@@ -27,7 +27,7 @@ declare module '../index' {
|
|
|
27
27
|
* zodSchema: z.string().email('Invalid email'),
|
|
28
28
|
* validator: async (value) => {
|
|
29
29
|
* const taken = await checkEmailTaken(value)
|
|
30
|
-
*
|
|
30
|
+
* if (taken) throw new Error('Email already taken')
|
|
31
31
|
* },
|
|
32
32
|
* },
|
|
33
33
|
* { id: 'age', zodSchema: z.coerce.number().int().min(0).max(150) },
|
|
@@ -4,9 +4,9 @@ const ZodValidatorPlugin = {
|
|
|
4
4
|
let i = r.zodSchema;
|
|
5
5
|
if (i) {
|
|
6
6
|
let e = i.safeParse(t);
|
|
7
|
-
if (!e.success)
|
|
7
|
+
if (!e.success) throw Error(e.error.issues[0]?.message || "Invalid value");
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
if (e) return e(t, n, r);
|
|
10
10
|
} }
|
|
11
11
|
};
|
|
12
12
|
export { ZodValidatorPlugin };
|
package/dist/style.css
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-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%;--un-leading:initial}}@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-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@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}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--
|
|
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-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%;--un-leading:initial}}@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-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}@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}:root,:host{--spacing:.25rem;--colors-gray-DEFAULT:#99a1af;--text-sm-fontSize:.875rem;--text-sm-lineHeight:1.25rem;--default-transition-timingFunction:cubic-bezier(.4,0,.2,1);--default-transition-duration:.15s;--radius-sm:.25rem;--colors-blue-DEFAULT:#54a2ff;--colors-green-DEFAULT:#05df72;--colors-red-DEFAULT:#ff6568;--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";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--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-blue-DEFAULT:lab(65.0361% -1.42065 -56.9802);--colors-green-DEFAULT:lab(78.503% -64.9264 39.7492);--colors-red-DEFAULT:lab(63.7053% 60.745 31.3109)}}*,: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-3\.5{font-size:.875rem}.lh-\[1\]{--un-leading:1;line-height:1}.m9{margin:36px}.mx-1{margin-inline:4px}.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}.p-1{padding:4px}.px,.px-4{padding-inline:16px}.px-2{padding-inline:8px}.py-1{padding-block:4px}.py-2{padding-block:8px}.pl-1{padding-left:4px}.pr-4{padding-right:16px}.ps{padding-inline-start:16px}.outline-0{outline-style:var(--un-outline-style);outline-width:0}.outline-2{outline-style:var(--un-outline-style);outline-width:2px}.outline-blue{outline-color:color-mix(in srgb,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.b{border-width:1px}.rd-2{border-radius:.5rem}.rd-sm{border-radius:var(--radius-sm)}.bg-\#fff{background-color:color-mix(in oklab,#fff var(--un-bg-opacity),transparent)}.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}.op-20{opacity:.2}.op-75{opacity:.75}.op40{opacity:.4}.flex{display:flex}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.gap-2{gap:8px}.grid{display:grid}.size-4\!{width:16px!important;height:16px!important}.size-full{width:100%;height:100%}.h-1\!{height:4px!important}.h-a\!{height:auto!important}.h-full{height:100%}.max-h-100{max-height:400px}.min-h-40{min-height:160px}.min-h-a\!{min-height:auto!important}.w-10px\!{width:10px!important}.after\:h-1:after{height:4px}.after\:w-1:after{width:4px}.inline{display:inline}.block{display:block}.hidden{display:none}.visible{visibility:visible}.collapse{visibility:collapse}.cursor-s-resize{cursor:s-resize}.cursor-w-resize{cursor:w-resize}.pointer-events-none{pointer-events:none}.resize{resize:both}.resize-none{resize:none}.select-none{-webkit-user-select:none;user-select:none}.translate-x-1\/2{--un-translate-x: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))}.items-center{align-items:center}.box-border{box-sizing:border-box}.inset-0{inset:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.justify-end\!{justify-content:flex-end!important}.justify-center{justify-content:center}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.z--1{z-index:-1}.z-1{z-index:1}.z-9{z-index:9}.overflow-auto{overflow:auto}.table{display:table}.table-cell{display:table-cell}@supports (color:color-mix(in lab, red, red)){.outline-blue{outline-color:color-mix(in oklab,var(--colors-blue-DEFAULT)var(--un-outline-opacity),transparent)}.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}}
|
|
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);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%}.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)}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}.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{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--scroll-view{overflow:auto}.data-table__layers{pointer-events:none;z-index:1;position:absolute;top:0;left:0}.data-table__layers>*{position:absolute}.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:1;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}.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:10;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);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)}}.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}@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);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%}.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)}@property --un-bg-opacity{syntax:"<percentage>";inherits:false;initial-value:100%}.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{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--scroll-view{overflow:auto}.data-table__layers{pointer-events:none;z-index:1;position:absolute;top:0;left:0}.data-table__layers>*{position:absolute}.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}.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:10;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);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)}}.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}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|