From 03295ddda47b32e1db1ab799b35b0fe5a7ebc898 Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 16 May 2023 15:16:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=97=A0JIRA=20=E6=95=B4=E7=90=86=E4=B8=80?= =?UTF-8?q?=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/polyfill/event.js | 15 -- packages/fineui/src/polyfill/index.js | 2 - packages/fineui/src/polyfill/sort.js | 34 ----- packages/fineui/webpack/attachments.js | 184 +------------------------ packages/fineui/webpack/webpack.dev.js | 2 +- 5 files changed, 4 insertions(+), 233 deletions(-) delete mode 100644 packages/fineui/src/polyfill/event.js delete mode 100644 packages/fineui/src/polyfill/sort.js diff --git a/packages/fineui/src/polyfill/event.js b/packages/fineui/src/polyfill/event.js deleted file mode 100644 index decca0f7f..000000000 --- a/packages/fineui/src/polyfill/event.js +++ /dev/null @@ -1,15 +0,0 @@ -const isIE = () => typeof window.CustomEvent !== "function"; - -if (isIE()) { - function CustomEvent(event, params) { - params = params || { bubbles: false, cancelable: false, detail: undefined }; - const evt = document.createEvent("CustomEvent"); - evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); - - return evt; - } - - CustomEvent.prototype = window.Event.prototype; - - window.CustomEvent = CustomEvent; -} diff --git a/packages/fineui/src/polyfill/index.js b/packages/fineui/src/polyfill/index.js index 3f5cde431..2f0dcabd3 100644 --- a/packages/fineui/src/polyfill/index.js +++ b/packages/fineui/src/polyfill/index.js @@ -1,3 +1 @@ -export * from "./event"; export * from "./number"; -export * from "./sort"; \ No newline at end of file diff --git a/packages/fineui/src/polyfill/sort.js b/packages/fineui/src/polyfill/sort.js deleted file mode 100644 index 5d6f7fb92..000000000 --- a/packages/fineui/src/polyfill/sort.js +++ /dev/null @@ -1,34 +0,0 @@ -// 修复ie9下sort方法的bug -// IE的sort 需要显示声明返回-1, 0, 1三种比较结果才可正常工作,而Chrome, Firefox中可以直接返回true, false等 -// BI-36544 sort提供的参数就可以自定义返回值,不需要特别控制。这边使用冒泡相较于快排可能慢了点。 -// 这边先将webkit的限制去掉 -!function (window) { - var ua = window.navigator.userAgent.toLowerCase(), - reg = /msie/; - if (reg.test(ua)) { - var _sort = Array.prototype.sort; - Array.prototype.sort = function (fn) { - if (!!fn && typeof fn === "function") { - if (this.length < 2) { - return this; - } - var i = 0, j = i + 1, l = this.length, tmp, r = false, t = 0; - for (; i < l; i++) { - for (j = i + 1; j < l; j++) { - t = fn.call(this, this[i], this[j]); - r = (typeof t === "number" ? t : - t ? 1 : 0) > 0; - if (r === true) { - tmp = this[i]; - this[i] = this[j]; - this[j] = tmp; - } - } - } - return this; - } - return _sort.call(this); - - }; - } -}(window); \ No newline at end of file diff --git a/packages/fineui/webpack/attachments.js b/packages/fineui/webpack/attachments.js index cbb87e3f1..7e6549d83 100644 --- a/packages/fineui/webpack/attachments.js +++ b/packages/fineui/webpack/attachments.js @@ -1,70 +1,16 @@ const { sync, uniq } = require("./utils"); -const workerCompact = "./dist/fix/worker.compact.js"; -const lodashJs = "src/core/1.lodash.js"; const jqueryPolyfill = "./src/core/platform/web/jquery/jquery.polyfill.js"; const configJS = "./src/core/platform/web/config.js"; -const runtimePolyfill = []; +const runtimePolyfill = ["core-js/stable"]; const basicAttachmentMap = { - polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(runtimePolyfill), - core: sync([ - "src/less/core/**/*.less", - "src/less/theme/**/*.less" - // lodashJs, - // jqueryJs, - // "src/core/**/*.js", - // "src/data/**/*.js", - ]), - // 最基础的控件 - base: sync([ - "src/less/base/**/*.less" - // "src/third/**/*.js", - // "src/base/**/*.js", - ]), - // 实现好的一些基础实例 - case: sync([ - // "src/case/**/*.js", - "src/less/case/**/*.less" - ]), - widget: sync([ - "src/less/widget/**/*.less", - "src/less/component/**/*.less" - // "src/widget/**/*.js", - // "src/component/**/*.js", - ]), - router: sync(["src/router/**/*.js"]), - core_without_platform: sync( - ["src/core/0.foundation.js", lodashJs, "src/core/**/*.js", "src/data/**/*.js"], - ["src/core/platform/**/*.js", "src/core/controller/**/*.js"] - ), - core_without_normalize: sync( - ["src/less/core/**/*.less", "src/less/theme/**/*.less"], - ["src/less/core/normalize.less", "src/less/core/normalize2.less"] - ), - core_without_conflict: sync( - ["src/less/core/**/*.less", "src/less/theme/**/*.less", lodashJs, "src/core/**/*.js", "src/data/**/*.js"], - ["src/core/conflict.js"] - ), + polyfill: sync(["src/polyfill/**/*.js"]).concat(runtimePolyfill), resource: sync(["src/less/resource/**/*.less"]), font: sync(["public/less/font.less"]), ts: ["./typescript/bundle.ts"], ui: sync(["ui/less/app.less", "ui/less/**/*.less", "ui/js/**/*.js"]), - config: sync(["demo/version.js", "i18n/i18n.cn.js"]), - utils: sync([ - "src/core/0.foundation.js", - lodashJs, - "src/core/constant/**/*.js", - "src/core/func/**/*.js", - "src/core/2.base.js", - "src/core/3.ob.js", - "src/core/5.inject.js", - "src/core/utils/*.js", - "i18n/i18n.cn.js", - "_mobile/date.i18n.cn.js", - "src/data/**/*.js" - ]), less: sync([ "src/less/core/**/*.less", "src/less/theme/**/*.less", @@ -76,69 +22,8 @@ const basicAttachmentMap = { js_bundle: sync(["src/bundle.js"]) }; -const bundle = [].concat( - basicAttachmentMap.polyfill, - basicAttachmentMap.core, - basicAttachmentMap.fix, - basicAttachmentMap.base, - basicAttachmentMap.case, - basicAttachmentMap.widget, - sync(["public/less/app.less", "public/less/**/*.less"]), - [workerCompact], - basicAttachmentMap.router, - sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]), - basicAttachmentMap.ts -); - const bundleCss = [].concat(basicAttachmentMap.less, sync(["public/less/app.less", "public/less/**/*.less"])); -// const bundleModern = [].concat( -// sync(["src/less/modern.less"]), -// sync(["public/modern/app.less", "public/modern/**/*.less"]), -// ); - -const coreJs = [].concat( - basicAttachmentMap.polyfill, - basicAttachmentMap.core, - basicAttachmentMap.fix, - basicAttachmentMap.base, - basicAttachmentMap.case, - basicAttachmentMap.widget, - basicAttachmentMap.router, - basicAttachmentMap.ts -); - -const resource = sync(["private/less/app.less", "private/less/**/*.less"]); - -const config = sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]); - -const bundleWithoutNormalize = [].concat( - basicAttachmentMap.core_without_normalize, - sync( - [ - "src/less/base/**/*.less", - "src/less/case/**/*.less", - "src/less/widget/**/*.less", - "src/less/component/**/*.less", - "public/less/**/*.less" - // ts的less - ], - ["public/less/app.less"] - ) -); - -const fineuiWithoutNormalize = [].concat( - basicAttachmentMap.core_without_normalize, - sync([ - "src/less/base/**/*.less", - "src/less/case/**/*.less", - "src/less/widget/**/*.less", - "src/less/component/**/*.less", - "ui/less/app.less", - "ui/less/**/*.less" - ]) -); - const fineui = [].concat( bundleCss, basicAttachmentMap.polyfill, @@ -155,70 +40,7 @@ const fineuiForWorker = [].concat( basicAttachmentMap.ts ); -const fineuiWithoutConflict = [].concat( - basicAttachmentMap.core_without_conflict, - basicAttachmentMap.fix, - basicAttachmentMap.base, - basicAttachmentMap.case, - basicAttachmentMap.widget, - basicAttachmentMap.router, - [workerCompact], - basicAttachmentMap.ui, - basicAttachmentMap.ts, - basicAttachmentMap.polyfill -); - -// const fineuiModern = [].concat( -// sync(["src/less/modern.less"]), -// sync([ -// 'ui/modern/app.less', -// 'ui/modern/**/*.less', -// ]), -// ); - -const fineuiProxy = [].concat( - basicAttachmentMap.polyfill, - basicAttachmentMap.core, - basicAttachmentMap.fixProxy, - basicAttachmentMap.base, - basicAttachmentMap.case, - basicAttachmentMap.widget, - basicAttachmentMap.router, - [workerCompact], - basicAttachmentMap.ui, - basicAttachmentMap.ts -); - -const demo = [].concat( - basicAttachmentMap.polyfill, - basicAttachmentMap.core, - basicAttachmentMap.fix, - basicAttachmentMap.config, - basicAttachmentMap.base, - basicAttachmentMap.case, - basicAttachmentMap.widget, - basicAttachmentMap.router, - sync(["public/less/app.less", "public/less/**/*.less"]), - [workerCompact], - basicAttachmentMap.ts, - sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]) -); - module.exports = { - lodash: lodashJs, - font: basicAttachmentMap.font, - bundle: uniq(bundle), - fineuiWithoutNormalize: uniq(fineuiWithoutNormalize), - fineuiWithoutConflict: uniq(fineuiWithoutConflict), - bundleWithoutNormalize: uniq(bundleWithoutNormalize), fineui: uniq(fineui), - fineuiProxy: uniq(fineuiProxy), - fineuiForWorker: uniq(fineuiForWorker), - utils: uniq(basicAttachmentMap.utils), - demo: uniq(demo), - coreWithoutPlatform: uniq(basicAttachmentMap.core_without_platform), - coreJs: uniq(coreJs), - resource: uniq(resource), - config: uniq(config), - bundleCss: uniq(bundleCss) + fineuiForWorker: uniq(fineuiForWorker) }; diff --git a/packages/fineui/webpack/webpack.dev.js b/packages/fineui/webpack/webpack.dev.js index 17fc5de6b..e858e890b 100644 --- a/packages/fineui/webpack/webpack.dev.js +++ b/packages/fineui/webpack/webpack.dev.js @@ -16,5 +16,5 @@ module.exports = merge(common, { devServer: { port: 9001, // liveReload: true, - }, + } }); From a867349e9811230b7f6c5cf94ef1fa09504cf242 Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 17 May 2023 14:15:15 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A0JIRA=20=E6=8A=BD=E8=B1=A1=E7=B1=BB?= =?UTF-8?q?=E5=B0=B1=E4=B8=8D=E7=94=A8shortcut=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../allvaluechooser/abstract.allvaluechooser.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/fineui/src/component/allvaluechooser/abstract.allvaluechooser.js b/packages/fineui/src/component/allvaluechooser/abstract.allvaluechooser.js index 1673d2866..fd90873f5 100644 --- a/packages/fineui/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/packages/fineui/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -1,5 +1,4 @@ import { - shortcut, Widget, extend, emptyFn, @@ -17,7 +16,6 @@ import { } from "@/core"; import { MultiSelectCombo } from "@/widget"; -@shortcut() export class AbstractAllValueChooser extends Widget { _const = { perPage: 100 }; @@ -42,12 +40,12 @@ export class AbstractAllValueChooser extends Widget { // 需要考虑到value也可能是数字 if (item.value === v || `${item.value}` === v) { text = item.text; - + return true; } }); } - + return text; } @@ -56,7 +54,7 @@ export class AbstractAllValueChooser extends Widget { for (let i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) { res.push(items[i]); } - + return res; } @@ -99,12 +97,12 @@ export class AbstractAllValueChooser extends Widget { callback({ items: resultItems, }); - + return; } if (options.type === MultiSelectCombo.REQ_GET_DATA_LENGTH) { callback({ count: resultItems.length }); - + return; } callback({ @@ -126,7 +124,7 @@ export class AbstractAllValueChooser extends Widget { }; } } - + return value; } } From 941c1b955333178451c2443e2836acdca8257c0d Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 17 May 2023 17:13:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?update=20=E5=AF=BC=E5=87=BAel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/base/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/fineui/src/base/index.js b/packages/fineui/src/base/index.js index 1edd6b127..e5c6dcdb5 100644 --- a/packages/fineui/src/base/index.js +++ b/packages/fineui/src/base/index.js @@ -10,3 +10,4 @@ export * from "./combination"; export * from "./layer"; export * from "./list"; export * from "./single"; +export * from "./el"; From 9c0eeea546624d2a9a0cbf9a5a3341a7bc82a84e Mon Sep 17 00:00:00 2001 From: zsmj Date: Wed, 17 May 2023 19:08:42 +0800 Subject: [PATCH 4/4] update --- packages/fineui/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/fineui/package.json b/packages/fineui/package.json index 61570fc75..388bb475a 100644 --- a/packages/fineui/package.json +++ b/packages/fineui/package.json @@ -54,6 +54,7 @@ "jquery": "3.6.3" }, "devDependencies": { + "core-js": "^3.30.2", "cross-env": "^7.0.3" } }