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.js
CHANGED
|
@@ -1,84 +1,58 @@
|
|
|
1
|
-
import { b
|
|
2
|
-
import { D
|
|
1
|
+
import { b, t as C } from "./OpenGrid-HmhGVC2V.js";
|
|
2
|
+
import { D, I, L, O, S, i, l, r, s } from "./OpenGrid-HmhGVC2V.js";
|
|
3
3
|
class T {
|
|
4
|
-
constructor(t, e,
|
|
4
|
+
constructor(t, e, o, r2 = {}) {
|
|
5
5
|
this._left = t, this._right = e;
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const c = (
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
}),
|
|
13
|
-
|
|
14
|
-
}),
|
|
15
|
-
}, _ =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
()
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
)),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
() => {
|
|
26
|
-
this._right.moveCheckedTo(this._left);
|
|
27
|
-
}
|
|
28
|
-
)), a.includeAll && (r.appendChild(c(
|
|
29
|
-
_.allRight ?? "⏩",
|
|
30
|
-
m("shuttle.allRight"),
|
|
31
|
-
() => {
|
|
32
|
-
this._moveAll(this._left, this._right);
|
|
33
|
-
}
|
|
34
|
-
)), r.appendChild(c(
|
|
35
|
-
_.allLeft ?? "⏪",
|
|
36
|
-
m("shuttle.allLeft"),
|
|
37
|
-
() => {
|
|
38
|
-
this._moveAll(this._right, this._left);
|
|
39
|
-
}
|
|
40
|
-
))), i.appendChild(r), this._el = r;
|
|
6
|
+
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:${r2.layout === "horizontal" ? "row" : "column"};`;
|
|
8
|
+
const c = (d, h, g) => {
|
|
9
|
+
const n = document.createElement("button");
|
|
10
|
+
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", () => {
|
|
11
|
+
n.style.background = "#f0f6ff", n.style.borderColor = "#1976d2";
|
|
12
|
+
}), n.addEventListener("mouseout", () => {
|
|
13
|
+
n.style.background = "#fff", n.style.borderColor = "#bbb";
|
|
14
|
+
}), n.addEventListener("click", g), n;
|
|
15
|
+
}, _ = r2.labels ?? {}, p = (d) => this._left.t(d);
|
|
16
|
+
s2.appendChild(c(_.toRight ?? "▶", p("shuttle.toRight"), () => {
|
|
17
|
+
this._left.moveCheckedTo(this._right);
|
|
18
|
+
})), s2.appendChild(c(_.toLeft ?? "◀", p("shuttle.toLeft"), () => {
|
|
19
|
+
this._right.moveCheckedTo(this._left);
|
|
20
|
+
})), r2.includeAll && (s2.appendChild(c(_.allRight ?? "⏩", p("shuttle.allRight"), () => {
|
|
21
|
+
this._moveAll(this._left, this._right);
|
|
22
|
+
})), s2.appendChild(c(_.allLeft ?? "⏪", p("shuttle.allLeft"), () => {
|
|
23
|
+
this._moveAll(this._right, this._left);
|
|
24
|
+
}))), o.appendChild(s2), this._el = s2;
|
|
41
25
|
}
|
|
42
26
|
_moveAll(t, e) {
|
|
43
|
-
const
|
|
44
|
-
|
|
27
|
+
const o = t.getData().length;
|
|
28
|
+
o > 0 && t.moveRowsTo(e, Array.from({ length: o }, (r2, s2) => s2));
|
|
45
29
|
}
|
|
46
30
|
destroy() {
|
|
47
31
|
this._el.remove();
|
|
48
32
|
}
|
|
49
33
|
}
|
|
50
|
-
function
|
|
51
|
-
return new T(
|
|
34
|
+
function v(E, t, e, o) {
|
|
35
|
+
return new T(E, t, e, o);
|
|
52
36
|
}
|
|
53
|
-
class
|
|
37
|
+
class N {
|
|
54
38
|
constructor(t, e) {
|
|
55
|
-
this._data = [], this._roots = [], this._expandedKeys = /* @__PURE__ */ new Set(), this._selectedId = null, this._container = typeof t == "string" ? document.querySelector(t) : t, this._opts = {
|
|
56
|
-
|
|
57
|
-
nodeHeight: 72,
|
|
58
|
-
levelGap: 52,
|
|
59
|
-
siblingGap: 20,
|
|
60
|
-
expandOnLoad: !0,
|
|
61
|
-
onNodeClick: () => {
|
|
62
|
-
},
|
|
63
|
-
...e
|
|
64
|
-
}, this._container.classList.add("og-orgchart");
|
|
39
|
+
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: () => {
|
|
40
|
+
}, ...e }, this._container.classList.add("og-orgchart");
|
|
65
41
|
}
|
|
66
42
|
setData(t) {
|
|
67
43
|
this._data = t;
|
|
68
|
-
const { idField: e, parentIdField:
|
|
69
|
-
|
|
44
|
+
const { idField: e, parentIdField: o, expandOnLoad: r2 } = this._opts;
|
|
45
|
+
r2 && this._expandedKeys.size === 0 && t.forEach((s2) => this._expandedKeys.add(s2[e])), this._roots = b(t, { idField: e, parentIdField: o }, this._expandedKeys), this._render();
|
|
70
46
|
}
|
|
71
47
|
setTheme(t) {
|
|
72
48
|
this._container.setAttribute("data-og-theme", t);
|
|
73
49
|
}
|
|
74
|
-
/** R12b: FORM(스킨) 축 — data-og-skin 을 자기 컨테이너에 설정(setTheme 과 동형, 색과 직교). */
|
|
75
50
|
setSkin(t) {
|
|
76
51
|
this._container.setAttribute("data-og-skin", t);
|
|
77
52
|
}
|
|
78
53
|
expandAll() {
|
|
79
54
|
const t = (e) => {
|
|
80
|
-
for (const
|
|
81
|
-
this._expandedKeys.add(i._treeId), i.children.length && t(i.children);
|
|
55
|
+
for (const o of e) this._expandedKeys.add(o._treeId), o.children.length && t(o.children);
|
|
82
56
|
};
|
|
83
57
|
t(this._roots), this._rebuild();
|
|
84
58
|
}
|
|
@@ -90,266 +64,203 @@ class I {
|
|
|
90
64
|
}
|
|
91
65
|
_rebuild() {
|
|
92
66
|
const { idField: t, parentIdField: e } = this._opts;
|
|
93
|
-
this._roots =
|
|
67
|
+
this._roots = b(this._data, { idField: t, parentIdField: e }, this._expandedKeys), this._render();
|
|
94
68
|
}
|
|
95
|
-
// ── 레이아웃 계산 (post-order: 리프부터 배치, 부모는 자식 중앙) ──
|
|
96
69
|
_calcLayout() {
|
|
97
|
-
const { nodeWidth: t, nodeHeight: e, levelGap:
|
|
70
|
+
const { nodeWidth: t, nodeHeight: e, levelGap: o, siblingGap: r2 } = this._opts, s2 = /* @__PURE__ */ new Map();
|
|
98
71
|
let c = 0;
|
|
99
|
-
const _ = (
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
102
|
-
const
|
|
103
|
-
return c += t +
|
|
72
|
+
const _ = (h) => {
|
|
73
|
+
const g = h._depth * (e + o), n = h._expanded ? h.children : [];
|
|
74
|
+
if (!n.length) {
|
|
75
|
+
const f = c;
|
|
76
|
+
return c += t + r2, s2.set(h._treeId, { x: f, y: g }), { minX: f, maxX: f };
|
|
104
77
|
}
|
|
105
|
-
let
|
|
106
|
-
for (const
|
|
107
|
-
const { minX:
|
|
108
|
-
|
|
78
|
+
let i2 = 1 / 0, u = -1 / 0;
|
|
79
|
+
for (const f of n) {
|
|
80
|
+
const { minX: a, maxX: m } = _(f);
|
|
81
|
+
a < i2 && (i2 = a), m > u && (u = m);
|
|
109
82
|
}
|
|
110
|
-
const
|
|
111
|
-
return
|
|
83
|
+
const l2 = i2 + (u - i2 + t) / 2 - t / 2;
|
|
84
|
+
return s2.set(h._treeId, { x: l2, y: g }), { minX: i2, maxX: u };
|
|
112
85
|
};
|
|
113
|
-
for (const
|
|
114
|
-
let
|
|
115
|
-
for (const { x:
|
|
116
|
-
|
|
117
|
-
return { layout: r, totalW: m + a, totalH: g + i + 16 };
|
|
86
|
+
for (const h of this._roots) _(h);
|
|
87
|
+
let p = 0, d = 0;
|
|
88
|
+
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 + r2, totalH: d + o + 16 };
|
|
118
90
|
}
|
|
119
|
-
|
|
120
|
-
_line(t, e, i, a, r) {
|
|
91
|
+
_line(t, e, o, r2, s2) {
|
|
121
92
|
const c = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
122
|
-
c.setAttribute("x1", String(e)), c.setAttribute("y1", String(
|
|
93
|
+
c.setAttribute("x1", String(e)), c.setAttribute("y1", String(o)), c.setAttribute("x2", String(r2)), c.setAttribute("y2", String(s2)), c.setAttribute("class", "og-orgchart-line"), t.appendChild(c);
|
|
123
94
|
}
|
|
124
|
-
// ── 렌더 ──
|
|
125
95
|
_render() {
|
|
126
|
-
const { nodeWidth: t, nodeHeight: e, levelGap:
|
|
96
|
+
const { nodeWidth: t, nodeHeight: e, levelGap: o, columns: r2 } = this._opts, { layout: s2, totalW: c, totalH: _ } = this._calcLayout();
|
|
127
97
|
this._container.innerHTML = "";
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
for (const
|
|
134
|
-
if (!
|
|
135
|
-
const
|
|
136
|
-
if (this._line(
|
|
137
|
-
const x =
|
|
138
|
-
this._line(
|
|
98
|
+
const p = document.createElement("div");
|
|
99
|
+
p.className = "og-orgchart-wrap", p.style.cssText = `width:${c}px;height:${_}px;`;
|
|
100
|
+
const d = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
101
|
+
d.setAttribute("width", String(c)), d.setAttribute("height", String(_)), d.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;overflow:visible;";
|
|
102
|
+
const h = (n) => {
|
|
103
|
+
for (const i2 of n) {
|
|
104
|
+
if (!i2._expanded || !i2.children.length) continue;
|
|
105
|
+
const u = s2.get(i2._treeId), l2 = u.x + t / 2, f = u.y + e, a = f + o / 2, m = i2.children;
|
|
106
|
+
if (this._line(d, l2, f, l2, a), m.length > 1) {
|
|
107
|
+
const x = s2.get(m[0]._treeId), y = s2.get(m[m.length - 1]._treeId);
|
|
108
|
+
this._line(d, x.x + t / 2, a, y.x + t / 2, a);
|
|
139
109
|
}
|
|
140
|
-
for (const x of
|
|
141
|
-
const y =
|
|
142
|
-
this._line(
|
|
110
|
+
for (const x of m) {
|
|
111
|
+
const y = s2.get(x._treeId), A = y.x + t / 2;
|
|
112
|
+
this._line(d, A, a, A, y.y);
|
|
143
113
|
}
|
|
144
|
-
|
|
114
|
+
h(m);
|
|
145
115
|
}
|
|
146
116
|
};
|
|
147
|
-
|
|
148
|
-
const
|
|
149
|
-
for (const
|
|
150
|
-
const
|
|
151
|
-
if (!
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
for (const
|
|
157
|
-
const
|
|
158
|
-
if (x.className = "og-orgchart-col" + (
|
|
159
|
-
const y = typeof
|
|
117
|
+
h(this._roots), p.appendChild(d);
|
|
118
|
+
const g = (n) => {
|
|
119
|
+
for (const i2 of n) {
|
|
120
|
+
const u = s2.get(i2._treeId);
|
|
121
|
+
if (!u) continue;
|
|
122
|
+
const l2 = document.createElement("div");
|
|
123
|
+
l2.className = "og-orgchart-node", i2._hasChildren && l2.classList.add("og-orgchart-node--branch"), i2._expanded && l2.classList.add("og-orgchart-node--expanded"), this._selectedId === i2._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
|
+
const f = document.createElement("div");
|
|
125
|
+
f.className = "og-orgchart-node-content";
|
|
126
|
+
for (const a of r2) {
|
|
127
|
+
const m = i2.data[a.field], x = document.createElement("div");
|
|
128
|
+
if (x.className = "og-orgchart-col" + (a.className ? " " + a.className : ""), a.style) {
|
|
129
|
+
const y = typeof a.style == "function" ? a.style(m, i2.data) : a.style;
|
|
160
130
|
x.setAttribute("style", y);
|
|
161
131
|
}
|
|
162
|
-
if (
|
|
163
|
-
const y =
|
|
132
|
+
if (a.renderer) {
|
|
133
|
+
const y = a.renderer(m, i2.data);
|
|
164
134
|
typeof y == "string" ? x.innerHTML = y : x.appendChild(y);
|
|
165
|
-
} else
|
|
166
|
-
|
|
167
|
-
p.appendChild(x);
|
|
135
|
+
} else x.textContent = m ?? "";
|
|
136
|
+
f.appendChild(x);
|
|
168
137
|
}
|
|
169
|
-
if (
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
x.stopPropagation(), this._toggle(
|
|
175
|
-
}),
|
|
138
|
+
if (l2.appendChild(f), i2._hasChildren) {
|
|
139
|
+
const a = document.createElement("button");
|
|
140
|
+
a.type = "button", a.className = "og-orgchart-toggle", a.setAttribute("aria-expanded", i2._expanded ? "true" : "false"), a.setAttribute("aria-label", C(i2._expanded ? "tree.collapse" : "tree.expand"));
|
|
141
|
+
const m = document.createElement("i");
|
|
142
|
+
m.setAttribute("aria-hidden", "true"), m.className = i2._expanded ? "bi bi-dash-circle" : "bi bi-plus-circle", a.appendChild(m), a.addEventListener("click", (x) => {
|
|
143
|
+
x.stopPropagation(), this._toggle(i2._treeId);
|
|
144
|
+
}), l2.appendChild(a);
|
|
176
145
|
}
|
|
177
|
-
|
|
178
|
-
this._selectedId =
|
|
179
|
-
}),
|
|
146
|
+
l2.addEventListener("click", () => {
|
|
147
|
+
this._selectedId = i2._treeId, this._opts.onNodeClick(i2._treeId, i2.data), this._container.querySelectorAll(".og-orgchart-node--selected").forEach((a) => a.classList.remove("og-orgchart-node--selected")), l2.classList.add("og-orgchart-node--selected");
|
|
148
|
+
}), p.appendChild(l2), i2._expanded && i2.children.length && g(i2.children);
|
|
180
149
|
}
|
|
181
150
|
};
|
|
182
|
-
|
|
151
|
+
g(this._roots), this._container.appendChild(p);
|
|
183
152
|
}
|
|
184
153
|
}
|
|
185
|
-
class
|
|
186
|
-
// ── 1. XML → 데이터 배열 ────────────────────────────────────
|
|
187
|
-
/**
|
|
188
|
-
* XML 문자열을 파싱하여 그리드 데이터 배열로 변환.
|
|
189
|
-
* Element / Attribute 방식 자동 감지.
|
|
190
|
-
*
|
|
191
|
-
* @throws XML 파싱 오류 시 Error 발생
|
|
192
|
-
*/
|
|
154
|
+
class I2 {
|
|
193
155
|
static parse(t, e = {}) {
|
|
194
|
-
var
|
|
195
|
-
const { fieldMap:
|
|
196
|
-
if (_) throw new Error(`XML 파싱 오류: ${(
|
|
197
|
-
const
|
|
198
|
-
let
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
for (const s of Array.from(d.attributes)) {
|
|
207
|
-
const h = i[s.name] ?? s.name;
|
|
208
|
-
p[h] = a ? s.value.trim() : s.value;
|
|
156
|
+
var _a, _b, _c;
|
|
157
|
+
const { fieldMap: o = {}, trim: r2 = true } = e, c = new DOMParser().parseFromString(t.trim(), "text/xml"), _ = c.querySelector("parsererror");
|
|
158
|
+
if (_) throw new Error(`XML 파싱 오류: ${(_a = _.textContent) == null ? void 0 : _a.trim()}`);
|
|
159
|
+
const p = c.documentElement;
|
|
160
|
+
let d = e.rowTag;
|
|
161
|
+
d || (d = ((_c = (_b = e.rootTag ? c.querySelector(e.rootTag) : p) == null ? void 0 : _b.children[0]) == null ? void 0 : _c.tagName) ?? "row");
|
|
162
|
+
const h = c.getElementsByTagName(d), g = [];
|
|
163
|
+
for (let n = 0; n < h.length; n++) {
|
|
164
|
+
const i2 = h[n], u = {};
|
|
165
|
+
for (const l2 of Array.from(i2.attributes)) {
|
|
166
|
+
const f = o[l2.name] ?? l2.name;
|
|
167
|
+
u[f] = r2 ? l2.value.trim() : l2.value;
|
|
209
168
|
}
|
|
210
|
-
for (const
|
|
211
|
-
const
|
|
212
|
-
|
|
169
|
+
for (const l2 of Array.from(i2.children)) {
|
|
170
|
+
const f = o[l2.tagName] ?? l2.tagName, a = l2.textContent ?? "";
|
|
171
|
+
u[f] = r2 ? a.trim() : a;
|
|
213
172
|
}
|
|
214
|
-
|
|
173
|
+
g.push(u);
|
|
215
174
|
}
|
|
216
|
-
return
|
|
175
|
+
return g;
|
|
217
176
|
}
|
|
218
|
-
// ── 2. 데이터 배열 → XML ─────────────────────────────────────
|
|
219
|
-
/**
|
|
220
|
-
* 그리드 데이터 배열을 XML 문자열로 직렬화.
|
|
221
|
-
*/
|
|
222
177
|
static stringify(t, e = {}) {
|
|
223
|
-
const {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
excludeFields: f = []
|
|
232
|
-
} = e, u = " ".repeat(m), o = [];
|
|
233
|
-
_ && o.push('<?xml version="1.0" encoding="UTF-8"?>'), o.push(`<${i}>`);
|
|
234
|
-
for (const n of t) {
|
|
235
|
-
const l = Object.entries(n).filter(([d]) => !f.includes(d));
|
|
236
|
-
if (r === "attribute") {
|
|
237
|
-
const d = l.map(([p, s]) => {
|
|
238
|
-
const h = c[p] ?? p, x = s == null ? g : String(s);
|
|
239
|
-
return `${h}="${this._escAttr(x)}"`;
|
|
178
|
+
const { rootTag: o = "rows", rowTag: r2 = "row", mode: s2 = "element", fieldMap: c = {}, declaration: _ = true, indent: p = 2, nullAs: d = "", excludeFields: h = [] } = e, g = " ".repeat(p), n = [];
|
|
179
|
+
_ && n.push('<?xml version="1.0" encoding="UTF-8"?>'), n.push(`<${o}>`);
|
|
180
|
+
for (const i2 of t) {
|
|
181
|
+
const u = Object.entries(i2).filter(([l2]) => !h.includes(l2));
|
|
182
|
+
if (s2 === "attribute") {
|
|
183
|
+
const l2 = u.map(([f, a]) => {
|
|
184
|
+
const m = c[f] ?? f, x = a == null ? d : String(a);
|
|
185
|
+
return `${m}="${this._escAttr(x)}"`;
|
|
240
186
|
}).join(" ");
|
|
241
|
-
|
|
187
|
+
n.push(`${g}<${r2}${l2 ? " " + l2 : ""} />`);
|
|
242
188
|
} else {
|
|
243
|
-
|
|
244
|
-
for (const [
|
|
245
|
-
const
|
|
246
|
-
|
|
189
|
+
n.push(`${g}<${r2}>`);
|
|
190
|
+
for (const [l2, f] of u) {
|
|
191
|
+
const a = c[l2] ?? l2, m = f == null ? d : String(f);
|
|
192
|
+
n.push(`${g}${g}<${a}>${this._escText(m)}</${a}>`);
|
|
247
193
|
}
|
|
248
|
-
|
|
194
|
+
n.push(`${g}</${r2}>`);
|
|
249
195
|
}
|
|
250
196
|
}
|
|
251
|
-
return
|
|
197
|
+
return n.push(`</${o}>`), n.join(`
|
|
252
198
|
`);
|
|
253
199
|
}
|
|
254
|
-
// ── 3. SAP BAPI XML 응답 파싱 ────────────────────────────────
|
|
255
|
-
/**
|
|
256
|
-
* SAP BAPI XML 응답을 파싱하여 { header, items, returns } 구조로 반환.
|
|
257
|
-
*
|
|
258
|
-
* 지원 패턴:
|
|
259
|
-
* <DOCUMENTHEADER>...</DOCUMENTHEADER>
|
|
260
|
-
* <ACCOUNTGL><ITEM>...</ITEM></ACCOUNTGL>
|
|
261
|
-
* <RETURN><TYPE>S</TYPE><MESSAGE>...</MESSAGE></RETURN>
|
|
262
|
-
*/
|
|
263
200
|
static parseSap(t) {
|
|
264
|
-
var
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
for (const l of Array.from(o.children))
|
|
273
|
-
n[l.tagName] = ((g = l.textContent) == null ? void 0 : g.trim()) ?? "";
|
|
274
|
-
a.returns.push(n);
|
|
201
|
+
var _a, _b, _c, _d;
|
|
202
|
+
const o = new DOMParser().parseFromString(t.trim(), "text/xml"), r2 = { header: {}, items: [], returns: [], raw: o }, s2 = o.getElementsByTagName("DOCUMENTHEADER")[0];
|
|
203
|
+
if (s2) for (const p of Array.from(s2.children)) r2.header[p.tagName] = ((_a = p.textContent) == null ? void 0 : _a.trim()) ?? "";
|
|
204
|
+
const c = o.getElementsByTagName("RETURN");
|
|
205
|
+
for (const p of Array.from(c)) {
|
|
206
|
+
const d = {};
|
|
207
|
+
for (const h of Array.from(p.children)) d[h.tagName] = ((_b = h.textContent) == null ? void 0 : _b.trim()) ?? "";
|
|
208
|
+
r2.returns.push(d);
|
|
275
209
|
}
|
|
276
210
|
const _ = ["ACCOUNTGL", "ACCOUNTRECEIVABLE", "ACCOUNTPAYABLE", "ITEMS"];
|
|
277
|
-
for (const
|
|
278
|
-
const
|
|
279
|
-
if (!
|
|
280
|
-
const
|
|
281
|
-
for (const
|
|
282
|
-
const
|
|
283
|
-
for (const
|
|
284
|
-
|
|
285
|
-
a.items.push(s);
|
|
211
|
+
for (const p of _) {
|
|
212
|
+
const d = o.getElementsByTagName(p)[0];
|
|
213
|
+
if (!d) continue;
|
|
214
|
+
const h = d.getElementsByTagName("ITEM"), g = h.length > 0 ? Array.from(h) : [d];
|
|
215
|
+
for (const n of g) {
|
|
216
|
+
const i2 = {};
|
|
217
|
+
for (const u of Array.from(n.children)) i2[u.tagName] = ((_c = u.textContent) == null ? void 0 : _c.trim()) ?? "";
|
|
218
|
+
r2.items.push(i2);
|
|
286
219
|
}
|
|
287
220
|
break;
|
|
288
221
|
}
|
|
289
|
-
if (
|
|
290
|
-
const
|
|
291
|
-
for (const
|
|
292
|
-
if (
|
|
293
|
-
const
|
|
294
|
-
for (const
|
|
295
|
-
|
|
296
|
-
Object.keys(d).length > 0 && a.items.push(d);
|
|
222
|
+
if (r2.items.length === 0) {
|
|
223
|
+
const p = o.documentElement, d = Array.from(p.children).filter((h) => h.hasAttribute("SEGMENT"));
|
|
224
|
+
for (const h of d) {
|
|
225
|
+
if (h.tagName === "EDI_DC40") continue;
|
|
226
|
+
const g = {};
|
|
227
|
+
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 && r2.items.push(g);
|
|
297
229
|
}
|
|
298
230
|
}
|
|
299
|
-
return
|
|
231
|
+
return r2;
|
|
300
232
|
}
|
|
301
|
-
// ── 4. SAP BAPI 페이로드 → XML 직렬화 ───────────────────────
|
|
302
|
-
/**
|
|
303
|
-
* BAPI 페이로드 객체를 SAP XML 형식으로 직렬화.
|
|
304
|
-
* sapGenPayload()의 결과 또는 단일 document 객체를 받음.
|
|
305
|
-
*/
|
|
306
233
|
static stringifySap(t) {
|
|
307
|
-
const e = [
|
|
308
|
-
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
309
|
-
"<BAPI_CALL>"
|
|
310
|
-
];
|
|
234
|
+
const e = ['<?xml version="1.0" encoding="UTF-8"?>', "<BAPI_CALL>"];
|
|
311
235
|
if (t.BAPI_FUNCTION && e.push(` <FUNCTION>${this._escText(t.BAPI_FUNCTION)}</FUNCTION>`), t.DOCUMENTHEADER && typeof t.DOCUMENTHEADER == "object") {
|
|
312
236
|
e.push(" <DOCUMENTHEADER>");
|
|
313
|
-
for (const [
|
|
314
|
-
r != null && r !== "" && e.push(` <${a}>${this._escText(String(r))}</${a}>`);
|
|
237
|
+
for (const [r2, s2] of Object.entries(t.DOCUMENTHEADER)) s2 != null && s2 !== "" && e.push(` <${r2}>${this._escText(String(s2))}</${r2}>`);
|
|
315
238
|
e.push(" </DOCUMENTHEADER>");
|
|
316
239
|
}
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
e.push(` <${i}>`);
|
|
322
|
-
for (const a of t[i]) {
|
|
240
|
+
const o = Object.keys(t).find((r2) => Array.isArray(t[r2]) && !r2.startsWith("_"));
|
|
241
|
+
if (o) {
|
|
242
|
+
e.push(` <${o}>`);
|
|
243
|
+
for (const r2 of t[o]) {
|
|
323
244
|
e.push(" <ITEM>");
|
|
324
|
-
for (const [
|
|
325
|
-
c != null && c !== "" && !r.startsWith("_") && e.push(` <${r}>${this._escText(String(c))}</${r}>`);
|
|
245
|
+
for (const [s2, c] of Object.entries(r2)) c != null && c !== "" && !s2.startsWith("_") && e.push(` <${s2}>${this._escText(String(c))}</${s2}>`);
|
|
326
246
|
e.push(" </ITEM>");
|
|
327
247
|
}
|
|
328
|
-
e.push(` </${
|
|
248
|
+
e.push(` </${o}>`);
|
|
329
249
|
}
|
|
330
250
|
return e.push("</BAPI_CALL>"), e.join(`
|
|
331
251
|
`);
|
|
332
252
|
}
|
|
333
|
-
// ── 5. 다건 documents 배열 → XML (sapGenPayload 결과 전체) ───
|
|
334
|
-
/**
|
|
335
|
-
* sapGenPayload()의 { totalDocuments, documents[] } 결과를
|
|
336
|
-
* 다건 BAPI XML로 직렬화.
|
|
337
|
-
*/
|
|
338
253
|
static stringifySapBatch(t) {
|
|
339
|
-
const e = [
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return t.documents.forEach((i, a) => {
|
|
344
|
-
e.push(` <BAPI_CALL seq="${a + 1}">`);
|
|
345
|
-
const r = this.stringifySap(i).split(`
|
|
254
|
+
const e = ['<?xml version="1.0" encoding="UTF-8"?>', `<BAPI_BATCH total="${t.documents.length}">`];
|
|
255
|
+
return t.documents.forEach((o, r2) => {
|
|
256
|
+
e.push(` <BAPI_CALL seq="${r2 + 1}">`);
|
|
257
|
+
const s2 = this.stringifySap(o).split(`
|
|
346
258
|
`).filter((c) => !c.startsWith("<?xml")).map((c) => " " + c).join(`
|
|
347
259
|
`);
|
|
348
|
-
e.push(
|
|
260
|
+
e.push(s2), e.push(" </BAPI_CALL>");
|
|
349
261
|
}), e.push("</BAPI_BATCH>"), e.join(`
|
|
350
262
|
`);
|
|
351
263
|
}
|
|
352
|
-
// ── 내부 이스케이프 헬퍼 ─────────────────────────────────────
|
|
353
264
|
static _escText(t) {
|
|
354
265
|
return t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
355
266
|
}
|
|
@@ -358,19 +269,19 @@ class w {
|
|
|
358
269
|
}
|
|
359
270
|
}
|
|
360
271
|
export {
|
|
361
|
-
|
|
272
|
+
D as DEFAULT_ICON_ROLES,
|
|
362
273
|
T as GridShuttle,
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
274
|
+
I as IconRegistry,
|
|
275
|
+
L as LocaleRegistry,
|
|
276
|
+
O as OpenGrid,
|
|
277
|
+
N as OrgChart,
|
|
278
|
+
S as SkinRegistry,
|
|
279
|
+
I2 as XmlConverter,
|
|
280
|
+
v as createGridShuttle,
|
|
281
|
+
i as iconRegistry,
|
|
282
|
+
l as localeRegistry,
|
|
283
|
+
r as renderIcon,
|
|
284
|
+
s as skinRegistry,
|
|
374
285
|
C as t
|
|
375
286
|
};
|
|
376
287
|
//# sourceMappingURL=open-grid.js.map
|