@libs-ui/services-diagram-draw 0.2.356-37

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 (33) hide show
  1. package/README.md +279 -0
  2. package/canvas.service.d.ts +42 -0
  3. package/diagram-draw.service.d.ts +91 -0
  4. package/direction.service.d.ts +43 -0
  5. package/esm2022/canvas.service.mjs +628 -0
  6. package/esm2022/diagram-draw.service.mjs +711 -0
  7. package/esm2022/direction.service.mjs +255 -0
  8. package/esm2022/index.mjs +6 -0
  9. package/esm2022/interfaces/canvas.interface.mjs +2 -0
  10. package/esm2022/interfaces/coordinates.interface.mjs +2 -0
  11. package/esm2022/interfaces/diagram.interface.mjs +2 -0
  12. package/esm2022/libs-ui-services-diagram-draw.mjs +5 -0
  13. package/esm2022/utils/calculator-branch.util.mjs +187 -0
  14. package/esm2022/utils/calculator-element.util.mjs +335 -0
  15. package/esm2022/utils/canvas.util.mjs +176 -0
  16. package/esm2022/utils/diagram.util.mjs +54 -0
  17. package/esm2022/utils/direction.util.mjs +103 -0
  18. package/esm2022/utils/horizontal/calculator-branch.util.mjs +243 -0
  19. package/esm2022/utils/horizontal/calculator-coordinates.util.mjs +315 -0
  20. package/fesm2022/libs-ui-services-diagram-draw.mjs +2982 -0
  21. package/fesm2022/libs-ui-services-diagram-draw.mjs.map +1 -0
  22. package/index.d.ts +5 -0
  23. package/interfaces/canvas.interface.d.ts +21 -0
  24. package/interfaces/coordinates.interface.d.ts +40 -0
  25. package/interfaces/diagram.interface.d.ts +109 -0
  26. package/package.json +27 -0
  27. package/utils/calculator-branch.util.d.ts +16 -0
  28. package/utils/calculator-element.util.d.ts +24 -0
  29. package/utils/canvas.util.d.ts +21 -0
  30. package/utils/diagram.util.d.ts +6 -0
  31. package/utils/direction.util.d.ts +6 -0
  32. package/utils/horizontal/calculator-branch.util.d.ts +67 -0
  33. package/utils/horizontal/calculator-coordinates.util.d.ts +42 -0
package/README.md ADDED
@@ -0,0 +1,279 @@
1
+ # @libs-ui/services-diagram-draw
2
+
3
+ > **Version:** 0.2.356-3
4
+ > **Angular:** ^18.2.0
5
+
6
+ Service quản lý toàn bộ vòng đời của diagram flow: tính toán tọa độ element, render component động vào canvas, vẽ SVG connector, và quản lý drop zone kéo-thả thông minh.
7
+
8
+ ---
9
+
10
+ ## Cài đặt
11
+
12
+ ```bash
13
+ npm install @libs-ui/services-diagram-draw
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Import
19
+
20
+ ```typescript
21
+ import { LibsUiDiagramDrawService, canvasConfigReadonly, storeDataDefault } from '@libs-ui/services-diagram-draw';
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Khởi tạo
27
+
28
+ ```typescript
29
+ @Component({ ... })
30
+ export class DiagramComponent implements AfterViewInit {
31
+ @ViewChild('svgContainer') svgContainer!: ElementRef<SVGElement>;
32
+ @ViewChild('nodesContainer') nodesContainer!: ElementRef<HTMLDivElement>;
33
+ @ViewChild('vcr', { read: ViewContainerRef }) vcr!: ViewContainerRef;
34
+
35
+ private readonly diagramService = inject(LibsUiDiagramDrawService);
36
+
37
+ ngAfterViewInit() {
38
+ // 1. Đăng ký config
39
+ this.diagramService.setConfig({
40
+ storeDataDefine: { ...storeDataDefault },
41
+ svgContainer: this.svgContainer,
42
+ nodesContainer: this.nodesContainer,
43
+ viewContainerRef: this.vcr,
44
+ nodeComponentType: MyNodeComponent,
45
+ nodeOtherConfigComponentType: MyWaitNodeComponent, // optional
46
+ });
47
+
48
+ // 2. Tính toán tọa độ
49
+ this.diagramService.configXYElements(this.elements);
50
+
51
+ // 3. Render nodes + SVG connector
52
+ this.diagramService.renderNodes(this.elements);
53
+ }
54
+ }
55
+ ```
56
+
57
+ ---
58
+
59
+ ## API
60
+
61
+ ### Methods
62
+
63
+ | Method | Parameters | Returns | Mô tả |
64
+ | --------------------------------------------------------- | -------------------------------------- | ------- | --------------------------------------------------------------------------------------------------- |
65
+ | `set setConfig` | `IConfig` | `void` | Đăng ký config (ViewContainerRef, container refs, component types). Phải gọi trước mọi method khác. |
66
+ | `set setConfigCanvas` | `Partial<ICanvasConfig>` | `void` | Ghi đè các tham số canvas config (margin, kích thước, màu SVG, …). |
67
+ | `configXYElements(elements, updateSVG?, positionX?)` | `IDiagramElement[], boolean?, number?` | `void` | Tính toán tọa độ X/Y cho tất cả elements và cập nhật SVG path. |
68
+ | `renderNodes(elements)` | `IDiagramElement[]` | `void` | Clear nodes cũ, render component động, branch labels và arrow indicators. |
69
+ | `clearNodes()` | — | `void` | Destroy tất cả ComponentRef, xóa node-dynamic, branch-label, arrow-indicator khỏi DOM. |
70
+ | `renderDropZones(flatElements, onDrop, canDropFn, rules)` | Xem bên dưới | `void` | Render drop zone "+" tại các vị trí cho phép kéo-thả. |
71
+ | `clearDropZones()` | — | `void` | Xóa tất cả `.diagram-drop-zone` khỏi nodesContainer. |
72
+
73
+ #### `renderDropZones` — chi tiết
74
+
75
+ ```typescript
76
+ renderDropZones(
77
+ flatElements: IDiagramElement[],
78
+ onDrop: (element: IDiagramElement, branch: IDiagramElementBranch | undefined, dragData: string) => void,
79
+ canDropFn: TDropZoneCanDropFn, // true = ẨN drop zone, false = HIỂN THỊ
80
+ ruleConnectableElements: IRuleConnectable[]
81
+ ): void
82
+ ```
83
+
84
+ ### Exported Constants
85
+
86
+ | Export | Type | Mô tả |
87
+ | ---------------------- | ---------------------------------- | ---------------------------------------------------------------------------------- |
88
+ | `canvasConfigReadonly` | `Signal<ICanvasConfig>` (readonly) | Signal đọc config canvas global, dùng trong component mà không cần inject service. |
89
+ | `storeDataDefault` | `IDiagramStoreData` | Giá trị mặc định cho `storeDataDefine`. |
90
+
91
+ ---
92
+
93
+ ## Canvas Config (`ICanvasConfig`)
94
+
95
+ Tuỳ chỉnh qua `setConfigCanvas`:
96
+
97
+ | Property | Default | Mô tả |
98
+ | ------------------------------------------------ | ------------ | ------------------------------------------------------- |
99
+ | `ELEMENT_WIDTH_DEFAULT_BRANCH_WHEN_NOT_ELEMENT` | `60` | Chiều rộng branch rỗng |
100
+ | `ELEMENT_MARGIN_DEFAULT` | `60` | Margin dọc giữa các element |
101
+ | `ELEMENT_MARGIN_DEFAULT_BRANCH` | `16` | Margin element trong branch |
102
+ | `ELEMENT_MARGIN_BETWEEN_BRANCH_DEFAULT` | `60` | Margin ngang giữa các branch |
103
+ | `DEFAULT_BRANCH_WHEN_NO_ELEMENT` | `100` | Chiều cao branch khi rỗng |
104
+ | `ELEMENT_HEIGHT_CURVE` | `10` | Độ cong SVG connector |
105
+ | `ELEMENT_SVG_STROKE_COLOR` | `'9ca2ad'` | Màu đường kẻ SVG (không có `#`) |
106
+ | `ELEMENT_SVG_STROKE_WIDTH` | `'1'` | Độ dày đường kẻ SVG |
107
+ | `ELEMENT_MARGIN_DEFAULT_BRANCH_TO_ELEMENT_FIRST` | `78` | Khoảng cách từ parent đến element đầu tiên trong branch |
108
+ | `DISTANCE_TO_WAIT` | `30` | Khoảng cách element chính → nodeOtherConfig |
109
+ | `WAIT_TO_ELEMENT` | `50` | Khoảng cách nodeOtherConfig → element kế tiếp |
110
+ | `ELEMENT_WAIT_DEFAULT` | `28` | Chiều cao mặc định nodeOtherConfig |
111
+ | `DISTANCE_WAIT_TO_NEXT_LINE` | `4` | Khoảng cách nodeOtherConfig → đường nối kế tiếp |
112
+ | `TYPE_ELEMENT_EXIT` | `'EXIT'` | Loại element kết thúc (không có drop zone bên dưới) |
113
+ | `TYPE_ELEMENT_WORKFLOW` | `'WORKFLOW'` | Loại element có branches |
114
+ | `WIDTH_ELEMENT_DEFAULT` | `165` | Chiều rộng mặc định node |
115
+ | `HEIGHT_ELEMENT_DEFAULT` | `48` | Chiều cao mặc định node |
116
+ | `ADD_ICON_DIAMETER` | `24` | Đường kính icon "+" drop zone |
117
+
118
+ ---
119
+
120
+ ## Interfaces
121
+
122
+ ```typescript
123
+ interface IDiagramElement {
124
+ code?: string; // Loại element (EXIT, WORKFLOW, …)
125
+ name?: string; // Tên hiển thị
126
+ id?: string; // Unique identifier
127
+ element_type?: string; // Type phân loại
128
+ branches?: IDiagramElementBranch[];
129
+ translateX?: number; // Tọa độ X (computed)
130
+ translateY?: number; // Tọa độ Y (computed)
131
+ specific_x?: number;
132
+ specific_y?: number;
133
+ specific_width?: number;
134
+ specific_height?: number;
135
+ attributeSvgD?: string; // SVG path string connector
136
+ nodeOtherConfig?: IDiagramElement; // Node phụ (wait/delay)
137
+ pre_id?: string;
138
+ next_id?: string;
139
+ disable?: boolean;
140
+ }
141
+
142
+ interface IDiagramElementBranch {
143
+ code?: string;
144
+ label?: string; // Label hiển thị trên nhánh
145
+ labelBgColor?: string; // Màu nền label
146
+ elements: IDiagramElement[];
147
+ onTheSide?: 'above' | 'under' | 'center';
148
+ specific_start_branch_x?: number;
149
+ specific_start_branch_y?: number;
150
+ nodeOtherConfig?: IDiagramElement;
151
+ isDirection?: boolean;
152
+ }
153
+
154
+ interface IConfig {
155
+ storeDataDefine: IDiagramStoreData;
156
+ svgContainer?: ElementRef<HTMLDivElement>;
157
+ nodesContainer?: ElementRef<HTMLDivElement>;
158
+ viewContainerRef?: ViewContainerRef;
159
+ nodeComponentType?: Type<any>;
160
+ nodeOtherConfigComponentType?: Type<any>;
161
+ dropZoneStyle?: IDropZoneIndicatorStyle; // Tuỳ chỉnh indicator "+"
162
+ }
163
+
164
+ interface IRuleConnectable {
165
+ elementCode: string;
166
+ elementCodeConnectableBefore: string[];
167
+ }
168
+
169
+ type TDropZoneCanDropFn = (before: IDiagramElement | undefined, current: IDiagramElement | undefined, after: IDiagramElement | undefined, rules: IRuleConnectable[]) => boolean;
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Tuỳ chỉnh indicator "+" (`IDropZoneIndicatorStyle`)
175
+
176
+ Truyền vào `dropZoneStyle` của `IConfig` để kiểm soát giao diện nút `"+"` trong drop zone.
177
+ Tất cả các field đều optional — giá trị nào không truyền sẽ dùng mặc định nội bộ của service.
178
+
179
+ ### Thứ tự ưu tiên render
180
+
181
+ | Ưu tiên | Điều kiện | Kết quả |
182
+ | ------- | ----------------------------- | ------------------------------------------------------------------- |
183
+ | **1** | `renderIndicator` được truyền | Toàn bộ HTML indicator do hàm này sinh ra |
184
+ | **2** | Không có `renderIndicator` | SVG `"+"` tự sinh từ `backgroundColor`, `iconColor`, `borderRadius` |
185
+
186
+ | Ưu tiên | Điều kiện | Kết quả hover |
187
+ | ------- | ---------------------------------- | ----------------------------------------------- |
188
+ | **1** | `renderHoverIndicator` được truyền | Nội dung bên trong rectangle do hàm này sinh ra |
189
+ | **2** | Không có `renderHoverIndicator` | Rectangle mở rộng trống (chỉ có nền + viền) |
190
+
191
+ ### Bảng thuộc tính
192
+
193
+ #### Indicator (trạng thái bình thường)
194
+
195
+ | Thuộc tính | Kiểu | Mặc định | Mô tả |
196
+ | ----------------- | -------------------------- | ----------- | -------------------------------------------------------------------------------------------- |
197
+ | `backgroundColor` | `string` | `'#3b82f6'` | Màu nền của indicator |
198
+ | `iconColor` | `string` | `'#ffffff'` | Màu dấu `"+"` bên trong indicator |
199
+ | `borderRadius` | `string` | `'50%'` | Bo góc indicator — `'50%'` cho tròn, `'6px'` cho vuông bo góc |
200
+ | `opacity` | `number` | `0.95` | Độ mờ của indicator ở trạng thái bình thường |
201
+ | `renderIndicator` | `(size: number) => string` | — | **[Động]** Hàm trả về HTML tùy ý thay thế toàn bộ indicator. Ghi đè mọi field tĩnh bên trên. |
202
+
203
+ #### Hover / drag-enter (rectangle mở rộng)
204
+
205
+ | Thuộc tính | Kiểu | Mặc định | Mô tả |
206
+ | ---------------------- | -------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------- |
207
+ | `hoverBackgroundColor` | `string` | `'#eef4ff'` | Màu nền rectangle khi kéo vào vùng drop |
208
+ | `hoverBorderColor` | `string` | `'rgba(59, 130, 246, 0.7)'` | Màu đường viền rectangle |
209
+ | `hoverBorderStyle` | `string` | `'dashed'` | Kiểu viền — `'dashed'` \| `'solid'` \| `'dotted'` |
210
+ | `hoverBorderRadius` | `number` | `10` | Border-radius (px) của rectangle |
211
+ | `renderHoverIndicator` | `() => string` | — | **[Động]** Hàm trả về HTML inject vào bên trong rectangle. Nếu không truyền, rectangle chỉ hiển thị nền trống. |
212
+
213
+ ### Ví dụ
214
+
215
+ **Chỉ đổi màu và bo góc:**
216
+
217
+ ```typescript
218
+ this.diagramService.setConfig = {
219
+ // ... các config khác
220
+ dropZoneStyle: {
221
+ backgroundColor: '#10b981',
222
+ iconColor: '#ffffff',
223
+ borderRadius: '4px', // hình vuông bo góc thay vì tròn
224
+ opacity: 1,
225
+ hoverBackgroundColor: '#f0fdf4',
226
+ hoverBorderColor: 'rgba(16, 185, 129, 0.8)',
227
+ hoverBorderStyle: 'dashed',
228
+ hoverBorderRadius: 8,
229
+ },
230
+ };
231
+ ```
232
+
233
+ **Render indicator hoàn toàn tùy chỉnh:**
234
+
235
+ ```typescript
236
+ this.diagramService.setConfig = {
237
+ // ... các config khác
238
+ dropZoneStyle: {
239
+ renderIndicator: (size: number) => `
240
+ <div style="
241
+ width: ${size}px; height: ${size}px;
242
+ background: #f59e0b; border-radius: 6px;
243
+ display: flex; align-items: center; justify-content: center;
244
+ ">
245
+ <svg viewBox="0 0 24 24" fill="white" width="14" height="14">
246
+ <path d="M12 5v14M5 12h14" stroke="white" stroke-width="2"/>
247
+ </svg>
248
+ </div>
249
+ `,
250
+ renderHoverIndicator: () => `
251
+ <span style="color: #f59e0b; font-size: 11px; font-weight: 600;">
252
+ + Thêm vào đây
253
+ </span>
254
+ `,
255
+ hoverBackgroundColor: '#fafafa',
256
+ hoverBorderColor: 'rgba(139, 92, 246, 0.5)',
257
+ hoverBorderStyle: 'solid',
258
+ hoverBorderRadius: 12,
259
+ },
260
+ };
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Lưu ý quan trọng
266
+
267
+ > ⚠️ Phải gọi `setConfig` trước khi dùng bất kỳ method nào khác.
268
+
269
+ > ⚠️ `canvasConfig` là signal **global** — thay đổi sẽ ảnh hưởng đến mọi instance trong cùng app.
270
+
271
+ > ⚠️ `renderNodes()` sẽ tự gọi `clearNodes()` trước khi render lại — không cần gọi thủ công trước.
272
+
273
+ > ⚠️ `canDropFn` trả về `true` → **ẨN** drop zone; `false` → **HIỂN THỊ** drop zone.
274
+
275
+ ---
276
+
277
+ ## Demo
278
+
279
+ Xem demo tại: `services/diagram-draw` trong core-ui app.
@@ -0,0 +1,42 @@
1
+ import { IHandlerFunction, IRuleConnectable } from './interfaces/canvas.interface';
2
+ import { IDiagramElement, IDiagramElementBranch } from './interfaces/diagram.interface';
3
+ import * as i0 from "@angular/core";
4
+ export declare class LibsUiDiagramDrawCanvasService {
5
+ private elements;
6
+ private flatElements;
7
+ private handlerFunction;
8
+ private elementRuleConnectable;
9
+ private translateService;
10
+ set HandlerFunction(handlerFunction: IHandlerFunction);
11
+ get HandlerFunction(): IHandlerFunction;
12
+ loadElements(elements: Array<IDiagramElement>, positionFirstNode: {
13
+ x: number;
14
+ y: number;
15
+ }, ruleConnectableElements: Array<IRuleConnectable>): void;
16
+ set Elements(elements: IDiagramElement[]);
17
+ get Elements(): IDiagramElement[];
18
+ set RuleConnectableElements(elements: Array<IRuleConnectable>);
19
+ get RuleConnectableElements(): Array<IRuleConnectable>;
20
+ checkRuleDragDrop(beforeElementDrag: IDiagramElement | undefined, currentElementDrag: IDiagramElement | undefined, afterElementDrag: IDiagramElement | undefined, ruleConnectableElements: Array<IRuleConnectable>): boolean;
21
+ get FlatElements(): IDiagramElement[];
22
+ checkExistNameElement(name: string, flatElements: Array<IDiagramElement>): boolean;
23
+ addElement(itemDrop: IDiagramElement, branchDrop: IDiagramElementBranch | undefined, dataDrop: IDiagramElement, branchChoice?: number): void;
24
+ private addElementToBranch;
25
+ private updateNextIdOfChildElementInElementWorkflow;
26
+ private checkEndMoveElementWhenDropElementCodeExit;
27
+ private moveElementsToBranch;
28
+ private findContainerHasElementStart;
29
+ private deleteElement;
30
+ private cloneElementAndAddElementEXitToBranch;
31
+ private addElementExitWorkFlow;
32
+ addElementExitWhenDeleteDirectionLine(element: IDiagramElement, branch: IDiagramElementBranch | undefined): void;
33
+ /**
34
+ * Khi một element bị xoá, hàm này sẽ tự động thêm exit cho tất cả các element phía trước đang trỏ tới element đó.
35
+ */
36
+ addElementExitForAllElementPreviousWhenElementDelete(elementsDelete: IDiagramElement[]): void;
37
+ removeOrChangeElement(elementRemove: IDiagramElement, elementChange: IDiagramElement | undefined, branchChoose?: number): Promise<void>;
38
+ deleteChangeElementAndInsertBranchKeep(elementRemove: IDiagramElement, elementChange: IDiagramElement | undefined, branchKeepElement: IDiagramElementBranch | undefined, branchChoice?: number | undefined): Promise<void>;
39
+ private addBranchKeepToFlow;
40
+ static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiDiagramDrawCanvasService, never>;
41
+ static ɵprov: i0.ɵɵInjectableDeclaration<LibsUiDiagramDrawCanvasService>;
42
+ }
@@ -0,0 +1,91 @@
1
+ import { IRuleConnectable, TDropZoneCanDropFn } from './interfaces/canvas.interface';
2
+ import { ICanvasConfig, IConfig, IDiagramElement, IDiagramElementBranch } from './interfaces/diagram.interface';
3
+ import * as i0 from "@angular/core";
4
+ export declare const canvasConfigReadonly: import("@angular/core").Signal<ICanvasConfig>;
5
+ export declare const storeDataDefault: {
6
+ positionMaxLeft: number;
7
+ positionMaxTop: number;
8
+ widthHeightSvgCanvas: {
9
+ heightSvg: number;
10
+ widthSvg: number;
11
+ };
12
+ };
13
+ export declare class LibsUiDiagramDrawService {
14
+ private configCanvas;
15
+ readonly orientation: import("@angular/core").WritableSignal<"vertical" | "horizontal">;
16
+ private elementSvg;
17
+ private attributeSvgD;
18
+ private componentRefs;
19
+ private virtualViewport?;
20
+ private virtualFlatElements;
21
+ private virtualFlatBranches;
22
+ private virtualNodesMap;
23
+ updateViewport(vp: {
24
+ x: number;
25
+ y: number;
26
+ width: number;
27
+ height: number;
28
+ }): void;
29
+ set setConfig(config: IConfig);
30
+ set setConfigCanvas(config: Partial<ICanvasConfig>);
31
+ configXYElements(elements: Array<IDiagramElement>, updateSVG?: boolean, positionX?: number): void;
32
+ private updatePositionElements;
33
+ private buildSvgElement;
34
+ /**
35
+ * Render tất cả nodes từ elements array
36
+ */
37
+ renderNodes(elements: Array<IDiagramElement>): void;
38
+ private extractVirtualElements;
39
+ private applyVirtualizationDiff;
40
+ /**
41
+ * Render elements và branches một cách đệ quy
42
+ */
43
+ private renderElementsRecursively;
44
+ /**
45
+ * Tạo một node component động
46
+ */
47
+ private createNode;
48
+ /**
49
+ * Clear tất cả nodes đã tạo
50
+ */
51
+ clearNodes(): void;
52
+ /**
53
+ * Tạo mũi tên indicator chỉ hướng vào node.
54
+ * - vertical: mũi tên ▼ phía TRÊN node (luồng trên → xuống)
55
+ * - horizontal: mũi tên ► phía TRÁI node (luồng trái → phải)
56
+ */
57
+ private createArrowIndicator;
58
+ /**
59
+ * Render branch labels (text annotations on branches)
60
+ */
61
+ private renderBranchLabels;
62
+ private createBranchLabel;
63
+ /**
64
+ * Render dấu "+" tại mỗi vị trí có thể thả element từ sidebar.
65
+ * Service tự tạo DOM elements và inject vào nodesContainer.
66
+ * @param flatElements Danh sách flat elements đã tính toán vị trí
67
+ * @param onDrop Callback khi người dùng thả element vào một "+"
68
+ * @param canDropFn (tùy chọn) Function kiểm tra điều kiện hiển thị drop zone.
69
+ * ```
70
+ */
71
+ renderDropZones(flatElements: IDiagramElement[], onDrop: (element: IDiagramElement, branch: IDiagramElementBranch | undefined, dragData: string) => void, canDropFn: TDropZoneCanDropFn, ruleConnectableElements: Array<IRuleConnectable>): void;
72
+ /** Xóa tất cả drop zone "+" khỏi DOM */
73
+ clearDropZones(): void;
74
+ private createDropZoneEl;
75
+ private calcDropZoneTopBranch;
76
+ private calcDropZoneLeftBranch;
77
+ private calcDropZoneTopNode;
78
+ private calcDropZoneLeftNode;
79
+ /**
80
+ * Horizontal node: "+" nằm giữa đường line nối 2 node — căn giữa Y của element.
81
+ */
82
+ private calcDropZoneTopNodeH;
83
+ private calcDropZoneLeftNodeH;
84
+ /**
85
+ * Horizontal branch: "+" nằm căn giữa Y của branch line, sau phần tử cuối trong nhánh.
86
+ */
87
+ private calcDropZoneTopBranchH;
88
+ private calcDropZoneLeftBranchH;
89
+ static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiDiagramDrawService, never>;
90
+ static ɵprov: i0.ɵɵInjectableDeclaration<LibsUiDiagramDrawService>;
91
+ }
@@ -0,0 +1,43 @@
1
+ import { Subject } from 'rxjs';
2
+ import { IDiagramElement, IDiagramElementBranch } from './interfaces/diagram.interface';
3
+ import * as i0 from "@angular/core";
4
+ export declare class LibsUiDiagramDrawDirectionService {
5
+ private elementDirection;
6
+ private branchDirection;
7
+ private elementViewDirectionId;
8
+ private onViewDirection;
9
+ private canvasService;
10
+ set ElementDirection(element: IDiagramElement | undefined);
11
+ get ElementDirection(): IDiagramElement | undefined;
12
+ set BranchDirection(branch: {
13
+ branch: IDiagramElementBranch;
14
+ index: number;
15
+ } | undefined);
16
+ get BranchDirection(): {
17
+ branch: IDiagramElementBranch;
18
+ index: number;
19
+ } | undefined;
20
+ set ElementViewDirectionId(id: string | undefined);
21
+ get ElementViewDirectionId(): string | undefined;
22
+ get OnViewDirection(): Subject<{
23
+ id: string;
24
+ }>;
25
+ private checkRuleDirectionToElement;
26
+ buildElementConnectTo(element: IDiagramElement, flatElements: IDiagramElement[], branch?: IDiagramElementBranch, checkRule?: (element: IDiagramElement | undefined, elementConnectTo: IDiagramElement | undefined) => boolean): IDiagramElement[] | undefined;
27
+ /**Xóa các element nằm phía sau khi nhánh được điều hướng */
28
+ deleteElementsBehindBranchConnectTo(branch: IDiagramElementBranch): void;
29
+ /**xóa line đến và xóa line đi ở toàn bộ các khối và nhánh bị xóa */
30
+ private deleteLineConnectFromElement;
31
+ /** Xóa pre_other_id từ khác khối mà khối bị xóa nối đến BlockDelete => Other*/
32
+ private deletePreOtherId;
33
+ /** Xóa next_other_id từ khác khối nối đến khối bị xóa Other => BlockDelete và kiểm tra + thêm khối thoát cho những khối nối tới BlockDelete*/
34
+ private deleteNextOtherId;
35
+ addBranchDirection(targetId: string, element: IDiagramElement, branch: IDiagramElementBranch, flatElements: IDiagramElement[]): void;
36
+ addElementDirection(targetId: string, element: IDiagramElement, flatElements: IDiagramElement[]): void;
37
+ deleteElementsBehindElementConnectTo(element: IDiagramElement, flatElements: IDiagramElement[]): void;
38
+ private findAndDeleteElementFromContainer;
39
+ editDirection(flatElements: IDiagramElement[], targetId: string, element: IDiagramElement, branch?: IDiagramElementBranch): void;
40
+ private editDirectionWithBranch;
41
+ static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiDiagramDrawDirectionService, never>;
42
+ static ɵprov: i0.ɵɵInjectableDeclaration<LibsUiDiagramDrawDirectionService>;
43
+ }