Browse Source

Merge branch 'feature/x' of ssh://code.fineres.com:7999/~claire.tang/d-fineui into bugfix/11.0

master
Claire 2 years ago
parent
commit
fa760e2cb9
  1. 3
      bi.lessconfig.json
  2. 2
      bin/cli/worker/template/main_thread.helper.t
  3. 62
      demo/js/widget/downlist/demo.downlist.js
  4. 2
      package.json
  5. 3
      src/base/single/editor/editor.multifile.js
  6. 1
      src/base/single/editor/editor.textarea.js
  7. 1
      src/base/single/input/file.js
  8. 17
      src/base/single/label/abstract.label.js
  9. 17
      src/base/single/label/label.js
  10. 2
      src/base/single/tip/tip.tooltip.js
  11. 22
      src/case/button/icon/iconhalf/icon.half.js
  12. 1
      src/case/combo/textvaluecombo/combo.textvalue.js
  13. 12
      src/core/4.widget.js
  14. 22
      src/core/utils/i18n.js
  15. 9
      src/less/base/single/button/item.singleselect.icontext.less
  16. 2
      src/router/router.js
  17. 16
      src/widget/downlist/item.downlist.js
  18. 48
      src/widget/downlist/item.downlistgroup.js
  19. 5
      typescript/base/single/button/buttons/button.ts
  20. 8
      webpack/attachments.js

3
bi.lessconfig.json

@ -40,5 +40,6 @@
"@color-bi-text-header-background": "rgba(9, 30, 64, 0.9)", "@color-bi-text-header-background": "rgba(9, 30, 64, 0.9)",
"@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)", "@color-bi-text-header-background-theme-dark": "rgba(255, 255, 255, 0.9)",
"@font-down-triangle": "e70b", "@font-down-triangle": "e70b",
"@font-date": "e733" "@font-date": "e733",
"@font-trigger-triangle": "e924"
} }

2
bin/cli/worker/template/main_thread.helper.t

@ -2,7 +2,7 @@ import { ${WorkerName}MainThreadWorker } from './main_thread/${workerName}_main_
// 不需要一起打包的话则不需要引入这行 // 不需要一起打包的话则不需要引入这行
// FuiWorkerPlugin中的属性会同步到fui-worker中同时支持loader行内传入属性 // FuiWorkerPlugin中的属性会同步到fui-worker中同时支持loader行内传入属性
// 根据实际需求传入inline返回格式 true -> blob urlfalse -> servicePath // 根据实际需求传入inline返回格式 true -> blob urlfalse -> servicePath
import { workerUrl } from 'fui-worker!./worker_thread/${workerName}_worker_thread'; import workerUrl from 'fui-worker!./worker_thread/${workerName}_worker_thread';
export class ${WorkerName}WorkerHelper { export class ${WorkerName}WorkerHelper {
private worker: ${WorkerName}MainThreadWorker; private worker: ${WorkerName}MainThreadWorker;

62
demo/js/widget/downlist/demo.downlist.js

@ -1,3 +1,15 @@
(function () {
var CustomIcon = BI.inherit(BI.Widget, {
render: function () {
return {
type: "bi.label",
text: "✨",
};
},
});
BI.shortcut("demo.downlist.icon", CustomIcon);
}());
Demo.Downlist = BI.inherit(BI.Widget, { Demo.Downlist = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "demo-downlist" baseCls: "demo-downlist"
@ -22,9 +34,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this; var self = this;
// test
return { return {
type: "bi.horizontal_adapt", type: "bi.left",
items: [{ items: [{
type: "bi.down_list_combo", type: "bi.down_list_combo",
ref: function (_ref) { ref: function (_ref) {
@ -131,7 +143,51 @@ Demo.Downlist = BI.inherit(BI.Widget, {
// }] // }]
}] }]
] ],
}, {
type: "bi.down_list_combo",
el: {
type: "bi.button",
ghost: true,
iconPosition: "right",
icon: "column-next-page-h-font",
text: "自定义 trigger 和 icon 的级联下拉框",
},
listeners: [{
eventName: "EVENT_CHANGE",
action: function (v) {
console.log("触发值", v);
}
}, {
eventName: "EVENT_SON_VALUE_CHANGE",
action: function(v) {
console.log("二级菜单触发值", v)
}
}],
items: [
[{
el: {
text: "选项一",
value: 1,
icon: {
type: "demo.downlist.icon",
},
},
children: [{
text: "选项一",
value: 11,
icon: {
type: "demo.downlist.icon",
},
}, {
text: "选项二",
value: 12,
}],
}, {
text: "选项二",
value: 2,
}]
],
}, { }, {
type: "bi.multi_layer_down_list_combo", type: "bi.multi_layer_down_list_combo",
ref: function (_ref) { ref: function (_ref) {

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220826175704", "version": "2.0.20220906172430",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

3
src/base/single/editor/editor.multifile.js

@ -43,12 +43,14 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
}); });
this.file.on(BI.File.EVENT_ERROR, function () { this.file.on(BI.File.EVENT_ERROR, function () {
self.fireEvent(BI.MultifileEditor.EVENT_ERROR, arguments); self.fireEvent(BI.MultifileEditor.EVENT_ERROR, arguments);
self._reset();
}); });
this.file.on(BI.File.EVENT_PROGRESS, function () { this.file.on(BI.File.EVENT_PROGRESS, function () {
self.fireEvent(BI.MultifileEditor.EVENT_PROGRESS, arguments); self.fireEvent(BI.MultifileEditor.EVENT_PROGRESS, arguments);
}); });
this.file.on(BI.File.EVENT_UPLOADED, function () { this.file.on(BI.File.EVENT_UPLOADED, function () {
self.fireEvent(BI.MultifileEditor.EVENT_UPLOADED, arguments); self.fireEvent(BI.MultifileEditor.EVENT_UPLOADED, arguments);
self._reset();
}); });
BI.createWidget({ BI.createWidget({
@ -93,7 +95,6 @@ BI.MultifileEditor = BI.inherit(BI.Widget, {
}, },
upload: function () { upload: function () {
this._reset();
this.file.upload(); this.file.upload();
}, },

1
src/base/single/editor/editor.textarea.js

@ -111,7 +111,6 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
cls: "bi-water-mark textarea-watermark", cls: "bi-water-mark textarea-watermark",
textAlign: "left", textAlign: "left",
whiteSpace: o.scrolly ? "normal" : "nowrap", whiteSpace: o.scrolly ? "normal" : "nowrap",
title: o.watermark,
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled, disabled: o.disabled,

1
src/base/single/input/file.js

@ -705,6 +705,7 @@
reset: function () { reset: function () {
if (this.wrap) { if (this.wrap) {
this.wrap.files = [];
this.wrap.attach_array = []; this.wrap.attach_array = [];
this.wrap.attach_names = []; this.wrap.attach_names = [];
this.wrap.attachNum = 0; this.wrap.attachNum = 0;

17
src/base/single/label/abstract.label.js

@ -24,23 +24,6 @@
}); });
}, },
getTitle: function () {
var title = this.options.title;
var text = this.options.text;
if (BI.isFunction(title)) {
return title();
}
if (BI.isNotNull(title)) {
return title;
}
if (BI.isFunction(text)) {
return text();
}
return text;
},
_createJson: function () { _createJson: function () {
var o = this.options; var o = this.options;

17
src/base/single/label/label.js

@ -10,6 +10,23 @@ BI.Label = BI.inherit(BI.AbstractLabel, {
keyword: "", keyword: "",
}, },
getTitle: function () {
var title = this.options.title;
var text = this.options.text;
if (BI.isFunction(title)) {
return title();
}
if (BI.isNotNull(title)) {
return title;
}
if (BI.isFunction(text)) {
return text();
}
return text;
},
doRedMark: function () { doRedMark: function () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark.apply(this.text, arguments);
}, },

2
src/base/single/tip/tip.tooltip.js

@ -53,6 +53,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
whiteSpace: "normal", whiteSpace: "normal",
text: text, text: text,
textHeight: 18, textHeight: 18,
title: null,
}; };
}), }),
}); });
@ -63,6 +64,7 @@ BI.Tooltip = BI.inherit(BI.Tip, {
textAlign: o.textAlign, textAlign: o.textAlign,
whiteSpace: "normal", whiteSpace: "normal",
text: o.text, text: o.text,
title: null,
textHeight: 18, textHeight: 18,
hgap: this._const.hgap, hgap: this._const.hgap,
vgap: this._const.vgap, vgap: this._const.vgap,

22
src/case/button/icon/iconhalf/icon.half.js

@ -7,16 +7,30 @@ BI.HalfButton = BI.inherit(BI.BasicButton, {
_defaultConfig: function () { _defaultConfig: function () {
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
extraCls: "bi-half-button bi-high-light-border", selected: false,
height: 14,
width: 14, width: 14,
selected: false height: 14,
iconWidth: 14,
iconHeight: 14,
}); });
}, },
render: function () {
var o = this.options;
return {
type: "bi.center_adapt",
items: [{
type: "bi.default",
cls: "bi-half-button bi-high-light-border",
width: o.iconWidth,
height: o.iconHeight,
}],
};
},
doClick: function () { doClick: function () {
BI.HalfButton.superclass.doClick.apply(this, arguments); BI.HalfButton.superclass.doClick.apply(this, arguments);
if(this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.HalfButton.EVENT_CHANGE); this.fireEvent(BI.HalfButton.EVENT_CHANGE);
} }
} }

1
src/case/combo/textvaluecombo/combo.textvalue.js

@ -76,7 +76,6 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
type: "bi.text_value_combo_popup", type: "bi.text_value_combo_popup",
ref: ref => this.popup = ref, ref: ref => this.popup = ref,
chooseType: o.chooseType, chooseType: o.chooseType,
value: o.value,
items: o.items, items: o.items,
listeners: [ listeners: [
{ {

12
src/core/4.widget.js

@ -748,7 +748,16 @@
this.purgeListeners(); this.purgeListeners();
}, },
_assetMounted: function () {
if (!this.isVisible()) {
this._setVisible(true);
this._mount(false, false, false);
this._setVisible(false);
}
},
_empty: function () { _empty: function () {
this._assetMounted();
BI.each(this._children, function (i, widget) { BI.each(this._children, function (i, widget) {
widget && widget._unMount && widget._unMount(); widget && widget._unMount && widget._unMount();
}); });
@ -790,6 +799,7 @@
}); });
}); });
this._watchers && (this._watchers = []); this._watchers && (this._watchers = []);
this._assetMounted();
this.__d(); this.__d();
this.element.empty(); this.element.empty();
this.element.unbind(); this.element.unbind();
@ -799,6 +809,7 @@
}, },
_destroy: function () { _destroy: function () {
this._assetMounted();
this.__destroy(); this.__destroy();
this.element.destroy(); this.element.destroy();
this.purgeListeners(); this.purgeListeners();
@ -806,6 +817,7 @@
destroy: function () { destroy: function () {
var self = this, o = this.options; var self = this, o = this.options;
this._assetMounted();
this.__destroy(); this.__destroy();
if (o.animation) { if (o.animation) {
this._innerSetVisible(false); this._innerSetVisible(false);

22
src/core/utils/i18n.js

@ -1,5 +1,8 @@
!(function () { !(function () {
var i18nStore = {}; var i18nStore = {};
var i18nFormatters = {};
BI._.extend(BI, { BI._.extend(BI, {
changeI18n: function (i18n) { changeI18n: function (i18n) {
if (i18n) { if (i18n) {
@ -9,6 +12,7 @@
addI18n: function (i18n) { addI18n: function (i18n) {
BI.extend(i18nStore, i18n); BI.extend(i18nStore, i18n);
}, },
i18nText: function (key) { i18nText: function (key) {
var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || ""; var localeText = i18nStore[key] || (BI.i18n && BI.i18n[key]) || "";
if (!localeText) { if (!localeText) {
@ -16,10 +20,18 @@
} }
var len = arguments.length; var len = arguments.length;
if (len > 1) { if (len > 1) {
if (localeText.indexOf("{R1}") > -1) { if (localeText.indexOf("{R1") > -1) {
for (var i = 1; i < len; i++) { for (var i = 1; i < len; i++) {
var key = "{R" + i + "}"; var reg = new RegExp(`{R${i},(.*?)}`, "g");
localeText = BI.replaceAll(localeText, key, arguments[i] + "");
var result = reg.exec(localeText);
if (result) {
var formatName = result[1];
localeText = BI.replaceAll(localeText, reg, i18nFormatters[formatName](key, arguments[i]));
} else {
localeText = BI.replaceAll(localeText, `{R${i}}`, arguments[i] + "");
}
} }
} else { } else {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
@ -30,6 +42,10 @@
} }
} }
return localeText; return localeText;
},
addI18nFormatter: function (formatName, fn) {
i18nFormatters[formatName] = fn;
} }
}); });
})(); })();

9
src/less/base/single/button/item.singleselect.icontext.less

@ -1,9 +0,0 @@
@import "../../../index.less";
.bi-single-select-icon-text-item{
&:active, &.active {
& .b-font:before {
color: @color-bi-text-active-single-select-icon-text-item;
}
}
}

2
src/router/router.js

@ -2326,7 +2326,7 @@
route.matched[lastRouteIndex] === current.matched[lastCurrentIndex] route.matched[lastRouteIndex] === current.matched[lastCurrentIndex]
) { ) {
this.ensureURL(); this.ensureURL();
return abort(createNavigationDuplicatedError(current, route)) return;
} }
var ref = resolveQueue( var ref = resolveQueue(

16
src/widget/downlist/item.downlist.js

@ -33,17 +33,21 @@ BI.DownListItem = BI.inherit(BI.BasicButton, {
keyword: o.keyword, keyword: o.keyword,
height: o.height height: o.height
}); });
var icon = BI.isPlainObject(o.icon) ? o.icon : {
type: "bi.icon",
width: o.iconWidth,
height: o.iconHeight,
}
this.icon = BI.createWidget({ this.icon = BI.createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: 36, width: 36,
height: o.height, height: o.height,
items: [{ items: [{
el: { el: icon,
type: "bi.icon", }],
width: o.iconWidth,
height: o.iconHeight
}
}]
}); });
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({

48
src/widget/downlist/item.downlistgroup.js

@ -8,11 +8,11 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
}, },
// invalid: true, // invalid: true,
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
icon: "",
iconCls2: "pull-right-e-font" iconCls2: "pull-right-e-font"
}); });
}, },
_init: function () { render: function () {
BI.DownListGroupItem.superclass._init.apply(this, arguments);
var o = this.options; var o = this.options;
var self = this; var self = this;
this.text = BI.createWidget({ this.text = BI.createWidget({
@ -21,9 +21,17 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
value: o.value, value: o.value,
height: o.height height: o.height,
}); });
if (BI.isPlainObject(o.icon)) {
this.icon1 = BI.createWidget({
width: 36,
height: o.height,
type: "bi.center_adapt",
items: [o.icon],
});
} else {
this.icon1 = BI.createWidget({ this.icon1 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: o.iconCls1, cls: o.iconCls1,
@ -32,8 +40,9 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
iconWidth: 36, iconWidth: 36,
disableSelected: true, disableSelected: true,
selected: this._digest(o.value) selected: this._digest(o.value),
}); });
}
this.icon2 = BI.createWidget({ this.icon2 = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
@ -42,27 +51,6 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
forceNotSelected: true forceNotSelected: true
}); });
var blank = BI.createWidget({
type: "bi.layout",
width: 24
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.icon2,
top: 0,
bottom: 0,
right: 0
}]
});
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank)
}))));
this.element.hover(function () { this.element.hover(function () {
if (self.isEnabled()) { if (self.isEnabled()) {
self.hover(); self.hover();
@ -72,6 +60,12 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
self.dishover(); self.dishover();
} }
}); });
return {
type: "bi.horizontal_fill",
columnSize: [36, "fill", 24],
items: [this.icon1, this.text, this.icon2]
}
}, },
_getLevel: function () { _getLevel: function () {
@ -117,8 +111,8 @@ BI.DownListGroupItem = BI.inherit(BI.BasicButton, {
}, },
setValue: function (v) { setValue: function (v) {
this.icon1.setSelected(this._digest(v)); this.icon1.setSelected && this.icon1.setSelected(this._digest(v));
} },
}); });
BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem); BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem);

5
typescript/base/single/button/buttons/button.ts

@ -10,8 +10,11 @@ export declare class Button extends BasicButton {
minWidth?: number; minWidth?: number;
readonly?: boolean; readonly?: boolean;
iconCls?: string; iconCls?: string;
level?: 'common' | 'success' | 'warning' |'ignore', level?: 'common' | 'success' | 'warning' | 'error' | 'ignore',
block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制 block?: boolean; // 是否块状显示,即不显示边框,没有最小宽度的限制
loading?: boolean, // 是否处于加载中
light?: boolean, // 是否使用浅色
plain?: boolean, // 是否是朴素按钮,和 clear 的区别是 plain 有悬浮效果
clear?: boolean; // 是否去掉边框和背景 clear?: boolean; // 是否去掉边框和背景
ghost?: boolean; // 是否幽灵显示, 即正常状态无背景 ghost?: boolean; // 是否幽灵显示, 即正常状态无背景
iconGap?: number; iconGap?: number;

8
webpack/attachments.js

@ -7,8 +7,13 @@ const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/1.lodash.js"; const lodashJs = "src/core/1.lodash.js";
const jqueryJs = "src/core/platform/web/jquery/_jquery.js"; const jqueryJs = "src/core/platform/web/jquery/_jquery.js";
const runtimePolyfill = ["@babel/polyfill", "es6-promise/auto"];
const basicAttachmentMap = { const basicAttachmentMap = {
polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(["@babel/polyfill", "es6-promise/auto"]), polyfill: sync([
"src/core/0.foundation.js",
"src/polyfill/**/*.js",
]).concat(runtimePolyfill),
core: sync([ core: sync([
"src/less/core/**/*.less", "src/less/core/**/*.less",
"src/less/theme/**/*.less", "src/less/theme/**/*.less",
@ -202,6 +207,7 @@ const fineuiProxy = [].concat(
); );
const fineuiWithoutJqueryAndPolyfillJs = [].concat( const fineuiWithoutJqueryAndPolyfillJs = [].concat(
runtimePolyfill,
sync([ sync([
"src/core/0.foundation.js", "src/core/0.foundation.js",
lodashJs, lodashJs,

Loading…
Cancel
Save