|
1 | 1 | import { SequentialStep } from '../../definition'; |
2 | 2 | import { StepExtension } from '../../designer-extension'; |
3 | 3 | import { createContainerStepComponentViewFactory } from './container-step-component-view'; |
| 4 | +import { ContainerStepComponentViewConfiguration } from './container-step-component-view-configuration'; |
4 | 5 | import { ContainerStepExtensionConfiguration } from './container-step-extension-configuration'; |
5 | 6 |
|
6 | | -const defaultConfiguration: ContainerStepExtensionConfiguration = { |
7 | | - view: { |
8 | | - paddingTop: 20, |
9 | | - paddingX: 20, |
10 | | - inputSize: 18, |
11 | | - inputRadius: 4, |
12 | | - inputIconSize: 14, |
13 | | - autoHideInputOnDrag: true, |
14 | | - isRegionClickable: true, |
15 | | - label: { |
16 | | - height: 22, |
17 | | - paddingX: 10, |
18 | | - minWidth: 50, |
19 | | - radius: 10 |
20 | | - } |
| 7 | +const defaultViewConfiguration: ContainerStepComponentViewConfiguration = { |
| 8 | + paddingTop: 20, |
| 9 | + paddingX: 20, |
| 10 | + inputSize: 18, |
| 11 | + inputRadius: 4, |
| 12 | + inputIconSize: 14, |
| 13 | + autoHideInputOnDrag: true, |
| 14 | + isRegionClickable: true, |
| 15 | + label: { |
| 16 | + height: 22, |
| 17 | + paddingX: 10, |
| 18 | + minWidth: 50, |
| 19 | + radius: 10 |
21 | 20 | } |
22 | 21 | }; |
23 | 22 |
|
24 | 23 | export class ContainerStepExtension implements StepExtension<SequentialStep> { |
25 | 24 | public static create(configuration?: ContainerStepExtensionConfiguration): ContainerStepExtension { |
26 | | - return new ContainerStepExtension(configuration ?? defaultConfiguration); |
| 25 | + return new ContainerStepExtension(configuration); |
27 | 26 | } |
28 | 27 |
|
29 | | - public readonly componentType = 'container'; |
| 28 | + public readonly componentType = this.configuration?.componentType ?? 'container'; |
30 | 29 |
|
31 | | - private constructor(private readonly configuration: ContainerStepExtensionConfiguration) {} |
| 30 | + private constructor(private readonly configuration: ContainerStepExtensionConfiguration | undefined) {} |
32 | 31 |
|
33 | | - public readonly createComponentView = createContainerStepComponentViewFactory(this.configuration.view); |
| 32 | + public readonly createComponentView = createContainerStepComponentViewFactory(this.configuration?.view ?? defaultViewConfiguration); |
34 | 33 | } |
0 commit comments