@ngx-formbar/core 1.0.0 → 2.0.0-next.1
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.
- package/README.md +2 -34
- package/fesm2022/ngx-formbar-core.mjs +225 -1658
- package/fesm2022/ngx-formbar-core.mjs.map +1 -1
- package/package.json +5 -12
- package/types/ngx-formbar-core.d.ts +525 -0
- package/LICENSE +0 -21
- package/index.d.ts +0 -5
- package/lib/components/form/ngxfb-form.component.d.ts +0 -28
- package/lib/composables/computed-value.d.ts +0 -8
- package/lib/composables/disabled.state.d.ts +0 -36
- package/lib/composables/dynamic-label.d.ts +0 -9
- package/lib/composables/dynamic-title.d.ts +0 -9
- package/lib/composables/hidden.state.d.ts +0 -68
- package/lib/composables/readonly.state.d.ts +0 -19
- package/lib/composables/testId.d.ts +0 -16
- package/lib/composables/update-strategy.d.ts +0 -20
- package/lib/composables/validators.d.ts +0 -22
- package/lib/config/config.d.ts +0 -7
- package/lib/config/provide-formbar.d.ts +0 -38
- package/lib/directives/ngxfb-abstract-control.directive.d.ts +0 -53
- package/lib/directives/ngxfb-block.directive.d.ts +0 -124
- package/lib/directives/ngxfb-control.directive.d.ts +0 -203
- package/lib/directives/ngxfb-group.directive.d.ts +0 -253
- package/lib/helper/control-container-view-providers.d.ts +0 -33
- package/lib/index.d.ts +0 -23
- package/lib/services/component-registration.service.d.ts +0 -8
- package/lib/services/configuration.service.d.ts +0 -8
- package/lib/services/expression.service.d.ts +0 -148
- package/lib/services/form.service.d.ts +0 -10
- package/lib/services/validator-registration.service.d.ts +0 -10
- package/lib/tokens/component-registrations.d.ts +0 -2
- package/lib/tokens/component-resolver.d.ts +0 -3
- package/lib/tokens/default-update-strategy.d.ts +0 -3
- package/lib/tokens/global-config.d.ts +0 -5
- package/lib/tokens/validator-registrations.d.ts +0 -8
- package/lib/tokens/validator-resolver.d.ts +0 -3
- package/lib/types/component-resolver.type.d.ts +0 -4
- package/lib/types/content.type.d.ts +0 -137
- package/lib/types/expression.type.d.ts +0 -2
- package/lib/types/form.type.d.ts +0 -4
- package/lib/types/functions.type.d.ts +0 -4
- package/lib/types/global-configuration.type.d.ts +0 -4
- package/lib/types/provide.type.d.ts +0 -42
- package/lib/types/registration.type.d.ts +0 -18
- package/lib/types/validation.type.d.ts +0 -59
- package/lib/types/validator-resolver.type.d.ts +0 -6
- package/public-api.d.ts +0 -1
- package/schematics/block/files/__componentName@dasherize__.component.html.template +0 -1
- package/schematics/block/files/__componentName@dasherize__.component.ts.template +0 -29
- package/schematics/block/files/__interfaceName@dasherize__.type.ts.template +0 -6
- package/schematics/block/index.d.ts +0 -3
- package/schematics/block/index.js +0 -11
- package/schematics/block/index.js.map +0 -1
- package/schematics/block/schema.json +0 -62
- package/schematics/collection.json +0 -31
- package/schematics/control/files/__componentName@dasherize__.component.html.template +0 -0
- package/schematics/control/files/__componentName@dasherize__.component.ts.template +0 -29
- package/schematics/control/files/__interfaceName@dasherize__.type.ts.template +0 -6
- package/schematics/control/index.d.ts +0 -3
- package/schematics/control/index.js +0 -11
- package/schematics/control/index.js.map +0 -1
- package/schematics/control/schema.json +0 -61
- package/schematics/group/files/__componentName@dasherize__.component.html.template +0 -5
- package/schematics/group/files/__componentName@dasherize__.component.ts.template +0 -29
- package/schematics/group/files/__interfaceName@dasherize__.type.ts.template +0 -5
- package/schematics/group/index.d.ts +0 -3
- package/schematics/group/index.js +0 -11
- package/schematics/group/index.js.map +0 -1
- package/schematics/group/schema.json +0 -62
- package/schematics/ng-add/files/config-registrations/async-validator-registrations.ts.template +0 -4
- package/schematics/ng-add/files/config-registrations/component-registrations.ts.template +0 -4
- package/schematics/ng-add/files/config-registrations/index.ts.template +0 -3
- package/schematics/ng-add/files/config-registrations/validator-registrations.ts.template +0 -4
- package/schematics/ng-add/files/helper/block.host-directive.ts.template +0 -6
- package/schematics/ng-add/files/helper/control.host-directive.ts.template +0 -6
- package/schematics/ng-add/files/helper/group.host-directive.ts.template +0 -6
- package/schematics/ng-add/files/helper/index.ts.template +0 -4
- package/schematics/ng-add/files/helper/view-provider.ts.template +0 -9
- package/schematics/ng-add/files/provider-config/config/__providerConfigFileName__.ts.template +0 -9
- package/schematics/ng-add/files/provider-config/inline/__providerConfigFileName__.ts.template +0 -8
- package/schematics/ng-add/files/provider-config/token/__providerConfigFileName__.ts.template +0 -4
- package/schematics/ng-add/files/schematics-config/__schematicConfigFileName__.json.template +0 -1
- package/schematics/ng-add/files/token-registrations/async-validator-registrations.ts.template +0 -8
- package/schematics/ng-add/files/token-registrations/component-registrations.ts.template +0 -8
- package/schematics/ng-add/files/token-registrations/index.ts.template +0 -3
- package/schematics/ng-add/files/token-registrations/validator-registrations.ts.template +0 -8
- package/schematics/ng-add/helper.d.ts +0 -11
- package/schematics/ng-add/helper.js +0 -198
- package/schematics/ng-add/helper.js.map +0 -1
- package/schematics/ng-add/index.d.ts +0 -3
- package/schematics/ng-add/index.js +0 -68
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/ng-add/rules/create-config-registration-files.rule.d.ts +0 -3
- package/schematics/ng-add/rules/create-config-registration-files.rule.js +0 -32
- package/schematics/ng-add/rules/create-config-registration-files.rule.js.map +0 -1
- package/schematics/ng-add/rules/create-formbar-registration-config.rule.d.ts +0 -3
- package/schematics/ng-add/rules/create-formbar-registration-config.rule.js +0 -30
- package/schematics/ng-add/rules/create-formbar-registration-config.rule.js.map +0 -1
- package/schematics/ng-add/rules/create-helper-files.rule.d.ts +0 -6
- package/schematics/ng-add/rules/create-helper-files.rule.js +0 -22
- package/schematics/ng-add/rules/create-helper-files.rule.js.map +0 -1
- package/schematics/ng-add/rules/create-schematics-config.rule.d.ts +0 -3
- package/schematics/ng-add/rules/create-schematics-config.rule.js +0 -42
- package/schematics/ng-add/rules/create-schematics-config.rule.js.map +0 -1
- package/schematics/ng-add/rules/create-token-registration-files.rule.d.ts +0 -3
- package/schematics/ng-add/rules/create-token-registration-files.rule.js +0 -32
- package/schematics/ng-add/rules/create-token-registration-files.rule.js.map +0 -1
- package/schematics/ng-add/rules/include-templates.rule.d.ts +0 -3
- package/schematics/ng-add/rules/include-templates.rule.js +0 -11
- package/schematics/ng-add/rules/include-templates.rule.js.map +0 -1
- package/schematics/ng-add/rules/install-dependencies.rule.d.ts +0 -2
- package/schematics/ng-add/rules/install-dependencies.rule.js +0 -12
- package/schematics/ng-add/rules/install-dependencies.rule.js.map +0 -1
- package/schematics/ng-add/rules/update-app-config.rule.d.ts +0 -3
- package/schematics/ng-add/rules/update-app-config.rule.js +0 -49
- package/schematics/ng-add/rules/update-app-config.rule.js.map +0 -1
- package/schematics/ng-add/rules/update-schematics-config.rule.d.ts +0 -6
- package/schematics/ng-add/rules/update-schematics-config.rule.js +0 -28
- package/schematics/ng-add/rules/update-schematics-config.rule.js.map +0 -1
- package/schematics/ng-add/schema.d.ts +0 -23
- package/schematics/ng-add/schema.js +0 -3
- package/schematics/ng-add/schema.js.map +0 -1
- package/schematics/ng-add/schema.json +0 -81
- package/schematics/register/component-info.type.d.ts +0 -11
- package/schematics/register/component-info.type.js +0 -3
- package/schematics/register/component-info.type.js.map +0 -1
- package/schematics/register/discover-components.d.ts +0 -19
- package/schematics/register/discover-components.js +0 -267
- package/schematics/register/discover-components.js.map +0 -1
- package/schematics/register/index.d.ts +0 -3
- package/schematics/register/index.js +0 -49
- package/schematics/register/index.js.map +0 -1
- package/schematics/register/register-components.d.ts +0 -3
- package/schematics/register/register-components.js +0 -38
- package/schematics/register/register-components.js.map +0 -1
- package/schematics/register/schema.d.ts +0 -14
- package/schematics/register/schema.js +0 -3
- package/schematics/register/schema.js.map +0 -1
- package/schematics/register/schema.json +0 -44
- package/schematics/shared/ast/decorators.d.ts +0 -9
- package/schematics/shared/ast/decorators.js +0 -182
- package/schematics/shared/ast/decorators.js.map +0 -1
- package/schematics/shared/ast/imports.d.ts +0 -3
- package/schematics/shared/ast/imports.js +0 -93
- package/schematics/shared/ast/imports.js.map +0 -1
- package/schematics/shared/ast/parse.d.ts +0 -3
- package/schematics/shared/ast/parse.js +0 -17
- package/schematics/shared/ast/parse.js.map +0 -1
- package/schematics/shared/ast/registrations.d.ts +0 -22
- package/schematics/shared/ast/registrations.js +0 -654
- package/schematics/shared/ast/registrations.js.map +0 -1
- package/schematics/shared/ast/types.d.ts +0 -3
- package/schematics/shared/ast/types.js +0 -58
- package/schematics/shared/ast/types.js.map +0 -1
- package/schematics/shared/file.d.ts +0 -4
- package/schematics/shared/file.js +0 -60
- package/schematics/shared/file.js.map +0 -1
- package/schematics/shared/helper.d.ts +0 -2
- package/schematics/shared/helper.js +0 -29
- package/schematics/shared/helper.js.map +0 -1
- package/schematics/shared/rules/create-component.rule.d.ts +0 -3
- package/schematics/shared/rules/create-component.rule.js +0 -15
- package/schematics/shared/rules/create-component.rule.js.map +0 -1
- package/schematics/shared/rules/register-control.rule.d.ts +0 -3
- package/schematics/shared/rules/register-control.rule.js +0 -30
- package/schematics/shared/rules/register-control.rule.js.map +0 -1
- package/schematics/shared/rules/register-type-map.rule.d.ts +0 -3
- package/schematics/shared/rules/register-type-map.rule.js +0 -46
- package/schematics/shared/rules/register-type-map.rule.js.map +0 -1
- package/schematics/shared/rules/register-type-token.rule.d.ts +0 -3
- package/schematics/shared/rules/register-type-token.rule.js +0 -49
- package/schematics/shared/rules/register-type-token.rule.js.map +0 -1
- package/schematics/shared/rules/scaffold-and-register.rule.d.ts +0 -3
- package/schematics/shared/rules/scaffold-and-register.rule.js +0 -134
- package/schematics/shared/rules/scaffold-and-register.rule.js.map +0 -1
- package/schematics/shared/schema.d.ts +0 -32
- package/schematics/shared/schema.js +0 -3
- package/schematics/shared/schema.js.map +0 -1
- package/schematics/tests/generators.spec.d.ts +0 -1
- package/schematics/tests/generators.spec.js +0 -450
- package/schematics/tests/generators.spec.js.map +0 -1
- package/schematics/tests/helper.d.ts +0 -20
- package/schematics/tests/helper.js +0 -275
- package/schematics/tests/helper.js.map +0 -1
- package/schematics/tests/ng-add.spec.d.ts +0 -1
- package/schematics/tests/ng-add.spec.js +0 -380
- package/schematics/tests/ng-add.spec.js.map +0 -1
- package/schematics/tests/register.spec.d.ts +0 -1
- package/schematics/tests/register.spec.js +0 -340
- package/schematics/tests/register.spec.js.map +0 -1
- package/schematics/tests/workspace-setup.d.ts +0 -21
- package/schematics/tests/workspace-setup.js +0 -256
- package/schematics/tests/workspace-setup.js.map +0 -1
- package/shared/ast.d.ts +0 -10
- package/shared/ast.js +0 -93
- package/shared/ast.js.map +0 -1
- package/shared/constants.d.ts +0 -16
- package/shared/constants.js +0 -20
- package/shared/constants.js.map +0 -1
- package/shared/shared-config.type.d.ts +0 -20
- package/shared/shared-config.type.js +0 -3
- package/shared/shared-config.type.js.map +0 -1
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const vitest_1 = require("vitest");
|
|
13
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
14
|
-
const workspace_setup_1 = require("./workspace-setup");
|
|
15
|
-
const helper_1 = require("./helper");
|
|
16
|
-
const find_module_1 = require("@schematics/angular/utility/find-module");
|
|
17
|
-
const registrations_1 = require("../shared/ast/registrations");
|
|
18
|
-
const parse_1 = require("../shared/ast/parse");
|
|
19
|
-
const imports_1 = require("../shared/ast/imports");
|
|
20
|
-
(0, vitest_1.describe)('register schematic', () => {
|
|
21
|
-
let appTree;
|
|
22
|
-
let runner;
|
|
23
|
-
const baseOptions = {
|
|
24
|
-
project: 'test-app',
|
|
25
|
-
};
|
|
26
|
-
const appConfigPathRaw = 'app.config.ts';
|
|
27
|
-
const formbarConfigPath = 'app/formbar.config.ts';
|
|
28
|
-
const schematicsConfigPath = 'app/formbar.config.json';
|
|
29
|
-
const registrationsPath = 'app/registrations/component-registrations.ts';
|
|
30
|
-
function runSchematic() {
|
|
31
|
-
return __awaiter(this, arguments, void 0, function* (options = {}) {
|
|
32
|
-
return runner.runSchematic('register', Object.assign(Object.assign({}, baseOptions), options), appTree);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
(0, vitest_1.beforeEach)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
-
runner = new testing_1.SchematicTestRunner('schematics', workspace_setup_1.COLLECTION_PATH);
|
|
37
|
-
appTree = yield (0, workspace_setup_1.setupWorkspace)(runner);
|
|
38
|
-
}));
|
|
39
|
-
it('finds and registers components anywhere, with and without helper', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
-
const files = [
|
|
41
|
-
{
|
|
42
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
43
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
44
|
-
className: 'InlineComponent',
|
|
45
|
-
key: 'inline',
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
path: (0, helper_1.app)('components/form/controls/helper.component.ts'),
|
|
49
|
-
content: (0, workspace_setup_1.createControlComponent)('helper', workspace_setup_1.helperProviders, 'HelperComponent'),
|
|
50
|
-
className: 'HelperComponent',
|
|
51
|
-
key: 'helper',
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
path: (0, helper_1.app)('features/account/profile/controls/profile-inline.component.ts'),
|
|
55
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-inline', workspace_setup_1.inlineProviders, 'ProfileInlineComponent'),
|
|
56
|
-
className: 'ProfileInlineComponent',
|
|
57
|
-
key: 'profile-inline',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
path: (0, helper_1.app)('features/account/profile/controls/profile-helper.component.ts'),
|
|
61
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'ProfileHelperComponent'),
|
|
62
|
-
className: 'ProfileHelperComponent',
|
|
63
|
-
key: 'profile-helper',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
path: (0, helper_1.app)('root-inline.component.ts'),
|
|
67
|
-
content: (0, workspace_setup_1.createControlComponent)('root-inline', workspace_setup_1.inlineProviders, 'RootInlineComponent'),
|
|
68
|
-
className: 'RootInlineComponent',
|
|
69
|
-
key: 'root-inline',
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
path: (0, helper_1.app)('root-helper.component.ts'),
|
|
73
|
-
content: (0, workspace_setup_1.createControlComponent)('root-helper', workspace_setup_1.helperProviders, 'RootHelperComponent'),
|
|
74
|
-
className: 'RootHelperComponent',
|
|
75
|
-
key: 'root-helper',
|
|
76
|
-
},
|
|
77
|
-
];
|
|
78
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
79
|
-
(0, workspace_setup_1.provideToken)(appTree, appConfigPathRaw, registrationsPath);
|
|
80
|
-
const tree = yield runSchematic();
|
|
81
|
-
assertRegisteredComponents(tree, files, (0, helper_1.src)(registrationsPath), registrations_1.componentRegistrationsMapProviderHasIdentifier);
|
|
82
|
-
}));
|
|
83
|
-
it('ignores invalid components', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
const files = [
|
|
85
|
-
{
|
|
86
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
87
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
88
|
-
className: 'InlineComponent',
|
|
89
|
-
key: 'inline',
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
path: (0, helper_1.app)('components/form/controls/helper.component.ts'),
|
|
93
|
-
content: (0, workspace_setup_1.createUnrelatedComponent)('helper', 'HelperComponent'),
|
|
94
|
-
className: 'HelperComponent',
|
|
95
|
-
key: 'helper',
|
|
96
|
-
shouldRegister: false,
|
|
97
|
-
},
|
|
98
|
-
];
|
|
99
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
100
|
-
(0, workspace_setup_1.provideToken)(appTree, appConfigPathRaw, registrationsPath);
|
|
101
|
-
const tree = yield runSchematic();
|
|
102
|
-
assertRegisteredComponents(tree, files, (0, helper_1.src)(registrationsPath), registrations_1.componentRegistrationsMapProviderHasIdentifier);
|
|
103
|
-
}));
|
|
104
|
-
it('respects exclude pattern', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
105
|
-
const files = [
|
|
106
|
-
{
|
|
107
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
108
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
109
|
-
className: 'InlineComponent',
|
|
110
|
-
key: 'inline',
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
path: (0, helper_1.app)('components/form/controls/helper.component.ts'),
|
|
114
|
-
content: (0, workspace_setup_1.createControlComponent)('helper', workspace_setup_1.helperProviders, 'HelperComponent'),
|
|
115
|
-
className: 'HelperComponent',
|
|
116
|
-
key: 'helper',
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
path: (0, helper_1.app)('features/account/profile/controls/profile-inline.component.ts'),
|
|
120
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-inline', workspace_setup_1.inlineProviders, 'ProfileInlineComponent'),
|
|
121
|
-
className: 'ProfileInlineComponent',
|
|
122
|
-
key: 'profile-inline',
|
|
123
|
-
shouldRegister: false,
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
path: (0, helper_1.app)('features/account/profile/controls/profile-helper.component.ts'),
|
|
127
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'ProfileHelperComponent'),
|
|
128
|
-
className: 'ProfileHelperComponent',
|
|
129
|
-
key: 'profile-helper',
|
|
130
|
-
shouldRegister: false,
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
path: (0, helper_1.app)('features/login/controls/password-input.component.ts'),
|
|
134
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'PasswordInputComponent'),
|
|
135
|
-
className: 'PasswordInputComponent',
|
|
136
|
-
key: 'password-input',
|
|
137
|
-
shouldRegister: false,
|
|
138
|
-
},
|
|
139
|
-
];
|
|
140
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
141
|
-
(0, workspace_setup_1.provideToken)(appTree, appConfigPathRaw, registrationsPath);
|
|
142
|
-
const tree = yield runSchematic({
|
|
143
|
-
exclude: ['**/account/**', (0, helper_1.app)('features/login/controls/**')],
|
|
144
|
-
});
|
|
145
|
-
assertRegisteredComponents(tree, files, (0, helper_1.src)(registrationsPath), registrations_1.componentRegistrationsMapProviderHasIdentifier);
|
|
146
|
-
}));
|
|
147
|
-
it('respects exclude pattern', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
148
|
-
const files = [
|
|
149
|
-
{
|
|
150
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
151
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
152
|
-
className: 'InlineComponent',
|
|
153
|
-
key: 'inline',
|
|
154
|
-
shouldRegister: false,
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
path: (0, helper_1.app)('components/form/controls/helper.component.ts'),
|
|
158
|
-
content: (0, workspace_setup_1.createControlComponent)('helper', workspace_setup_1.helperProviders, 'HelperComponent'),
|
|
159
|
-
className: 'HelperComponent',
|
|
160
|
-
key: 'helper',
|
|
161
|
-
shouldRegister: false,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
path: (0, helper_1.app)('features/account/profile/controls/profile-inline.component.ts'),
|
|
165
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-inline', workspace_setup_1.inlineProviders, 'ProfileInlineComponent'),
|
|
166
|
-
className: 'ProfileInlineComponent',
|
|
167
|
-
key: 'profile-inline',
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
path: (0, helper_1.app)('features/account/profile/controls/profile-helper.component.ts'),
|
|
171
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'ProfileHelperComponent'),
|
|
172
|
-
className: 'ProfileHelperComponent',
|
|
173
|
-
key: 'profile-helper',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
path: (0, helper_1.app)('features/login/controls/password-input.component.ts'),
|
|
177
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'PasswordInputComponent'),
|
|
178
|
-
className: 'PasswordInputComponent',
|
|
179
|
-
key: 'password-input',
|
|
180
|
-
shouldRegister: false,
|
|
181
|
-
},
|
|
182
|
-
];
|
|
183
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
184
|
-
(0, workspace_setup_1.provideToken)(appTree, appConfigPathRaw, registrationsPath);
|
|
185
|
-
const tree = yield runSchematic({
|
|
186
|
-
include: ['**/account/**'],
|
|
187
|
-
});
|
|
188
|
-
assertRegisteredComponents(tree, files, (0, helper_1.src)(registrationsPath), registrations_1.componentRegistrationsMapProviderHasIdentifier);
|
|
189
|
-
}));
|
|
190
|
-
it('registers components with the same name safely', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
191
|
-
const files = [
|
|
192
|
-
{
|
|
193
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
194
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
195
|
-
className: 'InlineComponent',
|
|
196
|
-
key: 'inline',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
path: (0, helper_1.app)('features/account/profile/controls/inline.component.ts'),
|
|
200
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
201
|
-
className: 'InlineComponent',
|
|
202
|
-
key: 'inline',
|
|
203
|
-
},
|
|
204
|
-
];
|
|
205
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
206
|
-
(0, workspace_setup_1.provideToken)(appTree, appConfigPathRaw, registrationsPath);
|
|
207
|
-
const tree = yield runSchematic();
|
|
208
|
-
const componentRegistrationsSf = (0, parse_1.parseTS)((0, helper_1.read)(tree, (0, helper_1.src)(registrationsPath)));
|
|
209
|
-
const controlsImportPath = (0, find_module_1.buildRelativePath)((0, helper_1.src)(registrationsPath), (0, helper_1.app)('components/form/controls/inline.component.ts')).replace('.ts', '');
|
|
210
|
-
const featureImportPath = (0, find_module_1.buildRelativePath)((0, helper_1.src)(registrationsPath), (0, helper_1.app)('features/account/profile/controls/inline.component.ts')).replace('.ts', '');
|
|
211
|
-
const controlImportCount = (0, helper_1.countNamedImport)(componentRegistrationsSf, controlsImportPath, 'InlineComponent');
|
|
212
|
-
const featureImportCount = (0, helper_1.countNamedImport)(componentRegistrationsSf, featureImportPath, 'InlineComponent');
|
|
213
|
-
const registrationsCount = (0, helper_1.countComponentRegistrationsMapProviderIdentifier)(componentRegistrationsSf, 'inline', 'InlineComponent');
|
|
214
|
-
(0, vitest_1.expect)(controlImportCount).toBe(1);
|
|
215
|
-
(0, vitest_1.expect)(featureImportCount).toBe(0);
|
|
216
|
-
(0, vitest_1.expect)(registrationsCount).toBe(1);
|
|
217
|
-
}));
|
|
218
|
-
it('does not duplicate registrations, if user already registered component under different key', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
219
|
-
const files = [
|
|
220
|
-
{
|
|
221
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
222
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
223
|
-
className: 'InlineComponent',
|
|
224
|
-
key: 'inline',
|
|
225
|
-
},
|
|
226
|
-
];
|
|
227
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
228
|
-
const controlsImportPath = (0, find_module_1.buildRelativePath)((0, helper_1.src)(registrationsPath), (0, helper_1.app)('components/form/controls/inline.component.ts')).replace('.ts', '');
|
|
229
|
-
(0, workspace_setup_1.provideToken)(appTree, appConfigPathRaw, registrationsPath, '["some-key", InlineComponent]', `import { InlineComponent } from '${controlsImportPath}'`);
|
|
230
|
-
const tree = yield runSchematic();
|
|
231
|
-
const componentRegistrationsSf = (0, parse_1.parseTS)((0, helper_1.read)(tree, (0, helper_1.src)(registrationsPath)));
|
|
232
|
-
const controlImportCount = (0, helper_1.countNamedImport)(componentRegistrationsSf, controlsImportPath, 'InlineComponent');
|
|
233
|
-
const newRegistrationsCount = (0, helper_1.countComponentRegistrationsMapProviderIdentifier)(componentRegistrationsSf, 'inline', 'InlineComponent');
|
|
234
|
-
const existingRegistrationsCount = (0, helper_1.countComponentRegistrationsMapProviderIdentifier)(componentRegistrationsSf, 'some-key', 'InlineComponent');
|
|
235
|
-
(0, vitest_1.expect)(controlImportCount).toBe(1);
|
|
236
|
-
(0, vitest_1.expect)(newRegistrationsCount).toBe(0);
|
|
237
|
-
(0, vitest_1.expect)(existingRegistrationsCount).toBe(1);
|
|
238
|
-
}));
|
|
239
|
-
it('uses schematics config file when passed as parameter', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
240
|
-
const files = [
|
|
241
|
-
{
|
|
242
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
243
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
244
|
-
className: 'InlineComponent',
|
|
245
|
-
key: 'inline',
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
path: (0, helper_1.app)('components/form/controls/helper.component.ts'),
|
|
249
|
-
content: (0, workspace_setup_1.createControlComponent)('helper', workspace_setup_1.helperProviders, 'HelperComponent'),
|
|
250
|
-
className: 'HelperComponent',
|
|
251
|
-
key: 'helper',
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
path: (0, helper_1.app)('components/form/controls/secret/secret.component.ts'),
|
|
255
|
-
content: (0, workspace_setup_1.createControlComponent)('secret', workspace_setup_1.helperProviders, 'SecretComponent'),
|
|
256
|
-
className: 'SecretComponent',
|
|
257
|
-
key: 'secret',
|
|
258
|
-
shouldRegister: false,
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
path: (0, helper_1.app)('features/login/controls/password-input.component.ts'),
|
|
262
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'PasswordInputComponent'),
|
|
263
|
-
className: 'PasswordInputComponent',
|
|
264
|
-
key: 'password-input',
|
|
265
|
-
shouldRegister: false,
|
|
266
|
-
},
|
|
267
|
-
];
|
|
268
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
269
|
-
const schematicsConfig = 'configurations/formbar.config.json';
|
|
270
|
-
const nonDefaultRegistrationsPath = 'app/feature/survey/form/component-registrations.ts';
|
|
271
|
-
const config = {
|
|
272
|
-
registrationType: 'config',
|
|
273
|
-
controlRegistrationsPath: nonDefaultRegistrationsPath,
|
|
274
|
-
discovery: {
|
|
275
|
-
include: ['**/components/form/controls/**'],
|
|
276
|
-
exclude: ['**/components/form/controls/secret/**'],
|
|
277
|
-
},
|
|
278
|
-
};
|
|
279
|
-
(0, helper_1.writeJson)(appTree, (0, helper_1.src)(schematicsConfig), config);
|
|
280
|
-
(0, workspace_setup_1.provideMap)(appTree, appConfigPathRaw, nonDefaultRegistrationsPath, formbarConfigPath);
|
|
281
|
-
const tree = yield runSchematic({
|
|
282
|
-
schematicsConfig,
|
|
283
|
-
});
|
|
284
|
-
assertRegisteredComponents(tree, files, (0, helper_1.src)(nonDefaultRegistrationsPath), registrations_1.directComponentRegistrationsHasIdentifier);
|
|
285
|
-
}));
|
|
286
|
-
it('finds schematics config file if no parameter was passed', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
287
|
-
const files = [
|
|
288
|
-
{
|
|
289
|
-
path: (0, helper_1.app)('components/form/controls/inline.component.ts'),
|
|
290
|
-
content: (0, workspace_setup_1.createControlComponent)('inline', workspace_setup_1.inlineProviders, 'InlineComponent'),
|
|
291
|
-
className: 'InlineComponent',
|
|
292
|
-
key: 'inline',
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
path: (0, helper_1.app)('components/form/controls/helper.component.ts'),
|
|
296
|
-
content: (0, workspace_setup_1.createControlComponent)('helper', workspace_setup_1.helperProviders, 'HelperComponent'),
|
|
297
|
-
className: 'HelperComponent',
|
|
298
|
-
key: 'helper',
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
path: (0, helper_1.app)('components/form/controls/secret/secret.component.ts'),
|
|
302
|
-
content: (0, workspace_setup_1.createControlComponent)('secret', workspace_setup_1.helperProviders, 'SecretComponent'),
|
|
303
|
-
className: 'SecretComponent',
|
|
304
|
-
key: 'secret',
|
|
305
|
-
shouldRegister: false,
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
path: (0, helper_1.app)('features/login/controls/password-input.component.ts'),
|
|
309
|
-
content: (0, workspace_setup_1.createControlComponent)('profile-helper', workspace_setup_1.helperProviders, 'PasswordInputComponent'),
|
|
310
|
-
className: 'PasswordInputComponent',
|
|
311
|
-
key: 'password-input',
|
|
312
|
-
shouldRegister: false,
|
|
313
|
-
},
|
|
314
|
-
];
|
|
315
|
-
(0, workspace_setup_1.addComponentFiles)(appTree, files);
|
|
316
|
-
const config = {
|
|
317
|
-
registrationType: 'config',
|
|
318
|
-
discovery: {
|
|
319
|
-
include: ['**/components/form/controls/**'],
|
|
320
|
-
exclude: ['**/components/form/controls/secret/**'],
|
|
321
|
-
},
|
|
322
|
-
};
|
|
323
|
-
(0, helper_1.writeJson)(appTree, (0, helper_1.src)(schematicsConfigPath), config);
|
|
324
|
-
(0, workspace_setup_1.provideMap)(appTree, appConfigPathRaw, registrationsPath, formbarConfigPath);
|
|
325
|
-
const tree = yield runSchematic();
|
|
326
|
-
assertRegisteredComponents(tree, files, (0, helper_1.src)(registrationsPath), registrations_1.directComponentRegistrationsHasIdentifier);
|
|
327
|
-
}));
|
|
328
|
-
});
|
|
329
|
-
function assertRegisteredComponents(tree, files, registrationsPath, hasRegistrationFn) {
|
|
330
|
-
const componentRegistrationsSf = (0, parse_1.parseTS)((0, helper_1.read)(tree, registrationsPath));
|
|
331
|
-
(0, helper_1.forEachAtLeastOnce)(files, ({ path, className, key, shouldRegister = true }) => {
|
|
332
|
-
const componentImportPath = (0, find_module_1.buildRelativePath)(registrationsPath, path).replace('.ts', '');
|
|
333
|
-
const importsComponent = (0, imports_1.hasNamedImport)(componentRegistrationsSf, componentImportPath, className);
|
|
334
|
-
const hasRegistration = hasRegistrationFn(componentRegistrationsSf, key, className);
|
|
335
|
-
const message = `${className} - ${key} - ${shouldRegister.toString()}`;
|
|
336
|
-
(0, vitest_1.expect)(importsComponent, message).toBe(shouldRegister);
|
|
337
|
-
(0, vitest_1.expect)(hasRegistration, message).toBe(shouldRegister);
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
//# sourceMappingURL=register.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"register.spec.js","sourceRoot":"","sources":["../../../../projects/core/automation/schematics/tests/register.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAsD;AACtD,gEAAuF;AAEvF,uDAW2B;AAC3B,qCAQkB;AAElB,yEAA4E;AAE5E,+DAGqC;AACrC,+CAA8C;AAC9C,mDAAuD;AAGvD,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAA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CAAC,CAAC,CAAC;IAExE,IAAA,2BAAkB,EAChB,KAAK,EACL,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,EAAE,EAAE,EAAE;QAClD,MAAM,mBAAmB,GAAG,IAAA,+BAAiB,EAC3C,iBAAiB,EACjB,IAAI,CACL,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAErB,MAAM,gBAAgB,GAAG,IAAA,wBAAc,EACrC,wBAAwB,EACxB,mBAAmB,EACnB,SAAS,CACV,CAAC;QACF,MAAM,eAAe,GAAG,iBAAiB,CACvC,wBAAwB,EACxB,GAAG,EACH,SAAS,CACV,CAAC;QACF,MAAM,OAAO,GAAG,GAAG,SAAS,MAAM,GAAG,MAAM,cAAc,CAAC,QAAQ,EAAE,EAAE,CAAC;QACvE,IAAA,eAAM,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvD,IAAA,eAAM,EAAC,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACxD,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
export declare const COLLECTION_PATH: string;
|
|
3
|
-
export declare function setupWorkspace(runner: SchematicTestRunner): Promise<UnitTestTree>;
|
|
4
|
-
export declare function provideToken(appTree: UnitTestTree, appConfigPathRaw: string, registrationsPath: string, initialRegistrations?: string, initialImports?: string): void;
|
|
5
|
-
export declare function provideTokenNoSplit(appTree: UnitTestTree, appConfigPathRaw: string, initialRegistrations?: string, initialImports?: string): void;
|
|
6
|
-
export declare function provideMapInlineNoSplit(appTree: UnitTestTree, appConfigPathRaw: string, initialRegistrations?: string, initialImports?: string): void;
|
|
7
|
-
export declare function provideMap(appTree: UnitTestTree, appConfigPathRaw: string, registrationsPath: string, formbarConfigPath: string, initialRegistrations?: string, initialImports?: string): void;
|
|
8
|
-
export declare function provideMapNoSplit(appTree: UnitTestTree, appConfigPathRaw: string, formbarConfigPath: string, initialRegistrations?: string, initialImports?: string): void;
|
|
9
|
-
export declare function addHelperIndexFile(appTree: UnitTestTree, helperPath: string): void;
|
|
10
|
-
export declare function addComponentFiles(appTree: UnitTestTree, files: TestComponentDetails[]): void;
|
|
11
|
-
export declare function createControlComponent(name: string, providersAndImports: [string, string], className: string): string;
|
|
12
|
-
export type TestComponentDetails = {
|
|
13
|
-
path: string;
|
|
14
|
-
content: string;
|
|
15
|
-
className: string;
|
|
16
|
-
key: string;
|
|
17
|
-
shouldRegister?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare const inlineProviders: [string, string];
|
|
20
|
-
export declare const helperProviders: [string, string];
|
|
21
|
-
export declare function createUnrelatedComponent(name: string, className: string): string;
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.helperProviders = exports.inlineProviders = exports.COLLECTION_PATH = void 0;
|
|
13
|
-
exports.setupWorkspace = setupWorkspace;
|
|
14
|
-
exports.provideToken = provideToken;
|
|
15
|
-
exports.provideTokenNoSplit = provideTokenNoSplit;
|
|
16
|
-
exports.provideMapInlineNoSplit = provideMapInlineNoSplit;
|
|
17
|
-
exports.provideMap = provideMap;
|
|
18
|
-
exports.provideMapNoSplit = provideMapNoSplit;
|
|
19
|
-
exports.addHelperIndexFile = addHelperIndexFile;
|
|
20
|
-
exports.addComponentFiles = addComponentFiles;
|
|
21
|
-
exports.createControlComponent = createControlComponent;
|
|
22
|
-
exports.createUnrelatedComponent = createUnrelatedComponent;
|
|
23
|
-
const path_1 = require("path");
|
|
24
|
-
const helper_1 = require("./helper");
|
|
25
|
-
const strings_1 = require("@angular-devkit/core/src/utils/strings");
|
|
26
|
-
const constants_1 = require("../../shared/constants");
|
|
27
|
-
exports.COLLECTION_PATH = (0, path_1.join)(__dirname, '../../../../../dist/core/schematics/collection.json');
|
|
28
|
-
function setupWorkspace(runner) {
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const workspaceOptions = {
|
|
31
|
-
name: 'workspace',
|
|
32
|
-
version: '19.0.0',
|
|
33
|
-
newProjectRoot: 'projects',
|
|
34
|
-
};
|
|
35
|
-
const workspaceTree = yield runner.runExternalSchematic('@schematics/angular', 'workspace', workspaceOptions);
|
|
36
|
-
const appOptions = {
|
|
37
|
-
name: 'test-app',
|
|
38
|
-
standalone: true,
|
|
39
|
-
};
|
|
40
|
-
return yield runner.runExternalSchematic('@schematics/angular', 'application', appOptions, workspaceTree);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function provideToken(appTree, appConfigPathRaw, registrationsPath, initialRegistrations = '', initialImports = '') {
|
|
44
|
-
const appConfigContent = [
|
|
45
|
-
"import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';",
|
|
46
|
-
"import { provideRouter } from '@angular/router';",
|
|
47
|
-
"import { appRoutes } from './app.routes';",
|
|
48
|
-
"import { provideHttpClient } from '@angular/common/http';",
|
|
49
|
-
`import { provideFormbar } from '${constants_1.PACKAGE_NAME}';`,
|
|
50
|
-
"import { formbarConfig } from './formbar.config';",
|
|
51
|
-
"import { componentRegistrationsProvider } from './registrations';",
|
|
52
|
-
'',
|
|
53
|
-
'export const appConfig: ApplicationConfig = {',
|
|
54
|
-
' providers: [',
|
|
55
|
-
' provideZoneChangeDetection({ eventCoalescing: true }),',
|
|
56
|
-
' provideRouter(appRoutes),',
|
|
57
|
-
' provideHttpClient(),',
|
|
58
|
-
' provideFormbar(formbarConfig),',
|
|
59
|
-
' componentRegistrationsProvider,',
|
|
60
|
-
' ],',
|
|
61
|
-
'};',
|
|
62
|
-
'',
|
|
63
|
-
].join('\n');
|
|
64
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.app)(appConfigPathRaw), appConfigContent);
|
|
65
|
-
const formbarConfigContent = [
|
|
66
|
-
`import { NGX_FW_COMPONENT_REGISTRATIONS } from '${constants_1.PACKAGE_NAME}';`,
|
|
67
|
-
initialImports,
|
|
68
|
-
'',
|
|
69
|
-
'export const componentRegistrationsProvider = {',
|
|
70
|
-
' provide: NGX_FW_COMPONENT_REGISTRATIONS,',
|
|
71
|
-
` useValue: new Map([${initialRegistrations}])`,
|
|
72
|
-
'};',
|
|
73
|
-
].join('\n');
|
|
74
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.src)(registrationsPath), formbarConfigContent);
|
|
75
|
-
}
|
|
76
|
-
function provideTokenNoSplit(appTree, appConfigPathRaw, initialRegistrations = '', initialImports = '') {
|
|
77
|
-
const appConfigContent = [
|
|
78
|
-
"import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';",
|
|
79
|
-
"import { provideRouter } from '@angular/router';",
|
|
80
|
-
"import { appRoutes } from './app.routes';",
|
|
81
|
-
"import { provideHttpClient } from '@angular/common/http';",
|
|
82
|
-
`import { provideFormbar, NGX_FW_COMPONENT_REGISTRATIONS } from '${constants_1.PACKAGE_NAME}';`,
|
|
83
|
-
initialImports,
|
|
84
|
-
'',
|
|
85
|
-
'export const appConfig: ApplicationConfig = {',
|
|
86
|
-
' providers: [',
|
|
87
|
-
' provideZoneChangeDetection({ eventCoalescing: true }),',
|
|
88
|
-
' provideRouter(appRoutes),',
|
|
89
|
-
' provideHttpClient(),',
|
|
90
|
-
' provideFormbar(),',
|
|
91
|
-
' {',
|
|
92
|
-
' provide: NGX_FW_COMPONENT_REGISTRATIONS,',
|
|
93
|
-
` useValue: new Map([${initialRegistrations}])`,
|
|
94
|
-
' }',
|
|
95
|
-
' ],',
|
|
96
|
-
'};',
|
|
97
|
-
'',
|
|
98
|
-
].join('\n');
|
|
99
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.app)(appConfigPathRaw), appConfigContent);
|
|
100
|
-
}
|
|
101
|
-
function provideMapInlineNoSplit(appTree, appConfigPathRaw, initialRegistrations = '', initialImports = '') {
|
|
102
|
-
const content = [
|
|
103
|
-
"import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';",
|
|
104
|
-
"import { provideRouter } from '@angular/router';",
|
|
105
|
-
"import { appRoutes } from './app.routes';",
|
|
106
|
-
"import { provideHttpClient } from '@angular/common/http';",
|
|
107
|
-
`import { provideFormbar } from '${constants_1.PACKAGE_NAME}';`,
|
|
108
|
-
initialImports,
|
|
109
|
-
'',
|
|
110
|
-
'export const appConfig: ApplicationConfig = {',
|
|
111
|
-
' providers: [',
|
|
112
|
-
' provideZoneChangeDetection({ eventCoalescing: true }),',
|
|
113
|
-
' provideRouter(appRoutes),',
|
|
114
|
-
' provideHttpClient(),',
|
|
115
|
-
' provideFormbar({',
|
|
116
|
-
` componentRegistrations: {${initialRegistrations}}`,
|
|
117
|
-
' }),',
|
|
118
|
-
' ],',
|
|
119
|
-
'};',
|
|
120
|
-
'',
|
|
121
|
-
].join('\n');
|
|
122
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.app)(appConfigPathRaw), content);
|
|
123
|
-
}
|
|
124
|
-
function provideMap(appTree, appConfigPathRaw, registrationsPath, formbarConfigPath, initialRegistrations = '', initialImports = '') {
|
|
125
|
-
const appConfigContent = [
|
|
126
|
-
"import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';",
|
|
127
|
-
"import { provideRouter } from '@angular/router';",
|
|
128
|
-
"import { appRoutes } from './app.routes';",
|
|
129
|
-
"import { provideHttpClient } from '@angular/common/http';",
|
|
130
|
-
`import { provideFormbar } from '${constants_1.PACKAGE_NAME}';`,
|
|
131
|
-
"import { formbarConfig } from './formbar.config';",
|
|
132
|
-
initialImports,
|
|
133
|
-
'',
|
|
134
|
-
'export const appConfig: ApplicationConfig = {',
|
|
135
|
-
' providers: [',
|
|
136
|
-
' provideZoneChangeDetection({ eventCoalescing: true }),',
|
|
137
|
-
' provideRouter(appRoutes),',
|
|
138
|
-
' provideHttpClient(),',
|
|
139
|
-
' provideFormbar(formbarConfig),',
|
|
140
|
-
' ],',
|
|
141
|
-
'};',
|
|
142
|
-
'',
|
|
143
|
-
].join('\n');
|
|
144
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.app)(appConfigPathRaw), appConfigContent);
|
|
145
|
-
const formbarConfigContent = [
|
|
146
|
-
`import { defineFormbarConfig } from '${constants_1.PACKAGE_NAME}';`,
|
|
147
|
-
"import { componentRegistrations } from './registrations';",
|
|
148
|
-
'',
|
|
149
|
-
'export const formbarConfig = defineFormbarConfig({',
|
|
150
|
-
' componentRegistrations,',
|
|
151
|
-
'});',
|
|
152
|
-
].join('\n');
|
|
153
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.src)(formbarConfigPath), formbarConfigContent);
|
|
154
|
-
const registrationsContent = [
|
|
155
|
-
`import { ComponentRegistrationConfig } from '${constants_1.PACKAGE_NAME}';`,
|
|
156
|
-
'',
|
|
157
|
-
`export const componentRegistrations: ComponentRegistrationConfig = {${initialRegistrations}};`,
|
|
158
|
-
].join('\n');
|
|
159
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.src)(registrationsPath), registrationsContent);
|
|
160
|
-
}
|
|
161
|
-
function provideMapNoSplit(appTree, appConfigPathRaw, formbarConfigPath, initialRegistrations = '', initialImports = '') {
|
|
162
|
-
const appConfigContent = [
|
|
163
|
-
"import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';",
|
|
164
|
-
"import { provideRouter } from '@angular/router';",
|
|
165
|
-
"import { appRoutes } from './app.routes';",
|
|
166
|
-
"import { provideHttpClient } from '@angular/common/http';",
|
|
167
|
-
`import { provideFormbar } from '${constants_1.PACKAGE_NAME}';`,
|
|
168
|
-
"import { formbarConfig } from './formbar.config';",
|
|
169
|
-
initialImports,
|
|
170
|
-
'',
|
|
171
|
-
'export const appConfig: ApplicationConfig = {',
|
|
172
|
-
' providers: [',
|
|
173
|
-
' provideZoneChangeDetection({ eventCoalescing: true }),',
|
|
174
|
-
' provideRouter(appRoutes),',
|
|
175
|
-
' provideHttpClient(),',
|
|
176
|
-
' provideFormbar(formbarConfig),',
|
|
177
|
-
' {',
|
|
178
|
-
' provide: NGX_FW_COMPONENT_REGISTRATIONS,',
|
|
179
|
-
` useValue: new Map([${initialRegistrations}])`,
|
|
180
|
-
' }',
|
|
181
|
-
' ],',
|
|
182
|
-
'};',
|
|
183
|
-
'',
|
|
184
|
-
].join('\n');
|
|
185
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.app)(appConfigPathRaw), appConfigContent);
|
|
186
|
-
const formbarConfigContent = [
|
|
187
|
-
`import { defineFormbarConfig } from '${constants_1.PACKAGE_NAME}';`,
|
|
188
|
-
'',
|
|
189
|
-
'export const formbarConfig = defineFormbarConfig({',
|
|
190
|
-
' componentRegistrations: {},',
|
|
191
|
-
'});',
|
|
192
|
-
].join('\n');
|
|
193
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.src)(formbarConfigPath), formbarConfigContent);
|
|
194
|
-
}
|
|
195
|
-
function addHelperIndexFile(appTree, helperPath) {
|
|
196
|
-
const index = [
|
|
197
|
-
"export { ngxfbBlockHostDirective } from './block.host-directive';",
|
|
198
|
-
"export { ngxfbControlHostDirective } from './control.host-directive';",
|
|
199
|
-
"export { controlContainerViewProviders } from './control-container.view-provider';",
|
|
200
|
-
"export { ngxfbGroupHostDirective } from './group.host-directive';",
|
|
201
|
-
].join('\n');
|
|
202
|
-
(0, helper_1.writeTs)(appTree, (0, helper_1.src)(`${helperPath}/index.ts`), index);
|
|
203
|
-
}
|
|
204
|
-
function addComponentFiles(appTree, files) {
|
|
205
|
-
for (const { path, content } of files) {
|
|
206
|
-
(0, helper_1.writeTs)(appTree, path, content);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
function createControlComponent(name, providersAndImports, className) {
|
|
210
|
-
const classifiedName = (0, strings_1.classify)(name);
|
|
211
|
-
const [providers, imports] = providersAndImports;
|
|
212
|
-
return `import { Component } from '@angular/core';
|
|
213
|
-
import { NgxfbControlDirective } from '${constants_1.PACKAGE_NAME}';
|
|
214
|
-
import { ReactiveFormsModule } from '@angular/forms';
|
|
215
|
-
${imports}
|
|
216
|
-
|
|
217
|
-
@Component({
|
|
218
|
-
selector: 'app-${name}-control',
|
|
219
|
-
imports: [ReactiveFormsModule],
|
|
220
|
-
templateUrl: './${name}-control.component.html',
|
|
221
|
-
${providers}
|
|
222
|
-
})
|
|
223
|
-
export class ${className} {
|
|
224
|
-
private readonly control = inject(NgxfbControlDirective<${classifiedName}Control>);
|
|
225
|
-
}
|
|
226
|
-
`;
|
|
227
|
-
}
|
|
228
|
-
exports.inlineProviders = [
|
|
229
|
-
`viewProviders: [
|
|
230
|
-
{
|
|
231
|
-
provide: ControlContainer,
|
|
232
|
-
useFactory: () => inject(ControlContainer, { skipSelf: true }),
|
|
233
|
-
}
|
|
234
|
-
],
|
|
235
|
-
hostDirectives: [
|
|
236
|
-
{
|
|
237
|
-
directive: NgxfbControlDirective,
|
|
238
|
-
inputs: ['content', 'name'],
|
|
239
|
-
}
|
|
240
|
-
],`,
|
|
241
|
-
`import { ControlContainer } from '@angular/forms';`,
|
|
242
|
-
];
|
|
243
|
-
exports.helperProviders = [
|
|
244
|
-
`viewProviders: viewProviders,
|
|
245
|
-
hostDirectives: [
|
|
246
|
-
ngxfbControlHostDirective
|
|
247
|
-
],`,
|
|
248
|
-
`import { viewProviders } from '../shared/helper';
|
|
249
|
-
import { ngxfbControlHostDirective } from '../shared/helper';`,
|
|
250
|
-
];
|
|
251
|
-
function createUnrelatedComponent(name, className) {
|
|
252
|
-
return `import { Component } from '@angular/core';
|
|
253
|
-
@Component({ selector: 'app-${name}', template: '' })
|
|
254
|
-
export class ${className} {}`;
|
|
255
|
-
}
|
|
256
|
-
//# sourceMappingURL=workspace-setup.js.map
|