Browse Source

Pull request #3469: KERNEL-14316 fix: 打包和处理一些细节上的问题

Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6

* commit 'cdd44f4b99bedbdb2d0e3b46c83f863e0691f5b0':
  KERNEL-14316 fix: 取消掉 npm 里面的 cd
  KERNEL-14316 fix: bundle 打包
  KERNEL-14316 fix: bundle打包
  KERNEL-14316 fix: 修复一些细节问题
  KERNEL-14316 fix: 过一遍 Demo,把控制台报错,全部解决掉
es6
treecat-罗群 1 year ago
parent
commit
af9f1f3e64
  1. 14
      package.json
  2. 204
      packages/demo/src/case/combo/demo.text_value_combo.js
  3. 14
      packages/demo/src/demo/base/button/demo.button.js
  4. 1
      packages/demo/src/demo/widget/multiselect/demo.multi_select_combo.js
  5. 4
      packages/demo/src/demo/widget/multiselect/demo.multi_select_list.js
  6. 6
      packages/demo/src/demo/widget/singleselct/demo.single_select_combo.js
  7. 52
      packages/fineui/lessconfig/bi.lessconfig.json
  8. 21
      packages/fineui/lessconfig/jsy.lessconfig.json
  9. 1
      packages/fineui/lodash.md
  10. 15
      packages/fineui/package.json
  11. 7
      packages/fineui/src/base/combination/bubble.js
  12. 13
      packages/fineui/src/bundle.js
  13. 3
      packages/fineui/src/case/ztree/parttree.js
  14. 3
      packages/fineui/src/core/controller/controller.bubbles.js
  15. 3
      packages/fineui/src/core/controller/controller.resizer.js
  16. 2012
      packages/fineui/src/core/controller/popper.js
  17. 4
      packages/fineui/src/core/platform/web/index.js
  18. 6
      packages/fineui/src/index.js
  19. 9
      packages/fineui/src/widget/multiselect/loader.js
  20. 88
      packages/fineui/webpack.prod.js

14
package.json

@ -7,27 +7,35 @@
"license": "ISC", "license": "ISC",
"scripts": { "scripts": {
"dev": "npm-run-all --parallel dev:*", "dev": "npm-run-all --parallel dev:*",
"dev:demo": "cd packages/demo && npm run dev", "dev:demo": "pnpm --dir packages/demo dev",
"dev:fineui": "cd packages/fineui && npm run dev", "dev:fineui": "pnpm --dir packages/fineui dev",
"static": "node script/code.static.js" "build": "pnpm --dir packages/fineui build"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.21.0", "@babel/cli": "^7.21.0",
"@babel/core": "^7.21.0", "@babel/core": "^7.21.0",
"@babel/runtime": "^7.21.0", "@babel/runtime": "^7.21.0",
"@fui/babel-preset-fineui": "^3.0.1", "@fui/babel-preset-fineui": "^3.0.1",
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2", "babel-loader": "^9.1.2",
"babel-plugin-module-resolver": "^5.0.0", "babel-plugin-module-resolver": "^5.0.0",
"css-loader": "^6.7.3", "css-loader": "^6.7.3",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"html-webpack-plugin": "^5.5.0", "html-webpack-plugin": "^5.5.0",
"less": "^4.1.3", "less": "^4.1.3",
"less-loader": "^11.1.0", "less-loader": "^11.1.0",
"mini-css-extract-plugin": "^2.7.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"postcss": "^8.4.21",
"style-loader": "^3.3.1", "style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.7",
"typescript": "^4.9.5", "typescript": "^4.9.5",
"uglifyjs-webpack-plugin": "^2.2.0",
"webpack": "^5.75.0", "webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.8.0", "webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^5.0.1", "webpack-cli": "^5.0.1",
"circular-dependency-plugin": "^5.2.2",
"webpack-dev-server": "^4.11.1" "webpack-dev-server": "^4.11.1"
} }
} }

204
packages/demo/src/case/combo/demo.text_value_combo.js

@ -1,93 +1,90 @@
/** /**
* Created by Dailer on 2017/7/11. * Created by Dailer on 2017/7/11.
*/ */
Demo.TextValueCombo = BI.inherit(BI.Widget, { import { shortcut, Widget, Label, VerticalLayout, TextValueCombo, Button, Selection } from "@fui/core";
props: {
baseCls: ""
},
render: function () {
var combo1, combo2;
var items = [ @shortcut()
export class TextValueCombo extends Widget {
static xtype = "demo.text_value_combo";
props = {
baseCls: "",
};
render() {
let combo1, combo2;
const items = [
{ {
text: "MVC-1", text: "MVC-1",
iconCls: "date-font", iconCls: "date-font",
value: 1 value: 1,
}, { },
{
text: "MVC-2", text: "MVC-2",
iconCls: "search-font", iconCls: "search-font",
value: 2 value: 2,
}, { },
{
text: "MVC-3", text: "MVC-3",
iconCls: "pull-right-font", iconCls: "pull-right-font",
value: 3 value: 3,
} },
]; ];
// 创建下拉框各种场景用例 // 创建下拉框各种场景用例
return { return {
type: "bi.vertical", type: VerticalLayout.xtype,
vgap: 20, vgap: 20,
hgap: 20, hgap: 20,
items: [ items: [
this.createCombo("无初始值,带提示文字", { this.createCombo("无初始值,带提示文字", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: (ref) => { ref() {
this.combo1 = ref; combo1 = ref;
}, },
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
items: items, items: items,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("自动根据value匹配text", { this.createCombo("自动根据value匹配text", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () {
combo = this;
},
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
value: 1, value: 1,
items: items, items: items,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("无初始值,可以清空", { this.createCombo("无初始值,可以清空", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () {
combo = this;
},
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
items: items, items: items,
allowClear: true, allowClear: true,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action() {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("有初始值,可以清空", { this.createCombo("有初始值,可以清空", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () {
combo = this;
},
defaultText: "请选择", defaultText: "请选择",
width: 300, width: 300,
value: 1, value: 1,
@ -95,17 +92,17 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true, allowClear: true,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("有初始值,value不匹配,自动标红,指定标红文字", { this.createCombo("有初始值,value不匹配,自动标红,指定标红文字", {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () { ref() {
combo = this; self.combo = this;
}, },
width: 300, width: 300,
text: "MVC-111", text: "MVC-111",
@ -116,19 +113,19 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
warningTitle: "value值不合法", warningTitle: "value值不合法",
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}), }),
this.createCombo("无初始值,外部受控调用setValue", { this.createCombo("无初始值,外部受控调用setValue", {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () { ref() {
combo1 = this; combo1 = this;
}, },
width: 300, width: 300,
@ -137,29 +134,30 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
defaultText: "请选择", defaultText: "请选择",
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}, { },
{
el: { el: {
type: "bi.button", type: Button.xtype,
text: "setValue(1)", text: "setValue(1)",
handler: function () { handler: function () {
combo1.setValue(1); combo1.setValue(1);
}, },
}, },
vgap: 10, vgap: 10,
} },
] ],
}), }),
this.createCombo("无初始值,外部受控调用setStatus", { this.createCombo("无初始值,外部受控调用setStatus", {
type: "bi.vertical", type: "bi.vertical",
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
ref: function () { ref: function () {
combo2 = this; combo2 = this;
}, },
@ -169,92 +167,92 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
defaultText: "请选择", defaultText: "请选择",
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
}, { },
{
el: { el: {
type: "bi.button", type: Button.xtype,
text: "setStatus()", text: "setStatus()",
handler: function () { handler: function () {
combo2.setStatus("error"); combo2.setStatus("error");
}, },
}, },
vgap: 10, vgap: 10,
} },
] ],
}), }),
this.createCombo("支持复选", { this.createCombo("支持复选", {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
width: 300, width: 300,
items: items, items: items,
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, chooseType: Selection.Multi,
value: [1], value: [1],
// allowSelectAll: false, // allowSelectAll: false,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
} },
] ],
}), }),
this.createCombo("支持复选,不要全选功能", { this.createCombo("支持复选,不要全选功能", {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
type: "bi.text_value_combo", type: TextValueCombo.xtype,
width: 300, width: 300,
items: items, items: items,
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, chooseType: Selection.Multi,
value: [1], value: [1],
allowSelectAll: false, allowSelectAll: false,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: TextValueCombo.EVENT_CHANGE,
action: function () { action: function () {
console.log(this.getValue()); console.log(this.getValue());
} },
} },
] ],
} },
] ],
}) }),
] ],
}; };
}, }
createCombo: function (text, combo) { createCombo(text, combo) {
return { return {
type: "bi.vertical", type: VerticalLayout.xtype,
items: [ items: [
{ {
el: { el: {
type: "bi.label", type: Label.xtype,
textAlign: "left", textAlign: "left",
text, text,
}, },
bgap: 10 bgap: 10,
}, { },
{
el: combo, el: combo,
bgap: 10, bgap: 10,
}, },
] ],
}; };
} }
}); }
BI.shortcut("demo.text_value_combo", Demo.TextValueCombo);

14
packages/demo/src/demo/base/button/demo.button.js

@ -403,20 +403,6 @@ export class ButtonDemo extends Widget {
console.log("我是无法被触发的!"); console.log("我是无法被触发的!");
}, },
}, },
{
type: Button.xtype,
text: "自定义图标按钮(点我修改)",
icon: {
type: "demo.joker.icon",
},
handler() {
console.log("触发点击事件");
this.loading();
setTimeout(() => {
this.loaded();
}, 5 * 1000);
},
},
{ {
type: Button.xtype, type: Button.xtype,
text: "文字偏左的按钮", text: "文字偏左的按钮",

1
packages/demo/src/demo/widget/multiselect/demo.multi_select_combo.js

@ -17,6 +17,7 @@ import {
@shortcut() @shortcut()
export class MultiSelectComboDemo extends Widget { export class MultiSelectComboDemo extends Widget {
static xtype = "demo.multi_select_combo"; static xtype = "demo.multi_select_combo";
static EVENT_CONFIRM = "EVENT_CONFIRM";
props = { baseCls: "demo-multi-select-combo" }; props = { baseCls: "demo-multi-select-combo" };

4
packages/demo/src/demo/widget/multiselect/demo.multi_select_list.js

@ -76,8 +76,8 @@ export class MultiSelectListDemo extends Widget {
}); });
if (options.selectedValues) { if (options.selectedValues) {
// 过滤 // 过滤
const filter = makeObject(options.selectedValues, true); const filterItems = makeObject(options.selectedValues, true);
items = filter(items, (i, ob) => !filter[ob.value]); items = filter(items, (i, ob) => !filterItems[ob.value]);
} }
if (options.type == MultiSelectCombo.REQ_GET_ALL_DATA) { if (options.type == MultiSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({

6
packages/demo/src/demo/widget/singleselct/demo.single_select_combo.js

@ -1,6 +1,6 @@
import { CONSTANTS } from "@/config/constant"; import { CONSTANTS } from "@/config/constant";
import { SingleSelectCombo, AbsoluteLayout, Button, shortcut, Widget, Func, createWidget, bind, each, makeObject } from "@fui/core" import { SingleSelectCombo, AbsoluteLayout, Button, shortcut, Widget, Func, createWidget, bind, each, makeObject, filter, delay } from "@fui/core"
@shortcut() @shortcut()
@ -56,8 +56,8 @@ export class SingleSelectComboDemo extends Widget {
}); });
if (options.selectedValues) { if (options.selectedValues) {
// 过滤 // 过滤
const filter = makeObject(options.selectedValues, true); const filterItems = makeObject(options.selectedValues, true);
items = filter(items, (i, ob) => !filter[ob.value]); items = filter(items, (i, ob) => !filterItems[ob.value]);
} }
if (options.type == SingleSelectCombo.REQ_GET_ALL_DATA) { if (options.type == SingleSelectCombo.REQ_GET_ALL_DATA) {
callback({ callback({

52
packages/fineui/lessconfig/bi.lessconfig.json

@ -0,0 +1,52 @@
{
"@color-primary": "#2C60DB",
"@color-green-100": "#3FC47B",
"@color-light-blue-100": "#19B8EA",
"@color-orange-100": "#FAAA39",
"@color-red-100": "#E65251",
"@color-black": "#091E40",
"@color-light-gray": "#ECEEF3",
"@color-light-gray-theme-dark": "#292F45",
"@border-color-line": "rgba(9, 30, 64, 0.15)",
"@border-color-light-line": "#E6E9EF",
"@border-color-dark-line": "#2E3A4D",
"@color-sliver-theme-dark": "#363E55",
"@border-color-disabled": "rgba(9, 30, 64, 0.07)",
"@font-color-normal": "#091E40",
"@font-color-gray": "rgba(9, 30, 64, 0.9)",
"@font-color-light-gray": "rgba(9, 30, 64, 0.66)",
"@font-color-tips": "rgba(9, 30, 64, 0.47)",
"@font-color-disabled": "rgba(9, 30, 64, 0.25)",
"@background-color-normal": "#F8F9FC",
"@color-bi-background-active-radio": "transparent",
"@color-bi-border-radio": "rgba(9, 30, 64, 0.37)",
"@color-bi-border-disabled-radio": "rgba(9, 30, 64, 0.19)",
"@color-bi-background-active-radio-content": "#2C60DB",
"@color-bi-border-checkbox-theme-dark": "rgba(255, 255, 255, 0.37)",
"@color-bi-border-hover-active-radio-theme-dark": "#3869DC",
"@color-bi-background-active-radio-content-theme-dark": "#3869DC",
"@color-bi-background-disabled-active-radio-content": "#FFFFFF",
"@color-bi-background-disabled-active-radio-content-theme-dark": "#606479",
"@color-bi-background-disabled-active-checkbox-content": "#FFFFFF",
"@color-bi-background-disabled-active-checkbox-content-theme-dark": "#606479",
"@color-bi-background-tooltip-success": "#3F506A",
"@color-bi-background-tooltip-failure": "#E65251",
"@color-bi-border-tooltip-success": "#2E3A4D",
"@color-bi-background-toast-success": "#FFFFFF",
"@color-bi-background-toast-warning": "#FFFFFF",
"@color-bi-background-toast-error": "#FFFFFF",
"@color-bi-background-toast-normal": "#FFFFFF",
"@color-bi-color-toast-success": "#3FC47B",
"@color-bi-color-toast-warning": "#FAAA39",
"@color-bi-color-toast-error": "#E65251",
"@color-bi-color-toast-normal": "#2C60DB",
"@color-bi-color-toast-text": "#000A19",
"@color-bi-text-header-background": "rgba(9, 30, 64, 0.9)",
"@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)",
"@font-date": "e733",
"@font-trigger-triangle": "e924",
"@font-solid-bottom": "e905",
"@font-solid-right": "e906",
"@font-dot": "e762",
"@font-down-triangle": "e70b"
}

21
packages/fineui/lessconfig/jsy.lessconfig.json

@ -0,0 +1,21 @@
{
"@background-color-card-primary": "#003D4D",
"@color-primary": "#00acbe",
"font-color-normal": "#0d1540",
"font-color-light-gray": "#0d1540",
"font-color-disabled": "fade(#0d1540, 40)",
"font-color-light-disabled": "fade(#0d1540, 20)",
"font-color-success": "#28b668",
"font-color-negative": "#e65251",
"font-color-warning": "#faaa39",
"font-color-tips": "fade(#0d1540, 40)",
"background-color-light-disabled": "fade(#0d1540, 5)",
"background-color-dark-success": "#28b668",
"background-color-negative": "#e65251",
"background-color-warning": "#faaa39",
"border-color-disabled": "#e8eaed",
"border-color-success": "#28b668",
"border-color-negative": "#e65251"
}

1
packages/fineui/lodash.md

@ -0,0 +1 @@
lodash core plus="debounce,throttle,get,set,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy,before,after,unescape,chunk,pick,pickBy,identity"

15
packages/fineui/package.json

@ -1,22 +1,25 @@
{ {
"name": "@fui/core", "name": "@fui/core",
"version": "2.0.20230208163847", "version": "2.0.20230208163847",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"module": "dist/es/index.js", "module": "dist/es/index.js",
"types": "dist/type/index.d.ts", "types": "dist/type/index.d.ts",
"bin": {
"fui-cli": "./bin/cli/cli.js"
},
"sideEffects": [ "sideEffects": [
"src/**/*.js",
"dist/es/core/*.js", "dist/es/core/*.js",
"dist/es/polyfill/**/*.js", "dist/es/core/element/**/*.js",
"dist/es/core/platform/**/*.js", "dist/es/core/platform/**/*.js",
"dist/es/polyfill/**/*.js",
"dist/es/case/ztree/jquery.ztree.core-3.5.js", "dist/es/case/ztree/jquery.ztree.core-3.5.js",
"dist/es/case/ztree/jquery.ztree.excheck-3.5.js" "dist/es/case/ztree/jquery.ztree.excheck-3.5.js"
], ],
"bin": {
"fui-cli": "./bin/cli/cli.js"
},
"scripts": { "scripts": {
"dev": "babel src -d dist/es --config-file ./esm.babel.js -w" "dev": "babel src -d dist/es --config-file ./esm.babel.js -w",
"build": "webpack --config=webpack.prod.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

7
packages/fineui/src/base/combination/bubble.js

@ -19,8 +19,9 @@ import {
emptyFn, emptyFn,
LogicFactory, LogicFactory,
EVENT_RESPONSE_TIME, EVENT_RESPONSE_TIME,
EVENT_BLUR EVENT_BLUR,
} from "@/core"; } from "@/core";
import { createPopper } from "@popperjs/core";
@shortcut() @shortcut()
export class Bubble extends Widget { export class Bubble extends Widget {
@ -427,7 +428,7 @@ export class Bubble extends Widget {
options: { options: {
offset: () => [adjustXOffset, (showArrow ? 12 : 0) + (adjustYOffset + adjustLength)], offset: () => [adjustXOffset, (showArrow ? 12 : 0) + (adjustYOffset + adjustLength)],
}, },
} },
]; ];
if (this.options.showArrow) { if (this.options.showArrow) {
modifiers.push({ modifiers.push({
@ -438,7 +439,7 @@ export class Bubble extends Widget {
}, },
}); });
} }
this.popper = BI.Popper.createPopper(this.combo.element[0], this.popupView.element[0], { this.popper = createPopper(this.combo.element[0], this.popupView.element[0], {
placement, placement,
strategy: "fixed", strategy: "fixed",
modifiers, modifiers,

13
packages/fineui/src/bundle.js

@ -1,4 +1,4 @@
import * as fineui from "./index"; import * as fuiExport from "./index";
import { shortcut, provider } from "@/core/5.inject"; import { shortcut, provider } from "@/core/5.inject";
import { _global } from "@/core/0.foundation"; import { _global } from "@/core/0.foundation";
import * as Decorators from "@/core/decorator"; import * as Decorators from "@/core/decorator";
@ -6,9 +6,10 @@ import * as Decorators from "@/core/decorator";
_global.BI = _global.BI || {}; _global.BI = _global.BI || {};
_global.BI.Decorators = Decorators; _global.BI.Decorators = Decorators;
_global.Fix = fineui.Fix; Object.assign(_global, {
_global._ = fineui._; Fix: fuiExport.Fix,
_: fuiExport._,
$: fuiExport.$,
});
_global.$ = fineui.$; Object.assign(_global.BI, fuiExport, { shortcut, provider });
Object.assign(_global.BI, fineui, { shortcut, provider });

3
packages/fineui/src/case/ztree/parttree.js

@ -65,7 +65,8 @@ export class PartTree extends Asynctree {
}), }),
function (res) { function (res) {
self.options.paras.selectedValues = res; self.options.paras.selectedValues = res;
this.seMethos(...args); // 看起来应该是 self
self.seMethos(...args);
} }
); );
} else { } else {

3
packages/fineui/src/core/controller/controller.bubbles.js

@ -7,6 +7,7 @@
import { Controller } from "./0.controller"; import { Controller } from "./0.controller";
import { isNotNull, each } from "../2.base"; import { isNotNull, each } from "../2.base";
import { createWidget } from "../5.inject"; import { createWidget } from "../5.inject";
import { createPopper } from "@popperjs/core";
export class BubblesController extends Controller { export class BubblesController extends Controller {
init() { init() {
@ -57,7 +58,7 @@ export class BubblesController extends Controller {
if (this.storePoppers[name]) { if (this.storePoppers[name]) {
this.storePoppers[name].destroy(); this.storePoppers[name].destroy();
} }
this.storePoppers[name] = BI.Popper.createPopper(context.element[0], bubble.element[0], { this.storePoppers[name] = createPopper(context.element[0], bubble.element[0], {
placement: ({ placement: ({
left: "top-start", left: "top-start",
center: "top", center: "top",

3
packages/fineui/src/core/controller/controller.resizer.js

@ -7,6 +7,7 @@ import { Controller } from "./0.controller";
import { isNull, each, debounce, isNotNull, isFunction } from "../2.base"; import { isNull, each, debounce, isNotNull, isFunction } from "../2.base";
import { Widget } from "../4.widget"; import { Widget } from "../4.widget";
import { _global } from "../0.foundation"; import { _global } from "../0.foundation";
import { Layout } from "../wrapper/layout";
import $ from "jquery"; import $ from "jquery";
export class ResizeController extends Controller { export class ResizeController extends Controller {
@ -32,7 +33,7 @@ export class ResizeController extends Controller {
return; return;
} }
if (resizer instanceof BI.Layout) { if (resizer instanceof Layout) {
resizer.resize(); resizer.resize();
return; return;

2012
packages/fineui/src/core/controller/popper.js

File diff suppressed because it is too large Load Diff

4
packages/fineui/src/core/platform/web/index.js

@ -2,5 +2,5 @@ export * from "./detectElementResize";
export * from "./function"; export * from "./function";
export * from "./load"; export * from "./load";
import "./jquery/index";
import "./config";

6
packages/fineui/src/index.js

@ -1,7 +1,11 @@
// sideEffects // sideEffects
import "./polyfill"; import "./polyfill";
import "./core/platform/web/jquery";
import "./core/system"; import "./core/system";
import "./core/element";
import "./core/platform";
import "./core/platform/web/jquery"
// 必须要等上面的准备好, 才初始化 config
import "./core/platform/web/config";
import _jquery from "jquery"; import _jquery from "jquery";

9
packages/fineui/src/widget/multiselect/loader.js

@ -16,7 +16,8 @@ import {
isFunction, isFunction,
makeObject, makeObject,
isArray, isArray,
each each,
Element
} from "@/core"; } from "@/core";
@shortcut() @shortcut()
@ -117,7 +118,7 @@ export class MultiSelectInnerLoader extends Widget {
}); });
const renderEngine = Widget._renderEngine; const renderEngine = Widget._renderEngine;
Widget.registerRenderEngine(BI.Element.renderEngine); Widget.registerRenderEngine(Element.renderEngine);
this.cachGroup = createWidget(o.el, { this.cachGroup = createWidget(o.el, {
type: ButtonGroup.xtype, type: ButtonGroup.xtype,
root: true, root: true,
@ -192,7 +193,7 @@ export class MultiSelectInnerLoader extends Widget {
} }
} }
const renderEngine = Widget._renderEngine; const renderEngine = Widget._renderEngine;
Widget.registerRenderEngine(BI.Element.renderEngine); Widget.registerRenderEngine(Element.renderEngine);
this.cachGroup.addItems(...arguments); this.cachGroup.addItems(...arguments);
Widget.registerRenderEngine(renderEngine); Widget.registerRenderEngine(renderEngine);
this.button_group.addItems(...arguments); this.button_group.addItems(...arguments);
@ -238,7 +239,7 @@ export class MultiSelectInnerLoader extends Widget {
this.cachItems = items.slice(firstItemsCount); this.cachItems = items.slice(firstItemsCount);
} }
const renderEngine = Widget._renderEngine; const renderEngine = Widget._renderEngine;
Widget.registerRenderEngine(BI.Element.renderEngine); Widget.registerRenderEngine(Element.renderEngine);
this.cachGroup.populate.call(this.cachGroup, items, keyword); this.cachGroup.populate.call(this.cachGroup, items, keyword);
Widget.registerRenderEngine(renderEngine); Widget.registerRenderEngine(renderEngine);
this.button_group.populate.call(this.button_group, items.slice(0, firstItemsCount), keyword); this.button_group.populate.call(this.button_group, items.slice(0, firstItemsCount), keyword);

88
packages/fineui/webpack.prod.js

@ -1,21 +1,43 @@
const HtmlWebpackPlugin = require('html-webpack-plugin'); const webpack = require("webpack");
const path = require('path'); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const path = require("path");
const autoprefixer = require("autoprefixer");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const CircularDependencyPlugin = require("circular-dependency-plugin");
const childProcess = require("child_process");
function git(command) {
return childProcess.execSync(`git ${command}`).toString().trim();
}
let lessVariables = {};
if (process.env.LESS_CONFIG_PATH) {
const lessConfigPath = path.isAbsolute(process.env.LESS_CONFIG_PATH)
? process.env.LESS_CONFIG_PATH
: path.resolve(__dirname, "lessconfig", process.env.LESS_CONFIG_PATH);
lessVariables = fs.existsSync(lessConfigPath) ? require(lessConfigPath) || {} : {};
}
module.exports = { module.exports = {
mode: 'production', mode: "production",
entry: './src/index.js', entry: {
devServer: { "fineui.min": "./src/bundle.js",
port: 3000, },
liveReload: true, output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
}, },
devtool: 'hidden-source-map', devtool: "hidden-source-map",
module: { module: {
rules: [ rules: [
{ {
test: /\.js$/, test: /\.js$/,
exclude: /node_modules/, exclude: /node_modules/,
use: { use: {
loader: 'babel-loader', loader: "babel-loader",
}, },
}, },
{ {
@ -23,19 +45,19 @@ module.exports = {
use: [ use: [
MiniCssExtractPlugin.loader, MiniCssExtractPlugin.loader,
{ {
loader: 'css-loader', loader: "css-loader",
options: { options: {
url: false, url: false,
}, },
}, },
{ {
loader: 'postcss-loader', loader: "postcss-loader",
options: { options: {
plugins: [autoprefixer], plugins: [autoprefixer],
}, },
}, },
{ {
loader: 'less-loader', loader: "less-loader",
options: { options: {
relativeUrls: false, relativeUrls: false,
modifyVars: lessVariables, modifyVars: lessVariables,
@ -46,32 +68,24 @@ module.exports = {
], ],
}, },
resolve: { resolve: {
extensions: ['.js', '.ts'], extensions: [".js", ".ts"],
alias: { alias: {
'@': path.resolve(__dirname, '../src'), "@": path.resolve(__dirname, "src"),
}, },
}, },
plugins: [ plugins: [new CircularDependencyPlugin()],
new MiniCssExtractPlugin({ optimization: {
path: dirs.DEST, usedExports: false,
filename: '[name].css', minimize: true,
}), minimizer: [
new ForkTsCheckerWebpackPlugin({}), new TerserPlugin({
new OptimizeCssAssetsPlugin({ include: /\.js$/i,
assetNameRegExp: /\.css$/g, }),
cssProcessor: require('cssnano'), new webpack.BannerPlugin({
cssProcessorPluginOptions: { banner: `time: ${new Date().toLocaleString()}; branch: ${git(
preset: [ "name-rev --name-only HEAD"
'default', )} commit: ${git("rev-parse HEAD")}`,
{ }),
discardComments: { ],
removeAll: true, },
},
normalizeUnicode: false,
},
],
},
canPrint: true,
}),
],
}; };

Loading…
Cancel
Save