@operato/data-mapper 9.0.0-beta.56 → 9.0.0-beta.61

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 (57) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +3 -3
  4. package/dist/src/components/function-box-options-builder.d.ts +0 -18
  5. package/dist/src/components/function-box-options-builder.js +0 -145
  6. package/dist/src/components/function-box-options-builder.js.map +0 -1
  7. package/dist/src/components/function-box-popup.d.ts +0 -15
  8. package/dist/src/components/function-box-popup.js +0 -236
  9. package/dist/src/components/function-box-popup.js.map +0 -1
  10. package/dist/src/components/property-editor.d.ts +0 -34
  11. package/dist/src/components/property-editor.js +0 -76
  12. package/dist/src/components/property-editor.js.map +0 -1
  13. package/dist/src/context/data-mapper-context.d.ts +0 -12
  14. package/dist/src/context/data-mapper-context.js +0 -3
  15. package/dist/src/context/data-mapper-context.js.map +0 -1
  16. package/dist/src/functions/custom-script.d.ts +0 -10
  17. package/dist/src/functions/custom-script.js +0 -49
  18. package/dist/src/functions/custom-script.js.map +0 -1
  19. package/dist/src/functions/date-formatting.d.ts +0 -10
  20. package/dist/src/functions/date-formatting.js +0 -59
  21. package/dist/src/functions/date-formatting.js.map +0 -1
  22. package/dist/src/functions/index.d.ts +0 -10
  23. package/dist/src/functions/index.js +0 -19
  24. package/dist/src/functions/index.js.map +0 -1
  25. package/dist/src/functions/json-query.d.ts +0 -10
  26. package/dist/src/functions/json-query.js +0 -116
  27. package/dist/src/functions/json-query.js.map +0 -1
  28. package/dist/src/functions/passthrough.d.ts +0 -6
  29. package/dist/src/functions/passthrough.js +0 -38
  30. package/dist/src/functions/passthrough.js.map +0 -1
  31. package/dist/src/functions/range-mapping.d.ts +0 -10
  32. package/dist/src/functions/range-mapping.js +0 -106
  33. package/dist/src/functions/range-mapping.js.map +0 -1
  34. package/dist/src/functions/string-manipulation.d.ts +0 -33
  35. package/dist/src/functions/string-manipulation.js +0 -215
  36. package/dist/src/functions/string-manipulation.js.map +0 -1
  37. package/dist/src/functions/text-transform.d.ts +0 -25
  38. package/dist/src/functions/text-transform.js +0 -167
  39. package/dist/src/functions/text-transform.js.map +0 -1
  40. package/dist/src/functions/value-mapping.d.ts +0 -10
  41. package/dist/src/functions/value-mapping.js +0 -109
  42. package/dist/src/functions/value-mapping.js.map +0 -1
  43. package/dist/src/index.d.ts +0 -2
  44. package/dist/src/index.js +0 -3
  45. package/dist/src/index.js.map +0 -1
  46. package/dist/src/ox-data-mapper.d.ts +0 -24
  47. package/dist/src/ox-data-mapper.js +0 -241
  48. package/dist/src/ox-data-mapper.js.map +0 -1
  49. package/dist/src/ox-mapping-area.d.ts +0 -36
  50. package/dist/src/ox-mapping-area.js +0 -382
  51. package/dist/src/ox-mapping-area.js.map +0 -1
  52. package/dist/src/types.d.ts +0 -19
  53. package/dist/src/types.js +0 -2
  54. package/dist/src/types.js.map +0 -1
  55. package/dist/stories/ox-data-mapper.stories.d.ts +0 -30
  56. package/dist/stories/ox-data-mapper.stories.js +0 -115
  57. package/dist/stories/ox-data-mapper.stories.js.map +0 -1
@@ -1,241 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import '@operato/data-tree/ox-tree.js';
3
- import './ox-mapping-area.js';
4
- import { LitElement, html, css } from 'lit';
5
- import { customElement, property, query, state } from 'lit/decorators.js';
6
- import { provide } from '@lit/context';
7
- import { dataMapperContext } from './context/data-mapper-context.js';
8
- let OxDataMapper = class OxDataMapper extends LitElement {
9
- constructor() {
10
- super(...arguments);
11
- this.sourceSchema = { id: 'source', label: 'source' };
12
- this.targetSchema = { id: 'target', label: 'target' };
13
- this.mappings = [];
14
- this.selected = null;
15
- this.dataMapperContext = {
16
- getUniqueId: () => {
17
- return Math.random().toString(36).substring(2, 9);
18
- },
19
- updateMappings: (mappings) => {
20
- this.mappings = mappings;
21
- this.dispatchEvent(new CustomEvent('change', {
22
- detail: this.mappings
23
- }));
24
- },
25
- getNodePosition: this.getNodePosition.bind(this)
26
- };
27
- this.dragStartElement = null;
28
- }
29
- render() {
30
- return html `
31
- <div class="container">
32
- <div class="tree-container source">
33
- <ox-tree
34
- .data=${this.sourceSchema}
35
- @collapsed=${() => this.mappingsArea.requestUpdate()}
36
- @expanded=${() => this.mappingsArea.requestUpdate()}
37
- @dragstart=${this.onDragStart}
38
- @dragover=${this.onDragOver}
39
- @drop=${this.onDrop}
40
- label-extends
41
- ></ox-tree>
42
- </div>
43
-
44
- <div class="tree-container target">
45
- <ox-tree
46
- .data=${this.targetSchema}
47
- @collapsed=${() => this.mappingsArea.requestUpdate()}
48
- @expanded=${() => this.mappingsArea.requestUpdate()}
49
- @dragstart=${this.onDragStart}
50
- @dragover=${this.onDragOver}
51
- @drop=${this.onDrop}
52
- direction="rtl"
53
- label-extends
54
- ></ox-tree>
55
- </div>
56
-
57
- <ox-mapping-area .mappings=${this.mappings}></ox-mapping-area>
58
- </div>
59
- `;
60
- }
61
- getNodePosition(nodeId, source) {
62
- const tree = source ? this.sourceTree : this.targetTree;
63
- if (!tree) {
64
- return;
65
- }
66
- const nodeRect = tree.findNodeSelfBounds(nodeId);
67
- if (!nodeRect) {
68
- return;
69
- }
70
- const mappingAreaRect = this.mappingsArea.getBoundingClientRect();
71
- return {
72
- x: source ? 0 : mappingAreaRect.width,
73
- y: nodeRect.top - mappingAreaRect.top + nodeRect.height / 2
74
- };
75
- }
76
- onDragStart(e) {
77
- var _a, _b;
78
- const path = e.composedPath();
79
- const target = path.find(el => { var _a; return (_a = el.dataset) === null || _a === void 0 ? void 0 : _a.id; });
80
- const nodeId = (_a = target === null || target === void 0 ? void 0 : target.dataset) === null || _a === void 0 ? void 0 : _a.id;
81
- if (!nodeId) {
82
- return;
83
- }
84
- const from = e.target === this.sourceTree ? 'source' : 'target';
85
- e.dataTransfer.setData('application/node-id', nodeId);
86
- e.dataTransfer.setData('application/from', from);
87
- e.dataTransfer.effectAllowed = 'move';
88
- // ✅ 노드의 라벨을 찾아 미리보기로 사용
89
- const nodeLabel = ((_b = target === null || target === void 0 ? void 0 : target.querySelector('span[label]')) === null || _b === void 0 ? void 0 : _b.textContent) || nodeId;
90
- // ✅ 미리보기 요소 생성
91
- const dragPreview = document.createElement('div');
92
- dragPreview.textContent = nodeLabel;
93
- dragPreview.style.fontSize = '14px';
94
- dragPreview.style.padding = '4px 8px';
95
- dragPreview.style.background = 'rgba(255, 255, 255, 0.3)';
96
- dragPreview.style.borderRadius = '4px';
97
- dragPreview.style.position = 'absolute';
98
- dragPreview.style.top = '-100px'; // 화면 밖으로 배치 (임시)
99
- dragPreview.style.left = '-100px';
100
- dragPreview.style.pointerEvents = 'none';
101
- dragPreview.style.zIndex = '1000';
102
- document.body.appendChild(dragPreview);
103
- // ✅ 커스텀 드래깅 이미지 적용
104
- e.dataTransfer.setDragImage(dragPreview, 0, 0);
105
- this.dragStartElement = e.target;
106
- // ✅ 일정 시간 후 미리보기 요소 삭제
107
- setTimeout(() => document.body.removeChild(dragPreview), 0);
108
- }
109
- onDragOver(e) {
110
- var _a;
111
- e.preventDefault();
112
- const from = e.dataTransfer.getData('application/from');
113
- if (this.dragStartElement === e.target) {
114
- return;
115
- }
116
- const path = e.composedPath();
117
- const target = path.find(el => { var _a; return (_a = el.dataset) === null || _a === void 0 ? void 0 : _a.id; });
118
- const nodeId = (_a = target === null || target === void 0 ? void 0 : target.dataset) === null || _a === void 0 ? void 0 : _a.id;
119
- if (!nodeId)
120
- return;
121
- e.target.selected = target.item;
122
- }
123
- onDrop(e) {
124
- var _a;
125
- e.preventDefault();
126
- const nodeId = e.dataTransfer.getData('application/node-id');
127
- const from = e.dataTransfer.getData('application/from');
128
- if (!nodeId ||
129
- (from == 'source' && e.target !== this.targetTree) ||
130
- (from == 'target' && e.target !== this.sourceTree)) {
131
- return;
132
- }
133
- // 드롭된 타겟 노드 찾기
134
- const path = e.composedPath();
135
- const targetNode = path.find(el => { var _a; return (_a = el.dataset) === null || _a === void 0 ? void 0 : _a.id; });
136
- const targetNodeId = (_a = targetNode === null || targetNode === void 0 ? void 0 : targetNode.dataset) === null || _a === void 0 ? void 0 : _a.id;
137
- if (!targetNodeId) {
138
- return;
139
- }
140
- // 중복 매핑 확인
141
- const existingMapping = (this.mappings || []).find(m => m.inputs.includes(from == 'source' ? nodeId : targetNodeId) &&
142
- m.outputs.includes(from == 'source' ? targetNodeId : nodeId));
143
- if (!existingMapping) {
144
- const { width, height } = this.mappingsArea.getBoundingClientRect();
145
- const { y: sourceY = 0 } = this.dataMapperContext.getNodePosition(from == 'source' ? nodeId : targetNodeId, true) || {};
146
- const { y: targetY = height } = this.dataMapperContext.getNodePosition(from == 'target' ? nodeId : targetNodeId, false) || {};
147
- const newMapping = {
148
- id: this.dataMapperContext.getUniqueId(),
149
- mappingFunction: 'passthrough',
150
- inputs: [from == 'source' ? nodeId : targetNodeId],
151
- outputs: [from == 'source' ? targetNodeId : nodeId],
152
- position: {
153
- x: width / 2 - 50,
154
- y: (sourceY + targetY) / 2
155
- }
156
- };
157
- this.dataMapperContext.updateMappings([...(this.mappings || []), newMapping]);
158
- this.mappingsArea.selectMappingBox(newMapping);
159
- }
160
- }
161
- };
162
- OxDataMapper.styles = css `
163
- .container {
164
- display: flex;
165
- width: 100%;
166
- min-height: 100%;
167
- position: relative;
168
- overflow-y: auto;
169
- align-items: stretch;
170
- }
171
-
172
- .tree-container {
173
- position: relative;
174
- flex: 1;
175
- display: flex;
176
- flex-direction: column;
177
- padding: 0;
178
- margin: 0;
179
- }
180
-
181
- .tree-container.source {
182
- order: 0;
183
- padding-right: 0px;
184
- }
185
-
186
- .tree-container.target {
187
- order: 2;
188
- padding-left: 0px;
189
- text-align: right;
190
- }
191
-
192
- ox-mapping-area {
193
- order: 1;
194
- position: relative;
195
- flex: 1;
196
- padding: 0;
197
- margin: 0;
198
- text-align: center;
199
- position: relative;
200
- }
201
-
202
- .tree-container.source::after,
203
- ox-mapping-area::after {
204
- content: '';
205
- position: absolute;
206
- right: 0;
207
- top: 0;
208
- width: 1px;
209
- height: 100%;
210
- background-color: black;
211
- }
212
- `;
213
- __decorate([
214
- property({ type: Object })
215
- ], OxDataMapper.prototype, "sourceSchema", void 0);
216
- __decorate([
217
- property({ type: Object })
218
- ], OxDataMapper.prototype, "targetSchema", void 0);
219
- __decorate([
220
- property({ type: Array })
221
- ], OxDataMapper.prototype, "mappings", void 0);
222
- __decorate([
223
- state()
224
- ], OxDataMapper.prototype, "selected", void 0);
225
- __decorate([
226
- query('.tree-container.source > ox-tree')
227
- ], OxDataMapper.prototype, "sourceTree", void 0);
228
- __decorate([
229
- query('.tree-container.target > ox-tree')
230
- ], OxDataMapper.prototype, "targetTree", void 0);
231
- __decorate([
232
- query('ox-mapping-area')
233
- ], OxDataMapper.prototype, "mappingsArea", void 0);
234
- __decorate([
235
- provide({ context: dataMapperContext })
236
- ], OxDataMapper.prototype, "dataMapperContext", void 0);
237
- OxDataMapper = __decorate([
238
- customElement('ox-data-mapper')
239
- ], OxDataMapper);
240
- export { OxDataMapper };
241
- //# sourceMappingURL=ox-data-mapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ox-data-mapper.js","sourceRoot":"","sources":["../../src/ox-data-mapper.ts"],"names":[],"mappings":";AAAA,OAAO,+BAA+B,CAAA;AACtC,OAAO,sBAAsB,CAAA;AAE7B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAKtC,OAAO,EAAE,iBAAiB,EAAyB,MAAM,kCAAkC,CAAA;AAIpF,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAqDuB,iBAAY,GAAa,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;QAC1D,i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import { LitElement, html, css, PropertyValues } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { provide } from '@lit/context'\n\nimport { OxTree } from '@operato/data-tree/ox-tree.js'\n\nimport { TreeNode, Mapping } from './types.js'\nimport { dataMapperContext, DataMapperContextType } from './context/data-mapper-context.js'\nimport { OxMappingArea } from './ox-mapping-area.js'\n\n@customElement('ox-data-mapper')\nexport class OxDataMapper extends LitElement {\n static styles = css`\n .container {\n display: flex;\n width: 100%;\n min-height: 100%;\n position: relative;\n overflow-y: auto;\n align-items: stretch;\n }\n\n .tree-container {\n position: relative;\n flex: 1;\n display: flex;\n flex-direction: column;\n padding: 0;\n margin: 0;\n }\n\n .tree-container.source {\n order: 0;\n padding-right: 0px;\n }\n\n .tree-container.target {\n order: 2;\n padding-left: 0px;\n text-align: right;\n }\n\n ox-mapping-area {\n order: 1;\n position: relative;\n flex: 1;\n padding: 0;\n margin: 0;\n text-align: center;\n position: relative;\n }\n\n .tree-container.source::after,\n ox-mapping-area::after {\n content: '';\n position: absolute;\n right: 0;\n top: 0;\n width: 1px;\n height: 100%;\n background-color: black;\n }\n `\n\n @property({ type: Object }) sourceSchema: TreeNode = { id: 'source', label: 'source' }\n @property({ type: Object }) targetSchema: TreeNode = { id: 'target', label: 'target' }\n @property({ type: Array }) mappings: Mapping[] = []\n\n @state() private selected: any = null\n\n @query('.tree-container.source > ox-tree') private sourceTree!: OxTree\n @query('.tree-container.target > ox-tree') private targetTree!: OxTree\n @query('ox-mapping-area') private mappingsArea!: OxMappingArea\n\n @provide({ context: dataMapperContext })\n private dataMapperContext: DataMapperContextType = {\n getUniqueId: () => {\n return Math.random().toString(36).substring(2, 9)\n },\n updateMappings: (mappings: Mapping[]) => {\n this.mappings = mappings\n this.dispatchEvent(\n new CustomEvent('change', {\n detail: this.mappings\n })\n )\n },\n getNodePosition: this.getNodePosition.bind(this)\n }\n\n private dragStartElement: EventTarget | null = null\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"tree-container source\">\n <ox-tree\n .data=${this.sourceSchema}\n @collapsed=${() => this.mappingsArea.requestUpdate()}\n @expanded=${() => this.mappingsArea.requestUpdate()}\n @dragstart=${this.onDragStart}\n @dragover=${this.onDragOver}\n @drop=${this.onDrop}\n label-extends\n ></ox-tree>\n </div>\n\n <div class=\"tree-container target\">\n <ox-tree\n .data=${this.targetSchema}\n @collapsed=${() => this.mappingsArea.requestUpdate()}\n @expanded=${() => this.mappingsArea.requestUpdate()}\n @dragstart=${this.onDragStart}\n @dragover=${this.onDragOver}\n @drop=${this.onDrop}\n direction=\"rtl\"\n label-extends\n ></ox-tree>\n </div>\n\n <ox-mapping-area .mappings=${this.mappings}></ox-mapping-area>\n </div>\n `\n }\n\n getNodePosition(nodeId: string, source: boolean) {\n const tree = source ? this.sourceTree : this.targetTree\n if (!tree) {\n return\n }\n\n const nodeRect = tree.findNodeSelfBounds(nodeId)\n if (!nodeRect) {\n return\n }\n const mappingAreaRect = this.mappingsArea.getBoundingClientRect()\n\n return {\n x: source ? 0 : mappingAreaRect.width,\n y: nodeRect.top - mappingAreaRect.top + nodeRect!.height / 2\n }\n }\n\n onDragStart(e: DragEvent) {\n const path = e.composedPath()\n const target = path.find(el => (el as HTMLElement).dataset?.id) as HTMLElement | undefined\n const nodeId = target?.dataset?.id\n\n if (!nodeId) {\n return\n }\n\n const from = e.target === this.sourceTree ? 'source' : 'target'\n\n e.dataTransfer!.setData('application/node-id', nodeId)\n e.dataTransfer!.setData('application/from', from)\n e.dataTransfer!.effectAllowed = 'move'\n\n // ✅ 노드의 라벨을 찾아 미리보기로 사용\n const nodeLabel = target?.querySelector('span[label]')?.textContent || nodeId\n\n // ✅ 미리보기 요소 생성\n const dragPreview = document.createElement('div')\n dragPreview.textContent = nodeLabel\n dragPreview.style.fontSize = '14px'\n dragPreview.style.padding = '4px 8px'\n dragPreview.style.background = 'rgba(255, 255, 255, 0.3)'\n dragPreview.style.borderRadius = '4px'\n dragPreview.style.position = 'absolute'\n dragPreview.style.top = '-100px' // 화면 밖으로 배치 (임시)\n dragPreview.style.left = '-100px'\n dragPreview.style.pointerEvents = 'none'\n dragPreview.style.zIndex = '1000'\n\n document.body.appendChild(dragPreview)\n\n // ✅ 커스텀 드래깅 이미지 적용\n e.dataTransfer!.setDragImage(dragPreview, 0, 0)\n\n this.dragStartElement = e.target\n\n // ✅ 일정 시간 후 미리보기 요소 삭제\n setTimeout(() => document.body.removeChild(dragPreview), 0)\n }\n\n onDragOver(e: DragEvent) {\n e.preventDefault()\n\n const from = e.dataTransfer!.getData('application/from')\n\n if (this.dragStartElement === e.target) {\n return\n }\n\n const path = e.composedPath()\n const target = path.find(el => (el as HTMLElement).dataset?.id) as HTMLElement | undefined\n const nodeId = target?.dataset?.id\n\n if (!nodeId) return\n ;(e.target as OxTree).selected = (target as any).item\n }\n\n onDrop(e: DragEvent) {\n e.preventDefault()\n\n const nodeId = e.dataTransfer!.getData('application/node-id')\n const from = e.dataTransfer!.getData('application/from')\n\n if (\n !nodeId ||\n (from == 'source' && e.target !== this.targetTree) ||\n (from == 'target' && e.target !== this.sourceTree)\n ) {\n return\n }\n\n // 드롭된 타겟 노드 찾기\n const path = e.composedPath()\n const targetNode = path.find(el => (el as HTMLElement).dataset?.id) as HTMLElement | undefined\n const targetNodeId = targetNode?.dataset?.id\n\n if (!targetNodeId) {\n return\n }\n\n // 중복 매핑 확인\n const existingMapping = (this.mappings || []).find(\n m =>\n m.inputs.includes(from == 'source' ? nodeId : targetNodeId) &&\n m.outputs.includes(from == 'source' ? targetNodeId : nodeId)\n )\n\n if (!existingMapping) {\n const { width, height } = this.mappingsArea.getBoundingClientRect()\n const { y: sourceY = 0 } =\n this.dataMapperContext.getNodePosition(from == 'source' ? nodeId : targetNodeId, true) || {}\n const { y: targetY = height } =\n this.dataMapperContext.getNodePosition(from == 'target' ? nodeId : targetNodeId, false) || {}\n\n const newMapping: Mapping = {\n id: this.dataMapperContext.getUniqueId(),\n mappingFunction: 'passthrough',\n inputs: [from == 'source' ? nodeId : targetNodeId],\n outputs: [from == 'source' ? targetNodeId : nodeId],\n position: {\n x: width / 2 - 50,\n y: (sourceY + targetY) / 2\n }\n }\n\n this.dataMapperContext.updateMappings([...(this.mappings || []), newMapping])\n\n this.mappingsArea.selectMappingBox(newMapping)\n }\n }\n}\n"]}
@@ -1,36 +0,0 @@
1
- import { LitElement } from 'lit';
2
- import { Mapping } from './types.js';
3
- import './components/function-box-popup.js';
4
- export declare class OxMappingArea extends LitElement {
5
- static styles: import("lit").CSSResult;
6
- mappings: Mapping[];
7
- selectedMapping?: Mapping;
8
- selectedLine?: {
9
- mapping: Mapping;
10
- nodeId: string;
11
- isInput: boolean;
12
- };
13
- popupVisible: boolean;
14
- popupPosition: {
15
- x: number;
16
- y: number;
17
- };
18
- private dataMapperContext;
19
- connectedCallback(): void;
20
- disconnectedCallback(): void;
21
- render(): import("lit-html").TemplateResult<1>;
22
- renderMapping(mapping: Mapping): import("lit-html").TemplateResult<2>;
23
- startDragForMappingBox(e: PointerEvent, mapping: Mapping): void;
24
- handleDragOver(e: DragEvent): void;
25
- handleDrop(e: DragEvent): void;
26
- selectMappingBox(mapping: Mapping): void;
27
- selectMappingLine(mapping: Mapping, nodeId: string, isInput: boolean): void;
28
- isLineSelected(mapping: Mapping, nodeId: string, isInput: boolean): boolean;
29
- openPopup(e: PointerEvent, mapping: Mapping): void;
30
- getSelectedTransformLogic(): string;
31
- updateTransformLogic(e: Event): void;
32
- handleKeyDown: (e: KeyboardEvent) => void;
33
- deleteSelectedLine(): void;
34
- deleteSelectedMapping(): void;
35
- private handleResize;
36
- }
@@ -1,382 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { LitElement, html, svg, css, nothing } from 'lit';
3
- import { customElement, property, state } from 'lit/decorators.js';
4
- import { consume } from '@lit/context';
5
- import { OxPopup } from '@operato/popup';
6
- import { dataMapperContext } from './context/data-mapper-context.js';
7
- import './components/function-box-popup.js';
8
- let OxMappingArea = class OxMappingArea extends LitElement {
9
- constructor() {
10
- super(...arguments);
11
- this.mappings = [];
12
- this.popupVisible = false;
13
- this.popupPosition = { x: 0, y: 0 };
14
- this.handleKeyDown = (e) => {
15
- if (e.key === 'Delete' || e.key === 'Backspace') {
16
- if (this.selectedLine) {
17
- this.deleteSelectedLine();
18
- }
19
- else if (this.selectedMapping) {
20
- this.deleteSelectedMapping();
21
- }
22
- }
23
- };
24
- this.handleResize = () => {
25
- this.requestUpdate();
26
- };
27
- }
28
- connectedCallback() {
29
- super.connectedCallback();
30
- window.addEventListener('resize', this.handleResize);
31
- window.addEventListener('keydown', this.handleKeyDown);
32
- }
33
- disconnectedCallback() {
34
- super.disconnectedCallback();
35
- window.removeEventListener('resize', this.handleResize);
36
- window.removeEventListener('keydown', this.handleKeyDown);
37
- }
38
- render() {
39
- const mappings = this.mappings || [];
40
- return html `
41
- <div class="mapping-area" @dragover=${this.handleDragOver} @drop=${this.handleDrop}>
42
- <svg>${mappings.map(m => this.renderMapping(m))}</svg>
43
- </div>
44
- `;
45
- }
46
- renderMapping(mapping) {
47
- var _a;
48
- const mappingAreaWidth = this.clientWidth;
49
- const x = mappingAreaWidth / 2 - 50;
50
- let y = mapping.position.y;
51
- if (y === undefined) {
52
- const positions = [...mapping.inputs, ...mapping.outputs]
53
- .map(nodeId => this.dataMapperContext.getNodePosition(nodeId, mapping.inputs.includes(nodeId)))
54
- .filter(Boolean);
55
- y =
56
- positions.length > 0
57
- ? positions.reduce((sum, pos) => sum + pos.y, 0) / positions.length - 10
58
- : this.clientHeight / 2 - 10;
59
- }
60
- return svg `
61
- <defs>
62
- <!-- 기본 화살표 (검은색) -->
63
- <marker id="arrowhead" markerWidth="6" markerHeight="4" refX="5.4" refY="2" orient="auto" markerUnits="strokeWidth">
64
- <polygon points="0 0, 6 2, 0 4" />
65
- </marker>
66
-
67
- <!-- 선택된 화살표 (붉은색) -->
68
- <marker id="arrowhead-selected" markerWidth="6" markerHeight="4" refX="5.4" refY="2" orient="auto" markerUnits="strokeWidth">
69
- <polygon points="0 0, 6 2, 0 4" />
70
- </marker>
71
- </defs>
72
-
73
- <g>
74
- ${mapping.inputs.map(input => {
75
- const sourcePos = this.dataMapperContext.getNodePosition(input, true);
76
- const isSelected = this.isLineSelected(mapping, input, true);
77
- return sourcePos
78
- ? svg `
79
- <!-- 베지어 커브 경로 -->
80
- <path
81
- d="M ${sourcePos.x},${sourcePos.y}
82
- C ${sourcePos.x + 100},${sourcePos.y}
83
- ${x - 100},${y + 10}
84
- ${x},${y + 10}"
85
- class="mapping-line"
86
- marker-end="url(#${isSelected ? 'arrowhead-selected' : 'arrowhead'})"
87
- ?selected=${isSelected}>
88
- </path>
89
-
90
- <!-- 클릭 이벤트를 위한 히트박스 -->
91
- <path d="M ${sourcePos.x},${sourcePos.y}
92
- C ${sourcePos.x + 100},${sourcePos.y}
93
- ${x - 100},${y + 10}
94
- ${x},${y + 10}"
95
- class="mapping-line-for-select"
96
- @click=${() => this.selectMappingLine(mapping, input, true)}>
97
- </path>
98
- `
99
- : nothing;
100
- })}
101
-
102
- <rect class="mapping-box"
103
- width="100" height="20"
104
- x=${x} y=${y}
105
- ?selected=${((_a = this.selectedMapping) === null || _a === void 0 ? void 0 : _a.id) === mapping.id}
106
- @pointerdown=${(e) => this.startDragForMappingBox(e, mapping)}
107
- @click=${() => this.selectMappingBox(mapping)}
108
- @dblclick=${(e) => this.openPopup(e, mapping)}>
109
- </rect>
110
-
111
- <text x=${x + 50} y=${y + 15} fill="black" font-size="12" text-anchor="middle" pointer-events="none">
112
- ${mapping.mappingFunction || 'passthrough'}
113
- </text>
114
-
115
- ${mapping.outputs.map(output => {
116
- const targetPos = this.dataMapperContext.getNodePosition(output, false);
117
- const isSelected = this.isLineSelected(mapping, output, false);
118
- return targetPos
119
- ? svg `
120
- <!-- 베지어 커브 경로 -->
121
- <path
122
- d="M ${x + 100},${y + 10}
123
- C ${x + 200},${y + 10}
124
- ${targetPos.x - 100},${targetPos.y}
125
- ${targetPos.x},${targetPos.y}"
126
- class="mapping-line"
127
- marker-end="url(#${isSelected ? 'arrowhead-selected' : 'arrowhead'})"
128
- ?selected=${isSelected}>
129
- </path>
130
-
131
- <!-- 클릭 이벤트를 위한 히트박스 -->
132
- <path d="M ${x + 100},${y + 10}
133
- C ${x + 200},${y + 10}
134
- ${targetPos.x - 100},${targetPos.y}
135
- ${targetPos.x},${targetPos.y}"
136
- class="mapping-line-for-select"
137
- @click=${() => this.selectMappingLine(mapping, output, false)}>
138
- </path>
139
- `
140
- : nothing;
141
- })}
142
- </g>
143
- `;
144
- }
145
- startDragForMappingBox(e, mapping) {
146
- e.stopPropagation();
147
- let dragStartY = mapping.position.y;
148
- let dragOffsetY = e.clientY;
149
- let draggingBox = mapping;
150
- const onDrag = (e) => {
151
- e.preventDefault();
152
- if (!draggingBox)
153
- return;
154
- const newY = dragStartY + e.clientY - dragOffsetY;
155
- const minY = 0;
156
- const maxY = this.clientHeight - 20;
157
- draggingBox.position = {
158
- x: this.clientWidth / 2 - 50,
159
- y: Math.max(minY, Math.min(maxY, newY))
160
- };
161
- this.requestUpdate();
162
- };
163
- const stopDrag = (e) => {
164
- e.stopPropagation();
165
- window.removeEventListener('pointermove', onDrag);
166
- window.removeEventListener('pointerup', stopDrag);
167
- this.dataMapperContext.updateMappings([...this.mappings]);
168
- };
169
- window.addEventListener('pointermove', onDrag);
170
- window.addEventListener('pointerup', stopDrag);
171
- }
172
- handleDragOver(e) {
173
- e.preventDefault();
174
- }
175
- handleDrop(e) {
176
- e.preventDefault();
177
- const nodeId = e.dataTransfer.getData('application/node-id');
178
- if (!nodeId) {
179
- return;
180
- }
181
- const from = e.dataTransfer.getData('application/from');
182
- const { top, left } = this.getBoundingClientRect();
183
- const dropX = e.clientX - left;
184
- const dropY = e.clientY - top;
185
- let droppedOnExistingBox = false;
186
- let selectedMapping = null;
187
- const mappings = this.mappings.map(mapping => {
188
- const boxY = mapping.position.y;
189
- const boxX = this.clientWidth / 2 - 50;
190
- if (dropY >= boxY && dropY <= boxY + 20 && dropX >= boxX && dropX < boxX + 100) {
191
- droppedOnExistingBox = true;
192
- const updatedMapping = {
193
- ...mapping,
194
- inputs: from === 'source' ? [...new Set([...mapping.inputs, nodeId])] : mapping.inputs,
195
- outputs: from === 'source' ? mapping.outputs : [...new Set([...mapping.outputs, nodeId])]
196
- };
197
- selectedMapping = updatedMapping;
198
- return updatedMapping;
199
- }
200
- return mapping;
201
- });
202
- if (!droppedOnExistingBox) {
203
- const createdMapping = {
204
- id: this.dataMapperContext.getUniqueId(),
205
- function: 'Transform',
206
- inputs: from == 'source' ? [nodeId] : [],
207
- outputs: from == 'source' ? [] : [nodeId],
208
- position: { x: this.clientWidth / 2 - 50, y: dropY - 10 }
209
- };
210
- mappings.push(createdMapping);
211
- selectedMapping = createdMapping;
212
- }
213
- this.dataMapperContext.updateMappings(mappings);
214
- selectedMapping && this.selectMappingBox(selectedMapping);
215
- }
216
- selectMappingBox(mapping) {
217
- this.selectedMapping = mapping;
218
- this.selectedLine = undefined;
219
- this.requestUpdate();
220
- }
221
- selectMappingLine(mapping, nodeId, isInput) {
222
- this.selectedMapping = undefined;
223
- this.selectedLine = { mapping, nodeId, isInput };
224
- this.requestUpdate();
225
- }
226
- isLineSelected(mapping, nodeId, isInput) {
227
- var _a;
228
- return (((_a = this.selectedLine) === null || _a === void 0 ? void 0 : _a.mapping) === mapping &&
229
- this.selectedLine.nodeId === nodeId &&
230
- this.selectedLine.isInput === isInput);
231
- }
232
- openPopup(e, mapping) {
233
- const popup = OxPopup.open({
234
- template: html `
235
- <function-box-popup
236
- .mapping=${mapping}
237
- @change=${(e) => {
238
- const changed = e.detail;
239
- this.dataMapperContext.updateMappings(this.mappings.map(mapping => {
240
- if (mapping.id !== changed.id) {
241
- return mapping;
242
- }
243
- return changed;
244
- }));
245
- popup.close();
246
- }}
247
- ></function-box-popup>
248
- `,
249
- style: 'width: 80vw; height: 80vh;',
250
- preventCloseOnBlur: true,
251
- backdrop: true
252
- });
253
- }
254
- getSelectedTransformLogic() {
255
- const mapping = this.mappings.find(m => m === this.selectedMapping);
256
- return (mapping === null || mapping === void 0 ? void 0 : mapping.mappingFunction) || 'passthrough';
257
- }
258
- updateTransformLogic(e) {
259
- const input = e.target;
260
- const mappings = this.mappings.map(m => m.mappingFunction === this.selectedMapping ? { ...m, mappingFunction: input.value } : m);
261
- this.dataMapperContext.updateMappings(mappings);
262
- }
263
- deleteSelectedLine() {
264
- if (!this.selectedLine)
265
- return;
266
- const { mapping, nodeId, isInput } = this.selectedLine;
267
- const updatedMappings = this.mappings
268
- .map(m => m === mapping
269
- ? {
270
- ...m,
271
- inputs: isInput ? m.inputs.filter(id => id !== nodeId) : m.inputs,
272
- outputs: !isInput ? m.outputs.filter(id => id !== nodeId) : m.outputs
273
- }
274
- : m)
275
- .filter(m => m.inputs.length > 0 || m.outputs.length > 0); // 입력/출력이 모두 삭제되면 제거
276
- this.dataMapperContext.updateMappings(updatedMappings);
277
- this.selectedLine = undefined;
278
- this.requestUpdate();
279
- }
280
- deleteSelectedMapping() {
281
- this.dataMapperContext.updateMappings(this.mappings.filter(m => m !== this.selectedMapping));
282
- this.selectedMapping = undefined;
283
- this.requestUpdate();
284
- }
285
- };
286
- OxMappingArea.styles = css `
287
- :host {
288
- display: flex;
289
-
290
- --line-color: #5b5858;
291
- --selected-line-color: red;
292
- }
293
-
294
- .mapping-area {
295
- flex: 1;
296
- padding: 0;
297
- margin: 0;
298
- text-align: center;
299
- position: relative;
300
- }
301
-
302
- svg {
303
- position: absolute;
304
- top: 0;
305
- left: 0;
306
- width: 100%;
307
- height: 100%;
308
- pointer-events: none;
309
- }
310
-
311
- .mapping-box {
312
- fill: rgba(0, 255, 0, 0.3);
313
- stroke: green;
314
- stroke-width: 1;
315
- cursor: grab;
316
- pointer-events: all;
317
- user-select: none;
318
- }
319
-
320
- .mapping-box:hover {
321
- fill: rgba(0, 255, 0, 0.5);
322
- }
323
-
324
- .mapping-box[selected] {
325
- stroke: var(--selected-line-color);
326
- stroke-width: 2;
327
- }
328
-
329
- .mapping-line {
330
- stroke: var(--line-color);
331
- stroke-width: 1;
332
- fill: none;
333
- cursor: pointer;
334
- pointer-events: all;
335
- }
336
-
337
- .mapping-line[selected] {
338
- stroke: var(--selected-line-color);
339
- stroke-width: 1.5;
340
- }
341
-
342
- .mapping-line-for-select {
343
- stroke: transparent;
344
- stroke-width: 10;
345
- fill: none;
346
- cursor: pointer;
347
- pointer-events: all;
348
- }
349
-
350
- marker * {
351
- stroke: var(--line-color);
352
- fill: var(--line-color);
353
- }
354
-
355
- marker#arrowhead-selected * {
356
- stroke: var(--selected-line-color);
357
- fill: var(--selected-line-color);
358
- }
359
- `;
360
- __decorate([
361
- property({ type: Array })
362
- ], OxMappingArea.prototype, "mappings", void 0);
363
- __decorate([
364
- state()
365
- ], OxMappingArea.prototype, "selectedMapping", void 0);
366
- __decorate([
367
- state()
368
- ], OxMappingArea.prototype, "selectedLine", void 0);
369
- __decorate([
370
- state()
371
- ], OxMappingArea.prototype, "popupVisible", void 0);
372
- __decorate([
373
- state()
374
- ], OxMappingArea.prototype, "popupPosition", void 0);
375
- __decorate([
376
- consume({ context: dataMapperContext, subscribe: true })
377
- ], OxMappingArea.prototype, "dataMapperContext", void 0);
378
- OxMappingArea = __decorate([
379
- customElement('ox-mapping-area')
380
- ], OxMappingArea);
381
- export { OxMappingArea };
382
- //# sourceMappingURL=ox-mapping-area.js.map