@microsoft/generator-sharepoint 1.13.1 → 1.14.0

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.
Files changed (94) hide show
  1. package/lib/common/BaseGenerator.d.ts +2 -2
  2. package/lib/common/BaseGenerator.d.ts.map +1 -1
  3. package/lib/common/PackageSolutionJsonManager.d.ts +6 -0
  4. package/lib/common/PackageSolutionJsonManager.d.ts.map +1 -1
  5. package/lib/common/PackageSolutionJsonManager.js +57 -16
  6. package/lib/common/dependency/adaptiveCardExtension/firstParty.json +6 -6
  7. package/lib/common/dependency/adaptiveCardExtension/firstPartyPlusBeta.json +6 -6
  8. package/lib/common/dependency/applicationCustomizer.json +2 -2
  9. package/lib/common/dependency/applicationCustomizerPlusBeta.json +2 -2
  10. package/lib/common/dependency/commandSet.json +2 -2
  11. package/lib/common/dependency/commandSetPlusBeta.json +2 -2
  12. package/lib/common/dependency/extension/firstParty.json +5 -5
  13. package/lib/common/dependency/extension/firstPartyPlusBeta.json +5 -5
  14. package/lib/common/dependency/fieldCustomizer.json +1 -1
  15. package/lib/common/dependency/fieldCustomizerPlusBeta.json +1 -1
  16. package/lib/common/dependency/library/firstParty.json +3 -3
  17. package/lib/common/dependency/library/firstPartyPlusBeta.json +3 -3
  18. package/lib/common/dependency/searchQueryModifier.json +1 -1
  19. package/lib/common/dependency/searchQueryModifierPlusBeta.json +1 -1
  20. package/lib/common/dependency/webpart/firstParty.json +8 -8
  21. package/lib/common/dependency/webpart/firstPartyPlusBeta.json +8 -8
  22. package/lib/generators/adaptiveCardExtension/index.d.ts +2 -2
  23. package/lib/generators/adaptiveCardExtension/index.d.ts.map +1 -1
  24. package/lib/generators/adaptiveCardExtension/index.js +4 -1
  25. package/lib/generators/adaptiveCardExtension/templates/base/loc/en-us.js +5 -8
  26. package/lib/generators/adaptiveCardExtension/templates/base/loc/mystring.d.ts +1 -4
  27. package/lib/generators/adaptiveCardExtension/templates/basicCardView/CardView.ts +2 -1
  28. package/lib/generators/adaptiveCardExtension/templates/imageCardView/CardView.ts +2 -1
  29. package/lib/generators/adaptiveCardExtension/templates/manifestTemplate/baseTemplate/{componentClassName}.manifest.json +1 -3
  30. package/lib/generators/adaptiveCardExtension/templates/none/quickView/QuickView.ts +0 -2
  31. package/lib/generators/adaptiveCardExtension/templates/none/quickView/template/QuickViewTemplate.json +0 -5
  32. package/lib/generators/adaptiveCardExtension/templates/none/{componentClassName}.ts +1 -14
  33. package/lib/generators/adaptiveCardExtension/templates/none/{componentName}PropertyPane.ts +0 -8
  34. package/lib/generators/adaptiveCardExtension/templates/primaryTextCardView/CardView.ts +2 -1
  35. package/lib/generators/app/index.js +22 -5
  36. package/lib/generators/applicationCustomizer/index.d.ts +2 -2
  37. package/lib/generators/applicationCustomizer/index.d.ts.map +1 -1
  38. package/lib/generators/applicationCustomizer/index.js +1 -1
  39. package/lib/generators/applicationCustomizer/templates/none/{componentClassName}.ts +0 -2
  40. package/lib/generators/commandSet/index.d.ts +2 -2
  41. package/lib/generators/commandSet/index.d.ts.map +1 -1
  42. package/lib/generators/commandSet/index.js +1 -1
  43. package/lib/generators/commandSet/templates/none/{componentClassName}.ts +0 -4
  44. package/lib/generators/component/BaseComponentGenerator.d.ts +8 -4
  45. package/lib/generators/component/BaseComponentGenerator.d.ts.map +1 -1
  46. package/lib/generators/component/BaseComponentGenerator.js +22 -22
  47. package/lib/generators/component/index.d.ts.map +1 -1
  48. package/lib/generators/extension/BaseExtensionGenerator.d.ts +2 -1
  49. package/lib/generators/extension/BaseExtensionGenerator.d.ts.map +1 -1
  50. package/lib/generators/extension/BaseExtensionGenerator.js +25 -0
  51. package/lib/generators/fieldCustomizer/index.d.ts +2 -2
  52. package/lib/generators/fieldCustomizer/index.d.ts.map +1 -1
  53. package/lib/generators/fieldCustomizer/index.js +12 -2
  54. package/lib/generators/fieldCustomizer/templates/{base/loc → loc}/en-us.js +0 -0
  55. package/lib/generators/fieldCustomizer/templates/{base/loc → loc}/myStrings.d.ts +0 -0
  56. package/lib/generators/fieldCustomizer/templates/minimal/loc/en-us.js +4 -0
  57. package/lib/generators/fieldCustomizer/templates/minimal/loc/myStrings.d.ts +7 -0
  58. package/lib/generators/fieldCustomizer/templates/minimal/{componentClassName}.module.scss +3 -0
  59. package/lib/generators/fieldCustomizer/templates/minimal/{componentClassName}.ts +29 -0
  60. package/lib/generators/fieldCustomizer/templates/none/{componentClassName}.ts +0 -4
  61. package/lib/generators/fieldCustomizer/templates/react/components/{componentName}.tsx +0 -4
  62. package/lib/generators/fieldCustomizer/templates/react/{componentClassName}.ts +0 -4
  63. package/lib/generators/library/index.d.ts +2 -2
  64. package/lib/generators/library/index.d.ts.map +1 -1
  65. package/lib/generators/library/index.js +1 -1
  66. package/lib/generators/searchQueryModifier/index.d.ts +2 -2
  67. package/lib/generators/searchQueryModifier/index.d.ts.map +1 -1
  68. package/lib/generators/searchQueryModifier/index.js +1 -1
  69. package/lib/generators/searchQueryModifier/templates/none/{componentClassName}.ts +0 -3
  70. package/lib/generators/solution/index.d.ts +1 -0
  71. package/lib/generators/solution/index.d.ts.map +1 -1
  72. package/lib/generators/solution/index.js +18 -58
  73. package/lib/generators/solution/templates/base/.vscode/launch.json +1 -5
  74. package/lib/generators/webpart/index.d.ts +2 -2
  75. package/lib/generators/webpart/index.d.ts.map +1 -1
  76. package/lib/generators/webpart/index.js +13 -5
  77. package/lib/generators/webpart/templates/assets/welcome-dark.png +0 -0
  78. package/lib/generators/webpart/templates/assets/welcome-light.png +0 -0
  79. package/lib/generators/webpart/templates/loc/en-us.js +11 -0
  80. package/lib/generators/webpart/templates/{base/loc → loc}/mystrings.d.ts +4 -0
  81. package/lib/generators/webpart/templates/minimal/loc/en-us.js +4 -0
  82. package/lib/generators/webpart/templates/minimal/loc/mystrings.d.ts +7 -0
  83. package/lib/generators/webpart/templates/minimal/{componentClassName}.module.scss +3 -0
  84. package/lib/generators/webpart/templates/minimal/{componentClassName}.ts +22 -0
  85. package/lib/generators/webpart/templates/none/{componentClassName}.module.scss +22 -62
  86. package/lib/generators/webpart/templates/none/{componentClassName}.ts +57 -14
  87. package/lib/generators/webpart/templates/react/components/I{componentName}Props.ts +4 -0
  88. package/lib/generators/webpart/templates/react/components/{componentName}.module.scss +23 -63
  89. package/lib/generators/webpart/templates/react/components/{componentName}.tsx +31 -13
  90. package/lib/generators/webpart/templates/react/{componentClassName}.ts +38 -1
  91. package/package.json +3 -3
  92. package/lib/generators/solution/templates/base/.vscode/extensions.json +0 -5
  93. package/lib/generators/webpart/templates/base/loc/en-us.js +0 -7
  94. package/lib/generators/webpart/templates/officeAddin/initial.outlookManifest.xml +0 -91
@@ -36,7 +36,7 @@ class SearchQueryModifierGenerator extends BaseExtension.BaseExtensionGenerator
36
36
  super(args, options);
37
37
  this.friendlyName = 'Search Query Modifier';
38
38
  this.codeName = 'SearchQueryModifier';
39
- this.allowedFrameworks = [];
39
+ this.allowedTemplates = [];
40
40
  defineOptions(this);
41
41
  }
42
42
  initializing() {
@@ -1,4 +1,3 @@
1
- import { override } from '@microsoft/decorators';
2
1
  import { Log } from '@microsoft/sp-core-library';
3
2
  import { BaseSearchQueryModifier, IQuery, SearchQueryScenario } from '@microsoft/sp-search-extensibility';
4
3
 
@@ -18,13 +17,11 @@ const LOG_SOURCE: string = '<%= componentClassName %>';
18
17
 
19
18
  export default class <%= componentClassName %> extends BaseSearchQueryModifier<I<%= componentClassName %>Properties> {
20
19
 
21
- @override
22
20
  public onInit(): Promise<void> {
23
21
  Log.info(LOG_SOURCE, 'Initialized <%= componentClassName %>');
24
22
  return Promise.resolve();
25
23
  }
26
24
 
27
- @override
28
25
  public modifySearchQuery(query: IQuery, scenario: SearchQueryScenario): Promise<IQuery> {
29
26
  Log.info(LOG_SOURCE, `Modifying query ${query.queryText} with ${strings.Title}`);
30
27
  return Promise.resolve(query);
@@ -1,6 +1,7 @@
1
1
  import { BaseGenerator, IBaseOptions } from '../../common/BaseGenerator';
2
2
  export interface ISolutionOptions extends IBaseOptions {
3
3
  solutionName: string;
4
+ solutionShortDescription: string;
4
5
  skipFeatureDeployment: boolean;
5
6
  environment: 'spo';
6
7
  packageManager: 'npm' | 'pnpm' | 'yarn';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/solution/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAIzE,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,OAAO,CAAC;IAC/B,WAAW,EAAE,KAAK,CAAC;IACnB,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACxC,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,WAAW,EAAE,MAAM,CAAiD;IACpE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,IAAI,CA8BhG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/solution/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAIzE,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB,EAAE,MAAM,CAAC;IACjC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,WAAW,EAAE,KAAK,CAAC;IACnB,cAAc,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACxC,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,WAAW,EAAE,MAAM,CAAiD;IACpE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,aAAa,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,IAAI,CA8BhG"}
@@ -81,22 +81,11 @@ class SolutionGenerator extends BaseGenerator_1.BaseGenerator {
81
81
  default: lodash.kebabCase(this.appname),
82
82
  when: () => !this.config.get('solutionName'),
83
83
  message: 'What is your solution name?'
84
- },
85
- {
86
- type: 'list',
87
- name: 'environment',
88
- when: () => !this.config.get('environment'),
89
- message: 'Only SharePoint Online (latest) is supported. For earlier versions of SharePoint (2016 and 2019) please use the 1.4.1 version of the generator.',
90
- default: 'spo',
91
- choices: [{ name: 'SharePoint Online only (latest)', value: 'spo' }]
92
- }
93
- ])
94
- .then((answers) => {
95
- if (!this.config.get('environment')) {
96
- this.config.set('environment', answers.environment);
97
84
  }
98
- const environment = this.config.get('environment');
99
- const solutionName = this.config.get('solutionName');
85
+ ]).then((answers) => {
86
+ const environment = 'spo';
87
+ const solutionName = this.config.get('solutionName') || answers.solutionName;
88
+ const solutionShortDescription = this.config.get('solutionShortDescription') || `${solutionName} description`;
100
89
  // allows to set --skip-feature-deployment false
101
90
  let skipFeatureDeployment = undefined;
102
91
  const skipFeatureDeploymentConfig = this.config.get('skipFeatureDeployment');
@@ -108,9 +97,12 @@ class SolutionGenerator extends BaseGenerator_1.BaseGenerator {
108
97
  skipFeatureDeployment = skipFeatureDeploymentConfig;
109
98
  }
110
99
  }
100
+ else {
101
+ skipFeatureDeployment = true;
102
+ }
111
103
  const componentType = this.config.get('componentType');
112
104
  const extensionType = this.config.get('extensionType');
113
- const framework = this.config.get('framework');
105
+ const template = this.config.get('framework') || this.config.get('template');
114
106
  const componentName = this.config.get('componentName');
115
107
  const componentDescription = this.config.get('componentDescription');
116
108
  const isCreatingSolution = this.config.get('isCreatingSolution');
@@ -125,10 +117,16 @@ class SolutionGenerator extends BaseGenerator_1.BaseGenerator {
125
117
  isDomainIsolated = isDomainIsolatedConfig;
126
118
  }
127
119
  }
120
+ else {
121
+ isDomainIsolated = false;
122
+ }
128
123
  const isPlusBeta = this.config.get('plusBeta');
129
- this.context.solutionName = this.config.get('solutionName') || answers.solutionName;
124
+ this.context.solutionName = solutionName;
130
125
  this.context.libraryName = lodash.kebabCase(this.context.solutionName);
131
126
  this.context.libraryId = Utils.generateGuid();
127
+ this.context.solutionShortDescription = solutionShortDescription;
128
+ this.context.skipFeatureDeployment = skipFeatureDeployment;
129
+ this.context.isDomainIsolated = isDomainIsolated;
132
130
  // store some variables
133
131
  YeomanConfiguration_1.YeomanConfiguration.version = BaseGenerator_1.BaseGenerator.generatorPackageJson.version;
134
132
  YeomanConfiguration_1.YeomanConfiguration.libraryName = this.context.libraryName;
@@ -137,55 +135,17 @@ class SolutionGenerator extends BaseGenerator_1.BaseGenerator {
137
135
  YeomanConfiguration_1.YeomanConfiguration.packageManager =
138
136
  this.config.get('packageManager') || YeomanConfiguration_1.YeomanConfiguration.packageManager || 'npm';
139
137
  this.config.set('solutionName', solutionName);
138
+ this.config.set('environment', environment);
139
+ this.config.set('solutionShortDescription', solutionShortDescription);
140
140
  this.config.set('skipFeatureDeployment', skipFeatureDeployment);
141
141
  this.config.set('componentType', componentType);
142
142
  this.config.set('extensionType', extensionType);
143
- this.config.set('framework', framework);
143
+ this.config.set('template', template);
144
144
  this.config.set('componentName', componentName);
145
145
  this.config.set('componentDescription', componentDescription);
146
146
  this.config.set('isCreatingSolution', isCreatingSolution);
147
147
  this.config.set('isDomainIsolated', isDomainIsolated);
148
148
  this.config.set('plusBeta', isPlusBeta);
149
- })
150
- .then(() => {
151
- return this.prompt([
152
- {
153
- type: 'confirm',
154
- name: 'skipFeatureDeployment',
155
- default: false,
156
- when: () => this.config.get('skipFeatureDeployment') === undefined,
157
- message: 'Do you want to allow the tenant admin the choice of being able ' +
158
- 'to deploy the solution to all sites immediately without running ' +
159
- 'any feature deployment or adding apps in sites?'
160
- }
161
- ]);
162
- })
163
- .then((answers) => {
164
- this.context.skipFeatureDeployment =
165
- this.config.get('skipFeatureDeployment') !== undefined
166
- ? this.config.get('skipFeatureDeployment')
167
- : answers.skipFeatureDeployment;
168
- })
169
- .then(() => {
170
- return this.prompt([
171
- {
172
- type: 'confirm',
173
- name: 'isDomainIsolated',
174
- default: false,
175
- when: () => YeomanConfiguration_1.YeomanConfiguration.environment === 'spo' && this.config.get('isDomainIsolated') === undefined,
176
- message: 'Will the components in the solution require permissions to access ' +
177
- 'web APIs that are unique and not shared with other components in the tenant?'
178
- }
179
- ]);
180
- })
181
- .then((answers) => {
182
- if (YeomanConfiguration_1.YeomanConfiguration.environment === 'spo') {
183
- if (this.config.get('isDomainIsolated') === undefined) {
184
- this.config.set('isDomainIsolated', answers.isDomainIsolated);
185
- }
186
- this.context.isDomainIsolated = this.config.get('isDomainIsolated');
187
- }
188
- // make sure we store the updated context values
189
149
  this.packageSolutionJson.setUpSolution(this.context);
190
150
  });
191
151
  }
@@ -1,13 +1,9 @@
1
1
  {
2
- /**
3
- * Install Chrome Debugger Extension for Visual Studio Code to debug your components with the
4
- * Chrome browser: https://aka.ms/spfx-debugger-extensions
5
- */
6
2
  "version": "0.2.0",
7
3
  "configurations": [
8
4
  {
9
5
  "name": "Hosted workbench",
10
- "type": "chrome",
6
+ "type": "pwa-chrome",
11
7
  "request": "launch",
12
8
  "url": "https://enter-your-SharePoint-site/_layouts/workbench.aspx",
13
9
  "webRoot": "${workspaceRoot}",
@@ -1,4 +1,4 @@
1
- import { IBaseOptions, BaseGenerator, AvailableFrameworks } from '../../common/BaseGenerator';
1
+ import { IBaseOptions, BaseGenerator, AvailableTemplates } from '../../common/BaseGenerator';
2
2
  import * as BaseComponent from '../component/BaseComponentGenerator';
3
3
  export interface IWebpartOptions extends BaseComponent.IBaseComponentOptions {
4
4
  }
@@ -9,7 +9,7 @@ export declare function defineOptions<TOptions extends IBaseOptions, TContext>(g
9
9
  export declare class WebpartGenerator extends BaseComponent.BaseComponentGenerator<IWebpartOptions, IWebpartContext> {
10
10
  protected readonly friendlyName: string;
11
11
  protected readonly codeName: string;
12
- protected readonly allowedFrameworks: AvailableFrameworks[];
12
+ protected readonly allowedTemplates: AvailableTemplates[];
13
13
  protected readonly folderName: string;
14
14
  initializing(): void;
15
15
  prompting(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/webpart/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAG9F,OAAO,KAAK,aAAa,MAAM,qCAAqC,CAAC;AAErE,MAAM,WAAW,eAAgB,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAE/E,MAAM,WAAW,eAAgB,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAE/E,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACnE,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC3C,IAAI,CAEN;AAED,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,sBAAsB,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1G,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAc;IACrD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAa;IAChD,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,mBAAmB,EAAE,CAAa;IACxE,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAc;IAE5C,YAAY,IAAI,IAAI;IAIpB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ1B,WAAW,IAAI,IAAI;IAQnB,OAAO,IAAI,IAAI;IAqBf,OAAO,IAAI,IAAI;IAMf,GAAG,IAAI,IAAI;IAIlB,SAAS,aAAa,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe;IAKvE,OAAO,CAAC,aAAa;CAGtB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/webpart/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAI7F,OAAO,KAAK,aAAa,MAAM,qCAAqC,CAAC;AAErE,MAAM,WAAW,eAAgB,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAE/E,MAAM,WAAW,eAAgB,SAAQ,aAAa,CAAC,qBAAqB;CAAG;AAE/E,wBAAgB,WAAW,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACjE,IAAI,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,EACvC,OAAO,EAAE,YAAY,GACpB,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,QAAQ,SAAS,YAAY,EAAE,QAAQ,EACnE,SAAS,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAC3C,IAAI,CAEN;AAED,qBAAa,gBAAiB,SAAQ,aAAa,CAAC,sBAAsB,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1G,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAc;IACrD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAa;IAChD,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,CAAwB;IACjF,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAc;IAE5C,YAAY,IAAI,IAAI;IAIpB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ1B,WAAW,IAAI,IAAI;IAenB,OAAO,IAAI,IAAI;IA0Bf,OAAO,IAAI,IAAI;IAMf,GAAG,IAAI,IAAI;IAIlB,SAAS,aAAa,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,OAAO,EAAE,eAAe;IAKvE,OAAO,CAAC,aAAa;CAGtB"}
@@ -22,6 +22,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.WebpartGenerator = exports.defineOptions = exports.composeWith = void 0;
23
23
  const path = __importStar(require("path"));
24
24
  const Utils = __importStar(require("../../common/utilities"));
25
+ const YeomanConfiguration_1 = require("../../common/YeomanConfiguration");
25
26
  const BaseComponent = __importStar(require("../component/BaseComponentGenerator"));
26
27
  function composeWith(base, options) {
27
28
  Utils.compose(path.basename(__dirname), base, options);
@@ -36,7 +37,7 @@ class WebpartGenerator extends BaseComponent.BaseComponentGenerator {
36
37
  super(args, options);
37
38
  this.friendlyName = 'Web part';
38
39
  this.codeName = 'WebPart';
39
- this.allowedFrameworks = ['react'];
40
+ this.allowedTemplates = ['react', 'minimal'];
40
41
  this.folderName = 'webparts';
41
42
  defineOptions(this);
42
43
  }
@@ -55,16 +56,23 @@ class WebpartGenerator extends BaseComponent.BaseComponentGenerator {
55
56
  super.configuring();
56
57
  this.ensureDependencyGroup('webpart');
57
58
  this.serveJson.setUpForWebParts();
59
+ const solutionName = YeomanConfiguration_1.YeomanConfiguration.libraryName;
60
+ this.packageSolutionJson.addFeature(Utils.generateGuid(), `${solutionName} Feature`, `The feature that activates elements of the ${solutionName} solution.`, false);
58
61
  }
59
62
  }
60
63
  writing() {
61
64
  if (this.shouldExecute()) {
62
- super.writing(true);
65
+ super.writing(false);
66
+ const dest = this._getOutputFolder(this.context.componentNameCamelCase);
67
+ const template = this.context.template;
68
+ this.copyTemplate(path.join(this.sourceRoot(), template), dest);
69
+ if (template !== 'minimal') {
70
+ this.copyTemplate(path.join(this.sourceRoot(), 'loc'), path.join(dest, 'loc'));
71
+ this.copyTemplate(path.join(this.sourceRoot(), 'assets'), path.join(dest, 'assets'));
72
+ }
73
+ this.copyTemplate(path.join(this.sourceRoot(), 'base'), dest);
63
74
  this.fs.copy(this.templatePath('./images/outline.png'), this.destinationPath(`teams/${this.context.componentId}_outline.png`));
64
75
  this.fs.copy(this.templatePath('./images/color.png'), this.destinationPath(`teams/${this.context.componentId}_color.png`));
65
- if (this.options.plusbeta) {
66
- this.fs.copyTpl(this.templatePath('./officeAddin/initial.outlookManifest.xml'), this.destinationPath(`officeAddin/${this.context.componentId}_outlookManifest.xml`), { componentId: this.context.componentId });
67
- }
68
76
  }
69
77
  }
70
78
  install() {
@@ -0,0 +1,11 @@
1
+ define([], function() {
2
+ return {
3
+ "PropertyPaneDescription": "Description",
4
+ "BasicGroupName": "Group Name",
5
+ "DescriptionFieldLabel": "Description Field",
6
+ "AppLocalEnvironmentSharePoint": "The app is running on your local environment as SharePoint web part",
7
+ "AppLocalEnvironmentTeams": "The app is running on your local environment as Microsoft Teams app",
8
+ "AppSharePointEnvironment": "The app is running on SharePoint page",
9
+ "AppTeamsTabEnvironment": "The app is running in Microsoft Teams"
10
+ }
11
+ });
@@ -2,6 +2,10 @@ declare interface I<%= componentStrings %> {
2
2
  PropertyPaneDescription: string;
3
3
  BasicGroupName: string;
4
4
  DescriptionFieldLabel: string;
5
+ AppLocalEnvironmentSharePoint: string;
6
+ AppLocalEnvironmentTeams: string;
7
+ AppSharePointEnvironment: string;
8
+ AppTeamsTabEnvironment: string;
5
9
  }
6
10
 
7
11
  declare module '<%= componentStrings %>' {
@@ -0,0 +1,4 @@
1
+ define([], function() {
2
+ return {
3
+ }
4
+ });
@@ -0,0 +1,7 @@
1
+ declare interface I<%= componentStrings %> {
2
+ }
3
+
4
+ declare module '<%= componentStrings %>' {
5
+ const strings: I<%= componentStrings %>;
6
+ export = strings;
7
+ }
@@ -0,0 +1,3 @@
1
+ .<%= componentNameCamelCase %> {
2
+ display: flex;
3
+ }
@@ -0,0 +1,22 @@
1
+ import { Version } from '@microsoft/sp-core-library';
2
+ import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
3
+
4
+ import styles from './<%= componentClassName %>.module.scss';
5
+
6
+ export interface I<%= componentClassName %>Props {
7
+ }
8
+
9
+ export default class <%= componentClassName %> extends BaseClientSideWebPart<I<%= componentClassName %>Props> {
10
+
11
+ protected onInit(): Promise<void> {
12
+ return super.onInit();
13
+ }
14
+
15
+ public render(): void {
16
+ this.domElement.innerHTML = `<div class="${ styles.<%= componentNameCamelCase %> }"></div>`;
17
+ }
18
+
19
+ protected get dataVersion(): Version {
20
+ return Version.parse('1.0');
21
+ }
22
+ }
@@ -1,74 +1,34 @@
1
1
  @import '~@microsoft/sp-office-ui-fabric-core/dist/sass/SPFabricCore.scss';
2
2
 
3
3
  .<%= componentNameCamelCase %> {
4
- .container {
5
- max-width: 700px;
6
- margin: 0px auto;
7
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
4
+ overflow: hidden;
5
+ padding: 1em;
6
+ color: "[theme:bodyText, default: #323130]";
7
+ color: var(--bodyText);
8
+ &.teams {
9
+ font-family: $ms-font-family-fallbacks;
8
10
  }
11
+ }
9
12
 
10
- .row {
11
- @include ms-Grid-row;
12
- @include ms-fontColor-white;
13
- background-color: $ms-color-themeDark;
14
- padding: 20px;
15
- }
16
-
17
- .column {
18
- @include ms-Grid-col;
19
- @include ms-lg10;
20
- @include ms-xl8;
21
- @include ms-xlPush2;
22
- @include ms-lgPush1;
23
- }
24
-
25
- .title {
26
- @include ms-font-xl;
27
- @include ms-fontColor-white;
28
- }
13
+ .welcome {
14
+ text-align: center;
15
+ }
29
16
 
30
- .subTitle {
31
- @include ms-font-l;
32
- @include ms-fontColor-white;
33
- }
34
-
35
- .description {
36
- @include ms-font-l;
37
- @include ms-fontColor-white;
38
- }
17
+ .welcomeImage {
18
+ width: 100%;
19
+ max-width: 420px;
20
+ }
39
21
 
40
- .button {
41
- // Our button
22
+ .links {
23
+ a {
42
24
  text-decoration: none;
43
- height: 32px;
44
-
45
- // Primary Button
46
- min-width: 80px;
47
- background-color: $ms-color-themePrimary;
48
- border-color: $ms-color-themePrimary;
49
- color: $ms-color-white;
50
-
51
- // Basic Button
52
- outline: transparent;
53
- position: relative;
54
- font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
55
- -webkit-font-smoothing: antialiased;
56
- font-size: $ms-font-size-m;
57
- font-weight: $ms-font-weight-regular;
58
- border-width: 0;
59
- text-align: center;
60
- cursor: pointer;
61
- display: inline-block;
62
- padding: 0 16px;
25
+ color: "[theme:link, default:#03787c]";
26
+ color: var(--link); // note: CSS Custom Properties support is limited to modern browsers only
63
27
 
64
- .label {
65
- font-weight: $ms-font-weight-semibold;
66
- font-size: $ms-font-size-m;
67
- height: 32px;
68
- line-height: 32px;
69
- margin: 0 4px;
70
- vertical-align: top;
71
- display: inline-block;
28
+ &:hover {
29
+ text-decoration: underline;
30
+ color: "[theme:linkHovered, default: #014446]";
31
+ color: var(--linkHovered); // note: CSS Custom Properties support is limited to modern browsers only
72
32
  }
73
33
  }
74
34
  }
@@ -4,6 +4,7 @@ import {
4
4
  PropertyPaneTextField
5
5
  } from '@microsoft/sp-property-pane';
6
6
  import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
7
+ import { IReadonlyTheme } from '@microsoft/sp-component-base';
7
8
  import { escape } from '@microsoft/sp-lodash-subset';
8
9
 
9
10
  import styles from './<%= componentClassName %>.module.scss';
@@ -15,22 +16,64 @@ export interface I<%= componentClassName %>Props {
15
16
 
16
17
  export default class <%= componentClassName %> extends BaseClientSideWebPart<I<%= componentClassName %>Props> {
17
18
 
19
+ private _isDarkTheme: boolean = false;
20
+ private _environmentMessage: string = '';
21
+
22
+ protected onInit(): Promise<void> {
23
+ this._environmentMessage = this._getEnvironmentMessage();
24
+
25
+ return super.onInit();
26
+ }
27
+
18
28
  public render(): void {
19
29
  this.domElement.innerHTML = `
20
- <div class="${ styles.<%= componentNameCamelCase %> }">
21
- <div class="${ styles.container }">
22
- <div class="${ styles.row }">
23
- <div class="${ styles.column }">
24
- <span class="${ styles.title }">Welcome to SharePoint!</span>
25
- <p class="${ styles.subTitle }">Customize SharePoint experiences using Web Parts.</p>
26
- <p class="${ styles.description }">${escape(this.properties.description)}</p>
27
- <a href="https://aka.ms/spfx" class="${ styles.button }">
28
- <span class="${ styles.label }">Learn more</span>
29
- </a>
30
- </div>
31
- </div>
32
- </div>
33
- </div>`;
30
+ <section class="${styles.<%= componentNameCamelCase %>} ${!!this.context.sdks.microsoftTeams ? styles.teams : ''}">
31
+ <div class="${styles.welcome}">
32
+ <img alt="" src="${this._isDarkTheme ? require('./assets/welcome-dark.png') : require('./assets/welcome-light.png')}" class="${styles.welcomeImage}" />
33
+ <h2>Well done, ${escape(this.context.pageContext.user.displayName)}!</h2>
34
+ <div>${this._environmentMessage}</div>
35
+ <div>Web part property value: <strong>${escape(this.properties.description)}</strong></div>
36
+ </div>
37
+ <div>
38
+ <h3>Welcome to SharePoint Framework!</h3>
39
+ <p>
40
+ The SharePoint Framework (SPFx) is a extensibility model for Microsoft Viva, Microsoft Teams and SharePoint. It's the easiest way to extend Microsoft 365 with automatic Single Sign On, automatic hosting and industry standard tooling.
41
+ </p>
42
+ <h4>Learn more about SPFx development:</h4>
43
+ <ul class="${styles.links}">
44
+ <li><a href="https://aka.ms/spfx" target="_blank">SharePoint Framework Overview</a></li>
45
+ <li><a href="https://aka.ms/spfx-yeoman-graph" target="_blank">Use Microsoft Graph in your solution</a></li>
46
+ <li><a href="https://aka.ms/spfx-yeoman-teams" target="_blank">Build for Microsoft Teams using SharePoint Framework</a></li>
47
+ <li><a href="https://aka.ms/spfx-yeoman-viva" target="_blank">Build for Microsoft Viva Connections using SharePoint Framework</a></li>
48
+ <li><a href="https://aka.ms/spfx-yeoman-store" target="_blank">Publish SharePoint Framework applications to the marketplace</a></li>
49
+ <li><a href="https://aka.ms/spfx-yeoman-api" target="_blank">SharePoint Framework API reference</a></li>
50
+ <li><a href="https://aka.ms/m365pnp" target="_blank">Microsoft 365 Developer Community</a></li>
51
+ </ul>
52
+ </div>
53
+ </section>`;
54
+ }
55
+
56
+ private _getEnvironmentMessage(): string {
57
+ if (!!this.context.sdks.microsoftTeams) { // running in Teams
58
+ return this.context.isServedFromLocalhost ? strings.AppLocalEnvironmentTeams : strings.AppTeamsTabEnvironment;
59
+ }
60
+
61
+ return this.context.isServedFromLocalhost ? strings.AppLocalEnvironmentSharePoint : strings.AppSharePointEnvironment;
62
+ }
63
+
64
+ protected onThemeChanged(currentTheme: IReadonlyTheme | undefined): void {
65
+ if (!currentTheme) {
66
+ return;
67
+ }
68
+
69
+ this._isDarkTheme = !!currentTheme.isInverted;
70
+ const {
71
+ semanticColors
72
+ } = currentTheme;
73
+ this.domElement.style.setProperty('--bodyText', semanticColors.bodyText);
74
+ this.domElement.style.setProperty('--link', semanticColors.link);
75
+ this.domElement.style.setProperty('--linkHovered', semanticColors.linkHovered);
76
+
34
77
  }
35
78
 
36
79
  protected get dataVersion(): Version {
@@ -1,3 +1,7 @@
1
1
  export interface I<%= componentName %>Props {
2
2
  description: string;
3
+ isDarkTheme: boolean;
4
+ environmentMessage: string;
5
+ hasTeamsContext: boolean;
6
+ userDisplayName: string;
3
7
  }
@@ -1,74 +1,34 @@
1
1
  @import '~office-ui-fabric-react/dist/sass/References.scss';
2
2
 
3
3
  .<%= componentNameCamelCase %> {
4
- .container {
5
- max-width: 700px;
6
- margin: 0px auto;
7
- box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1);
8
- }
9
-
10
- .row {
11
- @include ms-Grid-row;
12
- @include ms-fontColor-white;
13
- background-color: $ms-color-themeDark;
14
- padding: 20px;
15
- }
16
-
17
- .column {
18
- @include ms-Grid-col;
19
- @include ms-lg10;
20
- @include ms-xl8;
21
- @include ms-xlPush2;
22
- @include ms-lgPush1;
23
- }
24
-
25
- .title {
26
- @include ms-font-xl;
27
- @include ms-fontColor-white;
4
+ overflow: hidden;
5
+ padding: 1em;
6
+ color: "[theme:bodyText, default: #323130]";
7
+ color: var(--bodyText);
8
+ &.teams {
9
+ font-family: $ms-font-family-fallbacks;
28
10
  }
11
+ }
29
12
 
30
- .subTitle {
31
- @include ms-font-l;
32
- @include ms-fontColor-white;
33
- }
13
+ .welcome {
14
+ text-align: center;
15
+ }
34
16
 
35
- .description {
36
- @include ms-font-l;
37
- @include ms-fontColor-white;
38
- }
17
+ .welcomeImage {
18
+ width: 100%;
19
+ max-width: 420px;
20
+ }
39
21
 
40
- .button {
41
- // Our button
22
+ .links {
23
+ a {
42
24
  text-decoration: none;
43
- height: 32px;
25
+ color: "[theme:link, default:#03787c]";
26
+ color: var(--link); // note: CSS Custom Properties support is limited to modern browsers only
44
27
 
45
- // Primary Button
46
- min-width: 80px;
47
- background-color: $ms-color-themePrimary;
48
- border-color: $ms-color-themePrimary;
49
- color: $ms-color-white;
50
-
51
- // Basic Button
52
- outline: transparent;
53
- position: relative;
54
- font-family: "Segoe UI WestEuropean","Segoe UI",-apple-system,BlinkMacSystemFont,Roboto,"Helvetica Neue",sans-serif;
55
- -webkit-font-smoothing: antialiased;
56
- font-size: $ms-font-size-m;
57
- font-weight: $ms-font-weight-regular;
58
- border-width: 0;
59
- text-align: center;
60
- cursor: pointer;
61
- display: inline-block;
62
- padding: 0 16px;
63
-
64
- .label {
65
- font-weight: $ms-font-weight-semibold;
66
- font-size: $ms-font-size-m;
67
- height: 32px;
68
- line-height: 32px;
69
- margin: 0 4px;
70
- vertical-align: top;
71
- display: inline-block;
28
+ &:hover {
29
+ text-decoration: underline;
30
+ color: "[theme:linkHovered, default: #014446]";
31
+ color: var(--linkHovered); // note: CSS Custom Properties support is limited to modern browsers only
72
32
  }
73
33
  }
74
- }
34
+ }