UNPKG

mui-spfx-controls

Version:
145 lines 7.24 kB
import { __awaiter, __extends, __generator } from "tslib"; import { Version } from '@microsoft/sp-core-library'; import { PropertyPaneTextField, PropertyPaneToggle, } from '@microsoft/sp-property-pane'; import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base'; import { Logger } from '@pnp/logging'; import { Elanguages, IColumnReturnProperty, PropertyFieldColumnPicker, PropertyFieldColumnPickerOrderBy, PropertyFieldListPicker, PropertyFieldListPickerOrderBy, PropertyFieldMonacoEditor, } from '@pnp/spfx-property-controls'; import * as strings from 'DashboardWebPartStrings'; import * as React from 'react'; import * as ReactDom from 'react-dom'; import DashboardDisplay from './DashboardDisplay'; var DashboardWebPart = /** @class */ (function (_super) { __extends(DashboardWebPart, _super); function DashboardWebPart() { return _super !== null && _super.apply(this, arguments) || this; } DashboardWebPart.prototype.render = function () { var parsedTabValue = []; try { parsedTabValue = JSON.parse(this.properties.tabValue); } catch (error) { Logger.error(error); } var element = React.createElement(DashboardDisplay, { context: this.context, list: this.properties.list, fields: this.properties.fields, editable: this.properties.editable, resizable: this.properties.resizable, columnAction: this.properties.columnAction, exportAction: this.properties.exportAction, tabAction: this.properties.tabAction, filterAction: this.properties.filterAction, densityAction: this.properties.densityAction, searchAction: this.properties.searchAction, height: this.properties.height, tabValue: parsedTabValue, }); ReactDom.render(element, this.domElement); }; DashboardWebPart.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*/]; } }); }); }; DashboardWebPart.prototype.onDispose = function () { ReactDom.unmountComponentAtNode(this.domElement); }; Object.defineProperty(DashboardWebPart.prototype, "dataVersion", { get: function () { return Version.parse('1.0'); }, enumerable: false, configurable: true }); DashboardWebPart.prototype.getPropertyPaneConfiguration = function () { return { pages: [ { header: { description: strings.PropertyPaneDescription, }, groups: [ { groupName: strings.BasicGroupName, groupFields: [ PropertyFieldListPicker('list', { label: strings.ListFieldLabel, selectedList: this.properties.list, includeHidden: false, orderBy: PropertyFieldListPickerOrderBy.Title, disabled: false, onPropertyChange: this.onPropertyPaneFieldChanged.bind(this), properties: this.properties, context: this.context, key: 'listPickerFieldId', }), PropertyFieldColumnPicker('fields', { label: strings.ColumnsFieldLabel, context: this.context, selectedColumn: this.properties.fields, listId: this.properties.list, disabled: false, orderBy: PropertyFieldColumnPickerOrderBy.Title, onPropertyChange: this.onPropertyPaneFieldChanged.bind(this), properties: this.properties, deferredValidationTime: 0, key: 'columnPickerFieldId', displayHiddenColumns: false, columnReturnProperty: IColumnReturnProperty['Internal Name'], multiSelect: true, }), PropertyPaneToggle('searchAction', { label: strings.SearchActionFieldLabel, }), PropertyPaneToggle('tabAction', { label: strings.TabActionFieldLabel, }), PropertyPaneToggle('exportAction', { label: strings.ExportActionFieldLabel, }), PropertyPaneToggle('columnAction', { label: strings.ColumnActionFieldLabel, }), PropertyPaneToggle('filterAction', { label: strings.FilterActionFieldLabel, }), PropertyPaneToggle('densityAction', { label: strings.DensityActionFieldLabel, }), PropertyPaneToggle('editable', { label: strings.EditableActionFieldLabel, }), PropertyPaneToggle('resizable', { label: strings.ResizableActionFieldLabel, }), PropertyFieldMonacoEditor('tabValue', { key: 'tabValue-editor', language: Elanguages.json, value: this.properties.tabValue, showLineNumbers: true, showMiniMap: true, }), PropertyPaneTextField('height', { label: strings.HeightFieldLabel, description: strings.HeightFieldDescription, }), ], }, ], }, ], }; }; return DashboardWebPart; }(BaseClientSideWebPart)); export default DashboardWebPart; //# sourceMappingURL=DashboardWebPart.js.map