mui-spfx-controls
Version:
SPFx component library built with MUI
147 lines • 7.7 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var sp_core_library_1 = require("@microsoft/sp-core-library");
var sp_property_pane_1 = require("@microsoft/sp-property-pane");
var sp_webpart_base_1 = require("@microsoft/sp-webpart-base");
var logging_1 = require("@pnp/logging");
var spfx_property_controls_1 = require("@pnp/spfx-property-controls");
var strings = tslib_1.__importStar(require("DashboardWebPartStrings"));
var React = tslib_1.__importStar(require("react"));
var ReactDom = tslib_1.__importStar(require("react-dom"));
var DashboardDisplay_1 = tslib_1.__importDefault(require("./DashboardDisplay"));
var DashboardWebPart = /** @class */ (function (_super) {
tslib_1.__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) {
logging_1.Logger.error(error);
}
var element = React.createElement(DashboardDisplay_1.default, {
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 tslib_1.__awaiter(this, void 0, void 0, function () {
return tslib_1.__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 sp_core_library_1.Version.parse('1.0');
},
enumerable: false,
configurable: true
});
DashboardWebPart.prototype.getPropertyPaneConfiguration = function () {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
(0, spfx_property_controls_1.PropertyFieldListPicker)('list', {
label: strings.ListFieldLabel,
selectedList: this.properties.list,
includeHidden: false,
orderBy: spfx_property_controls_1.PropertyFieldListPickerOrderBy.Title,
disabled: false,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
properties: this.properties,
context: this.context,
key: 'listPickerFieldId',
}),
(0, spfx_property_controls_1.PropertyFieldColumnPicker)('fields', {
label: strings.ColumnsFieldLabel,
context: this.context,
selectedColumn: this.properties.fields,
listId: this.properties.list,
disabled: false,
orderBy: spfx_property_controls_1.PropertyFieldColumnPickerOrderBy.Title,
onPropertyChange: this.onPropertyPaneFieldChanged.bind(this),
properties: this.properties,
deferredValidationTime: 0,
key: 'columnPickerFieldId',
displayHiddenColumns: false,
columnReturnProperty: spfx_property_controls_1.IColumnReturnProperty['Internal Name'],
multiSelect: true,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('searchAction', {
label: strings.SearchActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('tabAction', {
label: strings.TabActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('exportAction', {
label: strings.ExportActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('columnAction', {
label: strings.ColumnActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('filterAction', {
label: strings.FilterActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('densityAction', {
label: strings.DensityActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('editable', {
label: strings.EditableActionFieldLabel,
}),
(0, sp_property_pane_1.PropertyPaneToggle)('resizable', {
label: strings.ResizableActionFieldLabel,
}),
(0, spfx_property_controls_1.PropertyFieldMonacoEditor)('tabValue', {
key: 'tabValue-editor',
language: spfx_property_controls_1.Elanguages.json,
value: this.properties.tabValue,
showLineNumbers: true,
showMiniMap: true,
}),
(0, sp_property_pane_1.PropertyPaneTextField)('height', {
label: strings.HeightFieldLabel,
description: strings.HeightFieldDescription,
}),
],
},
],
},
],
};
};
return DashboardWebPart;
}(sp_webpart_base_1.BaseClientSideWebPart));
exports.default = DashboardWebPart;
//# sourceMappingURL=DashboardWebPart.js.map