mui-spfx-controls
Version:
SPFx component library built with MUI
339 lines • 15.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var sp_core_library_1 = require("@microsoft/sp-core-library");
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 React = tslib_1.__importStar(require("react"));
var ReactDom = tslib_1.__importStar(require("react-dom"));
var strings = tslib_1.__importStar(require("SitePickerWebPartStrings"));
var NavigationDisplay_1 = tslib_1.__importDefault(require("./NavigationDisplay"));
var SitePickerWebPart = /** @class */ (function (_super) {
tslib_1.__extends(SitePickerWebPart, _super);
function SitePickerWebPart() {
return _super !== null && _super.apply(this, arguments) || this;
}
SitePickerWebPart.prototype.render = function () {
var tempItems = [
{
id: 'avengers',
label: 'Avengers',
children: [
{
id: 'iron_man',
label: 'Iron Man',
children: [
{
id: 'iron_man_1',
label: 'Iron Man (2008)',
link: 'https://www.imdb.com/title/tt0371746/',
},
{
id: 'iron_man_2',
label: 'Iron Man 2 (2010)',
link: 'https://www.imdb.com/title/tt1228705/',
},
{
id: 'iron_man_3',
label: 'Iron Man 3 (2013)',
link: 'https://www.imdb.com/title/tt1300854/',
},
],
},
{
id: 'captain_america',
label: 'Captain America',
children: [
{
id: 'captain_america_1',
label: 'Captain America: The First Avenger (2011)',
link: 'https://www.imdb.com/title/tt0458339/',
},
{
id: 'captain_america_2',
label: 'Captain America: The Winter Soldier (2014)',
link: 'https://www.imdb.com/title/tt1843866/',
},
{
id: 'captain_america_3',
label: 'Captain America: Civil War (2016)',
children: [
{
id: 'falcon_and_winter_soldier',
label: 'The Falcon and the Winter Soldier (2021)',
link: 'https://www.imdb.com/title/tt9208876/',
},
],
},
],
},
{
id: 'thor',
label: 'Thor',
children: [
{
id: 'thor_1',
label: 'Thor (2011)',
link: 'https://www.imdb.com/title/tt0800369/',
},
{
id: 'thor_2',
label: 'Thor: The Dark World (2013)',
link: 'https://www.imdb.com/title/tt1981115/',
},
{
id: 'thor_3',
label: 'Thor: Ragnarok (2017)',
link: 'https://www.imdb.com/title/tt3501632/',
},
{
id: 'thor_4',
label: 'Thor: Love and Thunder (2022)',
link: 'https://www.imdb.com/title/tt10648342/',
},
],
},
{
id: 'hulk',
label: 'Hulk',
children: [
{
id: 'hulk_1',
label: 'The Incredible Hulk (2008)',
link: 'https://www.imdb.com/title/tt0800080/',
},
],
},
{
id: 'black_widow',
label: 'Black Widow',
children: [
{
id: 'black_widow_1',
label: 'Iron Man 2 (2010)',
link: 'https://www.imdb.com/title/tt1228705/',
},
{
id: 'black_widow_2',
label: 'The Avengers (2012)',
link: 'https://www.imdb.com/title/tt0848228/',
},
{
id: 'black_widow_3',
label: 'Captain America: The Winter Soldier (2014)',
link: 'https://www.imdb.com/title/tt1843866/',
},
{
id: 'black_widow_4',
label: 'Avengers: Age of Ultron (2015)',
link: 'https://www.imdb.com/title/tt2395427/',
},
{
id: 'black_widow_5',
label: 'Captain America: Civil War (2016)',
link: 'https://www.imdb.com/title/tt3498820/',
},
{
id: 'black_widow_6',
label: 'Avengers: Infinity War (2018)',
link: 'https://www.imdb.com/title/tt4154756/',
},
{
id: 'black_widow_7',
label: 'Avengers: Endgame (2019)',
link: 'https://www.imdb.com/title/tt4154796/',
},
{
id: 'black_widow_8',
label: 'Black Widow (2021)',
link: 'https://www.imdb.com/title/tt3480822/',
},
],
},
{
id: 'hawkeye',
label: 'Hawkeye',
children: [
{
id: 'hawkeye_1',
label: 'Thor (2011)',
link: 'https://www.imdb.com/title/tt0800369/',
},
{
id: 'hawkeye_2',
label: 'The Avengers (2012)',
link: 'https://www.imdb.com/title/tt0848228/',
},
{
id: 'hawkeye_3',
label: 'Avengers: Age of Ultron (2015)',
link: 'https://www.imdb.com/title/tt2395427/',
},
{
id: 'hawkeye_4',
label: 'Captain America: Civil War (2016)',
link: 'https://www.imdb.com/title/tt3498820/',
},
{
id: 'hawkeye_5',
label: 'Avengers: Endgame (2019)',
link: 'https://www.imdb.com/title/tt4154796/',
},
{
id: 'hawkeye_6',
label: 'Hawkeye (2021)',
link: 'https://www.imdb.com/title/tt10160804/',
},
],
},
{
id: 'spiderman',
label: 'Spider-Man',
children: [
{
id: 'spiderman_1',
label: 'Spider-Man: Homecoming (2017)',
link: 'https://www.imdb.com/title/tt2250912/',
},
{
id: 'spiderman_2',
label: 'Spider-Man: Far From Home (2019)',
link: 'https://www.imdb.com/title/tt6320628/',
},
{
id: 'spiderman_3',
label: 'Spider-Man: No Way Home (2021)',
link: 'https://www.imdb.com/title/tt10872600/',
},
],
},
{
id: 'ant_man',
label: 'Ant-Man',
children: [
{
id: 'ant_man_1',
label: 'Ant-Man (2015)',
link: 'https://www.imdb.com/title/tt0478970/',
},
{
id: 'ant_man_2',
label: 'Ant-Man and the Wasp (2018)',
link: 'https://www.imdb.com/title/tt5095030/',
},
{
id: 'ant_man_3',
label: 'Ant-Man and the Wasp: Quantumania (2023)',
link: 'https://www.imdb.com/title/tt10954600/',
},
],
},
{
id: 'doctor_strange',
label: 'Doctor Strange',
children: [
{
id: 'doctor_strange_1',
label: 'Doctor Strange (2016)',
link: 'https://www.imdb.com/title/tt1211837/',
},
{
id: 'doctor_strange_2',
label: 'Doctor Strange in the Multiverse of Madness (2022)',
link: 'https://www.imdb.com/title/tt9419884/',
},
],
},
{
id: 'black_panther',
label: 'Black Panther',
children: [
{
id: 'black_panther_1',
label: 'Black Panther (2018)',
link: 'https://www.imdb.com/title/tt1825683/',
},
{
id: 'black_panther_2',
label: 'Black Panther: Wakanda Forever (2022)',
link: 'https://www.imdb.com/title/tt9114286/',
},
],
},
{
id: 'eternals',
label: 'Eternals',
children: [
{
id: 'eternals_1',
label: 'Eternals (2021)',
link: 'https://www.imdb.com/title/tt9032400/',
},
],
},
],
},
];
try {
tempItems = JSON.parse(this.properties.items);
}
catch (error) {
logging_1.Logger.error(error);
}
var element = React.createElement(NavigationDisplay_1.default, {
items: tempItems,
});
ReactDom.render(element, this.domElement);
};
SitePickerWebPart.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*/];
}
});
});
};
SitePickerWebPart.prototype.onDispose = function () {
ReactDom.unmountComponentAtNode(this.domElement);
};
Object.defineProperty(SitePickerWebPart.prototype, "dataVersion", {
get: function () {
return sp_core_library_1.Version.parse('1.0');
},
enumerable: false,
configurable: true
});
SitePickerWebPart.prototype.getPropertyPaneConfiguration = function () {
return {
pages: [
{
header: {
description: strings.PropertyPaneDescription,
},
groups: [
{
groupName: strings.BasicGroupName,
groupFields: [
(0, spfx_property_controls_1.PropertyFieldMonacoEditor)('items', {
key: 'items-editor',
language: spfx_property_controls_1.Elanguages.json,
value: this.properties.items,
showLineNumbers: true,
showMiniMap: true,
}),
],
},
],
},
],
};
};
return SitePickerWebPart;
}(sp_webpart_base_1.BaseClientSideWebPart));
exports.default = SitePickerWebPart;
//# sourceMappingURL=NavigationWebPart.js.map