Browse Source

Merge pull request #210405 in DEC/fineui from release/11.0 to bugfix/11.0

* commit '8b3fc308d531a461e1b2f56faf50c5eeebff9e73': (29 commits)
  auto upgrade version to 2.0.20221202174010
  无JIRA fix(widget.ts): 去掉_Widget里的_renderEngine
  auto upgrade version to 2.0.20221202164316
  auto upgrade version to 2.0.20221202162515
  无JIRA fix(widget.ts): 把_renderEngine改为静态属性
  auto upgrade version to 2.0.20221201180321
  KERNEL-13662 feat: text_value_combo 复选,支持不带全选 - from Richie
  auto upgrade version to 2.0.20221130152547
  auto upgrade version to 2.0.20221130100342
  KERNEL-13662 feat: text_value_combo 复选,支持不带全选 - from Richie
  auto upgrade version to 2.0.20221129152444
  auto upgrade version to 2.0.20221128101611
  auto upgrade version to 2.0.20221124203811
  无JIRA feat: 加个方法 BI.getMinimumFontSize() 获取当前最小字体设置
  auto upgrade version to 2.0.20221123105406
  无JIRA feat: 加个方法 BI.getMinimumFontSize() 获取当前最小字体设置
  auto upgrade version to 2.0.20221122222501
  auto upgrade version to 2.0.20221122172525
  无JIRA refactor(each): 加个重载
  BI-117565 fix: 自适应情况下number-checker的圆角实现
  ...
research/test
superman 2 years ago
parent
commit
1782b0acb1
  1. 31
      demo/js/case/combo/demo.text_value_combo.js
  2. 2
      package.json
  3. 4
      src/case/combo/textvaluecombo/combo.textvalue.js
  4. 79
      src/case/combo/textvaluecombo/popup.textvalue.js
  5. 9
      src/core/platform/web/function.js
  6. 2
      src/less/widget/multiselect/trigger/button.checkselected.less
  7. 4
      src/less/widget/multitree/trigger/multi.tree.button.checkselected.less
  8. 5
      src/widget/downlist/combo.downlist.js
  9. 7
      typescript/case/combo/combo.textvalue.ts
  10. 13
      typescript/case/combo/popup.textvalue.ts
  11. 4
      typescript/core/base.ts
  12. 15
      typescript/core/widget.ts
  13. 3
      typescript/index.ts

31
demo/js/case/combo/demo.text_value_combo.js

@ -8,7 +8,8 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
render: function () { render: function () {
var combo1, combo2; var combo1, combo2;
var items = [{ var items = [
{
text: "MVC-1", text: "MVC-1",
iconCls: "date-font", iconCls: "date-font",
value: 1 value: 1
@ -20,7 +21,8 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
text: "MVC-3", text: "MVC-3",
iconCls: "pull-right-font", iconCls: "pull-right-font",
value: 3 value: 3
}]; }
];
// 创建下拉框各种场景用例 // 创建下拉框各种场景用例
return { return {
@ -195,6 +197,31 @@ Demo.TextValueCombo = BI.inherit(BI.Widget, {
allowClear: true, allowClear: true,
defaultText: "请选择", defaultText: "请选择",
chooseType: BI.Selection.Multi, chooseType: BI.Selection.Multi,
value: [1],
// allowSelectAll: false,
listeners: [
{
eventName: BI.TextValueCombo.EVENT_CHANGE,
action: function () {
console.log(this.getValue());
}
}
]
}
]
}),
this.createCombo("支持复选,不要全选功能", {
type: "bi.vertical",
items: [
{
type: "bi.text_value_combo",
width: 300,
items: items,
allowClear: true,
defaultText: "请选择",
chooseType: BI.Selection.Multi,
value: [1],
allowSelectAll: false,
listeners: [ listeners: [
{ {
eventName: BI.TextValueCombo.EVENT_CHANGE, eventName: BI.TextValueCombo.EVENT_CHANGE,

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20221121190600", "version": "2.0.20221202174010",
"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",

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

@ -16,7 +16,8 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
el: {}, el: {},
allowClear: false, allowClear: false,
status: "success", // success | warning | error, status: "success", // success | warning | error,
title: null title: null,
allowSelectAll: true,
}); });
}, },
@ -78,6 +79,7 @@ BI.TextValueCombo = BI.inherit(BI.Widget, {
ref: ref => this.popup = ref, ref: ref => this.popup = ref,
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items, items: o.items,
allowSelectAll: o.allowSelectAll,
listeners: [ listeners: [
{ {
eventName: BI.TextValueComboPopup.EVENT_CHANGE, eventName: BI.TextValueComboPopup.EVENT_CHANGE,

79
src/case/combo/textvaluecombo/popup.textvalue.js

@ -2,28 +2,33 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
allowSelectAll: true,
}); });
}, },
render () { render() {
var o = this.options, self = this; var o = this.options, self = this;
if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (o.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return { return {
type: "bi.vertical", type: "bi.vertical",
vgap: 5, vgap: 5,
items: [{ items: [
{
type: "bi.button_group", type: "bi.button_group",
ref: (_ref) => { ref: (_ref) => {
this.popup = _ref; this.popup = _ref;
}, },
items: this._formatItems(o.items), items: this._formatItems(o.items),
chooseType: o.chooseType, chooseType: o.chooseType,
layouts: [{ layouts: [
{
type: "bi.vertical" type: "bi.vertical"
}], }
],
value: o.value, value: o.value,
listeners: [{ listeners: [
{
eventName: BI.Controller.EVENT_CHANGE, eventName: BI.Controller.EVENT_CHANGE,
action: function (type, val, obj) { action: function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
@ -31,15 +36,17 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj);
} }
} }
}] }
}] ]
}
]
}; };
} }
return { return {
type: "bi.vertical", type: "bi.vertical",
verticalAlign: BI.VerticalAlign.Stretch, verticalAlign: BI.VerticalAlign.Stretch,
rowSize: ["fill", ""], items: o.allowSelectAll ? [
items: [{ {
type: "bi.select_list", type: "bi.select_list",
logic: { logic: {
dynamic: true, dynamic: true,
@ -52,7 +59,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
}, },
el: { el: {
el: { el: {
chooseType: o.chooseType chooseType: o.chooseType,
} }
}, },
items: this._formatItems(o.items), items: this._formatItems(o.items),
@ -60,17 +67,21 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: o.value value: o.value
}, },
listeners: [{ height: "fill",
listeners: [
{
eventName: BI.SelectList.EVENT_CHANGE, eventName: BI.SelectList.EVENT_CHANGE,
action: function (val) { action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val); self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
} }
}] }
]
}, { }, {
type: "bi.center", type: "bi.center",
cls: "list-view-toolbar bi-high-light bi-split-top", cls: "list-view-toolbar bi-high-light bi-split-top",
height: 24, height: 24,
items: BI.createItems([{ items: BI.createItems([
{
type: "bi.text_button", type: "bi.text_button",
text: BI.i18nText("BI-Basic_Clears"), text: BI.i18nText("BI-Basic_Clears"),
handler: function () { handler: function () {
@ -82,12 +93,41 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
handler: function () { handler: function () {
self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM); self.fireEvent(BI.TextValueComboPopup.EVENT_CONFIRM);
} }
}], { }
], {
once: false, once: false,
shadow: true, shadow: true,
isShadowShowingOnSelected: true isShadowShowingOnSelected: true
}) })
}] }
] : [
{
type: "bi.list_pane",
logic: {
dynamic: true,
innerVgap: 5,
rowSize: ["", "fill"],
verticalAlign: BI.VerticalAlign.Stretch
},
ref: (_ref) => {
this.popup = _ref;
},
el: {
chooseType: o.chooseType,
},
items: this._formatItems(o.items),
value: o.value,
height: "fill",
listeners: [
{
eventName: BI.ListPane.EVENT_CHANGE,
action: function (val) {
self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val);
}
}
]
}
],
}; };
}, },
@ -117,6 +157,9 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
return this.popup.getValue(); return this.popup.getValue();
} }
var val = this.popup.getValue(); var val = this.popup.getValue();
if (!this.options.allowSelectAll) {
return val;
}
if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (val.type === BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return val.value; return val.value;
} else { } else {
@ -128,6 +171,10 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, {
if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) { if (this.options.chooseType !== BI.ButtonGroup.CHOOSE_TYPE_MULTI) {
return this.popup.setValue(v); return this.popup.setValue(v);
} }
if (!this.options.allowSelectAll) {
this.popup.setValue(v);
return;
}
this.popup.setValue({ this.popup.setValue({
type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, type: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
value: v value: v

9
src/core/platform/web/function.js

@ -137,5 +137,14 @@ BI._.extend(BI, {
return version[1] * 1; return version[1] * 1;
} }
return 0; return 0;
},
getMinimumFontSize: function () {
const el = document.createElement('div');
el.style.fontSize = "0px";
document.body.appendChild(el);
const size = getComputedStyle(el).fontSize;
el.remove();
return parseInt(size);
} }
}); });

2
src/less/widget/multiselect/trigger/button.checkselected.less

@ -2,7 +2,7 @@
.bi-multi-select-check-selected-button { .bi-multi-select-check-selected-button {
z-index: 1; z-index: 1;
.border-radius(50%); .border-radius(99999px);
&:active { &:active {
color: @color-bi-text-highlight; color: @color-bi-text-highlight;

4
src/less/widget/multitree/trigger/multi.tree.button.checkselected.less

@ -6,9 +6,9 @@
z-index: 1; z-index: 1;
} }
.trigger-check-text { .trigger-check-text {
.border-radius(8px); .border-radius(99999px);
.border-radius(calc(var(--css-scale, 1) * 8px));
z-index: 1; z-index: 1;
&:active { &:active {
background-color: @color-bi-background-multi-select-trigger-check-selected; background-color: @color-bi-background-multi-select-trigger-check-selected;
} }

5
src/widget/downlist/combo.downlist.js

@ -44,7 +44,8 @@
popup: {}, popup: {},
minWidth: 140, minWidth: 140,
maxHeight: 1000, maxHeight: 1000,
destroyWhenHide: false destroyWhenHide: false,
isDefaultInit: true,
}); });
}, },
@ -57,7 +58,7 @@
type: "bi.combo", type: "bi.combo",
trigger: o.trigger, trigger: o.trigger,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
isDefaultInit: true, isDefaultInit: o.isDefaultInit,
container: o.container, container: o.container,
adjustLength: o.adjustLength, adjustLength: o.adjustLength,
direction: o.direction, direction: o.direction,

7
typescript/case/combo/combo.textvalue.ts

@ -5,5 +5,10 @@ export declare class TextValueCombo extends Widget {
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
populate(items: any): void; clear(): void;
setText(text: string): void;
setValue(value: any): void;
setStatus(status: "success" | "warning" | "error"): void;
getValue(): any[];
populate(items: any[]): void;
} }

13
typescript/case/combo/popup.textvalue.ts

@ -0,0 +1,13 @@
import { Pane } from "../../base/pane";
export declare class TextValueComboPopup extends Pane {
static xtype: string;
static EVENT_CHANGE: string;
static EVENT_CLEAR: string;
static EVENT_CONFIRM: string;
populate(items: any[]): void;
getValue(): any;
setValue(value: any): void;
}

4
typescript/core/base.ts

@ -38,7 +38,9 @@ export interface _base {
size: (collection: any) => number; size: (collection: any) => number;
each: <T>(collection: T[] | object | string, callback?: ((index: number, value: T) => void) | object | string, thisArg?: any) => any; each<T>(collection: ArrayLike<T>, iteratee?: (index: number, value: T) => void, thisArg?: any): ArrayLike<T>;
each<T extends object, K extends keyof T>(collection: T, iteratee?: (index: K, value: T[K]) => void, thisArg?: any): T;
each<T>(collection: T, iteratee?: any, thisArg?: any): T;
map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[]; map: <T, U>(collection: T[] | object | string | null | undefined, callback?: ((index: number, value: T) => U) | object | string, thisArg?: any) => U[];

15
typescript/core/widget.ts

@ -69,11 +69,6 @@ export interface _Widget extends _OB {
*/ */
_manualSetValid: boolean; _manualSetValid: boolean;
/**
*
*/
_renderEngine: RenderEngine;
_store(): void; _store(): void;
// 生命周期函数 // 生命周期函数
@ -418,6 +413,11 @@ export declare class Widget extends OB {
*/ */
static registerRenderEngine(engine: RenderEngine): void; static registerRenderEngine(engine: RenderEngine): void;
/**
*
*/
static _renderEngine: RenderEngine;
/** /**
* loading的锁 * loading的锁
*/ */
@ -476,11 +476,6 @@ export declare class Widget extends OB {
*/ */
_manualSetValid: boolean; _manualSetValid: boolean;
/**
*
*/
_renderEngine: RenderEngine;
_store(): void; _store(): void;
// 生命周期函数 // 生命周期函数

3
typescript/index.ts

@ -20,6 +20,7 @@ import { IconChangeButton } from "./case/button/icon/icon.change";
import { MultiSelectItem } from "./case/button/item.multiselect"; import { MultiSelectItem } from "./case/button/item.multiselect";
import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble"; import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble";
import { TextValueCombo } from "./case/combo/combo.textvalue"; import { TextValueCombo } from "./case/combo/combo.textvalue";
import { TextValueComboPopup } from "./case/combo/popup.textvalue";
import { SmallTextValueCombo } from "./case/combo/combo.textvaluesmall"; import { SmallTextValueCombo } from "./case/combo/combo.textvaluesmall";
import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue"; import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue";
import { SignEditor } from "./case/editor/editor.sign"; import { SignEditor } from "./case/editor/editor.sign";
@ -226,6 +227,7 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
ButtonGroup: typeof ButtonGroup; ButtonGroup: typeof ButtonGroup;
Combo: typeof Combo; Combo: typeof Combo;
TextValueCombo: typeof TextValueCombo; TextValueCombo: typeof TextValueCombo;
TextValueComboPopup: typeof TextValueComboPopup;
SmallTextValueCombo: typeof SmallTextValueCombo; SmallTextValueCombo: typeof SmallTextValueCombo;
BubbleCombo: typeof BubbleCombo; BubbleCombo: typeof BubbleCombo;
AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo; AllValueMultiTextValueCombo: typeof AllValueMultiTextValueCombo;
@ -464,6 +466,7 @@ export {
MultiSelectBar, MultiSelectBar,
SelectList, SelectList,
TextValueCombo, TextValueCombo,
TextValueComboPopup,
SmallTextValueCombo, SmallTextValueCombo,
Editor, Editor,
IconLabel, IconLabel,

Loading…
Cancel
Save