diff --git a/packages/fineui/src/core/5.inject.js b/packages/fineui/src/core/5.inject.js index 0246f2497..f9aeacd07 100644 --- a/packages/fineui/src/core/5.inject.js +++ b/packages/fineui/src/core/5.inject.js @@ -601,3 +601,12 @@ export function getResource(type, config) { } throw new Error("unknown type: [" + type + "] undefined"); } + +/** + * 根据 xtype 获取已被注册的类 + * @param {string} xtype + * @returns + */ +export function getClass(xtype) { + return kv[xtype] || serviceInjection[xtype]; +} \ No newline at end of file diff --git a/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js b/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js deleted file mode 100644 index d7fb59e75..000000000 --- a/packages/fineui/src/core/platform/web/jquery/jquery.polyfill.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * 用于 jquery 在 worker 环境或者 V8 引擎的 polyfill - */ -// import { _global } from "@/core/0.foundation"; - -const _global = globalThis; - -const document = {}; -const fakeElement = Object.create(document); - -Object.assign(document, { - parentNode: null, - nodeType: 9, - head: fakeElement, - body: fakeElement, - ownerDocument: document, - documentElement: document, - toString() { - return "FakeDocument"; - }, - appendChild(child) { - return child; - }, - implementation: { - createHTMLDocument() { - return { - body: { - childNodes: [], - }, - }; - }, - createDocumentFragment() { - return this; - }, - }, - getElementById() { - return fakeElement; - }, - createElement() { - return fakeElement; - }, - createDocumentFragment() { - return this; - }, - cloneNode() { - return this; - }, - getElementsByTagName() { - return [fakeElement]; - }, - getElementsByClassName() { - return [fakeElement]; - }, - setAttribute() { - return null; - }, - getAttribute() { - return null; - }, - removeChild() { - return null; - }, - addEventListener() { - return null; - }, - removeEventListener() { - return null; - }, -}); - -Object.assign(fakeElement, { - nodeType: 1, - style: {}, - ownerDocument: document, - parentNod: fakeElement, - firstChild: fakeElement, - lastChild: fakeElement, - toString() { - return "FakeElement"; - }, -}); - -function polyfillProps(key, obj) { - _global[key] = _global[key] || obj; - if (typeof obj === "object") { - try { - Object.assign(_global[key], obj); - } catch(err) { - // _global[key] 可能只有 get 方法 - } - } -} - -_global.window = _global; -polyfillProps("XMLHttpRequest", function () {}); -polyfillProps("document", document); diff --git a/packages/fineui/webpack/attachments.js b/packages/fineui/webpack/attachments.js index aa28409ea..443a60dfc 100644 --- a/packages/fineui/webpack/attachments.js +++ b/packages/fineui/webpack/attachments.js @@ -1,6 +1,5 @@ const { sync, uniq } = require("./utils"); -const jqueryPolyfill = "./src/core/platform/web/jquery/jquery.polyfill.js"; const configJS = "./src/core/platform/web/config.js"; const runtimePolyfill = ["core-js/stable"]; @@ -40,7 +39,9 @@ const fineuiForWorker = [].concat( ); const fineuiWithout_Jquery_Polyfill = [].concat( - basicAttachmentMap.js_without_Jquery_polyfill, + bundleCss, + basicAttachmentMap.polyfill, + basicAttachmentMap.js_bundle, basicAttachmentMap.ts );