open-grid 1.2.0 → 1.2.1
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/OpenGrid-0r_543Kj.cjs +7192 -0
- package/dist/OpenGrid-HmhGVC2V.js +7203 -0
- package/dist/open-grid-react.cjs +27 -1
- package/dist/open-grid-react.js +22 -82
- package/dist/open-grid-vue.cjs +31 -1
- package/dist/open-grid-vue.js +29 -79
- package/dist/open-grid.cjs +272 -6
- package/dist/open-grid.js +177 -266
- package/dist/types/core/CellEditManager.d.ts +73 -0
- package/dist/types/core/CellEventHandler.d.ts +99 -2
- package/dist/types/core/ChartManager.d.ts +51 -3
- package/dist/types/core/ContextMenu.d.ts +43 -2
- package/dist/types/core/CrossGridController.d.ts +86 -15
- package/dist/types/core/CrossGridRegistry.d.ts +36 -2
- package/dist/types/core/DetailManager.d.ts +106 -15
- package/dist/types/core/ExportManager.d.ts +66 -1
- package/dist/types/core/ExtensionPointRegistry.d.ts +160 -14
- package/dist/types/core/FilterPanel.d.ts +17 -2
- package/dist/types/core/FilterSelect.d.ts +37 -13
- package/dist/types/core/FindBarManager.d.ts +26 -0
- package/dist/types/core/FlatRowModel.d.ts +54 -11
- package/dist/types/core/FooterManager.d.ts +53 -1
- package/dist/types/core/FormulaController.d.ts +139 -10
- package/dist/types/core/GridComposer.d.ts +54 -6
- package/dist/types/core/GridShuttle.d.ts +44 -4
- package/dist/types/core/GroupTreeManager.d.ts +86 -2
- package/dist/types/core/IconRegistry.d.ts +56 -9
- package/dist/types/core/KeyboardManager.d.ts +88 -4
- package/dist/types/core/MaskingEngine.d.ts +10 -9
- package/dist/types/core/MutationService.d.ts +113 -10
- package/dist/types/core/OrgChart.d.ts +56 -1
- package/dist/types/core/OverrideKernel.d.ts +59 -15
- package/dist/types/core/Pagination.d.ts +38 -4
- package/dist/types/core/RangeSelectionManager.d.ts +121 -7
- package/dist/types/core/RenderController.d.ts +56 -0
- package/dist/types/core/RowManager.d.ts +55 -0
- package/dist/types/core/SkinRegistry.d.ts +51 -15
- package/dist/types/core/SortFilterManager.d.ts +80 -1
- package/dist/types/core/TriggerManager.d.ts +46 -0
- package/dist/types/core/WorksheetManager.d.ts +61 -2
- package/dist/types/core/XmlConverter.d.ts +56 -23
- package/dist/types/core/chart/types.d.ts +107 -10
- package/dist/types/core/editors/CellEditor.d.ts +29 -2
- package/dist/types/core/formula/types.d.ts +71 -8
- package/dist/types/core/range/RangeQuery.d.ts +24 -2
- package/dist/types/core/renderers/CellRenderer.d.ts +100 -8
- package/dist/xlsx.min-BQ1o3sB6.cjs +11793 -0
- package/dist/{xlsx.min-Wavxcamn.js → xlsx.min-Bbz2ZypC.js} +453 -566
- package/package.json +2 -1
- package/dist/OpenGrid-B0Spm0rU.js +0 -10404
- package/dist/OpenGrid-CuXj0isp.cjs +0 -97
- package/dist/xlsx.min-Bx-LxWOf.cjs +0 -138
package/dist/open-grid-react.cjs
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime"), React = require("react"), OpenGrid = require("./OpenGrid-0r_543Kj.cjs");
|
|
4
|
+
function OpenGridReact({ data: e, columns: r, height: t = 400, width: u = "100%", editable: i = false, sortable: p = true, filterable: o = true, rowNumber: l = false, checkColumn: d = false, stateColumn: y = false, draggable: R = false, frozenColumns: x = 0, theme: s = "default", options: E, style: T, className: $, onReady: g, onDataChange: O, onCellClick: G, onRowClick: j, onEditEnd: a, onSortChange: b, onFilterChange: q, onRowDrop: S }) {
|
|
5
|
+
const c = React.useRef(null), n = React.useRef(null), M = { height: typeof t == "number" ? `${t}px` : t, width: typeof u == "number" ? `${u}px` : u, display: "block", boxSizing: "border-box", ...T };
|
|
6
|
+
return React.useEffect(() => {
|
|
7
|
+
if (!c.current) return;
|
|
8
|
+
const P = { columns: r, height: "100%", width: "100%", editable: i, sortable: p, filterable: o, rowNumber: l, checkColumn: d, stateColumn: y, draggable: R, frozenColumns: x, theme: s, ...E, onReady: (f) => {
|
|
9
|
+
n.current = f, (e == null ? void 0 : e.length) && f.setData(e), g == null ? void 0 : g(f);
|
|
10
|
+
}, ...O && { onDataChange: O }, ...G && { onCellClick: G }, ...j && { onRowClick: j }, ...a && { onEditEnd: a }, ...b && { onSortChange: b }, ...q && { onFilterChange: q }, ...S && { onRowDrop: S } }, v = new OpenGrid.OpenGrid(c.current, P);
|
|
11
|
+
return n.current = v, () => {
|
|
12
|
+
v.destroy(), n.current = null;
|
|
13
|
+
};
|
|
14
|
+
}, [r, i, p, o, l, d, y, R, x]), React.useEffect(() => {
|
|
15
|
+
n.current && e && n.current.setData(e);
|
|
16
|
+
}, [e]), React.useEffect(() => {
|
|
17
|
+
n.current && n.current.setTheme(s);
|
|
18
|
+
}, [s]), jsxRuntime.jsx("div", { ref: c, style: M, className: $ });
|
|
19
|
+
}
|
|
20
|
+
const OpenGridWithRef = React.forwardRef((e, r) => {
|
|
21
|
+
React.useRef(null);
|
|
22
|
+
const t = React.useRef(null);
|
|
23
|
+
return React.useEffect(() => {
|
|
24
|
+
t.current && r && (typeof r == "function" ? r(t.current) : r.current = t.current);
|
|
25
|
+
}), jsxRuntime.jsx(OpenGridReact, { ...e });
|
|
26
|
+
});
|
|
27
|
+
OpenGridWithRef.displayName = "OpenGrid", exports.OpenGrid = OpenGridReact;
|
|
2
28
|
//# sourceMappingURL=open-grid-react.cjs.map
|
package/dist/open-grid-react.js
CHANGED
|
@@ -1,91 +1,31 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { O as
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
checkColumn: G = !1,
|
|
14
|
-
stateColumn: m = !1,
|
|
15
|
-
draggable: R = !1,
|
|
16
|
-
frozenColumns: $ = 0,
|
|
17
|
-
theme: s = "default",
|
|
18
|
-
options: B,
|
|
19
|
-
style: D,
|
|
20
|
-
className: H,
|
|
21
|
-
onReady: i,
|
|
22
|
-
onDataChange: b,
|
|
23
|
-
onCellClick: j,
|
|
24
|
-
onRowClick: v,
|
|
25
|
-
onEditEnd: S,
|
|
26
|
-
onSortChange: T,
|
|
27
|
-
onFilterChange: W,
|
|
28
|
-
onRowDrop: q
|
|
29
|
-
}) {
|
|
30
|
-
const p = f(null), n = f(null), I = {
|
|
31
|
-
height: typeof t == "number" ? `${t}px` : t,
|
|
32
|
-
width: typeof c == "number" ? `${c}px` : c,
|
|
33
|
-
display: "block",
|
|
34
|
-
boxSizing: "border-box",
|
|
35
|
-
...D
|
|
36
|
-
};
|
|
37
|
-
return u(() => {
|
|
38
|
-
if (!p.current) return;
|
|
39
|
-
const J = {
|
|
40
|
-
columns: e,
|
|
41
|
-
height: "100%",
|
|
42
|
-
width: "100%",
|
|
43
|
-
editable: o,
|
|
44
|
-
sortable: O,
|
|
45
|
-
filterable: x,
|
|
46
|
-
rowNumber: y,
|
|
47
|
-
checkColumn: G,
|
|
48
|
-
stateColumn: m,
|
|
49
|
-
draggable: R,
|
|
50
|
-
frozenColumns: $,
|
|
51
|
-
theme: s,
|
|
52
|
-
...B,
|
|
53
|
-
onReady: (l) => {
|
|
54
|
-
n.current = l, r != null && r.length && l.setData(r), i == null || i(l);
|
|
55
|
-
},
|
|
56
|
-
...b && { onDataChange: b },
|
|
57
|
-
...j && { onCellClick: j },
|
|
58
|
-
...v && { onRowClick: v },
|
|
59
|
-
...S && { onEditEnd: S },
|
|
60
|
-
...T && { onSortChange: T },
|
|
61
|
-
...W && { onFilterChange: W },
|
|
62
|
-
...q && { onRowDrop: q }
|
|
63
|
-
}, z = new L(p.current, J);
|
|
64
|
-
return n.current = z, () => {
|
|
65
|
-
z.destroy(), n.current = null;
|
|
1
|
+
import { jsx as W } from "react/jsx-runtime";
|
|
2
|
+
import J, { useRef as u, useEffect as f } from "react";
|
|
3
|
+
import { O as K } from "./OpenGrid-HmhGVC2V.js";
|
|
4
|
+
function q({ data: r, columns: e, height: t = 400, width: c = "100%", editable: o = false, sortable: l = true, filterable: y = true, rowNumber: d = false, checkColumn: O = false, stateColumn: R = false, draggable: x = false, frozenColumns: G = 0, theme: s = "default", options: z, style: A, className: B, onReady: D, onDataChange: m, onCellClick: a, onRowClick: $, onEditEnd: b, onSortChange: j, onFilterChange: v, onRowDrop: S }) {
|
|
5
|
+
const i = u(null), n = u(null), H = { height: typeof t == "number" ? `${t}px` : t, width: typeof c == "number" ? `${c}px` : c, display: "block", boxSizing: "border-box", ...A };
|
|
6
|
+
return f(() => {
|
|
7
|
+
if (!i.current) return;
|
|
8
|
+
const I = { columns: e, height: "100%", width: "100%", editable: o, sortable: l, filterable: y, rowNumber: d, checkColumn: O, stateColumn: R, draggable: x, frozenColumns: G, theme: s, ...z, onReady: (p) => {
|
|
9
|
+
n.current = p, (r == null ? void 0 : r.length) && p.setData(r), D == null ? void 0 : D(p);
|
|
10
|
+
}, ...m && { onDataChange: m }, ...a && { onCellClick: a }, ...$ && { onRowClick: $ }, ...b && { onEditEnd: b }, ...j && { onSortChange: j }, ...v && { onFilterChange: v }, ...S && { onRowDrop: S } }, T = new K(i.current, I);
|
|
11
|
+
return n.current = T, () => {
|
|
12
|
+
T.destroy(), n.current = null;
|
|
66
13
|
};
|
|
67
|
-
}, [e, o,
|
|
14
|
+
}, [e, o, l, y, d, O, R, x, G]), f(() => {
|
|
68
15
|
n.current && r && n.current.setData(r);
|
|
69
|
-
}, [r]),
|
|
16
|
+
}, [r]), f(() => {
|
|
70
17
|
n.current && n.current.setTheme(s);
|
|
71
|
-
}, [s]),
|
|
72
|
-
"div",
|
|
73
|
-
{
|
|
74
|
-
ref: p,
|
|
75
|
-
style: I,
|
|
76
|
-
className: H
|
|
77
|
-
}
|
|
78
|
-
);
|
|
18
|
+
}, [s]), W("div", { ref: i, style: H, className: B });
|
|
79
19
|
}
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
const t =
|
|
83
|
-
return
|
|
20
|
+
const L = J.forwardRef((r, e) => {
|
|
21
|
+
u(null);
|
|
22
|
+
const t = u(null);
|
|
23
|
+
return f(() => {
|
|
84
24
|
t.current && e && (typeof e == "function" ? e(t.current) : e.current = t.current);
|
|
85
|
-
}),
|
|
25
|
+
}), W(q, { ...r });
|
|
86
26
|
});
|
|
87
|
-
|
|
27
|
+
L.displayName = "OpenGrid";
|
|
88
28
|
export {
|
|
89
|
-
|
|
29
|
+
q as OpenGrid
|
|
90
30
|
};
|
|
91
31
|
//# sourceMappingURL=open-grid-react.js.map
|
package/dist/open-grid-vue.cjs
CHANGED
|
@@ -1,2 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const vue = require("vue"), OpenGrid$1 = require("./OpenGrid-0r_543Kj.cjs"), _sfc_main = vue.defineComponent({ __name: "OpenGrid", props: { data: { default: () => [] }, columns: {}, height: { default: 400 }, width: { default: "100%" }, editable: { type: Boolean, default: false }, sortable: { type: Boolean, default: true }, filterable: { type: Boolean, default: true }, rowNumber: { type: Boolean, default: false }, checkColumn: { type: Boolean, default: false }, stateColumn: { type: Boolean, default: false }, draggable: { type: Boolean, default: false }, frozenColumns: { default: 0 }, theme: { default: "default" }, options: {} }, emits: ["update:data", "ready", "cell-click", "row-click", "edit-end", "sort-change", "filter-change", "row-check"], setup(n, { expose: u, emit: r }) {
|
|
4
|
+
const e = n, o = r, c = vue.ref(), a = vue.shallowRef(null);
|
|
5
|
+
let d = null;
|
|
6
|
+
const i = vue.computed(() => ({ height: typeof e.height == "number" ? `${e.height}px` : e.height, width: typeof e.width == "number" ? `${e.width}px` : e.width }));
|
|
7
|
+
return vue.onMounted(() => {
|
|
8
|
+
if (!c.value) return;
|
|
9
|
+
const l = { columns: e.columns, height: "100%", width: "100%", editable: e.editable, sortable: e.sortable, filterable: e.filterable, rowNumber: e.rowNumber, checkColumn: e.checkColumn, stateColumn: e.stateColumn, draggable: e.draggable, frozenColumns: e.frozenColumns, theme: e.theme, ...e.options, onReady: (t) => {
|
|
10
|
+
var _a;
|
|
11
|
+
((_a = e.data) == null ? void 0 : _a.length) && t.setData(e.data), o("ready", t);
|
|
12
|
+
}, onCellClick: (t) => o("cell-click", t), onRowClick: (t) => o("row-click", t), onEditEnd: (t) => o("edit-end", t), onSortChange: (t) => o("sort-change", t), onFilterChange: (t) => o("filter-change", t), onDataChange: (t) => {
|
|
13
|
+
d = t, o("update:data", t);
|
|
14
|
+
} };
|
|
15
|
+
a.value = new OpenGrid$1.OpenGrid(c.value, l);
|
|
16
|
+
}), vue.watch(() => e.data, (l) => {
|
|
17
|
+
!a.value || !l || l !== d && a.value.setData(l);
|
|
18
|
+
}, { deep: false }), vue.watch(() => e.theme, (l) => {
|
|
19
|
+
a.value && l && a.value.setTheme(l);
|
|
20
|
+
}), vue.watch(() => e.columns, (l) => {
|
|
21
|
+
a.value && a.value.applyColumns(l);
|
|
22
|
+
}, { deep: false }), vue.onUnmounted(() => {
|
|
23
|
+
var _a;
|
|
24
|
+
(_a = a.value) == null ? void 0 : _a.destroy(), a.value = null;
|
|
25
|
+
}), u({ grid: a }), (l, t) => (vue.openBlock(), vue.createElementBlock("div", { ref_key: "containerRef", ref: c, class: "og-vue-wrapper", style: vue.normalizeStyle(i.value) }, null, 4));
|
|
26
|
+
} }), _export_sfc = (n, u) => {
|
|
27
|
+
const r = n.__vccOpts || n;
|
|
28
|
+
for (const [e, o] of u) r[e] = o;
|
|
29
|
+
return r;
|
|
30
|
+
}, OpenGrid = _export_sfc(_sfc_main, [["__scopeId", "data-v-0a49d4fc"]]);
|
|
31
|
+
exports.OpenGrid = OpenGrid;
|
|
2
32
|
//# sourceMappingURL=open-grid-vue.cjs.map
|
package/dist/open-grid-vue.js
CHANGED
|
@@ -1,84 +1,34 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { O as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
width: typeof e.width == "number" ? `${e.width}px` : e.width
|
|
28
|
-
}));
|
|
29
|
-
return y(() => {
|
|
30
|
-
if (!c.value) return;
|
|
31
|
-
const l = {
|
|
32
|
-
columns: e.columns,
|
|
33
|
-
height: "100%",
|
|
34
|
-
width: "100%",
|
|
35
|
-
editable: e.editable,
|
|
36
|
-
sortable: e.sortable,
|
|
37
|
-
filterable: e.filterable,
|
|
38
|
-
rowNumber: e.rowNumber,
|
|
39
|
-
checkColumn: e.checkColumn,
|
|
40
|
-
stateColumn: e.stateColumn,
|
|
41
|
-
draggable: e.draggable,
|
|
42
|
-
frozenColumns: e.frozenColumns,
|
|
43
|
-
theme: e.theme,
|
|
44
|
-
...e.options,
|
|
45
|
-
onReady: (t) => {
|
|
46
|
-
var s;
|
|
47
|
-
(s = e.data) != null && s.length && t.setData(e.data), o("ready", t);
|
|
48
|
-
},
|
|
49
|
-
onCellClick: (t) => o("cell-click", t),
|
|
50
|
-
onRowClick: (t) => o("row-click", t),
|
|
51
|
-
onEditEnd: (t) => o("edit-end", t),
|
|
52
|
-
onSortChange: (t) => o("sort-change", t),
|
|
53
|
-
onFilterChange: (t) => o("filter-change", t),
|
|
54
|
-
onDataChange: (t) => {
|
|
55
|
-
i = t, o("update:data", t);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
a.value = new w(c.value, l);
|
|
59
|
-
}), d(() => e.data, (l) => {
|
|
60
|
-
!a.value || !l || l !== i && a.value.setData(l);
|
|
61
|
-
}, { deep: !1 }), d(() => e.theme, (l) => {
|
|
62
|
-
a.value && l && a.value.setTheme(l);
|
|
63
|
-
}), d(() => e.columns, (l) => {
|
|
64
|
-
a.value && a.value.applyColumns(l);
|
|
65
|
-
}, { deep: !1 }), b(() => {
|
|
66
|
-
var l;
|
|
67
|
-
(l = a.value) == null || l.destroy(), a.value = null;
|
|
68
|
-
}), u({ grid: a }), (l, t) => (v(), C("div", {
|
|
69
|
-
ref_key: "containerRef",
|
|
70
|
-
ref: c,
|
|
71
|
-
class: "og-vue-wrapper",
|
|
72
|
-
style: k(f.value)
|
|
73
|
-
}, null, 4));
|
|
74
|
-
}
|
|
75
|
-
}), B = (n, u) => {
|
|
1
|
+
import { defineComponent as f, ref as p, shallowRef as m, computed as h, onMounted as g, watch as d, onUnmounted as y, openBlock as b, createElementBlock as v, normalizeStyle as C } from "vue";
|
|
2
|
+
import { O as k } from "./OpenGrid-HmhGVC2V.js";
|
|
3
|
+
const w = f({ __name: "OpenGrid", props: { data: { default: () => [] }, columns: {}, height: { default: 400 }, width: { default: "100%" }, editable: { type: Boolean, default: false }, sortable: { type: Boolean, default: true }, filterable: { type: Boolean, default: true }, rowNumber: { type: Boolean, default: false }, checkColumn: { type: Boolean, default: false }, stateColumn: { type: Boolean, default: false }, draggable: { type: Boolean, default: false }, frozenColumns: { default: 0 }, theme: { default: "default" }, options: {} }, emits: ["update:data", "ready", "cell-click", "row-click", "edit-end", "sort-change", "filter-change", "row-check"], setup(n, { expose: u, emit: r }) {
|
|
4
|
+
const e = n, o = r, c = p(), a = m(null);
|
|
5
|
+
let i = null;
|
|
6
|
+
const s = h(() => ({ height: typeof e.height == "number" ? `${e.height}px` : e.height, width: typeof e.width == "number" ? `${e.width}px` : e.width }));
|
|
7
|
+
return g(() => {
|
|
8
|
+
if (!c.value) return;
|
|
9
|
+
const l = { columns: e.columns, height: "100%", width: "100%", editable: e.editable, sortable: e.sortable, filterable: e.filterable, rowNumber: e.rowNumber, checkColumn: e.checkColumn, stateColumn: e.stateColumn, draggable: e.draggable, frozenColumns: e.frozenColumns, theme: e.theme, ...e.options, onReady: (t) => {
|
|
10
|
+
var _a;
|
|
11
|
+
((_a = e.data) == null ? void 0 : _a.length) && t.setData(e.data), o("ready", t);
|
|
12
|
+
}, onCellClick: (t) => o("cell-click", t), onRowClick: (t) => o("row-click", t), onEditEnd: (t) => o("edit-end", t), onSortChange: (t) => o("sort-change", t), onFilterChange: (t) => o("filter-change", t), onDataChange: (t) => {
|
|
13
|
+
i = t, o("update:data", t);
|
|
14
|
+
} };
|
|
15
|
+
a.value = new k(c.value, l);
|
|
16
|
+
}), d(() => e.data, (l) => {
|
|
17
|
+
!a.value || !l || l !== i && a.value.setData(l);
|
|
18
|
+
}, { deep: false }), d(() => e.theme, (l) => {
|
|
19
|
+
a.value && l && a.value.setTheme(l);
|
|
20
|
+
}), d(() => e.columns, (l) => {
|
|
21
|
+
a.value && a.value.applyColumns(l);
|
|
22
|
+
}, { deep: false }), y(() => {
|
|
23
|
+
var _a;
|
|
24
|
+
(_a = a.value) == null ? void 0 : _a.destroy(), a.value = null;
|
|
25
|
+
}), u({ grid: a }), (l, t) => (b(), v("div", { ref_key: "containerRef", ref: c, class: "og-vue-wrapper", style: C(s.value) }, null, 4));
|
|
26
|
+
} }), _ = (n, u) => {
|
|
76
27
|
const r = n.__vccOpts || n;
|
|
77
|
-
for (const [e, o] of u)
|
|
78
|
-
r[e] = o;
|
|
28
|
+
for (const [e, o] of u) r[e] = o;
|
|
79
29
|
return r;
|
|
80
|
-
},
|
|
30
|
+
}, B = _(w, [["__scopeId", "data-v-0a49d4fc"]]);
|
|
81
31
|
export {
|
|
82
|
-
|
|
32
|
+
B as OpenGrid
|
|
83
33
|
};
|
|
84
34
|
//# sourceMappingURL=open-grid-vue.js.map
|
package/dist/open-grid.cjs
CHANGED
|
@@ -1,7 +1,273 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const OpenGrid = require("./OpenGrid-0r_543Kj.cjs");
|
|
4
|
+
class GridShuttle {
|
|
5
|
+
constructor(t, e, n, o = {}) {
|
|
6
|
+
this._left = t, this._right = e;
|
|
7
|
+
const s = document.createElement("div");
|
|
8
|
+
s.className = "og-shuttle", s.style.cssText = `display:flex;gap:6px;align-items:center;justify-content:center;flex-direction:${o.layout === "horizontal" ? "row" : "column"};`;
|
|
9
|
+
const a = (d, h, g) => {
|
|
10
|
+
const r = document.createElement("button");
|
|
11
|
+
return r.type = "button", r.className = "og-shuttle-btn", r.textContent = d, r.title = h, r.style.cssText = "min-width:34px;height:30px;padding:0 8px;border:1px solid #bbb;border-radius:7px;background:#fff;cursor:pointer;font-size:14px;color:#444;line-height:1;box-shadow:0 1px 2px rgba(0,0,0,0.06);", r.addEventListener("mouseover", () => {
|
|
12
|
+
r.style.background = "#f0f6ff", r.style.borderColor = "#1976d2";
|
|
13
|
+
}), r.addEventListener("mouseout", () => {
|
|
14
|
+
r.style.background = "#fff", r.style.borderColor = "#bbb";
|
|
15
|
+
}), r.addEventListener("click", g), r;
|
|
16
|
+
}, _ = o.labels ?? {}, p = (d) => this._left.t(d);
|
|
17
|
+
s.appendChild(a(_.toRight ?? "▶", p("shuttle.toRight"), () => {
|
|
18
|
+
this._left.moveCheckedTo(this._right);
|
|
19
|
+
})), s.appendChild(a(_.toLeft ?? "◀", p("shuttle.toLeft"), () => {
|
|
20
|
+
this._right.moveCheckedTo(this._left);
|
|
21
|
+
})), o.includeAll && (s.appendChild(a(_.allRight ?? "⏩", p("shuttle.allRight"), () => {
|
|
22
|
+
this._moveAll(this._left, this._right);
|
|
23
|
+
})), s.appendChild(a(_.allLeft ?? "⏪", p("shuttle.allLeft"), () => {
|
|
24
|
+
this._moveAll(this._right, this._left);
|
|
25
|
+
}))), n.appendChild(s), this._el = s;
|
|
26
|
+
}
|
|
27
|
+
_moveAll(t, e) {
|
|
28
|
+
const n = t.getData().length;
|
|
29
|
+
n > 0 && t.moveRowsTo(e, Array.from({ length: n }, (o, s) => s));
|
|
30
|
+
}
|
|
31
|
+
destroy() {
|
|
32
|
+
this._el.remove();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function createGridShuttle(E, t, e, n) {
|
|
36
|
+
return new GridShuttle(E, t, e, n);
|
|
37
|
+
}
|
|
38
|
+
class OrgChart {
|
|
39
|
+
constructor(t, e) {
|
|
40
|
+
this._data = [], this._roots = [], this._expandedKeys = /* @__PURE__ */ new Set(), this._selectedId = null, this._container = typeof t == "string" ? document.querySelector(t) : t, this._opts = { nodeWidth: 160, nodeHeight: 72, levelGap: 52, siblingGap: 20, expandOnLoad: true, onNodeClick: () => {
|
|
41
|
+
}, ...e }, this._container.classList.add("og-orgchart");
|
|
42
|
+
}
|
|
43
|
+
setData(t) {
|
|
44
|
+
this._data = t;
|
|
45
|
+
const { idField: e, parentIdField: n, expandOnLoad: o } = this._opts;
|
|
46
|
+
o && this._expandedKeys.size === 0 && t.forEach((s) => this._expandedKeys.add(s[e])), this._roots = OpenGrid.buildTree(t, { idField: e, parentIdField: n }, this._expandedKeys), this._render();
|
|
47
|
+
}
|
|
48
|
+
setTheme(t) {
|
|
49
|
+
this._container.setAttribute("data-og-theme", t);
|
|
50
|
+
}
|
|
51
|
+
setSkin(t) {
|
|
52
|
+
this._container.setAttribute("data-og-skin", t);
|
|
53
|
+
}
|
|
54
|
+
expandAll() {
|
|
55
|
+
const t = (e) => {
|
|
56
|
+
for (const n of e) this._expandedKeys.add(n._treeId), n.children.length && t(n.children);
|
|
57
|
+
};
|
|
58
|
+
t(this._roots), this._rebuild();
|
|
59
|
+
}
|
|
60
|
+
collapseAll() {
|
|
61
|
+
this._expandedKeys.clear(), this._rebuild();
|
|
62
|
+
}
|
|
63
|
+
_toggle(t) {
|
|
64
|
+
this._expandedKeys.has(t) ? this._expandedKeys.delete(t) : this._expandedKeys.add(t), this._rebuild();
|
|
65
|
+
}
|
|
66
|
+
_rebuild() {
|
|
67
|
+
const { idField: t, parentIdField: e } = this._opts;
|
|
68
|
+
this._roots = OpenGrid.buildTree(this._data, { idField: t, parentIdField: e }, this._expandedKeys), this._render();
|
|
69
|
+
}
|
|
70
|
+
_calcLayout() {
|
|
71
|
+
const { nodeWidth: t, nodeHeight: e, levelGap: n, siblingGap: o } = this._opts, s = /* @__PURE__ */ new Map();
|
|
72
|
+
let a = 0;
|
|
73
|
+
const _ = (h) => {
|
|
74
|
+
const g = h._depth * (e + n), r = h._expanded ? h.children : [];
|
|
75
|
+
if (!r.length) {
|
|
76
|
+
const f = a;
|
|
77
|
+
return a += t + o, s.set(h._treeId, { x: f, y: g }), { minX: f, maxX: f };
|
|
78
|
+
}
|
|
79
|
+
let i = 1 / 0, u = -1 / 0;
|
|
80
|
+
for (const f of r) {
|
|
81
|
+
const { minX: c, maxX: m } = _(f);
|
|
82
|
+
c < i && (i = c), m > u && (u = m);
|
|
83
|
+
}
|
|
84
|
+
const l = i + (u - i + t) / 2 - t / 2;
|
|
85
|
+
return s.set(h._treeId, { x: l, y: g }), { minX: i, maxX: u };
|
|
86
|
+
};
|
|
87
|
+
for (const h of this._roots) _(h);
|
|
88
|
+
let p = 0, d = 0;
|
|
89
|
+
for (const { x: h, y: g } of s.values()) h + t > p && (p = h + t), g + e > d && (d = g + e);
|
|
90
|
+
return { layout: s, totalW: p + o, totalH: d + n + 16 };
|
|
91
|
+
}
|
|
92
|
+
_line(t, e, n, o, s) {
|
|
93
|
+
const a = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
94
|
+
a.setAttribute("x1", String(e)), a.setAttribute("y1", String(n)), a.setAttribute("x2", String(o)), a.setAttribute("y2", String(s)), a.setAttribute("class", "og-orgchart-line"), t.appendChild(a);
|
|
95
|
+
}
|
|
96
|
+
_render() {
|
|
97
|
+
const { nodeWidth: t, nodeHeight: e, levelGap: n, columns: o } = this._opts, { layout: s, totalW: a, totalH: _ } = this._calcLayout();
|
|
98
|
+
this._container.innerHTML = "";
|
|
99
|
+
const p = document.createElement("div");
|
|
100
|
+
p.className = "og-orgchart-wrap", p.style.cssText = `width:${a}px;height:${_}px;`;
|
|
101
|
+
const d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
102
|
+
d.setAttribute("width", String(a)), d.setAttribute("height", String(_)), d.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;overflow:visible;";
|
|
103
|
+
const h = (r) => {
|
|
104
|
+
for (const i of r) {
|
|
105
|
+
if (!i._expanded || !i.children.length) continue;
|
|
106
|
+
const u = s.get(i._treeId), l = u.x + t / 2, f = u.y + e, c = f + n / 2, m = i.children;
|
|
107
|
+
if (this._line(d, l, f, l, c), m.length > 1) {
|
|
108
|
+
const x = s.get(m[0]._treeId), y = s.get(m[m.length - 1]._treeId);
|
|
109
|
+
this._line(d, x.x + t / 2, c, y.x + t / 2, c);
|
|
110
|
+
}
|
|
111
|
+
for (const x of m) {
|
|
112
|
+
const y = s.get(x._treeId), b = y.x + t / 2;
|
|
113
|
+
this._line(d, b, c, b, y.y);
|
|
114
|
+
}
|
|
115
|
+
h(m);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
h(this._roots), p.appendChild(d);
|
|
119
|
+
const g = (r) => {
|
|
120
|
+
for (const i of r) {
|
|
121
|
+
const u = s.get(i._treeId);
|
|
122
|
+
if (!u) continue;
|
|
123
|
+
const l = document.createElement("div");
|
|
124
|
+
l.className = "og-orgchart-node", i._hasChildren && l.classList.add("og-orgchart-node--branch"), i._expanded && l.classList.add("og-orgchart-node--expanded"), this._selectedId === i._treeId && l.classList.add("og-orgchart-node--selected"), l.style.cssText = `left:${u.x}px;top:${u.y}px;width:${t}px;height:${e}px;`;
|
|
125
|
+
const f = document.createElement("div");
|
|
126
|
+
f.className = "og-orgchart-node-content";
|
|
127
|
+
for (const c of o) {
|
|
128
|
+
const m = i.data[c.field], x = document.createElement("div");
|
|
129
|
+
if (x.className = "og-orgchart-col" + (c.className ? " " + c.className : ""), c.style) {
|
|
130
|
+
const y = typeof c.style == "function" ? c.style(m, i.data) : c.style;
|
|
131
|
+
x.setAttribute("style", y);
|
|
132
|
+
}
|
|
133
|
+
if (c.renderer) {
|
|
134
|
+
const y = c.renderer(m, i.data);
|
|
135
|
+
typeof y == "string" ? x.innerHTML = y : x.appendChild(y);
|
|
136
|
+
} else x.textContent = m ?? "";
|
|
137
|
+
f.appendChild(x);
|
|
138
|
+
}
|
|
139
|
+
if (l.appendChild(f), i._hasChildren) {
|
|
140
|
+
const c = document.createElement("button");
|
|
141
|
+
c.type = "button", c.className = "og-orgchart-toggle", c.setAttribute("aria-expanded", i._expanded ? "true" : "false"), c.setAttribute("aria-label", OpenGrid.t(i._expanded ? "tree.collapse" : "tree.expand"));
|
|
142
|
+
const m = document.createElement("i");
|
|
143
|
+
m.setAttribute("aria-hidden", "true"), m.className = i._expanded ? "bi bi-dash-circle" : "bi bi-plus-circle", c.appendChild(m), c.addEventListener("click", (x) => {
|
|
144
|
+
x.stopPropagation(), this._toggle(i._treeId);
|
|
145
|
+
}), l.appendChild(c);
|
|
146
|
+
}
|
|
147
|
+
l.addEventListener("click", () => {
|
|
148
|
+
this._selectedId = i._treeId, this._opts.onNodeClick(i._treeId, i.data), this._container.querySelectorAll(".og-orgchart-node--selected").forEach((c) => c.classList.remove("og-orgchart-node--selected")), l.classList.add("og-orgchart-node--selected");
|
|
149
|
+
}), p.appendChild(l), i._expanded && i.children.length && g(i.children);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
g(this._roots), this._container.appendChild(p);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
class XmlConverter {
|
|
156
|
+
static parse(t, e = {}) {
|
|
157
|
+
var _a, _b, _c;
|
|
158
|
+
const { fieldMap: n = {}, trim: o = true } = e, a = new DOMParser().parseFromString(t.trim(), "text/xml"), _ = a.querySelector("parsererror");
|
|
159
|
+
if (_) throw new Error(`XML 파싱 오류: ${(_a = _.textContent) == null ? void 0 : _a.trim()}`);
|
|
160
|
+
const p = a.documentElement;
|
|
161
|
+
let d = e.rowTag;
|
|
162
|
+
d || (d = ((_c = (_b = e.rootTag ? a.querySelector(e.rootTag) : p) == null ? void 0 : _b.children[0]) == null ? void 0 : _c.tagName) ?? "row");
|
|
163
|
+
const h = a.getElementsByTagName(d), g = [];
|
|
164
|
+
for (let r = 0; r < h.length; r++) {
|
|
165
|
+
const i = h[r], u = {};
|
|
166
|
+
for (const l of Array.from(i.attributes)) {
|
|
167
|
+
const f = n[l.name] ?? l.name;
|
|
168
|
+
u[f] = o ? l.value.trim() : l.value;
|
|
169
|
+
}
|
|
170
|
+
for (const l of Array.from(i.children)) {
|
|
171
|
+
const f = n[l.tagName] ?? l.tagName, c = l.textContent ?? "";
|
|
172
|
+
u[f] = o ? c.trim() : c;
|
|
173
|
+
}
|
|
174
|
+
g.push(u);
|
|
175
|
+
}
|
|
176
|
+
return g;
|
|
177
|
+
}
|
|
178
|
+
static stringify(t, e = {}) {
|
|
179
|
+
const { rootTag: n = "rows", rowTag: o = "row", mode: s = "element", fieldMap: a = {}, declaration: _ = true, indent: p = 2, nullAs: d = "", excludeFields: h = [] } = e, g = " ".repeat(p), r = [];
|
|
180
|
+
_ && r.push('<?xml version="1.0" encoding="UTF-8"?>'), r.push(`<${n}>`);
|
|
181
|
+
for (const i of t) {
|
|
182
|
+
const u = Object.entries(i).filter(([l]) => !h.includes(l));
|
|
183
|
+
if (s === "attribute") {
|
|
184
|
+
const l = u.map(([f, c]) => {
|
|
185
|
+
const m = a[f] ?? f, x = c == null ? d : String(c);
|
|
186
|
+
return `${m}="${this._escAttr(x)}"`;
|
|
187
|
+
}).join(" ");
|
|
188
|
+
r.push(`${g}<${o}${l ? " " + l : ""} />`);
|
|
189
|
+
} else {
|
|
190
|
+
r.push(`${g}<${o}>`);
|
|
191
|
+
for (const [l, f] of u) {
|
|
192
|
+
const c = a[l] ?? l, m = f == null ? d : String(f);
|
|
193
|
+
r.push(`${g}${g}<${c}>${this._escText(m)}</${c}>`);
|
|
194
|
+
}
|
|
195
|
+
r.push(`${g}</${o}>`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return r.push(`</${n}>`), r.join(`
|
|
199
|
+
`);
|
|
200
|
+
}
|
|
201
|
+
static parseSap(t) {
|
|
202
|
+
var _a, _b, _c, _d;
|
|
203
|
+
const n = new DOMParser().parseFromString(t.trim(), "text/xml"), o = { header: {}, items: [], returns: [], raw: n }, s = n.getElementsByTagName("DOCUMENTHEADER")[0];
|
|
204
|
+
if (s) for (const p of Array.from(s.children)) o.header[p.tagName] = ((_a = p.textContent) == null ? void 0 : _a.trim()) ?? "";
|
|
205
|
+
const a = n.getElementsByTagName("RETURN");
|
|
206
|
+
for (const p of Array.from(a)) {
|
|
207
|
+
const d = {};
|
|
208
|
+
for (const h of Array.from(p.children)) d[h.tagName] = ((_b = h.textContent) == null ? void 0 : _b.trim()) ?? "";
|
|
209
|
+
o.returns.push(d);
|
|
210
|
+
}
|
|
211
|
+
const _ = ["ACCOUNTGL", "ACCOUNTRECEIVABLE", "ACCOUNTPAYABLE", "ITEMS"];
|
|
212
|
+
for (const p of _) {
|
|
213
|
+
const d = n.getElementsByTagName(p)[0];
|
|
214
|
+
if (!d) continue;
|
|
215
|
+
const h = d.getElementsByTagName("ITEM"), g = h.length > 0 ? Array.from(h) : [d];
|
|
216
|
+
for (const r of g) {
|
|
217
|
+
const i = {};
|
|
218
|
+
for (const u of Array.from(r.children)) i[u.tagName] = ((_c = u.textContent) == null ? void 0 : _c.trim()) ?? "";
|
|
219
|
+
o.items.push(i);
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
if (o.items.length === 0) {
|
|
224
|
+
const p = n.documentElement, d = Array.from(p.children).filter((h) => h.hasAttribute("SEGMENT"));
|
|
225
|
+
for (const h of d) {
|
|
226
|
+
if (h.tagName === "EDI_DC40") continue;
|
|
227
|
+
const g = {};
|
|
228
|
+
for (const r of Array.from(h.children)) g[r.tagName] = ((_d = r.textContent) == null ? void 0 : _d.trim()) ?? "";
|
|
229
|
+
Object.keys(g).length > 0 && o.items.push(g);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return o;
|
|
233
|
+
}
|
|
234
|
+
static stringifySap(t) {
|
|
235
|
+
const e = ['<?xml version="1.0" encoding="UTF-8"?>', "<BAPI_CALL>"];
|
|
236
|
+
if (t.BAPI_FUNCTION && e.push(` <FUNCTION>${this._escText(t.BAPI_FUNCTION)}</FUNCTION>`), t.DOCUMENTHEADER && typeof t.DOCUMENTHEADER == "object") {
|
|
237
|
+
e.push(" <DOCUMENTHEADER>");
|
|
238
|
+
for (const [o, s] of Object.entries(t.DOCUMENTHEADER)) s != null && s !== "" && e.push(` <${o}>${this._escText(String(s))}</${o}>`);
|
|
239
|
+
e.push(" </DOCUMENTHEADER>");
|
|
240
|
+
}
|
|
241
|
+
const n = Object.keys(t).find((o) => Array.isArray(t[o]) && !o.startsWith("_"));
|
|
242
|
+
if (n) {
|
|
243
|
+
e.push(` <${n}>`);
|
|
244
|
+
for (const o of t[n]) {
|
|
245
|
+
e.push(" <ITEM>");
|
|
246
|
+
for (const [s, a] of Object.entries(o)) a != null && a !== "" && !s.startsWith("_") && e.push(` <${s}>${this._escText(String(a))}</${s}>`);
|
|
247
|
+
e.push(" </ITEM>");
|
|
248
|
+
}
|
|
249
|
+
e.push(` </${n}>`);
|
|
250
|
+
}
|
|
251
|
+
return e.push("</BAPI_CALL>"), e.join(`
|
|
252
|
+
`);
|
|
253
|
+
}
|
|
254
|
+
static stringifySapBatch(t) {
|
|
255
|
+
const e = ['<?xml version="1.0" encoding="UTF-8"?>', `<BAPI_BATCH total="${t.documents.length}">`];
|
|
256
|
+
return t.documents.forEach((n, o) => {
|
|
257
|
+
e.push(` <BAPI_CALL seq="${o + 1}">`);
|
|
258
|
+
const s = this.stringifySap(n).split(`
|
|
259
|
+
`).filter((a) => !a.startsWith("<?xml")).map((a) => " " + a).join(`
|
|
260
|
+
`);
|
|
261
|
+
e.push(s), e.push(" </BAPI_CALL>");
|
|
262
|
+
}), e.push("</BAPI_BATCH>"), e.join(`
|
|
263
|
+
`);
|
|
264
|
+
}
|
|
265
|
+
static _escText(t) {
|
|
266
|
+
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
267
|
+
}
|
|
268
|
+
static _escAttr(t) {
|
|
269
|
+
return this._escText(t).replace(/"/g, """).replace(/'/g, "'");
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
exports.DEFAULT_ICON_ROLES = OpenGrid.DEFAULT_ICON_ROLES, exports.IconRegistry = OpenGrid.IconRegistry, exports.LocaleRegistry = OpenGrid.LocaleRegistry, exports.OpenGrid = OpenGrid.OpenGrid, exports.SkinRegistry = OpenGrid.SkinRegistry, exports.iconRegistry = OpenGrid.iconRegistry, exports.localeRegistry = OpenGrid.localeRegistry, exports.renderIcon = OpenGrid.renderIcon, exports.skinRegistry = OpenGrid.skinRegistry, exports.t = OpenGrid.t, exports.GridShuttle = GridShuttle, exports.OrgChart = OrgChart, exports.XmlConverter = XmlConverter, exports.createGridShuttle = createGridShuttle;
|
|
7
273
|
//# sourceMappingURL=open-grid.cjs.map
|