diff --git a/src/case/ztree/asynctree.js b/src/case/ztree/asynctree.js index fd186ae20..9903bfbe5 100644 --- a/src/case/ztree/asynctree.js +++ b/src/case/ztree/asynctree.js @@ -1,6 +1,7 @@ import { cjkEncodeDO, deepClone, each, extend, isEmpty, isNotNull, isNull, shortcut } from "@/core"; import { TreeView } from "./treeview"; import { TreeRenderPageService } from "./treerender.page.service"; +import $ from "jquery"; @shortcut() export class Asynctree extends TreeView { @@ -18,8 +19,8 @@ export class Asynctree extends TreeView { const self = this; this.service = new TreeRenderPageService({ subNodeListGetter(tId) { - // 获取待检测的子节点列表, ztree并没有获取节点列表dom的API, 此处使用BI.$获取 - return BI.$(`#${self.id} #${tId}_ul`); + // 获取待检测的子节点列表, ztree并没有获取节点列表dom的API, 此处使用$获取 + return $(`#${self.id} #${tId}_ul`); }, }); } @@ -34,7 +35,7 @@ export class Asynctree extends TreeView { if (treeNode.disabled) { return false; } - const zTree = BI.$.fn.zTree.getZTreeObj(treeId); + const zTree = $.fn.zTree.getZTreeObj(treeId); // 当前点击节点的状态是半选,且为true_part, 则将其改为false_part,使得点击半选后切换到的是全选 let checked = treeNode.checked; const status = treeNode.getCheckStatus(); @@ -63,7 +64,7 @@ export class Asynctree extends TreeView { track(treeNode.children); - const treeObj = BI.$.fn.zTree.getZTreeObj(treeId); + const treeObj = $.fn.zTree.getZTreeObj(treeId); const nodes = treeObj.getSelectedNodes(); each(nodes, (index, node) => { node.halfCheck = false; diff --git a/src/case/ztree/jquery.ztree.core-3.5.js b/src/case/ztree/jquery.ztree.core-3.5.js index 0e1aedf39..9179120be 100644 --- a/src/case/ztree/jquery.ztree.core-3.5.js +++ b/src/case/ztree/jquery.ztree.core-3.5.js @@ -1,3 +1,5 @@ +import $ from "jquery"; + /* eslint-disable */ /* * JQuery zTree core @@ -2205,4 +2207,4 @@ var zt = $.fn.zTree, $$ = tools.$, consts = zt.consts; -})(BI.jQuery); +})($); diff --git a/src/case/ztree/jquery.ztree.excheck-3.5.js b/src/case/ztree/jquery.ztree.excheck-3.5.js index 685938c55..9efb23a9d 100644 --- a/src/case/ztree/jquery.ztree.excheck-3.5.js +++ b/src/case/ztree/jquery.ztree.excheck-3.5.js @@ -1,3 +1,5 @@ +import $ from "jquery"; + /* eslint-disable */ /* * JQuery zTree excheck v3.5.18 @@ -718,4 +720,4 @@ } return html; }; -})(BI.jQuery); +})($); diff --git a/src/case/ztree/list/listasynctree.js b/src/case/ztree/list/listasynctree.js index 3ace3c8a7..716d6c79e 100644 --- a/src/case/ztree/list/listasynctree.js +++ b/src/case/ztree/list/listasynctree.js @@ -1,5 +1,6 @@ import { Listtreeview } from "./listtreeview"; import { cjkEncodeDO, delay, isEmpty, shortcut, extend } from "@/core"; +import $ from "jquery"; /** * author: windy @@ -23,7 +24,7 @@ export class Listasynctree extends Listtreeview { } function onClick(event, treeId, treeNode) { - const zTree = BI.$.fn.zTree.getZTreeObj(treeId); + const zTree = $.fn.zTree.getZTreeObj(treeId); const checked = treeNode.checked; self._checkValue(treeNode, !checked); zTree.checkNode(treeNode, !checked, true, true); diff --git a/src/case/ztree/list/listparttree.js b/src/case/ztree/list/listparttree.js index 19a97b4c6..640390b5d 100644 --- a/src/case/ztree/list/listparttree.js +++ b/src/case/ztree/list/listparttree.js @@ -1,6 +1,7 @@ import { Listasynctree } from "./listasynctree"; import { shortcut, extend, Events, delay } from "@/core"; import { TreeView } from "../treeview"; +import $ from "jquery"; /** * guy @@ -75,7 +76,7 @@ export class ListPartTree extends Listasynctree { if (self._stop === true) { return; } - self.nodes = BI.$.fn.zTree.init(tree.element, setting, nodes); + self.nodes = $.fn.zTree.init(tree.element, setting, nodes); } delay(() => { diff --git a/src/case/ztree/list/listtreeview.js b/src/case/ztree/list/listtreeview.js index 0d08af8a7..b7ec3aaa7 100644 --- a/src/case/ztree/list/listtreeview.js +++ b/src/case/ztree/list/listtreeview.js @@ -1,5 +1,6 @@ import { TreeView } from "../treeview"; import { extend, isNotNull, concat, each, shortcut } from "@/core"; +import $ from "jquery"; /** * author: windy @@ -36,7 +37,7 @@ export class Listtreeview extends TreeView { const self = this; function onClick(event, treeId, treeNode) { - const zTree = BI.$.fn.zTree.getZTreeObj(treeId); + const zTree = $.fn.zTree.getZTreeObj(treeId); const checked = treeNode.checked; self._checkValue(treeNode, !checked); zTree.checkNode(treeNode, !checked, true, true); diff --git a/src/case/ztree/parttree.js b/src/case/ztree/parttree.js index 069a116f0..b9ccb74f1 100644 --- a/src/case/ztree/parttree.js +++ b/src/case/ztree/parttree.js @@ -1,6 +1,7 @@ import { isEmpty, shortcut, extend, deepClone, each, isNotEmptyArray, Events, delay, isNull } from "@/core"; import { Asynctree } from "./asynctree"; import { TreeView } from "./treeview"; +import $ from "jquery"; /** * guy @@ -165,7 +166,7 @@ export class PartTree extends Asynctree { if (self._stop === true) { return; } - self.nodes = BI.$.fn.zTree.init(tree.element, setting, nodes); + self.nodes = $.fn.zTree.init(tree.element, setting, nodes); } delay(() => { diff --git a/src/case/ztree/tree.display.js b/src/case/ztree/tree.display.js index c32cdd80d..dc996dfe1 100644 --- a/src/case/ztree/tree.display.js +++ b/src/case/ztree/tree.display.js @@ -1,5 +1,6 @@ import { extend, shortcut, each, i18nText } from "@/core"; import { TreeView } from "./treeview"; +import $ from "jquery"; /** * guy @@ -65,6 +66,6 @@ export class DisplayTree extends TreeView { } initTree(nodes, setting) { - this.nodes = BI.$.fn.zTree.init(this.tree.element, setting || this._configSetting(), nodes); + this.nodes = $.fn.zTree.init(this.tree.element, setting || this._configSetting(), nodes); } } diff --git a/src/case/ztree/tree.list.display.js b/src/case/ztree/tree.list.display.js index 3985a92bc..9add974f5 100644 --- a/src/case/ztree/tree.list.display.js +++ b/src/case/ztree/tree.list.display.js @@ -1,5 +1,6 @@ import { Listtreeview } from "./list/listtreeview"; import { each, shortcut, i18nText } from "@/core"; +import $ from "jquery"; /** * guy @@ -70,6 +71,6 @@ export class ListDisplayTree extends Listtreeview { } initTree(nodes, setting) { - this.nodes = BI.$.fn.zTree.init(this.tree.element, setting || this._configSetting(), nodes); + this.nodes = $.fn.zTree.init(this.tree.element, setting || this._configSetting(), nodes); } } diff --git a/src/case/ztree/treeview.js b/src/case/ztree/treeview.js index f48d91bd0..080821f0f 100644 --- a/src/case/ztree/treeview.js +++ b/src/case/ztree/treeview.js @@ -26,6 +26,7 @@ import { STYLE_CONSTANTS } from "@/core"; import { Msg, Pane, LoadingBar, Text } from "@/base"; +import $ from "jquery"; @shortcut() export class TreeView extends Pane { @@ -241,7 +242,7 @@ export class TreeView extends Pane { track(treeNode.children); const treeObj = self.nodes; const nodes = treeObj.getSelectedNodes(); - BI.$.each(nodes, (index, node) => { + $.each(nodes, (index, node) => { node.halfCheck = false; }); } @@ -416,7 +417,7 @@ export class TreeView extends Pane { // // 处理标红 // if (BI.isNotNull(n.text)) { // if (BI.isKey(o.paras.keyword)) { - // n.text = BI.$("
").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); + // n.text = $("
").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html(); // } else { // n.text = BI.htmlEncode(BI.Text.formatText(n.text + "")); // } @@ -466,7 +467,7 @@ export class TreeView extends Pane { if (self._stop === true) { return; } - self.nodes = BI.$.fn.zTree.init(tree.element, setting, nodes); + self.nodes = $.fn.zTree.init(tree.element, setting, nodes); } const op = extend({}, o.paras, { @@ -518,7 +519,7 @@ export class TreeView extends Pane { }, callback: {}, }; - this.nodes = BI.$.fn.zTree.init(this.tree.element, setting || defaultSetting, nodes); + this.nodes = $.fn.zTree.init(this.tree.element, setting || defaultSetting, nodes); } start() { diff --git a/src/core/4.widget.js b/src/core/4.widget.js index 4cd38f284..63e831577 100644 --- a/src/core/4.widget.js +++ b/src/core/4.widget.js @@ -6,6 +6,7 @@ * @cfg {JSON} options 配置属性 */ +import $ from "jquery"; import { isFunction, isArray, @@ -1135,16 +1136,16 @@ Widget.registerRenderEngine({ if (isWidget(widget)) { const o = widget.options; if (o.element) { - return BI.$(o.element); + return $(o.element); } if (o.tagName) { - return BI.$(document.createElement(o.tagName)); + return $(document.createElement(o.tagName)); } - return BI.$(document.createDocumentFragment()); + return $(document.createDocumentFragment()); } - return BI.$(widget); + return $(widget); }, createFragment() { return document.createDocumentFragment(); diff --git a/src/core/conflict.js b/src/core/conflict.js index dba9b8b6f..823b174fb 100644 --- a/src/core/conflict.js +++ b/src/core/conflict.js @@ -1,7 +1,6 @@ - -if (!_global.$ && !_global.jQuery) { - _global.jQuery = _global.$ = BI.jQuery; -} -if (!_global._) { - _global._ = BI._; -} +// if (!_global.$ && !_global.jQuery) { +// _global.jQuery = _global.$ = BI.jQuery; +// } +// if (!_global._) { +// _global._ = BI._; +// } diff --git a/src/core/constant/var.js b/src/core/constant/var.js index 8f3a5f259..a109324c0 100644 --- a/src/core/constant/var.js +++ b/src/core/constant/var.js @@ -142,10 +142,10 @@ export function pixFormat(pix, border) { if (!isNumber(pix)) { return pix; } - if (BI.pixUnit === "px") { - return (pix / BI.pixRatio - (border || 0)) + BI.pixUnit; + if (pixUnit === "px") { + return (pix / pixRatio - (border || 0)) + pixUnit; } - const length = pix / BI.pixRatio + BI.pixUnit; + const length = pix / pixRatio + pixUnit; if (border > 0) { return `calc(${length} - ${`${border}px`})`; } @@ -157,11 +157,11 @@ export function toPix(pix, border) { if (!isNumber(pix)) { return pix; } - if (BI.pixUnit === "px") { - return pix - (border || 0) * BI.pixRatio; + if (pixUnit === "px") { + return pix - (border || 0) * pixRatio; } if (border > 0) { - return `calc(${pix / BI.pixRatio + BI.pixUnit} - ${`${border}px`})`; + return `calc(${pix / pixRatio + pixUnit} - ${`${border}px`})`; } return pix; diff --git a/src/core/controller/controller.resizer.js b/src/core/controller/controller.resizer.js index 802f7f69e..1431904cb 100644 --- a/src/core/controller/controller.resizer.js +++ b/src/core/controller/controller.resizer.js @@ -7,6 +7,7 @@ import { Controller } from "./0.controller"; import { isNull, each, debounce, isNotNull, isFunction } from "../2.base"; import { Widget } from "../4.widget"; import { _global } from "../0.foundation"; +import $ from "jquery"; export class ResizeController extends Controller { init() { @@ -24,7 +25,7 @@ export class ResizeController extends Controller { _resize(ev) { each(this.resizerManger, (key, resizer) => { - if (resizer instanceof BI.$) { + if (resizer instanceof $) { if (resizer.is(":visible")) { resizer.trigger("__resize__"); } diff --git a/src/core/platform/web/detectElementResize.js b/src/core/platform/web/detectElementResize.js index 7be166fd9..3ae28a853 100644 --- a/src/core/platform/web/detectElementResize.js +++ b/src/core/platform/web/detectElementResize.js @@ -1,4 +1,5 @@ import { ResizeObserver as ResizeObserverPolyfill } from "@juggle/resize-observer"; +import $ from "jquery"; const ResizeObserver = window.ResizeObserver || ResizeObserverPolyfill; @@ -7,7 +8,7 @@ function addResizeListener(element, fn) { if (!element.__resizeObserver__) { const resizeObserver = new ResizeObserver((() => { element.__resizeListeners__.forEach(listener => { - BI.$(element).is(":visible") && listener(); + $(element).is(":visible") && listener(); }); })); resizeObserver.observe(element); diff --git a/src/core/platform/web/jquery/_jquery.js b/src/core/platform/web/jquery/_jquery.js index 017d94ecc..52f4c1ef3 100644 --- a/src/core/platform/web/jquery/_jquery.js +++ b/src/core/platform/web/jquery/_jquery.js @@ -1,7 +1,7 @@ -import jQuery from "jquery"; -import { _global } from "@/core/0.foundation"; +// import jQuery from "jquery"; +// import { _global } from "@/core/0.foundation"; -// todo:先垫着,不然开发会崩 -_global.BI = _global.BI || {}; +// // todo:先垫着,不然开发会崩 +// _global.BI = _global.BI || {}; -_global.BI.jQuery = _global.BI.$ = jQuery; +// _global.BI.jQuery = _global.BI.$ = jQuery; diff --git a/src/core/platform/web/jquery/event.js b/src/core/platform/web/jquery/event.js index ea3ec568f..7dd61b2cf 100644 --- a/src/core/platform/web/jquery/event.js +++ b/src/core/platform/web/jquery/event.js @@ -1,7 +1,9 @@ +import $ from "jquery"; + /* * 给jQuery.Event对象添加的工具方法 */ -BI.$.extend(BI.$.Event.prototype, { +$.extend($.Event.prototype, { // event.stopEvent stopEvent() { this.stopPropagation(); diff --git a/src/core/platform/web/jquery/fn.js b/src/core/platform/web/jquery/fn.js index 6af28974b..2403d95b6 100644 --- a/src/core/platform/web/jquery/fn.js +++ b/src/core/platform/web/jquery/fn.js @@ -4,8 +4,9 @@ import { toUpperCase, remove, camelize, isKey, isNull, isNotEmptyString, map, hy import { makeFirstPY } from "../../../utils"; import { createWidget } from "../../../5.inject"; import { _global } from "../../../0.foundation"; +import $ from "jquery"; -BI.jQuery.fn.extend({ +$.fn.extend({ insets() { const p = this.padding(), @@ -111,7 +112,7 @@ BI.jQuery.fn.extend({ if (tidx >= 0 && (pidx > tidx || pidx === -1)) { // 标红的text未encode this.append(htmlEncode(textLeft.substr(0, tidx))); - this.append(BI.$("").addClass("bi-keyword-red-mark") + this.append($("").addClass("bi-keyword-red-mark") .html(htmlEncode(textLeft.substr(tidx, keyword.length)))); textLeft = textLeft.substr(tidx + keyword.length); @@ -123,7 +124,7 @@ BI.jQuery.fn.extend({ // BI-56386 这边两个pid / text.length是为了防止截取的首字符串不是完整的,但光这样做还不够,即时错位了,也不能说明就不符合条件 // 标红的text未encode this.append(htmlEncode(textLeft.substr(0, pidx))); - this.append(BI.$("").addClass("bi-keyword-red-mark") + this.append($("").addClass("bi-keyword-red-mark") .html(htmlEncode(textLeft.substr(pidx, keyword.length)))); if (isNotEmptyString(py)) { // 每一组拼音都应该前进,而不是只是当前的 @@ -141,8 +142,8 @@ BI.jQuery.fn.extend({ }, getDomHeight(parent) { - const clone = BI.$(this).clone(); - clone.appendTo(BI.$(parent || "body")); + const clone = $(this).clone(); + clone.appendTo($(parent || "body")); const height = clone.height(); clone.remove(); diff --git a/src/core/platform/web/jquery/jquery.mousewheel.js b/src/core/platform/web/jquery/jquery.mousewheel.js index f55fd91e9..7930f1b24 100644 --- a/src/core/platform/web/jquery/jquery.mousewheel.js +++ b/src/core/platform/web/jquery/jquery.mousewheel.js @@ -1,4 +1,5 @@ import { _global } from "../../../0.foundation"; +import $ from "jquery"; /* eslint-disable */ /* ! @@ -11,7 +12,7 @@ import { _global } from "../../../0.foundation"; (function (factory) { // Browser globals - factory(BI.jQuery); + factory($); // if ( typeof define === "function" && define.amd ) { // // AMD. Register as an anonymous module. // define(["../core/jquery"], factory); diff --git a/src/core/platform/web/load.js b/src/core/platform/web/load.js index 7ab3a490a..8daf6cbb9 100644 --- a/src/core/platform/web/load.js +++ b/src/core/platform/web/load.js @@ -1,16 +1,18 @@ +import $ from "jquery"; + const _LOADED = {}; // alex:保存加载过的 function loadReady(src, must) { - const $scripts = BI.$("head script, body script"); - BI.$.each($scripts, (i, item) => { + const $scripts = $("head script, body script"); + $.each($scripts, (i, item) => { if (item.src.indexOf(src) !== -1) { _LOADED[src] = true; } }); - const $links = BI.$("head link"); - BI.$.each($links, (i, item) => { + const $links = $("head link"); + $.each($links, (i, item) => { if (item.href.indexOf(src) !== -1 && must) { _LOADED[src] = false; - BI.$(item).remove(); + $(item).remove(); } }); } @@ -37,7 +39,7 @@ export function $import(src, ext, must) { _LOADED[src] = true; } else { // alex:这里用同步调用的方式,必须等待ajax完成 - BI.$.ajax({ + $.ajax({ url: src, dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 async: false, diff --git a/src/core/utils/dom.js b/src/core/utils/dom.js index a60a097ad..390a0100b 100644 --- a/src/core/utils/dom.js +++ b/src/core/utils/dom.js @@ -2,13 +2,14 @@ * 对DOM操作的通用函数 */ import { each, isEmpty, isNull } from "../2.base"; +import $ from "jquery"; export function ready(fn) { BI.Widget._renderEngine.createElement(document).ready(fn); } export function patchProps(fromElement, toElement) { - const elemData = BI.jQuery._data(fromElement[0]); + const elemData = $._data(fromElement[0]); const events = elemData.events; each(events, (eventKey, event) => { each(event, (i, handler) => { @@ -20,7 +21,7 @@ export function patchProps(fromElement, toElement) { throw new Error("不匹配"); } each(fromChildren, (i, child) => { - patchProps(BI.jQuery(child), BI.jQuery(toChildren[i])); + patchProps($(child), $(toChildren[i])); }); each(fromElement.data("__widgets"), (i, widget) => { widget.element = toElement; @@ -38,7 +39,7 @@ export function hang(doms) { const frag = BI.Widget._renderEngine.createFragment(); each(doms, (i, dom) => { dom instanceof BI.Widget && (dom = dom.element); - dom instanceof BI.$ && dom[0] && frag.appendChild(dom[0]); + dom instanceof $ && dom[0] && frag.appendChild(dom[0]); }); return frag;