From c09ea7d0ee7ff71308c00395266b40234ba4966d Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 10:28:14 +0800 Subject: [PATCH 01/29] =?UTF-8?q?feature:=20combo=E6=98=BE=E9=9A=90?= =?UTF-8?q?=E8=A7=84=E5=88=99=E9=87=8D=E6=9E=84=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/combo.js | 5 +++++ src/core/4.widget.js | 12 ++++++++---- src/less/base/combo/combo.less | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 7abbf77eb..8d2849ad6 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -48,6 +48,11 @@ }); }, + // 复写visual相关代码,让其通过class实现显隐藏 + __setElementVisible: function (visible) { + this.element[visible ? "removeClass" : "addClass"]("bi-combo-hidden"); + }, + render: function () { var self = this, o = this.options; this._initCombo(); diff --git a/src/core/4.widget.js b/src/core/4.widget.js index 5af118dd5..49c1238cc 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -308,7 +308,7 @@ }) : o.invisible; if (invisible) { // 用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 - this.element.css("display", "none"); + this.__setElementVisible(false); } } }, @@ -513,13 +513,17 @@ } }, + __setElementVisible: function (visible) { + this.element.css("display", visible ? "" : "none"); + }, + _innerSetVisible: function (visible) { var self = this, o = this.options; var lastVisible = !o.invisible; this._setVisible(visible); if (visible === true) { // 用this.element.show()会把display属性改成block - this.element.css("display", ""); + this.__setElementVisible(true); this._mount(); if (o.animation && !lastVisible) { this.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active").addClass(o.animation + "-enter"); @@ -552,10 +556,10 @@ } this._animationDuring = setTimeout(function () { self.element.removeClass(o.animation + "-leave").removeClass(o.animation + "-leave-active"); - self.element.css("display", "none"); + self.__setElementVisible(false); }, o.animationDuring); } else { - this.element.css("display", "none"); + this.__setElementVisible(false); } } }, diff --git a/src/less/base/combo/combo.less b/src/less/base/combo/combo.less index 206953d4b..3ebed47bc 100644 --- a/src/less/base/combo/combo.less +++ b/src/less/base/combo/combo.less @@ -12,9 +12,6 @@ } &.bi-combo-popup { - display: block !important; - visibility: visible !important; - & > .bi-trigger { & .bi-trigger-icon-button { & .x-icon { @@ -24,6 +21,9 @@ } } } + &.bi-combo-hidden:not(.bi-combo-popup) { + display: none !important; + } &.bi-combo-popup, &.bi-combo-hover, &:hover { &.bi-border, &.bi-border-bottom { From 2ec1bd2ce6f77181fe3f3febe1cc07a25c96eb8a Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 11:29:10 +0800 Subject: [PATCH 02/29] =?UTF-8?q?bi-combo-popup=E6=8D=A2=E4=B8=80=E7=A7=8D?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/响应式布局.html | 12 ++++++------ src/base/combination/combo.js | 5 ----- src/less/core/utils/common.less | 6 +++--- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/响应式布局.html b/examples/响应式布局.html index b0148d2b4..72a71951f 100644 --- a/examples/响应式布局.html +++ b/examples/响应式布局.html @@ -53,13 +53,13 @@ box-shadow: 0 2px 5px rgb(0 0 0 / 16%), 0 2px 10px rgb(0 0 0 / 12%); } .nav-logo { - background-image: url(https://qn.wangchuan.cc/pullrequest-logo.svg); + background-image: url(http://qn.wangchuan.cc/pullrequest-logo.svg); background-repeat: no-repeat; background-position: 50%; background-size: contain; } .image { - background-image: url(https://qn.wangchuan.cc/hero-graphic.png); + background-image: url(http://qn.wangchuan.cc/hero-graphic.png); background-repeat: no-repeat; background-size: contain; } @@ -79,7 +79,7 @@ border: 1px solid #4aa4e0; } .wave { - background-image: url(https://qn.wangchuan.cc/wave.png); + background-image: url(http://qn.wangchuan.cc/wave.png); background-size: cover; background-repeat: repeat-x; } @@ -205,7 +205,7 @@ maxWidth: "100%", maxHeight: "100%", }, - src: "https://qn.wangchuan.cc/hero-graphic.png", + src: "http://qn.wangchuan.cc/hero-graphic.png", width: "auto", height: "auto", }, @@ -318,7 +318,7 @@ maxWidth: "100%", maxHeight: "100%", }, - src: "https://qn.wangchuan.cc/velocity.png", + src: "http://qn.wangchuan.cc/velocity.png", width: "auto", height: "auto", }, @@ -358,7 +358,7 @@ maxWidth: "100%", maxHeight: "100%", }, - src: "https://qn.wangchuan.cc/secure.png", + src: "http://qn.wangchuan.cc/secure.png", width: "auto", height: "auto", }, diff --git a/src/base/combination/combo.js b/src/base/combination/combo.js index 8d2849ad6..7abbf77eb 100644 --- a/src/base/combination/combo.js +++ b/src/base/combination/combo.js @@ -48,11 +48,6 @@ }); }, - // 复写visual相关代码,让其通过class实现显隐藏 - __setElementVisible: function (visible) { - this.element[visible ? "removeClass" : "addClass"]("bi-combo-hidden"); - }, - render: function () { var self = this, o = this.options; this._initCombo(); diff --git a/src/less/core/utils/common.less b/src/less/core/utils/common.less index 0a0b0e53b..d4b0d3bcd 100644 --- a/src/less/core/utils/common.less +++ b/src/less/core/utils/common.less @@ -570,7 +570,7 @@ // hover-visible的原子化形式 .bi-hover-visible-container { - &:where(:not(&:hover)) .bi-hover-visible-item { + &:where(:not(&:hover)) .bi-hover-visible-item:not(.bi-combo-popup) { display: none; } @@ -591,11 +591,11 @@ // } //} - & .bi-hover-visible-item { + & .bi-hover-visible-item:not(.bi-combo-popup) { visibility: hidden; } - &:hover .bi-hover-visible-item { + &:hover .bi-hover-visible-item:not(.bi-combo-popup) { visibility: visible; } } From 67c70cf144480c6727c050d514c35133c73383ab Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 11:30:24 +0800 Subject: [PATCH 03/29] update --- src/less/base/combo/combo.less | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/less/base/combo/combo.less b/src/less/base/combo/combo.less index 3ebed47bc..b6e9d2e00 100644 --- a/src/less/base/combo/combo.less +++ b/src/less/base/combo/combo.less @@ -21,9 +21,6 @@ } } } - &.bi-combo-hidden:not(.bi-combo-popup) { - display: none !important; - } &.bi-combo-popup, &.bi-combo-hover, &:hover { &.bi-border, &.bi-border-bottom { From e7a5e07081010eaa797d200ca5d9f98214a0a555 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 11:34:37 +0800 Subject: [PATCH 04/29] update --- src/less/core/wrapper/inline.less | 6 ------ src/less/core/wrapper/inline.old.less | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/src/less/core/wrapper/inline.less b/src/less/core/wrapper/inline.less index f87f98c8a..804586e81 100644 --- a/src/less/core/wrapper/inline.less +++ b/src/less/core/wrapper/inline.less @@ -15,10 +15,4 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } diff --git a/src/less/core/wrapper/inline.old.less b/src/less/core/wrapper/inline.old.less index 6d6b1b4a5..8c9ef9584 100644 --- a/src/less/core/wrapper/inline.old.less +++ b/src/less/core/wrapper/inline.old.less @@ -14,12 +14,6 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } .bi-inline-horizontal-adapt-layout { @@ -38,12 +32,6 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } .bi-inline-vertical-adapt-layout { @@ -62,10 +50,4 @@ display: inline-block !important; } } - - & > .bi-combo { - &.bi-combo-popup { - display: inline-block !important; - } - } } From f8eb30a4c95536d7205d1e8a42bf21a12324bd12 Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 13:55:52 +0800 Subject: [PATCH 05/29] =?UTF-8?q?=E6=97=A0JRIA=20fix:=20destoryed=E5=89=8D?= =?UTF-8?q?=E9=87=8A=E6=94=BEResizeDetector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/list/listview.js | 3 ++- src/base/list/virtualgrouplist.js | 5 +++++ src/base/list/virtuallist.js | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/base/list/listview.js b/src/base/list/listview.js index 7028132bc..9939adfbb 100644 --- a/src/base/list/listview.js +++ b/src/base/list/listview.js @@ -128,7 +128,8 @@ BI.ListView = BI.inherit(BI.Widget, { this._populate(items); }, - destroyed: function () { + beforeDestroy: function () { + BI.ResizeDetector.removeResizeListener(this); this.restore(); }, }); diff --git a/src/base/list/virtualgrouplist.js b/src/base/list/virtualgrouplist.js index 34b11e800..d32dc3a58 100644 --- a/src/base/list/virtualgrouplist.js +++ b/src/base/list/virtualgrouplist.js @@ -181,6 +181,11 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, { populate: function (items) { this._populate(items); }, + + beforeDestroy: function () { + BI.ResizeDetector.removeResizeListener(this); + this.restore(); + } }); BI.shortcut("bi.virtual_group_list", BI.VirtualGroupList); diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js index 2715008cb..3c110b637 100644 --- a/src/base/list/virtuallist.js +++ b/src/base/list/virtuallist.js @@ -201,10 +201,10 @@ BI.VirtualList = BI.inherit(BI.Widget, { this._populate(items); }, - destroyed: function () { - this.cache = {}; - this.renderedIndex = -1; - }, + beforeDestroy: function () { + BI.ResizeDetector.removeResizeListener(this); + this.restore(); + } }); BI.shortcut("bi.virtual_list", BI.VirtualList); From 1d53158358c65d3dc8478c9a99173709a392b7bc Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 14:16:00 +0800 Subject: [PATCH 06/29] =?UTF-8?q?KERNEL-13119=20chore:=20BI.ResizeDetector?= =?UTF-8?q?=20=E7=BB=9F=E4=B8=80=E9=87=87=E7=94=A8ResizeObserver=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/detectElementResize.js | 675 +++++++++++++++---- 1 file changed, 544 insertions(+), 131 deletions(-) diff --git a/src/core/platform/web/detectElementResize.js b/src/core/platform/web/detectElementResize.js index 7137bb50c..357e938a7 100644 --- a/src/core/platform/web/detectElementResize.js +++ b/src/core/platform/web/detectElementResize.js @@ -1,120 +1,557 @@ /** * Detect Element Resize. - * Forked in order to guard against unsafe 'window' and 'document' references. - * - * https://github.com/sdecima/javascript-detect-element-resize - * Sebastian Decima - * - * version: 0.5.3 + * A minimal library which polyfills the ResizeObserver API and is entirely based on the latest Draft Specification. + * https://github.com/juggle/resize-observer + * version: 3.4.0 **/ -!(function () { - var attachEvent = _global.document && _global.document.attachEvent, - stylesCreated = false; - - if (_global.document && !attachEvent) { - var requestFrame = (function () { - var raf = _global.requestAnimationFrame || _global.mozRequestAnimationFrame || _global.webkitRequestAnimationFrame || - function (fn) { return _global.setTimeout(fn, 20); }; - return function (fn) { return raf(fn); }; - })(); - - var cancelFrame = (function () { - var cancel = _global.cancelAnimationFrame || _global.mozCancelAnimationFrame || _global.webkitCancelAnimationFrame || - _global.clearTimeout; - return function (id) { return cancel(id); }; - })(); - - var resetTriggers = function (element) { - var triggers = element.__resizeTriggers__, - expand = triggers.firstElementChild, - contract = triggers.lastElementChild, - expandChild = expand.firstElementChild; - contract.scrollLeft = contract.scrollWidth; - contract.scrollTop = contract.scrollHeight; - expandChild.style.width = expand.offsetWidth + 1 + "px"; - expandChild.style.height = expand.offsetHeight + 1 + "px"; - expand.scrollLeft = expand.scrollWidth; - expand.scrollTop = expand.scrollHeight; - }; - - var checkTriggers = function (element) { - return element.offsetWidth !== element.__resizeLast__.width || - element.offsetHeight !== element.__resizeLast__.height; - }; - - var scrollListener = function (e) { - var element = this; - resetTriggers(this); - if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__); - this.__resizeRAF__ = requestFrame(function () { - if (checkTriggers(element)) { - element.__resizeLast__.width = element.offsetWidth; - element.__resizeLast__.height = element.offsetHeight; - element.__resizeListeners__.forEach(function (fn) { - fn.call(element, e); - }); - } +var ResizeObserverPolyfill = (function (exports) { + 'use strict'; + + var resizeObservers = []; + + var hasActiveObservations = function () { + return resizeObservers.some(function (ro) { + return ro.activeTargets.length > 0; + }); + }; + + var hasSkippedObservations = function () { + return resizeObservers.some(function (ro) { + return ro.skippedTargets.length > 0; + }); + }; + + var msg = 'ResizeObserver loop completed with undelivered notifications.'; + var deliverResizeLoopError = function () { + var event; + if (typeof ErrorEvent === 'function') { + event = new ErrorEvent('error', { + message: msg }); + } else { + event = document.createEvent('Event'); + event.initEvent('error', false, false); + event.message = msg; + } + window.dispatchEvent(event); + }; + + var ResizeObserverBoxOptions; + (function (ResizeObserverBoxOptions) { + ResizeObserverBoxOptions["BORDER_BOX"] = "border-box"; + ResizeObserverBoxOptions["CONTENT_BOX"] = "content-box"; + ResizeObserverBoxOptions["DEVICE_PIXEL_CONTENT_BOX"] = "device-pixel-content-box"; + })(ResizeObserverBoxOptions || (ResizeObserverBoxOptions = {})); + + var freeze = function (obj) { + return Object.freeze(obj); + }; + + var ResizeObserverSize = (function () { + function ResizeObserverSize(inlineSize, blockSize) { + this.inlineSize = inlineSize; + this.blockSize = blockSize; + freeze(this); + } + + return ResizeObserverSize; + }()); + + var DOMRectReadOnly = (function () { + function DOMRectReadOnly(x, y, width, height) { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.top = this.y; + this.left = this.x; + this.bottom = this.top + this.height; + this.right = this.left + this.width; + return freeze(this); + } + + DOMRectReadOnly.prototype.toJSON = function () { + var _a = this, x = _a.x, y = _a.y, top = _a.top, right = _a.right, bottom = _a.bottom, left = _a.left, + width = _a.width, height = _a.height; + return { x: x, y: y, top: top, right: right, bottom: bottom, left: left, width: width, height: height }; }; + DOMRectReadOnly.fromRect = function (rectangle) { + return new DOMRectReadOnly(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + }; + return DOMRectReadOnly; + }()); - /* Detect CSS Animations support to detect element display/re-attach */ - var animation = false, - animationstring = "animation", - keyframeprefix = "", - animationstartevent = "animationstart", - domPrefixes = "Webkit Moz O ms".split(" "), - startEvents = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), - pfx = ""; - { - var elm = document.createElement("fakeelement"); - if (elm.style.animationName !== undefined) { - animation = true; - } - - if (animation === false) { - for (var i = 0; i < domPrefixes.length; i++) { - if (elm.style[domPrefixes[i] + "AnimationName"] !== undefined) { - pfx = domPrefixes[i]; - animationstring = pfx + "Animation"; - keyframeprefix = "-" + pfx.toLowerCase() + "-"; - animationstartevent = startEvents[i]; - animation = true; - break; - } + var isSVG = function (target) { + return target instanceof SVGElement && 'getBBox' in target; + }; + var isHidden = function (target) { + if (isSVG(target)) { + var _a = target.getBBox(), width = _a.width, height = _a.height; + return !width && !height; + } + var _b = target, offsetWidth = _b.offsetWidth, offsetHeight = _b.offsetHeight; + return !(offsetWidth || offsetHeight || target.getClientRects().length); + }; + var isElement = function (obj) { + var _a; + if (obj instanceof Element) { + return true; + } + var scope = (_a = obj === null || obj === void 0 ? void 0 : obj.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView; + return !!(scope && obj instanceof scope.Element); + }; + var isReplacedElement = function (target) { + switch (target.tagName) { + case 'INPUT': + if (target.type !== 'image') { + break; } + case 'VIDEO': + case 'AUDIO': + case 'EMBED': + case 'OBJECT': + case 'CANVAS': + case 'IFRAME': + case 'IMG': + return true; + } + return false; + }; + + var global = typeof window !== 'undefined' ? window : {}; + + var cache = new WeakMap(); + var scrollRegexp = /auto|scroll/; + var verticalRegexp = /^tb|vertical/; + var IE = (/msie|trident/i).test(global.navigator && global.navigator.userAgent); + var parseDimension = function (pixel) { + return parseFloat(pixel || '0'); + }; + var size = function (inlineSize, blockSize, switchSizes) { + if (inlineSize === void 0) { + inlineSize = 0; + } + if (blockSize === void 0) { + blockSize = 0; + } + if (switchSizes === void 0) { + switchSizes = false; + } + return new ResizeObserverSize((switchSizes ? blockSize : inlineSize) || 0, (switchSizes ? inlineSize : blockSize) || 0); + }; + var zeroBoxes = freeze({ + devicePixelContentBoxSize: size(), + borderBoxSize: size(), + contentBoxSize: size(), + contentRect: new DOMRectReadOnly(0, 0, 0, 0) + }); + var calculateBoxSizes = function (target, forceRecalculation) { + if (forceRecalculation === void 0) { + forceRecalculation = false; + } + if (cache.has(target) && !forceRecalculation) { + return cache.get(target); + } + if (isHidden(target)) { + cache.set(target, zeroBoxes); + return zeroBoxes; + } + var cs = getComputedStyle(target); + var svg = isSVG(target) && target.ownerSVGElement && target.getBBox(); + var removePadding = !IE && cs.boxSizing === 'border-box'; + var switchSizes = verticalRegexp.test(cs.writingMode || ''); + var canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ''); + var canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ''); + var paddingTop = svg ? 0 : parseDimension(cs.paddingTop); + var paddingRight = svg ? 0 : parseDimension(cs.paddingRight); + var paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom); + var paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft); + var borderTop = svg ? 0 : parseDimension(cs.borderTopWidth); + var borderRight = svg ? 0 : parseDimension(cs.borderRightWidth); + var borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth); + var borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth); + var horizontalPadding = paddingLeft + paddingRight; + var verticalPadding = paddingTop + paddingBottom; + var horizontalBorderArea = borderLeft + borderRight; + var verticalBorderArea = borderTop + borderBottom; + var horizontalScrollbarThickness = !canScrollHorizontally ? 0 : target.offsetHeight - verticalBorderArea - target.clientHeight; + var verticalScrollbarThickness = !canScrollVertically ? 0 : target.offsetWidth - horizontalBorderArea - target.clientWidth; + var widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0; + var heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0; + var contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness; + var contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness; + var borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea; + var borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea; + var boxes = freeze({ + devicePixelContentBoxSize: size(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes), + borderBoxSize: size(borderBoxWidth, borderBoxHeight, switchSizes), + contentBoxSize: size(contentWidth, contentHeight, switchSizes), + contentRect: new DOMRectReadOnly(paddingLeft, paddingTop, contentWidth, contentHeight) + }); + cache.set(target, boxes); + return boxes; + }; + var calculateBoxSize = function (target, observedBox, forceRecalculation) { + var _a = calculateBoxSizes(target, forceRecalculation), borderBoxSize = _a.borderBoxSize, + contentBoxSize = _a.contentBoxSize, devicePixelContentBoxSize = _a.devicePixelContentBoxSize; + switch (observedBox) { + case ResizeObserverBoxOptions.DEVICE_PIXEL_CONTENT_BOX: + return devicePixelContentBoxSize; + case ResizeObserverBoxOptions.BORDER_BOX: + return borderBoxSize; + default: + return contentBoxSize; + } + }; + + var ResizeObserverEntry = (function () { + function ResizeObserverEntry(target) { + var boxes = calculateBoxSizes(target); + this.target = target; + this.contentRect = boxes.contentRect; + this.borderBoxSize = freeze([boxes.borderBoxSize]); + this.contentBoxSize = freeze([boxes.contentBoxSize]); + this.devicePixelContentBoxSize = freeze([boxes.devicePixelContentBoxSize]); + } + + return ResizeObserverEntry; + }()); + + var calculateDepthForNode = function (node) { + if (isHidden(node)) { + return Infinity; + } + var depth = 0; + var parent = node.parentNode; + while (parent) { + depth += 1; + parent = parent.parentNode; + } + return depth; + }; + + var broadcastActiveObservations = function () { + var shallowestDepth = Infinity; + var callbacks = []; + resizeObservers.forEach(function processObserver(ro) { + if (ro.activeTargets.length === 0) { + return; } + var entries = []; + ro.activeTargets.forEach(function processTarget(ot) { + var entry = new ResizeObserverEntry(ot.target); + var targetDepth = calculateDepthForNode(ot.target); + entries.push(entry); + ot.lastReportedSize = calculateBoxSize(ot.target, ot.observedBox); + if (targetDepth < shallowestDepth) { + shallowestDepth = targetDepth; + } + }); + callbacks.push(function resizeObserverCallback() { + ro.callback.call(ro.observer, entries, ro.observer); + }); + ro.activeTargets.splice(0, ro.activeTargets.length); + }); + for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { + var callback = callbacks_1[_i]; + callback(); + } + return shallowestDepth; + }; + + var gatherActiveObservationsAtDepth = function (depth) { + resizeObservers.forEach(function processObserver(ro) { + ro.activeTargets.splice(0, ro.activeTargets.length); + ro.skippedTargets.splice(0, ro.skippedTargets.length); + ro.observationTargets.forEach(function processTarget(ot) { + if (ot.isActive()) { + if (calculateDepthForNode(ot.target) > depth) { + ro.activeTargets.push(ot); + } else { + ro.skippedTargets.push(ot); + } + } + }); + }); + }; + + var process = function () { + var depth = 0; + gatherActiveObservationsAtDepth(depth); + while (hasActiveObservations()) { + depth = broadcastActiveObservations(); + gatherActiveObservationsAtDepth(depth); + } + if (hasSkippedObservations()) { + deliverResizeLoopError(); + } + return depth > 0; + }; + + var trigger; + var callbacks = []; + var notify = function () { + return callbacks.splice(0).forEach(function (cb) { + return cb(); + }); + }; + var queueMicroTask = function (callback) { + if (!trigger) { + var toggle_1 = 0; + var el_1 = document.createTextNode(''); + var config = { characterData: true }; + new MutationObserver(function () { + return notify(); + }).observe(el_1, config); + trigger = function () { + el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++); + }; + } + callbacks.push(callback); + trigger(); + }; + + var queueResizeObserver = function (cb) { + queueMicroTask(function ResizeObserver() { + requestAnimationFrame(cb); + }); + }; + + var watching = 0; + var isWatching = function () { + return !!watching; + }; + var CATCH_PERIOD = 250; + var observerConfig = { attributes: true, characterData: true, childList: true, subtree: true }; + var events = ['resize', 'load', 'transitionend', 'animationend', 'animationstart', 'animationiteration', 'keyup', 'keydown', 'mouseup', 'mousedown', 'mouseover', 'mouseout', 'blur', 'focus']; + var time = function (timeout) { + if (timeout === void 0) { + timeout = 0; + } + return Date.now() + timeout; + }; + var scheduled = false; + var Scheduler = (function () { + function Scheduler() { + var _this = this; + this.stopped = true; + this.listener = function () { + return _this.schedule(); + }; } - var animationName = "resizeanim"; - var animationKeyframes = "@" + keyframeprefix + "keyframes " + animationName + " { from { opacity: 0; } to { opacity: 0; } } "; - var animationStyle = keyframeprefix + "animation: 1ms " + animationName + "; "; - } + Scheduler.prototype.run = function (timeout) { + var _this = this; + if (timeout === void 0) { + timeout = CATCH_PERIOD; + } + if (scheduled) { + return; + } + scheduled = true; + var until = time(timeout); + queueResizeObserver(function () { + var elementsHaveResized = false; + try { + elementsHaveResized = process(); + } finally { + scheduled = false; + timeout = until - time(); + if (!isWatching()) { + return; + } + if (elementsHaveResized) { + _this.run(1000); + } else if (timeout > 0) { + _this.run(timeout); + } else { + _this.start(); + } + } + }); + }; + Scheduler.prototype.schedule = function () { + this.stop(); + this.run(); + }; + Scheduler.prototype.observe = function () { + var _this = this; + var cb = function () { + return _this.observer && _this.observer.observe(document.body, observerConfig); + }; + document.body ? cb() : global.addEventListener('DOMContentLoaded', cb); + }; + Scheduler.prototype.start = function () { + var _this = this; + if (this.stopped) { + this.stopped = false; + this.observer = new MutationObserver(this.listener); + this.observe(); + events.forEach(function (name) { + return global.addEventListener(name, _this.listener, true); + }); + } + }; + Scheduler.prototype.stop = function () { + var _this = this; + if (!this.stopped) { + this.observer && this.observer.disconnect(); + events.forEach(function (name) { + return global.removeEventListener(name, _this.listener, true); + }); + this.stopped = true; + } + }; + return Scheduler; + }()); + var scheduler = new Scheduler(); + var updateCount = function (n) { + !watching && n > 0 && scheduler.start(); + watching += n; + !watching && scheduler.stop(); + }; - var createStyles = function () { - if (!stylesCreated) { - // opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 - var css = (animationKeyframes ? animationKeyframes : "") + - ".resize-triggers { " + (animationStyle ? animationStyle : "") + "visibility: hidden; opacity: 0; } " + - ".resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }", - head = document.head || document.getElementsByTagName("head")[0], - style = document.createElement("style"); + var skipNotifyOnElement = function (target) { + return !isSVG(target) && !isReplacedElement(target) && getComputedStyle(target).display === 'inline'; + }; + var ResizeObservation = (function () { + function ResizeObservation(target, observedBox) { + this.target = target; + this.observedBox = observedBox || ResizeObserverBoxOptions.CONTENT_BOX; + this.lastReportedSize = { + inlineSize: -1, blockSize: -1 + }; + } - style.type = "text/css"; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } else { - style.appendChild(document.createTextNode(css)); + ResizeObservation.prototype.isActive = function () { + var size = calculateBoxSize(this.target, this.observedBox, true); + if (skipNotifyOnElement(this.target)) { + this.lastReportedSize = size; + } + if (this.lastReportedSize.inlineSize !== size.inlineSize || this.lastReportedSize.blockSize !== size.blockSize) { + return true; } + return false; + }; + return ResizeObservation; + }()); + + var ResizeObserverDetail = (function () { + function ResizeObserverDetail(resizeObserver, callback) { + this.activeTargets = []; + this.skippedTargets = []; + this.observationTargets = []; + this.observer = resizeObserver; + this.callback = callback; + } - head.appendChild(style); - stylesCreated = true; + return ResizeObserverDetail; + }()); + + var observerMap = new WeakMap(); + var getObservationIndex = function (observationTargets, target) { + for (var i = 0; i < observationTargets.length; i += 1) { + if (observationTargets[i].target === target) { + return i; + } } + return -1; }; + var ResizeObserverController = (function () { + function ResizeObserverController() { + } + + ResizeObserverController.connect = function (resizeObserver, callback) { + var detail = new ResizeObserverDetail(resizeObserver, callback); + observerMap.set(resizeObserver, detail); + }; + ResizeObserverController.observe = function (resizeObserver, target, options) { + var detail = observerMap.get(resizeObserver); + var firstObservation = detail.observationTargets.length === 0; + if (getObservationIndex(detail.observationTargets, target) < 0) { + firstObservation && resizeObservers.push(detail); + detail.observationTargets.push(new ResizeObservation(target, options && options.box)); + updateCount(1); + scheduler.schedule(); + } + }; + ResizeObserverController.unobserve = function (resizeObserver, target) { + var detail = observerMap.get(resizeObserver); + var index = getObservationIndex(detail.observationTargets, target); + var lastObservation = detail.observationTargets.length === 1; + if (index >= 0) { + lastObservation && resizeObservers.splice(resizeObservers.indexOf(detail), 1); + detail.observationTargets.splice(index, 1); + updateCount(-1); + } + }; + ResizeObserverController.disconnect = function (resizeObserver) { + var _this = this; + var detail = observerMap.get(resizeObserver); + detail.observationTargets.slice().forEach(function (ot) { + return _this.unobserve(resizeObserver, ot.target); + }); + detail.activeTargets.splice(0, detail.activeTargets.length); + }; + return ResizeObserverController; + }()); + + var ResizeObserver = (function () { + function ResizeObserver(callback) { + if (arguments.length === 0) { + throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present."); + } + if (typeof callback !== 'function') { + throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function."); + } + ResizeObserverController.connect(this, callback); + } + + ResizeObserver.prototype.observe = function (target, options) { + if (arguments.length === 0) { + throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present."); + } + if (!isElement(target)) { + throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element"); + } + ResizeObserverController.observe(this, target, options); + }; + ResizeObserver.prototype.unobserve = function (target) { + if (arguments.length === 0) { + throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present."); + } + if (!isElement(target)) { + throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element"); + } + ResizeObserverController.unobserve(this, target); + }; + ResizeObserver.prototype.disconnect = function () { + ResizeObserverController.disconnect(this); + }; + ResizeObserver.toString = function () { + return 'function ResizeObserver () { [polyfill code] }'; + }; + return ResizeObserver; + }()); + + exports.ResizeObserver = ResizeObserver; + exports.ResizeObserverEntry = ResizeObserverEntry; + exports.ResizeObserverSize = ResizeObserverSize; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); + +var ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill.ResizeObserver; + +!(function () { var addResizeListener = function (element, fn) { - if (window.ResizeObserver) { + if (ResizeObserver) { if (!element.__resizeObserver__) { - var resizeObserver = new window.ResizeObserver(function () { + var resizeObserver = new ResizeObserver(function () { element.__resizeListeners__.forEach(function (listener) { listener(); }); @@ -126,47 +563,24 @@ element.__resizeListeners__ = []; } element.__resizeListeners__.push(fn); - } else if (attachEvent) { - element.attachEvent("onresize", fn); - BI.nextTick(fn); - } else { - if (!element.__resizeTriggers__) { - if (getComputedStyle(element).position === "static") element.style.position = "relative"; - createStyles(); - element.__resizeLast__ = {}; - element.__resizeListeners__ = []; - (element.__resizeTriggers__ = document.createElement("div")).className = "resize-triggers"; - element.__resizeTriggers__.innerHTML = "
" + - "
"; - element.appendChild(element.__resizeTriggers__); - resetTriggers(element); - element.addEventListener("scroll", scrollListener, true); - - /* Listen for a css animation to detect element display/re-attach */ - animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { - if (e.animationName === animationName) {resetTriggers(element);} - }); - } - element.__resizeListeners__.push(fn); } }; var removeResizeListener = function (element, fn) { - if (window.ResizeObserver) { + if (ResizeObserver) { + if (BI.isNull(fn)) { + element.__resizeListeners__ = []; + element.__resizeObserver__ && element.__resizeObserver__.unobserve(element); + element.__resizeObserver__ = null; + return; + } var index = element.__resizeListeners__.indexOf(fn); if (index >= 0) { element.__resizeListeners__.splice(index, 1); if (!element.__resizeListeners__.length) { element.__resizeObserver__ && element.__resizeObserver__.unobserve(element); + element.__resizeObserver__ = null; } } - } else if (attachEvent) { - element.detachEvent("onresize", fn); - } else { - element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); - if (!element.__resizeListeners__.length) { - element.removeEventListener("scroll", scrollListener); - element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); - } } }; @@ -176,8 +590,7 @@ return function () { removeResizeListener(widget.element[0], fn); }; - }, - removeResizeListener: function (widget, fn) { + }, removeResizeListener: function (widget, fn) { removeResizeListener(widget.element[0], fn); } }; From 5dd22609b56e171e9595a40a8f5d89b4fad7c629 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 14:58:53 +0800 Subject: [PATCH 07/29] =?UTF-8?q?feature:=20listeners=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BC=A0=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/5.inject.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/core/5.inject.js b/src/core/5.inject.js index 0554740f7..5e2cb0a72 100644 --- a/src/core/5.inject.js +++ b/src/core/5.inject.js @@ -449,7 +449,7 @@ } else if (item.el && (item.el.type || options.type)) { el = BI.extend({}, options, item.el); } - + if (el) { var elType = (el.type && el.type.xtype) || el.type; runConfigFunction(elType); @@ -471,12 +471,18 @@ var wType = (w.type && w.type.xtype) || w.type; if (wType === elType) { if (BI.Plugin.hasObject(elType)) { - w.listeners = (w.listeners || []).concat([{ - eventName: BI.Events.MOUNT, - action: function () { + if (!w.listeners || BI.isArray(w.listeners)) { + w.listeners = (w.listeners || []).concat([{ + eventName: BI.Events.MOUNT, + action: function () { + BI.Plugin.getObject(elType, this); + } + }]); + } else { + w.listeners[BI.Events.MOUNT] = function () { BI.Plugin.getObject(elType, this); } - }]); + } } return createWidget(w, context, lazy); } From 07dbabbfbff0ad7ffe9aa81ef744d4976893e84e Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 15:17:14 +0800 Subject: [PATCH 08/29] =?UTF-8?q?=E6=97=A0JIRA=20chore:=20=20listeners?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AF=B9=E8=B1=A1,=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E7=9A=84value=E6=94=AF=E6=8C=81array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/3.ob.js | 19 ++++++++++--------- src/core/5.inject.js | 8 +++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/core/3.ob.js b/src/core/3.ob.js index a9019c3a8..f23ebd67b 100644 --- a/src/core/3.ob.js +++ b/src/core/3.ob.js @@ -32,9 +32,7 @@ this._constructor(config); }; BI._.extend(OB.prototype, { - props: {}, - init: null, - destroyed: null, + props: {}, init: null, destroyed: null, _constructor: function (config) { this._initProps(config); @@ -71,6 +69,12 @@ self.on(eventName, lis); return; } + if (BI._.isArray(lis)) { + BI._.each(lis, function (l) { + self.on(eventName, l); + }); + return; + } (lis.target ? lis.target : self)[lis.once ? "once" : "on"](lis.eventName, BI._.bind(lis.action, self)); }); delete this.options.listeners; @@ -139,8 +143,7 @@ this.un(eventName, proxy); }; this.on(eventName, proxy); - }, - /** + }, /** * 解除观察者绑定的指定事件 * @param {String} eventName 要解除绑定事件的名字 * @param {Function} fn 事件对应的执行函数,该参数是可选的,没有该参数时,将解除绑定所有同名字的事件 @@ -163,15 +166,13 @@ this._getEvents()[eventName] = newFns; } } - }, - /** + }, /** * 清除观察者的所有事件绑定 */ purgeListeners: function () { /* alex:清空events*/ this.events = {}; - }, - /** + }, /** * 触发绑定过的事件 * * @param {String} eventName 要触发的事件的名字 diff --git a/src/core/5.inject.js b/src/core/5.inject.js index 5e2cb0a72..f4c28401d 100644 --- a/src/core/5.inject.js +++ b/src/core/5.inject.js @@ -479,9 +479,11 @@ } }]); } else { - w.listeners[BI.Events.MOUNT] = function () { - BI.Plugin.getObject(elType, this); - } + w.listeners[BI.Events.MOUNT] = (w.listeners[BI.Events.MOUNT] || []), concat([ + function () { + BI.Plugin.getObject(elType, this); + } + ]); } } return createWidget(w, context, lazy); From bb20a9207792f69ee5d7a51b8a0c28e2b6df166e Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 15:20:00 +0800 Subject: [PATCH 09/29] =?UTF-8?q?=E6=97=A0JRIA=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/3.ob.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/core/3.ob.js b/src/core/3.ob.js index f23ebd67b..100fcac17 100644 --- a/src/core/3.ob.js +++ b/src/core/3.ob.js @@ -32,7 +32,11 @@ this._constructor(config); }; BI._.extend(OB.prototype, { - props: {}, init: null, destroyed: null, + props: {}, + + init: null, + + destroyed: null, _constructor: function (config) { this._initProps(config); @@ -143,7 +147,9 @@ this.un(eventName, proxy); }; this.on(eventName, proxy); - }, /** + }, + + /** * 解除观察者绑定的指定事件 * @param {String} eventName 要解除绑定事件的名字 * @param {Function} fn 事件对应的执行函数,该参数是可选的,没有该参数时,将解除绑定所有同名字的事件 @@ -166,13 +172,17 @@ this._getEvents()[eventName] = newFns; } } - }, /** + }, + + /** * 清除观察者的所有事件绑定 */ purgeListeners: function () { /* alex:清空events*/ this.events = {}; - }, /** + }, + + /** * 触发绑定过的事件 * * @param {String} eventName 要触发的事件的名字 From 1b69ebb93a1043d5f2db83641a48419b8878ef1c Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 15:25:19 +0800 Subject: [PATCH 10/29] =?UTF-8?q?=E6=97=A0JIRA=20fix=20=E8=AF=AD=E6=B3=95?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/5.inject.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/5.inject.js b/src/core/5.inject.js index f4c28401d..f3d5f8627 100644 --- a/src/core/5.inject.js +++ b/src/core/5.inject.js @@ -479,7 +479,7 @@ } }]); } else { - w.listeners[BI.Events.MOUNT] = (w.listeners[BI.Events.MOUNT] || []), concat([ + w.listeners[BI.Events.MOUNT] = (w.listeners[BI.Events.MOUNT] || []).concat([ function () { BI.Plugin.getObject(elType, this); } From 647c334d6ad720c1e1bab63336b932a9a1199662 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 17 Oct 2022 15:28:29 +0800 Subject: [PATCH 11/29] auto upgrade version to 2.0.20221017152752 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b1083bcdc..7dced93f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221017122609", + "version": "2.0.20221017152752", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 41ada7a50aeb2c1aea2722e2331083eddd7ea53e Mon Sep 17 00:00:00 2001 From: zsmj Date: Mon, 17 Oct 2022 15:55:06 +0800 Subject: [PATCH 12/29] =?UTF-8?q?=E6=97=A0JRIA=20fix:=20w.listeners[BI.Eve?= =?UTF-8?q?nts.MOUNT]=E7=9A=84concat=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/5.inject.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/5.inject.js b/src/core/5.inject.js index f3d5f8627..9602deed9 100644 --- a/src/core/5.inject.js +++ b/src/core/5.inject.js @@ -479,11 +479,11 @@ } }]); } else { - w.listeners[BI.Events.MOUNT] = (w.listeners[BI.Events.MOUNT] || []).concat([ + w.listeners[BI.Events.MOUNT] = [ function () { BI.Plugin.getObject(elType, this); } - ]); + ].concat(w.listeners[BI.Events.MOUNT] || []); } } return createWidget(w, context, lazy); From ce9aee8bd7360f05666f75485af02c771b01bd47 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 17 Oct 2022 16:04:52 +0800 Subject: [PATCH 13/29] auto upgrade version to 2.0.20221017160443 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7dced93f3..014e9dd92 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221017152752", + "version": "2.0.20221017160443", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 2256f3df9e173ff4b8e36181b259092db7635eac Mon Sep 17 00:00:00 2001 From: data Date: Mon, 17 Oct 2022 16:13:51 +0800 Subject: [PATCH 14/29] auto upgrade version to 2.0.20221017161333 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 014e9dd92..3e4476280 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221017160443", + "version": "2.0.20221017161333", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 3de35086633999de76719c6cec836647430e589a Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 17 Oct 2022 22:54:19 +0800 Subject: [PATCH 15/29] =?UTF-8?q?feature:=20=E6=97=A5=E6=9C=9F=E4=B8=8D?= =?UTF-8?q?=E7=94=A8=E6=94=BEprepares=E9=87=8C=E5=8E=BB=E4=BA=86=EF=BC=8Cp?= =?UTF-8?q?repares=E5=8F=AF=E4=BB=A5=E4=B8=8Dinit=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=B9=9F=E4=B8=8D=E5=A4=A7=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _mobile/date.i18n.cn.js | 67 ----------------- src/case/calendar/calendar.js | 2 +- src/core/constant/date.i18n.js | 66 ----------------- src/core/func/alias.js | 2 +- src/core/func/date.js | 73 ++++++++++++++++++- .../yearquarter/card.static.yearquarter.js | 8 +- 6 files changed, 76 insertions(+), 142 deletions(-) delete mode 100644 _mobile/date.i18n.cn.js delete mode 100644 src/core/constant/date.i18n.js diff --git a/_mobile/date.i18n.cn.js b/_mobile/date.i18n.cn.js deleted file mode 100644 index 79e294934..000000000 --- a/_mobile/date.i18n.cn.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Created by astronaut007 on 2018/8/8 - */ -// 牵扯到国际化这些常量在页面加载后再生效 -// full day names -BI.Date = BI.Date || {}; -BI.Date._DN = ["星期日", - "星期一", - "星期二", - "星期三", - "星期四", - "星期五", - "星期六", - "星期日"]; - -// short day names -BI.Date._SDN = ["日", - "一", - "二", - "三", - "四", - "五", - "六", - "日"]; - -// Monday first, etc. -BI.Date._FD = 1; - -// full month namesdat -BI.Date._MN = [ - "一月", - "二月", - "三月", - "四月", - "五月", - "六月", - "七月", - "八月", - "九月", - "十月", - "十一月", - "十二月"]; - -// short month names -BI.Date._SMN = [0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11]; - -BI.Date._QN = ["", "第1季度", - "第2季度", - "第3季度", - "第4季度"]; - -/** Adds the number of days array to the Date object. */ -BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - -// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以 -BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6]; diff --git a/src/case/calendar/calendar.js b/src/case/calendar/calendar.js index f5a99e37d..5c5026d8f 100644 --- a/src/case/calendar/calendar.js +++ b/src/case/calendar/calendar.js @@ -120,7 +120,7 @@ BI.Calendar = BI.inherit(BI.Widget, { _getWeekLabel: function () { return BI.map(BI.range(0, 7), function (idx, v) { - return BI.Date._SDN[(v + BI.StartOfWeek) % 7]; + return BI.getShortDayName((v + BI.StartOfWeek) % 7); }); }, diff --git a/src/core/constant/date.i18n.js b/src/core/constant/date.i18n.js deleted file mode 100644 index 67f8c93d0..000000000 --- a/src/core/constant/date.i18n.js +++ /dev/null @@ -1,66 +0,0 @@ -BI.prepares.push(function () { - BI.Date = BI.Date || {}; - // 牵扯到国际化这些常量在页面加载后再生效 - // full day names - BI.Date._DN = [BI.i18nText("BI-Basic_Sunday"), - BI.i18nText("BI-Basic_Monday"), - BI.i18nText("BI-Basic_Tuesday"), - BI.i18nText("BI-Basic_Wednesday"), - BI.i18nText("BI-Basic_Thursday"), - BI.i18nText("BI-Basic_Friday"), - BI.i18nText("BI-Basic_Saturday"), - BI.i18nText("BI-Basic_Sunday")]; - - // short day names - BI.Date._SDN = [BI.i18nText("BI-Basic_Simple_Sunday"), - BI.i18nText("BI-Basic_Simple_Monday"), - BI.i18nText("BI-Basic_Simple_Tuesday"), - BI.i18nText("BI-Basic_Simple_Wednesday"), - BI.i18nText("BI-Basic_Simple_Thursday"), - BI.i18nText("BI-Basic_Simple_Friday"), - BI.i18nText("BI-Basic_Simple_Saturday"), - BI.i18nText("BI-Basic_Simple_Sunday")]; - - // Monday first, etc. - BI.Date._FD = 1; - - // full month namesdat - BI.Date._MN = [ - BI.i18nText("BI-Basic_January"), - BI.i18nText("BI-Basic_February"), - BI.i18nText("BI-Basic_March"), - BI.i18nText("BI-Basic_April"), - BI.i18nText("BI-Basic_May"), - BI.i18nText("BI-Basic_June"), - BI.i18nText("BI-Basic_July"), - BI.i18nText("BI-Basic_August"), - BI.i18nText("BI-Basic_September"), - BI.i18nText("BI-Basic_October"), - BI.i18nText("BI-Basic_November"), - BI.i18nText("BI-Basic_December")]; - - // short month names - BI.Date._SMN = [0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11]; - - BI.Date._QN = ["", BI.i18nText("BI-Quarter_1"), - BI.i18nText("BI-Quarter_2"), - BI.i18nText("BI-Quarter_3"), - BI.i18nText("BI-Quarter_4")]; - - /** Adds the number of days array to the Date object. */ - BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - - // 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以 - BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6]; -}); \ No newline at end of file diff --git a/src/core/func/alias.js b/src/core/func/alias.js index e30d88c24..0dca26ca6 100644 --- a/src/core/func/alias.js +++ b/src/core/func/alias.js @@ -804,7 +804,7 @@ var str = jfmt.str, len = jfmt.len, ch = jfmt["char"]; switch (ch) { case "E": // 星期 - str = BI.Date._DN[date.getDay()]; + str = BI.getFullDayName(date.getDay()); break; case "y": // 年 if (len <= 3) { diff --git a/src/core/func/date.js b/src/core/func/date.js index 74bf3bea7..d603d235c 100644 --- a/src/core/func/date.js +++ b/src/core/func/date.js @@ -6,6 +6,29 @@ BI.Date.HOUR = 60 * BI.Date.MINUTE; BI.Date.DAY = 24 * BI.Date.HOUR; BI.Date.WEEK = 7 * BI.Date.DAY; +// Monday first, etc. +BI.Date._FD = 1; + +// short month names +BI.Date._SMN = [0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11]; + +/** Adds the number of days array to the Date object. */ +BI.Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + +// 实际上无论周几作为一周的第一天,周初周末都是在-6-0间做偏移,用一个数组就可以 +BI.Date._OFFSET = [0, -1, -2, -3, -4, -5, -6]; + BI._.extend(BI, { /** * 获取时区 @@ -136,6 +159,50 @@ BI._.extend(BI, { return BI.getOffsetDate(date, BI.Date._OFFSET[w < startOfWeek ? (7 + w - startOfWeek) : (w - startOfWeek)] + 6); }, + getFullDayName: function (index) { + return [BI.i18nText("BI-Basic_Sunday"), + BI.i18nText("BI-Basic_Monday"), + BI.i18nText("BI-Basic_Tuesday"), + BI.i18nText("BI-Basic_Wednesday"), + BI.i18nText("BI-Basic_Thursday"), + BI.i18nText("BI-Basic_Friday"), + BI.i18nText("BI-Basic_Saturday"), + BI.i18nText("BI-Basic_Sunday")][index]; + }, + + getShortDayName: function (index) { + return [BI.i18nText("BI-Basic_Simple_Sunday"), + BI.i18nText("BI-Basic_Simple_Monday"), + BI.i18nText("BI-Basic_Simple_Tuesday"), + BI.i18nText("BI-Basic_Simple_Wednesday"), + BI.i18nText("BI-Basic_Simple_Thursday"), + BI.i18nText("BI-Basic_Simple_Friday"), + BI.i18nText("BI-Basic_Simple_Saturday"), + BI.i18nText("BI-Basic_Simple_Sunday")][index]; + }, + + getMonthName: function (index) { + return [BI.i18nText("BI-Basic_January"), + BI.i18nText("BI-Basic_February"), + BI.i18nText("BI-Basic_March"), + BI.i18nText("BI-Basic_April"), + BI.i18nText("BI-Basic_May"), + BI.i18nText("BI-Basic_June"), + BI.i18nText("BI-Basic_July"), + BI.i18nText("BI-Basic_August"), + BI.i18nText("BI-Basic_September"), + BI.i18nText("BI-Basic_October"), + BI.i18nText("BI-Basic_November"), + BI.i18nText("BI-Basic_December")][index] + }, + + getQuarterName: function (index) { + return ["", BI.i18nText("BI-Quarter_1"), + BI.i18nText("BI-Quarter_2"), + BI.i18nText("BI-Quarter_3"), + BI.i18nText("BI-Quarter_4")][index]; + }, + // 格式化打印日期 print: function (date, str) { var m = date.getMonth(); @@ -158,10 +225,10 @@ BI._.extend(BI, { } var min = date.getMinutes(); var sec = date.getSeconds(); - s["%a"] = BI.Date._SDN[w]; // abbreviated weekday name [FIXME: I18N] - s["%A"] = BI.Date._DN[w]; // full weekday name + s["%a"] = BI.getShortDayName(w); // abbreviated weekday name [FIXME: I18N] + s["%A"] = BI.getFullDayName(w); // full weekday name s["%b"] = BI.Date._SMN[m]; // abbreviated month name [FIXME: I18N] - s["%B"] = BI.Date._MN[m]; // full month name + s["%B"] = BI.getMonthName(m); // full month name // FIXME: %c : preferred date and time representation for the current locale s["%C"] = 1 + Math.floor(y / 100); // the century number s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) diff --git a/src/widget/yearquarter/card.static.yearquarter.js b/src/widget/yearquarter/card.static.yearquarter.js index 78cdb518c..cf54c6fcf 100644 --- a/src/widget/yearquarter/card.static.yearquarter.js +++ b/src/widget/yearquarter/card.static.yearquarter.js @@ -8,16 +8,16 @@ BI.StaticYearQuarterCard = BI.inherit(BI.Widget, { _createQuarter: function () { var self = this; var items = [{ - text: BI.Date._QN[1], + text: BI.getQuarterName(1), value: 1 }, { - text: BI.Date._QN[2], + text: BI.getQuarterName(2), value: 2 }, { - text: BI.Date._QN[3], + text: BI.getQuarterName(3), value: 3 }, { - text: BI.Date._QN[4], + text: BI.getQuarterName(4), value: 4 }]; return BI.map(items, function (j, item) { From 52706e9f9fd584f8d51b054b201e483a02111c8f Mon Sep 17 00:00:00 2001 From: data Date: Tue, 18 Oct 2022 09:04:23 +0800 Subject: [PATCH 16/29] auto upgrade version to 2.0.20221018090412 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3e4476280..c7418bc2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221017161333", + "version": "2.0.20221018090412", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 93bc5faecace04b3f72312ae688c2ff42050acef Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 18 Oct 2022 09:34:52 +0800 Subject: [PATCH 17/29] =?UTF-8?q?KERNEL-13123=20feat:=20combo=20trigger?= =?UTF-8?q?=E6=94=AF=E6=8C=81=20hover-click?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/combination/bubble.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/base/combination/bubble.js b/src/base/combination/bubble.js index d3bc2975a..1af43b79c 100644 --- a/src/base/combination/bubble.js +++ b/src/base/combination/bubble.js @@ -12,7 +12,7 @@ attributes: { tabIndex: -1, }, - trigger: "click", // click || hover || click-hover || "" + trigger: "click", // click || hover || click-hover || "hover-click" || "" toggle: true, direction: "", placement: "bottom-start", // top-start/top/top-end/bottom-start/bottom/bottom-end/left-start/left/left-end/right-start/right/right-end @@ -219,6 +219,15 @@ } }); break; + case "hover-click": + self.element.on("mouseenter." + self.getName(), function (e) { + if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { + self._popupView(e); + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); + self.fireEvent(BI.Bubble.EVENT_EXPAND); + } + }); + break; default: break; } From 4f18cc8cfa1a402e30ed4e270078130998362a5f Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 18 Oct 2022 11:00:46 +0800 Subject: [PATCH 18/29] =?UTF-8?q?BI-115516:=20=E7=AC=AC=E4=B8=80=E9=A1=B5?= =?UTF-8?q?=E5=A4=9A=E6=98=BE=E7=A4=BA=E4=B8=80=E4=BA=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/loader.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/widget/multiselect/loader.js b/src/widget/multiselect/loader.js index 47f34a729..7f4a293de 100644 --- a/src/widget/multiselect/loader.js +++ b/src/widget/multiselect/loader.js @@ -167,7 +167,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { }]); return false; } - this.options.items = (items || []).slice(0, 100); + this.options.items = (items || []).slice(0, (items || []).length % 100); this.times = 1; this.count = 0; this.count += items.length; @@ -184,14 +184,15 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { populate: function (items, keyword) { if (this._populate.apply(this, arguments)) { this.cachItems = []; - if (items.length > 100) { - this.cachItems = items.slice(100); + var firstItemsCount = 100 + items.length % 100; + if (items.length > firstItemsCount) { + this.cachItems = items.slice(firstItemsCount); } var renderEngine = BI.Widget._renderEngine; BI.Widget.registerRenderEngine(BI.Element.renderEngine); this.cachGroup.populate.call(this.cachGroup, items, keyword); BI.Widget.registerRenderEngine(renderEngine); - this.button_group.populate.call(this.button_group, items.slice(0, 100), keyword); + this.button_group.populate.call(this.button_group, items.slice(0, firstItemsCount), keyword); } }, From daee5f31b8a51f5cc25ea1edb2895596619681db Mon Sep 17 00:00:00 2001 From: zsmj Date: Tue, 18 Oct 2022 11:24:46 +0800 Subject: [PATCH 19/29] =?UTF-8?q?=E6=97=A0JIRA=20chore:=20=E6=8F=8F?= =?UTF-8?q?=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typescript/core/platform/web/detectElementResize.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typescript/core/platform/web/detectElementResize.ts b/typescript/core/platform/web/detectElementResize.ts index c0ba6e28d..8e1566ce9 100644 --- a/typescript/core/platform/web/detectElementResize.ts +++ b/typescript/core/platform/web/detectElementResize.ts @@ -2,5 +2,5 @@ import { Widget } from "../../../core/widget"; export type _DetectElementResize = { addResizeListener: (widget: Widget, fn: Function) => Function - removeResizeListener: (widget: Widget, fn: Function) => void -} \ No newline at end of file + removeResizeListener: (widget: Widget, fn?: Function) => void +} From 1672bae8a8002e3035c87175dc227d58f8e355ad Mon Sep 17 00:00:00 2001 From: data Date: Tue, 18 Oct 2022 11:25:09 +0800 Subject: [PATCH 20/29] auto upgrade version to 2.0.20221018112352 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c7418bc2c..ce2fee7d6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221018090412", + "version": "2.0.20221018112352", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 4a987bb987938593f5cc126b84f147253570c54b Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 18 Oct 2022 14:04:15 +0800 Subject: [PATCH 21/29] =?UTF-8?q?BI-115516=20check=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E4=B9=9F=E5=A4=84=E7=90=86=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselect/check/multiselect.display.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/widget/multiselect/check/multiselect.display.js b/src/widget/multiselect/check/multiselect.display.js index 337afd59f..b5b4f76e8 100644 --- a/src/widget/multiselect/check/multiselect.display.js +++ b/src/widget/multiselect/check/multiselect.display.js @@ -26,6 +26,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, { var self = this, opts = this.options; this.hasNext = false; + var cacheItems = []; this.button_group = BI.createWidget({ type: "bi.list_pane", @@ -45,10 +46,29 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, { }] }, itemsCreator: function (options, callback) { + if (options.times === 1) { + cacheItems = []; + } + + if (cacheItems.length > 0) { + var renderedItems = cacheItems.slice(0, 100); + cacheItems = cacheItems.slice(100); + self.hasNext = true; + if (cacheItems.length === 0) { + self.hasNext = false; + } + callback(self._createItems(renderedItems)); + return; + } opts.itemsCreator(options, function (ob) { self.hasNext = !!ob.hasNext; - callback(self._createItems(ob.items)); + var firstItemsCount = 100 + ob.items.length % 100; + if (ob.items.length > 100) { + cacheItems = ob.items.slice(100 + ob.items.length % 100); + self.hasNext = true; + } + callback(self._createItems(ob.items.slice(0, firstItemsCount))); }); }, hasNext: function () { From 1d05fc0b0adf761b64683d0ff2ca207ae1596af8 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 18 Oct 2022 16:15:14 +0800 Subject: [PATCH 22/29] auto upgrade version to 2.0.20221018161504 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce2fee7d6..0c16da78e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221018112352", + "version": "2.0.20221018161504", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 0f5397b31e8ba75b2cfc8037bb146251b7c1aa56 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 18 Oct 2022 16:30:48 +0800 Subject: [PATCH 23/29] bugfix --- src/widget/multiselect/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/multiselect/loader.js b/src/widget/multiselect/loader.js index 7f4a293de..c2c2d8de7 100644 --- a/src/widget/multiselect/loader.js +++ b/src/widget/multiselect/loader.js @@ -167,7 +167,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { }]); return false; } - this.options.items = (items || []).slice(0, (items || []).length % 100); + this.options.items = (items || []).slice(0, 100 + (items || []).length % 100); this.times = 1; this.count = 0; this.count += items.length; From 568a930fdabb8dc469e64dfc966125bc3ca5f6fd Mon Sep 17 00:00:00 2001 From: superman Date: Tue, 18 Oct 2022 15:50:14 +0800 Subject: [PATCH 24/29] Merge pull request #200530 in DEC/fineui from master to feature/x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * commit 'b3540cf33517b3b0231b692d0d1085a1d301eb3e': 无JIRA chore: 描述 KERNEL-13123 feat: combo trigger支持 hover-click --- src/base/combination/bubble.js | 11 ++++++++++- typescript/core/platform/web/detectElementResize.ts | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/base/combination/bubble.js b/src/base/combination/bubble.js index d3bc2975a..1af43b79c 100644 --- a/src/base/combination/bubble.js +++ b/src/base/combination/bubble.js @@ -12,7 +12,7 @@ attributes: { tabIndex: -1, }, - trigger: "click", // click || hover || click-hover || "" + trigger: "click", // click || hover || click-hover || "hover-click" || "" toggle: true, direction: "", placement: "bottom-start", // top-start/top/top-end/bottom-start/bottom/bottom-end/left-start/left/left-end/right-start/right/right-end @@ -219,6 +219,15 @@ } }); break; + case "hover-click": + self.element.on("mouseenter." + self.getName(), function (e) { + if (self.isEnabled() && self.isValid() && self.combo.isEnabled() && self.combo.isValid()) { + self._popupView(e); + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EXPAND, "", self.combo); + self.fireEvent(BI.Bubble.EVENT_EXPAND); + } + }); + break; default: break; } diff --git a/typescript/core/platform/web/detectElementResize.ts b/typescript/core/platform/web/detectElementResize.ts index c0ba6e28d..8e1566ce9 100644 --- a/typescript/core/platform/web/detectElementResize.ts +++ b/typescript/core/platform/web/detectElementResize.ts @@ -2,5 +2,5 @@ import { Widget } from "../../../core/widget"; export type _DetectElementResize = { addResizeListener: (widget: Widget, fn: Function) => Function - removeResizeListener: (widget: Widget, fn: Function) => void -} \ No newline at end of file + removeResizeListener: (widget: Widget, fn?: Function) => void +} From 655410e6a1470149b3031296a4e69b1c87d7935a Mon Sep 17 00:00:00 2001 From: superman Date: Tue, 18 Oct 2022 11:05:13 +0800 Subject: [PATCH 25/29] Merge pull request #200297 in DEC/fineui from master to feature/x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * commit '9bdc3080be01ea47ef34b35b6b367aad3430c844': BI-115516: 第一页多显示一些 --- src/widget/multiselect/loader.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/widget/multiselect/loader.js b/src/widget/multiselect/loader.js index 47f34a729..7f4a293de 100644 --- a/src/widget/multiselect/loader.js +++ b/src/widget/multiselect/loader.js @@ -167,7 +167,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { }]); return false; } - this.options.items = (items || []).slice(0, 100); + this.options.items = (items || []).slice(0, (items || []).length % 100); this.times = 1; this.count = 0; this.count += items.length; @@ -184,14 +184,15 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { populate: function (items, keyword) { if (this._populate.apply(this, arguments)) { this.cachItems = []; - if (items.length > 100) { - this.cachItems = items.slice(100); + var firstItemsCount = 100 + items.length % 100; + if (items.length > firstItemsCount) { + this.cachItems = items.slice(firstItemsCount); } var renderEngine = BI.Widget._renderEngine; BI.Widget.registerRenderEngine(BI.Element.renderEngine); this.cachGroup.populate.call(this.cachGroup, items, keyword); BI.Widget.registerRenderEngine(renderEngine); - this.button_group.populate.call(this.button_group, items.slice(0, 100), keyword); + this.button_group.populate.call(this.button_group, items.slice(0, firstItemsCount), keyword); } }, From bfbb8d1d3747b094810dc8382146ce7a4e475760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?guy-=E7=8E=8B=E5=B7=9D?= Date: Tue, 18 Oct 2022 14:05:53 +0800 Subject: [PATCH 26/29] =?UTF-8?q?Pull=20request=20#3135:=20BI-115516=20che?= =?UTF-8?q?ck=E9=9D=A2=E6=9D=BF=E4=B9=9F=E5=A4=84=E7=90=86=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge in VISUAL/fineui from ~GUY/fineui:master to master * commit '5c9b9a34fb2f8bbbe092e53113df6b8e47f98f80': BI-115516 check面板也处理下 --- .../multiselect/check/multiselect.display.js | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/widget/multiselect/check/multiselect.display.js b/src/widget/multiselect/check/multiselect.display.js index 337afd59f..b5b4f76e8 100644 --- a/src/widget/multiselect/check/multiselect.display.js +++ b/src/widget/multiselect/check/multiselect.display.js @@ -26,6 +26,7 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, { var self = this, opts = this.options; this.hasNext = false; + var cacheItems = []; this.button_group = BI.createWidget({ type: "bi.list_pane", @@ -45,10 +46,29 @@ BI.DisplaySelectedList = BI.inherit(BI.Pane, { }] }, itemsCreator: function (options, callback) { + if (options.times === 1) { + cacheItems = []; + } + + if (cacheItems.length > 0) { + var renderedItems = cacheItems.slice(0, 100); + cacheItems = cacheItems.slice(100); + self.hasNext = true; + if (cacheItems.length === 0) { + self.hasNext = false; + } + callback(self._createItems(renderedItems)); + return; + } opts.itemsCreator(options, function (ob) { self.hasNext = !!ob.hasNext; - callback(self._createItems(ob.items)); + var firstItemsCount = 100 + ob.items.length % 100; + if (ob.items.length > 100) { + cacheItems = ob.items.slice(100 + ob.items.length % 100); + self.hasNext = true; + } + callback(self._createItems(ob.items.slice(0, firstItemsCount))); }); }, hasNext: function () { From 7b5878fb6c1efd58dfeeffd013d5d261c718a45c Mon Sep 17 00:00:00 2001 From: windy Date: Tue, 18 Oct 2022 16:43:16 +0800 Subject: [PATCH 27/29] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/multiselect/loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/multiselect/loader.js b/src/widget/multiselect/loader.js index 7f4a293de..c2c2d8de7 100644 --- a/src/widget/multiselect/loader.js +++ b/src/widget/multiselect/loader.js @@ -167,7 +167,7 @@ BI.MultiSelectInnerLoader = BI.inherit(BI.Widget, { }]); return false; } - this.options.items = (items || []).slice(0, (items || []).length % 100); + this.options.items = (items || []).slice(0, 100 + (items || []).length % 100); this.times = 1; this.count = 0; this.count += items.length; From 5ff4f87609cadbdc6dcb92223000043eecf364cc Mon Sep 17 00:00:00 2001 From: data Date: Tue, 18 Oct 2022 16:54:20 +0800 Subject: [PATCH 28/29] auto upgrade version to 2.0.20221018165412 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0c16da78e..61a07e3c4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221018161504", + "version": "2.0.20221018165412", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From 376d18df965ddfc2cf808b4ccd5b15cdcc4426e9 Mon Sep 17 00:00:00 2001 From: data Date: Tue, 18 Oct 2022 17:14:21 +0800 Subject: [PATCH 29/29] auto upgrade version to 2.0.20221018171414 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 61a07e3c4..fa1c5ba6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221018165412", + "version": "2.0.20221018171414", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",