intable 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +2 -1
- package/dist/__uno.css +1 -1
- package/dist/chevron-right.js +3 -5
- package/dist/components/Columns.js +50 -84
- package/dist/components/DocTree.js +21 -29
- package/dist/components/Menu.js +81 -105
- package/dist/components/Popover.js +23 -31
- package/dist/components/Render.js +10 -11
- package/dist/components/Split.js +34 -46
- package/dist/components/Tree.js +38 -57
- package/dist/components/utils.js +4 -6
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +93 -128
- package/dist/hooks/useDir.js +22 -39
- package/dist/hooks/useSort.d.ts +18 -0
- package/dist/hooks/useSort.js +83 -0
- package/dist/hooks/useVirtualizer.js +43 -68
- package/dist/index.d.ts +8 -2
- package/dist/index.js +175 -213
- package/dist/loading.js +3 -5
- package/dist/plugins/CellMergePlugin.d.ts +12 -0
- package/dist/plugins/CellMergePlugin.js +2 -0
- package/dist/plugins/CellSelectionPlugin.js +89 -125
- package/dist/plugins/CommandPlugin.js +3 -6
- package/dist/plugins/CopyPastePlugin.js +24 -37
- package/dist/plugins/DiffPlugin.js +33 -45
- package/dist/plugins/DragPlugin.d.ts +14 -0
- package/dist/plugins/DragPlugin.js +47 -0
- package/dist/plugins/EditablePlugin.js +88 -139
- package/dist/plugins/ExpandPlugin.js +26 -30
- package/dist/plugins/HistoryPlugin.js +16 -21
- package/dist/plugins/MenuPlugin.js +51 -76
- package/dist/plugins/RenderPlugin/components.js +45 -63
- package/dist/plugins/RenderPlugin/index.js +29 -42
- package/dist/plugins/ResizePlugin.d.ts +2 -2
- package/dist/plugins/ResizePlugin.js +71 -94
- package/dist/plugins/RowGroupPlugin.js +57 -73
- package/dist/plugins/RowSelectionPlugin.js +31 -42
- package/dist/plugins/VirtualScrollPlugin.js +54 -79
- package/dist/plus.js +3 -5
- package/dist/style.css +2 -184
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +46 -64
- package/dist/wc.js +11 -11
- package/dist/x.js +3 -5
- package/package.json +3 -2
- package/dist/plugins/DragColumnPlugin.d.ts +0 -2
- package/dist/plugins/DragColumnPlugin.js +0 -4
package/dist/utils.js
CHANGED
|
@@ -1,88 +1,70 @@
|
|
|
1
1
|
import { useMemoAsync } from "./hooks/index.js";
|
|
2
2
|
import { delay, isFunction, isPlainObject, isPromise } from "es-toolkit";
|
|
3
|
-
function file2base64(
|
|
4
|
-
return new Promise((
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
reader.onload = () => resolve(reader.result);
|
|
3
|
+
function file2base64(e) {
|
|
4
|
+
return new Promise((g, _) => {
|
|
5
|
+
let v = new FileReader();
|
|
6
|
+
v.readAsDataURL(e), v.onload = () => g(v.result);
|
|
8
7
|
});
|
|
9
8
|
}
|
|
10
|
-
function chooseFile(
|
|
11
|
-
return new Promise((
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
input.onchange = () => {
|
|
17
|
-
if (input.files && input.files.length > 0) resolve(input.multiple ? [...input.files] : input.files[0]);
|
|
18
|
-
};
|
|
19
|
-
input.oncancel = reject;
|
|
20
|
-
input.click();
|
|
9
|
+
function chooseFile(e) {
|
|
10
|
+
return new Promise((g, _) => {
|
|
11
|
+
let v = document.createElement("input");
|
|
12
|
+
v.type = "file", v.accept = e?.accept, v.multiple = e?.multiple, v.onchange = () => {
|
|
13
|
+
v.files && v.files.length > 0 && g(v.multiple ? [...v.files] : v.files[0]);
|
|
14
|
+
}, v.oncancel = _, v.click();
|
|
21
15
|
});
|
|
22
16
|
}
|
|
23
17
|
function chooseImage() {
|
|
24
18
|
return chooseFile({ accept: "image/*" });
|
|
25
19
|
}
|
|
26
|
-
async function print(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Object.assign(iframe.style, {
|
|
20
|
+
async function print(e) {
|
|
21
|
+
let _ = document.createElement("iframe");
|
|
22
|
+
_.srcdoc = `${[...document.querySelectorAll("style"), ...document.querySelectorAll("link[rel=\"stylesheet\"]")].map((e) => e.outerHTML).join("\n")}\n\n${e}`, Object.assign(_.style, {
|
|
30
23
|
position: "fixed",
|
|
31
24
|
display: "none"
|
|
32
|
-
});
|
|
33
|
-
document.body.append(iframe);
|
|
34
|
-
await new Promise((resolve) => iframe.contentWindow.addEventListener("load", resolve, { once: true }));
|
|
35
|
-
await delay(300);
|
|
36
|
-
iframe.contentWindow.print();
|
|
37
|
-
iframe.remove();
|
|
25
|
+
}), document.body.append(_), await new Promise((e) => _.contentWindow.addEventListener("load", e, { once: !0 })), await delay(300), _.contentWindow.print(), _.remove();
|
|
38
26
|
}
|
|
39
|
-
function mergeRect(
|
|
27
|
+
function mergeRect(e, g) {
|
|
40
28
|
return DOMRect.fromRect({
|
|
41
|
-
x: Math.min(
|
|
42
|
-
y: Math.min(
|
|
43
|
-
width: Math.max(
|
|
44
|
-
height: Math.max(
|
|
29
|
+
x: Math.min(e.x, g.x),
|
|
30
|
+
y: Math.min(e.y, g.y),
|
|
31
|
+
width: Math.max(e.right, g.right) - Math.min(e.x, g.x),
|
|
32
|
+
height: Math.max(e.bottom, g.bottom) - Math.min(e.y, g.y)
|
|
45
33
|
});
|
|
46
34
|
}
|
|
47
|
-
function getStyles(
|
|
48
|
-
return [...
|
|
35
|
+
function getStyles(e = document) {
|
|
36
|
+
return [...e.querySelectorAll("style"), ...e.querySelectorAll("link[rel=\"stylesheet\"]")].map((e) => e.outerHTML).join("\n");
|
|
49
37
|
}
|
|
50
|
-
const unFn = (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const ret = cb(arr[i], i);
|
|
56
|
-
if (ret != null) return ret;
|
|
38
|
+
const unFn = (e, ...g) => typeof e == "function" ? e(...g) : e, log = (...e) => (console.log(...e), e[0]), parseStyle = (e) => e ? e.split(";").reduce((e, g) => ((([g, _]) => e[g.trim()] = _.trim())(g.split(":")), e), {}) : {};
|
|
39
|
+
function findret(e, g) {
|
|
40
|
+
for (let _ = 0; _ < e.length; _++) {
|
|
41
|
+
let v = g(e[_], _);
|
|
42
|
+
if (v != null) return v;
|
|
57
43
|
}
|
|
58
44
|
}
|
|
59
|
-
function emptyObject(
|
|
60
|
-
for (
|
|
61
|
-
return
|
|
45
|
+
function emptyObject(e) {
|
|
46
|
+
for (let g of Object.keys(e)) delete e[g];
|
|
47
|
+
return e;
|
|
48
|
+
}
|
|
49
|
+
async function findAsync(e, g) {
|
|
50
|
+
for (let _ = 0; _ < e.length; _++) if (await g(e[_], _)) return e[_];
|
|
62
51
|
}
|
|
63
52
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
64
|
-
function resolveOptions(
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
if (isPlainObject(ret)) ret = Object.entries(ret).map(([k, v]) => ({
|
|
73
|
-
value: k,
|
|
74
|
-
label: v,
|
|
75
|
-
...v
|
|
76
|
-
}));
|
|
77
|
-
return ret?.map((e) => resolveOpt(e)) || [];
|
|
53
|
+
function resolveOptions(g) {
|
|
54
|
+
let y = g;
|
|
55
|
+
return isFunction(y) && (y = y()), isPromise(y) ? (cache.has(y) || cache.set(y, useMemoAsync(() => y.then((e) => e.map((e) => resolveOptions(e))))), cache.get(y)()) : (isPlainObject(y) && (y = Object.entries(y).map(([e, g]) => ({
|
|
56
|
+
value: e,
|
|
57
|
+
label: g,
|
|
58
|
+
...g
|
|
59
|
+
}))), y?.map((e) => resolveOpt(e)) || []);
|
|
78
60
|
}
|
|
79
|
-
function resolveOpt(
|
|
80
|
-
return isPlainObject(
|
|
81
|
-
label:
|
|
82
|
-
value:
|
|
61
|
+
function resolveOpt(e) {
|
|
62
|
+
return isPlainObject(e) ? e : Array.isArray(e) ? {
|
|
63
|
+
label: e[0],
|
|
64
|
+
value: e[1]
|
|
83
65
|
} : {
|
|
84
|
-
label:
|
|
85
|
-
value:
|
|
66
|
+
label: e,
|
|
67
|
+
value: e
|
|
86
68
|
};
|
|
87
69
|
}
|
|
88
|
-
export { chooseFile, chooseImage, emptyObject, file2base64, findret, getStyles, log, mergeRect, parseStyle, print, resolveOptions, unFn };
|
|
70
|
+
export { chooseFile, chooseImage, emptyObject, file2base64, findAsync, findret, getStyles, log, mergeRect, parseStyle, print, resolveOptions, unFn };
|
package/dist/wc.js
CHANGED
|
@@ -8,17 +8,17 @@ const TableElement = customElement("wc-table", {
|
|
|
8
8
|
css: {
|
|
9
9
|
value: "",
|
|
10
10
|
attribute: "css",
|
|
11
|
-
notify:
|
|
12
|
-
reflect:
|
|
11
|
+
notify: !0,
|
|
12
|
+
reflect: !1
|
|
13
13
|
},
|
|
14
|
-
theme: ""
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
theme: "",
|
|
15
|
+
noShadow: !0
|
|
16
|
+
}, (c, { element: l }) => {
|
|
17
|
+
c.noShadow && noShadowDOM();
|
|
18
|
+
let u = createMutable(c.options);
|
|
19
|
+
return createEffect(() => {
|
|
20
|
+
let { options: e } = c;
|
|
21
|
+
untrack(() => batch(() => reconcile(e)(u)));
|
|
22
|
+
}), createComponent(Intable, u);
|
|
23
23
|
});
|
|
24
24
|
export { TableElement };
|
package/dist/x.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { spread, template } from "solid-js/web";
|
|
2
|
-
var _tmpl$ = /* @__PURE__ */ template(
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
spread(_el$, props, true, true);
|
|
6
|
-
return _el$;
|
|
2
|
+
var _tmpl$ = /* @__PURE__ */ template("<svg viewBox=\"0 0 24 24\"width=1.2em height=1.2em><path fill=none stroke=currentColor stroke-linecap=round stroke-linejoin=round stroke-width=2 d=\"M18 6L6 18M6 6l12 12\">"), x_default = (n = {}) => (() => {
|
|
3
|
+
var r = _tmpl$();
|
|
4
|
+
return spread(r, n, !0, !0), r;
|
|
7
5
|
})();
|
|
8
6
|
export { x_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intable",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"module": "./dist/index.js",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": "./dist/index.js",
|
|
13
|
+
"./theme/*": "./dist/theme/*",
|
|
13
14
|
"./*": {
|
|
14
15
|
"import": "./dist/*.js",
|
|
15
16
|
"types": "./dist/*.d.ts"
|
|
@@ -46,4 +47,4 @@
|
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"diff": "^8.0.2"
|
|
48
49
|
}
|
|
49
|
-
}
|
|
50
|
+
}
|