Skip to content

Commit 901889a

Browse files
authored
Merge pull request #23 from bci-oss/feature/set-encapsulation-default
Add question to ask for view encapsulation strategy
2 parents 67214fb + f87dec4 commit 901889a

File tree

9 files changed

+329
-232
lines changed

9 files changed

+329
-232
lines changed

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
- [Pre-load config file](#pre-load-config-file)
2828
- [Skip Installation](#skip-install)
2929
- [Overwrite](#overwrite)
30+
- [Add material css theme](#Add material css theme)
31+
- [Set View Encapsulation strategy](#Set View Encapsulation strategy)
3032
- [Documentation](#documentation)
3133
- [License](#license)
3234

@@ -616,10 +618,14 @@ ng generate @esmf/semantic-ui-schematics:table --overwrite
616618
617619
If you want to add the indigo pink material theme, you may use the '--getOptionalMaterialTheme' flag
618620
621+
when the wizard will prompt the question:
622+
619623
```bash
620-
ng generate @esmf/semantic-ui-schematics:table --getOptionalMaterialTheme
624+
Do you want to add the Angular Material theme? (Indigo Pink Theme)
621625
```
622626
627+
User may choose Yes or No.
628+
623629
if user did not set --getOptionalMaterialTheme to true but wants to add a material theme to the project,
624630
in angular.json in styles section the following code can be added:
625631
@@ -635,6 +641,22 @@ in angular.json in styles section the following code can be added:
635641
636642
---
637643
644+
### Set View Encapsulation strategy
645+
646+
By default the view encapsulation for the generated table component is set to None.
647+
If you want to change the View Encapsulation strategy, you may use the '--viewEncapsulation' flag
648+
where user can choose one of the following options: None, Emulated, ShadowDom.
649+
650+
when the wizard will prompt the question:
651+
652+
```bash
653+
Do you want to specify view encapsulation strategy?
654+
```
655+
656+
User may choose one of the values: None, Emulated, ShadowDom.
657+
658+
---
659+
638660
## Documentation
639661
640662
Further documentation and howto's are provided in the
102 KB
Loading
76.4 KB
Loading
98 KB
Loading

documentation/js-sdk-guide/modules/tooling-guide/pages/table-generation.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,22 @@ shared
208208
│ │ │ <component-name>-datasource.ts
209209
----
210210

211+
=== _Material theme(Indigo pink)_
212+
213+
User can add to angular.json Indigo pink material theme. These action will appear in the actions column of the table. In the following prompt you can choose to add the Indigo pink material theme.
214+
215+
image::material-theme-prompt.png[width=100%]
216+
217+
In the generated angular.json table if user selected yes we can observe the change in styles array.
218+
219+
image::angular-json-example.png[width=100%]
220+
221+
=== _Set view encapsulation strategy for the generated table component_
222+
223+
User can set the View Encapsulation strategy by default the ViewEncapsulation will be set to None on the generated table component. In the following prompt you can choose to add another View Encapsulation value.
224+
225+
image::view-encapsulation-prompt.png[width=100%]
226+
211227
=== _Flags for generating the table_
212228

213229
By using

src/ng-generate/table-prompter/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {Observable, Subject, Subscriber} from 'rxjs';
3333
import {TemplateHelper} from '../../utils/template-helper';
3434
import {Schema} from '../table/schema';
3535
import * as locale from 'locale-codes';
36+
import {ViewEncapsulation} from '@schematics/angular/component/schema';
3637

3738
inquirer.registerPrompt('fuzzypath', require('inquirer-fuzzy-path'));
3839
inquirer.registerPrompt('suggest', require('inquirer-prompt-suggest'));
@@ -743,6 +744,14 @@ function getUserConfigQuestions(allAnswers: any, tree: Tree, options: Schema): Q
743744
default: true,
744745
};
745746

747+
const requestSetViewEncapsulation = {
748+
type: 'list',
749+
name: 'viewEncapsulation',
750+
message: 'Do you want to specify view encapsulation strategy?',
751+
choices: [ViewEncapsulation.None, ViewEncapsulation.Emulated, ViewEncapsulation.ShadowDom],
752+
default: ViewEncapsulation.None,
753+
};
754+
746755
return [
747756
requestJSONPathSelectedModelElement,
748757
requestExcludedProperties,
@@ -760,6 +769,7 @@ function getUserConfigQuestions(allAnswers: any, tree: Tree, options: Schema): Q
760769
requestAspectModelVersionSupport,
761770
requestOptionalMaterialTheme,
762771
requestCustomStyleImports,
772+
requestSetViewEncapsulation,
763773
requestOverwriteFiles,
764774
];
765775
}

0 commit comments

Comments
 (0)