mui-spfx-controls
Version:
SPFx component library built with MUI
102 lines • 4.58 kB
JavaScript
import { __awaiter, __extends, __generator } from "tslib";
import { Version } from '@microsoft/sp-core-library';
import { PropertyPaneDropdown, } from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { PropertyFieldListPicker, PropertyFieldListPickerOrderBy, } from '@pnp/spfx-property-controls';
import * as React from 'react';
import * as ReactDom from 'react-dom';
import * as strings from 'ExplorerWebPartStrings';
import ExplorerDisplay from './ExplorerDisplay';
var ExplorerWebPart = /** @class */ (function (_super) {
__extends(ExplorerWebPart, _super);
function ExplorerWebPart() {
return _super !== null && _super.apply(this, arguments) || this;
}
ExplorerWebPart.prototype.render = function () {
var element = React.createElement(ExplorerDisplay, {
context: this.context,
library: this.properties.library,
defaultDisplayType: this.properties.displayType,
});
ReactDom.render(element, this.domElement);
};
ExplorerWebPart.prototype.onInit = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _super.prototype.onInit.call(this)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
ExplorerWebPart.prototype.onDispose = function () {
ReactDom.unmountComponentAtNode(this.domElement);
};
Object.defineProperty(ExplorerWebPart.prototype, "dataVersion", {
get: function () {
return Version.parse('1.0');
},
enumerable: false,
configurable: true
});
ExplorerWebPart.prototype.getPropertyPaneConfiguration = function () {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
PropertyFieldListPicker('library', {
label: 'Select a list',
selectedList: this.properties.library,
orderBy: PropertyFieldListPickerOrderBy.Title,
baseTemplate: 101,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
listsToExclude: [
'Form Templates',
'Site Assets',
'Style Library',
'Content and Structure Reports',
'Site Pages',
'Images',
'Pages',
'_catalogs/hubsite',
],
includeListTitleAndUrl: true,
properties: this.properties,
context: this.context,
deferredValidationTime: 0,
key: 'listPickerFieldId',
}),
PropertyPaneDropdown('displayType', {
label: 'Select the display type',
selectedKey: 'grid',
options: [
{
key: 'list',
text: 'list',
},
{
key: 'grid',
text: 'grid',
},
],
}),
],
},
],
},
],
};
};
return ExplorerWebPart;
}(BaseClientSideWebPart));
export default ExplorerWebPart;
//# sourceMappingURL=ExplorerWebPart.js.map