From 2a9391bffd34363ed9197a8ce3ff7064e397526c Mon Sep 17 00:00:00 2001 From: Mark Cunningham Date: Sun, 15 Nov 2020 14:11:46 +0000 Subject: [PATCH] Added getVisible and getDisabled support --- .../pcfcontroldemo/MultiSelectControl/MultiSelect.tsx | 11 ++++++++++- controls/pcfcontroldemo/MultiSelectControl/index.ts | 7 ++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/controls/pcfcontroldemo/MultiSelectControl/MultiSelect.tsx b/controls/pcfcontroldemo/MultiSelectControl/MultiSelect.tsx index e1478c3..243c197 100644 --- a/controls/pcfcontroldemo/MultiSelectControl/MultiSelect.tsx +++ b/controls/pcfcontroldemo/MultiSelectControl/MultiSelect.tsx @@ -2,6 +2,8 @@ import * as React from "react"; import AsyncSelect from 'react-select/async'; export interface IProps { + isControlVisible: boolean; + isControlDisabled: boolean; displayValueField: any; displayFieldLabel: any; columns: any; @@ -55,6 +57,8 @@ export class MultiSelectControl extends React.Component { { const selectStyles = { menuPortal: (zindex: any) => ({ ...zindex, zIndex: 9999}) }; + if (this.props.isControlVisible) + { return (
{ getOptionValue={e => e[this.props.displayValueField]} loadOptions={this.loadOptions} defaultOptions + isDisabled={this.props.isControlDisabled} onChange={this.onChange} />
- ); + ) + } + else{ + return (<>); + }; } } \ No newline at end of file diff --git a/controls/pcfcontroldemo/MultiSelectControl/index.ts b/controls/pcfcontroldemo/MultiSelectControl/index.ts index c1e7599..be49293 100644 --- a/controls/pcfcontroldemo/MultiSelectControl/index.ts +++ b/controls/pcfcontroldemo/MultiSelectControl/index.ts @@ -19,7 +19,9 @@ export class MultiSelectPCFControl implements ComponentFramework.StandardControl columns: "", topCount: "", filterField: "", - entityName: "" + entityName: "", + isControlVisible: true, + isControlDisabled: true }; private _context: ComponentFramework.Context; @@ -77,6 +79,9 @@ export class MultiSelectPCFControl implements ComponentFramework.StandardControl private renderElement() { + this.props.isControlDisabled = this._context.mode.isControlDisabled; + this.props.isControlVisible = this._context.mode.isVisible; + ReactDOM.render( React.createElement(MultiSelectControl, this.props) , this._container