Skip to content

Commit 43ebe56

Browse files
authored
Merge pull request #12 from bci-oss/feature/remove-global-modules
Removed global modules
2 parents 3f166b3 + d985c30 commit 43ebe56

File tree

125 files changed

+5840
-6358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+5840
-6358
lines changed

libs/schematic/generators/ng-add/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {addPackageJsonDependencies, DEFAULT_DEPENDENCIES} from '../utils/package
1616
import {NodePackageInstallTask} from '@angular-devkit/schematics/tasks';
1717

1818
export function add(options: any): Rule {
19-
return (tree: Tree, context: SchematicContext) => {
20-
context.addTask(new NodePackageInstallTask());
21-
return chain([addPackageJsonDependencies(options.skipImport, options, DEFAULT_DEPENDENCIES)])(tree, context);
22-
};
19+
return (tree: Tree, context: SchematicContext) => {
20+
context.addTask(new NodePackageInstallTask());
21+
return chain([addPackageJsonDependencies(options.skipImport, options, DEFAULT_DEPENDENCIES)])(tree, context);
22+
};
2323
}

libs/schematic/generators/ng-generate/components/card/README.md

Lines changed: 91 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
## Table of Contents
22

33
- [Generate a card component with the schematics command](#generate-a-card-component-with-the-schematics-command)
4-
- [Flags and options that can be used in the generation process](#flags-and-options-that-can-be-used-in-the-generation-process)
5-
- [Generate a component with a custom name](#generate-a-component-with-a-custom-name)
6-
- [Exclude one or more properties from the generation](#exclude-one-or-more-properties-from-the-generation)
7-
- [Multi-version support for Aspect Models](#multi-version-support-for-aspect-models)
8-
- [Manual adaptions in _app.module.ts_](#manual-adaptions-in-appmodulets)
9-
- [Show customized information in the card with ng-template](#show-customized-information-in-the-card-with-ng-template)
10-
- [Export functionality](#export-functionality)
11-
- [Custom icons for the command bar](#custom-icons-for-the-command-bar)
12-
- [Add translations](#add-translations)
13-
- [Pre-load config file](#pre-load-config-file)
14-
- [Skip Installation](#skip-install)
15-
- [Overwrite](#overwrite)
16-
- [Add material css theme](#Add-material-css-theme)
17-
- [Set View Encapsulation strategy](#Set-View-Encapsulation-strategy)
4+
- [Flags and options that can be used in the generation process](#flags-and-options-that-can-be-used-in-the-generation-process)
5+
- [Generate a component with a custom name](#generate-a-component-with-a-custom-name)
6+
- [Exclude one or more properties from the generation](#exclude-one-or-more-properties-from-the-generation)
7+
- [Multi-version support for Aspect Models](#multi-version-support-for-aspect-models)
8+
- [Show customized information in the card with ng-template](#show-customized-information-in-the-card-with-ng-template)
9+
- [Export functionality](#export-functionality)
10+
- [Custom icons for the command bar](#custom-icons-for-the-command-bar)
11+
- [Add translations](#add-translations)
12+
- [Pre-load config file](#pre-load-config-file)
13+
- [Skip Installation](#skip-install)
14+
- [Overwrite](#overwrite)
15+
- [Add material css theme](#Add-material-css-theme)
16+
- [Set View Encapsulation strategy](#Set-View-Encapsulation-strategy)
1817

1918
# Generate a card component with the schematics command
2019

@@ -54,9 +53,9 @@ this will be the result in the generated component .ts file
5453

5554
```typescript
5655
@Component({
57-
selector: 'esmf-sdk-ui-movement-card',
58-
templateUrl: './movement-card.component.html',
59-
styleUrls: ['./movement-card.component.scss'],
56+
selector: 'esmf-sdk-ui-movement-card',
57+
templateUrl: './movement-card.component.html',
58+
styleUrls: ['./movement-card.component.scss'],
6059
})
6160
export class MovementCardComponent {}
6261
```
@@ -72,9 +71,9 @@ selector.
7271

7372
```typescript
7473
@Component({
75-
selector: 'esmf-sdk-ui-custom-card', // <- provided name reflected in the selector name
76-
templateUrl: './custom-card.component.html', // <- provided name reflected in the component path
77-
styleUrls: ['./custom-card.component.scss'], // <- provided name reflected in the component files
74+
selector: 'esmf-sdk-ui-custom-card', // <- provided name reflected in the selector name
75+
templateUrl: './custom-card.component.html', // <- provided name reflected in the component path
76+
styleUrls: ['./custom-card.component.scss'], // <- provided name reflected in the component files
7877
})
7978
export class CustomCardComponent {} // <- provided name reflected in the component class name
8079
```
@@ -148,54 +147,15 @@ component and the language files.
148147

149148
---
150149

151-
## Manual adaptions in _app.module.ts_
152-
153-
Please note that you (eventually) need to manually adapt file
154-
_src/app/app.module.ts_ in order to specify which versions of the card UI
155-
component you would like to use. In the example below, versions 1.0.0 and
156-
1.1.0 are to be used as components.
157-
158-
```typescript
159-
import {NgModule} from '@angular/core';
160-
import {BrowserModule} from '@angular/platform-browser';
161-
162-
import {AppComponent} from './app.component';
163-
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
164-
import {
165-
MovementCardModule as MovementCardModule_v100
166-
} from './shared/components/movement-card/v100/movement-card.module';
167-
import {
168-
MovementCardModule as MovementCardModule_v110
169-
} from './shared/components/movement-card/v110/movement-card.module';
170-
171-
@NgModule({
172-
imports: [
173-
MovementCardModule_v100, // <-- Manually added
174-
MovementTCardModule_v110 // <-- Manually added
175-
]
176-
})
177-
```
178-
179-
This gives you the choice to decide which UI components (and in which version) are used to compose your web application.
180-
You then can use this specific version of the card UI component, e.g. in _src/app/app.component.html_:
181-
182-
```angular2html
183-
184-
<esmf-sdk-ui-movement-card-v100></esmf-sdk-ui-movement-card-v100>
185-
<esmf-sdk-ui-movement-card-v110></esmf-sdk-ui-movement-card-v110>
186-
```
187-
188-
---
189-
190150
## Show customized information in the card with ng-template
191151

192152
In your parent HTML file, you have the ability to define a custom ng-template.
193153
This template will be integrated directly into the card's content.
194154

195155
You can either:
196156

197-
* Utilize the pre-defined elements and their values, or
198-
* Introduce entirely custom content according to your requirements.
157+
- Utilize the pre-defined elements and their values, or
158+
- Introduce entirely custom content according to your requirements.
199159

200160
This flexibility allows you to tailor the card's appearance and behavior to fit specific scenarios.
201161

@@ -207,23 +167,35 @@ Without versioning:
207167

208168
```html
209169
<esmf-sdk-ui-movement-card-v100>
210-
<ng-template #cardTemplate let-data let-element="<componentName>CardValues" let-getElementValue="getElementValue" let-translateService="translateService">
211-
<div class="data-card-element" *ngFor="let elem of element">
212-
<b>{{ elem + ".preferredName" | transloco }}</b>: {{ getElementValue(data, elem) }}
213-
</div>
214-
</ng-template>
170+
<ng-template
171+
#cardTemplate
172+
let-data
173+
let-element="<componentName>CardValues"
174+
let-getElementValue="getElementValue"
175+
let-translateService="translateService"
176+
>
177+
<div class="data-card-element" *ngFor="let elem of element">
178+
<b>{{ elem + ".preferredName" | transloco }}</b>: {{ getElementValue(data, elem) }}
179+
</div>
180+
</ng-template>
215181
</esmf-sdk-ui-movement-card-v100>
216182
```
217183

218184
With versioning:
219185

220186
```html
221187
<esmf-sdk-ui-movement-card-v100>
222-
<ng-template #cardTemplate let-data let-element="<componentName>CardValues" let-getElementValue="getElementValue" let-translateService="translateService">
223-
<div class="data-card-element" *ngFor="let elem of element">
224-
<b>{{ 'movement.v210.' + elem + ".preferredName" | transloco }}</b>: {{ getElementValue(data, elem) }}
225-
</div>
226-
</ng-template>
188+
<ng-template
189+
#cardTemplate
190+
let-data
191+
let-element="<componentName>CardValues"
192+
let-getElementValue="getElementValue"
193+
let-translateService="translateService"
194+
>
195+
<div class="data-card-element" *ngFor="let elem of element">
196+
<b>{{ 'movement.v210.' + elem + ".preferredName" | transloco }}</b>: {{ getElementValue(data, elem) }}
197+
</div>
198+
</ng-template>
227199
</esmf-sdk-ui-movement-card-v100>
228200
```
229201

@@ -251,35 +223,35 @@ By pressing it, a modal dialog window will appear with multiple options.
251223

252224
1. If the data is handled on the client side, the following options will appear:
253225

254-
1. Export all pages (by default)
255-
Pressing this button will result into a full data export to a csv file.
256-
2. Export only first page
257-
If this option appears, this will lead to a csv file being exported including only the first page from the view.
226+
1. Export all pages (by default)
227+
Pressing this button will result into a full data export to a csv file.
228+
2. Export only first page
229+
If this option appears, this will lead to a csv file being exported including only the first page from the view.
258230

259231
2. If the data is handled remotely, the following options will be visible:
260232

261-
1. Export all pages (by default) - option which exports a csv containing the set of data which can be visible on
262-
that
263-
page.
264-
2. Export only first page
265-
If this option appears, this will lead to a csv file being exported including only the first page from the view.
266-
3. Export all pages (only if an ExtendedCsvExporter function is passed to the card through bindings) - will result
267-
in exporting the data by calling an external function passed to the generated component through binding by using
268-
the `extendedCsvExporter` attribute.
233+
1. Export all pages (by default) - option which exports a csv containing the set of data which can be visible on
234+
that
235+
page.
236+
2. Export only first page
237+
If this option appears, this will lead to a csv file being exported including only the first page from the view.
238+
3. Export all pages (only if an ExtendedCsvExporter function is passed to the card through bindings) - will result
239+
in exporting the data by calling an external function passed to the generated component through binding by using
240+
the `extendedCsvExporter` attribute.
269241

270-
```html
271-
<esmf-sdk-ui-movement-card-v321 [extendedCsvExporter]="csvExporter"></esmf-sdk-ui-movement-card-v321>
272-
```
242+
```html
243+
<esmf-sdk-ui-movement-card-v321 [extendedCsvExporter]="csvExporter"></esmf-sdk-ui-movement-card-v321>
244+
```
273245

274246
The `csvExporter` function will have a type `ExtendedCsvExporter` exported in the component's service file, and it
275247
will need to implement a function with 2 arguments, the displayed columns and the RQL query which will query the data
276248
from the backend.
277249

278-
```typescript
279-
export interface ExtendedCsvExporter {
280-
export(displayedColumns: string[], rqlQuery: string): void;
281-
}
282-
```
250+
```typescript
251+
export interface ExtendedCsvExporter {
252+
export(displayedColumns: string[], rqlQuery: string): void;
253+
}
254+
```
283255

284256
If this function is not exposed to the component, this option will not appear in the export dialog window.
285257

@@ -317,38 +289,38 @@ ng generate @esmf/semantic-ui-schematics:card --configFile=<config-file-name>-wi
317289

318290
Example of configuration file:
319291

320-
[//]: # (TODO check this is up to date)
292+
[//]: # 'TODO check this is up to date'
321293

322294
```json
323295
{
324-
"aspectModelTFiles": ["FOLDER\\Movement.ttl"],
325-
"excludedProperties": [],
326-
"configFile": "wizard.config.json",
327-
"complexProps": [
328-
{
329-
"prop": "position",
330-
"propsToShow": ["x", "y", "z"]
331-
}
332-
],
333-
"selectedModelElementUrn": "urn:samm:org.eclipse.esmf.test:1.0.0#Movement",
334-
"jsonAccessPath": "",
335-
"defaultSortingCol": "moving",
336-
"customRowActions": ["schedule"],
337-
"addCommandBar": true,
338-
"enabledCommandBarFunctions": ["addCustomCommandBarActions", "addSearchBar", "addEnumQuickFilters", "addDateQuickFilters"],
339-
"customCommandBarActions": ["edit.svg"],
340-
"enableRemoteDataHandling": true,
341-
"enableVersionSupport": true,
342-
"overwrite": true,
343-
"getOptionalMaterialTheme": false,
344-
"datePickers": [
345-
{
346-
"propertyUrn": "urn:samm:org.eclipse.test:1.0.0#datePicker",
347-
"datePicker": {
348-
"type": "singleDatePicker"
349-
}
296+
"aspectModelTFiles": ["FOLDER\\Movement.ttl"],
297+
"excludedProperties": [],
298+
"configFile": "wizard.config.json",
299+
"complexProps": [
300+
{
301+
"prop": "position",
302+
"propsToShow": ["x", "y", "z"]
303+
}
304+
],
305+
"selectedModelElementUrn": "urn:samm:org.eclipse.esmf.test:1.0.0#Movement",
306+
"jsonAccessPath": "",
307+
"defaultSortingCol": "moving",
308+
"customRowActions": ["schedule"],
309+
"addCommandBar": true,
310+
"enabledCommandBarFunctions": ["addCustomCommandBarActions", "addSearchBar", "addEnumQuickFilters", "addDateQuickFilters"],
311+
"customCommandBarActions": ["edit.svg"],
312+
"enableRemoteDataHandling": true,
313+
"enableVersionSupport": true,
314+
"overwrite": true,
315+
"getOptionalMaterialTheme": false,
316+
"datePickers": [
317+
{
318+
"propertyUrn": "urn:samm:org.eclipse.test:1.0.0#datePicker",
319+
"datePicker": {
320+
"type": "singleDatePicker"
350321
}
351-
]
322+
}
323+
]
352324
}
353325
```
354326

libs/schematic/generators/ng-generate/components/card/generators/components/card/index.ts

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,39 +23,39 @@ let sharedOptions: any = {};
2323
let allProps: Array<Property> = [];
2424

2525
export function generateCardComponent(options: any): Rule {
26-
return (tree: Tree, _context: SchematicContext) => {
27-
allProps = options.listAllProperties;
26+
return (tree: Tree, _context: SchematicContext) => {
27+
allProps = options.listAllProperties;
2828

29-
return chain([
30-
...(options.hasFilters ? [generateChipList(options)] : []),
31-
...(options.addCommandBar ? [generateCommandBar(options, allProps)] : []),
32-
generateCard(options, _context),
33-
])(tree, _context);
34-
};
29+
return chain([
30+
...(options.hasFilters ? [generateChipList(options)] : []),
31+
...(options.addCommandBar ? [generateCommandBar(options, allProps)] : []),
32+
generateCard(options, _context),
33+
])(tree, _context);
34+
};
3535
}
3636

3737
function generateCard(options: Schema, _context: SchematicContext): Rule {
38-
sharedOptions = options;
38+
sharedOptions = options;
3939

40-
return mergeWith(
41-
apply(url('./generators/components/card/files'), [
42-
templateInclude(_context, applyTemplate, options, '../shared/methods'),
43-
move(sharedOptions.path),
44-
]),
45-
sharedOptions.overwrite ? MergeStrategy.Overwrite : MergeStrategy.Error,
46-
);
40+
return mergeWith(
41+
apply(url('./generators/components/card/files'), [
42+
templateInclude(_context, applyTemplate, options, '../shared/methods'),
43+
move(sharedOptions.path),
44+
]),
45+
sharedOptions.overwrite ? MergeStrategy.Overwrite : MergeStrategy.Error
46+
);
4747
}
4848

4949
function applyTemplate(): Rule {
50-
return applyTemplates({
51-
classify: strings.classify,
52-
dasherize: strings.dasherize,
53-
camelize: strings.camelize,
54-
options: sharedOptions,
55-
name: sharedOptions.name,
56-
selectedModelElementUrn: sharedOptions.selectedModelElement.aspectModelUrn,
57-
aspectModelElementUrn: sharedOptions.aspectModel.aspectModelUrn,
58-
enumProperties: getEnumProperties(sharedOptions),
59-
enumPropertyDefinitions: getEnumPropertyDefinitions(sharedOptions, allProps),
60-
});
50+
return applyTemplates({
51+
classify: strings.classify,
52+
dasherize: strings.dasherize,
53+
camelize: strings.camelize,
54+
options: sharedOptions,
55+
name: sharedOptions.name,
56+
selectedModelElementUrn: sharedOptions.selectedModelElement.aspectModelUrn,
57+
aspectModelElementUrn: sharedOptions.aspectModel.aspectModelUrn,
58+
enumProperties: getEnumProperties(sharedOptions),
59+
enumPropertyDefinitions: getEnumPropertyDefinitions(sharedOptions, allProps),
60+
});
6161
}

libs/schematic/generators/ng-generate/components/card/generators/components/export-dialog/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ import {apply, applyTemplates, MergeStrategy, mergeWith, move, Rule, SchematicCo
1515
import {strings} from '@angular-devkit/core';
1616

1717
export function generateExportCardDialog(options: any): Rule {
18-
return (tree: Tree, _context: SchematicContext) => {
19-
return mergeWith(
20-
apply(url('./generators/components/export-dialog/files'), [
21-
applyTemplates({
22-
classify: strings.classify,
23-
dasherize: strings.dasherize,
24-
options: options,
25-
name: 'export-card-dialog',
26-
}),
27-
move('src/app/shared/components/export-confirmation-dialog'),
28-
]),
29-
options.overwrite ? MergeStrategy.Overwrite : MergeStrategy.Error,
30-
);
31-
};
18+
return (tree: Tree, _context: SchematicContext) => {
19+
return mergeWith(
20+
apply(url('./generators/components/export-dialog/files'), [
21+
applyTemplates({
22+
classify: strings.classify,
23+
dasherize: strings.dasherize,
24+
options: options,
25+
name: 'export-card-dialog',
26+
}),
27+
move('src/app/shared/components/export-confirmation-dialog'),
28+
]),
29+
options.overwrite ? MergeStrategy.Overwrite : MergeStrategy.Error
30+
);
31+
};
3232
}

0 commit comments

Comments
 (0)