@vxe-ui/core 4.5.11 → 4.5.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.esm.js +28 -28
- package/dist/all.esm.min.js +1 -1
- package/es/src/core.js +1 -1
- package/es/src/log.js +1 -1
- package/es/src/popper-utils.js +26 -26
- package/lib/index.umd.js +28 -28
- package/lib/index.umd.min.js +1 -1
- package/lib/src/core.js +1 -1
- package/lib/src/log.js +1 -1
- package/lib/src/popper-utils.js +26 -26
- package/package.json +1 -1
- package/packages/src/popper-utils.ts +32 -28
package/dist/all.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
|
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
|
|
5
5
|
// packages_temp/src/core.ts
|
|
6
|
-
var coreVersion = "4.5.
|
|
6
|
+
var coreVersion = "4.5.12";
|
|
7
7
|
var VxeCore = {
|
|
8
8
|
coreVersion,
|
|
9
9
|
uiVersion: "",
|
|
@@ -396,7 +396,7 @@ function createLog(type, name) {
|
|
|
396
396
|
return msg;
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
-
var version = "4.5.
|
|
399
|
+
var version = "4.5.12";
|
|
400
400
|
var log = {
|
|
401
401
|
create: createLog,
|
|
402
402
|
warn: createLog("warn", `v${version}`),
|
|
@@ -1221,9 +1221,16 @@ function getWrapperElement(panelElem) {
|
|
|
1221
1221
|
if (!panelElem) {
|
|
1222
1222
|
return null;
|
|
1223
1223
|
}
|
|
1224
|
-
const
|
|
1224
|
+
const doc = panelElem.ownerDocument;
|
|
1225
|
+
const bodyEl = doc.body;
|
|
1225
1226
|
const parentEl = panelElem.parentElement;
|
|
1226
|
-
|
|
1227
|
+
if (parentEl === bodyEl) {
|
|
1228
|
+
return bodyEl;
|
|
1229
|
+
}
|
|
1230
|
+
if (parentEl === doc.documentElement) {
|
|
1231
|
+
return bodyEl;
|
|
1232
|
+
}
|
|
1233
|
+
return parentEl || null;
|
|
1227
1234
|
}
|
|
1228
1235
|
function getAppendSelector(appendTo) {
|
|
1229
1236
|
const selectElem = appendTo && XEUtils18.isFunction(appendTo) ? appendTo({}) : appendTo;
|
|
@@ -1241,15 +1248,12 @@ var popperUtils = {
|
|
|
1241
1248
|
* 更新位置
|
|
1242
1249
|
*/
|
|
1243
1250
|
updatePlacement(targetElem, panelElem, options) {
|
|
1244
|
-
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign(
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
},
|
|
1251
|
-
options
|
|
1252
|
-
);
|
|
1251
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
1252
|
+
appendTo: "",
|
|
1253
|
+
teleportTo: false,
|
|
1254
|
+
marginSize: 18,
|
|
1255
|
+
isMinWidth: true
|
|
1256
|
+
}, options);
|
|
1253
1257
|
let panelPlacement = "bottom";
|
|
1254
1258
|
let top = "";
|
|
1255
1259
|
let bottom = "";
|
|
@@ -1274,8 +1278,8 @@ var popperUtils = {
|
|
|
1274
1278
|
const parentWrapperScrollTop = parentWrapperEl.scrollTop;
|
|
1275
1279
|
const parentWrapperOffsetLeft = parentWrapperRect.left;
|
|
1276
1280
|
const parentWrapperOffsetTop = parentWrapperRect.top;
|
|
1277
|
-
const targetLeft = targetRect.left;
|
|
1278
|
-
const targetTop = targetRect.top;
|
|
1281
|
+
const targetLeft = targetRect.left - parentWrapperOffsetLeft;
|
|
1282
|
+
const targetTop = targetRect.top - parentWrapperOffsetTop;
|
|
1279
1283
|
minWidth = targetElem.offsetWidth;
|
|
1280
1284
|
if (teleportTo) {
|
|
1281
1285
|
left = (defaultLeft || targetLeft - (panelWidth - targetWidth) / 2) - parentWrapperScrollLeft;
|
|
@@ -1309,13 +1313,11 @@ var popperUtils = {
|
|
|
1309
1313
|
}
|
|
1310
1314
|
}
|
|
1311
1315
|
if (left + panelWidth + marginSize > visibleWidth) {
|
|
1312
|
-
left
|
|
1316
|
+
left = visibleWidth - panelWidth - marginSize;
|
|
1313
1317
|
}
|
|
1314
1318
|
if (left < marginSize) {
|
|
1315
1319
|
left = marginSize;
|
|
1316
1320
|
}
|
|
1317
|
-
top -= parentWrapperOffsetTop;
|
|
1318
|
-
left -= parentWrapperOffsetLeft;
|
|
1319
1321
|
} else {
|
|
1320
1322
|
if (placement === "top") {
|
|
1321
1323
|
panelPlacement = "top";
|
|
@@ -1346,17 +1348,15 @@ var popperUtils = {
|
|
|
1346
1348
|
if (isMinWidth && XEUtils18.isNumber(minWidth)) {
|
|
1347
1349
|
stys.minWidth = minWidth + "px";
|
|
1348
1350
|
}
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
} else {
|
|
1357
|
-
arrowLeft = targetLeft - left + (panelWidth - (targetLeft - left)) / 2;
|
|
1358
|
-
}
|
|
1351
|
+
const panelViewportLeft = teleportTo ? parentWrapperOffsetLeft + left : panelRect.left + left;
|
|
1352
|
+
let arrowLeftValue = targetRect.left + targetWidth / 2 - panelViewportLeft;
|
|
1353
|
+
if (panelWidth > 0) {
|
|
1354
|
+
const arrowHalf = 5;
|
|
1355
|
+
const minArrow = arrowHalf;
|
|
1356
|
+
const maxArrow = panelWidth - arrowHalf;
|
|
1357
|
+
arrowLeftValue = Math.max(minArrow, Math.min(maxArrow, arrowLeftValue));
|
|
1359
1358
|
}
|
|
1359
|
+
arrowLeft = arrowLeftValue;
|
|
1360
1360
|
}
|
|
1361
1361
|
}
|
|
1362
1362
|
return {
|
package/dist/all.esm.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ke=Object.defineProperty,Be=(t,e,r)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,v=(t,e,r)=>Be(t,typeof e!="symbol"?e+"":e,r),yt="4.5.11",C={coreVersion:yt,uiVersion:"",tableVersion:"",designVersion:"",ganttVersion:""};import{createCommentVNode as Xe}from"vue";import Dt from"xe-utils";import He from"dom-zindex";var L={size:"",version:1,zIndex:999,resizeInterval:500},It={theme:""};function Z(t){const e=!t||t==="default"?"light":t;if(It.theme=e,typeof document!="undefined"){const r=document.documentElement;r&&r.setAttribute("data-vxe-ui-theme",e)}return C}function Ct(){return It.theme}function Wt(t){return t&&(t.zIndex&&He.setCurrent(t.zIndex),t.theme&&Z(t.theme),Dt.merge(L,t)),C}function Nt(t,e){return arguments.length?Dt.get(L,t,e):L}var Lt={};import{h as Rt}from"vue";import kt from"xe-utils";var lt={};import Ae from"xe-utils";function at(t){return Ae.isArray(t)?t:t?[t]:[]}function Bt(t){return t&&Object.assign(lt,t),C}function ut(t){return arguments.length?kt.get(lt,t):lt}function Xt(t){const e=ut(t);return ht(e,t)}function ht(t,e){return kt.isFunction(t)?Rt("span",{},at(t({name:e}))):Rt("i",{class:t})}import M from"xe-utils";var W={F2:"F2",F10:"F10",TAB:"Tab",ESCAPE:"Escape",ENTER:"Enter",DELETE:"Delete",BACKSPACE:"Backspace",SPACEBAR:" ",CONTEXT_MENU:"ContextMenu",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",HOME:"Home",END:"End",PROCESS:"Process",A:"A",X:"X",C:"C",V:"V",D:"D",F:"F",H:"H",M:"M",Y:"Y",Z:"Z",R:"R",P:"P"},ft=M.browse(),Ht={" ":"Spacebar",Apps:W.CONTEXT_MENU,Del:W.DELETE,Up:W.ARROW_UP,Down:W.ARROW_DOWN,Left:W.ARROW_LEFT,Right:W.ARROW_RIGHT},At=ft.firefox?"DOMMouseScroll":"mousewheel",mt=[];function T(t){const e=t.type===At;mt.forEach(({type:r,cb:n})=>{t.cancelBubble||(r===t.type||e&&r==="mousewheel")&&n(t)})}var _t=class{constructor(t,e,r){v(this,"$event"),v(this,"type",""),v(this,"key",""),v(this,"code",""),this.$event=t,t&&(t.type&&(this.type=t.type),t.key&&(this.key=t.key),t.code&&(this.code=t.code)),Object.assign(this,e),M.objectEach(r,(n,o)=>{if(M.isFunction(n)){let s=null,c=!1;Object.defineProperty(this,o,{get(){return c||(c=!0,s=n()),s}})}else this[o]=n})}stopPropagation(){const t=this.$event;t&&t.stopPropagation()}preventDefault(){const t=this.$event;t&&t.preventDefault()}},Mt=(t,e,r)=>(t instanceof _t&&(t=t.$event),new _t(t,e,r)),Ut={on(t,e,r){mt.push({comp:t,type:e,cb:r})},off(t,e){M.remove(mt,r=>r.comp===t&&r.type===e)},hasKey(t,e){if(!e)return!1;const{key:r}=t;return e=e.toLowerCase(),r?e===r.toLowerCase()||!!(Ht[r]&&Ht[r].toLowerCase()===e):!1},hasControlKey(t){return t.ctrlKey||t.metaKey}};ft.isDoc&&(ft.msie||(window.addEventListener("copy",T,!1),window.addEventListener("cut",T,!1),window.addEventListener("paste",T,!1)),document.addEventListener("scroll",T,!0),document.addEventListener("keydown",T,!1),document.addEventListener("contextmenu",T,!1),window.addEventListener("mousedown",T,!1),window.addEventListener("click",T,!1),window.addEventListener("blur",T,!1),window.addEventListener("resize",T,!1),window.addEventListener(At,M.throttle(T,100,{leading:!0,trailing:!1}),{passive:!0,capture:!1}));import Vt from"xe-utils";var jt,R=[],_e=500;function Me(){R.length&&(R.forEach(t=>{t.tarList.forEach(e=>{const{target:r,width:n,heighe:o}=e,s=r.clientWidth,c=r.clientHeight;(s&&n!==s||c&&o!==c)&&(e.width=s,e.heighe=c,setTimeout(t.callback))})}),Ft())}function Ft(){clearTimeout(jt),jt=setTimeout(Me,L.resizeInterval||_e)}var Ue=class{constructor(t){v(this,"tarList",[]),v(this,"callback"),this.callback=t}observe(t){if(t){const{tarList:e}=this;e.some(r=>r.target===t)||e.push({target:t,width:t.clientWidth,heighe:t.clientHeight}),R.length||Ft(),R.some(r=>r===this)||R.push(this)}}unobserve(t){Vt.remove(R,e=>e.tarList.some(r=>r.target===t))}disconnect(){Vt.remove(R,t=>t===this)}},zt={create(t){return window.ResizeObserver?new window.ResizeObserver(t):new Ue(t)}};import Yt from"xe-utils";import{reactive as Ve}from"vue";var B=Ve({language:"",langMaps:{}}),$t=!1,J={};function je(t){return t&&t.__esModule?t.default:t}function dt(t,e){const{langMaps:r,language:n}=B,{i18n:o}=L;if(o)return`${o(t,e)||""}`;if($t||(r[n]||console.error(`[vxe core] 语言包未安装。Language not installed. https://${C.uiVersion?"vxeui.com":"vxetable.cn"}/#/start/i18n`),$t=!0),!e&&J[t])return J[t];const s=Yt.toFormatString(Yt.get(r[n],t,t),e);return e||(J[t]=s),s}function qt(t){const{language:e}=B,r=t||"zh-CN";return e!==r&&(B.language=r,J={}),C}function Kt(t,e){return B.langMaps[t]=Object.assign({},je(e)),C}function Gt(t){const{langMaps:e}=B;return!!e[t]}function Zt(){const{language:t}=B;return t}import Q from"xe-utils";function gt(t,e){return function(r,n){const o=`[vxe ${e||""}] ${dt(r,n)}`;return console[t](o),o}}var Jt="4.5.11",O={create:gt,warn:gt("warn",`v${Jt}`),err:gt("error",`v${Jt}`)},U={},k={mixin(t){return Q.each(t,(e,r)=>{k.add(r,e)}),k},get(t){return U[t]||null},add(t,e){if(t&&e){const r=U[t];r?(Q.each(e,(n,o)=>{!Q.eqNull(r[o])&&r[o]!==n&&O.warn("vxe.error.coverProp",[`Renderer.${t}`,o])}),Object.assign(r,e)):U[t]=e}return k},forEach(t){return Q.objectEach(U,t),k},delete(t){return delete U[t],k}};import V from"xe-utils";var Fe=class{constructor(){v(this,"store",{})}mixin(t){return V.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t],n=V.keys(r);return V.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?V.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){V.objectEach(this.store,t)}},Qt=Fe,pt=new Qt;Object.assign(pt,{_name:"Validators"});import X from"xe-utils";var ze=class{constructor(){v(this,"store",{})}mixin(t){return X.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t];X.isFunction(e)&&(O.warn("vxe.error.delProp",["menus -> callback","menuMethod"]),e={menuMethod:e});const n=X.keys(r);return X.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?X.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){X.objectEach(this.store,t)}},bt=new ze;Object.assign(bt,{_name:"Menus"});import H from"xe-utils";var Ye=class{constructor(){v(this,"store",{})}mixin(t){return H.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t];H.isFunction(e)&&(O.warn("vxe.error.delProp",["formats -> callback","cellFormatMethod"]),e={cellFormatMethod:e});const n=H.keys(r);return H.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?H.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){H.objectEach(this.store,t)}},vt=new Ye;Object.assign(vt,{_name:"Formats"});import A from"xe-utils";var $e=class{constructor(){v(this,"store",{})}mixin(t){return A.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t];A.isFunction(e)&&(O.warn("vxe.error.delProp",["commands -> callback","commandMethod"]),e={commandMethod:e});const n=A.keys(r);return A.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?A.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){A.objectEach(this.store,t)}},Et=new $e;Object.assign(Et,{_name:"Commands"});import tt from"xe-utils";var j={},F={mixin(t){return tt.each(t,(e,r)=>{F.add(r,e)}),F},get(t){return t?j[t]||[]:[]},add(t,e){tt.isFunction(e)&&(e={tableInterceptorMethod:e});const r=e.tableInterceptorMethod;if(r){let n=j[t];n||(n=j[t]=[]),n.indexOf(r)>-1&&O.warn("vxe.error.coverProp",["Interceptor",t]),n.push(r)}return F},delete(t,e){const r=j[t];if(r){tt.isFunction(e)&&(e={tableInterceptorMethod:e});const n=e?e.tableInterceptorMethod:null;n?tt.remove(r,o=>o===n):delete j[t]}}};import qe from"xe-utils";var P,z={text:"",html:""};function Ke(t){if(!P){P=document.createElement("textarea"),P.id="$VxeCopy";const e=P.style;e.width="48px",e.height="24px",e.position="fixed",e.zIndex="0",e.left="-500px",e.top="-500px",document.body.appendChild(P)}P.value=t}var te={getStore(){return z},setStore(t){Object.assign(z,t||{})},copy(t){let e=!1;try{const r=qe.toValueString(t);Ke(r),P.select(),P.setSelectionRange(0,P.value.length),e=document.execCommand("copy"),P.blur(),z.text=r,z.html=""}catch(r){}return e},getText(){return z.text||""}};import Ge from"xe-utils";function Y(t,e){let r=!0,n=!1;const o=e||L.permissionMethod;if(t&&o){r=!1,n=!0;let c=!1,E=!1;const S=String(t).split("|");for(let b=0;b<S.length;b++){const $=S[b];let w=!0,h=!1;const x=o({code:$});if(Ge.isBoolean(x)?w=x:x&&(w=!!x.visible,h=!!x.disabled),!h&&!E&&(E=!0,n=h),w&&!c&&(c=!0,r=w),c&&E)break}}return{code:t,visible:r,disabled:n}}var ee={getCheckInfo(t){return Y(t)},checkVisible(t){return Y(t).visible},checkDisable(t){return Y(t).disabled}};import et from"dom-zindex";var re={next(){return et.getNext()},getLast(){return et.getCurrent()},nextSub(){return et.getSubNext()},getSubLast(){return et.getSubCurrent()}};import ne from"xe-utils";var oe={getStrVal(t){return ne.eqNull(t)?"":""+t},isEmptyVal(t){return t==null||t===""},getDefVal(t,e){return ne.eqNull(t)?e:t},isEnabled(t){return!!(t&&t.enabled!==!1)},hasEnableConf(t,e){return!!(e&&(t?e.enabled!==!1:e.enabled))}};import rt from"xe-utils";var Ze=class{constructor(t,e){v(this,"storeName","vxe_storage"),v(this,"key"),v(this,"version"),v(this,"dbPromise",null),v(this,"dbName",""),this.key=t,this.version=e}getDBName(){return`${this.key}_${this.version}`}resetDB(){this.dbPromise=null,this.dbName=""}openDB(){const t=this.getDBName();return this.dbPromise&&this.dbName===t?this.dbPromise:(this.dbName=t,this.dbPromise=new Promise((e,r)=>{const n=indexedDB.open(t,1);n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close(),this.resetDB()},o.onclose=()=>{this.resetDB()},e(o)},n.onerror=()=>{r(n.error||new Error(`IdbStore open failed: ${t}`))},n.onblocked=()=>{console.warn(`[IdbStore] open blocked: ${t}`)}}).catch(e=>{throw this.resetDB(),e}),this.dbPromise)}getById(t){return this.openDB().then(e=>new Promise((r,n)=>{const o=e.transaction(this.storeName,"readonly").objectStore(this.storeName).get(t);o.onsuccess=()=>r(o.result),o.onerror=()=>n(o.error)}))}getAll(){return this.openDB().then(t=>new Promise((e,r)=>{const n=t.transaction(this.storeName,"readonly").objectStore(this.storeName);if(rt.isFunction(n.getAll)){const c=n.getAll();c.onsuccess=()=>e(c.result||[]),c.onerror=()=>r(c.error);return}const o=[],s=n.openCursor();s.onsuccess=()=>{const c=s.result;c?(o.push(c.value),c.continue()):e(o)},s.onerror=()=>r(s.error)}))}updateById(t,e){return e==null?this.deleteById(t):this.openDB().then(r=>new Promise((n,o)=>{const s=r.transaction(this.storeName,"readwrite");s.objectStore(this.storeName).put({id:t,data:e}),s.oncomplete=()=>n(),s.onerror=()=>o(s.error)}))}deleteById(t){return this.openDB().then(e=>new Promise((r,n)=>{const o=e.transaction(this.storeName,"readwrite");o.objectStore(this.storeName).delete(t),o.oncomplete=()=>r(),o.onerror=()=>n(o.error)}))}clear(){return this.openDB().then(t=>new Promise((e,r)=>{const n=t.transaction(this.storeName,"readwrite");n.objectStore(this.storeName).clear(),n.oncomplete=()=>e(),n.onerror=()=>r(n.error)}))}cleanupOldDBs(){if(!indexedDB.databases)return Promise.resolve();const t=this.getDBName(),e=`${this.key}_`;return indexedDB.databases().then(r=>{r.forEach(n=>{const o=n.name;if(!o||o===t||!o.startsWith(e))return;o.slice(e.length).includes("_")||indexedDB.deleteDatabase(o)})})}},Je=class{constructor(t,e){v(this,"key"),v(this,"version"),this.key=t,this.version=e}readAll(){const t=rt.toStringJSON(localStorage.getItem(this.key)||"");return t&&String(t._v)===String(this.version)?t:{_v:this.version}}writeAll(t){localStorage.setItem(this.key,rt.toJSONString(t))}getById(t){const e=this.readAll(),r=Object.prototype.hasOwnProperty.call(e,t);return Promise.resolve(r&&e[t]!=null?{id:t,data:e[t]}:void 0)}getAll(){const t=this.readAll(),e=[];return Object.keys(t).forEach(r=>{r!=="_v"&&t[r]!=null&&e.push({id:r,data:t[r]})}),Promise.resolve(e)}updateById(t,e){if(e==null)return this.deleteById(t);const r=this.readAll();return r[t]=e,this.writeAll(r),Promise.resolve()}deleteById(t){const e=this.readAll();return delete e[t],this.writeAll(e),Promise.resolve()}clear(){return this.writeAll({_v:this.version}),Promise.resolve()}cleanupOldDBs(){const t=localStorage.getItem(this.key);if(!t)return Promise.resolve();const e=rt.toStringJSON(t);return(!e||String(e._v)!==String(this.version))&&localStorage.removeItem(this.key),Promise.resolve()}},se={createStore(t,e){const r=Object.assign({},e),n=r.version||L.version||0,o=r.driver;return(!o||o==="indexedDB")&&typeof indexedDB!="undefined"?new Ze(t,n):new Je(t,n)}};import Qe from"xe-utils";var wt={};function ie(t){return wt[t]||(wt[t]=new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g")),wt[t]}function St(t,e){return t?t.classList?t.classList.contains(e):!!(t.className&&t.className.match&&t.className.match(ie(e))):!1}function ce(t,e){t&&St(t,e)&&(t.className=t.className.replace(ie(e),""))}var le={isPx(t){return t&&/^\d+(\.\d+)?(px)?$/.test(t)},isScale(t){return t&&/^\d+(\.\d+)?%$/.test(t)},hasClass:St,removeClass:ce,addClass(t,e){t&&!St(t,e)&&(ce(t,e),t.className=t.className+" "+e)},buildClass(t,e){const r=[];if(t)for(let n=0;n<t.length;n++){const o=t[n];o&&r.push(""+o)}return Qe.each(e,(n,o)=>{n&&r.push(o)}),r.join(" ")}},xt={getThumbSize(t,e,r){if(e<=t)return 0;const n=t/e,o=r*n;return Math.max(20,Math.min(o,r))},getThumbOffsetSize(t,e,r,n,o){const s=r-e;if(s<=0)return 0;const c=n-o;return c<=0?0:Math.min(Math.max(t,0),s)/s*c},getScrollFromClick(t,e,r,n,o){const s=n-o,c=r-e;if(c<=0||s<=0)return 0;let E=t-o/2;return E=Math.min(Math.max(E,0),s),E/s*c},getScrollFromDrag(t,e,r,n,o,s){const c=n-r,E=o-s;if(c<=0||E<=0)return 0;let S=t-e;return S=Math.min(Math.max(S,0),E),S/E*c}};import _ from"xe-utils";function ae(t){if(!t)return null;const e=document.body,r=t.parentElement;return(r===e?document.documentElement:r)||null}function ue(t){return(t&&_.isFunction(t)?t({}):t)||"body"}function he(t){const e=ue(t);return _.isString(e)?document.querySelector(e)||document.body:e}var fe={updatePlacement(t,e,r){const{defaultTop:n,defaultLeft:o,placement:s,defaultPlacement:c,appendTo:E,teleportTo:S,marginSize:b,isMinWidth:$}=Object.assign({appendTo:"",teleportTo:!1,marginSize:12,isMinWidth:!0},r);let w="bottom",h="",x="",g=0,q="",i="";const u={};if(e&&t){const l=document.documentElement,f=ae(S?he(E):e);if(f){const a=t.offsetWidth,m=t.offsetHeight,p=e.offsetWidth,d=e.offsetHeight,y=f.getBoundingClientRect(),K=e.getBoundingClientRect(),Pt=t.getBoundingClientRect(),ct=l.clientHeight,G=l.clientWidth,Ne=f.scrollLeft,D=f.scrollTop,Le=y.left,Re=y.top,N=Pt.left,I=Pt.top;q=t.offsetWidth,S?(g=(o||N-(p-a)/2)-Ne,h=(n||I+m)-D,s==="top"?(w="top",h=I-d):s||(c==="top"?(w="top",n||(h=I-d),h<b-D&&(w="bottom",h=I+m-D),h+d+b>ct-D&&(w="top",h=I-d-D)):(h+d+b>ct-D&&(w="top",h=I-d-D),h<b-D&&(w="bottom",h=I+m-D))),g+p+b>G&&(g-=g+p+b-G),g<b&&(g=b),h-=Re,g-=Le):(s==="top"?(w="top",x=m):s||(h=m,I+m+d+b>ct&&I-m-d>b&&(w="top",h="",x=m)),K.left+K.width+b>G&&(g=-(K.left+K.width+b-G))),_.isNumber(h)&&(u.top=h+"px"),_.isNumber(x)&&(u.bottom=x+"px"),_.isNumber(g)&&(u.left=g+"px"),$&&_.isNumber(q)&&(u.minWidth=q+"px"),g===N?a<=p&&(i=a/2):g<N&&(g+p>N+a?i=N-g+a/2:i=N-g+(p-(N-g))/2)}}return{top:h||0,bottom:x||0,left:g||0,arrowLeft:i||0,style:u,placement:w}},getWrapperElement:ae,getAppendSelector:ue,getAppendElement:he},me=new Qt;import tr from"xe-utils";import{computed as Tt,ref as nt,inject as de,provide as ge}from"vue";var{getThumbOffsetSize:ot,getThumbSize:pe,getScrollFromClick:be,getScrollFromDrag:ve}=xt;function Ee(t){const e=de("xeSizeInfo",null),r=Tt(()=>{const{size:n}=t;return n||(e?e.value:null)});return ge("xeSizeInfo",r),{computeSize:r}}function we(t){return{computePermissionInfo:Tt(()=>Y(t.permissionCode,t.permissionMethod))}}function Se(t){const e=de("xeScrollbarInfo",null),r=Tt(()=>{const{useScrollbar:n}=t;return tr.isBoolean(n)?n:e?e.value:null});return ge("xeScrollbarInfo",r),{computeIsVScrollbar:r}}var xe=t=>{const{reactData:e,internalData:r}=t,n=nt(),o=nt(),s=nt(),c=nt();return{refTrackXElem:n,refTrackYElem:o,refThumbXElem:s,refThumbYElem:c,updateThumbSize:()=>{const i=t.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const u=n.value,l=u?pe(i.clientWidth,i.scrollWidth,u.clientWidth):0,f=s.value;f&&(f.style.width=l+"px"),e.xThumbWidth=l;const a=o.value,m=a?pe(i.clientHeight,i.scrollHeight,a.clientHeight):0,p=c.value;p&&(p.style.height=m+"px"),e.yThumbHeight=m},updateThumbOffset:()=>{const i=t.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const{xThumbWidth:u,yThumbHeight:l}=e,f=n.value,a=s.value,m=f&&u?ot(i.scrollLeft,i.clientWidth,i.scrollWidth,f.clientWidth,u):0;r.xThumbLeft=m,a&&u&&(a.style.width=u+"px",a.style.transform=`translateX(${m}px)`);const p=o.value,d=c.value,y=p&&l?ot(i.scrollTop,i.clientHeight,i.scrollHeight,p.clientHeight,l):0;r.yThumbTop=y,d&&l&&(d.style.height=l+"px",d.style.transform=`translateY(${y}px)`)},clickTrackXEvent:i=>{const u=i.currentTarget;if(u!==i.target)return;const l=t.getScrollViewElem();if(!l)return;const{xThumbWidth:f}=e,a=u.getBoundingClientRect();l.scrollTo({left:be(i.clientX-a.left,l.clientWidth,l.scrollWidth,u.clientWidth,f),behavior:"auto"})},clickTrackYEvent:i=>{const u=i.currentTarget;if(u!==i.target)return;const l=t.getScrollViewElem();if(!l)return;const{yThumbHeight:f}=e,a=u.getBoundingClientRect();l.scrollTo({top:be(i.clientY-a.top,l.clientHeight,l.scrollHeight,u.clientHeight,f),behavior:"auto"})},pointerdownThumbXEvent:i=>{const u=i.currentTarget;r.isThumbDrag=!0,u.setPointerCapture(i.pointerId);const l=t.getScrollViewElem();if(!l)return;const{xThumbWidth:f}=e,a=u.parentElement,m=a.getBoundingClientRect(),p=i.clientX-m.left,d=ot(l.scrollLeft,l.clientWidth,l.scrollWidth,a.clientWidth,f);r.thumbDragOffset=p-d},pointermoveThumbXEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:l,thumbDragOffset:f}=r;if(l){const a=t.getScrollViewElem();if(!a)return;const{xThumbWidth:m}=e,d=i.currentTarget.parentElement,y=d.getBoundingClientRect();a.scrollLeft=ve(i.clientX-y.left,f,a.clientWidth,a.scrollWidth,d.clientWidth,m)}},cleatPointerThumbEvent:i=>{i.currentTarget.releasePointerCapture(i.pointerId),r.isThumbDrag=!1},pointerdownThumbYEvent:i=>{const u=i.currentTarget;r.isThumbDrag=!0,u.setPointerCapture(i.pointerId);const l=t.getScrollViewElem();if(!l)return;const{yThumbHeight:f}=e,a=u.parentElement,m=a.getBoundingClientRect(),p=i.clientY-m.top,d=ot(l.scrollTop,l.clientHeight,l.scrollHeight,a.clientHeight,f);r.thumbDragOffset=p-d},pointermoveThumbYEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:l,thumbDragOffset:f}=r;if(l){const a=t.getScrollViewElem();if(!a)return;const{yThumbHeight:m}=e,d=i.currentTarget.parentElement,y=d.getBoundingClientRect();a.scrollTop=ve(i.clientY-y.top,f,a.clientHeight,a.scrollHeight,d.clientHeight,m)}}}},Te={useSize:Ee,useVScrollbar:Se,usePermission:we,useInitVScrollbar:xe};import Ot from"xe-utils";var Oe=[];function Pe(t,e){return t&&t.install&&Oe.indexOf(t)===-1&&(t.install(it,e),Oe.push(t)),it}var st={};function ye(t){return st[t]||null}function De(t){return!!st[t]}function Ie(t){t&&t.name&&(st[t.name]=t,st[Ot.kebabCase(t.name)]=t)}function Ce(){return Xe()}function We(t,e,r){if(t){const n=`${t}`.match(/(\d+).(\d+).(\d+)/);if(n){const o=Ot.toNumber(n[1]);if(r){const s=Ot.toNumber(n[2]);return o>=e&&s>=r}return o>=e}}return!1}var it=Object.assign(C,{renderEmptyElement:Ce,setTheme:Z,getTheme:Ct,setConfig:Wt,getConfig:Nt,setIcon:Bt,getIcon:ut,renderGlobalIcon:Xt,renderCustomIcon:ht,setLanguage:qt,hasLanguage:Gt,getLanguage:Zt,setI18n:Kt,getI18n:dt,globalEvents:Ut,GLOBAL_EVENT_KEYS:W,createEvent:Mt,globalResize:zt,renderer:k,validators:pt,menus:bt,formats:vt,commands:Et,interceptor:F,clipboard:te,log:O,permission:ee,zIndex:re,baseUtils:oe,dbUtils:se,domUtils:le,scrollbarUtils:xt,popperUtils:fe,globalStore:Lt,hooks:me,component:Ie,getComponent:ye,hasComponent:De,useFns:Te,getSlotVNs:at,checkVersion:We,use:Pe});Z();var er=it;export{W as GLOBAL_EVENT_KEYS,C as VxeCore,it as VxeUI,oe as baseUtils,We as checkVersion,te as clipboard,Et as commands,Ie as component,yt as coreVersion,Mt as createEvent,se as dbUtils,er as default,le as domUtils,vt as formats,ye as getComponent,Nt as getConfig,dt as getI18n,ut as getIcon,Zt as getLanguage,at as getSlotVNs,Ct as getTheme,Ut as globalEvents,zt as globalResize,Lt as globalStore,Y as handleCheckInfo,De as hasComponent,Gt as hasLanguage,me as hooks,F as interceptor,O as log,bt as menus,ee as permission,fe as popperUtils,ht as renderCustomIcon,Ce as renderEmptyElement,Xt as renderGlobalIcon,k as renderer,xt as scrollbarUtils,Wt as setConfig,Kt as setI18n,Bt as setIcon,qt as setLanguage,Z as setTheme,Pe as use,Te as useFns,xe as useInitVScrollbar,we as usePermission,Ee as useSize,Se as useVScrollbar,pt as validators,re as zIndex};
|
|
1
|
+
var Ae=Object.defineProperty,Xe=(t,e,r)=>e in t?Ae(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,b=(t,e,r)=>Xe(t,typeof e!="symbol"?e+"":e,r),Dt="4.5.12",C={coreVersion:Dt,uiVersion:"",tableVersion:"",designVersion:"",ganttVersion:""};import{createCommentVNode as _e}from"vue";import It from"xe-utils";import Me from"dom-zindex";var L={size:"",version:1,zIndex:999,resizeInterval:500},Ct={theme:""};function G(t){const e=!t||t==="default"?"light":t;if(Ct.theme=e,typeof document!="undefined"){const r=document.documentElement;r&&r.setAttribute("data-vxe-ui-theme",e)}return C}function Wt(){return Ct.theme}function Lt(t){return t&&(t.zIndex&&Me.setCurrent(t.zIndex),t.theme&&G(t.theme),It.merge(L,t)),C}function Nt(t,e){return arguments.length?It.get(L,t,e):L}var Rt={};import{h as kt}from"vue";import Bt from"xe-utils";var at={};import Ue from"xe-utils";function ut(t){return Ue.isArray(t)?t:t?[t]:[]}function Ht(t){return t&&Object.assign(at,t),C}function ht(t){return arguments.length?Bt.get(at,t):at}function At(t){const e=ht(t);return ft(e,t)}function ft(t,e){return Bt.isFunction(t)?kt("span",{},ut(t({name:e}))):kt("i",{class:t})}import M from"xe-utils";var W={F2:"F2",F10:"F10",TAB:"Tab",ESCAPE:"Escape",ENTER:"Enter",DELETE:"Delete",BACKSPACE:"Backspace",SPACEBAR:" ",CONTEXT_MENU:"ContextMenu",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",HOME:"Home",END:"End",PROCESS:"Process",A:"A",X:"X",C:"C",V:"V",D:"D",F:"F",H:"H",M:"M",Y:"Y",Z:"Z",R:"R",P:"P"},mt=M.browse(),Xt={" ":"Spacebar",Apps:W.CONTEXT_MENU,Del:W.DELETE,Up:W.ARROW_UP,Down:W.ARROW_DOWN,Left:W.ARROW_LEFT,Right:W.ARROW_RIGHT},_t=mt.firefox?"DOMMouseScroll":"mousewheel",dt=[];function T(t){const e=t.type===_t;dt.forEach(({type:r,cb:n})=>{t.cancelBubble||(r===t.type||e&&r==="mousewheel")&&n(t)})}var Mt=class{constructor(t,e,r){b(this,"$event"),b(this,"type",""),b(this,"key",""),b(this,"code",""),this.$event=t,t&&(t.type&&(this.type=t.type),t.key&&(this.key=t.key),t.code&&(this.code=t.code)),Object.assign(this,e),M.objectEach(r,(n,o)=>{if(M.isFunction(n)){let s=null,c=!1;Object.defineProperty(this,o,{get(){return c||(c=!0,s=n()),s}})}else this[o]=n})}stopPropagation(){const t=this.$event;t&&t.stopPropagation()}preventDefault(){const t=this.$event;t&&t.preventDefault()}},Ut=(t,e,r)=>(t instanceof Mt&&(t=t.$event),new Mt(t,e,r)),Vt={on(t,e,r){dt.push({comp:t,type:e,cb:r})},off(t,e){M.remove(dt,r=>r.comp===t&&r.type===e)},hasKey(t,e){if(!e)return!1;const{key:r}=t;return e=e.toLowerCase(),r?e===r.toLowerCase()||!!(Xt[r]&&Xt[r].toLowerCase()===e):!1},hasControlKey(t){return t.ctrlKey||t.metaKey}};mt.isDoc&&(mt.msie||(window.addEventListener("copy",T,!1),window.addEventListener("cut",T,!1),window.addEventListener("paste",T,!1)),document.addEventListener("scroll",T,!0),document.addEventListener("keydown",T,!1),document.addEventListener("contextmenu",T,!1),window.addEventListener("mousedown",T,!1),window.addEventListener("click",T,!1),window.addEventListener("blur",T,!1),window.addEventListener("resize",T,!1),window.addEventListener(_t,M.throttle(T,100,{leading:!0,trailing:!1}),{passive:!0,capture:!1}));import jt from"xe-utils";var Ft,N=[],Ve=500;function je(){N.length&&(N.forEach(t=>{t.tarList.forEach(e=>{const{target:r,width:n,heighe:o}=e,s=r.clientWidth,c=r.clientHeight;(s&&n!==s||c&&o!==c)&&(e.width=s,e.heighe=c,setTimeout(t.callback))})}),zt())}function zt(){clearTimeout(Ft),Ft=setTimeout(je,L.resizeInterval||Ve)}var Fe=class{constructor(t){b(this,"tarList",[]),b(this,"callback"),this.callback=t}observe(t){if(t){const{tarList:e}=this;e.some(r=>r.target===t)||e.push({target:t,width:t.clientWidth,heighe:t.clientHeight}),N.length||zt(),N.some(r=>r===this)||N.push(this)}}unobserve(t){jt.remove(N,e=>e.tarList.some(r=>r.target===t))}disconnect(){jt.remove(N,t=>t===this)}},Yt={create(t){return window.ResizeObserver?new window.ResizeObserver(t):new Fe(t)}};import $t from"xe-utils";import{reactive as ze}from"vue";var k=ze({language:"",langMaps:{}}),qt=!1,Z={};function Ye(t){return t&&t.__esModule?t.default:t}function gt(t,e){const{langMaps:r,language:n}=k,{i18n:o}=L;if(o)return`${o(t,e)||""}`;if(qt||(r[n]||console.error(`[vxe core] 语言包未安装。Language not installed. https://${C.uiVersion?"vxeui.com":"vxetable.cn"}/#/start/i18n`),qt=!0),!e&&Z[t])return Z[t];const s=$t.toFormatString($t.get(r[n],t,t),e);return e||(Z[t]=s),s}function Kt(t){const{language:e}=k,r=t||"zh-CN";return e!==r&&(k.language=r,Z={}),C}function Gt(t,e){return k.langMaps[t]=Object.assign({},Ye(e)),C}function Zt(t){const{langMaps:e}=k;return!!e[t]}function Jt(){const{language:t}=k;return t}import J from"xe-utils";function pt(t,e){return function(r,n){const o=`[vxe ${e||""}] ${gt(r,n)}`;return console[t](o),o}}var Qt="4.5.12",O={create:pt,warn:pt("warn",`v${Qt}`),err:pt("error",`v${Qt}`)},U={},R={mixin(t){return J.each(t,(e,r)=>{R.add(r,e)}),R},get(t){return U[t]||null},add(t,e){if(t&&e){const r=U[t];r?(J.each(e,(n,o)=>{!J.eqNull(r[o])&&r[o]!==n&&O.warn("vxe.error.coverProp",[`Renderer.${t}`,o])}),Object.assign(r,e)):U[t]=e}return R},forEach(t){return J.objectEach(U,t),R},delete(t){return delete U[t],R}};import V from"xe-utils";var $e=class{constructor(){b(this,"store",{})}mixin(t){return V.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t],n=V.keys(r);return V.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?V.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){V.objectEach(this.store,t)}},te=$e,bt=new te;Object.assign(bt,{_name:"Validators"});import B from"xe-utils";var qe=class{constructor(){b(this,"store",{})}mixin(t){return B.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t];B.isFunction(e)&&(O.warn("vxe.error.delProp",["menus -> callback","menuMethod"]),e={menuMethod:e});const n=B.keys(r);return B.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?B.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){B.objectEach(this.store,t)}},vt=new qe;Object.assign(vt,{_name:"Menus"});import H from"xe-utils";var Ke=class{constructor(){b(this,"store",{})}mixin(t){return H.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t];H.isFunction(e)&&(O.warn("vxe.error.delProp",["formats -> callback","cellFormatMethod"]),e={cellFormatMethod:e});const n=H.keys(r);return H.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?H.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){H.objectEach(this.store,t)}},Et=new Ke;Object.assign(Et,{_name:"Formats"});import A from"xe-utils";var Ge=class{constructor(){b(this,"store",{})}mixin(t){return A.each(t,(e,r)=>{this.add(r,e)}),this}has(t){return!!this.get(t)}get(t){return this.store[t]}add(t,e){const r=this.store[t];A.isFunction(e)&&(O.warn("vxe.error.delProp",["commands -> callback","commandMethod"]),e={commandMethod:e});const n=A.keys(r);return A.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?A.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){A.objectEach(this.store,t)}},wt=new Ge;Object.assign(wt,{_name:"Commands"});import Q from"xe-utils";var j={},F={mixin(t){return Q.each(t,(e,r)=>{F.add(r,e)}),F},get(t){return t?j[t]||[]:[]},add(t,e){Q.isFunction(e)&&(e={tableInterceptorMethod:e});const r=e.tableInterceptorMethod;if(r){let n=j[t];n||(n=j[t]=[]),n.indexOf(r)>-1&&O.warn("vxe.error.coverProp",["Interceptor",t]),n.push(r)}return F},delete(t,e){const r=j[t];if(r){Q.isFunction(e)&&(e={tableInterceptorMethod:e});const n=e?e.tableInterceptorMethod:null;n?Q.remove(r,o=>o===n):delete j[t]}}};import Ze from"xe-utils";var P,z={text:"",html:""};function Je(t){if(!P){P=document.createElement("textarea"),P.id="$VxeCopy";const e=P.style;e.width="48px",e.height="24px",e.position="fixed",e.zIndex="0",e.left="-500px",e.top="-500px",document.body.appendChild(P)}P.value=t}var ee={getStore(){return z},setStore(t){Object.assign(z,t||{})},copy(t){let e=!1;try{const r=Ze.toValueString(t);Je(r),P.select(),P.setSelectionRange(0,P.value.length),e=document.execCommand("copy"),P.blur(),z.text=r,z.html=""}catch(r){}return e},getText(){return z.text||""}};import Qe from"xe-utils";function Y(t,e){let r=!0,n=!1;const o=e||L.permissionMethod;if(t&&o){r=!1,n=!0;let c=!1,v=!1;const w=String(t).split("|");for(let g=0;g<w.length;g++){const $=w[g];let E=!0,d=!1;const x=o({code:$});if(Qe.isBoolean(x)?E=x:x&&(E=!!x.visible,d=!!x.disabled),!d&&!v&&(v=!0,n=d),E&&!c&&(c=!0,r=E),c&&v)break}}return{code:t,visible:r,disabled:n}}var re={getCheckInfo(t){return Y(t)},checkVisible(t){return Y(t).visible},checkDisable(t){return Y(t).disabled}};import tt from"dom-zindex";var ne={next(){return tt.getNext()},getLast(){return tt.getCurrent()},nextSub(){return tt.getSubNext()},getSubLast(){return tt.getSubCurrent()}};import oe from"xe-utils";var se={getStrVal(t){return oe.eqNull(t)?"":""+t},isEmptyVal(t){return t==null||t===""},getDefVal(t,e){return oe.eqNull(t)?e:t},isEnabled(t){return!!(t&&t.enabled!==!1)},hasEnableConf(t,e){return!!(e&&(t?e.enabled!==!1:e.enabled))}};import et from"xe-utils";var tr=class{constructor(t,e){b(this,"storeName","vxe_storage"),b(this,"key"),b(this,"version"),b(this,"dbPromise",null),b(this,"dbName",""),this.key=t,this.version=e}getDBName(){return`${this.key}_${this.version}`}resetDB(){this.dbPromise=null,this.dbName=""}openDB(){const t=this.getDBName();return this.dbPromise&&this.dbName===t?this.dbPromise:(this.dbName=t,this.dbPromise=new Promise((e,r)=>{const n=indexedDB.open(t,1);n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close(),this.resetDB()},o.onclose=()=>{this.resetDB()},e(o)},n.onerror=()=>{r(n.error||new Error(`IdbStore open failed: ${t}`))},n.onblocked=()=>{console.warn(`[IdbStore] open blocked: ${t}`)}}).catch(e=>{throw this.resetDB(),e}),this.dbPromise)}getById(t){return this.openDB().then(e=>new Promise((r,n)=>{const o=e.transaction(this.storeName,"readonly").objectStore(this.storeName).get(t);o.onsuccess=()=>r(o.result),o.onerror=()=>n(o.error)}))}getAll(){return this.openDB().then(t=>new Promise((e,r)=>{const n=t.transaction(this.storeName,"readonly").objectStore(this.storeName);if(et.isFunction(n.getAll)){const c=n.getAll();c.onsuccess=()=>e(c.result||[]),c.onerror=()=>r(c.error);return}const o=[],s=n.openCursor();s.onsuccess=()=>{const c=s.result;c?(o.push(c.value),c.continue()):e(o)},s.onerror=()=>r(s.error)}))}updateById(t,e){return e==null?this.deleteById(t):this.openDB().then(r=>new Promise((n,o)=>{const s=r.transaction(this.storeName,"readwrite");s.objectStore(this.storeName).put({id:t,data:e}),s.oncomplete=()=>n(),s.onerror=()=>o(s.error)}))}deleteById(t){return this.openDB().then(e=>new Promise((r,n)=>{const o=e.transaction(this.storeName,"readwrite");o.objectStore(this.storeName).delete(t),o.oncomplete=()=>r(),o.onerror=()=>n(o.error)}))}clear(){return this.openDB().then(t=>new Promise((e,r)=>{const n=t.transaction(this.storeName,"readwrite");n.objectStore(this.storeName).clear(),n.oncomplete=()=>e(),n.onerror=()=>r(n.error)}))}cleanupOldDBs(){if(!indexedDB.databases)return Promise.resolve();const t=this.getDBName(),e=`${this.key}_`;return indexedDB.databases().then(r=>{r.forEach(n=>{const o=n.name;if(!o||o===t||!o.startsWith(e))return;o.slice(e.length).includes("_")||indexedDB.deleteDatabase(o)})})}},er=class{constructor(t,e){b(this,"key"),b(this,"version"),this.key=t,this.version=e}readAll(){const t=et.toStringJSON(localStorage.getItem(this.key)||"");return t&&String(t._v)===String(this.version)?t:{_v:this.version}}writeAll(t){localStorage.setItem(this.key,et.toJSONString(t))}getById(t){const e=this.readAll(),r=Object.prototype.hasOwnProperty.call(e,t);return Promise.resolve(r&&e[t]!=null?{id:t,data:e[t]}:void 0)}getAll(){const t=this.readAll(),e=[];return Object.keys(t).forEach(r=>{r!=="_v"&&t[r]!=null&&e.push({id:r,data:t[r]})}),Promise.resolve(e)}updateById(t,e){if(e==null)return this.deleteById(t);const r=this.readAll();return r[t]=e,this.writeAll(r),Promise.resolve()}deleteById(t){const e=this.readAll();return delete e[t],this.writeAll(e),Promise.resolve()}clear(){return this.writeAll({_v:this.version}),Promise.resolve()}cleanupOldDBs(){const t=localStorage.getItem(this.key);if(!t)return Promise.resolve();const e=et.toStringJSON(t);return(!e||String(e._v)!==String(this.version))&&localStorage.removeItem(this.key),Promise.resolve()}},ie={createStore(t,e){const r=Object.assign({},e),n=r.version||L.version||0,o=r.driver;return(!o||o==="indexedDB")&&typeof indexedDB!="undefined"?new tr(t,n):new er(t,n)}};import rr from"xe-utils";var xt={};function ce(t){return xt[t]||(xt[t]=new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g")),xt[t]}function St(t,e){return t?t.classList?t.classList.contains(e):!!(t.className&&t.className.match&&t.className.match(ce(e))):!1}function le(t,e){t&&St(t,e)&&(t.className=t.className.replace(ce(e),""))}var ae={isPx(t){return t&&/^\d+(\.\d+)?(px)?$/.test(t)},isScale(t){return t&&/^\d+(\.\d+)?%$/.test(t)},hasClass:St,removeClass:le,addClass(t,e){t&&!St(t,e)&&(le(t,e),t.className=t.className+" "+e)},buildClass(t,e){const r=[];if(t)for(let n=0;n<t.length;n++){const o=t[n];o&&r.push(""+o)}return rr.each(e,(n,o)=>{n&&r.push(o)}),r.join(" ")}},Tt={getThumbSize(t,e,r){if(e<=t)return 0;const n=t/e,o=r*n;return Math.max(20,Math.min(o,r))},getThumbOffsetSize(t,e,r,n,o){const s=r-e;if(s<=0)return 0;const c=n-o;return c<=0?0:Math.min(Math.max(t,0),s)/s*c},getScrollFromClick(t,e,r,n,o){const s=n-o,c=r-e;if(c<=0||s<=0)return 0;let v=t-o/2;return v=Math.min(Math.max(v,0),s),v/s*c},getScrollFromDrag(t,e,r,n,o,s){const c=n-r,v=o-s;if(c<=0||v<=0)return 0;let w=t-e;return w=Math.min(Math.max(w,0),v),w/v*c}};import X from"xe-utils";function ue(t){if(!t)return null;const e=t.ownerDocument,r=e.body,n=t.parentElement;return n===r||n===e.documentElement?r:n||null}function he(t){return(t&&X.isFunction(t)?t({}):t)||"body"}function fe(t){const e=he(t);return X.isString(e)?document.querySelector(e)||document.body:e}var me={updatePlacement(t,e,r){const{defaultTop:n,defaultLeft:o,placement:s,defaultPlacement:c,appendTo:v,teleportTo:w,marginSize:g,isMinWidth:$}=Object.assign({appendTo:"",teleportTo:!1,marginSize:18,isMinWidth:!0},r);let E="bottom",d="",x="",S=0,q="",i="";const a={};if(e&&t){const l=document.documentElement,h=ue(w?fe(v):e);if(h){const u=t.offsetWidth,f=t.offsetHeight,p=e.offsetWidth,m=e.offsetHeight,y=h.getBoundingClientRect(),_=e.getBoundingClientRect(),it=t.getBoundingClientRect(),ct=l.clientHeight,K=l.clientWidth,Ne=h.scrollLeft,D=h.scrollTop,yt=y.left,Re=y.top,ke=it.left-yt,I=it.top-Re;q=t.offsetWidth,w?(S=(o||ke-(p-u)/2)-Ne,d=(n||I+f)-D,s==="top"?(E="top",d=I-m):s||(c==="top"?(E="top",n||(d=I-m),d<g-D&&(E="bottom",d=I+f-D),d+m+g>ct-D&&(E="top",d=I-m-D)):(d+m+g>ct-D&&(E="top",d=I-m-D),d<g-D&&(E="bottom",d=I+f-D))),S+p+g>K&&(S=K-p-g),S<g&&(S=g)):(s==="top"?(E="top",x=f):s||(d=f,I+f+m+g>ct&&I-f-m>g&&(E="top",d="",x=f)),_.left+_.width+g>K&&(S=-(_.left+_.width+g-K))),X.isNumber(d)&&(a.top=d+"px"),X.isNumber(x)&&(a.bottom=x+"px"),X.isNumber(S)&&(a.left=S+"px"),$&&X.isNumber(q)&&(a.minWidth=q+"px");const Be=w?yt+S:_.left+S;let lt=it.left+u/2-Be;if(p>0){const He=p-5;lt=Math.max(5,Math.min(He,lt))}i=lt}}return{top:d||0,bottom:x||0,left:S||0,arrowLeft:i||0,style:a,placement:E}},getWrapperElement:ue,getAppendSelector:he,getAppendElement:fe},de=new te;import nr from"xe-utils";import{computed as Ot,ref as rt,inject as ge,provide as pe}from"vue";var{getThumbOffsetSize:nt,getThumbSize:be,getScrollFromClick:ve,getScrollFromDrag:Ee}=Tt;function we(t){const e=ge("xeSizeInfo",null),r=Ot(()=>{const{size:n}=t;return n||(e?e.value:null)});return pe("xeSizeInfo",r),{computeSize:r}}function xe(t){return{computePermissionInfo:Ot(()=>Y(t.permissionCode,t.permissionMethod))}}function Se(t){const e=ge("xeScrollbarInfo",null),r=Ot(()=>{const{useScrollbar:n}=t;return nr.isBoolean(n)?n:e?e.value:null});return pe("xeScrollbarInfo",r),{computeIsVScrollbar:r}}var Te=t=>{const{reactData:e,internalData:r}=t,n=rt(),o=rt(),s=rt(),c=rt();return{refTrackXElem:n,refTrackYElem:o,refThumbXElem:s,refThumbYElem:c,updateThumbSize:()=>{const i=t.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const a=n.value,l=a?be(i.clientWidth,i.scrollWidth,a.clientWidth):0,h=s.value;h&&(h.style.width=l+"px"),e.xThumbWidth=l;const u=o.value,f=u?be(i.clientHeight,i.scrollHeight,u.clientHeight):0,p=c.value;p&&(p.style.height=f+"px"),e.yThumbHeight=f},updateThumbOffset:()=>{const i=t.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const{xThumbWidth:a,yThumbHeight:l}=e,h=n.value,u=s.value,f=h&&a?nt(i.scrollLeft,i.clientWidth,i.scrollWidth,h.clientWidth,a):0;r.xThumbLeft=f,u&&a&&(u.style.width=a+"px",u.style.transform=`translateX(${f}px)`);const p=o.value,m=c.value,y=p&&l?nt(i.scrollTop,i.clientHeight,i.scrollHeight,p.clientHeight,l):0;r.yThumbTop=y,m&&l&&(m.style.height=l+"px",m.style.transform=`translateY(${y}px)`)},clickTrackXEvent:i=>{const a=i.currentTarget;if(a!==i.target)return;const l=t.getScrollViewElem();if(!l)return;const{xThumbWidth:h}=e,u=a.getBoundingClientRect();l.scrollTo({left:ve(i.clientX-u.left,l.clientWidth,l.scrollWidth,a.clientWidth,h),behavior:"auto"})},clickTrackYEvent:i=>{const a=i.currentTarget;if(a!==i.target)return;const l=t.getScrollViewElem();if(!l)return;const{yThumbHeight:h}=e,u=a.getBoundingClientRect();l.scrollTo({top:ve(i.clientY-u.top,l.clientHeight,l.scrollHeight,a.clientHeight,h),behavior:"auto"})},pointerdownThumbXEvent:i=>{const a=i.currentTarget;r.isThumbDrag=!0,a.setPointerCapture(i.pointerId);const l=t.getScrollViewElem();if(!l)return;const{xThumbWidth:h}=e,u=a.parentElement,f=u.getBoundingClientRect(),p=i.clientX-f.left,m=nt(l.scrollLeft,l.clientWidth,l.scrollWidth,u.clientWidth,h);r.thumbDragOffset=p-m},pointermoveThumbXEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:l,thumbDragOffset:h}=r;if(l){const u=t.getScrollViewElem();if(!u)return;const{xThumbWidth:f}=e,m=i.currentTarget.parentElement,y=m.getBoundingClientRect();u.scrollLeft=Ee(i.clientX-y.left,h,u.clientWidth,u.scrollWidth,m.clientWidth,f)}},cleatPointerThumbEvent:i=>{i.currentTarget.releasePointerCapture(i.pointerId),r.isThumbDrag=!1},pointerdownThumbYEvent:i=>{const a=i.currentTarget;r.isThumbDrag=!0,a.setPointerCapture(i.pointerId);const l=t.getScrollViewElem();if(!l)return;const{yThumbHeight:h}=e,u=a.parentElement,f=u.getBoundingClientRect(),p=i.clientY-f.top,m=nt(l.scrollTop,l.clientHeight,l.scrollHeight,u.clientHeight,h);r.thumbDragOffset=p-m},pointermoveThumbYEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:l,thumbDragOffset:h}=r;if(l){const u=t.getScrollViewElem();if(!u)return;const{yThumbHeight:f}=e,m=i.currentTarget.parentElement,y=m.getBoundingClientRect();u.scrollTop=Ee(i.clientY-y.top,h,u.clientHeight,u.scrollHeight,m.clientHeight,f)}}}},Oe={useSize:we,useVScrollbar:Se,usePermission:xe,useInitVScrollbar:Te};import Pt from"xe-utils";var Pe=[];function ye(t,e){return t&&t.install&&Pe.indexOf(t)===-1&&(t.install(st,e),Pe.push(t)),st}var ot={};function De(t){return ot[t]||null}function Ie(t){return!!ot[t]}function Ce(t){t&&t.name&&(ot[t.name]=t,ot[Pt.kebabCase(t.name)]=t)}function We(){return _e()}function Le(t,e,r){if(t){const n=`${t}`.match(/(\d+).(\d+).(\d+)/);if(n){const o=Pt.toNumber(n[1]);if(r){const s=Pt.toNumber(n[2]);return o>=e&&s>=r}return o>=e}}return!1}var st=Object.assign(C,{renderEmptyElement:We,setTheme:G,getTheme:Wt,setConfig:Lt,getConfig:Nt,setIcon:Ht,getIcon:ht,renderGlobalIcon:At,renderCustomIcon:ft,setLanguage:Kt,hasLanguage:Zt,getLanguage:Jt,setI18n:Gt,getI18n:gt,globalEvents:Vt,GLOBAL_EVENT_KEYS:W,createEvent:Ut,globalResize:Yt,renderer:R,validators:bt,menus:vt,formats:Et,commands:wt,interceptor:F,clipboard:ee,log:O,permission:re,zIndex:ne,baseUtils:se,dbUtils:ie,domUtils:ae,scrollbarUtils:Tt,popperUtils:me,globalStore:Rt,hooks:de,component:Ce,getComponent:De,hasComponent:Ie,useFns:Oe,getSlotVNs:ut,checkVersion:Le,use:ye});G();var or=st;export{W as GLOBAL_EVENT_KEYS,C as VxeCore,st as VxeUI,se as baseUtils,Le as checkVersion,ee as clipboard,wt as commands,Ce as component,Dt as coreVersion,Ut as createEvent,ie as dbUtils,or as default,ae as domUtils,Et as formats,De as getComponent,Nt as getConfig,gt as getI18n,ht as getIcon,Jt as getLanguage,ut as getSlotVNs,Wt as getTheme,Vt as globalEvents,Yt as globalResize,Rt as globalStore,Y as handleCheckInfo,Ie as hasComponent,Zt as hasLanguage,de as hooks,F as interceptor,O as log,vt as menus,re as permission,me as popperUtils,ft as renderCustomIcon,We as renderEmptyElement,At as renderGlobalIcon,R as renderer,Tt as scrollbarUtils,Lt as setConfig,Gt as setI18n,Ht as setIcon,Kt as setLanguage,G as setTheme,ye as use,Oe as useFns,Te as useInitVScrollbar,xe as usePermission,we as useSize,Se as useVScrollbar,bt as validators,ne as zIndex};
|
package/es/src/core.js
CHANGED
package/es/src/log.js
CHANGED
package/es/src/popper-utils.js
CHANGED
|
@@ -3,9 +3,16 @@ function getWrapperElement(panelElem) {
|
|
|
3
3
|
if (!panelElem) {
|
|
4
4
|
return null;
|
|
5
5
|
}
|
|
6
|
-
const
|
|
6
|
+
const doc = panelElem.ownerDocument;
|
|
7
|
+
const bodyEl = doc.body;
|
|
7
8
|
const parentEl = panelElem.parentElement;
|
|
8
|
-
|
|
9
|
+
if (parentEl === bodyEl) {
|
|
10
|
+
return bodyEl;
|
|
11
|
+
}
|
|
12
|
+
if (parentEl === doc.documentElement) {
|
|
13
|
+
return bodyEl;
|
|
14
|
+
}
|
|
15
|
+
return parentEl || null;
|
|
9
16
|
}
|
|
10
17
|
function getAppendSelector(appendTo) {
|
|
11
18
|
const selectElem = appendTo && XEUtils.isFunction(appendTo) ? appendTo({}) : appendTo;
|
|
@@ -23,15 +30,12 @@ const popperUtils = {
|
|
|
23
30
|
* 更新位置
|
|
24
31
|
*/
|
|
25
32
|
updatePlacement(targetElem, panelElem, options) {
|
|
26
|
-
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
options
|
|
34
|
-
);
|
|
33
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
34
|
+
appendTo: "",
|
|
35
|
+
teleportTo: false,
|
|
36
|
+
marginSize: 18,
|
|
37
|
+
isMinWidth: true
|
|
38
|
+
}, options);
|
|
35
39
|
let panelPlacement = "bottom";
|
|
36
40
|
let top = "";
|
|
37
41
|
let bottom = "";
|
|
@@ -56,8 +60,8 @@ const popperUtils = {
|
|
|
56
60
|
const parentWrapperScrollTop = parentWrapperEl.scrollTop;
|
|
57
61
|
const parentWrapperOffsetLeft = parentWrapperRect.left;
|
|
58
62
|
const parentWrapperOffsetTop = parentWrapperRect.top;
|
|
59
|
-
const targetLeft = targetRect.left;
|
|
60
|
-
const targetTop = targetRect.top;
|
|
63
|
+
const targetLeft = targetRect.left - parentWrapperOffsetLeft;
|
|
64
|
+
const targetTop = targetRect.top - parentWrapperOffsetTop;
|
|
61
65
|
minWidth = targetElem.offsetWidth;
|
|
62
66
|
if (teleportTo) {
|
|
63
67
|
left = (defaultLeft || targetLeft - (panelWidth - targetWidth) / 2) - parentWrapperScrollLeft;
|
|
@@ -91,13 +95,11 @@ const popperUtils = {
|
|
|
91
95
|
}
|
|
92
96
|
}
|
|
93
97
|
if (left + panelWidth + marginSize > visibleWidth) {
|
|
94
|
-
left
|
|
98
|
+
left = visibleWidth - panelWidth - marginSize;
|
|
95
99
|
}
|
|
96
100
|
if (left < marginSize) {
|
|
97
101
|
left = marginSize;
|
|
98
102
|
}
|
|
99
|
-
top -= parentWrapperOffsetTop;
|
|
100
|
-
left -= parentWrapperOffsetLeft;
|
|
101
103
|
} else {
|
|
102
104
|
if (placement === "top") {
|
|
103
105
|
panelPlacement = "top";
|
|
@@ -128,17 +130,15 @@ const popperUtils = {
|
|
|
128
130
|
if (isMinWidth && XEUtils.isNumber(minWidth)) {
|
|
129
131
|
stys.minWidth = minWidth + "px";
|
|
130
132
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
} else {
|
|
139
|
-
arrowLeft = targetLeft - left + (panelWidth - (targetLeft - left)) / 2;
|
|
140
|
-
}
|
|
133
|
+
const panelViewportLeft = teleportTo ? parentWrapperOffsetLeft + left : panelRect.left + left;
|
|
134
|
+
let arrowLeftValue = targetRect.left + targetWidth / 2 - panelViewportLeft;
|
|
135
|
+
if (panelWidth > 0) {
|
|
136
|
+
const arrowHalf = 5;
|
|
137
|
+
const minArrow = arrowHalf;
|
|
138
|
+
const maxArrow = panelWidth - arrowHalf;
|
|
139
|
+
arrowLeftValue = Math.max(minArrow, Math.min(maxArrow, arrowLeftValue));
|
|
141
140
|
}
|
|
141
|
+
arrowLeft = arrowLeftValue;
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
return {
|
package/lib/index.umd.js
CHANGED
|
@@ -112,7 +112,7 @@ __export(index_exports, {
|
|
|
112
112
|
module.exports = __toCommonJS(index_exports);
|
|
113
113
|
|
|
114
114
|
// packages_temp/src/core.ts
|
|
115
|
-
var coreVersion = "4.5.
|
|
115
|
+
var coreVersion = "4.5.12";
|
|
116
116
|
var VxeCore = {
|
|
117
117
|
coreVersion,
|
|
118
118
|
uiVersion: "",
|
|
@@ -659,7 +659,7 @@ function createLog(type, name) {
|
|
|
659
659
|
return msg;
|
|
660
660
|
};
|
|
661
661
|
}
|
|
662
|
-
var version = "4.5.
|
|
662
|
+
var version = "4.5.12";
|
|
663
663
|
var log = {
|
|
664
664
|
create: createLog,
|
|
665
665
|
warn: createLog("warn", `v${version}`),
|
|
@@ -1483,9 +1483,16 @@ function getWrapperElement(panelElem) {
|
|
|
1483
1483
|
if (!panelElem) {
|
|
1484
1484
|
return null;
|
|
1485
1485
|
}
|
|
1486
|
-
const
|
|
1486
|
+
const doc = panelElem.ownerDocument;
|
|
1487
|
+
const bodyEl2 = doc.body;
|
|
1487
1488
|
const parentEl = panelElem.parentElement;
|
|
1488
|
-
|
|
1489
|
+
if (parentEl === bodyEl2) {
|
|
1490
|
+
return bodyEl2;
|
|
1491
|
+
}
|
|
1492
|
+
if (parentEl === doc.documentElement) {
|
|
1493
|
+
return bodyEl2;
|
|
1494
|
+
}
|
|
1495
|
+
return parentEl || null;
|
|
1489
1496
|
}
|
|
1490
1497
|
function getAppendSelector(appendTo) {
|
|
1491
1498
|
const selectElem = appendTo && import_xe_utils18.default.isFunction(appendTo) ? appendTo({}) : appendTo;
|
|
@@ -1503,15 +1510,12 @@ var popperUtils = {
|
|
|
1503
1510
|
* 更新位置
|
|
1504
1511
|
*/
|
|
1505
1512
|
updatePlacement(targetElem, panelElem, options) {
|
|
1506
|
-
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign(
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
},
|
|
1513
|
-
options
|
|
1514
|
-
);
|
|
1513
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
1514
|
+
appendTo: "",
|
|
1515
|
+
teleportTo: false,
|
|
1516
|
+
marginSize: 18,
|
|
1517
|
+
isMinWidth: true
|
|
1518
|
+
}, options);
|
|
1515
1519
|
let panelPlacement = "bottom";
|
|
1516
1520
|
let top = "";
|
|
1517
1521
|
let bottom = "";
|
|
@@ -1536,8 +1540,8 @@ var popperUtils = {
|
|
|
1536
1540
|
const parentWrapperScrollTop = parentWrapperEl.scrollTop;
|
|
1537
1541
|
const parentWrapperOffsetLeft = parentWrapperRect.left;
|
|
1538
1542
|
const parentWrapperOffsetTop = parentWrapperRect.top;
|
|
1539
|
-
const targetLeft = targetRect.left;
|
|
1540
|
-
const targetTop = targetRect.top;
|
|
1543
|
+
const targetLeft = targetRect.left - parentWrapperOffsetLeft;
|
|
1544
|
+
const targetTop = targetRect.top - parentWrapperOffsetTop;
|
|
1541
1545
|
minWidth = targetElem.offsetWidth;
|
|
1542
1546
|
if (teleportTo) {
|
|
1543
1547
|
left = (defaultLeft || targetLeft - (panelWidth - targetWidth) / 2) - parentWrapperScrollLeft;
|
|
@@ -1571,13 +1575,11 @@ var popperUtils = {
|
|
|
1571
1575
|
}
|
|
1572
1576
|
}
|
|
1573
1577
|
if (left + panelWidth + marginSize > visibleWidth) {
|
|
1574
|
-
left
|
|
1578
|
+
left = visibleWidth - panelWidth - marginSize;
|
|
1575
1579
|
}
|
|
1576
1580
|
if (left < marginSize) {
|
|
1577
1581
|
left = marginSize;
|
|
1578
1582
|
}
|
|
1579
|
-
top -= parentWrapperOffsetTop;
|
|
1580
|
-
left -= parentWrapperOffsetLeft;
|
|
1581
1583
|
} else {
|
|
1582
1584
|
if (placement === "top") {
|
|
1583
1585
|
panelPlacement = "top";
|
|
@@ -1608,17 +1610,15 @@ var popperUtils = {
|
|
|
1608
1610
|
if (isMinWidth && import_xe_utils18.default.isNumber(minWidth)) {
|
|
1609
1611
|
stys.minWidth = minWidth + "px";
|
|
1610
1612
|
}
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
} else {
|
|
1619
|
-
arrowLeft = targetLeft - left + (panelWidth - (targetLeft - left)) / 2;
|
|
1620
|
-
}
|
|
1613
|
+
const panelViewportLeft = teleportTo ? parentWrapperOffsetLeft + left : panelRect.left + left;
|
|
1614
|
+
let arrowLeftValue = targetRect.left + targetWidth / 2 - panelViewportLeft;
|
|
1615
|
+
if (panelWidth > 0) {
|
|
1616
|
+
const arrowHalf = 5;
|
|
1617
|
+
const minArrow = arrowHalf;
|
|
1618
|
+
const maxArrow = panelWidth - arrowHalf;
|
|
1619
|
+
arrowLeftValue = Math.max(minArrow, Math.min(maxArrow, arrowLeftValue));
|
|
1621
1620
|
}
|
|
1621
|
+
arrowLeft = arrowLeftValue;
|
|
1622
1622
|
}
|
|
1623
1623
|
}
|
|
1624
1624
|
return {
|
package/lib/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(B,$){typeof module=="object"&&typeof module.exports=="object"?module.exports=$(require("vue"),require("xe-utils")):typeof define=="function"&&define.amd?define(["vue","xe-utils"],$):(B=typeof globalThis!="undefined"?globalThis:B||self,B.VxeUI=$(B.Vue,B.XEUtils))})(this,function(B,$){var be={vue:B,"xe-utils":$},f=function(e){return be[e]!==void 0?be[e]:typeof window!="undefined"&&window[e]?window[e]:typeof globalThis!="undefined"&&globalThis[e]?globalThis[e]:be[e]},ve={exports:{}},Ar=ve.exports,sr=Object.create,q=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,lr=Object.getOwnPropertyNames,ar=Object.getPrototypeOf,cr=Object.prototype.hasOwnProperty,ur=(e,t,r)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fr=(e,t)=>{for(var r in t)q(e,r,{get:t[r],enumerable:!0})},je=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of lr(t))!cr.call(e,o)&&o!==r&&q(e,o,{get:()=>t[o],enumerable:!(n=ir(t,o))||n.enumerable});return e},p=(e,t,r)=>(r=e!=null?sr(ar(e)):{},je(t||!e||!e.__esModule?q(r,"default",{value:e,enumerable:!0}):r,e)),dr=e=>je(q({},"__esModule",{value:!0}),e),E=(e,t,r)=>ur(e,typeof t!="symbol"?t+"":t,r),ze={};fr(ze,{GLOBAL_EVENT_KEYS:()=>R,VxeCore:()=>L,VxeUI:()=>de,baseUtils:()=>Wt,checkVersion:()=>nr,clipboard:()=>Pt,commands:()=>Be,component:()=>tr,coreVersion:()=>Fe,createEvent:()=>gt,dbUtils:()=>Rt,default:()=>Rr,domUtils:()=>Ht,formats:()=>Re,getComponent:()=>Qt,getConfig:()=>it,getI18n:()=>De,getIcon:()=>Ie,getLanguage:()=>It,getSlotVNs:()=>ye,getTheme:()=>ot,globalEvents:()=>pt,globalResize:()=>xt,globalStore:()=>lt,handleCheckInfo:()=>ne,hasComponent:()=>er,hasLanguage:()=>yt,hooks:()=>zt,interceptor:()=>te,log:()=>I,menus:()=>We,permission:()=>Dt,popperUtils:()=>jt,renderCustomIcon:()=>Oe,renderEmptyElement:()=>rr,renderGlobalIcon:()=>ft,renderer:()=>M,scrollbarUtils:()=>Ae,setConfig:()=>st,setI18n:()=>Tt,setIcon:()=>ut,setLanguage:()=>_t,setTheme:()=>se,use:()=>Zt,useFns:()=>Gt,useInitVScrollbar:()=>Kt,usePermission:()=>$t,useSize:()=>Yt,useVScrollbar:()=>qt,validators:()=>Le,zIndex:()=>Nt}),ve.exports=dr(ze);var Fe="4.5.11",L={coreVersion:Fe,uiVersion:"",tableVersion:"",designVersion:"",ganttVersion:""},hr=f("vue"),Xe=p(f("xe-utils")),j=null,Ee=null,W=null,Ue="z-index-manage",k=null,Ye="z-index-style",$e="m",qe="s",K={m:1e3,s:1e3};function xe(){return j||typeof document!="undefined"&&(j=document),j}function Ke(){return j&&!Ee&&(Ee=j.body||j.getElementsByTagName("body")[0]),Ee}function mr(){let e=0;if(xe()){const r=Ke();if(r){const n=r.getElementsByTagName("*");for(let o=0;o<n.length;o++){const s=n[o];if(s&&s.style&&s.nodeType===1){const l=s.style.zIndex;l&&/^\d+$/.test(l)&&(e=Math.max(e,Number(l)))}}}}return e}function gr(){if(!k){const e=xe();e&&(k=e.getElementById(Ye),k||(k=e.createElement("style"),k.id=Ye,e.getElementsByTagName("head")[0].appendChild(k)))}return k}function Ge(){const e=gr();if(e){const t="--dom-",r="-z-index";e.innerHTML=":root{"+t+"main"+r+":"+oe()+";"+t+"sub"+r+":"+_e()+"}"}}function Je(){if(!W){const e=xe();if(e&&(W=e.getElementById(Ue),!W)){const t=Ke();t&&(W=e.createElement("div"),W.id=Ue,W.style.display="none",t.appendChild(W),we(K.m),Se(K.s))}}return W}function Ze(e){return function(t){if(t){t=Number(t),K[e]=t;const r=Je();r&&(r.dataset?r.dataset[e]=t+"":r.setAttribute("data-"+e,t+""))}return Ge(),K[e]}}var we=Ze($e);function Qe(e,t){return function(n){let o;const s=Je();if(s){const l=s.dataset?s.dataset[e]:s.getAttribute("data-"+e);l&&(o=Number(l))}return o||(o=K[e]),n?Number(n)<o?t():n:o}}var oe=Qe($e,et);function et(){return we(oe()+1)}var Se=Ze(qe),tt=Qe(qe,rt);function _e(){return oe()+tt()}function rt(){return Se(tt()+1),_e()}var pr={setCurrent:we,getCurrent:oe,getNext:et,setSubCurrent:Se,getSubCurrent:_e,getSubNext:rt,getMax:mr};Ge();var G=pr,H={size:"",version:1,zIndex:999,resizeInterval:500},nt={theme:""};function se(e){const t=!e||e==="default"?"light":e;if(nt.theme=t,typeof document!="undefined"){const r=document.documentElement;r&&r.setAttribute("data-vxe-ui-theme",t)}return L}function ot(){return nt.theme}function st(e){return e&&(e.zIndex&&G.setCurrent(e.zIndex),e.theme&&se(e.theme),Xe.default.merge(H,e)),L}function it(e,t){return arguments.length?Xe.default.get(H,e,t):H}var lt={},at=f("vue"),ct=p(f("xe-utils")),Te={},br=p(f("xe-utils"));function ye(e){return br.default.isArray(e)?e:e?[e]:[]}function ut(e){return e&&Object.assign(Te,e),L}function Ie(e){return arguments.length?ct.default.get(Te,e):Te}function ft(e){const t=Ie(e);return Oe(t,e)}function Oe(e,t){return ct.default.isFunction(e)?(0,at.h)("span",{},ye(e({name:t}))):(0,at.h)("i",{class:e})}var J=p(f("xe-utils")),R={F2:"F2",F10:"F10",TAB:"Tab",ESCAPE:"Escape",ENTER:"Enter",DELETE:"Delete",BACKSPACE:"Backspace",SPACEBAR:" ",CONTEXT_MENU:"ContextMenu",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",HOME:"Home",END:"End",PROCESS:"Process",A:"A",X:"X",C:"C",V:"V",D:"D",F:"F",H:"H",M:"M",Y:"Y",Z:"Z",R:"R",P:"P"},Ce=J.default.browse(),dt={" ":"Spacebar",Apps:R.CONTEXT_MENU,Del:R.DELETE,Up:R.ARROW_UP,Down:R.ARROW_DOWN,Left:R.ARROW_LEFT,Right:R.ARROW_RIGHT},ht=Ce.firefox?"DOMMouseScroll":"mousewheel",Pe=[];function y(e){const t=e.type===ht;Pe.forEach(({type:r,cb:n})=>{e.cancelBubble||(r===e.type||t&&r==="mousewheel")&&n(e)})}var mt=class{constructor(e,t,r){E(this,"$event"),E(this,"type",""),E(this,"key",""),E(this,"code",""),this.$event=e,e&&(e.type&&(this.type=e.type),e.key&&(this.key=e.key),e.code&&(this.code=e.code)),Object.assign(this,t),J.default.objectEach(r,(n,o)=>{if(J.default.isFunction(n)){let s=null,l=!1;Object.defineProperty(this,o,{get(){return l||(l=!0,s=n()),s}})}else this[o]=n})}stopPropagation(){const e=this.$event;e&&e.stopPropagation()}preventDefault(){const e=this.$event;e&&e.preventDefault()}},gt=(e,t,r)=>(e instanceof mt&&(e=e.$event),new mt(e,t,r)),pt={on(e,t,r){Pe.push({comp:e,type:t,cb:r})},off(e,t){J.default.remove(Pe,r=>r.comp===e&&r.type===t)},hasKey(e,t){if(!t)return!1;const{key:r}=e;return t=t.toLowerCase(),r?t===r.toLowerCase()||!!(dt[r]&&dt[r].toLowerCase()===t):!1},hasControlKey(e){return e.ctrlKey||e.metaKey}};Ce.isDoc&&(Ce.msie||(window.addEventListener("copy",y,!1),window.addEventListener("cut",y,!1),window.addEventListener("paste",y,!1)),document.addEventListener("scroll",y,!0),document.addEventListener("keydown",y,!1),document.addEventListener("contextmenu",y,!1),window.addEventListener("mousedown",y,!1),window.addEventListener("click",y,!1),window.addEventListener("blur",y,!1),window.addEventListener("resize",y,!1),window.addEventListener(ht,J.default.throttle(y,100,{leading:!0,trailing:!1}),{passive:!0,capture:!1}));var bt=p(f("xe-utils")),vt,A=[],vr=500;function Er(){A.length&&(A.forEach(e=>{e.tarList.forEach(t=>{const{target:r,width:n,heighe:o}=t,s=r.clientWidth,l=r.clientHeight;(s&&n!==s||l&&o!==l)&&(t.width=s,t.heighe=l,setTimeout(e.callback))})}),Et())}function Et(){clearTimeout(vt),vt=setTimeout(Er,H.resizeInterval||vr)}var xr=class{constructor(e){E(this,"tarList",[]),E(this,"callback"),this.callback=e}observe(e){if(e){const{tarList:t}=this;t.some(r=>r.target===e)||t.push({target:e,width:e.clientWidth,heighe:e.clientHeight}),A.length||Et(),A.some(r=>r===this)||A.push(this)}}unobserve(e){bt.default.remove(A,t=>t.tarList.some(r=>r.target===e))}disconnect(){bt.default.remove(A,e=>e===this)}},xt={create(e){return window.ResizeObserver?new window.ResizeObserver(e):new xr(e)}},wt=p(f("xe-utils")),wr=f("vue"),z=(0,wr.reactive)({language:"",langMaps:{}}),St=!1,ie={};function Sr(e){return e&&e.__esModule?e.default:e}function De(e,t){const{langMaps:r,language:n}=z,{i18n:o}=H;if(o)return`${o(e,t)||""}`;if(St||(r[n]||console.error(`[vxe core] 语言包未安装。Language not installed. https://${L.uiVersion?"vxeui.com":"vxetable.cn"}/#/start/i18n`),St=!0),!t&&ie[e])return ie[e];const s=wt.default.toFormatString(wt.default.get(r[n],e,e),t);return t||(ie[e]=s),s}function _t(e){const{language:t}=z,r=e||"zh-CN";return t!==r&&(z.language=r,ie={}),L}function Tt(e,t){return z.langMaps[e]=Object.assign({},Sr(t)),L}function yt(e){const{langMaps:t}=z;return!!t[e]}function It(){const{language:e}=z;return e}var le=p(f("xe-utils"));function Ne(e,t){return function(r,n){const o=`[vxe ${t||""}] ${De(r,n)}`;return console[e](o),o}}var Ot="4.5.11",I={create:Ne,warn:Ne("warn",`v${Ot}`),err:Ne("error",`v${Ot}`)},Z={},M={mixin(e){return le.default.each(e,(t,r)=>{M.add(r,t)}),M},get(e){return Z[e]||null},add(e,t){if(e&&t){const r=Z[e];r?(le.default.each(t,(n,o)=>{!le.default.eqNull(r[o])&&r[o]!==n&&I.warn("vxe.error.coverProp",[`Renderer.${e}`,o])}),Object.assign(r,t)):Z[e]=t}return M},forEach(e){return le.default.objectEach(Z,e),M},delete(e){return delete Z[e],M}},Q=p(f("xe-utils")),_r=class{constructor(){E(this,"store",{})}mixin(e){return Q.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e],n=Q.default.keys(r);return Q.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?Q.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){Q.default.objectEach(this.store,e)}},Ct=_r,Le=new Ct;Object.assign(Le,{_name:"Validators"});var F=p(f("xe-utils")),Tr=class{constructor(){E(this,"store",{})}mixin(e){return F.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e];F.default.isFunction(t)&&(I.warn("vxe.error.delProp",["menus -> callback","menuMethod"]),t={menuMethod:t});const n=F.default.keys(r);return F.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?F.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){F.default.objectEach(this.store,e)}},We=new Tr;Object.assign(We,{_name:"Menus"});var X=p(f("xe-utils")),yr=class{constructor(){E(this,"store",{})}mixin(e){return X.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e];X.default.isFunction(t)&&(I.warn("vxe.error.delProp",["formats -> callback","cellFormatMethod"]),t={cellFormatMethod:t});const n=X.default.keys(r);return X.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?X.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){X.default.objectEach(this.store,e)}},Re=new yr;Object.assign(Re,{_name:"Formats"});var U=p(f("xe-utils")),Ir=class{constructor(){E(this,"store",{})}mixin(e){return U.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e];U.default.isFunction(t)&&(I.warn("vxe.error.delProp",["commands -> callback","commandMethod"]),t={commandMethod:t});const n=U.default.keys(r);return U.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?U.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){U.default.objectEach(this.store,e)}},Be=new Ir;Object.assign(Be,{_name:"Commands"});var ae=p(f("xe-utils")),ee={},te={mixin(e){return ae.default.each(e,(t,r)=>{te.add(r,t)}),te},get(e){return e?ee[e]||[]:[]},add(e,t){ae.default.isFunction(t)&&(t={tableInterceptorMethod:t});const r=t.tableInterceptorMethod;if(r){let n=ee[e];n||(n=ee[e]=[]),n.indexOf(r)>-1&&I.warn("vxe.error.coverProp",["Interceptor",e]),n.push(r)}return te},delete(e,t){const r=ee[e];if(r){ae.default.isFunction(t)&&(t={tableInterceptorMethod:t});const n=t?t.tableInterceptorMethod:null;n?ae.default.remove(r,o=>o===n):delete ee[e]}}},Or=p(f("xe-utils")),C,re={text:"",html:""};function Cr(e){if(!C){C=document.createElement("textarea"),C.id="$VxeCopy";const t=C.style;t.width="48px",t.height="24px",t.position="fixed",t.zIndex="0",t.left="-500px",t.top="-500px",document.body.appendChild(C)}C.value=e}var Pt={getStore(){return re},setStore(e){Object.assign(re,e||{})},copy(e){let t=!1;try{const r=Or.default.toValueString(e);Cr(r),C.select(),C.setSelectionRange(0,C.value.length),t=document.execCommand("copy"),C.blur(),re.text=r,re.html=""}catch(r){}return t},getText(){return re.text||""}},Pr=p(f("xe-utils"));function ne(e,t){let r=!0,n=!1;const o=t||H.permissionMethod;if(e&&o){r=!1,n=!0;let l=!1,w=!1;const _=String(e).split("|");for(let x=0;x<_.length;x++){const he=_[x];let S=!0,d=!1;const T=o({code:he});if(Pr.default.isBoolean(T)?S=T:T&&(S=!!T.visible,d=!!T.disabled),!d&&!w&&(w=!0,n=d),S&&!l&&(l=!0,r=S),l&&w)break}}return{code:e,visible:r,disabled:n}}var Dt={getCheckInfo(e){return ne(e)},checkVisible(e){return ne(e).visible},checkDisable(e){return ne(e).disabled}},Nt={next(){return G.getNext()},getLast(){return G.getCurrent()},nextSub(){return G.getSubNext()},getSubLast(){return G.getSubCurrent()}},Lt=p(f("xe-utils")),Wt={getStrVal(e){return Lt.default.eqNull(e)?"":""+e},isEmptyVal(e){return e==null||e===""},getDefVal(e,t){return Lt.default.eqNull(e)?t:e},isEnabled(e){return!!(e&&e.enabled!==!1)},hasEnableConf(e,t){return!!(t&&(e?t.enabled!==!1:t.enabled))}},ce=p(f("xe-utils")),Dr=class{constructor(e,t){E(this,"storeName","vxe_storage"),E(this,"key"),E(this,"version"),E(this,"dbPromise",null),E(this,"dbName",""),this.key=e,this.version=t}getDBName(){return`${this.key}_${this.version}`}resetDB(){this.dbPromise=null,this.dbName=""}openDB(){const e=this.getDBName();return this.dbPromise&&this.dbName===e?this.dbPromise:(this.dbName=e,this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close(),this.resetDB()},o.onclose=()=>{this.resetDB()},t(o)},n.onerror=()=>{r(n.error||new Error(`IdbStore open failed: ${e}`))},n.onblocked=()=>{console.warn(`[IdbStore] open blocked: ${e}`)}}).catch(t=>{throw this.resetDB(),t}),this.dbPromise)}getById(e){return this.openDB().then(t=>new Promise((r,n)=>{const o=t.transaction(this.storeName,"readonly").objectStore(this.storeName).get(e);o.onsuccess=()=>r(o.result),o.onerror=()=>n(o.error)}))}getAll(){return this.openDB().then(e=>new Promise((t,r)=>{const n=e.transaction(this.storeName,"readonly").objectStore(this.storeName);if(ce.default.isFunction(n.getAll)){const l=n.getAll();l.onsuccess=()=>t(l.result||[]),l.onerror=()=>r(l.error);return}const o=[],s=n.openCursor();s.onsuccess=()=>{const l=s.result;l?(o.push(l.value),l.continue()):t(o)},s.onerror=()=>r(s.error)}))}updateById(e,t){return t==null?this.deleteById(e):this.openDB().then(r=>new Promise((n,o)=>{const s=r.transaction(this.storeName,"readwrite");s.objectStore(this.storeName).put({id:e,data:t}),s.oncomplete=()=>n(),s.onerror=()=>o(s.error)}))}deleteById(e){return this.openDB().then(t=>new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite");o.objectStore(this.storeName).delete(e),o.oncomplete=()=>r(),o.onerror=()=>n(o.error)}))}clear(){return this.openDB().then(e=>new Promise((t,r)=>{const n=e.transaction(this.storeName,"readwrite");n.objectStore(this.storeName).clear(),n.oncomplete=()=>t(),n.onerror=()=>r(n.error)}))}cleanupOldDBs(){if(!indexedDB.databases)return Promise.resolve();const e=this.getDBName(),t=`${this.key}_`;return indexedDB.databases().then(r=>{r.forEach(n=>{const o=n.name;if(!o||o===e||!o.startsWith(t))return;o.slice(t.length).includes("_")||indexedDB.deleteDatabase(o)})})}},Nr=class{constructor(e,t){E(this,"key"),E(this,"version"),this.key=e,this.version=t}readAll(){const e=ce.default.toStringJSON(localStorage.getItem(this.key)||"");return e&&String(e._v)===String(this.version)?e:{_v:this.version}}writeAll(e){localStorage.setItem(this.key,ce.default.toJSONString(e))}getById(e){const t=this.readAll(),r=Object.prototype.hasOwnProperty.call(t,e);return Promise.resolve(r&&t[e]!=null?{id:e,data:t[e]}:void 0)}getAll(){const e=this.readAll(),t=[];return Object.keys(e).forEach(r=>{r!=="_v"&&e[r]!=null&&t.push({id:r,data:e[r]})}),Promise.resolve(t)}updateById(e,t){if(t==null)return this.deleteById(e);const r=this.readAll();return r[e]=t,this.writeAll(r),Promise.resolve()}deleteById(e){const t=this.readAll();return delete t[e],this.writeAll(t),Promise.resolve()}clear(){return this.writeAll({_v:this.version}),Promise.resolve()}cleanupOldDBs(){const e=localStorage.getItem(this.key);if(!e)return Promise.resolve();const t=ce.default.toStringJSON(e);return(!t||String(t._v)!==String(this.version))&&localStorage.removeItem(this.key),Promise.resolve()}},Rt={createStore(e,t){const r=Object.assign({},t),n=r.version||H.version||0,o=r.driver;return(!o||o==="indexedDB")&&typeof indexedDB!="undefined"?new Dr(e,n):new Nr(e,n)}},Lr=p(f("xe-utils")),ke={};function Bt(e){return ke[e]||(ke[e]=new RegExp(`(?:^|\\s)${e}(?!\\S)`,"g")),ke[e]}function He(e,t){return e?e.classList?e.classList.contains(t):!!(e.className&&e.className.match&&e.className.match(Bt(t))):!1}function kt(e,t){e&&He(e,t)&&(e.className=e.className.replace(Bt(t),""))}var Ht={isPx(e){return e&&/^\d+(\.\d+)?(px)?$/.test(e)},isScale(e){return e&&/^\d+(\.\d+)?%$/.test(e)},hasClass:He,removeClass:kt,addClass(e,t){e&&!He(e,t)&&(kt(e,t),e.className=e.className+" "+t)},buildClass(e,t){const r=[];if(e)for(let n=0;n<e.length;n++){const o=e[n];o&&r.push(""+o)}return Lr.default.each(t,(n,o)=>{n&&r.push(o)}),r.join(" ")}},Ae={getThumbSize(e,t,r){if(t<=e)return 0;const n=e/t,o=r*n;return Math.max(20,Math.min(o,r))},getThumbOffsetSize(e,t,r,n,o){const s=r-t;if(s<=0)return 0;const l=n-o;return l<=0?0:Math.min(Math.max(e,0),s)/s*l},getScrollFromClick(e,t,r,n,o){const s=n-o,l=r-t;if(l<=0||s<=0)return 0;let w=e-o/2;return w=Math.min(Math.max(w,0),s),w/s*l},getScrollFromDrag(e,t,r,n,o,s){const l=n-r,w=o-s;if(l<=0||w<=0)return 0;let _=e-t;return _=Math.min(Math.max(_,0),w),_/w*l}},Y=p(f("xe-utils"));function At(e){if(!e)return null;const t=document.body,r=e.parentElement;return(r===t?document.documentElement:r)||null}function Mt(e){return(e&&Y.default.isFunction(e)?e({}):e)||"body"}function Vt(e){const t=Mt(e);return Y.default.isString(t)?document.querySelector(t)||document.body:t}var jt={updatePlacement(e,t,r){const{defaultTop:n,defaultLeft:o,placement:s,defaultPlacement:l,appendTo:w,teleportTo:_,marginSize:x,isMinWidth:he}=Object.assign({appendTo:"",teleportTo:!1,marginSize:12,isMinWidth:!0},r);let S="bottom",d="",T="",b=0,me="",i="";const u={};if(t&&e){const a=document.documentElement,h=At(_?Vt(w):t);if(h){const c=e.offsetWidth,m=e.offsetHeight,v=t.offsetWidth,g=t.offsetHeight,P=h.getBoundingClientRect(),ge=t.getBoundingClientRect(),or=e.getBoundingClientRect(),Ve=a.clientHeight,pe=a.clientWidth,Br=h.scrollLeft,D=h.scrollTop,kr=P.left,Hr=P.top,V=or.left,N=or.top;me=e.offsetWidth,_?(b=(o||V-(v-c)/2)-Br,d=(n||N+m)-D,s==="top"?(S="top",d=N-g):s||(l==="top"?(S="top",n||(d=N-g),d<x-D&&(S="bottom",d=N+m-D),d+g+x>Ve-D&&(S="top",d=N-g-D)):(d+g+x>Ve-D&&(S="top",d=N-g-D),d<x-D&&(S="bottom",d=N+m-D))),b+v+x>pe&&(b-=b+v+x-pe),b<x&&(b=x),d-=Hr,b-=kr):(s==="top"?(S="top",T=m):s||(d=m,N+m+g+x>Ve&&N-m-g>x&&(S="top",d="",T=m)),ge.left+ge.width+x>pe&&(b=-(ge.left+ge.width+x-pe))),Y.default.isNumber(d)&&(u.top=d+"px"),Y.default.isNumber(T)&&(u.bottom=T+"px"),Y.default.isNumber(b)&&(u.left=b+"px"),he&&Y.default.isNumber(me)&&(u.minWidth=me+"px"),b===V?c<=v&&(i=c/2):b<V&&(b+v>V+c?i=V-b+c/2:i=V-b+(v-(V-b))/2)}}return{top:d||0,bottom:T||0,left:b||0,arrowLeft:i||0,style:u,placement:S}},getWrapperElement:At,getAppendSelector:Mt,getAppendElement:Vt},zt=new Ct,Wr=p(f("xe-utils")),O=f("vue"),{getThumbOffsetSize:ue,getThumbSize:Ft,getScrollFromClick:Xt,getScrollFromDrag:Ut}=Ae;function Yt(e){const t=(0,O.inject)("xeSizeInfo",null),r=(0,O.computed)(()=>{const{size:n}=e;return n||(t?t.value:null)});return(0,O.provide)("xeSizeInfo",r),{computeSize:r}}function $t(e){return{computePermissionInfo:(0,O.computed)(()=>ne(e.permissionCode,e.permissionMethod))}}function qt(e){const t=(0,O.inject)("xeScrollbarInfo",null),r=(0,O.computed)(()=>{const{useScrollbar:n}=e;return Wr.default.isBoolean(n)?n:t?t.value:null});return(0,O.provide)("xeScrollbarInfo",r),{computeIsVScrollbar:r}}var Kt=e=>{const{reactData:t,internalData:r}=e,n=(0,O.ref)(),o=(0,O.ref)(),s=(0,O.ref)(),l=(0,O.ref)();return{refTrackXElem:n,refTrackYElem:o,refThumbXElem:s,refThumbYElem:l,updateThumbSize:()=>{const i=e.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const u=n.value,a=u?Ft(i.clientWidth,i.scrollWidth,u.clientWidth):0,h=s.value;h&&(h.style.width=a+"px"),t.xThumbWidth=a;const c=o.value,m=c?Ft(i.clientHeight,i.scrollHeight,c.clientHeight):0,v=l.value;v&&(v.style.height=m+"px"),t.yThumbHeight=m},updateThumbOffset:()=>{const i=e.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const{xThumbWidth:u,yThumbHeight:a}=t,h=n.value,c=s.value,m=h&&u?ue(i.scrollLeft,i.clientWidth,i.scrollWidth,h.clientWidth,u):0;r.xThumbLeft=m,c&&u&&(c.style.width=u+"px",c.style.transform=`translateX(${m}px)`);const v=o.value,g=l.value,P=v&&a?ue(i.scrollTop,i.clientHeight,i.scrollHeight,v.clientHeight,a):0;r.yThumbTop=P,g&&a&&(g.style.height=a+"px",g.style.transform=`translateY(${P}px)`)},clickTrackXEvent:i=>{const u=i.currentTarget;if(u!==i.target)return;const a=e.getScrollViewElem();if(!a)return;const{xThumbWidth:h}=t,c=u.getBoundingClientRect();a.scrollTo({left:Xt(i.clientX-c.left,a.clientWidth,a.scrollWidth,u.clientWidth,h),behavior:"auto"})},clickTrackYEvent:i=>{const u=i.currentTarget;if(u!==i.target)return;const a=e.getScrollViewElem();if(!a)return;const{yThumbHeight:h}=t,c=u.getBoundingClientRect();a.scrollTo({top:Xt(i.clientY-c.top,a.clientHeight,a.scrollHeight,u.clientHeight,h),behavior:"auto"})},pointerdownThumbXEvent:i=>{const u=i.currentTarget;r.isThumbDrag=!0,u.setPointerCapture(i.pointerId);const a=e.getScrollViewElem();if(!a)return;const{xThumbWidth:h}=t,c=u.parentElement,m=c.getBoundingClientRect(),v=i.clientX-m.left,g=ue(a.scrollLeft,a.clientWidth,a.scrollWidth,c.clientWidth,h);r.thumbDragOffset=v-g},pointermoveThumbXEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:a,thumbDragOffset:h}=r;if(a){const c=e.getScrollViewElem();if(!c)return;const{xThumbWidth:m}=t,g=i.currentTarget.parentElement,P=g.getBoundingClientRect();c.scrollLeft=Ut(i.clientX-P.left,h,c.clientWidth,c.scrollWidth,g.clientWidth,m)}},cleatPointerThumbEvent:i=>{i.currentTarget.releasePointerCapture(i.pointerId),r.isThumbDrag=!1},pointerdownThumbYEvent:i=>{const u=i.currentTarget;r.isThumbDrag=!0,u.setPointerCapture(i.pointerId);const a=e.getScrollViewElem();if(!a)return;const{yThumbHeight:h}=t,c=u.parentElement,m=c.getBoundingClientRect(),v=i.clientY-m.top,g=ue(a.scrollTop,a.clientHeight,a.scrollHeight,c.clientHeight,h);r.thumbDragOffset=v-g},pointermoveThumbYEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:a,thumbDragOffset:h}=r;if(a){const c=e.getScrollViewElem();if(!c)return;const{yThumbHeight:m}=t,g=i.currentTarget.parentElement,P=g.getBoundingClientRect();c.scrollTop=Ut(i.clientY-P.top,h,c.clientHeight,c.scrollHeight,g.clientHeight,m)}}}},Gt={useSize:Yt,useVScrollbar:qt,usePermission:$t,useInitVScrollbar:Kt},Me=p(f("xe-utils")),Jt=[];function Zt(e,t){return e&&e.install&&Jt.indexOf(e)===-1&&(e.install(de,t),Jt.push(e)),de}var fe={};function Qt(e){return fe[e]||null}function er(e){return!!fe[e]}function tr(e){e&&e.name&&(fe[e.name]=e,fe[Me.default.kebabCase(e.name)]=e)}function rr(){return(0,hr.createCommentVNode)()}function nr(e,t,r){if(e){const n=`${e}`.match(/(\d+).(\d+).(\d+)/);if(n){const o=Me.default.toNumber(n[1]);if(r){const s=Me.default.toNumber(n[2]);return o>=t&&s>=r}return o>=t}}return!1}var de=Object.assign(L,{renderEmptyElement:rr,setTheme:se,getTheme:ot,setConfig:st,getConfig:it,setIcon:ut,getIcon:Ie,renderGlobalIcon:ft,renderCustomIcon:Oe,setLanguage:_t,hasLanguage:yt,getLanguage:It,setI18n:Tt,getI18n:De,globalEvents:pt,GLOBAL_EVENT_KEYS:R,createEvent:gt,globalResize:xt,renderer:M,validators:Le,menus:We,formats:Re,commands:Be,interceptor:te,clipboard:Pt,log:I,permission:Dt,zIndex:Nt,baseUtils:Wt,dbUtils:Rt,domUtils:Ht,scrollbarUtils:Ae,popperUtils:jt,globalStore:lt,hooks:zt,component:tr,getComponent:Qt,hasComponent:er,useFns:Gt,getSlotVNs:ye,checkVersion:nr,use:Zt});se();var Rr=de;return ve.exports});
|
|
1
|
+
(function(B,Y){typeof module=="object"&&typeof module.exports=="object"?module.exports=Y(require("vue"),require("xe-utils")):typeof define=="function"&&define.amd?define(["vue","xe-utils"],Y):(B=typeof globalThis!="undefined"?globalThis:B||self,B.VxeUI=Y(B.Vue,B.XEUtils))})(this,function(B,Y){var pe={vue:B,"xe-utils":Y},f=function(e){return pe[e]!==void 0?pe[e]:typeof window!="undefined"&&window[e]?window[e]:typeof globalThis!="undefined"&&globalThis[e]?globalThis[e]:pe[e]},be={exports:{}},jr=be.exports,ir=Object.create,$=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,ar=Object.getOwnPropertyNames,cr=Object.getPrototypeOf,ur=Object.prototype.hasOwnProperty,fr=(e,t,r)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dr=(e,t)=>{for(var r in t)$(e,r,{get:t[r],enumerable:!0})},ze=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ar(t))!ur.call(e,o)&&o!==r&&$(e,o,{get:()=>t[o],enumerable:!(n=lr(t,o))||n.enumerable});return e},p=(e,t,r)=>(r=e!=null?ir(cr(e)):{},ze(t||!e||!e.__esModule?$(r,"default",{value:e,enumerable:!0}):r,e)),hr=e=>ze($({},"__esModule",{value:!0}),e),b=(e,t,r)=>fr(e,typeof t!="symbol"?t+"":t,r),Fe={};dr(Fe,{GLOBAL_EVENT_KEYS:()=>R,VxeCore:()=>L,VxeUI:()=>de,baseUtils:()=>Rt,checkVersion:()=>or,clipboard:()=>Dt,commands:()=>Re,component:()=>rr,coreVersion:()=>Xe,createEvent:()=>pt,dbUtils:()=>Bt,default:()=>Br,domUtils:()=>At,formats:()=>We,getComponent:()=>er,getConfig:()=>lt,getI18n:()=>Pe,getIcon:()=>ye,getLanguage:()=>Ot,getSlotVNs:()=>Te,getTheme:()=>st,globalEvents:()=>bt,globalResize:()=>wt,globalStore:()=>at,handleCheckInfo:()=>re,hasComponent:()=>tr,hasLanguage:()=>It,hooks:()=>Ft,interceptor:()=>ee,log:()=>I,menus:()=>Le,permission:()=>Nt,popperUtils:()=>zt,renderCustomIcon:()=>Ie,renderEmptyElement:()=>nr,renderGlobalIcon:()=>dt,renderer:()=>M,scrollbarUtils:()=>He,setConfig:()=>it,setI18n:()=>yt,setIcon:()=>ft,setLanguage:()=>Tt,setTheme:()=>se,use:()=>Qt,useFns:()=>Jt,useInitVScrollbar:()=>Gt,usePermission:()=>qt,useSize:()=>$t,useVScrollbar:()=>Kt,validators:()=>Ne,zIndex:()=>Lt}),be.exports=hr(Fe);var Xe="4.5.12",L={coreVersion:Xe,uiVersion:"",tableVersion:"",designVersion:"",ganttVersion:""},mr=f("vue"),Ue=p(f("xe-utils")),V=null,ve=null,W=null,Ye="z-index-manage",k=null,$e="z-index-style",qe="m",Ke="s",q={m:1e3,s:1e3};function xe(){return V||typeof document!="undefined"&&(V=document),V}function Ge(){return V&&!ve&&(ve=V.body||V.getElementsByTagName("body")[0]),ve}function gr(){let e=0;if(xe()){const r=Ge();if(r){const n=r.getElementsByTagName("*");for(let o=0;o<n.length;o++){const s=n[o];if(s&&s.style&&s.nodeType===1){const l=s.style.zIndex;l&&/^\d+$/.test(l)&&(e=Math.max(e,Number(l)))}}}}return e}function pr(){if(!k){const e=xe();e&&(k=e.getElementById($e),k||(k=e.createElement("style"),k.id=$e,e.getElementsByTagName("head")[0].appendChild(k)))}return k}function Je(){const e=pr();if(e){const t="--dom-",r="-z-index";e.innerHTML=":root{"+t+"main"+r+":"+oe()+";"+t+"sub"+r+":"+Se()+"}"}}function Ze(){if(!W){const e=xe();if(e&&(W=e.getElementById(Ye),!W)){const t=Ge();t&&(W=e.createElement("div"),W.id=Ye,W.style.display="none",t.appendChild(W),Ee(q.m),we(q.s))}}return W}function Qe(e){return function(t){if(t){t=Number(t),q[e]=t;const r=Ze();r&&(r.dataset?r.dataset[e]=t+"":r.setAttribute("data-"+e,t+""))}return Je(),q[e]}}var Ee=Qe(qe);function et(e,t){return function(n){let o;const s=Ze();if(s){const l=s.dataset?s.dataset[e]:s.getAttribute("data-"+e);l&&(o=Number(l))}return o||(o=q[e]),n?Number(n)<o?t():n:o}}var oe=et(qe,tt);function tt(){return Ee(oe()+1)}var we=Qe(Ke),rt=et(Ke,nt);function Se(){return oe()+rt()}function nt(){return we(rt()+1),Se()}var br={setCurrent:Ee,getCurrent:oe,getNext:tt,setSubCurrent:we,getSubCurrent:Se,getSubNext:nt,getMax:gr};Je();var K=br,H={size:"",version:1,zIndex:999,resizeInterval:500},ot={theme:""};function se(e){const t=!e||e==="default"?"light":e;if(ot.theme=t,typeof document!="undefined"){const r=document.documentElement;r&&r.setAttribute("data-vxe-ui-theme",t)}return L}function st(){return ot.theme}function it(e){return e&&(e.zIndex&&K.setCurrent(e.zIndex),e.theme&&se(e.theme),Ue.default.merge(H,e)),L}function lt(e,t){return arguments.length?Ue.default.get(H,e,t):H}var at={},ct=f("vue"),ut=p(f("xe-utils")),_e={},vr=p(f("xe-utils"));function Te(e){return vr.default.isArray(e)?e:e?[e]:[]}function ft(e){return e&&Object.assign(_e,e),L}function ye(e){return arguments.length?ut.default.get(_e,e):_e}function dt(e){const t=ye(e);return Ie(t,e)}function Ie(e,t){return ut.default.isFunction(e)?(0,ct.h)("span",{},Te(e({name:t}))):(0,ct.h)("i",{class:e})}var G=p(f("xe-utils")),R={F2:"F2",F10:"F10",TAB:"Tab",ESCAPE:"Escape",ENTER:"Enter",DELETE:"Delete",BACKSPACE:"Backspace",SPACEBAR:" ",CONTEXT_MENU:"ContextMenu",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",HOME:"Home",END:"End",PROCESS:"Process",A:"A",X:"X",C:"C",V:"V",D:"D",F:"F",H:"H",M:"M",Y:"Y",Z:"Z",R:"R",P:"P"},Oe=G.default.browse(),ht={" ":"Spacebar",Apps:R.CONTEXT_MENU,Del:R.DELETE,Up:R.ARROW_UP,Down:R.ARROW_DOWN,Left:R.ARROW_LEFT,Right:R.ARROW_RIGHT},mt=Oe.firefox?"DOMMouseScroll":"mousewheel",Ce=[];function y(e){const t=e.type===mt;Ce.forEach(({type:r,cb:n})=>{e.cancelBubble||(r===e.type||t&&r==="mousewheel")&&n(e)})}var gt=class{constructor(e,t,r){b(this,"$event"),b(this,"type",""),b(this,"key",""),b(this,"code",""),this.$event=e,e&&(e.type&&(this.type=e.type),e.key&&(this.key=e.key),e.code&&(this.code=e.code)),Object.assign(this,t),G.default.objectEach(r,(n,o)=>{if(G.default.isFunction(n)){let s=null,l=!1;Object.defineProperty(this,o,{get(){return l||(l=!0,s=n()),s}})}else this[o]=n})}stopPropagation(){const e=this.$event;e&&e.stopPropagation()}preventDefault(){const e=this.$event;e&&e.preventDefault()}},pt=(e,t,r)=>(e instanceof gt&&(e=e.$event),new gt(e,t,r)),bt={on(e,t,r){Ce.push({comp:e,type:t,cb:r})},off(e,t){G.default.remove(Ce,r=>r.comp===e&&r.type===t)},hasKey(e,t){if(!t)return!1;const{key:r}=e;return t=t.toLowerCase(),r?t===r.toLowerCase()||!!(ht[r]&&ht[r].toLowerCase()===t):!1},hasControlKey(e){return e.ctrlKey||e.metaKey}};Oe.isDoc&&(Oe.msie||(window.addEventListener("copy",y,!1),window.addEventListener("cut",y,!1),window.addEventListener("paste",y,!1)),document.addEventListener("scroll",y,!0),document.addEventListener("keydown",y,!1),document.addEventListener("contextmenu",y,!1),window.addEventListener("mousedown",y,!1),window.addEventListener("click",y,!1),window.addEventListener("blur",y,!1),window.addEventListener("resize",y,!1),window.addEventListener(mt,G.default.throttle(y,100,{leading:!0,trailing:!1}),{passive:!0,capture:!1}));var vt=p(f("xe-utils")),xt,A=[],xr=500;function Er(){A.length&&(A.forEach(e=>{e.tarList.forEach(t=>{const{target:r,width:n,heighe:o}=t,s=r.clientWidth,l=r.clientHeight;(s&&n!==s||l&&o!==l)&&(t.width=s,t.heighe=l,setTimeout(e.callback))})}),Et())}function Et(){clearTimeout(xt),xt=setTimeout(Er,H.resizeInterval||xr)}var wr=class{constructor(e){b(this,"tarList",[]),b(this,"callback"),this.callback=e}observe(e){if(e){const{tarList:t}=this;t.some(r=>r.target===e)||t.push({target:e,width:e.clientWidth,heighe:e.clientHeight}),A.length||Et(),A.some(r=>r===this)||A.push(this)}}unobserve(e){vt.default.remove(A,t=>t.tarList.some(r=>r.target===e))}disconnect(){vt.default.remove(A,e=>e===this)}},wt={create(e){return window.ResizeObserver?new window.ResizeObserver(e):new wr(e)}},St=p(f("xe-utils")),Sr=f("vue"),j=(0,Sr.reactive)({language:"",langMaps:{}}),_t=!1,ie={};function _r(e){return e&&e.__esModule?e.default:e}function Pe(e,t){const{langMaps:r,language:n}=j,{i18n:o}=H;if(o)return`${o(e,t)||""}`;if(_t||(r[n]||console.error(`[vxe core] 语言包未安装。Language not installed. https://${L.uiVersion?"vxeui.com":"vxetable.cn"}/#/start/i18n`),_t=!0),!t&&ie[e])return ie[e];const s=St.default.toFormatString(St.default.get(r[n],e,e),t);return t||(ie[e]=s),s}function Tt(e){const{language:t}=j,r=e||"zh-CN";return t!==r&&(j.language=r,ie={}),L}function yt(e,t){return j.langMaps[e]=Object.assign({},_r(t)),L}function It(e){const{langMaps:t}=j;return!!t[e]}function Ot(){const{language:e}=j;return e}var le=p(f("xe-utils"));function De(e,t){return function(r,n){const o=`[vxe ${t||""}] ${Pe(r,n)}`;return console[e](o),o}}var Ct="4.5.12",I={create:De,warn:De("warn",`v${Ct}`),err:De("error",`v${Ct}`)},J={},M={mixin(e){return le.default.each(e,(t,r)=>{M.add(r,t)}),M},get(e){return J[e]||null},add(e,t){if(e&&t){const r=J[e];r?(le.default.each(t,(n,o)=>{!le.default.eqNull(r[o])&&r[o]!==n&&I.warn("vxe.error.coverProp",[`Renderer.${e}`,o])}),Object.assign(r,t)):J[e]=t}return M},forEach(e){return le.default.objectEach(J,e),M},delete(e){return delete J[e],M}},Z=p(f("xe-utils")),Tr=class{constructor(){b(this,"store",{})}mixin(e){return Z.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e],n=Z.default.keys(r);return Z.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?Z.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){Z.default.objectEach(this.store,e)}},Pt=Tr,Ne=new Pt;Object.assign(Ne,{_name:"Validators"});var z=p(f("xe-utils")),yr=class{constructor(){b(this,"store",{})}mixin(e){return z.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e];z.default.isFunction(t)&&(I.warn("vxe.error.delProp",["menus -> callback","menuMethod"]),t={menuMethod:t});const n=z.default.keys(r);return z.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?z.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){z.default.objectEach(this.store,e)}},Le=new yr;Object.assign(Le,{_name:"Menus"});var F=p(f("xe-utils")),Ir=class{constructor(){b(this,"store",{})}mixin(e){return F.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e];F.default.isFunction(t)&&(I.warn("vxe.error.delProp",["formats -> callback","cellFormatMethod"]),t={cellFormatMethod:t});const n=F.default.keys(r);return F.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?F.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){F.default.objectEach(this.store,e)}},We=new Ir;Object.assign(We,{_name:"Formats"});var X=p(f("xe-utils")),Or=class{constructor(){b(this,"store",{})}mixin(e){return X.default.each(e,(t,r)=>{this.add(r,t)}),this}has(e){return!!this.get(e)}get(e){return this.store[e]}add(e,t){const r=this.store[e];X.default.isFunction(t)&&(I.warn("vxe.error.delProp",["commands -> callback","commandMethod"]),t={commandMethod:t});const n=X.default.keys(r);return X.default.each(t,(o,s)=>{n.includes(s)&&I.warn("vxe.error.coverProp",[e,s])}),this.store[e]=r?X.default.merge(r,t):t,this}delete(e){delete this.store[e]}forEach(e){X.default.objectEach(this.store,e)}},Re=new Or;Object.assign(Re,{_name:"Commands"});var ae=p(f("xe-utils")),Q={},ee={mixin(e){return ae.default.each(e,(t,r)=>{ee.add(r,t)}),ee},get(e){return e?Q[e]||[]:[]},add(e,t){ae.default.isFunction(t)&&(t={tableInterceptorMethod:t});const r=t.tableInterceptorMethod;if(r){let n=Q[e];n||(n=Q[e]=[]),n.indexOf(r)>-1&&I.warn("vxe.error.coverProp",["Interceptor",e]),n.push(r)}return ee},delete(e,t){const r=Q[e];if(r){ae.default.isFunction(t)&&(t={tableInterceptorMethod:t});const n=t?t.tableInterceptorMethod:null;n?ae.default.remove(r,o=>o===n):delete Q[e]}}},Cr=p(f("xe-utils")),C,te={text:"",html:""};function Pr(e){if(!C){C=document.createElement("textarea"),C.id="$VxeCopy";const t=C.style;t.width="48px",t.height="24px",t.position="fixed",t.zIndex="0",t.left="-500px",t.top="-500px",document.body.appendChild(C)}C.value=e}var Dt={getStore(){return te},setStore(e){Object.assign(te,e||{})},copy(e){let t=!1;try{const r=Cr.default.toValueString(e);Pr(r),C.select(),C.setSelectionRange(0,C.value.length),t=document.execCommand("copy"),C.blur(),te.text=r,te.html=""}catch(r){}return t},getText(){return te.text||""}},Dr=p(f("xe-utils"));function re(e,t){let r=!0,n=!1;const o=t||H.permissionMethod;if(e&&o){r=!1,n=!0;let l=!1,E=!1;const S=String(e).split("|");for(let v=0;v<S.length;v++){const he=S[v];let w=!0,g=!1;const _=o({code:he});if(Dr.default.isBoolean(_)?w=_:_&&(w=!!_.visible,g=!!_.disabled),!g&&!E&&(E=!0,n=g),w&&!l&&(l=!0,r=w),l&&E)break}}return{code:e,visible:r,disabled:n}}var Nt={getCheckInfo(e){return re(e)},checkVisible(e){return re(e).visible},checkDisable(e){return re(e).disabled}},Lt={next(){return K.getNext()},getLast(){return K.getCurrent()},nextSub(){return K.getSubNext()},getSubLast(){return K.getSubCurrent()}},Wt=p(f("xe-utils")),Rt={getStrVal(e){return Wt.default.eqNull(e)?"":""+e},isEmptyVal(e){return e==null||e===""},getDefVal(e,t){return Wt.default.eqNull(e)?t:e},isEnabled(e){return!!(e&&e.enabled!==!1)},hasEnableConf(e,t){return!!(t&&(e?t.enabled!==!1:t.enabled))}},ce=p(f("xe-utils")),Nr=class{constructor(e,t){b(this,"storeName","vxe_storage"),b(this,"key"),b(this,"version"),b(this,"dbPromise",null),b(this,"dbName",""),this.key=e,this.version=t}getDBName(){return`${this.key}_${this.version}`}resetDB(){this.dbPromise=null,this.dbName=""}openDB(){const e=this.getDBName();return this.dbPromise&&this.dbName===e?this.dbPromise:(this.dbName=e,this.dbPromise=new Promise((t,r)=>{const n=indexedDB.open(e,1);n.onupgradeneeded=()=>{const o=n.result;o.objectStoreNames.contains(this.storeName)||o.createObjectStore(this.storeName,{keyPath:"id"})},n.onsuccess=()=>{const o=n.result;o.onversionchange=()=>{o.close(),this.resetDB()},o.onclose=()=>{this.resetDB()},t(o)},n.onerror=()=>{r(n.error||new Error(`IdbStore open failed: ${e}`))},n.onblocked=()=>{console.warn(`[IdbStore] open blocked: ${e}`)}}).catch(t=>{throw this.resetDB(),t}),this.dbPromise)}getById(e){return this.openDB().then(t=>new Promise((r,n)=>{const o=t.transaction(this.storeName,"readonly").objectStore(this.storeName).get(e);o.onsuccess=()=>r(o.result),o.onerror=()=>n(o.error)}))}getAll(){return this.openDB().then(e=>new Promise((t,r)=>{const n=e.transaction(this.storeName,"readonly").objectStore(this.storeName);if(ce.default.isFunction(n.getAll)){const l=n.getAll();l.onsuccess=()=>t(l.result||[]),l.onerror=()=>r(l.error);return}const o=[],s=n.openCursor();s.onsuccess=()=>{const l=s.result;l?(o.push(l.value),l.continue()):t(o)},s.onerror=()=>r(s.error)}))}updateById(e,t){return t==null?this.deleteById(e):this.openDB().then(r=>new Promise((n,o)=>{const s=r.transaction(this.storeName,"readwrite");s.objectStore(this.storeName).put({id:e,data:t}),s.oncomplete=()=>n(),s.onerror=()=>o(s.error)}))}deleteById(e){return this.openDB().then(t=>new Promise((r,n)=>{const o=t.transaction(this.storeName,"readwrite");o.objectStore(this.storeName).delete(e),o.oncomplete=()=>r(),o.onerror=()=>n(o.error)}))}clear(){return this.openDB().then(e=>new Promise((t,r)=>{const n=e.transaction(this.storeName,"readwrite");n.objectStore(this.storeName).clear(),n.oncomplete=()=>t(),n.onerror=()=>r(n.error)}))}cleanupOldDBs(){if(!indexedDB.databases)return Promise.resolve();const e=this.getDBName(),t=`${this.key}_`;return indexedDB.databases().then(r=>{r.forEach(n=>{const o=n.name;if(!o||o===e||!o.startsWith(t))return;o.slice(t.length).includes("_")||indexedDB.deleteDatabase(o)})})}},Lr=class{constructor(e,t){b(this,"key"),b(this,"version"),this.key=e,this.version=t}readAll(){const e=ce.default.toStringJSON(localStorage.getItem(this.key)||"");return e&&String(e._v)===String(this.version)?e:{_v:this.version}}writeAll(e){localStorage.setItem(this.key,ce.default.toJSONString(e))}getById(e){const t=this.readAll(),r=Object.prototype.hasOwnProperty.call(t,e);return Promise.resolve(r&&t[e]!=null?{id:e,data:t[e]}:void 0)}getAll(){const e=this.readAll(),t=[];return Object.keys(e).forEach(r=>{r!=="_v"&&e[r]!=null&&t.push({id:r,data:e[r]})}),Promise.resolve(t)}updateById(e,t){if(t==null)return this.deleteById(e);const r=this.readAll();return r[e]=t,this.writeAll(r),Promise.resolve()}deleteById(e){const t=this.readAll();return delete t[e],this.writeAll(t),Promise.resolve()}clear(){return this.writeAll({_v:this.version}),Promise.resolve()}cleanupOldDBs(){const e=localStorage.getItem(this.key);if(!e)return Promise.resolve();const t=ce.default.toStringJSON(e);return(!t||String(t._v)!==String(this.version))&&localStorage.removeItem(this.key),Promise.resolve()}},Bt={createStore(e,t){const r=Object.assign({},t),n=r.version||H.version||0,o=r.driver;return(!o||o==="indexedDB")&&typeof indexedDB!="undefined"?new Nr(e,n):new Lr(e,n)}},Wr=p(f("xe-utils")),Be={};function kt(e){return Be[e]||(Be[e]=new RegExp(`(?:^|\\s)${e}(?!\\S)`,"g")),Be[e]}function ke(e,t){return e?e.classList?e.classList.contains(t):!!(e.className&&e.className.match&&e.className.match(kt(t))):!1}function Ht(e,t){e&&ke(e,t)&&(e.className=e.className.replace(kt(t),""))}var At={isPx(e){return e&&/^\d+(\.\d+)?(px)?$/.test(e)},isScale(e){return e&&/^\d+(\.\d+)?%$/.test(e)},hasClass:ke,removeClass:Ht,addClass(e,t){e&&!ke(e,t)&&(Ht(e,t),e.className=e.className+" "+t)},buildClass(e,t){const r=[];if(e)for(let n=0;n<e.length;n++){const o=e[n];o&&r.push(""+o)}return Wr.default.each(t,(n,o)=>{n&&r.push(o)}),r.join(" ")}},He={getThumbSize(e,t,r){if(t<=e)return 0;const n=e/t,o=r*n;return Math.max(20,Math.min(o,r))},getThumbOffsetSize(e,t,r,n,o){const s=r-t;if(s<=0)return 0;const l=n-o;return l<=0?0:Math.min(Math.max(e,0),s)/s*l},getScrollFromClick(e,t,r,n,o){const s=n-o,l=r-t;if(l<=0||s<=0)return 0;let E=e-o/2;return E=Math.min(Math.max(E,0),s),E/s*l},getScrollFromDrag(e,t,r,n,o,s){const l=n-r,E=o-s;if(l<=0||E<=0)return 0;let S=e-t;return S=Math.min(Math.max(S,0),E),S/E*l}},U=p(f("xe-utils"));function Mt(e){if(!e)return null;const t=e.ownerDocument,r=t.body,n=e.parentElement;return n===r||n===t.documentElement?r:n||null}function Vt(e){return(e&&U.default.isFunction(e)?e({}):e)||"body"}function jt(e){const t=Vt(e);return U.default.isString(t)?document.querySelector(t)||document.body:t}var zt={updatePlacement(e,t,r){const{defaultTop:n,defaultLeft:o,placement:s,defaultPlacement:l,appendTo:E,teleportTo:S,marginSize:v,isMinWidth:he}=Object.assign({appendTo:"",teleportTo:!1,marginSize:18,isMinWidth:!0},r);let w="bottom",g="",_="",T=0,me="",i="";const c={};if(t&&e){const a=document.documentElement,d=Mt(S?jt(E):t);if(d){const u=e.offsetWidth,h=e.offsetHeight,x=t.offsetWidth,m=t.offsetHeight,P=d.getBoundingClientRect(),ne=t.getBoundingClientRect(),Me=e.getBoundingClientRect(),Ve=a.clientHeight,ge=a.clientWidth,kr=d.scrollLeft,D=d.scrollTop,sr=P.left,Hr=P.top,Ar=Me.left-sr,N=Me.top-Hr;me=e.offsetWidth,S?(T=(o||Ar-(x-u)/2)-kr,g=(n||N+h)-D,s==="top"?(w="top",g=N-m):s||(l==="top"?(w="top",n||(g=N-m),g<v-D&&(w="bottom",g=N+h-D),g+m+v>Ve-D&&(w="top",g=N-m-D)):(g+m+v>Ve-D&&(w="top",g=N-m-D),g<v-D&&(w="bottom",g=N+h-D))),T+x+v>ge&&(T=ge-x-v),T<v&&(T=v)):(s==="top"?(w="top",_=h):s||(g=h,N+h+m+v>Ve&&N-h-m>v&&(w="top",g="",_=h)),ne.left+ne.width+v>ge&&(T=-(ne.left+ne.width+v-ge))),U.default.isNumber(g)&&(c.top=g+"px"),U.default.isNumber(_)&&(c.bottom=_+"px"),U.default.isNumber(T)&&(c.left=T+"px"),he&&U.default.isNumber(me)&&(c.minWidth=me+"px");const Mr=S?sr+T:ne.left+T;let je=Me.left+u/2-Mr;if(x>0){const Vr=x-5;je=Math.max(5,Math.min(Vr,je))}i=je}}return{top:g||0,bottom:_||0,left:T||0,arrowLeft:i||0,style:c,placement:w}},getWrapperElement:Mt,getAppendSelector:Vt,getAppendElement:jt},Ft=new Pt,Rr=p(f("xe-utils")),O=f("vue"),{getThumbOffsetSize:ue,getThumbSize:Xt,getScrollFromClick:Ut,getScrollFromDrag:Yt}=He;function $t(e){const t=(0,O.inject)("xeSizeInfo",null),r=(0,O.computed)(()=>{const{size:n}=e;return n||(t?t.value:null)});return(0,O.provide)("xeSizeInfo",r),{computeSize:r}}function qt(e){return{computePermissionInfo:(0,O.computed)(()=>re(e.permissionCode,e.permissionMethod))}}function Kt(e){const t=(0,O.inject)("xeScrollbarInfo",null),r=(0,O.computed)(()=>{const{useScrollbar:n}=e;return Rr.default.isBoolean(n)?n:t?t.value:null});return(0,O.provide)("xeScrollbarInfo",r),{computeIsVScrollbar:r}}var Gt=e=>{const{reactData:t,internalData:r}=e,n=(0,O.ref)(),o=(0,O.ref)(),s=(0,O.ref)(),l=(0,O.ref)();return{refTrackXElem:n,refTrackYElem:o,refThumbXElem:s,refThumbYElem:l,updateThumbSize:()=>{const i=e.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const c=n.value,a=c?Xt(i.clientWidth,i.scrollWidth,c.clientWidth):0,d=s.value;d&&(d.style.width=a+"px"),t.xThumbWidth=a;const u=o.value,h=u?Xt(i.clientHeight,i.scrollHeight,u.clientHeight):0,x=l.value;x&&(x.style.height=h+"px"),t.yThumbHeight=h},updateThumbOffset:()=>{const i=e.getScrollViewElem();if(!i||!i.clientHeight||!i.clientHeight)return;const{xThumbWidth:c,yThumbHeight:a}=t,d=n.value,u=s.value,h=d&&c?ue(i.scrollLeft,i.clientWidth,i.scrollWidth,d.clientWidth,c):0;r.xThumbLeft=h,u&&c&&(u.style.width=c+"px",u.style.transform=`translateX(${h}px)`);const x=o.value,m=l.value,P=x&&a?ue(i.scrollTop,i.clientHeight,i.scrollHeight,x.clientHeight,a):0;r.yThumbTop=P,m&&a&&(m.style.height=a+"px",m.style.transform=`translateY(${P}px)`)},clickTrackXEvent:i=>{const c=i.currentTarget;if(c!==i.target)return;const a=e.getScrollViewElem();if(!a)return;const{xThumbWidth:d}=t,u=c.getBoundingClientRect();a.scrollTo({left:Ut(i.clientX-u.left,a.clientWidth,a.scrollWidth,c.clientWidth,d),behavior:"auto"})},clickTrackYEvent:i=>{const c=i.currentTarget;if(c!==i.target)return;const a=e.getScrollViewElem();if(!a)return;const{yThumbHeight:d}=t,u=c.getBoundingClientRect();a.scrollTo({top:Ut(i.clientY-u.top,a.clientHeight,a.scrollHeight,c.clientHeight,d),behavior:"auto"})},pointerdownThumbXEvent:i=>{const c=i.currentTarget;r.isThumbDrag=!0,c.setPointerCapture(i.pointerId);const a=e.getScrollViewElem();if(!a)return;const{xThumbWidth:d}=t,u=c.parentElement,h=u.getBoundingClientRect(),x=i.clientX-h.left,m=ue(a.scrollLeft,a.clientWidth,a.scrollWidth,u.clientWidth,d);r.thumbDragOffset=x-m},pointermoveThumbXEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:a,thumbDragOffset:d}=r;if(a){const u=e.getScrollViewElem();if(!u)return;const{xThumbWidth:h}=t,m=i.currentTarget.parentElement,P=m.getBoundingClientRect();u.scrollLeft=Yt(i.clientX-P.left,d,u.clientWidth,u.scrollWidth,m.clientWidth,h)}},cleatPointerThumbEvent:i=>{i.currentTarget.releasePointerCapture(i.pointerId),r.isThumbDrag=!1},pointerdownThumbYEvent:i=>{const c=i.currentTarget;r.isThumbDrag=!0,c.setPointerCapture(i.pointerId);const a=e.getScrollViewElem();if(!a)return;const{yThumbHeight:d}=t,u=c.parentElement,h=u.getBoundingClientRect(),x=i.clientY-h.top,m=ue(a.scrollTop,a.clientHeight,a.scrollHeight,u.clientHeight,d);r.thumbDragOffset=x-m},pointermoveThumbYEvent:i=>{if(!i.currentTarget.hasPointerCapture(i.pointerId))return;const{isThumbDrag:a,thumbDragOffset:d}=r;if(a){const u=e.getScrollViewElem();if(!u)return;const{yThumbHeight:h}=t,m=i.currentTarget.parentElement,P=m.getBoundingClientRect();u.scrollTop=Yt(i.clientY-P.top,d,u.clientHeight,u.scrollHeight,m.clientHeight,h)}}}},Jt={useSize:$t,useVScrollbar:Kt,usePermission:qt,useInitVScrollbar:Gt},Ae=p(f("xe-utils")),Zt=[];function Qt(e,t){return e&&e.install&&Zt.indexOf(e)===-1&&(e.install(de,t),Zt.push(e)),de}var fe={};function er(e){return fe[e]||null}function tr(e){return!!fe[e]}function rr(e){e&&e.name&&(fe[e.name]=e,fe[Ae.default.kebabCase(e.name)]=e)}function nr(){return(0,mr.createCommentVNode)()}function or(e,t,r){if(e){const n=`${e}`.match(/(\d+).(\d+).(\d+)/);if(n){const o=Ae.default.toNumber(n[1]);if(r){const s=Ae.default.toNumber(n[2]);return o>=t&&s>=r}return o>=t}}return!1}var de=Object.assign(L,{renderEmptyElement:nr,setTheme:se,getTheme:st,setConfig:it,getConfig:lt,setIcon:ft,getIcon:ye,renderGlobalIcon:dt,renderCustomIcon:Ie,setLanguage:Tt,hasLanguage:It,getLanguage:Ot,setI18n:yt,getI18n:Pe,globalEvents:bt,GLOBAL_EVENT_KEYS:R,createEvent:pt,globalResize:wt,renderer:M,validators:Ne,menus:Le,formats:We,commands:Re,interceptor:ee,clipboard:Dt,log:I,permission:Nt,zIndex:Lt,baseUtils:Rt,dbUtils:Bt,domUtils:At,scrollbarUtils:He,popperUtils:zt,globalStore:at,hooks:Ft,component:rr,getComponent:er,hasComponent:tr,useFns:Jt,getSlotVNs:Te,checkVersion:or,use:Qt});se();var Br=de;return be.exports});
|
package/lib/src/core.js
CHANGED
package/lib/src/log.js
CHANGED
package/lib/src/popper-utils.js
CHANGED
|
@@ -36,9 +36,16 @@ function getWrapperElement(panelElem) {
|
|
|
36
36
|
if (!panelElem) {
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const doc = panelElem.ownerDocument;
|
|
40
|
+
const bodyEl = doc.body;
|
|
40
41
|
const parentEl = panelElem.parentElement;
|
|
41
|
-
|
|
42
|
+
if (parentEl === bodyEl) {
|
|
43
|
+
return bodyEl;
|
|
44
|
+
}
|
|
45
|
+
if (parentEl === doc.documentElement) {
|
|
46
|
+
return bodyEl;
|
|
47
|
+
}
|
|
48
|
+
return parentEl || null;
|
|
42
49
|
}
|
|
43
50
|
function getAppendSelector(appendTo) {
|
|
44
51
|
const selectElem = appendTo && import_xe_utils.default.isFunction(appendTo) ? appendTo({}) : appendTo;
|
|
@@ -56,15 +63,12 @@ const popperUtils = {
|
|
|
56
63
|
* 更新位置
|
|
57
64
|
*/
|
|
58
65
|
updatePlacement(targetElem, panelElem, options) {
|
|
59
|
-
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
options
|
|
67
|
-
);
|
|
66
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
67
|
+
appendTo: "",
|
|
68
|
+
teleportTo: false,
|
|
69
|
+
marginSize: 18,
|
|
70
|
+
isMinWidth: true
|
|
71
|
+
}, options);
|
|
68
72
|
let panelPlacement = "bottom";
|
|
69
73
|
let top = "";
|
|
70
74
|
let bottom = "";
|
|
@@ -89,8 +93,8 @@ const popperUtils = {
|
|
|
89
93
|
const parentWrapperScrollTop = parentWrapperEl.scrollTop;
|
|
90
94
|
const parentWrapperOffsetLeft = parentWrapperRect.left;
|
|
91
95
|
const parentWrapperOffsetTop = parentWrapperRect.top;
|
|
92
|
-
const targetLeft = targetRect.left;
|
|
93
|
-
const targetTop = targetRect.top;
|
|
96
|
+
const targetLeft = targetRect.left - parentWrapperOffsetLeft;
|
|
97
|
+
const targetTop = targetRect.top - parentWrapperOffsetTop;
|
|
94
98
|
minWidth = targetElem.offsetWidth;
|
|
95
99
|
if (teleportTo) {
|
|
96
100
|
left = (defaultLeft || targetLeft - (panelWidth - targetWidth) / 2) - parentWrapperScrollLeft;
|
|
@@ -124,13 +128,11 @@ const popperUtils = {
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
if (left + panelWidth + marginSize > visibleWidth) {
|
|
127
|
-
left
|
|
131
|
+
left = visibleWidth - panelWidth - marginSize;
|
|
128
132
|
}
|
|
129
133
|
if (left < marginSize) {
|
|
130
134
|
left = marginSize;
|
|
131
135
|
}
|
|
132
|
-
top -= parentWrapperOffsetTop;
|
|
133
|
-
left -= parentWrapperOffsetLeft;
|
|
134
136
|
} else {
|
|
135
137
|
if (placement === "top") {
|
|
136
138
|
panelPlacement = "top";
|
|
@@ -161,17 +163,15 @@ const popperUtils = {
|
|
|
161
163
|
if (isMinWidth && import_xe_utils.default.isNumber(minWidth)) {
|
|
162
164
|
stys.minWidth = minWidth + "px";
|
|
163
165
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
} else {
|
|
172
|
-
arrowLeft = targetLeft - left + (panelWidth - (targetLeft - left)) / 2;
|
|
173
|
-
}
|
|
166
|
+
const panelViewportLeft = teleportTo ? parentWrapperOffsetLeft + left : panelRect.left + left;
|
|
167
|
+
let arrowLeftValue = targetRect.left + targetWidth / 2 - panelViewportLeft;
|
|
168
|
+
if (panelWidth > 0) {
|
|
169
|
+
const arrowHalf = 5;
|
|
170
|
+
const minArrow = arrowHalf;
|
|
171
|
+
const maxArrow = panelWidth - arrowHalf;
|
|
172
|
+
arrowLeftValue = Math.max(minArrow, Math.min(maxArrow, arrowLeftValue));
|
|
174
173
|
}
|
|
174
|
+
arrowLeft = arrowLeftValue;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
return {
|
package/package.json
CHANGED
|
@@ -9,9 +9,21 @@ function getWrapperElement(panelElem: HTMLElement | null | undefined) {
|
|
|
9
9
|
if (!panelElem) {
|
|
10
10
|
return null
|
|
11
11
|
}
|
|
12
|
-
const
|
|
12
|
+
const doc = panelElem.ownerDocument
|
|
13
|
+
const bodyEl = doc.body
|
|
13
14
|
const parentEl = panelElem.parentElement
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
// panel 直接挂在 body 下:返回 body,走原生视口坐标
|
|
17
|
+
if (parentEl === bodyEl) {
|
|
18
|
+
return bodyEl
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (parentEl === doc.documentElement) {
|
|
22
|
+
return bodyEl
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 普通容器:返回父节点本身,由它决定定位上下文
|
|
26
|
+
return parentEl || null
|
|
15
27
|
}
|
|
16
28
|
|
|
17
29
|
/**
|
|
@@ -38,15 +50,12 @@ export const popperUtils: VxePopperUtils = {
|
|
|
38
50
|
* 更新位置
|
|
39
51
|
*/
|
|
40
52
|
updatePlacement(targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: VxePopperOptions) {
|
|
41
|
-
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
options
|
|
49
|
-
)
|
|
53
|
+
const { defaultTop, defaultLeft, placement, defaultPlacement, appendTo, teleportTo, marginSize, isMinWidth } = Object.assign({
|
|
54
|
+
appendTo: '',
|
|
55
|
+
teleportTo: false,
|
|
56
|
+
marginSize: 18,
|
|
57
|
+
isMinWidth: true
|
|
58
|
+
}, options)
|
|
50
59
|
let panelPlacement: 'top' | 'bottom' = 'bottom'
|
|
51
60
|
let top: number | '' = ''
|
|
52
61
|
let bottom: number | '' = ''
|
|
@@ -73,8 +82,8 @@ export const popperUtils: VxePopperUtils = {
|
|
|
73
82
|
const parentWrapperScrollTop = parentWrapperEl.scrollTop
|
|
74
83
|
const parentWrapperOffsetLeft = parentWrapperRect.left
|
|
75
84
|
const parentWrapperOffsetTop = parentWrapperRect.top
|
|
76
|
-
const targetLeft = targetRect.left
|
|
77
|
-
const targetTop = targetRect.top
|
|
85
|
+
const targetLeft = targetRect.left - parentWrapperOffsetLeft
|
|
86
|
+
const targetTop = targetRect.top - parentWrapperOffsetTop
|
|
78
87
|
|
|
79
88
|
minWidth = targetElem.offsetWidth
|
|
80
89
|
|
|
@@ -115,16 +124,12 @@ export const popperUtils: VxePopperUtils = {
|
|
|
115
124
|
}
|
|
116
125
|
// 如果溢出右边
|
|
117
126
|
if (left + panelWidth + marginSize > visibleWidth) {
|
|
118
|
-
left
|
|
127
|
+
left = visibleWidth - panelWidth - marginSize
|
|
119
128
|
}
|
|
120
129
|
// 如果溢出左边
|
|
121
130
|
if (left < marginSize) {
|
|
122
131
|
left = marginSize
|
|
123
132
|
}
|
|
124
|
-
|
|
125
|
-
// 偏移
|
|
126
|
-
top -= parentWrapperOffsetTop
|
|
127
|
-
left -= parentWrapperOffsetLeft
|
|
128
133
|
} else {
|
|
129
134
|
if (placement === 'top') {
|
|
130
135
|
panelPlacement = 'top'
|
|
@@ -160,17 +165,16 @@ export const popperUtils: VxePopperUtils = {
|
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
// 箭头
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
arrowLeft = targetLeft - left + (panelWidth - (targetLeft - left)) / 2
|
|
172
|
-
}
|
|
168
|
+
const panelViewportLeft = teleportTo ? parentWrapperOffsetLeft + left : panelRect.left + left
|
|
169
|
+
let arrowLeftValue = targetRect.left + targetWidth / 2 - panelViewportLeft
|
|
170
|
+
// 限制箭头不溢出 panel
|
|
171
|
+
if (panelWidth > 0) {
|
|
172
|
+
const arrowHalf = 5
|
|
173
|
+
const minArrow = arrowHalf
|
|
174
|
+
const maxArrow = panelWidth - arrowHalf
|
|
175
|
+
arrowLeftValue = Math.max(minArrow, Math.min(maxArrow, arrowLeftValue))
|
|
173
176
|
}
|
|
177
|
+
arrowLeft = arrowLeftValue
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
180
|
return {
|