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.
Files changed (54) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/OpenGrid-0r_543Kj.cjs +7192 -0
  4. package/dist/OpenGrid-HmhGVC2V.js +7203 -0
  5. package/dist/open-grid-react.cjs +27 -1
  6. package/dist/open-grid-react.js +22 -82
  7. package/dist/open-grid-vue.cjs +31 -1
  8. package/dist/open-grid-vue.js +29 -79
  9. package/dist/open-grid.cjs +272 -6
  10. package/dist/open-grid.js +177 -266
  11. package/dist/types/core/CellEditManager.d.ts +73 -0
  12. package/dist/types/core/CellEventHandler.d.ts +99 -2
  13. package/dist/types/core/ChartManager.d.ts +51 -3
  14. package/dist/types/core/ContextMenu.d.ts +43 -2
  15. package/dist/types/core/CrossGridController.d.ts +86 -15
  16. package/dist/types/core/CrossGridRegistry.d.ts +36 -2
  17. package/dist/types/core/DetailManager.d.ts +106 -15
  18. package/dist/types/core/ExportManager.d.ts +66 -1
  19. package/dist/types/core/ExtensionPointRegistry.d.ts +160 -14
  20. package/dist/types/core/FilterPanel.d.ts +17 -2
  21. package/dist/types/core/FilterSelect.d.ts +37 -13
  22. package/dist/types/core/FindBarManager.d.ts +26 -0
  23. package/dist/types/core/FlatRowModel.d.ts +54 -11
  24. package/dist/types/core/FooterManager.d.ts +53 -1
  25. package/dist/types/core/FormulaController.d.ts +139 -10
  26. package/dist/types/core/GridComposer.d.ts +54 -6
  27. package/dist/types/core/GridShuttle.d.ts +44 -4
  28. package/dist/types/core/GroupTreeManager.d.ts +86 -2
  29. package/dist/types/core/IconRegistry.d.ts +56 -9
  30. package/dist/types/core/KeyboardManager.d.ts +88 -4
  31. package/dist/types/core/MaskingEngine.d.ts +10 -9
  32. package/dist/types/core/MutationService.d.ts +113 -10
  33. package/dist/types/core/OrgChart.d.ts +56 -1
  34. package/dist/types/core/OverrideKernel.d.ts +59 -15
  35. package/dist/types/core/Pagination.d.ts +38 -4
  36. package/dist/types/core/RangeSelectionManager.d.ts +121 -7
  37. package/dist/types/core/RenderController.d.ts +56 -0
  38. package/dist/types/core/RowManager.d.ts +55 -0
  39. package/dist/types/core/SkinRegistry.d.ts +51 -15
  40. package/dist/types/core/SortFilterManager.d.ts +80 -1
  41. package/dist/types/core/TriggerManager.d.ts +46 -0
  42. package/dist/types/core/WorksheetManager.d.ts +61 -2
  43. package/dist/types/core/XmlConverter.d.ts +56 -23
  44. package/dist/types/core/chart/types.d.ts +107 -10
  45. package/dist/types/core/editors/CellEditor.d.ts +29 -2
  46. package/dist/types/core/formula/types.d.ts +71 -8
  47. package/dist/types/core/range/RangeQuery.d.ts +24 -2
  48. package/dist/types/core/renderers/CellRenderer.d.ts +100 -8
  49. package/dist/xlsx.min-BQ1o3sB6.cjs +11793 -0
  50. package/dist/{xlsx.min-Wavxcamn.js → xlsx.min-Bbz2ZypC.js} +453 -566
  51. package/package.json +2 -1
  52. package/dist/OpenGrid-B0Spm0rU.js +0 -10404
  53. package/dist/OpenGrid-CuXj0isp.cjs +0 -97
  54. package/dist/xlsx.min-Bx-LxWOf.cjs +0 -138
package/dist/open-grid.js CHANGED
@@ -1,84 +1,58 @@
1
- import { b as E, t as C } from "./OpenGrid-B0Spm0rU.js";
2
- import { D as S, I as O, L as R, O as D, S as k, i as M, l as B, r as U, s as F } from "./OpenGrid-B0Spm0rU.js";
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, i, a = {}) {
4
+ constructor(t, e, o, r2 = {}) {
5
5
  this._left = t, this._right = e;
6
- const r = document.createElement("div");
7
- r.className = "og-shuttle", r.style.cssText = `display:flex;gap:6px;align-items:center;justify-content:center;flex-direction:${a.layout === "horizontal" ? "row" : "column"};`;
8
- const c = (g, f, u) => {
9
- const o = document.createElement("button");
10
- return o.type = "button", o.className = "og-shuttle-btn", o.textContent = g, o.title = f, o.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);", o.addEventListener("mouseover", () => {
11
- o.style.background = "#f0f6ff", o.style.borderColor = "#1976d2";
12
- }), o.addEventListener("mouseout", () => {
13
- o.style.background = "#fff", o.style.borderColor = "#bbb";
14
- }), o.addEventListener("click", u), o;
15
- }, _ = a.labels ?? {}, m = (g) => this._left.t(g);
16
- r.appendChild(c(
17
- _.toRight ?? "▶",
18
- m("shuttle.toRight"),
19
- () => {
20
- this._left.moveCheckedTo(this._right);
21
- }
22
- )), r.appendChild(c(
23
- _.toLeft ?? "◀",
24
- m("shuttle.toLeft"),
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 i = t.getData().length;
44
- i > 0 && t.moveRowsTo(e, Array.from({ length: i }, (a, r) => r));
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 N(A, t, e, i) {
51
- return new T(A, t, e, i);
34
+ function v(E, t, e, o) {
35
+ return new T(E, t, e, o);
52
36
  }
53
- class I {
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
- nodeWidth: 160,
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: i, expandOnLoad: a } = this._opts;
69
- a && this._expandedKeys.size === 0 && t.forEach((r) => this._expandedKeys.add(r[e])), this._roots = E(t, { idField: e, parentIdField: i }, this._expandedKeys), this._render();
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 i of e)
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 = E(this._data, { idField: t, parentIdField: e }, this._expandedKeys), this._render();
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: i, siblingGap: a } = this._opts, r = /* @__PURE__ */ new Map();
70
+ const { nodeWidth: t, nodeHeight: e, levelGap: o, siblingGap: r2 } = this._opts, s2 = /* @__PURE__ */ new Map();
98
71
  let c = 0;
99
- const _ = (f) => {
100
- const u = f._depth * (e + i), o = f._expanded ? f.children : [];
101
- if (!o.length) {
102
- const p = c;
103
- return c += t + a, r.set(f._treeId, { x: p, y: u }), { minX: p, maxX: p };
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 n = 1 / 0, l = -1 / 0;
106
- for (const p of o) {
107
- const { minX: s, maxX: h } = _(p);
108
- s < n && (n = s), h > l && (l = h);
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 d = n + (l - n + t) / 2 - t / 2;
111
- return r.set(f._treeId, { x: d, y: u }), { minX: n, maxX: l };
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 f of this._roots) _(f);
114
- let m = 0, g = 0;
115
- for (const { x: f, y: u } of r.values())
116
- f + t > m && (m = f + t), u + e > g && (g = u + e);
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
- // ── SVG 직선 헬퍼 ──
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(i)), c.setAttribute("x2", String(a)), c.setAttribute("y2", String(r)), c.setAttribute("class", "og-orgchart-line"), t.appendChild(c);
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: i, columns: a } = this._opts, { layout: r, totalW: c, totalH: _ } = this._calcLayout();
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 m = document.createElement("div");
129
- m.className = "og-orgchart-wrap", m.style.cssText = `width:${c}px;height:${_}px;`;
130
- const g = document.createElementNS("http://www.w3.org/2000/svg", "svg");
131
- g.setAttribute("width", String(c)), g.setAttribute("height", String(_)), g.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;overflow:visible;";
132
- const f = (o) => {
133
- for (const n of o) {
134
- if (!n._expanded || !n.children.length) continue;
135
- const l = r.get(n._treeId), d = l.x + t / 2, p = l.y + e, s = p + i / 2, h = n.children;
136
- if (this._line(g, d, p, d, s), h.length > 1) {
137
- const x = r.get(h[0]._treeId), y = r.get(h[h.length - 1]._treeId);
138
- this._line(g, x.x + t / 2, s, y.x + t / 2, s);
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 h) {
141
- const y = r.get(x._treeId), b = y.x + t / 2;
142
- this._line(g, b, s, b, y.y);
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
- f(h);
114
+ h(m);
145
115
  }
146
116
  };
147
- f(this._roots), m.appendChild(g);
148
- const u = (o) => {
149
- for (const n of o) {
150
- const l = r.get(n._treeId);
151
- if (!l) continue;
152
- const d = document.createElement("div");
153
- d.className = "og-orgchart-node", n._hasChildren && d.classList.add("og-orgchart-node--branch"), n._expanded && d.classList.add("og-orgchart-node--expanded"), this._selectedId === n._treeId && d.classList.add("og-orgchart-node--selected"), d.style.cssText = `left:${l.x}px;top:${l.y}px;width:${t}px;height:${e}px;`;
154
- const p = document.createElement("div");
155
- p.className = "og-orgchart-node-content";
156
- for (const s of a) {
157
- const h = n.data[s.field], x = document.createElement("div");
158
- if (x.className = "og-orgchart-col" + (s.className ? " " + s.className : ""), s.style) {
159
- const y = typeof s.style == "function" ? s.style(h, n.data) : s.style;
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 (s.renderer) {
163
- const y = s.renderer(h, n.data);
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
- x.textContent = h ?? "";
167
- p.appendChild(x);
135
+ } else x.textContent = m ?? "";
136
+ f.appendChild(x);
168
137
  }
169
- if (d.appendChild(p), n._hasChildren) {
170
- const s = document.createElement("button");
171
- s.type = "button", s.className = "og-orgchart-toggle", s.setAttribute("aria-expanded", n._expanded ? "true" : "false"), s.setAttribute("aria-label", C(n._expanded ? "tree.collapse" : "tree.expand"));
172
- const h = document.createElement("i");
173
- h.setAttribute("aria-hidden", "true"), h.className = n._expanded ? "bi bi-dash-circle" : "bi bi-plus-circle", s.appendChild(h), s.addEventListener("click", (x) => {
174
- x.stopPropagation(), this._toggle(n._treeId);
175
- }), d.appendChild(s);
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
- d.addEventListener("click", () => {
178
- this._selectedId = n._treeId, this._opts.onNodeClick(n._treeId, n.data), this._container.querySelectorAll(".og-orgchart-node--selected").forEach((s) => s.classList.remove("og-orgchart-node--selected")), d.classList.add("og-orgchart-node--selected");
179
- }), m.appendChild(d), n._expanded && n.children.length && u(n.children);
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
- u(this._roots), this._container.appendChild(m);
151
+ g(this._roots), this._container.appendChild(p);
183
152
  }
184
153
  }
185
- class w {
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 o, n;
195
- const { fieldMap: i = {}, trim: a = !0 } = e, c = new DOMParser().parseFromString(t.trim(), "text/xml"), _ = c.querySelector("parsererror");
196
- if (_) throw new Error(`XML 파싱 오류: ${(o = _.textContent) == null ? void 0 : o.trim()}`);
197
- const m = c.documentElement;
198
- let g = e.rowTag;
199
- if (!g) {
200
- const l = e.rootTag ? c.querySelector(e.rootTag) : m;
201
- g = ((n = l == null ? void 0 : l.children[0]) == null ? void 0 : n.tagName) ?? "row";
202
- }
203
- const f = c.getElementsByTagName(g), u = [];
204
- for (let l = 0; l < f.length; l++) {
205
- const d = f[l], p = {};
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 s of Array.from(d.children)) {
211
- const h = i[s.tagName] ?? s.tagName, x = s.textContent ?? "";
212
- p[h] = a ? x.trim() : x;
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
- u.push(p);
173
+ g.push(u);
215
174
  }
216
- return u;
175
+ return g;
217
176
  }
218
- // ── 2. 데이터 배열 → XML ─────────────────────────────────────
219
- /**
220
- * 그리드 데이터 배열을 XML 문자열로 직렬화.
221
- */
222
177
  static stringify(t, e = {}) {
223
- const {
224
- rootTag: i = "rows",
225
- rowTag: a = "row",
226
- mode: r = "element",
227
- fieldMap: c = {},
228
- declaration: _ = !0,
229
- indent: m = 2,
230
- nullAs: g = "",
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
- o.push(`${u}<${a}${d ? " " + d : ""} />`);
187
+ n.push(`${g}<${r2}${l2 ? " " + l2 : ""} />`);
242
188
  } else {
243
- o.push(`${u}<${a}>`);
244
- for (const [d, p] of l) {
245
- const s = c[d] ?? d, h = p == null ? g : String(p);
246
- o.push(`${u}${u}<${s}>${this._escText(h)}</${s}>`);
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
- o.push(`${u}</${a}>`);
194
+ n.push(`${g}</${r2}>`);
249
195
  }
250
196
  }
251
- return o.push(`</${i}>`), o.join(`
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 m, g, f, u;
265
- const i = new DOMParser().parseFromString(t.trim(), "text/xml"), a = { header: {}, items: [], returns: [], raw: i }, r = i.getElementsByTagName("DOCUMENTHEADER")[0];
266
- if (r)
267
- for (const o of Array.from(r.children))
268
- a.header[o.tagName] = ((m = o.textContent) == null ? void 0 : m.trim()) ?? "";
269
- const c = i.getElementsByTagName("RETURN");
270
- for (const o of Array.from(c)) {
271
- const n = {};
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 o of _) {
278
- const n = i.getElementsByTagName(o)[0];
279
- if (!n) continue;
280
- const l = n.getElementsByTagName("ITEM"), d = l.length > 0 ? Array.from(l) : [n];
281
- for (const p of d) {
282
- const s = {};
283
- for (const h of Array.from(p.children))
284
- s[h.tagName] = ((f = h.textContent) == null ? void 0 : f.trim()) ?? "";
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 (a.items.length === 0) {
290
- const o = i.documentElement, n = Array.from(o.children).filter((l) => l.hasAttribute("SEGMENT"));
291
- for (const l of n) {
292
- if (l.tagName === "EDI_DC40") continue;
293
- const d = {};
294
- for (const p of Array.from(l.children))
295
- d[p.tagName] = ((u = p.textContent) == null ? void 0 : u.trim()) ?? "";
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 a;
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 [a, r] of Object.entries(t.DOCUMENTHEADER))
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 i = Object.keys(t).find(
318
- (a) => Array.isArray(t[a]) && !a.startsWith("_")
319
- );
320
- if (i) {
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 [r, c] of Object.entries(a))
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(` </${i}>`);
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
- '<?xml version="1.0" encoding="UTF-8"?>',
341
- `<BAPI_BATCH total="${t.documents.length}">`
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(r), e.push(" </BAPI_CALL>");
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
355
266
  }
@@ -358,19 +269,19 @@ class w {
358
269
  }
359
270
  }
360
271
  export {
361
- S as DEFAULT_ICON_ROLES,
272
+ D as DEFAULT_ICON_ROLES,
362
273
  T as GridShuttle,
363
- O as IconRegistry,
364
- R as LocaleRegistry,
365
- D as OpenGrid,
366
- I as OrgChart,
367
- k as SkinRegistry,
368
- w as XmlConverter,
369
- N as createGridShuttle,
370
- M as iconRegistry,
371
- B as localeRegistry,
372
- U as renderIcon,
373
- F as skinRegistry,
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