feat: added a new property to hide/unhide webpart

feat: added a new FluentUI based css class to hide webpart
This commit is contained in:
babakdanyal 2023-06-27 14:00:00 +10:00
parent 8665d4665a
commit b7d34c459e
No known key found for this signature in database
28 changed files with 84 additions and 46 deletions

View File

@ -18,6 +18,7 @@ export interface IEnhancedPowerAppsWebPartProps {
height: number; height: number;
width: number; width: number;
aspectratio: '16:9' | '3:2' | '16:10' | '4:3' | 'Custom'; aspectratio: '16:9' | '3:2' | '16:10' | '4:3' | 'Custom';
isWebPartHiddenOnSmallDevices: boolean;
themeValues: string[]; themeValues: string[];
} }
export default class EnhancedPowerAppsWebPart extends BaseClientSideWebPart<IEnhancedPowerAppsWebPartProps> { export default class EnhancedPowerAppsWebPart extends BaseClientSideWebPart<IEnhancedPowerAppsWebPartProps> {

View File

@ -1 +1 @@
{"version":3,"file":"EnhancedPowerAppsWebPart.d.ts","sourceRoot":"","sources":["../../../src/webparts/enhancedPowerApps/EnhancedPowerAppsWebPart.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EACL,0BAA0B,EAK3B,MAAM,6BAA6B,CAAC;AAMrC;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D;;GAEG;AACH,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAG3B,MAAM,4BAA4B,CAAC;AAuBpC,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,GAAC,aAAa,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAC,KAAK,GAAC,OAAO,GAAC,KAAK,GAAC,QA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EAAE,MAAM,GAAC,KAAK,GAAC,OAAO,GAAC,KAAK,GAAC,QAAQ,CAAC;IACjD,6BAA6B,EAAE,OAAO,CAAC;IACvC,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,qBAAqB,CAAC,8BAA8B,CAAC;IACzG,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,aAAa,CAA6B;IAElD,SAAS,CAAC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAa1B,MAAM,IAAI,IAAI;IA6DrB,SAAS,CAAC,SAAS,IAAI,IAAI;uBAIb,WAAW,EAAI,OAAO;IAIpC,SAAS,CAAC,4BAA4B,IAAI,0BAA0B;uBA2ItD,kBAAkB,EAAI,0BAA0B;IAU9D,OAAO,CAAC,YAAY,CAEnB;IAED;;;;KAIC;IACD,OAAO,CAAC,wBAAwB;IAKhC;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;CAIjD"}

View File

@ -100,6 +100,7 @@ var EnhancedPowerAppsWebPart = /** @class */ (function (_super) {
height: clientHeight, height: clientHeight,
themeVariant: this._themeVariant, themeVariant: this._themeVariant,
border: this.properties.border, border: this.properties.border,
isWebPartHiddenOnSmallDevices: this.properties.isWebPartHiddenOnSmallDevices,
themeValues: this.properties.themeValues themeValues: this.properties.themeValues
}); });
ReactDom.render(element, this.domElement); ReactDom.render(element, this.domElement);
@ -139,6 +140,9 @@ var EnhancedPowerAppsWebPart = /** @class */ (function (_super) {
PropertyPaneToggle('border', { PropertyPaneToggle('border', {
label: strings.BorderFieldLabel label: strings.BorderFieldLabel
}), }),
PropertyPaneToggle('isWebPartHiddenOnSmallDevices', {
label: strings.IsWebPartHiddenOnSmallDevicesFieldLabel
}),
PropertyPaneChoiceGroup('layout', { PropertyPaneChoiceGroup('layout', {
label: strings.LayoutFieldLabel, label: strings.LayoutFieldLabel,
options: [ options: [
@ -191,7 +195,7 @@ var EnhancedPowerAppsWebPart = /** @class */ (function (_super) {
}), }),
this.properties.layout === "AspectRatio" && this.properties.aspectratio === "Custom" && PropertyPaneTextField('height', { this.properties.layout === "AspectRatio" && this.properties.aspectratio === "Custom" && PropertyPaneTextField('height', {
label: strings.HeightFieldLabel, label: strings.HeightFieldLabel,
}), })
] ]
}, },
{ {

View File

@ -21,6 +21,7 @@
"properties": { "properties": {
"layout": 'AspectRatio', "layout": 'AspectRatio',
"aspectratio": '16:9', "aspectratio": '16:9',
"isWebPartHiddenOnSmallDevices":false
} }
}] }]
} }

View File

@ -24,7 +24,7 @@ var EnhancedPowerApps = /** @class */ (function (_super) {
return _super !== null && _super.apply(this, arguments) || this; return _super !== null && _super.apply(this, arguments) || this;
} }
EnhancedPowerApps.prototype.render = function () { EnhancedPowerApps.prototype.render = function () {
var _a = this.props, dynamicProp = _a.dynamicProp, themeVariant = _a.themeVariant, themeValues = _a.themeValues, appWebLink = _a.appWebLink, useDynamicProp = _a.useDynamicProp, dynamicPropName = _a.dynamicPropName, locale = _a.locale, border = _a.border, height = _a.height; var _a = this.props, dynamicProp = _a.dynamicProp, themeVariant = _a.themeVariant, themeValues = _a.themeValues, appWebLink = _a.appWebLink, useDynamicProp = _a.useDynamicProp, dynamicPropName = _a.dynamicPropName, locale = _a.locale, border = _a.border, isWebPartHiddenOnSmallDevices = _a.isWebPartHiddenOnSmallDevices, height = _a.height;
// The only thing we need for this web part to be configured is an app link or app id // The only thing we need for this web part to be configured is an app link or app id
var needConfiguration = !appWebLink; var needConfiguration = !appWebLink;
var semanticColors = themeVariant.semanticColors; var semanticColors = themeVariant.semanticColors;
@ -48,7 +48,7 @@ var EnhancedPowerApps = /** @class */ (function (_super) {
} }
// Build the frame url // Build the frame url
var frameUrl = appUrl + "?source=SPClient-EnhancedPowerAppsWebPart&amp;locale=" + locale + "&amp;enableOnBehalfOf=true&amp;authMode=onbehalfof&amp;hideNavBar=true&amp;" + dynamicPropValue + themeParams + "&locale=" + locale; var frameUrl = appUrl + "?source=SPClient-EnhancedPowerAppsWebPart&amp;locale=" + locale + "&amp;enableOnBehalfOf=true&amp;authMode=onbehalfof&amp;hideNavBar=true&amp;" + dynamicPropValue + themeParams + "&locale=" + locale;
return (React.createElement("div", { className: styles.enhancedPowerApps, style: needConfiguration ? { height: "315px" } : { height: height + "px" } }, return (React.createElement("div", { className: isWebPartHiddenOnSmallDevices ? styles.enhancedPowerApps && styles.hideOnMobileDevices : styles.enhancedPowerApps, style: needConfiguration ? { height: "315px" } : { height: height + "px" } },
needConfiguration && needConfiguration &&
React.createElement(Placeholder, { iconName: 'PowerApps', iconText: strings.PlaceholderIconText, description: strings.PlaceholderDescription, buttonLabel: strings.PlaceholderButtonLabel, onConfigure: this.props.onConfigure }), React.createElement(Placeholder, { iconName: 'PowerApps', iconText: strings.PlaceholderIconText, description: strings.PlaceholderDescription, buttonLabel: strings.PlaceholderButtonLabel, onConfigure: this.props.onConfigure }),
!needConfiguration && !needConfiguration &&

View File

@ -1 +1 @@
{"version":3,"file":"EnhancedPowerApps.js","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/EnhancedPowerApps.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAErD,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAE3D;;KAEK;AACL,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAQvE;IAA+C,qCAAiE;IAAhH;;IAmEA,CAAC;IAjEQ,kCAAM,GAAb;QACQ,IAAA,eAUU,EATd,4BAAW,EACX,8BAAY,EACZ,4BAAW,EACX,0BAAU,EACV,kCAAc,EACd,oCAAe,EACf,kBAAM,EACN,kBAAM,EACN,kBACc,CAAC;QAEjB,qFAAqF;QACrF,IAAM,iBAAiB,GAAY,CAAC,UAAU,CAAC;QAEvC,IAAA,4CAAc,CAAkC;QAExD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W,EAAE,OAAO,CAAC,sBAAsB,EAC3C,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAI;YACtC,CAAC,iBAAiB;gBACnB,0CACC,IAAI,CAAC,KAAK,CAAC,UAAU;oBACvB,gCAAQ,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,IAAI,EAAC,KAAK,EAAC,sDAAsD,EAAC,OAAO,EAAC,gIAAgI,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EACnR,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA,CAAC,CAAC,GAAG,GACpB,CAEN,CAEA,CACP,CAAC;IACJ,CAAC;IACH,wBAAC;AAAD,CAAC,AAnED,CAA+C,KAAK,CAAC,SAAS,GAmE7D"} {"version":3,"file":"EnhancedPowerApps.js","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/EnhancedPowerApps.tsx"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,MAAM,MAAM,iCAAiC,CAAC;AAErD,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAE3D;;KAEK;AACL,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAQvE;IAA+C,qCAAiE;IAAhH;;IAmEA,CAAC;IAjEQ,kCAAM,GAAb;QACQ,IAAA,eAWU,EAVd,4BAAW,EACX,8BAAY,EACZ,4BAAW,EACX,0BAAU,EACV,kCAAc,EACd,oCAAe,EACf,kBAAM,EACN,kBAAM,EACN,gEAA6B,EAC7B,kBACc,CAAC;QAEjB,qFAAqF;QACrF,IAAM,iBAAiB,GAAY,CAAC,UAAU,CAAC;QAEvC,IAAA,4CAAc,CAAkC;QAExD,sEAAsE;QACtE,IAAM,gBAAgB,GAAW,cAAc,IAAI,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,MAAI,kBAAkB,CAAC,eA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AC,sBAAsB,EAC3C,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,GAAI;YACtC,CAAC,iBAAiB;gBACnB,0CACC,IAAI,CAAC,KAAK,CAAC,UAAU;oBACvB,gCAAQ,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAC,IAAI,EAAC,KAAK,EAAC,sDAAsD,EAAC,OAAO,EAAC,gIAAgI,EAC3O,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EACvC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA,CAAC,CAAC,GAAG,GACpB,CAEN,CAEA,CACP,CAAC;IACJ,CAAC;IACH,wBAAC;AAAD,CAAC,AAnED,CAA+C,KAAK,CAAC,SAAS,GAmE7D"}

View File

@ -1,2 +1 @@
.enhancedPowerApps_466fc2fc{color:inherit}.enhancedPowerApps_466fc2fc span[class^=placeholderText_]{font-size:20px!important;font-weight:600!important;color:#323130}.enhancedPowerApps_466fc2fc span[class^=placeholderDescriptionText_]{color:#605e5c!important;margin:20px 0 28px;line-height:23px;font-size:16px!important} .enhancedPowerApps_dc8a3c45{color:inherit}.enhancedPowerApps_dc8a3c45 span[class^=placeholderText_]{font-size:20px!important;font-weight:600!important;color:#323130}.enhancedPowerApps_dc8a3c45 span[class^=placeholderDescriptionText_]{color:#605e5c!important;margin:20px 0 28px;line-height:23px;font-size:16px!important}@media only screen and (max-width:639.99999px){.hideOnMobileDevices_dc8a3c45{display:none!important}}
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImZpbGU6Ly8vd29ya3NwYWNlcy9zcC1kZXYtZngtd2VicGFydHMvc2FtcGxlcy9yZWFjdC1lbmhhbmNlZC1wb3dlcmFwcHMvc3JjL3dlYnBhcnRzL2VuaGFuY2VkUG93ZXJBcHBzL2NvbXBvbmVudHMvRW5oYW5jZWRQb3dlckFwcHMubW9kdWxlLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsNEJBQ0UsTUFBQSxRQU9BLDBEQUNFLFVBQUEsZUFDQSxZQUFBLGNBQ0EsTUFBQSxRQUdGLHFFQUNFLE1BQUEsa0JBQ0EsT0FBQSxLQUFBLEVBQUEsS0FDQSxZQUFBLEtBQ0EsVUFBQSJ9 */

View File

@ -1,5 +1,6 @@
declare const styles: { declare const styles: {
enhancedPowerApps: string; enhancedPowerApps: string;
hideOnMobileDevices: string;
}; };
export default styles; export default styles;
//# sourceMappingURL=EnhancedPowerApps.module.scss.d.ts.map //# sourceMappingURL=EnhancedPowerApps.module.scss.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"EnhancedPowerApps.module.scss.d.ts","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/EnhancedPowerApps.module.scss.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;CAEX,CAAC;AAEF,eAAe,MAAM,CAAC"} {"version":3,"file":"EnhancedPowerApps.module.scss.d.ts","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/EnhancedPowerApps.module.scss.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,MAAM;;;CAGX,CAAC;AAEF,eAAe,MAAM,CAAC"}

View File

@ -1,7 +1,8 @@
/* tslint:disable */ /* tslint:disable */
require("./EnhancedPowerApps.module.css"); require("./EnhancedPowerApps.module.css");
var styles = { var styles = {
enhancedPowerApps: 'enhancedPowerApps_466fc2fc' enhancedPowerApps: 'enhancedPowerApps_dc8a3c45',
hideOnMobileDevices: 'hideOnMobileDevices_dc8a3c45'
}; };
export default styles; export default styles;
/* tslint:enable */ /* tslint:enable */

View File

@ -1 +1 @@
{"version":3,"file":"EnhancedPowerApps.module.scss.js","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/EnhancedPowerApps.module.scss.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC1C,IAAM,MAAM,GAAG;IACb,iBAAiB,EAAE,4BAA4B;CAChD,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,mBAAmB"} {"version":3,"file":"EnhancedPowerApps.module.scss.js","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/EnhancedPowerApps.module.scss.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,CAAC,gCAAgC,CAAC,CAAC;AAC1C,IAAM,MAAM,GAAG;IACb,iBAAiB,EAAE,4BAA4B;IAC/C,mBAAmB,EAAE,8BAA8B;CACpD,CAAC;AAEF,eAAe,MAAM,CAAC;AACtB,mBAAmB"}

View File

@ -41,6 +41,10 @@ export interface IEnhancedPowerAppsProps {
* Whether we show border or not * Whether we show border or not
*/ */
border: boolean; border: boolean;
/**
* Whether we show webpart or not
*/
isWebPartHiddenOnSmallDevices: boolean;
/** /**
* Selected theme values to pass to Power Apps * Selected theme values to pass to Power Apps
*/ */

View File

@ -1 +1 @@
{"version":3,"file":"IEnhancedPowerAppsProps.d.ts","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/IEnhancedPowerAppsProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;IAExB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;IAEzC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB"} {"version":3,"file":"IEnhancedPowerAppsProps.d.ts","sourceRoot":"","sources":["../../../../src/webparts/enhancedPowerApps/components/IEnhancedPowerAppsProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,EAAE,MAAM,IAAI,CAAC;IAExB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,YAAY,EAAE,cAAc,GAAG,SAAS,CAAC;IAEzC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;IAEvC;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB"}

View File

@ -26,6 +26,7 @@ define([], function() {
PlaceholderIconText: "Enhanced Microsoft Power Apps", PlaceholderIconText: "Enhanced Microsoft Power Apps",
PropertyPaneDescription: "Add a custom business app by pasting its web link or ID below.", PropertyPaneDescription: "Add a custom business app by pasting its web link or ID below.",
BasicGroupName: "Basic Configuration", BasicGroupName: "Basic Configuration",
AppWebLinkFieldLabel: "App web link or ID" AppWebLinkFieldLabel: "App web link or ID",
IsWebPartHiddenOnSmallDevicesFieldLabel: "Hide webpart on mobile devices"
} }
}); });

View File

@ -2939,6 +2939,14 @@
"tslint": "~5.12.1", "tslint": "~5.12.1",
"tslint-microsoft-contrib": "~5.2.1", "tslint-microsoft-contrib": "~5.2.1",
"typescript": "~3.3.3" "typescript": "~3.3.3"
},
"dependencies": {
"typescript": {
"version": "3.3.4000",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.4000.tgz",
"integrity": "sha512-jjOcCZvpkl2+z7JFn0yBOoLQyLoIkNZAs/fYJkUG6VKy6zLPHJGfQJYFHzibB6GJaF/8QrcECtlQ5cpvRHSMEA==",
"dev": true
}
} }
}, },
"@microsoft/sp-build-core-tasks": { "@microsoft/sp-build-core-tasks": {
@ -3715,16 +3723,6 @@
"msal": "1.4.13", "msal": "1.4.13",
"msalLegacy": "npm:msal@1.4.12", "msalLegacy": "npm:msal@1.4.12",
"tslib": "~1.10.0" "tslib": "~1.10.0"
},
"dependencies": {
"msalLegacy": {
"version": "npm:msal@1.4.12",
"resolved": "https://registry.npmjs.org/msal/-/msal-1.4.12.tgz",
"integrity": "sha512-gjupwQ6nvNL6mZkl5NIXyUmZhTiEMRu5giNdgHMh8l5EPOnV2Xj6nukY1NIxFacSTkEYUSDB47Pej9GxDYf+1w==",
"requires": {
"tslib": "^1.9.3"
}
}
} }
}, },
"@microsoft/sp-loader": { "@microsoft/sp-loader": {
@ -15970,6 +15968,14 @@
"tslib": "^1.9.3" "tslib": "^1.9.3"
} }
}, },
"msalLegacy": {
"version": "npm:msal@1.4.12",
"resolved": "https://registry.npmjs.org/msal/-/msal-1.4.12.tgz",
"integrity": "sha512-gjupwQ6nvNL6mZkl5NIXyUmZhTiEMRu5giNdgHMh8l5EPOnV2Xj6nukY1NIxFacSTkEYUSDB47Pej9GxDYf+1w==",
"requires": {
"tslib": "^1.9.3"
}
},
"multicast-dns": { "multicast-dns": {
"version": "6.2.3", "version": "6.2.3",
"resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz", "resolved": "https://registry.npmjs.org/multicast-dns/-/multicast-dns-6.2.3.tgz",
@ -18535,14 +18541,13 @@
"integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao=" "integrity": "sha1-DD0L6u2KAclm2Xh793goElKpeao="
}, },
"react": { "react": {
"version": "16.8.5", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react/-/react-16.8.5.tgz", "resolved": "https://registry.npmjs.org/react/-/react-16.13.1.tgz",
"integrity": "sha512-daCb9TD6FZGvJ3sg8da1tRAtIuw29PbKZW++NN4wqkbEvxL+bZpaaYb4xuftW/SpXmgacf1skXl/ddX6CdOlDw==", "integrity": "sha512-YMZQQq32xHLX0bz5Mnibv1/LHb3Sqzngu7xstSM+vrkE5Kzr9xE0yMByK5kMoTK30YVJE61WfbxIFFvfeDKT1w==",
"requires": { "requires": {
"loose-envify": "^1.1.0", "loose-envify": "^1.1.0",
"object-assign": "^4.1.1", "object-assign": "^4.1.1",
"prop-types": "^15.6.2", "prop-types": "^15.6.2"
"scheduler": "^0.13.5"
} }
}, },
"react-ace": { "react-ace": {
@ -21744,9 +21749,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "3.3.4000", "version": "3.9.10",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.4000.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
"integrity": "sha512-jjOcCZvpkl2+z7JFn0yBOoLQyLoIkNZAs/fYJkUG6VKy6zLPHJGfQJYFHzibB6GJaF/8QrcECtlQ5cpvRHSMEA==", "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
"dev": true "dev": true
}, },
"ua-parser-js": { "ua-parser-js": {

View File

@ -1,6 +1,6 @@
{ {
"name": "react-enhanced-powerapps", "name": "react-enhanced-powerapps",
"version": "1.1.0", "version": "1.2.0",
"private": true, "private": true,
"main": "lib/index.js", "main": "lib/index.js",
"engines": { "engines": {
@ -21,12 +21,12 @@
"@microsoft/sp-webpart-base": "1.13.1", "@microsoft/sp-webpart-base": "1.13.1",
"@pnp/spfx-controls-react": "1.19.0", "@pnp/spfx-controls-react": "1.19.0",
"@pnp/spfx-property-controls": "1.19.0", "@pnp/spfx-property-controls": "1.19.0",
"office-ui-fabric-react": "6.214.0",
"react": "16.8.5",
"react-dom": "16.8.5",
"lodash": ">=4.17.19", "lodash": ">=4.17.19",
"serialize-javascript": ">=2.1.1", "lodash.template": ">=4.5.0",
"lodash.template": ">=4.5.0" "office-ui-fabric-react": "6.214.0",
"react": "^16.13.1",
"react-dom": "16.8.5",
"serialize-javascript": ">=2.1.1"
}, },
"devDependencies": { "devDependencies": {
"@microsoft/rush-stack-compiler-3.3": "0.3.5", "@microsoft/rush-stack-compiler-3.3": "0.3.5",
@ -47,6 +47,7 @@
"stylelint-config-css-modules": "^2.2.0", "stylelint-config-css-modules": "^2.2.0",
"stylelint-config-standard": "^20.0.0", "stylelint-config-standard": "^20.0.0",
"stylelint-scss": "^3.18.0", "stylelint-scss": "^3.18.0",
"typescript": "^3.9.10",
"webpack-bundle-analyzer": "^3.8.0" "webpack-bundle-analyzer": "^3.8.0"
} }
} }

View File

@ -21,6 +21,7 @@
"properties": { "properties": {
"layout": 'AspectRatio', "layout": 'AspectRatio',
"aspectratio": '16:9', "aspectratio": '16:9',
"isWebPartHiddenOnSmallDevices":false
} }
}] }]
} }

View File

@ -59,6 +59,7 @@ export interface IEnhancedPowerAppsWebPartProps {
height: number; height: number;
width: number; width: number;
aspectratio: '16:9'|'3:2'|'16:10'|'4:3'|'Custom'; aspectratio: '16:9'|'3:2'|'16:10'|'4:3'|'Custom';
isWebPartHiddenOnSmallDevices: boolean;
themeValues: string[]; themeValues: string[];
} }
@ -132,6 +133,7 @@ export default class EnhancedPowerAppsWebPart extends BaseClientSideWebPart<IEnh
height: clientHeight, height: clientHeight,
themeVariant: this._themeVariant, themeVariant: this._themeVariant,
border: this.properties.border, border: this.properties.border,
isWebPartHiddenOnSmallDevices: this.properties.isWebPartHiddenOnSmallDevices,
themeValues: this.properties.themeValues themeValues: this.properties.themeValues
} }
); );
@ -172,6 +174,9 @@ export default class EnhancedPowerAppsWebPart extends BaseClientSideWebPart<IEnh
PropertyPaneToggle('border', { PropertyPaneToggle('border', {
label: strings.BorderFieldLabel label: strings.BorderFieldLabel
}), }),
PropertyPaneToggle('isWebPartHiddenOnSmallDevices', {
label: strings.IsWebPartHiddenOnSmallDevicesFieldLabel
}),
PropertyPaneChoiceGroup('layout', { PropertyPaneChoiceGroup('layout', {
label: strings.LayoutFieldLabel, label: strings.LayoutFieldLabel,
options: [ options: [
@ -224,7 +229,7 @@ export default class EnhancedPowerAppsWebPart extends BaseClientSideWebPart<IEnh
}), }),
this.properties.layout === "AspectRatio" && this.properties.aspectratio === "Custom" && PropertyPaneTextField('height', { this.properties.layout === "AspectRatio" && this.properties.aspectratio === "Custom" && PropertyPaneTextField('height', {
label: strings.HeightFieldLabel, label: strings.HeightFieldLabel,
}), })
] ]
}, },
{ {

View File

@ -22,3 +22,9 @@
} }
// END // END
} }
.hideOnMobileDevices{
@include ms-screen-md-down {
display: none !important;
}
}

View File

@ -1,7 +1,8 @@
/* tslint:disable */ /* tslint:disable */
require("./EnhancedPowerApps.module.css"); require("./EnhancedPowerApps.module.css");
const styles = { const styles = {
enhancedPowerApps: 'enhancedPowerApps_466fc2fc' enhancedPowerApps: 'enhancedPowerApps_dc8a3c45',
hideOnMobileDevices: 'hideOnMobileDevices_dc8a3c45'
}; };
export default styles; export default styles;

View File

@ -26,6 +26,7 @@ export default class EnhancedPowerApps extends React.Component<IEnhancedPowerApp
dynamicPropName, dynamicPropName,
locale, locale,
border, border,
isWebPartHiddenOnSmallDevices,
height height
} = this.props; } = this.props;
@ -55,13 +56,11 @@ export default class EnhancedPowerApps extends React.Component<IEnhancedPowerApp
} }
}); });
} }
// Build the frame url // Build the frame url
const frameUrl: string = `${appUrl}?source=SPClient-EnhancedPowerAppsWebPart&amp;locale=${locale}&amp;enableOnBehalfOf=true&amp;authMode=onbehalfof&amp;hideNavBar=true&amp;${dynamicPropValue}${themeParams}&locale=${locale}`; const frameUrl: string = `${appUrl}?source=SPClient-EnhancedPowerAppsWebPart&amp;locale=${locale}&amp;enableOnBehalfOf=true&amp;authMode=onbehalfof&amp;hideNavBar=true&amp;${dynamicPropValue}${themeParams}&locale=${locale}`;
return ( return (
<div className={ styles.enhancedPowerApps } style={needConfiguration ? {height:`315px`}:{height:`${height}px`}}> <div className={ isWebPartHiddenOnSmallDevices?styles.enhancedPowerApps && styles.hideOnMobileDevices:styles.enhancedPowerApps} style={needConfiguration ? {height:`315px`}:{height:`${height}px`}}>
{needConfiguration && {needConfiguration &&
<Placeholder <Placeholder
iconName='PowerApps' iconName='PowerApps'
@ -72,7 +71,8 @@ export default class EnhancedPowerApps extends React.Component<IEnhancedPowerApp
{!needConfiguration && {!needConfiguration &&
<> <>
{ this.props.appWebLink && { this.props.appWebLink &&
<iframe src={frameUrl} scrolling="no" allow="geolocation *; microphone *; camera *; fullscreen *;" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-forms allow-orientation-lock allow-downloads" width={this.props.width} height={height} <iframe src={frameUrl} scrolling="no" allow="geolocation *; microphone *; camera *; fullscreen *;" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-forms allow-orientation-lock allow-downloads"
width={this.props.width} height={height}
frameBorder={border ? "1": "0"} frameBorder={border ? "1": "0"}
></iframe> ></iframe>
} }

View File

@ -54,6 +54,11 @@ export interface IEnhancedPowerAppsProps {
*/ */
border: boolean; border: boolean;
/**
* Whether we show webpart or not
*/
isWebPartHiddenOnSmallDevices: boolean;
/** /**
* Selected theme values to pass to Power Apps * Selected theme values to pass to Power Apps
*/ */

View File

@ -26,6 +26,7 @@ define([], function() {
PlaceholderIconText: "Enhanced Microsoft Power Apps", PlaceholderIconText: "Enhanced Microsoft Power Apps",
PropertyPaneDescription: "Add a custom business app by pasting its web link or ID below.", PropertyPaneDescription: "Add a custom business app by pasting its web link or ID below.",
BasicGroupName: "Basic Configuration", BasicGroupName: "Basic Configuration",
AppWebLinkFieldLabel: "App web link or ID" AppWebLinkFieldLabel: "App web link or ID",
IsWebPartHiddenOnSmallDevicesFieldLabel: "Hide webpart on mobile devices"
} }
}); });

View File

@ -26,6 +26,7 @@ declare interface IEnhancedPowerAppsWebPartStrings {
PropertyPaneDescription: string; PropertyPaneDescription: string;
BasicGroupName: string; BasicGroupName: string;
AppWebLinkFieldLabel: string; AppWebLinkFieldLabel: string;
IsWebPartHiddenOnSmallDevicesFieldLabel:string;
} }
declare module 'EnhancedPowerAppsWebPartStrings' { declare module 'EnhancedPowerAppsWebPartStrings' {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long