diff --git a/config/serve.json b/config/serve.json index ee06040..964fbe1 100644 --- a/config/serve.json +++ b/config/serve.json @@ -3,7 +3,7 @@ "port": 4321, "https": true, "serveConfigurations": { - "fieldCustomizer": { + "default": { "pageUrl": "https://sharepoint/sites/demo/Lists/Test/AllItems.aspx", "fieldCustomizers": { "ExpiryDate": { @@ -23,4 +23,3 @@ } } } - diff --git a/package.json b/package.json index 96a3542..b087739 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "@microsoft/sp-dialog": "1.4.1", "@microsoft/sp-http": "1.4.1", "@microsoft/sp-listview-extensibility": "1.4.1", + "@microsoft/sp-page-context": "1.4.1", "@types/es6-promise": "0.0.33", "@types/webpack-env": "1.13.1" }, @@ -30,4 +31,3 @@ "gulp": "~3.9.1" } } - diff --git a/src/extensions/expiryIndicator/ExpiryIndicatorFieldCustomizer.module.scss.ts b/src/extensions/expiryIndicator/ExpiryIndicatorFieldCustomizer.module.scss.ts new file mode 100644 index 0000000..f8a74fc --- /dev/null +++ b/src/extensions/expiryIndicator/ExpiryIndicatorFieldCustomizer.module.scss.ts @@ -0,0 +1,12 @@ +/* tslint:disable */ +require('./ExpiryIndicatorFieldCustomizer.module.css'); +const styles = { + cell: 'cell_012cf8b1', + date: 'date_012cf8b1', + label: 'label_012cf8b1', + calculated: 'calculated_012cf8b1', + neutral: 'neutral_012cf8b1', +}; + +export default styles; +/* tslint:enable */ \ No newline at end of file diff --git a/src/extensions/expiryIndicatorCommandSet/ExpiryIndicatorCommandSet.ts b/src/extensions/expiryIndicatorCommandSet/ExpiryIndicatorCommandSet.ts index 273e084..950e27e 100644 --- a/src/extensions/expiryIndicatorCommandSet/ExpiryIndicatorCommandSet.ts +++ b/src/extensions/expiryIndicatorCommandSet/ExpiryIndicatorCommandSet.ts @@ -1,6 +1,6 @@ import { override } from '@microsoft/decorators'; -import { SPPermission } from '@microsoft/sp-core-library'; import { Dialog } from '@microsoft/sp-dialog'; +import { SPPermission } from '@microsoft/sp-page-context'; import { BaseListViewCommandSet, Command, @@ -107,8 +107,9 @@ export default class ExpiryIndicatorCommandSet }; if (this._config.confirmExtension) { - Dialog.confirm(strings.ConfirmMessage.replace('{0}', String(ids.length))) - .then((confirmed: boolean): Promise => confirmed ? execute() : Promise.resolve()); + if (window.confirm(strings.ConfirmMessage.replace('{0}', String(ids.length)))) { + execute(); + } } else { execute(); } @@ -125,14 +126,12 @@ export default class ExpiryIndicatorCommandSet }); } ); - dialog.show().then((): void => { this.raiseOnChange(); }); + dialog.show(); } private _refreshFieldState(): Promise { return this._itemService.fieldExists(this._config.expiryField).then((exists: boolean): void => { this._expiryFieldExists = exists; - this.raiseOnChange(); }); } } - diff --git a/src/extensions/expiryIndicatorCommandSet/ExpirySettingsDialog.ts b/src/extensions/expiryIndicatorCommandSet/ExpirySettingsDialog.ts index 93275a5..37a1532 100644 --- a/src/extensions/expiryIndicatorCommandSet/ExpirySettingsDialog.ts +++ b/src/extensions/expiryIndicatorCommandSet/ExpirySettingsDialog.ts @@ -8,12 +8,12 @@ import { import * as strings from 'ExpiryIndicatorCommandSetStrings'; export class ExpirySettingsDialog extends BaseDialog { - private _config: IExpiryConfig; + private _expiryConfig: IExpiryConfig; private _save: (config: IExpiryConfig) => Promise; public constructor(config: IExpiryConfig, save: (config: IExpiryConfig) => Promise) { super(); - this._config = config; + this._expiryConfig = config; this._save = save; } @@ -49,14 +49,14 @@ export class ExpirySettingsDialog extends BaseDialog { '' + ''; - this._setValue('baseField', this._config.baseField); - this._setValue('expiryField', this._config.expiryField); - this._setValue('lifetimeValue', String(this._config.default.lifeTime.value)); - this._setValue('lifetimeUnit', this._config.default.lifeTime.unit); - this._setValue('defaultColumnRule', JSON.stringify(this._config.default.columnRule, undefined, 2)); - this._setValue('rules', JSON.stringify(this._config.rules, undefined, 2)); - this._setValue('nullText', this._config.nullText); - (this._field('confirmExtension') as HTMLInputElement).checked = this._config.confirmExtension; + this._setValue('baseField', this._expiryConfig.baseField); + this._setValue('expiryField', this._expiryConfig.expiryField); + this._setValue('lifetimeValue', String(this._expiryConfig.default.lifeTime.value)); + this._setValue('lifetimeUnit', this._expiryConfig.default.lifeTime.unit); + this._setValue('defaultColumnRule', JSON.stringify(this._expiryConfig.default.columnRule, undefined, 2)); + this._setValue('rules', JSON.stringify(this._expiryConfig.rules, undefined, 2)); + this._setValue('nullText', this._expiryConfig.nullText); + (this._field('confirmExtension') as HTMLInputElement).checked = this._expiryConfig.confirmExtension; (this.domElement.querySelector('[data-action="cancel"]') as HTMLButtonElement).onclick = (): void => { this.close(); @@ -95,7 +95,7 @@ export class ExpirySettingsDialog extends BaseDialog { saveButton.disabled = true; this._save(config).then((): void => { - this._config = config; + this._expiryConfig = config; this.close(); }).catch((error: Error): void => { saveButton.disabled = false;