diff --git a/src/case/calendar/calendar.year.js b/src/case/calendar/calendar.year.js index 2d9d968417..7de7811594 100644 --- a/src/case/calendar/calendar.year.js +++ b/src/case/calendar/calendar.year.js @@ -51,7 +51,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, { columns: 2, rows: 6, columnSize: [1 / 2, 1 / 2], - rowSize: 24 + rowSize: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, })), { type: "bi.center_adapt", vgap: 1 @@ -110,7 +110,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, { whiteSpace: "normal", once: false, forceSelected: true, - height: 24, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: 45, value: td.text, disabled: td.disabled diff --git a/src/case/combo/iconcombo/popup.iconcombo.js b/src/case/combo/iconcombo/popup.iconcombo.js index 3cc4fcd32f..0c6067bac0 100644 --- a/src/case/combo/iconcombo/popup.iconcombo.js +++ b/src/case/combo/iconcombo/popup.iconcombo.js @@ -19,7 +19,7 @@ BI.IconComboPopup = BI.inherit(BI.Pane, { type: "bi.button_group", items: BI.createItems(o.items, { type: "bi.single_select_icon_text_item", - height: 24 + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }), chooseType: o.chooseType, layouts: [{ @@ -47,7 +47,7 @@ BI.IconComboPopup = BI.inherit(BI.Pane, { BI.IconComboPopup.superclass.populate.apply(this, arguments); items = BI.createItems(items, { type: "bi.single_select_icon_text_item", - height: 24 + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); this.popup.populate(items); }, diff --git a/src/case/combo/icontextvaluecombo/popup.icontextvalue.js b/src/case/combo/icontextvaluecombo/popup.icontextvalue.js index 424b0dd806..993bceb456 100644 --- a/src/case/combo/icontextvaluecombo/popup.icontextvalue.js +++ b/src/case/combo/icontextvaluecombo/popup.icontextvalue.js @@ -20,7 +20,7 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, { type: "bi.button_group", items: BI.createItems(o.items, { type: "bi.single_select_icon_text_item", - height: 24, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, iconHeight: o.iconHeight, iconWidth: o.iconWidth, iconWrapperWidth: o.iconWrapperWidth @@ -55,10 +55,10 @@ BI.IconTextValueComboPopup = BI.inherit(BI.Pane, { var o = this.options; items = BI.createItems(items, { type: "bi.single_select_icon_text_item", - height: 24, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, iconWrapperWidth: o.iconWrapperWidth, iconHeight: o.iconHeight, - iconWidth: o.iconWidth + iconWidth: o.iconWidth, }); this.popup.populate(items, keyword); }, diff --git a/src/case/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js index cf68deefa9..5b3c0a8ee1 100644 --- a/src/case/combo/textvaluecombo/popup.textvalue.js +++ b/src/case/combo/textvaluecombo/popup.textvalue.js @@ -14,7 +14,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { items: BI.createItems(o.items, { type: "bi.single_select_item", textAlign: o.textAlign, - height: 24 + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }), chooseType: o.chooseType, layouts: [{ @@ -43,7 +43,7 @@ BI.TextValueComboPopup = BI.inherit(BI.Pane, { BI.TextValueComboPopup.superclass.populate.apply(this, arguments); items = BI.createItems(items, { type: "bi.single_select_item", - height: 24 + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); this.popup.populate(items); }, diff --git a/src/case/layer/layer.multipopup.js b/src/case/layer/layer.multipopup.js index ec937a172c..3979c69271 100644 --- a/src/case/layer/layer.multipopup.js +++ b/src/case/layer/layer.multipopup.js @@ -31,7 +31,7 @@ BI.MultiPopupView = BI.inherit(BI.PopupView, { this.buttongroup = BI.createWidget({ type: "bi.button_group", cls: "list-view-toolbar bi-high-light bi-split-top", - height: 24, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, items: BI.createItems(text, { type: "bi.text_button", once: false, diff --git a/src/core/platform/web/size.js b/src/core/platform/web/size.js new file mode 100644 index 0000000000..053c05c8e2 --- /dev/null +++ b/src/core/platform/web/size.js @@ -0,0 +1,49 @@ +/** + * @author windy + * @version 2.0 + * Created by windy on 2021/6/30 + */ +_.extend(BI, { + VIEW_SIZE: { + SMALL: 1, + NORMAL: 2, + BIG: 3, + CUSTOM: 4, + }, +}); +BI.Func = BI.Func || {}; +_.extend(BI.Func, { + + /** + * 默认提供三种尺寸类型,small, normal, big + * 也可以在此基础上适用类型custom定制尺寸 + * @param opt + */ + switchWidgetSizeConfig: function(opt) { + switch (opt.type) { + case BI.VIEW_SIZE.BIG: + opt.TOOL_BAR_HEIGHT = 30; + opt.LIST_ITEM_HEIGHT = 30; + opt.TRIGGER_HEIGHT = 30; + break; + case BI.VIEW_SIZE.SMALL: + case BI.VIEW_SIZE.NORMAL: + default: + break; + } + + BI.config('bi.constant.widget.size', function (ob) { + return BI.extend(ob, opt); + }); + }, +}); + +BI.constant('bi.constant.widget.size', { + TOOL_BAR_HEIGHT: 24, + LIST_ITEM_HEIGHT: 24, + TRIGGER_HEIGHT: 24, +}); + +BI.prepares.push(function () { + BI.SIZE_CONSANTS = BI.Constants.getConstant('bi.constant.widget.size'); +}); diff --git a/src/widget/downlist/item.downlist.js b/src/widget/downlist/item.downlist.js index f05fa2e5d0..068c94fabe 100644 --- a/src/widget/downlist/item.downlist.js +++ b/src/widget/downlist/item.downlist.js @@ -4,7 +4,7 @@ BI.DownListItem = BI.inherit(BI.BasicButton, { return BI.extend(conf, { baseCls: "bi-down-list-item bi-list-item-active", cls: "", - height: 24, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, logic: { dynamic: true }, diff --git a/src/widget/downlist/popup.downlist.js b/src/widget/downlist/popup.downlist.js index fbf2c2492a..b9ebed40e7 100644 --- a/src/widget/downlist/popup.downlist.js +++ b/src/widget/downlist/popup.downlist.js @@ -98,7 +98,7 @@ BI.DownListPopup = BI.inherit(BI.Pane, { item.el.logic = { dynamic: true }; - item.el.height = item.el.height || self.constants.height; + item.el.height = item.el.height || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT; item.el.iconCls2 = self.constants.nextIcon; item.popup = { lgap: 1, diff --git a/src/widget/dynamicdate/dynamicdate.param.item.js b/src/widget/dynamicdate/dynamicdate.param.item.js index 1db32d44c9..c8771e9080 100644 --- a/src/widget/dynamicdate/dynamicdate.param.item.js +++ b/src/widget/dynamicdate/dynamicdate.param.item.js @@ -1,14 +1,16 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, { - props: { - baseCls: "bi-dynamic-date-param-item", - dateType: BI.DynamicDateCard.TYPE.YEAR, - validationChecker: function() { - return true; - }, - value: 0, - offset: 0, - height: 24 + props: function() { + return { + baseCls: "bi-dynamic-date-param-item", + dateType: BI.DynamicDateCard.TYPE.YEAR, + validationChecker: function() { + return true; + }, + value: 0, + offset: 0, + height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, + } }, render: function () { @@ -19,7 +21,7 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, { el: { type: "bi.sign_editor", cls: "bi-border", - height: 22, + height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2, validationChecker: function (v) { return BI.isNaturalNumber(v); }, @@ -47,13 +49,13 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, { }, { el: { type: "bi.label", - height: 24, + height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, text: this._getText() }, width: o.dateType === BI.DynamicDateCard.TYPE.WORK_DAY ? 60 : 20 }, { type: "bi.text_value_combo", - height: 24, + height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, items: [{ text: BI.i18nText("BI-Basic_Front"), value: 0 diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index b57185335e..339e02af0b 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -10,7 +10,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { baseCls: "bi-multi-select-combo", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - itemHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: 24, allowEdit: true }); diff --git a/src/widget/multiselect/multiselect.combo.nobar.js b/src/widget/multiselect/multiselect.combo.nobar.js index 6203175e4a..70c6b5db22 100644 --- a/src/widget/multiselect/multiselect.combo.nobar.js +++ b/src/widget/multiselect/multiselect.combo.nobar.js @@ -10,7 +10,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, { baseCls: "bi-multi-select-combo-no-bar", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - itemHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: 24, }); }, diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index db225e95f0..9c3b979095 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -11,7 +11,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, height: 24, - itemHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, allowEdit: true }); }, diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 2fb735ba61..0bd836397e 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -10,7 +10,7 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { baseCls: "bi-multi-select-insert-combo-no-bar", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - itemsHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: 24, }); }, diff --git a/src/widget/multiselect/multiselect.loader.js b/src/widget/multiselect/multiselect.loader.js index fdfb2d1aa7..4996f12daa 100644 --- a/src/widget/multiselect/multiselect.loader.js +++ b/src/widget/multiselect/multiselect.loader.js @@ -18,7 +18,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, onLoaded: BI.emptyFn, - itemHeight: 24 + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); }, @@ -126,7 +126,7 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { type: "bi.multi_select_item", logic: this.options.logic, cls: "bi-list-item-active", - height: this.options.itemHeight, + height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, selected: this.isAllSelected(), iconWrapperWidth: 36 }); diff --git a/src/widget/multiselect/multiselect.loader.nobar.js b/src/widget/multiselect/multiselect.loader.nobar.js index 8f469e62e4..d7744d042f 100644 --- a/src/widget/multiselect/multiselect.loader.nobar.js +++ b/src/widget/multiselect/multiselect.loader.nobar.js @@ -17,7 +17,7 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, { }, valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, - itemHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, onLoaded: BI.emptyFn }); }, @@ -117,7 +117,7 @@ BI.MultiSelectNoBarLoader = BI.inherit(BI.Widget, { type: "bi.multi_select_item", cls: "bi-list-item-active", logic: this.options.logic, - height: this.options.itemHeight, + height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, iconWrapperWidth: 36 }); }, diff --git a/src/widget/multiselect/multiselect.popup.view.js b/src/widget/multiselect/multiselect.popup.view.js index 1343eb2f09..9c6bac7f0f 100644 --- a/src/widget/multiselect/multiselect.popup.view.js +++ b/src/widget/multiselect/multiselect.popup.view.js @@ -14,7 +14,7 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, onLoaded: BI.emptyFn, - itemHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); }, diff --git a/src/widget/multiselect/multiselect.popup.view.nobar.js b/src/widget/multiselect/multiselect.popup.view.nobar.js index 55428df4f1..f5ba1cebd0 100644 --- a/src/widget/multiselect/multiselect.popup.view.nobar.js +++ b/src/widget/multiselect/multiselect.popup.view.nobar.js @@ -13,7 +13,7 @@ BI.MultiSelectNoBarPopupView = BI.inherit(BI.Widget, { maxHeight: 400, valueFormatter: BI.emptyFn, itemsCreator: BI.emptyFn, - itemHeight: 24, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, onLoaded: BI.emptyFn }); }, diff --git a/src/widget/multiselect/search/multiselect.search.insert.pane.js b/src/widget/multiselect/search/multiselect.search.insert.pane.js index 7513408fe0..d5195979c5 100644 --- a/src/widget/multiselect/search/multiselect.search.insert.pane.js +++ b/src/widget/multiselect/search/multiselect.search.insert.pane.js @@ -30,7 +30,7 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, { this.addNotMatchTip = BI.createWidget({ type: "bi.label", text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""), - height: this.constants.height, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, cls: "bi-high-light", hgap: 5, }); @@ -57,7 +57,7 @@ BI.MultiSelectSearchInsertPane = BI.inherit(BI.Widget, { element: this, items: [{ el: this.addNotMatchTip, - height: this.constants.height, + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }, { el: this.loader, }], diff --git a/src/widget/multiselect/search/multiselect.search.loader.js b/src/widget/multiselect/search/multiselect.search.loader.js index 2ea43383c4..c32bbc0a32 100644 --- a/src/widget/multiselect/search/multiselect.search.loader.js +++ b/src/widget/multiselect/search/multiselect.search.loader.js @@ -92,7 +92,7 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { logic: { dynamic: false }, - height: this.options.itemHeight, + height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, selected: this.isAllSelected(), cls: "bi-list-item-active", iconWrapperWidth: 36 diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js index f4cea55c3d..419e96eb3c 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.js +++ b/src/widget/multiselectlist/multiselectlist.insert.js @@ -7,8 +7,8 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { baseCls: "bi-multi-select-insert-list", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - searcherHeight: 24, - itemHeight: 24 + searcherHeight: BI.SIZE_CONSANTS.TRIGGER_HEIGHT, + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); }, _init: function () { @@ -71,7 +71,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { ref: function (ref) { self.editor = ref; }, - height: o.searcherHeight, + height: o.searcherHeight || BI.SIZE_CONSANTS.TRIGGER_HEIGHT, }, isAutoSearch: false, isAutoSync: false, @@ -164,7 +164,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { element: this, items: [{ el: this.trigger, - height: o.searcherHeight + height: o.searcherHeight || BI.SIZE_CONSANTS.TRIGGER_HEIGHT, }, { el: this.adapter, height: "fill" @@ -175,7 +175,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { element: this, items: [{ el: this.searcherPane, - top: o.searcherHeight, + top: o.searcherHeight || BI.SIZE_CONSANTS.TRIGGER_HEIGHT, bottom: 0, left: 0, right: 0 diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index bbb6c23bbf..9b0e7b21e9 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -7,7 +7,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { baseCls: "bi-multi-select-insert-list", itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, - searcherHeight: 24 + searcherHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); }, _init: function () { diff --git a/src/widget/multiselectlist/multiselectlist.js b/src/widget/multiselectlist/multiselectlist.js index e4a046793b..feea0fb2fd 100644 --- a/src/widget/multiselectlist/multiselectlist.js +++ b/src/widget/multiselectlist/multiselectlist.js @@ -8,7 +8,7 @@ BI.MultiSelectList = BI.inherit(BI.Widget, { itemsCreator: BI.emptyFn, valueFormatter: BI.emptyFn, searcherHeight: 24, - itemHeight: 24 + itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }); }, _init: function () { diff --git a/src/widget/year/card.dynamic.year.js b/src/widget/year/card.dynamic.year.js index 536fc01636..b38d55119e 100644 --- a/src/widget/year/card.dynamic.year.js +++ b/src/widget/year/card.dynamic.year.js @@ -22,7 +22,7 @@ BI.DynamicYearCard = BI.inherit(BI.Widget, { type: "bi.label", text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"), textAlign: "left", - height: 24 + height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, }, { type: "bi.dynamic_date_param_item", ref: function () { diff --git a/src/widget/year/popup.year.js b/src/widget/year/popup.year.js index 0782b43f13..73afd9681d 100644 --- a/src/widget/year/popup.year.js +++ b/src/widget/year/popup.year.js @@ -8,7 +8,6 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { constants: { tabHeight: 30, - buttonHeight: 24 }, props: { @@ -33,7 +32,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { items: [[{ type: "bi.text_button", cls: "bi-split-top bi-high-light", - textHeight: c.buttonHeight - 1, + textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1, shadow: true, text: BI.i18nText("BI-Basic_Clear"), listeners: [{ @@ -44,7 +43,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { }] }, { type: "bi.text_button", - textHeight: c.buttonHeight - 1, + textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1, cls: "bi-split-left bi-split-right bi-high-light bi-split-top", shadow: true, text: BI.i18nText("BI-Basic_Current_Year"), @@ -61,7 +60,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { }, { type: "bi.text_button", cls: "bi-split-top bi-high-light", - textHeight: c.buttonHeight - 1, + textHeight: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 1, shadow: true, text: BI.i18nText("BI-Basic_OK"), listeners: [{ @@ -76,7 +75,7 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, { } }] }]], - height: 24 + height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, }, }] };