From 3877d8493edc9fab90f475649961fa0d151cb7da Mon Sep 17 00:00:00 2001 From: Nikola Metulev Date: Wed, 1 Sep 2021 14:15:31 -0700 Subject: [PATCH] Fixes bundle by moving back to @fluentui\web-components 0.22 (#1314) * undo mgt-loader fixes * downgraded to @fluentui/web-componenxts@0.22 * export file-upload Co-authored-by: Beth Pan --- packages/mgt-components/package.json | 2 +- .../components/mgt-file-list/mgt-file-list.ts | 11 ++++-- .../mgt-file-upload/mgt-file-upload.ts | 8 +++-- .../src/utils/FluentComponents.ts | 36 +++++++++---------- packages/mgt/src/bundle/mgt-loader.js | 21 ++--------- 5 files changed, 35 insertions(+), 43 deletions(-) diff --git a/packages/mgt-components/package.json b/packages/mgt-components/package.json index c46003ecec..44ab9bcb1c 100644 --- a/packages/mgt-components/package.json +++ b/packages/mgt-components/package.json @@ -40,7 +40,7 @@ "@microsoft/microsoft-graph-client": "^2.2.1", "@microsoft/microsoft-graph-types": "^2.0.0", "@microsoft/microsoft-graph-types-beta": "^0.15.0-preview", - "@fluentui/web-components": "^1.3.3", + "@fluentui/web-components": "0.22.1", "office-ui-fabric-core": "11.0.0" }, "publishConfig": { diff --git a/packages/mgt-components/src/components/mgt-file-list/mgt-file-list.ts b/packages/mgt-components/src/components/mgt-file-list/mgt-file-list.ts index b075ac4e1c..7aa2e59ab4 100644 --- a/packages/mgt-components/src/components/mgt-file-list/mgt-file-list.ts +++ b/packages/mgt-components/src/components/mgt-file-list/mgt-file-list.ts @@ -41,10 +41,13 @@ import { strings } from './strings'; import { MgtFile } from '../mgt-file/mgt-file'; import { MgtFileUploadConfig } from './mgt-file-upload/mgt-file-upload'; -import { fluentProgressRing } from '@fluentui/web-components'; -import { registerFluentComponents } from '../../utils/FluentComponents'; +export { FluentDesignSystemProvider, FluentProgressRing } from '@fluentui/web-components'; +export * from './mgt-file-upload/mgt-file-upload'; -registerFluentComponents(fluentProgressRing); +// import { fluentProgressRing } from '@fluentui/web-components'; +// import { registerFluentComponents } from '../../utils/FluentComponents'; + +// registerFluentComponents(fluentProgressRing); /** * The File List component displays a list of multiple folders and files by @@ -573,6 +576,7 @@ export class MgtFileList extends MgtTemplatedComponent { */ protected renderFiles(): TemplateResult { return html` +
${this.enableFileUpload ? this.renderFileUpload() : null}
    + `; } diff --git a/packages/mgt-components/src/components/mgt-file-list/mgt-file-upload/mgt-file-upload.ts b/packages/mgt-components/src/components/mgt-file-list/mgt-file-upload/mgt-file-upload.ts index d7365e996a..95275c5679 100644 --- a/packages/mgt-components/src/components/mgt-file-list/mgt-file-upload/mgt-file-upload.ts +++ b/packages/mgt-components/src/components/mgt-file-list/mgt-file-upload/mgt-file-upload.ts @@ -22,10 +22,12 @@ import { deleteSessionFile } from '../../../graph/graph.files'; -import { registerFluentComponents } from '../../../utils/FluentComponents'; -import { fluentButton, fluentCheckbox, fluentProgress } from '@fluentui/web-components'; +export { FluentProgress, FluentButton, FluentCheckbox } from '@fluentui/web-components'; -registerFluentComponents(fluentProgress, fluentButton, fluentCheckbox); +// import { registerFluentComponents } from '../../../utils/FluentComponents'; +// import { fluentButton, fluentCheckbox, fluentProgress } from '@fluentui/web-components'; + +// registerFluentComponents(fluentProgress, fluentButton, fluentCheckbox); /** * Upload conflict behavior status diff --git a/packages/mgt-components/src/utils/FluentComponents.ts b/packages/mgt-components/src/utils/FluentComponents.ts index 209b7d7472..f3b6cb9b90 100644 --- a/packages/mgt-components/src/utils/FluentComponents.ts +++ b/packages/mgt-components/src/utils/FluentComponents.ts @@ -1,23 +1,23 @@ -import { provideFluentDesignSystem } from '@fluentui/web-components'; +// import { provideFluentDesignSystem } from '@fluentui/web-components'; -const designSystem = provideFluentDesignSystem(); +// const designSystem = provideFluentDesignSystem(); -export const registerFluentComponents = (...fluentComponents) => { - if (!fluentComponents || !fluentComponents.length) { - return; - } +// export const registerFluentComponents = (...fluentComponents) => { +// if (!fluentComponents || !fluentComponents.length) { +// return; +// } - const registry = { - register(container: any) { - if (!container) { - return; - } +// const registry = { +// register(container: any) { +// if (!container) { +// return; +// } - for (const component of fluentComponents) { - component().register(container); - } - } - }; +// for (const component of fluentComponents) { +// component().register(container); +// } +// } +// }; - designSystem.register(registry); -}; +// designSystem.register(registry); +// }; diff --git a/packages/mgt/src/bundle/mgt-loader.js b/packages/mgt/src/bundle/mgt-loader.js index 12c0553a95..f47bf5057e 100644 --- a/packages/mgt/src/bundle/mgt-loader.js +++ b/packages/mgt/src/bundle/mgt-loader.js @@ -5,7 +5,7 @@ * ------------------------------------------------------------------------------------------- */ -(async function () { +(function () { 'use strict'; var rootPath = getScriptPath(); @@ -15,8 +15,6 @@ window.WebComponents = window.WebComponents || {}; window.WebComponents.root = rootPath + 'wc/'; - await waitUntilReady(); - addScript(rootPath + 'wc/webcomponents-loader.js'); addScript(rootPath + 'mgt.es6.js'); } else { @@ -50,19 +48,6 @@ return true; } - function waitUntilReady() { - - return new Promise(function (resolve, reject) { - if (document.body) { - resolve(); - } - - document.addEventListener('DOMContentLoaded', function () { - resolve(); - }) - }); - }; - function addScript(src, onload) { // TODO: support async loading @@ -73,7 +58,7 @@ // tag.addEventListener("load", onload); // } - // document.write(tag.outerHTML); - document.head.appendChild(tag); + document.write(tag.outerHTML); + // document.head.appendChild(tag); } })();