Browse Source

Merge pull request #188732 in DEC/fineui from master to feature/x

* commit '3ab68cd8324047a78d88176938520adbe5f712cf':
  auto upgrade version to 2.0.20221007090556
  resizeObserver
  auto upgrade version to 2.0.20221004143445
  auto upgrade version to 2.0.20221003165530
  feature: 支持type可以直接传函数,没有xtype都行
  无JIRA fix: 动态日期面板border
  auto upgrade version to 2.0.20220928194458
  KERNEL-12982 feat: [组件化] : BI.Popover提供控制能否拖动的能力
  chore: 优化
master
superman 2 years ago
parent
commit
3f72a7d1bd
  1. 2
      package.json
  2. 15
      src/base/layer/layer.popover.js
  3. 5
      src/base/list/virtualgrouplist.js
  4. 14
      src/core/5.inject.js
  5. 29
      src/core/platform/web/detectElementResize.js
  6. 2
      src/widget/dynamicdate/dynamicdate.param.item.js

2
package.json

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

15
src/base/layer/layer.popover.js

@ -158,9 +158,11 @@ BI.Popover = BI.inherit(BI.Widget, {
mounted: function () { mounted: function () {
var self = this; var self = this;
this.dragger.element.mousedown(function (e) { this.dragger.element.mousedown(function (e) {
self.startX = self.element[0].offsetLeft; if (self.options.draggable !== false) {
self.startY = self.element[0].offsetTop; self.startX = self.element[0].offsetLeft;
self.tracker.captureMouseMoves(e); self.startY = self.element[0].offsetTop;
self.tracker.captureMouseMoves(e);
}
}); });
}, },
@ -207,6 +209,10 @@ BI.Popover = BI.inherit(BI.Widget, {
}; };
}, },
setDraggable: function (b) {
this.options.draggable = b;
},
hide: function () { hide: function () {
}, },
@ -224,9 +230,6 @@ BI.Popover = BI.inherit(BI.Widget, {
setZindex: function (zindex) { setZindex: function (zindex) {
this.element.css({ "z-index": zindex }); this.element.css({ "z-index": zindex });
}, },
destroyed: function () {
},
}); });
BI.shortcut("bi.popover", BI.Popover); BI.shortcut("bi.popover", BI.Popover);

5
src/base/list/virtualgrouplist.js

@ -97,12 +97,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) { this.container[self.renderedIndex === -1 ? "populate" : "addItems"](items.map(function (item, i) {
return o.itemFormatter(item, index + i); return o.itemFormatter(item, index + i);
}), this); }), this);
var addedHeight = getElementHeight() - lastHeight; var elementHeight = getElementHeight();
var addedHeight = elementHeight - lastHeight;
this.tree.set(cnt, addedHeight); this.tree.set(cnt, addedHeight);
this.renderedIndex = cnt; this.renderedIndex = cnt;
cnt++; cnt++;
index += o.blockSize; index += o.blockSize;
lastHeight = this.renderedIndex === -1 ? 0 : getElementHeight(); lastHeight = this.renderedIndex === -1 ? 0 : elementHeight;
} }
}, },

14
src/core/5.inject.js

@ -411,7 +411,7 @@
// 根据配置属性生成widget // 根据配置属性生成widget
var createWidget = function (config, context, lazy) { var createWidget = function (config, context, lazy) {
var cls = kv[config.type]; var cls = BI.isFunction(config.type) ? config.type : kv[config.type];
if (!cls) { if (!cls) {
throw new Error("组件: [" + config.type + "] 未定义"); throw new Error("组件: [" + config.type + "] 未定义");
@ -451,7 +451,8 @@
} }
if (el) { if (el) {
runConfigFunction(el.type); var elType = (el.type && el.type.xtype) || el.type;
runConfigFunction(elType);
} }
// 先把准备环境准备好 // 先把准备环境准备好
@ -466,13 +467,14 @@
return item; return item;
} }
if (el) { if (el) {
w = BI.Plugin.getWidget(el.type, el); w = BI.Plugin.getWidget(elType, el);
if (w.type === el.type) { var wType = (w.type && w.type.xtype) || w.type;
if (BI.Plugin.hasObject(el.type)) { if (wType === elType) {
if (BI.Plugin.hasObject(elType)) {
w.listeners = (w.listeners || []).concat([{ w.listeners = (w.listeners || []).concat([{
eventName: BI.Events.MOUNT, eventName: BI.Events.MOUNT,
action: function () { action: function () {
BI.Plugin.getObject(el.type, this); BI.Plugin.getObject(elType, this);
} }
}]); }]);
} }

29
src/core/platform/web/detectElementResize.js

@ -112,7 +112,21 @@
}; };
var addResizeListener = function (element, fn) { var addResizeListener = function (element, fn) {
if (attachEvent) { if (window.ResizeObserver) {
if (!element.__resizeObserver__) {
var resizeObserver = new window.ResizeObserver(function () {
element.__resizeListeners__.forEach(function (listener) {
listener();
});
});
resizeObserver.observe(element);
element.__resizeObserver__ = resizeObserver;
}
if (!element.__resizeListeners__) {
element.__resizeListeners__ = [];
}
element.__resizeListeners__.push(fn);
} else if (attachEvent) {
element.attachEvent("onresize", fn); element.attachEvent("onresize", fn);
BI.nextTick(fn); BI.nextTick(fn);
} else { } else {
@ -137,8 +151,17 @@
} }
}; };
var removeResizeListener = function (element, fn) { var removeResizeListener = function (element, fn) {
if (attachEvent) element.detachEvent("onresize", fn); if (window.ResizeObserver) {
else { var index = element.__resizeListeners__.indexOf(fn);
if (index >= 0) {
element.__resizeListeners__.splice(index, 1);
if (!element.__resizeListeners__.length) {
element.__resizeObserver__ && element.__resizeObserver__.unobserve(element);
}
}
} else if (attachEvent) {
element.detachEvent("onresize", fn);
} else {
element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1);
if (!element.__resizeListeners__.length) { if (!element.__resizeListeners__.length) {
element.removeEventListener("scroll", scrollListener); element.removeEventListener("scroll", scrollListener);

2
src/widget/dynamicdate/dynamicdate.param.item.js

@ -20,7 +20,7 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, {
items: [{ items: [{
el: { el: {
type: "bi.sign_editor", type: "bi.sign_editor",
cls: "bi-border", cls: "bi-border bi-focus-shadow bi-border-radius",
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2, height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT - 2,
validationChecker: function (v) { validationChecker: function (v) {
return BI.isNaturalNumber(v); return BI.isNaturalNumber(v);

Loading…
Cancel
Save