-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba73083
commit a3d6595
Showing
33 changed files
with
240 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
projects/f-flow/src/domain/create-connection-markers/create-connection-markers.execution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
export function deepCloneNode<T extends (HTMLElement | SVGElement)>(node: T): T { | ||
const clone = node.cloneNode(true) as T; | ||
const descendantsWithId = clone.querySelectorAll('[id]'); | ||
const nodeName = node.nodeName.toLowerCase(); | ||
|
||
clone.removeAttribute('id'); | ||
|
||
for (let i = 0; i < descendantsWithId.length; i++) { | ||
descendantsWithId[ i ].removeAttribute('id'); | ||
} | ||
|
||
if (nodeName === 'canvas') { | ||
transferCanvasData(node as HTMLCanvasElement, clone as HTMLCanvasElement); | ||
} else if (nodeName === 'input' || nodeName === 'select' || nodeName === 'textarea') { | ||
transferInputData(node as HTMLInputElement, clone as HTMLInputElement); | ||
} | ||
|
||
transferData('canvas', node, clone, transferCanvasData); | ||
transferData('input, textarea, select', node, clone, transferInputData); | ||
return clone; | ||
} | ||
|
||
function transferData<T extends Element>( | ||
selector: string, | ||
node: HTMLElement | SVGElement, | ||
clone: HTMLElement | SVGElement, | ||
callback: (source: T, clone: T) => void, | ||
) { | ||
const descendantElements = node.querySelectorAll<T>(selector); | ||
|
||
if (descendantElements.length) { | ||
const cloneElements = clone.querySelectorAll<T>(selector); | ||
|
||
for (let i = 0; i < descendantElements.length; i++) { | ||
callback(descendantElements[ i ], cloneElements[ i ]); | ||
} | ||
} | ||
} | ||
|
||
let cloneUniqueId = 0; | ||
|
||
function transferInputData( | ||
source: Element & { value: string }, | ||
clone: Element & { value: string; name: string; type: string }, | ||
) { | ||
if (clone.type !== 'file') { | ||
clone.value = source.value; | ||
} | ||
|
||
if (clone.type === 'radio' && clone.name) { | ||
clone.name = `mat-clone-${ clone.name }-${ cloneUniqueId++ }`; | ||
} | ||
} | ||
|
||
function transferCanvasData(source: HTMLCanvasElement, clone: HTMLCanvasElement) { | ||
const context = clone.getContext('2d'); | ||
|
||
if (context) { | ||
try { | ||
context.drawImage(source, 0, 0); | ||
} catch { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export function sanitizeElementId(id: string): string { | ||
if (!id.match(/^[a-zA-Z_]/)) { | ||
id = '_' + id; | ||
} | ||
return id.replace(/[^a-zA-Z0-9_\-:.]/g, '_'); | ||
} |
2 changes: 1 addition & 1 deletion
2
projects/f-flow/src/f-connection/common/f-connection-identifiers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
projects/f-flow/src/f-connection/common/f-path/get-path-marker-id.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/ | ||
/docs/get-started | ||
/docs/f-flow-component | ||
/docs/f-canvas-component | ||
/docs/f-node-directive | ||
/docs/f-drag-handle-directive | ||
/docs/f-connection-component | ||
/docs/f-connection-for-create-component | ||
/docs/f-connection-marker-directive | ||
/docs/f-node-output-directive | ||
/docs/f-node-input-directive | ||
/docs/f-node-outlet-directive | ||
/docs/f-draggable-directive | ||
/docs/f-zoom-directive | ||
/docs/f-background-component | ||
/docs/f-line-alignment-component | ||
/docs/f-minimap-component | ||
/docs/dagre-layout | ||
/docs/elkjs-layout | ||
/docs/f-visual-programming-flow | ||
/docs/f-db-management-flow |
Oops, something went wrong.