open-grid 1.3.1 → 1.5.0
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 +77 -0
- package/README.ja.md +462 -0
- package/README.md +70 -19
- package/README.zh.md +455 -0
- package/dist/{OpenGrid-B7m7ei7f.cjs → OpenGrid-CT9bV6On.cjs} +7 -7
- package/dist/OpenGrid-CT9bV6On.cjs.map +1 -0
- package/dist/{OpenGrid-CeUdO_fM.js → OpenGrid-DACnZdEy.js} +7 -7
- package/dist/OpenGrid-DACnZdEy.js.map +1 -0
- package/dist/Registry-CPJYOqCn.js +74 -0
- package/dist/Registry-CPJYOqCn.js.map +1 -0
- package/dist/Registry-D74ZmdDz.cjs +71 -0
- package/dist/Registry-D74ZmdDz.cjs.map +1 -0
- package/dist/{index-JjfWY3Bt.cjs → index-Brfso4Ry.cjs} +92 -160
- package/dist/index-Brfso4Ry.cjs.map +1 -0
- package/dist/index-CeJ-0-80.cjs.map +1 -0
- package/dist/index-DnarQ4eR.js.map +1 -0
- package/dist/index-al9Mbv3E.js +481 -0
- package/dist/index-al9Mbv3E.js.map +1 -0
- package/dist/open-grid-base.css +98 -35
- package/dist/open-grid-header.cjs +188 -0
- package/dist/open-grid-header.cjs.map +1 -0
- package/dist/open-grid-header.css +386 -0
- package/dist/open-grid-header.js +197 -0
- package/dist/open-grid-header.js.map +1 -0
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.cjs.map +1 -0
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-react.js.map +1 -0
- package/dist/open-grid-themes.css +774 -1
- package/dist/open-grid-typography.cjs +97 -0
- package/dist/open-grid-typography.cjs.map +1 -0
- package/dist/open-grid-typography.css +181 -0
- package/dist/open-grid-typography.js +105 -0
- package/dist/open-grid-typography.js.map +1 -0
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.cjs.map +1 -0
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid-vue.js.map +1 -0
- package/dist/open-grid.cjs +31 -31
- package/dist/open-grid.cjs.map +1 -0
- package/dist/open-grid.js +86 -82
- package/dist/open-grid.js.map +1 -0
- package/dist/types/core/FilterSelect.d.ts +269 -33
- package/dist/types/core/GridShuttle.d.ts +160 -24
- package/dist/types/core/IconRegistry.d.ts +241 -33
- package/dist/types/core/OpenGrid.d.ts +2589 -327
- package/dist/types/core/OrgChart.d.ts +249 -32
- package/dist/types/core/SkinRegistry.d.ts +295 -60
- package/dist/types/core/XmlConverter.d.ts +388 -47
- package/dist/types/core/appearance/AppearanceAxis.d.ts +1 -1
- package/dist/types/core/appearance/HeaderRegistry.d.ts +236 -0
- package/dist/types/core/appearance/ThemeMetaRegistry.d.ts +1 -1
- package/dist/types/core/appearance/TypographyRegistry.d.ts +122 -0
- package/dist/types/core/appearance/index.d.ts +1 -0
- package/dist/types/core/chart/types.d.ts +1008 -126
- package/dist/types/core/extension/Registry.d.ts +389 -51
- package/dist/types/core/extension/reserved.d.ts +34 -5
- package/dist/types/core/i18n/LocaleRegistry.d.ts +271 -54
- package/dist/types/core/i18n/types.d.ts +636 -85
- package/dist/types/core/types.d.ts +3576 -426
- package/dist/types/header/index.d.ts +144 -0
- package/dist/types/index.d.ts +226 -17
- package/dist/types/typography/index.d.ts +128 -0
- package/dist/xlsx.min-BQ1o3sB6.cjs.map +1 -0
- package/dist/xlsx.min-Bbz2ZypC.js.map +1 -0
- package/package.json +126 -112
- package/dist/index-DrCPRuYi.js +0 -548
package/dist/open-grid.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { b, t as
|
|
2
|
-
import { D, I, L, O, S, i, l, r, s } from "./OpenGrid-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { b, t as T } from "./OpenGrid-DACnZdEy.js";
|
|
2
|
+
import { D, I, L, O, S, i, l, r, s } from "./OpenGrid-DACnZdEy.js";
|
|
3
|
+
import { R, T as T2, i as i2 } from "./Registry-CPJYOqCn.js";
|
|
4
|
+
class C {
|
|
5
|
+
constructor(t, e, r2, o = {}) {
|
|
5
6
|
this._left = t, this._right = e;
|
|
6
7
|
const s2 = document.createElement("div");
|
|
7
|
-
s2.className = "og-shuttle", s2.style.cssText = `display:flex;gap:6px;align-items:center;justify-content:center;flex-direction:${
|
|
8
|
+
s2.className = "og-shuttle", s2.style.cssText = `display:flex;gap:6px;align-items:center;justify-content:center;flex-direction:${o.layout === "horizontal" ? "row" : "column"};`;
|
|
8
9
|
const c = (d, h, g) => {
|
|
9
10
|
const n = document.createElement("button");
|
|
10
11
|
return n.type = "button", n.className = "og-shuttle-btn", n.textContent = d, n.title = h, n.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);", n.addEventListener("mouseover", () => {
|
|
@@ -12,27 +13,27 @@ class T {
|
|
|
12
13
|
}), n.addEventListener("mouseout", () => {
|
|
13
14
|
n.style.background = "#fff", n.style.borderColor = "#bbb";
|
|
14
15
|
}), n.addEventListener("click", g), n;
|
|
15
|
-
}, _ =
|
|
16
|
+
}, _ = o.labels ?? {}, p = (d) => this._left.t(d);
|
|
16
17
|
s2.appendChild(c(_.toRight ?? "▶", p("shuttle.toRight"), () => {
|
|
17
18
|
this._left.moveCheckedTo(this._right);
|
|
18
19
|
})), s2.appendChild(c(_.toLeft ?? "◀", p("shuttle.toLeft"), () => {
|
|
19
20
|
this._right.moveCheckedTo(this._left);
|
|
20
|
-
})),
|
|
21
|
+
})), o.includeAll && (s2.appendChild(c(_.allRight ?? "⏩", p("shuttle.allRight"), () => {
|
|
21
22
|
this._moveAll(this._left, this._right);
|
|
22
23
|
})), s2.appendChild(c(_.allLeft ?? "⏪", p("shuttle.allLeft"), () => {
|
|
23
24
|
this._moveAll(this._right, this._left);
|
|
24
|
-
}))),
|
|
25
|
+
}))), r2.appendChild(s2), this._el = s2;
|
|
25
26
|
}
|
|
26
27
|
_moveAll(t, e) {
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const r2 = t.getData().length;
|
|
29
|
+
r2 > 0 && t.moveRowsTo(e, Array.from({ length: r2 }, (o, s2) => s2));
|
|
29
30
|
}
|
|
30
31
|
destroy() {
|
|
31
32
|
this._el.remove();
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
|
-
function v(E, t, e,
|
|
35
|
-
return new
|
|
35
|
+
function v(E, t, e, r2) {
|
|
36
|
+
return new C(E, t, e, r2);
|
|
36
37
|
}
|
|
37
38
|
class N {
|
|
38
39
|
constructor(t, e) {
|
|
@@ -41,8 +42,8 @@ class N {
|
|
|
41
42
|
}
|
|
42
43
|
setData(t) {
|
|
43
44
|
this._data = t;
|
|
44
|
-
const { idField: e, parentIdField:
|
|
45
|
-
|
|
45
|
+
const { idField: e, parentIdField: r2, expandOnLoad: o } = this._opts;
|
|
46
|
+
o && this._expandedKeys.size === 0 && t.forEach((s2) => this._expandedKeys.add(s2[e])), this._roots = b(t, { idField: e, parentIdField: r2 }, this._expandedKeys), this._render();
|
|
46
47
|
}
|
|
47
48
|
setTheme(t) {
|
|
48
49
|
this._container.setAttribute("data-og-theme", t);
|
|
@@ -52,7 +53,7 @@ class N {
|
|
|
52
53
|
}
|
|
53
54
|
expandAll() {
|
|
54
55
|
const t = (e) => {
|
|
55
|
-
for (const
|
|
56
|
+
for (const r2 of e) this._expandedKeys.add(r2._treeId), r2.children.length && t(r2.children);
|
|
56
57
|
};
|
|
57
58
|
t(this._roots), this._rebuild();
|
|
58
59
|
}
|
|
@@ -67,42 +68,42 @@ class N {
|
|
|
67
68
|
this._roots = b(this._data, { idField: t, parentIdField: e }, this._expandedKeys), this._render();
|
|
68
69
|
}
|
|
69
70
|
_calcLayout() {
|
|
70
|
-
const { nodeWidth: t, nodeHeight: e, levelGap:
|
|
71
|
+
const { nodeWidth: t, nodeHeight: e, levelGap: r2, siblingGap: o } = this._opts, s2 = /* @__PURE__ */ new Map();
|
|
71
72
|
let c = 0;
|
|
72
73
|
const _ = (h) => {
|
|
73
|
-
const g = h._depth * (e +
|
|
74
|
+
const g = h._depth * (e + r2), n = h._expanded ? h.children : [];
|
|
74
75
|
if (!n.length) {
|
|
75
76
|
const f = c;
|
|
76
|
-
return c += t +
|
|
77
|
+
return c += t + o, s2.set(h._treeId, { x: f, y: g }), { minX: f, maxX: f };
|
|
77
78
|
}
|
|
78
|
-
let
|
|
79
|
+
let i3 = 1 / 0, u = -1 / 0;
|
|
79
80
|
for (const f of n) {
|
|
80
81
|
const { minX: a, maxX: m } = _(f);
|
|
81
|
-
a <
|
|
82
|
+
a < i3 && (i3 = a), m > u && (u = m);
|
|
82
83
|
}
|
|
83
|
-
const l2 =
|
|
84
|
-
return s2.set(h._treeId, { x: l2, y: g }), { minX:
|
|
84
|
+
const l2 = i3 + (u - i3 + t) / 2 - t / 2;
|
|
85
|
+
return s2.set(h._treeId, { x: l2, y: g }), { minX: i3, maxX: u };
|
|
85
86
|
};
|
|
86
87
|
for (const h of this._roots) _(h);
|
|
87
88
|
let p = 0, d = 0;
|
|
88
89
|
for (const { x: h, y: g } of s2.values()) h + t > p && (p = h + t), g + e > d && (d = g + e);
|
|
89
|
-
return { layout: s2, totalW: p +
|
|
90
|
+
return { layout: s2, totalW: p + o, totalH: d + r2 + 16 };
|
|
90
91
|
}
|
|
91
|
-
_line(t, e,
|
|
92
|
+
_line(t, e, r2, o, s2) {
|
|
92
93
|
const c = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
93
|
-
c.setAttribute("x1", String(e)), c.setAttribute("y1", String(
|
|
94
|
+
c.setAttribute("x1", String(e)), c.setAttribute("y1", String(r2)), c.setAttribute("x2", String(o)), c.setAttribute("y2", String(s2)), c.setAttribute("class", "og-orgchart-line"), t.appendChild(c);
|
|
94
95
|
}
|
|
95
96
|
_render() {
|
|
96
|
-
const { nodeWidth: t, nodeHeight: e, levelGap:
|
|
97
|
+
const { nodeWidth: t, nodeHeight: e, levelGap: r2, columns: o } = this._opts, { layout: s2, totalW: c, totalH: _ } = this._calcLayout();
|
|
97
98
|
this._container.innerHTML = "";
|
|
98
99
|
const p = document.createElement("div");
|
|
99
100
|
p.className = "og-orgchart-wrap", p.style.cssText = `width:${c}px;height:${_}px;`;
|
|
100
101
|
const d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
101
102
|
d.setAttribute("width", String(c)), d.setAttribute("height", String(_)), d.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;overflow:visible;";
|
|
102
103
|
const h = (n) => {
|
|
103
|
-
for (const
|
|
104
|
-
if (!
|
|
105
|
-
const u = s2.get(
|
|
104
|
+
for (const i3 of n) {
|
|
105
|
+
if (!i3._expanded || !i3.children.length) continue;
|
|
106
|
+
const u = s2.get(i3._treeId), l2 = u.x + t / 2, f = u.y + e, a = f + r2 / 2, m = i3.children;
|
|
106
107
|
if (this._line(d, l2, f, l2, a), m.length > 1) {
|
|
107
108
|
const x = s2.get(m[0]._treeId), y = s2.get(m[m.length - 1]._treeId);
|
|
108
109
|
this._line(d, x.x + t / 2, a, y.x + t / 2, a);
|
|
@@ -116,36 +117,36 @@ class N {
|
|
|
116
117
|
};
|
|
117
118
|
h(this._roots), p.appendChild(d);
|
|
118
119
|
const g = (n) => {
|
|
119
|
-
for (const
|
|
120
|
-
const u = s2.get(
|
|
120
|
+
for (const i3 of n) {
|
|
121
|
+
const u = s2.get(i3._treeId);
|
|
121
122
|
if (!u) continue;
|
|
122
123
|
const l2 = document.createElement("div");
|
|
123
|
-
l2.className = "og-orgchart-node",
|
|
124
|
+
l2.className = "og-orgchart-node", i3._hasChildren && l2.classList.add("og-orgchart-node--branch"), i3._expanded && l2.classList.add("og-orgchart-node--expanded"), this._selectedId === i3._treeId && l2.classList.add("og-orgchart-node--selected"), l2.style.cssText = `left:${u.x}px;top:${u.y}px;width:${t}px;height:${e}px;`;
|
|
124
125
|
const f = document.createElement("div");
|
|
125
126
|
f.className = "og-orgchart-node-content";
|
|
126
|
-
for (const a of
|
|
127
|
-
const m =
|
|
127
|
+
for (const a of o) {
|
|
128
|
+
const m = i3.data[a.field], x = document.createElement("div");
|
|
128
129
|
if (x.className = "og-orgchart-col" + (a.className ? " " + a.className : ""), a.style) {
|
|
129
|
-
const y = typeof a.style == "function" ? a.style(m,
|
|
130
|
+
const y = typeof a.style == "function" ? a.style(m, i3.data) : a.style;
|
|
130
131
|
x.setAttribute("style", y);
|
|
131
132
|
}
|
|
132
133
|
if (a.renderer) {
|
|
133
|
-
const y = a.renderer(m,
|
|
134
|
+
const y = a.renderer(m, i3.data);
|
|
134
135
|
typeof y == "string" ? x.innerHTML = y : x.appendChild(y);
|
|
135
136
|
} else x.textContent = m ?? "";
|
|
136
137
|
f.appendChild(x);
|
|
137
138
|
}
|
|
138
|
-
if (l2.appendChild(f),
|
|
139
|
+
if (l2.appendChild(f), i3._hasChildren) {
|
|
139
140
|
const a = document.createElement("button");
|
|
140
|
-
a.type = "button", a.className = "og-orgchart-toggle", a.setAttribute("aria-expanded",
|
|
141
|
+
a.type = "button", a.className = "og-orgchart-toggle", a.setAttribute("aria-expanded", i3._expanded ? "true" : "false"), a.setAttribute("aria-label", T(i3._expanded ? "tree.collapse" : "tree.expand"));
|
|
141
142
|
const m = document.createElement("i");
|
|
142
|
-
m.setAttribute("aria-hidden", "true"), m.className =
|
|
143
|
-
x.stopPropagation(), this._toggle(
|
|
143
|
+
m.setAttribute("aria-hidden", "true"), m.className = i3._expanded ? "bi bi-dash-circle" : "bi bi-plus-circle", a.appendChild(m), a.addEventListener("click", (x) => {
|
|
144
|
+
x.stopPropagation(), this._toggle(i3._treeId);
|
|
144
145
|
}), l2.appendChild(a);
|
|
145
146
|
}
|
|
146
147
|
l2.addEventListener("click", () => {
|
|
147
|
-
this._selectedId =
|
|
148
|
-
}), p.appendChild(l2),
|
|
148
|
+
this._selectedId = i3._treeId, this._opts.onNodeClick(i3._treeId, i3.data), this._container.querySelectorAll(".og-orgchart-node--selected").forEach((a) => a.classList.remove("og-orgchart-node--selected")), l2.classList.add("og-orgchart-node--selected");
|
|
149
|
+
}), p.appendChild(l2), i3._expanded && i3.children.length && g(i3.children);
|
|
149
150
|
}
|
|
150
151
|
};
|
|
151
152
|
g(this._roots), this._container.appendChild(p);
|
|
@@ -154,107 +155,107 @@ class N {
|
|
|
154
155
|
class I2 {
|
|
155
156
|
static parse(t, e = {}) {
|
|
156
157
|
var _a, _b, _c;
|
|
157
|
-
const { fieldMap:
|
|
158
|
+
const { fieldMap: r2 = {}, trim: o = true } = e, c = new DOMParser().parseFromString(t.trim(), "text/xml"), _ = c.querySelector("parsererror");
|
|
158
159
|
if (_) throw new Error(`XML 파싱 오류: ${(_a = _.textContent) == null ? void 0 : _a.trim()}`);
|
|
159
160
|
const p = c.documentElement;
|
|
160
161
|
let d = e.rowTag;
|
|
161
162
|
d || (d = ((_c = (_b = e.rootTag ? c.querySelector(e.rootTag) : p) == null ? void 0 : _b.children[0]) == null ? void 0 : _c.tagName) ?? "row");
|
|
162
163
|
const h = c.getElementsByTagName(d), g = [];
|
|
163
164
|
for (let n = 0; n < h.length; n++) {
|
|
164
|
-
const
|
|
165
|
-
for (const l2 of Array.from(
|
|
166
|
-
const f =
|
|
167
|
-
u[f] =
|
|
165
|
+
const i3 = h[n], u = {};
|
|
166
|
+
for (const l2 of Array.from(i3.attributes)) {
|
|
167
|
+
const f = r2[l2.name] ?? l2.name;
|
|
168
|
+
u[f] = o ? l2.value.trim() : l2.value;
|
|
168
169
|
}
|
|
169
|
-
for (const l2 of Array.from(
|
|
170
|
-
const f =
|
|
171
|
-
u[f] =
|
|
170
|
+
for (const l2 of Array.from(i3.children)) {
|
|
171
|
+
const f = r2[l2.tagName] ?? l2.tagName, a = l2.textContent ?? "";
|
|
172
|
+
u[f] = o ? a.trim() : a;
|
|
172
173
|
}
|
|
173
174
|
g.push(u);
|
|
174
175
|
}
|
|
175
176
|
return g;
|
|
176
177
|
}
|
|
177
178
|
static stringify(t, e = {}) {
|
|
178
|
-
const { rootTag:
|
|
179
|
-
_ && n.push('<?xml version="1.0" encoding="UTF-8"?>'), n.push(`<${
|
|
180
|
-
for (const
|
|
181
|
-
const u = Object.entries(
|
|
179
|
+
const { rootTag: r2 = "rows", rowTag: o = "row", mode: s2 = "element", fieldMap: c = {}, declaration: _ = true, indent: p = 2, nullAs: d = "", excludeFields: h = [] } = e, g = " ".repeat(p), n = [];
|
|
180
|
+
_ && n.push('<?xml version="1.0" encoding="UTF-8"?>'), n.push(`<${r2}>`);
|
|
181
|
+
for (const i3 of t) {
|
|
182
|
+
const u = Object.entries(i3).filter(([l2]) => !h.includes(l2));
|
|
182
183
|
if (s2 === "attribute") {
|
|
183
184
|
const l2 = u.map(([f, a]) => {
|
|
184
185
|
const m = c[f] ?? f, x = a == null ? d : String(a);
|
|
185
186
|
return `${m}="${this._escAttr(x)}"`;
|
|
186
187
|
}).join(" ");
|
|
187
|
-
n.push(`${g}<${
|
|
188
|
+
n.push(`${g}<${o}${l2 ? " " + l2 : ""} />`);
|
|
188
189
|
} else {
|
|
189
|
-
n.push(`${g}<${
|
|
190
|
+
n.push(`${g}<${o}>`);
|
|
190
191
|
for (const [l2, f] of u) {
|
|
191
192
|
const a = c[l2] ?? l2, m = f == null ? d : String(f);
|
|
192
193
|
n.push(`${g}${g}<${a}>${this._escText(m)}</${a}>`);
|
|
193
194
|
}
|
|
194
|
-
n.push(`${g}</${
|
|
195
|
+
n.push(`${g}</${o}>`);
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
|
-
return n.push(`</${
|
|
198
|
+
return n.push(`</${r2}>`), n.join(`
|
|
198
199
|
`);
|
|
199
200
|
}
|
|
200
201
|
static parseSap(t) {
|
|
201
202
|
var _a, _b, _c, _d;
|
|
202
|
-
const
|
|
203
|
-
if (s2) for (const p of Array.from(s2.children))
|
|
204
|
-
const c =
|
|
203
|
+
const r2 = new DOMParser().parseFromString(t.trim(), "text/xml"), o = { header: {}, items: [], returns: [], raw: r2 }, s2 = r2.getElementsByTagName("DOCUMENTHEADER")[0];
|
|
204
|
+
if (s2) for (const p of Array.from(s2.children)) o.header[p.tagName] = ((_a = p.textContent) == null ? void 0 : _a.trim()) ?? "";
|
|
205
|
+
const c = r2.getElementsByTagName("RETURN");
|
|
205
206
|
for (const p of Array.from(c)) {
|
|
206
207
|
const d = {};
|
|
207
208
|
for (const h of Array.from(p.children)) d[h.tagName] = ((_b = h.textContent) == null ? void 0 : _b.trim()) ?? "";
|
|
208
|
-
|
|
209
|
+
o.returns.push(d);
|
|
209
210
|
}
|
|
210
211
|
const _ = ["ACCOUNTGL", "ACCOUNTRECEIVABLE", "ACCOUNTPAYABLE", "ITEMS"];
|
|
211
212
|
for (const p of _) {
|
|
212
|
-
const d =
|
|
213
|
+
const d = r2.getElementsByTagName(p)[0];
|
|
213
214
|
if (!d) continue;
|
|
214
215
|
const h = d.getElementsByTagName("ITEM"), g = h.length > 0 ? Array.from(h) : [d];
|
|
215
216
|
for (const n of g) {
|
|
216
|
-
const
|
|
217
|
-
for (const u of Array.from(n.children))
|
|
218
|
-
|
|
217
|
+
const i3 = {};
|
|
218
|
+
for (const u of Array.from(n.children)) i3[u.tagName] = ((_c = u.textContent) == null ? void 0 : _c.trim()) ?? "";
|
|
219
|
+
o.items.push(i3);
|
|
219
220
|
}
|
|
220
221
|
break;
|
|
221
222
|
}
|
|
222
|
-
if (
|
|
223
|
-
const p =
|
|
223
|
+
if (o.items.length === 0) {
|
|
224
|
+
const p = r2.documentElement, d = Array.from(p.children).filter((h) => h.hasAttribute("SEGMENT"));
|
|
224
225
|
for (const h of d) {
|
|
225
226
|
if (h.tagName === "EDI_DC40") continue;
|
|
226
227
|
const g = {};
|
|
227
228
|
for (const n of Array.from(h.children)) g[n.tagName] = ((_d = n.textContent) == null ? void 0 : _d.trim()) ?? "";
|
|
228
|
-
Object.keys(g).length > 0 &&
|
|
229
|
+
Object.keys(g).length > 0 && o.items.push(g);
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
|
-
return
|
|
232
|
+
return o;
|
|
232
233
|
}
|
|
233
234
|
static stringifySap(t) {
|
|
234
235
|
const e = ['<?xml version="1.0" encoding="UTF-8"?>', "<BAPI_CALL>"];
|
|
235
236
|
if (t.BAPI_FUNCTION && e.push(` <FUNCTION>${this._escText(t.BAPI_FUNCTION)}</FUNCTION>`), t.DOCUMENTHEADER && typeof t.DOCUMENTHEADER == "object") {
|
|
236
237
|
e.push(" <DOCUMENTHEADER>");
|
|
237
|
-
for (const [
|
|
238
|
+
for (const [o, s2] of Object.entries(t.DOCUMENTHEADER)) s2 != null && s2 !== "" && e.push(` <${o}>${this._escText(String(s2))}</${o}>`);
|
|
238
239
|
e.push(" </DOCUMENTHEADER>");
|
|
239
240
|
}
|
|
240
|
-
const
|
|
241
|
-
if (
|
|
242
|
-
e.push(` <${
|
|
243
|
-
for (const
|
|
241
|
+
const r2 = Object.keys(t).find((o) => Array.isArray(t[o]) && !o.startsWith("_"));
|
|
242
|
+
if (r2) {
|
|
243
|
+
e.push(` <${r2}>`);
|
|
244
|
+
for (const o of t[r2]) {
|
|
244
245
|
e.push(" <ITEM>");
|
|
245
|
-
for (const [s2, c] of Object.entries(
|
|
246
|
+
for (const [s2, c] of Object.entries(o)) c != null && c !== "" && !s2.startsWith("_") && e.push(` <${s2}>${this._escText(String(c))}</${s2}>`);
|
|
246
247
|
e.push(" </ITEM>");
|
|
247
248
|
}
|
|
248
|
-
e.push(` </${
|
|
249
|
+
e.push(` </${r2}>`);
|
|
249
250
|
}
|
|
250
251
|
return e.push("</BAPI_CALL>"), e.join(`
|
|
251
252
|
`);
|
|
252
253
|
}
|
|
253
254
|
static stringifySapBatch(t) {
|
|
254
255
|
const e = ['<?xml version="1.0" encoding="UTF-8"?>', `<BAPI_BATCH total="${t.documents.length}">`];
|
|
255
|
-
return t.documents.forEach((
|
|
256
|
-
e.push(` <BAPI_CALL seq="${
|
|
257
|
-
const s2 = this.stringifySap(
|
|
256
|
+
return t.documents.forEach((r2, o) => {
|
|
257
|
+
e.push(` <BAPI_CALL seq="${o + 1}">`);
|
|
258
|
+
const s2 = this.stringifySap(r2).split(`
|
|
258
259
|
`).filter((c) => !c.startsWith("<?xml")).map((c) => " " + c).join(`
|
|
259
260
|
`);
|
|
260
261
|
e.push(s2), e.push(" </BAPI_CALL>");
|
|
@@ -270,18 +271,21 @@ class I2 {
|
|
|
270
271
|
}
|
|
271
272
|
export {
|
|
272
273
|
D as DEFAULT_ICON_ROLES,
|
|
273
|
-
|
|
274
|
+
C as GridShuttle,
|
|
274
275
|
I as IconRegistry,
|
|
275
276
|
L as LocaleRegistry,
|
|
276
277
|
O as OpenGrid,
|
|
277
278
|
N as OrgChart,
|
|
279
|
+
R as RESERVED_PREFIXES,
|
|
278
280
|
S as SkinRegistry,
|
|
281
|
+
T2 as TypedRegistry,
|
|
279
282
|
I2 as XmlConverter,
|
|
280
283
|
v as createGridShuttle,
|
|
281
284
|
i as iconRegistry,
|
|
285
|
+
i2 as isReserved,
|
|
282
286
|
l as localeRegistry,
|
|
283
287
|
r as renderIcon,
|
|
284
288
|
s as skinRegistry,
|
|
285
|
-
|
|
289
|
+
T as t
|
|
286
290
|
};
|
|
287
291
|
//# sourceMappingURL=open-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-grid.js","sources":["../src/core/GridShuttle.ts"],"sourcesContent":["// ============================================================\n// 그리드 셔틀 — 두 그리드 사이에 화살표 버튼을 두고\n// \"체크된 행\"을 드래그 없이 버튼으로 이동(move)시킨다.\n// 이동 자체는 grid.moveCheckedTo() 를 호출 → crossGridMapping(필드 매핑)과\n// 3단계 이벤트가 드래그 이동과 동일하게 적용된다.\n// ============================================================\nimport type { OpenGridInstance } from './types.js';\n\n/**\n * 그리드 셔틀 생성 옵션.\n *\n * Grid shuttle construction options.\n *\n * グリッドシャトルの生成オプション。\n *\n * 表格穿梭框的构造选项。\n */\nexport interface GridShuttleOptions {\n /**\n * 버튼 배치 방향. 두 그리드가 가로로 나란히 있으면 'vertical'(위아래 버튼), 세로로 쌓여 있으면\n * 'horizontal'을 쓴다. 기본 'vertical'.\n *\n * Button layout direction. Use 'vertical' (stacked buttons) when the two grids sit side by side,\n * or 'horizontal' when they're stacked vertically. Default 'vertical'.\n *\n * ボタンの配置方向。2つのグリッドが横に並んでいる場合は 'vertical'(上下のボタン)、縦に積まれて\n * いる場合は 'horizontal' を使います。既定は 'vertical'。\n *\n * 按钮的排列方向。两个表格左右并排时用 'vertical'(上下排列的按钮),上下堆叠时用\n * 'horizontal'。默认 'vertical'。\n *\n * @defaultValue 'vertical'\n */\n layout?: 'vertical' | 'horizontal';\n /**\n * 전체 이동(≫ ≪) 버튼도 표시. \"전체 선택 후 이동\"을 한 번의 클릭으로 줄이고 싶을 때 켠다.\n * 기본 false(개별 이동 버튼만 표시).\n *\n * Also show move-all (≫ ≪) buttons, so a full transfer takes one click instead of\n * \"select all, then move\". Default false (only the per-check move buttons are shown).\n *\n * 全件移動(≫ ≪)ボタンも表示します。「全選択してから移動」を1回のクリックに縮めたいときに\n * 有効にします。既定は false(個別移動ボタンのみ表示)。\n *\n * 同时显示全部移动(≫ ≪)按钮,把「全选后再移动」缩短为一次点击。默认 false(仅显示单项\n * 移动按钮)。\n *\n * @defaultValue false\n */\n includeAll?: boolean;\n /**\n * 버튼 라벨 커스터마이즈(다국어 문구를 직접 넣고 싶을 때). 생략 시 그리드 로케일의 기본\n * 문구(▶ ◀ ⏩ ⏪)를 사용한다.\n *\n * Customize button labels (e.g. to hardcode a specific phrase). Falls back to the grid's\n * locale defaults (▶ ◀ ⏩ ⏪) when omitted.\n *\n * ボタンラベルのカスタマイズ(多言語の文言を直接入れたいとき)。省略した場合はグリッドロケールの\n * 既定の文言(▶ ◀ ⏩ ⏪)を使います。\n *\n * 自定义按钮标签(需要直接写入多语言文案时)。省略时回退到表格区域设置的默认文案\n * (▶ ◀ ⏩ ⏪)。\n */\n labels?: { toRight?: string; toLeft?: string; allRight?: string; allLeft?: string };\n}\n\n/**\n * 두 그리드 사이의 셔틀 UI.\n *\n * Shuttle UI between two grids.\n *\n * 2つのグリッドの間に置くシャトルUI。\n *\n * 两个表格之间的穿梭框 UI。\n *\n * \"가용 항목 그리드\"와 \"선택된 항목 그리드\"를 나란히 두고, 그 사이에서 체크한 행을 화살표\n * 버튼으로 옮기고 싶을 때 쓴다(권한 배정, 컬럼 표시 여부 선택 같은 화면에 흔한 UI 패턴).\n * 동작 순서는 이렇다: 사용자가 왼쪽 그리드에서 행을 체크하고 ▶ 버튼을 클릭하면, 내부적으로\n * `grid.moveCheckedTo()` 가 호출되어 오른쪽 그리드로 행이 옮겨진다 — 이때 crossGridMapping\n * (필드 매핑)과 3단계 이벤트가 드래그로 옮길 때와 동일하게 적용되므로, 버튼 이동과 드래그\n * 이동을 섞어 써도 동작이 갈리지 않는다.\n *\n * Places arrow buttons between an \"available items\" grid and a \"selected items\" grid so\n * checked rows can be moved between them without dragging (a common pattern for permission\n * assignment, column visibility pickers, etc.). Operation order: the user checks rows in the\n * left grid and clicks ▶, which internally calls `grid.moveCheckedTo()` to move those rows into\n * the right grid — crossGridMapping (field mapping) and the 3-stage events apply identically to\n * drag-based moves, so mixing button moves with drag moves never behaves differently.\n *\n * 「利用可能な項目のグリッド」と「選択された項目のグリッド」を並べて置き、その間でチェックした行を\n * 矢印ボタンで移したいときに使います(権限の割り当てや、列の表示可否の選択といった画面によくあるUI\n * パターンです)。動作の順序は次のとおりです。ユーザーが左のグリッドで行をチェックして ▶ ボタンを\n * クリックすると、内部で `grid.moveCheckedTo()` が呼ばれ、右のグリッドへ行が移されます — このとき\n * crossGridMapping(フィールドマッピング)と3段階のイベントがドラッグで移すときと同じように適用\n * されるため、ボタン移動とドラッグ移動を混ぜて使っても動作が食い違うことはありません。\n *\n * 在「可用项目表格」和「已选项目表格」之间放置箭头按钮,无需拖拽即可移动勾选的行(权限分配、\n * 列显示与否的选择等界面中常见的 UI 模式)。动作顺序如下:用户在左侧表格勾选行并点击 ▶,内部\n * 就会调用 `grid.moveCheckedTo()` 把这些行移入右侧表格 — 此时 crossGridMapping(字段映射)\n * 和 3 阶段事件与拖拽移动完全相同地生效,因此混用按钮移动和拖拽移动也不会出现动作分歧。\n *\n * @example\n * const shuttle = new GridShuttle(leftGrid, rightGrid, document.querySelector('#mid')!, {\n * layout: 'vertical',\n * includeAll: true,\n * });\n */\nexport class GridShuttle {\n private _el: HTMLElement;\n\n /**\n * @param _left - 왼쪽 그리드 인스턴스\n *\n * Left grid instance.\n *\n * 左のグリッドインスタンス。\n *\n * 左侧表格实例。\n *\n * @param _right - 오른쪽 그리드 인스턴스\n *\n * Right grid instance.\n *\n * 右のグリッドインスタンス。\n *\n * 右侧表格实例。\n *\n * @param mount - 셔틀 버튼을 붙일 마운트 엘리먼트\n *\n * Mount element to attach the shuttle buttons.\n *\n * シャトルボタンを取り付けるマウント要素。\n *\n * 用于挂载穿梭框按钮的元素。\n *\n * @param opts - 셔틀 옵션\n *\n * Shuttle options.\n *\n * シャトルのオプション。\n *\n * 穿梭框选项。\n */\n constructor(\n private _left: OpenGridInstance,\n private _right: OpenGridInstance,\n mount: HTMLElement,\n opts: GridShuttleOptions = {},\n ) {\n const wrap = document.createElement('div');\n wrap.className = 'og-shuttle';\n wrap.style.cssText =\n `display:flex;gap:6px;align-items:center;justify-content:center;` +\n `flex-direction:${opts.layout === 'horizontal' ? 'row' : 'column'};`;\n\n const mk = (label: string, title: string, fn: () => void): HTMLButtonElement => {\n const b = document.createElement('button');\n b.type = 'button';\n b.className = 'og-shuttle-btn';\n b.textContent = label;\n b.title = title;\n b.style.cssText =\n 'min-width:34px;height:30px;padding:0 8px;border:1px solid #bbb;border-radius:7px;' +\n 'background:#fff;cursor:pointer;font-size:14px;color:#444;line-height:1;' +\n 'box-shadow:0 1px 2px rgba(0,0,0,0.06);';\n b.addEventListener('mouseover', () => { b.style.background = '#f0f6ff'; b.style.borderColor = '#1976d2'; });\n b.addEventListener('mouseout', () => { b.style.background = '#fff'; b.style.borderColor = '#bbb'; });\n b.addEventListener('click', fn);\n return b;\n };\n\n const L = opts.labels ?? {};\n // i18n: 버튼 title 은 왼쪽 그리드 인스턴스 로케일로 해석(라벨 옵션이 있으면 그 값이 우선).\n const t = (key: string) => this._left.t(key);\n wrap.appendChild(mk(L.toRight ?? '▶', t('shuttle.toRight'),\n () => { void this._left.moveCheckedTo(this._right); }));\n wrap.appendChild(mk(L.toLeft ?? '◀', t('shuttle.toLeft'),\n () => { void this._right.moveCheckedTo(this._left); }));\n\n if (opts.includeAll) {\n wrap.appendChild(mk(L.allRight ?? '⏩', t('shuttle.allRight'),\n () => { void this._moveAll(this._left, this._right); }));\n wrap.appendChild(mk(L.allLeft ?? '⏪', t('shuttle.allLeft'),\n () => { void this._moveAll(this._right, this._left); }));\n }\n\n mount.appendChild(wrap);\n this._el = wrap;\n }\n\n private _moveAll(from: OpenGridInstance, to: OpenGridInstance): void {\n const n = from.getData().length;\n if (n > 0) void from.moveRowsTo(to, Array.from({ length: n }, (_, i) => i));\n }\n\n /**\n * 셔틀 UI 를 DOM 에서 제거한다.\n *\n * Remove the shuttle UI from the DOM.\n *\n * シャトルUIをDOMから取り除きます。\n *\n * 从 DOM 中移除穿梭框 UI。\n */\n destroy(): void { this._el.remove(); }\n}\n\n/**\n * 두 그리드 사이에 셔틀(화살표 이동) 버튼을 만든다.\n *\n * Create shuttle (arrow-move) buttons between two grids.\n *\n * 2つのグリッドの間にシャトル(矢印移動)ボタンを作ります。\n *\n * 在两个表格之间创建穿梭框(箭头移动)按钮。\n *\n * `new GridShuttle(...)` 과 동일하되, `new` 없이 함수 호출 한 줄로 끝내고 싶을 때 쓰는 편의 팩토리.\n *\n * Same as `new GridShuttle(...)`, but a convenience factory for callers who'd rather skip `new`.\n *\n * `new GridShuttle(...)` と同じですが、`new` なしで関数呼び出し1行で済ませたいときに使う便利\n * ファクトリです。\n *\n * 与 `new GridShuttle(...)` 相同,只是为不想写 `new` 的调用方提供的便捷工厂。\n *\n * @param left - 왼쪽 그리드 인스턴스\n *\n * Left grid instance.\n *\n * 左のグリッドインスタンス。\n *\n * 左侧表格实例。\n *\n * @param right - 오른쪽 그리드 인스턴스\n *\n * Right grid instance.\n *\n * 右のグリッドインスタンス。\n *\n * 右侧表格实例。\n *\n * @param mount - 셔틀 버튼을 붙일 마운트 엘리먼트\n *\n * Mount element to attach the shuttle buttons.\n *\n * シャトルボタンを取り付けるマウント要素。\n *\n * 用于挂载穿梭框按钮的元素。\n *\n * @param opts - 셔틀 옵션\n *\n * Shuttle options.\n *\n * シャトルのオプション。\n *\n * 穿梭框选项。\n *\n * @returns 생성된 GridShuttle 인스턴스\n *\n * The created GridShuttle instance.\n *\n * 生成された GridShuttle インスタンス。\n *\n * 创建的 GridShuttle 实例。\n *\n * @example\n * const shuttle = createGridShuttle(leftGrid, rightGrid, mountEl, { includeAll: true });\n */\nexport function createGridShuttle(\n left: OpenGridInstance,\n right: OpenGridInstance,\n mount: HTMLElement,\n opts?: GridShuttleOptions,\n): GridShuttle {\n return new GridShuttle(left, right, mount, opts);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GO;AAAA,QAAA,iBAAkB,gBAAA;AAAA,IAAA,CAAA,GAAA,EAAA,KAAA,eAAA,GAAA,EAAA,KAAA;AAAA,CAAA;AAAA,EAAA;AAAA,EAAA,OAAA,SAAA,GAAA;AAAA,WAAA,EAAA,QAAA,MAAA,OAAA,EAAA,QAAA,MAAA,MAAA,EAAA,QAAA,MAAA,MAAA;AAAA,EAAA;AAAA,EAAA,OAAA,SAAA,GAAA;AAAA,WAAA,KAAA,SAAA,CAAA,EAAA,QAAA,MAAA,QAAA,EAAA,QAAA,MAAA,QAAA;AAAA,EAAA;AAAA;"}
|