mui-spfx-controls
Version:
SPFx component library built with MUI
174 lines • 8.85 kB
JavaScript
import { __awaiter, __extends, __generator } from "tslib";
import * as React from 'react';
import * as ReactDom from 'react-dom';
import { Version } from '@microsoft/sp-core-library';
import { PropertyPaneTextField, PropertyPaneDropdown, PropertyPaneToggle, PropertyPaneChoiceGroup, } from '@microsoft/sp-property-pane';
import { BaseClientSideWebPart } from '@microsoft/sp-webpart-base';
import { IColumnReturnProperty, PropertyFieldColumnPicker, PropertyFieldColumnPickerOrderBy, PropertyFieldListPicker, PropertyFieldListPickerOrderBy, PropertyFieldNumber, } from '@pnp/spfx-property-controls';
import * as strings from 'ListItemPickerWebPartStrings';
import ListItemPicker from './ListItemPickerDisplay';
var ListItemPickerWebPart = /** @class */ (function (_super) {
__extends(ListItemPickerWebPart, _super);
function ListItemPickerWebPart() {
return _super !== null && _super.apply(this, arguments) || this;
}
ListItemPickerWebPart.prototype.render = function () {
var element = React.createElement(ListItemPicker, {
context: this.context,
list: this.properties.list,
fields: this.properties.fields,
displayField: this.properties.displayField,
searchSuggestionLimit: this.properties.searchSuggestionLimit,
label: this.properties.label,
disabled: this.properties.disabled,
size: this.properties.size,
color: this.properties.color,
variant: this.properties.variant,
});
ReactDom.render(element, this.domElement);
};
ListItemPickerWebPart.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*/];
}
});
});
};
ListItemPickerWebPart.prototype.onDispose = function () {
ReactDom.unmountComponentAtNode(this.domElement);
};
Object.defineProperty(ListItemPickerWebPart.prototype, "dataVersion", {
get: function () {
return Version.parse('1.0');
},
enumerable: false,
configurable: true
});
ListItemPickerWebPart.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,
}),
PropertyPaneTextField('displayField', {
label: strings.OptionDisplayFieldLabel,
}),
PropertyFieldNumber('searchSuggestionLimit', {
key: 'numberPickerFieldId',
label: strings.SearchSuggestionLimitFieldLabel,
value: this.properties.searchSuggestionLimit,
}),
PropertyPaneTextField('label', {
label: strings.LabelFieldLabel,
}),
PropertyPaneChoiceGroup('size', {
label: strings.SizeFieldLabel,
options: [
{
key: 'small',
text: 'small',
},
{
key: 'medium',
text: 'medium',
},
],
}),
PropertyPaneToggle('disabled', {
label: strings.DisabledFieldLabel,
}),
PropertyPaneDropdown('variant', {
label: strings.VariantFieldLabel,
selectedKey: 'outlined',
options: [
{
key: 'outlined',
text: 'outlined',
},
{
key: 'standard',
text: 'standard',
},
{
key: 'filled',
text: 'filled',
},
],
}),
PropertyPaneDropdown('color', {
label: strings.ColorFieldLabel,
selectedKey: 'primary',
options: [
{
key: 'primary',
text: 'primary',
},
{
key: 'secondary',
text: 'secondary',
},
{
key: 'info',
text: 'info',
},
{
key: 'success',
text: 'success',
},
{
key: 'warning',
text: 'warning',
},
{
key: 'error',
text: 'error',
},
],
}),
],
},
],
},
],
};
};
return ListItemPickerWebPart;
}(BaseClientSideWebPart));
export default ListItemPickerWebPart;
//# sourceMappingURL=ListItemPickerWebPart.js.map