Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 207x 207x 207x 207x 2x 2x 2x 2x 2x 4x 4x 8x 8x 8x 4x 45x | /* * Copyright 2021 Harness Inc. All rights reserved. * Use of this source code is governed by the PolyForm Shield 1.0.0 license * that can be found in the licenses directory at the root of this repository, also available at * https://polyformproject.org/wp-content/uploads/2020/06/PolyForm-Shield-1.0.0.txt. */ import { AbstractModelFactory, BaseModel, BaseModelGenerics, CanvasEngine, CanvasEngineListener, CanvasModel, CanvasModelGenerics, FactoryBank, FactoryBankListener, LayerModel, LayerModelGenerics, LayerModelOptions } from '@projectstorm/react-canvas-core' import { DiagramEngine, NodeModel, DiagramModel } from '@projectstorm/react-diagrams-core' import { EmptyNodeModel } from '../node/EmptyNode/EmptyNodeModel' import type { RollbackToggleSwitchProps } from '../canvas/RollbackToggleSwitch/RollbackToggleSwitch' export interface StepGroupNodeLayerOptions extends LayerModelOptions { label?: string childrenDistance?: number depth?: number headerDepth?: number allowAdd?: boolean identifier?: string showRollback?: boolean inComplete?: boolean containerCss?: React.CSSProperties textCss?: React.CSSProperties skipCondition?: string conditionalExecutionEnabled?: boolean rollBackProps?: Omit<RollbackToggleSwitchProps, 'onChange'> disableCollapseButton?: boolean hideOutPort?: boolean } export interface StepGroupNodeLayerModelGenerics extends LayerModelGenerics { OPTIONS: StepGroupNodeLayerOptions CHILDREN: NodeModel ENGINE: DiagramEngine } export class StepGroupNodeLayerModel< G extends StepGroupNodeLayerModelGenerics = StepGroupNodeLayerModelGenerics > extends LayerModel<G> { startNode: EmptyNodeModel endNode: EmptyNodeModel constructor(options: StepGroupNodeLayerOptions = {}) { super({ type: 'step-group-nodes', isSvg: false, allowAdd: false, depth: 1, containerCss: {}, textCss: {}, inComplete: false, transformed: true, showRollback: true, ...options }) this.startNode = new EmptyNodeModel({ id: options.identifier + '-Start', identifier: options.identifier, name: 'Empty', hideOutPort: true }) this.endNode = new EmptyNodeModel({ id: options.identifier + '-End', identifier: options.identifier, name: 'Empty', hideInPort: true, hideOutPort: options.hideOutPort }) this.addModel(this.startNode) this.addModel(this.endNode) } setOptions(options: StepGroupNodeLayerOptions): void { this.options = { ...this.options, ...options } this.endNode.setOptions({ ...this.endNode.getOptions(), ...{ hideOutPort: this.options.hideOutPort } }) } addModel(model: G['CHILDREN']): void { Iif (!(model instanceof NodeModel)) { throw new Error('Can only add nodes to this layer') } model.registerListener({ entityRemoved: () => { ;(this.getParent() as DiagramModel).removeNode(model) } }) super.addModel(model) } getIdentifier(): string | undefined { return this.options.identifier } // getChildModelFactoryBank(engine: G['ENGINE']) { // return engine.getNodeFactories() as AbstractModelFactory<BaseModel<BaseModelGenerics>, CanvasEngine<CanvasEngineListener, CanvasModel<CanvasModelGenerics>>> // } getChildModelFactoryBank( engine: G['ENGINE'] ): FactoryBank< AbstractModelFactory< BaseModel<BaseModelGenerics>, CanvasEngine<CanvasEngineListener, CanvasModel<CanvasModelGenerics>> >, FactoryBankListener< AbstractModelFactory< BaseModel<BaseModelGenerics>, CanvasEngine<CanvasEngineListener, CanvasModel<CanvasModelGenerics>> > > > { return engine.getNodeFactories() as any } getNodes() { return this.getModels() } } |