Browse Source

Pull request #3476: KERNEL-14316 chore: 代码同步和打包

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

* commit '4cf8c2720349a8e2478f04f1c94c14c02a98c2cd':
  KERNEL-14316 chore: 代码同步
  KERNEL-14316 chore: 对依赖进行调整
  KERNEL-14316 chore: 合并代码提交
  KERNEL-14316 fix: webpack 打包配置
es6
treecat-罗群 2 years ago
parent
commit
2a2d3eeb9a
  1. 9
      package.json
  2. 14
      packages/fineui/package.json
  3. 2
      packages/fineui/src/base/combination/group.combo.js
  4. 2
      packages/fineui/src/base/combination/loader.js
  5. 2
      packages/fineui/src/base/combination/searcher.js
  6. 4
      packages/fineui/src/base/pager/pager.js
  7. 6
      packages/fineui/src/base/single/input/input.js
  8. 2
      packages/fineui/src/case/layer/pane.list.js
  9. 9
      packages/fineui/src/case/trigger/trigger.editor.js
  10. 2
      packages/fineui/src/core/2.base.js
  11. 6
      packages/fineui/src/core/4.widget.js
  12. 34
      packages/fineui/src/core/5.inject.js
  13. 4
      packages/fineui/src/core/6.plugin.js
  14. 2
      packages/fineui/src/core/controller/controller.layer.js
  15. 2
      packages/fineui/src/core/listener/listener.show.js
  16. 2
      packages/fineui/src/core/utils/dom.js
  17. 4
      packages/fineui/src/core/wrapper/layout/adapt/absolute.leftrightvertical.js
  18. 6
      packages/fineui/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js
  19. 2
      packages/fineui/src/core/wrapper/layout/fill/float.fill.horizontal.js
  20. 2
      packages/fineui/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js
  21. 4
      packages/fineui/src/core/wrapper/layout/float/float.absolute.leftrightvertical.js
  22. 2
      packages/fineui/src/core/wrapper/layout/layout.border.js
  23. 6
      packages/fineui/src/core/wrapper/layout/layout.card.js
  24. 4
      packages/fineui/src/core/wrapper/layout/layout.division.js
  25. 2
      packages/fineui/src/core/wrapper/layout/layout.grid.js
  26. 4
      packages/fineui/src/core/wrapper/layout/layout.tape.js
  27. 4
      packages/fineui/src/core/wrapper/layout/layout.window.js
  28. 2
      packages/fineui/src/core/wrapper/layout/middle/middle.center.js
  29. 2
      packages/fineui/src/core/wrapper/layout/middle/middle.float.center.js
  30. 2
      packages/fineui/src/core/wrapper/layout/middle/middle.horizontal.js
  31. 2
      packages/fineui/src/core/wrapper/layout/middle/middle.vertical.js
  32. 2
      packages/fineui/src/widget/multiselect/loader.js
  33. 7
      packages/fineui/src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js
  34. 2
      packages/fineui/ui/less/app.less
  35. 2
      packages/fineui/ui/less/background.less
  36. 2
      packages/fineui/ui/less/font.less
  37. 5
      packages/fineui/ui/less/icon.less
  38. 5
      packages/fineui/ui/less/var.less
  39. 91
      packages/fineui/webpack.prod.js
  40. 265
      packages/fineui/webpack/attachments.js
  41. 16
      packages/fineui/webpack/dirs.js
  42. 24
      packages/fineui/webpack/utils.js
  43. 90
      packages/fineui/webpack/webpack.common.js
  44. 11
      packages/fineui/webpack/webpack.css.js
  45. 59
      packages/fineui/webpack/webpack.prod.js

9
package.json

@ -19,15 +19,18 @@
"autoprefixer": "^10.4.14",
"babel-loader": "^9.1.2",
"babel-plugin-module-resolver": "^5.0.0",
"circular-dependency-plugin": "^5.2.2",
"css-loader": "^6.7.3",
"css-minimizer-webpack-plugin": "^5.0.0",
"fork-ts-checker-webpack-plugin": "^8.0.0",
"html-webpack-plugin": "^5.5.0",
"less": "^4.1.3",
"less-loader": "^11.1.0",
"mini-css-extract-plugin": "^2.7.5",
"npm-run-all": "^4.1.5",
"optimize-css-assets-webpack-plugin": "^6.0.1",
"postcss": "^8.4.21",
"postcss-loader": "^7.1.0",
"glob": "^9.3.4",
"style-loader": "^3.3.1",
"terser-webpack-plugin": "^5.3.7",
"typescript": "^4.9.5",
@ -35,7 +38,7 @@
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.8.0",
"webpack-cli": "^5.0.1",
"circular-dependency-plugin": "^5.2.2",
"webpack-dev-server": "^4.11.1"
"webpack-dev-server": "^4.11.1",
"webpack-merge": "^5.8.0"
}
}

14
packages/fineui/package.json

@ -1,6 +1,6 @@
{
"name": "@fui/core",
"version": "2.0.20230208163847",
"version": "2.0.20230208163847",
"description": "fineui",
"main": "dist/fineui_without_conflict.min.js",
"module": "dist/es/index.js",
@ -9,6 +9,7 @@
"fui-cli": "./bin/cli/cli.js"
},
"sideEffects": [
"**/*.less",
"src/**/*.js",
"dist/es/core/*.js",
"dist/es/core/element/**/*.js",
@ -19,7 +20,10 @@
],
"scripts": {
"dev": "babel src -d dist/es --config-file ./esm.babel.js -w",
"build": "webpack --config=webpack.prod.js"
"build": "webpack --config=webpack/webpack.prod.js",
"webpack:css": "webpack --config=webpack/webpack.css.js --mode production",
"biCss": "cross-env LESS_CONFIG_PATH=lessconfig/bi.lessconfig.json LESS_FILE_NAME=bi npm run webpack:css",
"jsyCss": "cross-env LESS_CONFIG_PATH=lessconfig/jsy.lessconfig.json LESS_FILE_NAME=jsy npm run webpack:css"
},
"repository": {
"type": "git",
@ -36,11 +40,13 @@
"author": "fanruan",
"license": "MIT",
"dependencies": {
"@babel/core": "^7.21.0",
"@juggle/resize-observer": "^3.4.0",
"@popperjs/core": "2.11.6",
"@types/yargs": "17.0.13",
"jquery": "3.6.3",
"yargs": "17.6.2"
},
"devDependencies": {
"cross-env": "^7.0.3",
"@types/yargs": "17.0.13"
}
}

2
packages/fineui/src/base/combination/group.combo.js

@ -74,7 +74,7 @@ export class ComboGroup extends Widget {
} = this.options;
const children = items;
if (isEmpty(children)) {
throw new Error("ComboGroup构造错误");
throw new Error("ComboGroup create items error");
}
each(children, (i, ch) => {
const son = formatEL(ch).el.children;

2
packages/fineui/src/base/combination/loader.js

@ -255,7 +255,7 @@ export class Loader extends Widget {
{ times: 1 },
(...args) => {
if (args.length === 0) {
throw new Error("参数不能为空");
throw new Error("Parameter cannot be empty");
}
this.populate(...args);
o.onLoaded();

2
packages/fineui/src/base/combination/searcher.js

@ -278,7 +278,7 @@ export class Searcher extends Widget {
this.editor.blur();
} catch (e) {
if (!this.editor.blur) {
throw new Error("editor没有实现blur方法");
throw new Error("The editor does not implement the blur method");
}
} finally {
this.editor.setValue("");

4
packages/fineui/src/base/pager/pager.js

@ -54,8 +54,8 @@ export class Pager extends Widget {
jump: emptyFn, // 分页的回调函数
first: false, // 是否显示首页
last: false, // 是否显示尾页
prev: "上一页",
next: "下一页",
prev: BI.i18nText("BI-Previous_Page"),
next: BI.i18nText("BI-Next_Page"),
firstPage: 1,
lastPage: () =>

6
packages/fineui/src/base/single/input/input.js

@ -289,7 +289,7 @@ export class Input extends Single {
focus() {
if (!this.element.is(":visible")) {
throw new Error("input输入框在不可见下不能focus");
throw new Error("input cannot be focus when it's invisible");
}
if (!this._isEditing === true) {
this.element.focus();
@ -299,7 +299,7 @@ export class Input extends Single {
blur() {
if (!this.element.is(":visible")) {
throw new Error("input输入框在不可见下不能blur");
throw new Error("input cannot be blur when it's invisible");
}
if (this._isEditing === true) {
this.element.blur();
@ -309,7 +309,7 @@ export class Input extends Single {
selectAll() {
if (!this.element.is(":visible")) {
throw new Error("input输入框在不可见下不能select");
throw new Error("input cannot be select when it's invisible");
}
this.element.select();
this._isEditing = true;

2
packages/fineui/src/case/layer/pane.list.js

@ -165,7 +165,7 @@ export class ListPane extends Pane {
{ times: 1 },
(...args) => {
if (args.length === 0) {
throw new Error("参数不能为空");
throw new Error("Parameter cannot be empty");
}
this.populate(...args);
}

9
packages/fineui/src/case/trigger/trigger.editor.js

@ -23,9 +23,10 @@ export class EditorTrigger extends Trigger {
const conf = super._defaultConfig(...arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-editor-trigger bi-border-radius ${
config.simple ? "bi-border-bottom" : "bi-border"
}`,
baseCls:
(conf.baseCls || "") +
" bi-editor-trigger " +
(config.simple ? "bi-border-bottom" : "bi-border bi-border-radius"),
height: 24,
validationChecker: emptyFn,
quitChecker: emptyFn,
@ -83,7 +84,7 @@ export class EditorTrigger extends Trigger {
width: o.triggerWidth || toPix(o.height, 2),
},
width: "",
}
},
],
});
}

2
packages/fineui/src/core/2.base.js

@ -93,7 +93,7 @@ export function isWidget(widget) {
export function createWidgets(items, options, context) {
if (!isArray(items)) {
throw new Error("items必须是数组", items);
throw new Error("items must be array", items);
}
if (isWidget(options)) {
context = options;

6
packages/fineui/src/core/4.widget.js

@ -158,7 +158,7 @@ export class Widget extends OB {
if (initCallbackCalled === true) {
_global.console &&
console.error(
"组件: 请检查beforeInit内部的写法,callback只能执行一次"
"widget: please check the beforeInit method. The callback can only be executed once"
);
return;
@ -170,7 +170,7 @@ export class Widget extends OB {
if (renderCallbackCalled === true) {
_global.console &&
console.error(
"组件: 请检查beforeRender内部的写法,callback只能执行一次"
"widget: please check the beforeRender method. The callback can only be executed once"
);
return;
@ -698,7 +698,7 @@ export class Widget extends OB {
}
name = name || widget.getName() || uniqueId("widget");
if (this._children[name]) {
throw new Error("组件:组件名已存在,不能进行添加");
throw new Error("widget: widget name already exists, cannot be added");
}
widget._setParent && widget._setParent(this);
widget.on(Events.DESTROY, function () {

34
packages/fineui/src/core/5.inject.js

@ -18,7 +18,7 @@ const moduleInjection = {}, moduleInjectionMap = {
export function module(xtype, cls) {
if (isNotNull(moduleInjection[xtype])) {
_global.console && console.error(`module: [${xtype}] 已经注册过了`);
_global.console && console.error(`module: [${xtype}] already registered`);
} else {
if (isFunction(cls)) {
cls = cls();
@ -48,7 +48,7 @@ export function module(xtype, cls) {
const constantInjection = {};
export function constant(xtype, cls) {
if (isNotNull(constantInjection[xtype])) {
_global.console && console.error(`constant: [${xtype}]已经注册过了`);
_global.console && console.error(`constant: [${xtype}]already registered`);
} else {
constantInjection[xtype] = cls;
}
@ -59,7 +59,7 @@ export function constant(xtype, cls) {
const modelInjection = {};
export function model(xtype, cls) {
if (isNotNull(modelInjection[xtype])) {
_global.console && console.error(`model: [${xtype}] 已经注册过了`);
_global.console && console.error(`model: [${xtype}] already registered`);
} else {
modelInjection[xtype] = cls;
}
@ -70,7 +70,7 @@ export function model(xtype, cls) {
const storeInjection = {};
export function store(xtype, cls) {
if (isNotNull(storeInjection[xtype])) {
_global.console && console.error(`store: [${xtype}] 已经注册过了`);
_global.console && console.error(`store: [${xtype}] already registered`);
} else {
storeInjection[xtype] = cls;
}
@ -81,7 +81,7 @@ export function store(xtype, cls) {
const serviceInjection = {};
export function service(xtype, cls) {
if ((serviceInjection[xtype])) {
_global.console && console.error(`service: [${xtype}] 已经注册过了`);
_global.console && console.error(`service: [${xtype}] already registered`);
}
serviceInjection[xtype] = cls;
@ -92,7 +92,7 @@ export function service(xtype, cls) {
const providerInjection = {};
export function provider(xtype, cls) {
if ((providerInjection[xtype])) {
_global.console && console.error(`provider: [${xtype}] 已经注册过了`);
_global.console && console.error(`provider: [${xtype}] already registered`);
} else {
providerInjection[xtype] = cls;
}
@ -145,7 +145,7 @@ const runConfigFunction = (type, configFn) => {
}
}
if (findVersion === true) {
_global.console && console.error(`moduleId: [${module.moduleId}] 接口: [${type}] 接口版本: [${version}] 已过期,版本要求为:`, dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]);
_global.console && console.error(`moduleId: [${module.moduleId}] interface: [${type}] version: [${version}] has expired. The version requirement is: `, dependencies[module.moduleId], "=>", moduleInjection[module.moduleId]);
continue;
}
}
@ -245,7 +245,7 @@ export function point(type, action, pointFn, after) {
export const Modules = {
getModule (type) {
if (!moduleInjection[type]) {
_global.console && console.error(`module: [${type}] 未定义`);
_global.console && console.error(`module: [${type}] undefined`);
}
return moduleInjection[type];
@ -258,7 +258,7 @@ export const Modules = {
export const Constants = {
getConstant (type) {
if (isNull(constantInjection[type])) {
_global.console && console.error(`constant: [${type}] 未定义`);
_global.console && console.error(`constant: [${type}] undefined`);
}
runConfigFunction(type);
@ -307,7 +307,7 @@ function callPoint(inst, types) {
export const Models = {
getModel (type, config) {
if (!modelInjection[type]) {
_global.console && console.error(`model: [${type}] 未定义`);
_global.console && console.error(`model: [${type}] undefined`);
}
runConfigFunction(type);
const inst = new modelInjection[type](config);
@ -323,7 +323,7 @@ const stores = {};
export const Stores = {
getStore (type, config) {
if (!storeInjection[type]) {
_global.console && console.error(`store: [${type}] 未定义`);
_global.console && console.error(`store: [${type}] undefined`);
}
if (stores[type]) {
return stores[type];
@ -342,7 +342,7 @@ const services = {};
export const Services = {
getService: (type, config) => {
if (!serviceInjection[type]) {
_global.console && console.error(`service: [${type}] 未定义`);
_global.console && console.error(`service: [${type}] undefined`);
}
if (services[type]) {
return services[type];
@ -359,7 +359,7 @@ const providers = {},
export const Providers = {
getProvider: (type, config) => {
if (!providerInjection[type]) {
_global.console && console.error(`provider: [${type}] 未定义`);
_global.console && console.error(`provider: [${type}] undefined`);
}
runConfigFunction(type);
if (!providers[type]) {
@ -398,7 +398,7 @@ export const Actions = {
const kv = {};
export function shortcut(xtype, cls) {
if (isNotNull(kv[xtype])) {
_global.console && console.error(`组件: [${xtype}] 已经注册过了`);
_global.console && console.error(`widget: [${xtype}] already registered`);
}
if (cls) {
cls.xtype = xtype;
@ -413,7 +413,7 @@ const createRealWidget = (config, context, lazy) => {
const Cls = isFunction(config.type) ? config.type : kv[config.type];
if (!Cls) {
throw new Error(`组件: [${config.type}] 未定义`);
throw new Error(`widget: [${config.type}] undefined`);
}
let pushed = false;
const widget = new Cls();
@ -495,7 +495,7 @@ export function createWidget(item, options, context, lazy) {
if (isWidget(item.el)) {
return item.el;
}
throw new Error("组件:无法根据item创建组件", item);
throw new Error("widget: Unable to create widget from item ", item);
}
export function _lazyCreateWidget (item, options, context) {
@ -524,5 +524,5 @@ export function getResource(type, config) {
if (providerInjection[type]) {
return Providers.getProvider(type, config);
}
throw new Error(`未知类型: [${type}] 未定义`);
throw new Error("unknown type: [" + type + "] undefined");
}

4
packages/fineui/src/core/6.plugin.js

@ -76,7 +76,7 @@ export const Plugin = {
_WidgetsPlugin[type] = [];
}
if (_WidgetsPlugin[type].length > 0) {
console.log("组件已经注册过了!");
console.log("widget already registered!");
}
_WidgetsPlugin[type].push(fn);
},
@ -116,7 +116,7 @@ export const Plugin = {
_ObjectPlugin[type] = [];
}
if (_ObjectPlugin[type].length > 0) {
console.log("对象已经注册过了!");
console.log("object already registered!");
}
_ObjectPlugin[type].push(fn);
},

2
packages/fineui/src/core/controller/controller.layer.js

@ -154,7 +154,7 @@ export class LayerController extends Controller {
add(name, layer, layout) {
if (this.has(name)) {
throw new Error("不能创建同名的Layer");
throw new Error("can not create Layers with the same name");
}
layout.setVisible(false);
this.layerManager[name] = layer;

2
packages/fineui/src/core/listener/listener.show.js

@ -30,7 +30,7 @@ export class ShowListener extends OB {
v = v || eventObj.getValue();
v = isArray(v) ? (v.length > 1 ? v.toString() : v[0]) : v;
if (isNull(v)) {
throw new Error("不能为null");
throw new Error("canot be null");
}
const cardName = cardNameCreator(v);
if (!cardLayout.isCardExisted(cardName)) {

2
packages/fineui/src/core/utils/dom.js

@ -19,7 +19,7 @@ export function patchProps(fromElement, toElement) {
});
const fromChildren = fromElement.children(), toChildren = toElement.children();
if (fromChildren.length !== toChildren.length) {
throw new Error("不匹配");
throw new Error("don't match");
}
each(fromChildren, (i, child) => {
patchProps($(child), $(toChildren[i]));

4
packages/fineui/src/core/wrapper/layout/adapt/absolute.leftrightvertical.js

@ -111,7 +111,7 @@ export class AbsoluteLeftRightVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {
@ -166,7 +166,7 @@ export class AbsoluteRightVerticalAdaptLayout extends Layout {
addItem () {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate (items) {

6
packages/fineui/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js

@ -117,7 +117,7 @@ export class LeftRightVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {
@ -176,7 +176,7 @@ export class LeftVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {
@ -234,7 +234,7 @@ export class RightVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(...args) {

2
packages/fineui/src/core/wrapper/layout/fill/float.fill.horizontal.js

@ -35,7 +35,7 @@ export class FloatHorizontalFillLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(items) {

2
packages/fineui/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js

@ -105,7 +105,7 @@ export class FlexLeftRightVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {

4
packages/fineui/src/core/wrapper/layout/float/float.absolute.leftrightvertical.js

@ -128,7 +128,7 @@ export class FloatAbsoluteLeftRightVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {
@ -198,7 +198,7 @@ export class FloatAbsoluteRightVerticalAdaptLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {

2
packages/fineui/src/core/wrapper/layout/layout.border.js

@ -31,7 +31,7 @@ export class BorderLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(regions) {

6
packages/fineui/src/core/wrapper/layout/layout.card.js

@ -88,7 +88,7 @@ export class CardLayout extends Layout {
getCardByName(cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName不存在", cardName);
throw new Error("cardName not exist", cardName);
}
return this._children[this._getChildName(cardName)];
@ -104,7 +104,7 @@ export class CardLayout extends Layout {
deleteCardByName(cardName) {
if (!this.isCardExisted(cardName)) {
throw new Error("cardName不存在", cardName);
throw new Error("cardName not exist", cardName);
}
const child = this._children[this._getChildName(cardName)];
@ -114,7 +114,7 @@ export class CardLayout extends Layout {
addCardByName(cardName, cardItem) {
if (this.isCardExisted(cardName)) {
throw new Error("cardName 已存在", cardName);
throw new Error("cardName already exist", cardName);
}
const widget = _lazyCreateWidget(cardItem, this);
widget.element.css({

4
packages/fineui/src/core/wrapper/layout/layout.division.js

@ -34,7 +34,7 @@ export class DivisionLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(items) {
@ -88,7 +88,7 @@ export class DivisionLayout extends Layout {
for (let j = 0; j < columns; j++) {
let w;
if (!map[i][j]) {
throw new Error(`item(${i}${j}) 必须`, map);
throw new Error(`item(${i}${j}) must exist`, map);
}
if (!this.hasWidget(this._getChildName(`${i}_${j}`))) {
w = _lazyCreateWidget(map[i][j]);

2
packages/fineui/src/core/wrapper/layout/layout.grid.js

@ -28,7 +28,7 @@ export class GridLayout extends Layout {
addItem() {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(items) {

4
packages/fineui/src/core/wrapper/layout/layout.tape.js

@ -39,7 +39,7 @@ export class HTapeLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(items) {
@ -168,7 +168,7 @@ export class VTapeLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(items) {

4
packages/fineui/src/core/wrapper/layout/layout.window.js

@ -41,7 +41,7 @@ export class WindowLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
stroke(items) {
@ -80,7 +80,7 @@ export class WindowLayout extends Layout {
for (let i = 0; i < o.rows; i++) {
for (let j = 0; j < o.columns; j++) {
if (!o.items[i][j]) {
throw new Error("构造错误", o.items);
throw new Error("create items error", o.items);
}
if (!this.hasWidget(this._getChildName(`${i}_${j}`))) {
const w = _lazyCreateWidget(o.items[i][j]);

2
packages/fineui/src/core/wrapper/layout/middle/middle.center.js

@ -71,7 +71,7 @@ export class CenterLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {

2
packages/fineui/src/core/wrapper/layout/middle/middle.float.center.js

@ -71,7 +71,7 @@ export class FloatCenterLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {

2
packages/fineui/src/core/wrapper/layout/middle/middle.horizontal.js

@ -70,7 +70,7 @@ export class HorizontalCenterLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {

2
packages/fineui/src/core/wrapper/layout/middle/middle.vertical.js

@ -70,7 +70,7 @@ export class VerticalCenterLayout extends Layout {
addItem(item) {
// do nothing
throw new Error("不能添加子组件");
throw new Error("Cannot add subwidget");
}
populate(items) {

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

@ -207,7 +207,7 @@ export class MultiSelectInnerLoader extends Widget {
{ times: 1 },
function (items, keyword) {
if (arguments.length === 0) {
throw new Error("参数不能为空");
throw new Error("object already registered");
}
self.populate(...arguments);
o.onLoaded();

7
packages/fineui/src/widget/textvaluedownlistcombo/combo.textvaluedownlist.js

@ -11,7 +11,7 @@ import {
deepClone,
each,
flatten,
has
has,
} from "@/core";
import { DownListCombo } from "../downlist";
@ -23,9 +23,8 @@ export class TextValueDownListCombo extends Widget {
_defaultConfig(config) {
return extend(super._defaultConfig(...arguments), {
baseCls: `bi-text-value-down-list-combo bi-border-radius ${
config.simple ? "bi-border-bottom" : "bi-border"
}`,
baseCls:
"bi-text-value-down-list-combo " + (config.simple ? "bi-border-bottom" : "bi-border bi-border-radius"),
height: 24,
});
}

2
packages/fineui/ui/less/app.less

@ -0,0 +1,2 @@
@import "../../src/less/resource/app.less";
@import "var.less";

2
packages/fineui/ui/less/background.less

@ -0,0 +1,2 @@
@import "../../src/less/resource/background.less";
@import "var.less";

2
packages/fineui/ui/less/font.less

@ -0,0 +1,2 @@
@import "../../src/less/resource/font.less";
@import "var.less";

5
packages/fineui/ui/less/icon.less

@ -0,0 +1,5 @@
@import "../../src/less/resource/icon.less";
@import "var.less";

5
packages/fineui/ui/less/var.less

@ -0,0 +1,5 @@
@webUrl: 'resources?path=/com/fr/web/ui/';
@fontUrl: '@{webUrl}font/'; //图片的基本地址
@imageUrl: '@{webUrl}images/1x/'; //图片的基本地址
@image2xUrl: '@{webUrl}images/2x/'; //2倍图片的基本地址

91
packages/fineui/webpack.prod.js

@ -1,91 +0,0 @@
const webpack = require("webpack");
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 = {
mode: "production",
entry: {
"fineui.min": "./src/bundle.js",
},
output: {
path: path.resolve(__dirname, "dist"),
filename: "[name].js",
},
devtool: "hidden-source-map",
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
{
test: /\.(css|less)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
url: false,
},
},
{
loader: "postcss-loader",
options: {
plugins: [autoprefixer],
},
},
{
loader: "less-loader",
options: {
relativeUrls: false,
modifyVars: lessVariables,
},
},
],
},
],
},
resolve: {
extensions: [".js", ".ts"],
alias: {
"@": path.resolve(__dirname, "src"),
},
},
plugins: [new CircularDependencyPlugin()],
optimization: {
usedExports: false,
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.js$/i,
}),
new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString()}; branch: ${git(
"name-rev --name-only HEAD"
)} commit: ${git("rev-parse HEAD")}`,
}),
],
},
};

265
packages/fineui/webpack/attachments.js

@ -0,0 +1,265 @@
const { sync, uniq } = require("./utils");
const fixJs = "./dist/fix/fix.js";
const fixProxyJs = './dist/fix/fix.proxy.js';
const fixCompact = "./dist/fix/fix.compact.js";
const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
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",
]),
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",
]),
fix: [fixJs],
fixProxy: [fixProxyJs],
less: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
"src/less/base/**/*.less",
"src/less/case/**/*.less",
"src/less/widget/**/*.less",
"src/less/component/**/*.less",
]),
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"]),
[fixCompact, 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,
['./dist/fix/fix.compact.js'],
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.js_bundle,
basicAttachmentMap.ui,
// basicAttachmentMap.ts,
);
const fineuiWithoutConflict = [].concat(
basicAttachmentMap.polyfill,
basicAttachmentMap.core_without_conflict,
basicAttachmentMap.fix,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
[fixCompact, workerCompact],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
// 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,
[fixCompact, workerCompact],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
const fineuiWithoutJqueryAndPolyfillJs = [].concat(
runtimePolyfill,
sync([
"src/core/0.foundation.js",
lodashJs,
"src/core/**/*.js",
"src/data/**/*.js",
], [
"src/core/platform/web/**/*.js",
]),
basicAttachmentMap.fix,
sync([
"src/base/**/*.js",
"src/case/**/*.js",
], [
"src/base/single/input/file.js",
"src/case/ztree/**/*.js",
]),
basicAttachmentMap.widget,
sync([fixCompact, workerCompact, "ui/js/**/*.js"]),
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"]),
[fixCompact, workerCompact],
basicAttachmentMap.ts,
sync(["demo/less/*.less", "demo/less/**/*.less", "demo/app.js", "demo/js/**/*.js", "demo/config.js"]),
);
module.exports = {
fix: fixJs,
fixProxy: fixProxyJs,
lodash: lodashJs,
font: basicAttachmentMap.font,
bundle: uniq(bundle),
fineuiWithoutNormalize: uniq(fineuiWithoutNormalize),
fineuiWithoutConflict: uniq(fineuiWithoutConflict),
bundleWithoutNormalize: uniq(bundleWithoutNormalize),
fineui: uniq(fineui),
fineuiProxy: uniq(fineuiProxy),
fineuiWithoutJqueryAndPolyfillJs: uniq(fineuiWithoutJqueryAndPolyfillJs),
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),
};

16
packages/fineui/webpack/dirs.js

@ -0,0 +1,16 @@
const path = require("path");
module.exports = {
DEST: path.resolve(__dirname, "../dist"),
NODE_MODULES: path.resolve(__dirname, "../node_modules"),
PRIVATE: path.resolve(__dirname, "../private"),
BABEL_CONFIG: path.resolve(__dirname, "../babel.config.js"),
TYPESCRIPT: path.resolve(__dirname, "../typescript"),
ROUTER: path.resolve(__dirname, "../src/router"),
SRC: path.resolve(__dirname, "../src"),
DEMO: path.resolve(__dirname, "../demo"),
PUBLIC: path.resolve(__dirname, "../public"),
I18N: path.resolve(__dirname, "../i18n"),
UI: path.resolve(__dirname, "../ui"),
MOBILE: path.resolve(__dirname, "../_mobile"),
FIX: path.resolve(__dirname, "../dist/fix"),
};

24
packages/fineui/webpack/utils.js

@ -0,0 +1,24 @@
const path = require('path');
const glob = require('glob');
// const glob = require('fast-glob');
function uniq(names) {
return [...new Set(names)];
}
const globalExcludes = [
"**/*/__test__/*.js",
];
function sync(patterns, excludes = []) {
const ignore = globalExcludes.concat(excludes).map(pattern => path.join(__dirname, "../", pattern).replace(/\\/g, '/'));
return patterns.map(pattern => glob.sync(path.join(__dirname, "../", pattern).replace(/\\/g, '/'), { ignore })).flat();
}
module.exports = {
sync,
uniq,
};

90
packages/fineui/webpack/webpack.common.js

@ -0,0 +1,90 @@
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const autoprefixer = require("autoprefixer");
const path = require("path");
const fs = require("fs");
const dirs = require("./dirs");
const attachments = require("./attachments");
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 = {
entry: {
fineui: attachments.fineui,
},
externals: {
lodash: "_",
underscore: "_",
},
resolve: {
mainFields: ["module", "main"],
extensions: [".js", ".ts"],
alias: {
"@": path.resolve(__dirname, "../src"),
},
},
module: {
rules: [
{
test: /\.(jsx?|tsx?)$/i,
include: [
dirs.NODE_MODULES,
dirs.PRIVATE,
dirs.PUBLIC,
dirs.MOBILE,
dirs.DEMO,
dirs.I18N,
dirs.UI,
dirs.FIX,
dirs.TYPESCRIPT,
dirs.SRC,
],
exclude: /node_modules(\/|\\)core-js/,
use: [
{
loader: "babel-loader",
options: {
configFile: dirs.BABEL_CONFIG,
},
},
],
},
{
test: /\.(css|less)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
url: false,
},
},
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [autoprefixer],
},
},
},
{
loader: "less-loader",
options: {
lessOptions: {
relativeUrls: false,
modifyVars: lessVariables,
},
},
},
],
},
],
},
};

11
packages/fineui/webpack/webpack.css.js

@ -0,0 +1,11 @@
const { merge } = require("webpack-merge");
const prod = require("./webpack.prod.js");
const attachments = require("./attachments");
prod.entry = {};
module.exports = merge(prod, {
mode: "production",
entry: {
[`${process.env.LESS_FILE_NAME}.min`]: attachments.bundleCss,
},
});

59
packages/fineui/webpack/webpack.prod.js

@ -0,0 +1,59 @@
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const common = require("./webpack.common.js");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const childProcess = require("child_process");
const { merge } = require("webpack-merge");
const dirs = require("./dirs");
const attachments = require("./attachments");
function git(command) {
return childProcess.execSync(`git ${command}`).toString().trim();
}
module.exports = merge(common, {
mode: "production",
entry: {
"fineui.min": attachments.fineui
},
output: {
path: dirs.DEST,
filename: "[name].js",
},
devtool: "hidden-source-map",
optimization: {
usedExports: false,
minimize: true,
minimizer: [
new TerserPlugin({
include: /\.min/,
parallel: true,
terserOptions: {
output: {
comments: false,
},
},
}),
new webpack.BannerPlugin({
banner: `time: ${new Date().toLocaleString("en-US")}; branch: ${git(
"name-rev --name-only HEAD"
)} commit: ${git("rev-parse HEAD")}`,
}),
new CssMinimizerPlugin(),
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
new ForkTsCheckerWebpackPlugin({}),
],
});
Loading…
Cancel
Save