@things-factory/integration-ui 9.0.27 → 9.0.32

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.
@@ -15,8 +15,8 @@ export interface Node {
15
15
  id: string
16
16
  labels: string[]
17
17
  properties: { [key: string]: any }
18
- x?: number
19
- y?: number
18
+ x: number
19
+ y: number
20
20
  fx?: number | null
21
21
  fy?: number | null
22
22
  icon?: string
@@ -11,6 +11,8 @@ export class GraphViewer {
11
11
  private options: any
12
12
  private svgScale
13
13
  private svgTranslate
14
+ private svgContainer: any
15
+ private zoom: any
14
16
 
15
17
  public simulation: any
16
18
 
@@ -35,33 +37,41 @@ export class GraphViewer {
35
37
  }
36
38
 
37
39
  private init(selector: any) {
38
- this.svg = d3
40
+ // SVG 컨테이너 생성
41
+ const svgContainer = d3
39
42
  .select(selector)
40
43
  .append('svg')
41
44
  .attr('width', '100%')
42
45
  .attr('height', '100%')
43
46
  .attr('class', 'graph-viewer')
44
- .call(
45
- d3.zoom().on('zoom', (event, d) => {
46
- var scale = event.transform.k,
47
- translate = [event.transform.x, event.transform.y]
48
47
 
49
- if (this.svgTranslate) {
50
- translate[0] += this.svgTranslate[0]
51
- translate[1] += this.svgTranslate[1]
52
- }
48
+ // 줌 동작 정의 (마우스 중심 줌 자동 지원)
49
+ const zoom = d3
50
+ .zoom()
51
+ .scaleExtent([0.1, 10])
52
+ .on('zoom', event => {
53
+ // D3가 자동으로 계산한 transform을 그대로 사용 (마우스 중심 줌)
54
+ this.svg.attr('transform', event.transform)
55
+ })
53
56
 
54
- if (this.svgScale) {
55
- scale *= this.svgScale
56
- }
57
+ // SVG 컨테이너에 줌 적용
58
+ svgContainer.call(zoom)
57
59
 
58
- this.svg.attr('transform', 'translate(' + translate[0] + ', ' + translate[1] + ') scale(' + scale + ')')
59
- })
60
- )
61
- .on('dblclick.zoom', null)
62
- .append('g') // 그룹 요소 추가
63
- .attr('width', '100%')
64
- .attr('height', '100%')
60
+ // 기본 더블클릭 비활성화
61
+ svgContainer.on('dblclick.zoom', null)
62
+
63
+ // 배경 더블클릭 시 zoomFit 실행
64
+ svgContainer.on('dblclick', event => {
65
+ event.preventDefault()
66
+ this.zoomFit()
67
+ })
68
+
69
+ // 실제 그래프 내용을 담을 그룹 생성
70
+ this.svg = svgContainer.append('g').attr('class', 'graph-container').attr('width', '100%').attr('height', '100%')
71
+
72
+ // SVG 컨테이너 참조 저장 (zoomFit에서 사용)
73
+ this.svgContainer = svgContainer
74
+ this.zoom = zoom
65
75
 
66
76
  // Define arrow markers for graph links
67
77
  this.svg
@@ -114,10 +124,7 @@ export class GraphViewer {
114
124
  this.tick()
115
125
  })
116
126
  .on('end', () => {
117
- if (this.options.zoomFit && this.needZoomFit) {
118
- this.needZoomFit = false
119
- this.zoomFit()
120
- }
127
+ // 자동 zoomFit 제거 - 더블클릭으로만 실행
121
128
  })
122
129
 
123
130
  return simulation
@@ -251,7 +258,8 @@ export class GraphViewer {
251
258
  this.options.onNodeDoubleClick(d)
252
259
  }
253
260
  })
254
- .on('mouseenter', (event, d) => {
261
+ .on('mouseenter', function (this: any, event: any, d: any) {
262
+ d3.select(this).style('background', '#f0f0f0')
255
263
  event.target.dispatchEvent(
256
264
  new CustomEvent('node-mouseenter', {
257
265
  detail: d,
@@ -259,7 +267,8 @@ export class GraphViewer {
259
267
  })
260
268
  )
261
269
  })
262
- .on('mouseleave', (event, d) => {
270
+ .on('mouseleave', function (this: any, event: any, d: any) {
271
+ d3.select(this).style('background', 'white')
263
272
  event.target.dispatchEvent(
264
273
  new CustomEvent('node-mouseleave', {
265
274
  detail: d,
@@ -369,26 +378,32 @@ export class GraphViewer {
369
378
  }
370
379
 
371
380
  zoomFit() {
372
- var bounds = this.svg.node().getBBox(),
373
- parent = this.svg.node().parentElement.parentElement,
374
- fullWidth = parent.clientWidth,
375
- fullHeight = parent.clientHeight,
376
- width = bounds.width,
377
- height = bounds.height,
378
- midX = bounds.x + width / 2,
379
- midY = bounds.y + height / 2
380
-
381
- if (width === 0 || height === 0) {
382
- return // nothing to fit
383
- }
381
+ if (!this.svg || !this.svgContainer) return
382
+
383
+ const bounds = this.svg.node()?.getBBox()
384
+ const svgNode = this.svgContainer.node()
385
+
386
+ if (!bounds || !svgNode) return
387
+
388
+ const rect = svgNode.getBoundingClientRect()
389
+ const fullWidth = rect.width
390
+ const fullHeight = rect.height
391
+
392
+ if (bounds.width === 0 || bounds.height === 0) return
393
+
394
+ const padding = 50
395
+ const scale = Math.min((fullWidth - padding) / bounds.width, (fullHeight - padding) / bounds.height) * 0.85
396
+
397
+ const centerX = bounds.x + bounds.width / 2
398
+ const centerY = bounds.y + bounds.height / 2
384
399
 
385
- this.svgScale = 0.85 / Math.max(width / fullWidth, height / fullHeight)
386
- this.svgTranslate = [fullWidth / 2 - this.svgScale * midX, fullHeight / 2 - this.svgScale * midY]
400
+ const transform = d3.zoomIdentity
401
+ .translate(fullWidth / 2, fullHeight / 2)
402
+ .scale(scale)
403
+ .translate(-centerX, -centerY)
387
404
 
388
- this.svg.attr(
389
- 'transform',
390
- 'translate(' + this.svgTranslate[0] + ', ' + this.svgTranslate[1] + ') scale(' + this.svgScale + ')'
391
- )
405
+ // D3의 줌 상태를 직접 업데이트하여 이후 휠스크롤이 올바르게 작동하도록 함
406
+ this.svgContainer.transition().duration(750).call(this.zoom.transform, transform)
392
407
  }
393
408
 
394
409
  size() {
@@ -1,3 +1,4 @@
1
+ import '@operato/property-editor/ox-property-editor-secret.js'
1
2
  import './editors/entity-editor.js'
2
3
  import './editors/property-editor.js'
3
4
 
@@ -31,6 +32,7 @@ export default function bootstrap() {
31
32
  registerGristRenderer('data', OxGristRendererJson5)
32
33
 
33
34
  OxPropertyEditor.register({
35
+ secret: 'ox-property-editor-secret',
34
36
  'http-headers': 'property-editor-http-headers',
35
37
  'http-parameters': 'property-editor-http-parameters',
36
38
  'http-body': 'property-editor-http-body',
@@ -16,8 +16,8 @@ export interface Node {
16
16
  properties: {
17
17
  [key: string]: any;
18
18
  };
19
- x?: number;
20
- y?: number;
19
+ x: number;
20
+ y: number;
21
21
  fx?: number | null;
22
22
  fy?: number | null;
23
23
  icon?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"graph-data.js","sourceRoot":"","sources":["../../client/analysis/graph-data.ts"],"names":[],"mappings":"","sourcesContent":["export interface GraphData {\n results: Array<{\n columns: string[]\n data: Array<{\n graph: {\n nodes: Node[]\n relationships: Relationship[]\n }\n }>\n }>\n errors: any[]\n}\n\nexport interface Node {\n id: string\n labels: string[]\n properties: { [key: string]: any }\n x?: number\n y?: number\n fx?: number | null\n fy?: number | null\n icon?: string\n}\n\nexport interface Relationship {\n id: string\n type: string\n startNode: string\n endNode: string\n source?: Node\n target?: Node\n properties: { [key: string]: any }\n linknum?: number\n}\n"]}
1
+ {"version":3,"file":"graph-data.js","sourceRoot":"","sources":["../../client/analysis/graph-data.ts"],"names":[],"mappings":"","sourcesContent":["export interface GraphData {\n results: Array<{\n columns: string[]\n data: Array<{\n graph: {\n nodes: Node[]\n relationships: Relationship[]\n }\n }>\n }>\n errors: any[]\n}\n\nexport interface Node {\n id: string\n labels: string[]\n properties: { [key: string]: any }\n x: number\n y: number\n fx?: number | null\n fy?: number | null\n icon?: string\n}\n\nexport interface Relationship {\n id: string\n type: string\n startNode: string\n endNode: string\n source?: Node\n target?: Node\n properties: { [key: string]: any }\n linknum?: number\n}\n"]}
@@ -10,6 +10,8 @@ export declare class GraphViewer {
10
10
  private options;
11
11
  private svgScale;
12
12
  private svgTranslate;
13
+ private svgContainer;
14
+ private zoom;
13
15
  simulation: any;
14
16
  constructor(_selector: any, _options: any);
15
17
  private init;
@@ -23,27 +23,35 @@ export class GraphViewer {
23
23
  this.init(_selector);
24
24
  }
25
25
  init(selector) {
26
- this.svg = d3
26
+ // SVG 컨테이너 생성
27
+ const svgContainer = d3
27
28
  .select(selector)
28
29
  .append('svg')
29
30
  .attr('width', '100%')
30
31
  .attr('height', '100%')
31
- .attr('class', 'graph-viewer')
32
- .call(d3.zoom().on('zoom', (event, d) => {
33
- var scale = event.transform.k, translate = [event.transform.x, event.transform.y];
34
- if (this.svgTranslate) {
35
- translate[0] += this.svgTranslate[0];
36
- translate[1] += this.svgTranslate[1];
37
- }
38
- if (this.svgScale) {
39
- scale *= this.svgScale;
40
- }
41
- this.svg.attr('transform', 'translate(' + translate[0] + ', ' + translate[1] + ') scale(' + scale + ')');
42
- }))
43
- .on('dblclick.zoom', null)
44
- .append('g') // 그룹 요소 추가
45
- .attr('width', '100%')
46
- .attr('height', '100%');
32
+ .attr('class', 'graph-viewer');
33
+ // 줌 동작 정의 (마우스 중심 자동 지원)
34
+ const zoom = d3
35
+ .zoom()
36
+ .scaleExtent([0.1, 10])
37
+ .on('zoom', event => {
38
+ // D3가 자동으로 계산한 transform을 그대로 사용 (마우스 중심 줌)
39
+ this.svg.attr('transform', event.transform);
40
+ });
41
+ // SVG 컨테이너에 줌 적용
42
+ svgContainer.call(zoom);
43
+ // 기본 더블클릭 줌 비활성화
44
+ svgContainer.on('dblclick.zoom', null);
45
+ // 배경 더블클릭 시 zoomFit 실행
46
+ svgContainer.on('dblclick', event => {
47
+ event.preventDefault();
48
+ this.zoomFit();
49
+ });
50
+ // 실제 그래프 내용을 담을 그룹 생성
51
+ this.svg = svgContainer.append('g').attr('class', 'graph-container').attr('width', '100%').attr('height', '100%');
52
+ // SVG 컨테이너 참조 저장 (zoomFit에서 사용)
53
+ this.svgContainer = svgContainer;
54
+ this.zoom = zoom;
47
55
  // Define arrow markers for graph links
48
56
  this.svg
49
57
  .append('defs')
@@ -85,10 +93,7 @@ export class GraphViewer {
85
93
  this.tick();
86
94
  })
87
95
  .on('end', () => {
88
- if (this.options.zoomFit && this.needZoomFit) {
89
- this.needZoomFit = false;
90
- this.zoomFit();
91
- }
96
+ // 자동 zoomFit 제거 - 더블클릭으로만 실행
92
97
  });
93
98
  return simulation;
94
99
  }
@@ -194,13 +199,15 @@ export class GraphViewer {
194
199
  this.options.onNodeDoubleClick(d);
195
200
  }
196
201
  })
197
- .on('mouseenter', (event, d) => {
202
+ .on('mouseenter', function (event, d) {
203
+ d3.select(this).style('background', '#f0f0f0');
198
204
  event.target.dispatchEvent(new CustomEvent('node-mouseenter', {
199
205
  detail: d,
200
206
  bubbles: true
201
207
  }));
202
208
  })
203
- .on('mouseleave', (event, d) => {
209
+ .on('mouseleave', function (event, d) {
210
+ d3.select(this).style('background', 'white');
204
211
  event.target.dispatchEvent(new CustomEvent('node-mouseleave', {
205
212
  detail: d,
206
213
  bubbles: true
@@ -291,13 +298,27 @@ export class GraphViewer {
291
298
  d.fy = null;
292
299
  }
293
300
  zoomFit() {
294
- var bounds = this.svg.node().getBBox(), parent = this.svg.node().parentElement.parentElement, fullWidth = parent.clientWidth, fullHeight = parent.clientHeight, width = bounds.width, height = bounds.height, midX = bounds.x + width / 2, midY = bounds.y + height / 2;
295
- if (width === 0 || height === 0) {
296
- return; // nothing to fit
297
- }
298
- this.svgScale = 0.85 / Math.max(width / fullWidth, height / fullHeight);
299
- this.svgTranslate = [fullWidth / 2 - this.svgScale * midX, fullHeight / 2 - this.svgScale * midY];
300
- this.svg.attr('transform', 'translate(' + this.svgTranslate[0] + ', ' + this.svgTranslate[1] + ') scale(' + this.svgScale + ')');
301
+ if (!this.svg || !this.svgContainer)
302
+ return;
303
+ const bounds = this.svg.node()?.getBBox();
304
+ const svgNode = this.svgContainer.node();
305
+ if (!bounds || !svgNode)
306
+ return;
307
+ const rect = svgNode.getBoundingClientRect();
308
+ const fullWidth = rect.width;
309
+ const fullHeight = rect.height;
310
+ if (bounds.width === 0 || bounds.height === 0)
311
+ return;
312
+ const padding = 50;
313
+ const scale = Math.min((fullWidth - padding) / bounds.width, (fullHeight - padding) / bounds.height) * 0.85;
314
+ const centerX = bounds.x + bounds.width / 2;
315
+ const centerY = bounds.y + bounds.height / 2;
316
+ const transform = d3.zoomIdentity
317
+ .translate(fullWidth / 2, fullHeight / 2)
318
+ .scale(scale)
319
+ .translate(-centerX, -centerY);
320
+ // D3의 줌 상태를 직접 업데이트하여 이후 휠스크롤이 올바르게 작동하도록 함
321
+ this.svgContainer.transition().duration(750).call(this.zoom.transform, transform);
301
322
  }
302
323
  size() {
303
324
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"graph-viewer.js","sourceRoot":"","sources":["../../client/analysis/graph-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGxB,MAAM,OAAO,WAAW;IAatB,YAAY,SAAc,EAAE,QAAa;QATjC,UAAK,GAAW,EAAE,CAAA;QAClB,kBAAa,GAAmB,EAAE,CAAA;QAClC,gBAAW,GAAG,IAAI,CAAA;QAQxB,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,SAAS;YACvB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;YAClB,oBAAoB,EAAE,SAAS;YAC/B,UAAU,EAAE,EAAE;YACd,iBAAiB,EAAE,SAAS;YAC5B,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,EAAE;YAClB,UAAU,EAAE,CAAC;YACb,GAAG,QAAQ;SACZ,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACtB,CAAC;IAEO,IAAI,CAAC,QAAa;QACxB,IAAI,CAAC,GAAG,GAAG,EAAE;aACV,MAAM,CAAC,QAAQ,CAAC;aAChB,MAAM,CAAC,KAAK,CAAC;aACb,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;aACrB,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC;aACtB,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC;aAC7B,IAAI,CACH,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;YAChC,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,CAAA;QAE9B,IAAI,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAM,CAAC,iBAAiB;QAC1B,CAAC;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,CAAA;QACvE,IAAI,CAAC,YAAY,GAAG,CAAC,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,EAAE,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;QAEjG,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,WAAW,EACX,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,IAAI,CAAC,QAAQ,GAAG,GAAG,CACrG,CAAA;IACH,CAAC;IAED,IAAI;QACF,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACxB,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM;SACzC,CAAA;IACH,CAAC;CACF","sourcesContent":["import * as d3 from 'd3'\nimport { Node, Relationship, GraphData } from './graph-data.js'\n\nexport class GraphViewer {\n private svg: any\n private svgNodes: any\n private svgRelationships: any\n private nodes: Node[] = []\n private relationships: Relationship[] = []\n private needZoomFit = true\n private options: any\n private svgScale\n private svgTranslate\n\n public simulation: any\n\n constructor(_selector: any, _options: any) {\n this.options = {\n arrowSize: 4,\n colors: this.colors(),\n highlight: undefined,\n infoPanel: true,\n minCollision: undefined,\n graphData: undefined,\n dataUrl: undefined,\n nodeOutlineFillColor: undefined,\n nodeRadius: 25,\n relationshipColor: '#a5abb6',\n zoomFit: false,\n classes2colors: {},\n numClasses: 0,\n ..._options\n }\n this.init(_selector)\n }\n\n private init(selector: any) {\n this.svg = d3\n .select(selector)\n .append('svg')\n .attr('width', '100%')\n .attr('height', '100%')\n .attr('class', 'graph-viewer')\n .call(\n d3.zoom().on('zoom', (event, d) => {\n var scale = event.transform.k,\n translate = [event.transform.x, event.transform.y]\n\n if (this.svgTranslate) {\n translate[0] += this.svgTranslate[0]\n translate[1] += this.svgTranslate[1]\n }\n\n if (this.svgScale) {\n scale *= this.svgScale\n }\n\n this.svg.attr('transform', 'translate(' + translate[0] + ', ' + translate[1] + ') scale(' + scale + ')')\n })\n )\n .on('dblclick.zoom', null)\n .append('g') // 그룹 요소 추가\n .attr('width', '100%')\n .attr('height', '100%')\n\n // Define arrow markers for graph links\n this.svg\n .append('defs')\n .append('marker')\n .attr('id', 'arrow')\n .attr('viewBox', '0 -5 10 10')\n .attr('refX', 10)\n .attr('refY', 0)\n .attr('markerWidth', 6)\n .attr('markerHeight', 6)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M0,-5L10,0L0,5')\n .attr('fill', this.options.relationshipColor)\n\n this.svgNodes = this.svg.append('g').attr('class', 'nodes')\n this.svgRelationships = this.svg.append('g').attr('class', 'relationships')\n this.simulation = this.initSimulation()\n\n if (this.options.graphData) {\n this.updateWithGraphData(this.options.graphData)\n }\n }\n\n initSimulation() {\n const x = this.svg.node().parentElement.parentElement.clientWidth / 2\n const y = this.svg.node().parentElement.parentElement.clientHeight / 2\n\n var simulation = d3\n .forceSimulation()\n .force(\n 'collide',\n d3\n .forceCollide()\n .radius(d => {\n return this.options.minCollision\n })\n .iterations(2)\n )\n .force('charge', d3.forceManyBody())\n .force(\n 'link',\n d3.forceLink().id(d => {\n return d.id\n })\n )\n .force('center', d3.forceCenter(x, y))\n .on('tick', () => {\n this.tick()\n })\n .on('end', () => {\n if (this.options.zoomFit && this.needZoomFit) {\n this.needZoomFit = false\n this.zoomFit()\n }\n })\n\n return simulation\n }\n\n private tick() {\n this.svgNodes.selectAll('.node').attr('transform', (d: any) => `translate(${d.x}, ${d.y})`)\n\n this.svgRelationships\n .selectAll('.relationship')\n .attr('x1', (d: any) => this.calculateIntersection(d.source, d.target).x1)\n .attr('y1', (d: any) => this.calculateIntersection(d.source, d.target).y1)\n .attr('x2', (d: any) => this.calculateIntersection(d.source, d.target).x2)\n .attr('y2', (d: any) => this.calculateIntersection(d.source, d.target).y2)\n\n this.svgRelationships.selectAll('.relationship-text').attr('transform', (d: any) => {\n const midX =\n (this.calculateIntersection(d.source, d.target).x1 + this.calculateIntersection(d.source, d.target).x2) / 2\n const midY =\n (this.calculateIntersection(d.source, d.target).y1 + this.calculateIntersection(d.source, d.target).y2) / 2\n return `translate(${midX}, ${midY})`\n })\n }\n\n private calculateIntersection(source, target) {\n const dx = target.x - source.x\n const dy = target.y - source.y\n const distance = Math.sqrt(dx * dx + dy * dy)\n const ratio = (distance - this.options.nodeRadius) / distance\n\n const x1 = source.x + dx * (this.options.nodeRadius / distance)\n const y1 = source.y + dy * (this.options.nodeRadius / distance)\n const x2 = target.x - dx * (this.options.nodeRadius / distance)\n const y2 = target.y - dy * (this.options.nodeRadius / distance)\n\n return { x1, y1, x2, y2 }\n }\n\n private colors() {\n return [\n '#68bdf6', // light blue\n '#6dce9e', // green #1\n '#faafc2', // light pink\n '#f2baf6', // purple\n '#ff928c', // light red\n '#fcea7e', // light yellow\n '#ffc766', // light orange\n '#405f9e', // navy blue\n '#a5abb6', // dark gray\n '#78cecb', // green #2,\n '#b88cbb', // dark purple\n '#ced2d9', // light gray\n '#e84646', // dark red\n '#fa5f86', // dark pink\n '#ffab1a', // dark orange\n '#fcda19', // dark yellow\n '#797b80', // black\n '#c9d96f', // pistachio\n '#47991f', // green #3\n '#70edee', // turquoise\n '#ff75ea' // pink\n ]\n }\n\n updateWithGraphData(graphData: GraphData) {\n this.nodes = graphData.results[0].data[0].graph.nodes\n this.relationships = graphData.results[0].data[0].graph.relationships\n\n this.relationships.forEach(rel => {\n const sourceNode = this.nodes.find(node => node.id === rel.startNode)\n const targetNode = this.nodes.find(node => node.id === rel.endNode)\n\n if (!sourceNode || !targetNode) {\n console.warn(`Node not found for relationship: ${rel.id}`)\n return\n }\n\n rel.source = sourceNode\n rel.target = targetNode\n })\n\n this.updateNodesAndRelationships()\n }\n\n private updateNodesAndRelationships() {\n this.needZoomFit = true\n\n this.svgNodes.selectAll('.node').remove()\n this.svgRelationships.selectAll('.relationship').remove()\n this.svgRelationships.selectAll('.relationship-text').remove()\n\n this.appendNodesToGraph()\n this.appendRelationshipsToGraph()\n\n this.simulation.nodes(this.nodes)\n ;(this.simulation.force('link') as d3.ForceLink<Node, Relationship>).links(this.relationships)\n\n // 시뮬레이션을 강제로 재시작하여 레이아웃이 적절히 재정렬되도록 함\n this.simulation.alpha(1).restart()\n }\n\n private appendNodesToGraph() {\n const nodeEnter = this.svgNodes\n .selectAll('.node')\n .data(this.nodes, (d: any) => d.id)\n .enter()\n .append('g')\n .attr('class', d => {\n var highlight,\n i,\n classes = 'node',\n label = d.labels[0]\n\n if (d.icon) {\n classes += ' node-icon'\n }\n\n return classes\n })\n .on('click', (event, d) => {\n d.fx = d.fy = null\n\n if (typeof this.options.onNodeClick === 'function') {\n this.options.onNodeClick(d)\n }\n })\n .on('dblclick', (event, d) => {\n this.stickNode(event, d)\n\n if (typeof this.options.onNodeDoubleClick === 'function') {\n this.options.onNodeDoubleClick(d)\n }\n })\n .on('mouseenter', (event, d) => {\n event.target.dispatchEvent(\n new CustomEvent('node-mouseenter', {\n detail: d,\n bubbles: true\n })\n )\n })\n .on('mouseleave', (event, d) => {\n event.target.dispatchEvent(\n new CustomEvent('node-mouseleave', {\n detail: d,\n bubbles: true\n })\n )\n })\n .call(\n d3\n .drag()\n .on('start', this.dragStarted.bind(this))\n .on('drag', this.dragged.bind(this))\n .on('end', this.dragEnded.bind(this))\n )\n\n nodeEnter\n .append('circle')\n .attr('class', 'outline')\n .attr('r', this.options.nodeRadius)\n .style('fill', d => this.class2color(d.labels[0]))\n .style('stroke', d => this.class2darkenColor(d.labels[0]))\n .style('stroke-width', 2)\n\n nodeEnter\n .append('text')\n .attr('class', 'text icon')\n .attr('x', 0)\n .attr('y', 0)\n .attr('text-anchor', 'middle')\n .attr('dominant-baseline', 'central')\n .attr('font-family', 'Material Symbols Outlined')\n .attr('font-size', '24px')\n .attr('fill', '#000')\n .text(d => this.getNodeIcon(d))\n\n nodeEnter\n .append('text')\n .attr('dy', 40)\n .attr('text-anchor', 'middle')\n .text(d => d.properties.name || d.id)\n }\n\n stickNode(event: d3.event, d) {\n d.fx = event.x\n d.fy = event.y\n }\n\n private appendRelationshipsToGraph() {\n const relationshipEnter = this.svgRelationships\n .selectAll('.relationship')\n .data(\n this.relationships.filter(rel => rel.source && rel.target),\n d => d.id\n )\n .enter()\n .append('g')\n .attr('class', 'relationship-group')\n\n relationshipEnter\n .append('line')\n .attr('class', 'relationship')\n .style('stroke', this.options.relationshipColor)\n .style('stroke-width', 2)\n .attr('marker-end', 'url(#arrow)')\n\n relationshipEnter\n .append('text')\n .attr('class', 'relationship-text')\n .attr('fill', '#000000')\n .attr('font-size', '8px')\n .attr('pointer-events', 'none')\n .attr('text-anchor', 'middle')\n .text(d => d.type)\n }\n\n private getNodeIcon(d: Node): string {\n return d.icon || ''\n }\n\n private class2color(cls: string) {\n if (!this.options.classes2colors[cls]) {\n this.options.classes2colors[cls] = this.options.colors[this.options.numClasses % this.options.colors.length]\n this.options.numClasses++\n }\n return this.options.classes2colors[cls]\n }\n\n private class2darkenColor(cls: string) {\n return d3.rgb(this.class2color(cls)).darker(1)\n }\n\n private dragStarted(event: any, d: Node) {\n if (!event.active) this.simulation.alphaTarget(0.3).restart()\n d.fx = d.x\n d.fy = d.y\n }\n\n private dragged(event: any, d: Node) {\n d.fx = event.x\n d.fy = event.y\n }\n\n private dragEnded(event: any, d: Node) {\n if (!event.active) this.simulation.alphaTarget(0)\n d.fx = null\n d.fy = null\n }\n\n zoomFit() {\n var bounds = this.svg.node().getBBox(),\n parent = this.svg.node().parentElement.parentElement,\n fullWidth = parent.clientWidth,\n fullHeight = parent.clientHeight,\n width = bounds.width,\n height = bounds.height,\n midX = bounds.x + width / 2,\n midY = bounds.y + height / 2\n\n if (width === 0 || height === 0) {\n return // nothing to fit\n }\n\n this.svgScale = 0.85 / Math.max(width / fullWidth, height / fullHeight)\n this.svgTranslate = [fullWidth / 2 - this.svgScale * midX, fullHeight / 2 - this.svgScale * midY]\n\n this.svg.attr(\n 'transform',\n 'translate(' + this.svgTranslate[0] + ', ' + this.svgTranslate[1] + ') scale(' + this.svgScale + ')'\n )\n }\n\n size() {\n return {\n nodes: this.nodes.length,\n relationships: this.relationships.length\n }\n }\n}\n"]}
1
+ {"version":3,"file":"graph-viewer.js","sourceRoot":"","sources":["../../client/analysis/graph-viewer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAGxB,MAAM,OAAO,WAAW;IAetB,YAAY,SAAc,EAAE,QAAa;QAXjC,UAAK,GAAW,EAAE,CAAA;QAClB,kBAAa,GAAmB,EAAE,CAAA;QAClC,gBAAW,GAAG,IAAI,CAAA;QAUxB,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;YACrB,SAAS,EAAE,SAAS;YACpB,SAAS,EAAE,IAAI;YACf,YAAY,EAAE,SAAS;YACvB,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,SAAS;YAClB,oBAAoB,EAAE,SAAS;YAC/B,UAAU,EAAE,EAAE;YACd,iBAAiB,EAAE,SAAS;YAC5B,OAAO,EAAE,KAAK;YACd,cAAc,EAAE,EAAE;YAClB,UAAU,EAAE,CAAC;YACb,GAAG,QAAQ;SACZ,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IACtB,CAAC;IAEO,IAAI,CAAC,QAAa;QACxB,cAAc;QACd,MAAM,YAAY,GAAG,EAAE;aACpB,MAAM,CAAC,QAAQ,CAAC;aAChB,MAAM,CAAC,KAAK,CAAC;aACb,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ourcesContent":["import * as d3 from 'd3'\nimport { Node, Relationship, GraphData } from './graph-data.js'\n\nexport class GraphViewer {\n private svg: any\n private svgNodes: any\n private svgRelationships: any\n private nodes: Node[] = []\n private relationships: Relationship[] = []\n private needZoomFit = true\n private options: any\n private svgScale\n private svgTranslate\n private svgContainer: any\n private zoom: any\n\n public simulation: any\n\n constructor(_selector: any, _options: any) {\n this.options = {\n arrowSize: 4,\n colors: this.colors(),\n highlight: undefined,\n infoPanel: true,\n minCollision: undefined,\n graphData: undefined,\n dataUrl: undefined,\n nodeOutlineFillColor: undefined,\n nodeRadius: 25,\n relationshipColor: '#a5abb6',\n zoomFit: false,\n classes2colors: {},\n numClasses: 0,\n ..._options\n }\n this.init(_selector)\n }\n\n private init(selector: any) {\n // SVG 컨테이너 생성\n const svgContainer = d3\n .select(selector)\n .append('svg')\n .attr('width', '100%')\n .attr('height', '100%')\n .attr('class', 'graph-viewer')\n\n // 줌 동작 정의 (마우스 중심 줌 자동 지원)\n const zoom = d3\n .zoom()\n .scaleExtent([0.1, 10])\n .on('zoom', event => {\n // D3가 자동으로 계산한 transform을 그대로 사용 (마우스 중심 줌)\n this.svg.attr('transform', event.transform)\n })\n\n // SVG 컨테이너에 줌 적용\n svgContainer.call(zoom)\n\n // 기본 더블클릭 줌 비활성화\n svgContainer.on('dblclick.zoom', null)\n\n // 배경 더블클릭 시 zoomFit 실행\n svgContainer.on('dblclick', event => {\n event.preventDefault()\n this.zoomFit()\n })\n\n // 실제 그래프 내용을 담을 그룹 생성\n this.svg = svgContainer.append('g').attr('class', 'graph-container').attr('width', '100%').attr('height', '100%')\n\n // SVG 컨테이너 참조 저장 (zoomFit에서 사용)\n this.svgContainer = svgContainer\n this.zoom = zoom\n\n // Define arrow markers for graph links\n this.svg\n .append('defs')\n .append('marker')\n .attr('id', 'arrow')\n .attr('viewBox', '0 -5 10 10')\n .attr('refX', 10)\n .attr('refY', 0)\n .attr('markerWidth', 6)\n .attr('markerHeight', 6)\n .attr('orient', 'auto')\n .append('path')\n .attr('d', 'M0,-5L10,0L0,5')\n .attr('fill', this.options.relationshipColor)\n\n this.svgNodes = this.svg.append('g').attr('class', 'nodes')\n this.svgRelationships = this.svg.append('g').attr('class', 'relationships')\n this.simulation = this.initSimulation()\n\n if (this.options.graphData) {\n this.updateWithGraphData(this.options.graphData)\n }\n }\n\n initSimulation() {\n const x = this.svg.node().parentElement.parentElement.clientWidth / 2\n const y = this.svg.node().parentElement.parentElement.clientHeight / 2\n\n var simulation = d3\n .forceSimulation()\n .force(\n 'collide',\n d3\n .forceCollide()\n .radius(d => {\n return this.options.minCollision\n })\n .iterations(2)\n )\n .force('charge', d3.forceManyBody())\n .force(\n 'link',\n d3.forceLink().id(d => {\n return d.id\n })\n )\n .force('center', d3.forceCenter(x, y))\n .on('tick', () => {\n this.tick()\n })\n .on('end', () => {\n // 자동 zoomFit 제거 - 더블클릭으로만 실행\n })\n\n return simulation\n }\n\n private tick() {\n this.svgNodes.selectAll('.node').attr('transform', (d: any) => `translate(${d.x}, ${d.y})`)\n\n this.svgRelationships\n .selectAll('.relationship')\n .attr('x1', (d: any) => this.calculateIntersection(d.source, d.target).x1)\n .attr('y1', (d: any) => this.calculateIntersection(d.source, d.target).y1)\n .attr('x2', (d: any) => this.calculateIntersection(d.source, d.target).x2)\n .attr('y2', (d: any) => this.calculateIntersection(d.source, d.target).y2)\n\n this.svgRelationships.selectAll('.relationship-text').attr('transform', (d: any) => {\n const midX =\n (this.calculateIntersection(d.source, d.target).x1 + this.calculateIntersection(d.source, d.target).x2) / 2\n const midY =\n (this.calculateIntersection(d.source, d.target).y1 + this.calculateIntersection(d.source, d.target).y2) / 2\n return `translate(${midX}, ${midY})`\n })\n }\n\n private calculateIntersection(source, target) {\n const dx = target.x - source.x\n const dy = target.y - source.y\n const distance = Math.sqrt(dx * dx + dy * dy)\n const ratio = (distance - this.options.nodeRadius) / distance\n\n const x1 = source.x + dx * (this.options.nodeRadius / distance)\n const y1 = source.y + dy * (this.options.nodeRadius / distance)\n const x2 = target.x - dx * (this.options.nodeRadius / distance)\n const y2 = target.y - dy * (this.options.nodeRadius / distance)\n\n return { x1, y1, x2, y2 }\n }\n\n private colors() {\n return [\n '#68bdf6', // light blue\n '#6dce9e', // green #1\n '#faafc2', // light pink\n '#f2baf6', // purple\n '#ff928c', // light red\n '#fcea7e', // light yellow\n '#ffc766', // light orange\n '#405f9e', // navy blue\n '#a5abb6', // dark gray\n '#78cecb', // green #2,\n '#b88cbb', // dark purple\n '#ced2d9', // light gray\n '#e84646', // dark red\n '#fa5f86', // dark pink\n '#ffab1a', // dark orange\n '#fcda19', // dark yellow\n '#797b80', // black\n '#c9d96f', // pistachio\n '#47991f', // green #3\n '#70edee', // turquoise\n '#ff75ea' // pink\n ]\n }\n\n updateWithGraphData(graphData: GraphData) {\n this.nodes = graphData.results[0].data[0].graph.nodes\n this.relationships = graphData.results[0].data[0].graph.relationships\n\n this.relationships.forEach(rel => {\n const sourceNode = this.nodes.find(node => node.id === rel.startNode)\n const targetNode = this.nodes.find(node => node.id === rel.endNode)\n\n if (!sourceNode || !targetNode) {\n console.warn(`Node not found for relationship: ${rel.id}`)\n return\n }\n\n rel.source = sourceNode\n rel.target = targetNode\n })\n\n this.updateNodesAndRelationships()\n }\n\n private updateNodesAndRelationships() {\n this.needZoomFit = true\n\n this.svgNodes.selectAll('.node').remove()\n this.svgRelationships.selectAll('.relationship').remove()\n this.svgRelationships.selectAll('.relationship-text').remove()\n\n this.appendNodesToGraph()\n this.appendRelationshipsToGraph()\n\n this.simulation.nodes(this.nodes)\n ;(this.simulation.force('link') as d3.ForceLink<Node, Relationship>).links(this.relationships)\n\n // 시뮬레이션을 강제로 재시작하여 레이아웃이 적절히 재정렬되도록 함\n this.simulation.alpha(1).restart()\n }\n\n private appendNodesToGraph() {\n const nodeEnter = this.svgNodes\n .selectAll('.node')\n .data(this.nodes, (d: any) => d.id)\n .enter()\n .append('g')\n .attr('class', d => {\n var highlight,\n i,\n classes = 'node',\n label = d.labels[0]\n\n if (d.icon) {\n classes += ' node-icon'\n }\n\n return classes\n })\n .on('click', (event, d) => {\n d.fx = d.fy = null\n\n if (typeof this.options.onNodeClick === 'function') {\n this.options.onNodeClick(d)\n }\n })\n .on('dblclick', (event, d) => {\n this.stickNode(event, d)\n\n if (typeof this.options.onNodeDoubleClick === 'function') {\n this.options.onNodeDoubleClick(d)\n }\n })\n .on('mouseenter', function (this: any, event: any, d: any) {\n d3.select(this).style('background', '#f0f0f0')\n event.target.dispatchEvent(\n new CustomEvent('node-mouseenter', {\n detail: d,\n bubbles: true\n })\n )\n })\n .on('mouseleave', function (this: any, event: any, d: any) {\n d3.select(this).style('background', 'white')\n event.target.dispatchEvent(\n new CustomEvent('node-mouseleave', {\n detail: d,\n bubbles: true\n })\n )\n })\n .call(\n d3\n .drag()\n .on('start', this.dragStarted.bind(this))\n .on('drag', this.dragged.bind(this))\n .on('end', this.dragEnded.bind(this))\n )\n\n nodeEnter\n .append('circle')\n .attr('class', 'outline')\n .attr('r', this.options.nodeRadius)\n .style('fill', d => this.class2color(d.labels[0]))\n .style('stroke', d => this.class2darkenColor(d.labels[0]))\n .style('stroke-width', 2)\n\n nodeEnter\n .append('text')\n .attr('class', 'text icon')\n .attr('x', 0)\n .attr('y', 0)\n .attr('text-anchor', 'middle')\n .attr('dominant-baseline', 'central')\n .attr('font-family', 'Material Symbols Outlined')\n .attr('font-size', '24px')\n .attr('fill', '#000')\n .text(d => this.getNodeIcon(d))\n\n nodeEnter\n .append('text')\n .attr('dy', 40)\n .attr('text-anchor', 'middle')\n .text(d => d.properties.name || d.id)\n }\n\n stickNode(event: d3.event, d) {\n d.fx = event.x\n d.fy = event.y\n }\n\n private appendRelationshipsToGraph() {\n const relationshipEnter = this.svgRelationships\n .selectAll('.relationship')\n .data(\n this.relationships.filter(rel => rel.source && rel.target),\n d => d.id\n )\n .enter()\n .append('g')\n .attr('class', 'relationship-group')\n\n relationshipEnter\n .append('line')\n .attr('class', 'relationship')\n .style('stroke', this.options.relationshipColor)\n .style('stroke-width', 2)\n .attr('marker-end', 'url(#arrow)')\n\n relationshipEnter\n .append('text')\n .attr('class', 'relationship-text')\n .attr('fill', '#000000')\n .attr('font-size', '8px')\n .attr('pointer-events', 'none')\n .attr('text-anchor', 'middle')\n .text(d => d.type)\n }\n\n private getNodeIcon(d: Node): string {\n return d.icon || ''\n }\n\n private class2color(cls: string) {\n if (!this.options.classes2colors[cls]) {\n this.options.classes2colors[cls] = this.options.colors[this.options.numClasses % this.options.colors.length]\n this.options.numClasses++\n }\n return this.options.classes2colors[cls]\n }\n\n private class2darkenColor(cls: string) {\n return d3.rgb(this.class2color(cls)).darker(1)\n }\n\n private dragStarted(event: any, d: Node) {\n if (!event.active) this.simulation.alphaTarget(0.3).restart()\n d.fx = d.x\n d.fy = d.y\n }\n\n private dragged(event: any, d: Node) {\n d.fx = event.x\n d.fy = event.y\n }\n\n private dragEnded(event: any, d: Node) {\n if (!event.active) this.simulation.alphaTarget(0)\n d.fx = null\n d.fy = null\n }\n\n zoomFit() {\n if (!this.svg || !this.svgContainer) return\n\n const bounds = this.svg.node()?.getBBox()\n const svgNode = this.svgContainer.node()\n\n if (!bounds || !svgNode) return\n\n const rect = svgNode.getBoundingClientRect()\n const fullWidth = rect.width\n const fullHeight = rect.height\n\n if (bounds.width === 0 || bounds.height === 0) return\n\n const padding = 50\n const scale = Math.min((fullWidth - padding) / bounds.width, (fullHeight - padding) / bounds.height) * 0.85\n\n const centerX = bounds.x + bounds.width / 2\n const centerY = bounds.y + bounds.height / 2\n\n const transform = d3.zoomIdentity\n .translate(fullWidth / 2, fullHeight / 2)\n .scale(scale)\n .translate(-centerX, -centerY)\n\n // D3의 줌 상태를 직접 업데이트하여 이후 휠스크롤이 올바르게 작동하도록 함\n this.svgContainer.transition().duration(750).call(this.zoom.transform, transform)\n }\n\n size() {\n return {\n nodes: this.nodes.length,\n relationships: this.relationships.length\n }\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import '@operato/property-editor/ox-property-editor-secret.js';
1
2
  import './editors/entity-editor.js';
2
3
  import './editors/property-editor.js';
3
4
  export default function bootstrap(): void;
@@ -1,3 +1,4 @@
1
+ import '@operato/property-editor/ox-property-editor-secret.js';
1
2
  import './editors/entity-editor.js';
2
3
  import './editors/property-editor.js';
3
4
  import { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js';
@@ -21,6 +22,7 @@ export default function bootstrap() {
21
22
  registerGristRenderer('crontab', OxGristRendererCrontab);
22
23
  registerGristRenderer('data', OxGristRendererJson5);
23
24
  OxPropertyEditor.register({
25
+ secret: 'ox-property-editor-secret',
24
26
  'http-headers': 'property-editor-http-headers',
25
27
  'http-parameters': 'property-editor-http-parameters',
26
28
  'http-body': 'property-editor-http-body',
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAA;AAC/F,OAAO,EACL,cAAc,IAAI,mBAAmB,EACrC,gBAAgB,IAAI,qBAAqB,EACzC,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAA;AAEvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAA;IAClD,mBAAmB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;IACnD,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA;IACrD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC9C,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA;IACpD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAE9C,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAA;IACxD,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IAEnD,gBAAgB,CAAC,QAAQ,CAAC;QACxB,cAAc,EAAE,8BAA8B;QAC9C,iBAAiB,EAAE,iCAAiC;QACpD,WAAW,EAAE,2BAA2B;QACxC,iBAAiB,EAAE,iCAAiC;QACpD,qBAAqB,EAAE,qCAAqC;QAC5D,eAAe,EAAE,+BAA+B;QAChD,sBAAsB,EAAE,sCAAsC;KAC/D,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import './editors/entity-editor.js'\nimport './editors/property-editor.js'\n\nimport { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js'\nimport { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js'\nimport {\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer,\n OxGristRendererJson5\n} from '@operato/data-grist'\nimport { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'\nimport { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'\nimport { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'\nimport { OxGristEditorData } from '@operato/grist-editor/ox-grist-editor-data.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nimport { ConnectionSelector } from './grist/connection-selector.js'\nimport { ConnectorSelector } from './grist/connector-selector.js'\nimport { TaskTypeSelector } from './grist/task-type-selector.js'\n\nexport default function bootstrap() {\n registerGristEditor('task-type', TaskTypeSelector)\n registerGristEditor('connector', ConnectorSelector)\n registerGristEditor('connection', ConnectionSelector)\n registerGristEditor('json', OxGristEditorJson)\n registerGristEditor('parameters', OxGristEditorParameters)\n registerGristEditor('crontab', OxGristEditorCrontab)\n registerGristEditor('data', OxGristEditorData)\n\n registerGristRenderer('crontab', OxGristRendererCrontab)\n registerGristRenderer('data', OxGristRendererJson5)\n\n OxPropertyEditor.register({\n 'http-headers': 'property-editor-http-headers',\n 'http-parameters': 'property-editor-http-parameters',\n 'http-body': 'property-editor-http-body',\n 'entity-selector': 'property-editor-entity-selector',\n 'scenario-step-input': 'property-editor-scenario-step-input',\n 'tag-scenarios': 'property-editor-tag-scenarios',\n 'procedure-parameters': 'property-editor-procedure-parameters'\n })\n}\n"]}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,uDAAuD,CAAA;AAC9D,OAAO,4BAA4B,CAAA;AACnC,OAAO,8BAA8B,CAAA;AAErC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAA;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAA;AAC/F,OAAO,EACL,cAAc,IAAI,mBAAmB,EACrC,gBAAgB,IAAI,qBAAqB,EACzC,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAA;AAEvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAEhE,MAAM,CAAC,OAAO,UAAU,SAAS;IAC/B,mBAAmB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAA;IAClD,mBAAmB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;IACnD,mBAAmB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA;IACrD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAC9C,mBAAmB,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAA;IAC1D,mBAAmB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAA;IACpD,mBAAmB,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IAE9C,qBAAqB,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAA;IACxD,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;IAEnD,gBAAgB,CAAC,QAAQ,CAAC;QACxB,MAAM,EAAE,2BAA2B;QACnC,cAAc,EAAE,8BAA8B;QAC9C,iBAAiB,EAAE,iCAAiC;QACpD,WAAW,EAAE,2BAA2B;QACxC,iBAAiB,EAAE,iCAAiC;QACpD,qBAAqB,EAAE,qCAAqC;QAC5D,eAAe,EAAE,+BAA+B;QAChD,sBAAsB,EAAE,sCAAsC;KAC/D,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import '@operato/property-editor/ox-property-editor-secret.js'\nimport './editors/entity-editor.js'\nimport './editors/property-editor.js'\n\nimport { OxGristEditorJson } from '@operato/app/grist-editor/ox-grist-editor-json.js'\nimport { OxGristRendererCrontab } from '@operato/app/grist-editor/ox-grist-renderer-crontab.js'\nimport {\n registerEditor as registerGristEditor,\n registerRenderer as registerGristRenderer,\n OxGristRendererJson5\n} from '@operato/data-grist'\nimport { OxGristEditorCrontab } from '@operato/grist-editor/ox-grist-editor-crontab.js'\nimport { OxGristEditorPrivilege } from '@operato/app/grist-editor/ox-grist-editor-privilege.js'\nimport { OxGristEditorParameters } from '@operato/grist-editor/ox-grist-editor-parameters.js'\nimport { OxGristEditorData } from '@operato/grist-editor/ox-grist-editor-data.js'\nimport { OxPropertyEditor } from '@operato/property-editor'\n\nimport { ConnectionSelector } from './grist/connection-selector.js'\nimport { ConnectorSelector } from './grist/connector-selector.js'\nimport { TaskTypeSelector } from './grist/task-type-selector.js'\n\nexport default function bootstrap() {\n registerGristEditor('task-type', TaskTypeSelector)\n registerGristEditor('connector', ConnectorSelector)\n registerGristEditor('connection', ConnectionSelector)\n registerGristEditor('json', OxGristEditorJson)\n registerGristEditor('parameters', OxGristEditorParameters)\n registerGristEditor('crontab', OxGristEditorCrontab)\n registerGristEditor('data', OxGristEditorData)\n\n registerGristRenderer('crontab', OxGristRendererCrontab)\n registerGristRenderer('data', OxGristRendererJson5)\n\n OxPropertyEditor.register({\n secret: 'ox-property-editor-secret',\n 'http-headers': 'property-editor-http-headers',\n 'http-parameters': 'property-editor-http-parameters',\n 'http-body': 'property-editor-http-body',\n 'entity-selector': 'property-editor-entity-selector',\n 'scenario-step-input': 'property-editor-scenario-step-input',\n 'tag-scenarios': 'property-editor-tag-scenarios',\n 'procedure-parameters': 'property-editor-procedure-parameters'\n })\n}\n"]}