@vxe-ui/core 4.4.42 → 4.5.1

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.
Files changed (195) hide show
  1. package/dist/all.esm.js +1594 -1389
  2. package/dist/all.esm.min.js +1 -0
  3. package/es/index.d.ts +138 -0
  4. package/es/index.esm.js +138 -125
  5. package/es/index.js +150 -0
  6. package/es/src/base-utils.d.ts +2 -0
  7. package/es/src/base-utils.js +40 -37
  8. package/es/src/clipboard.d.ts +2 -0
  9. package/es/src/clipboard.js +48 -45
  10. package/es/src/commands.d.ts +2 -0
  11. package/es/src/commands.js +47 -48
  12. package/es/src/config.d.ts +13 -0
  13. package/es/src/config.js +21 -23
  14. package/es/src/configStore.d.ts +2 -0
  15. package/es/src/configStore.js +8 -5
  16. package/es/src/core.d.ts +3 -0
  17. package/es/src/core.js +11 -7
  18. package/es/src/dataStore.d.ts +2 -0
  19. package/es/src/dataStore.js +4 -1
  20. package/es/src/db-utils.d.ts +2 -0
  21. package/es/src/db-utils.js +234 -0
  22. package/es/src/dom-utils.d.ts +2 -0
  23. package/es/src/dom-utils.js +65 -68
  24. package/es/src/event.d.ts +4 -0
  25. package/es/src/event.js +133 -147
  26. package/es/src/formats.d.ts +2 -0
  27. package/es/src/formats.js +47 -48
  28. package/es/src/hooks.d.ts +2 -0
  29. package/es/src/hooks.js +5 -2
  30. package/es/src/i18n.d.ts +6 -0
  31. package/es/src/i18n.js +51 -44
  32. package/es/src/i18nStore.d.ts +5 -0
  33. package/es/src/i18nStore.js +7 -4
  34. package/es/src/icon.d.ts +9 -0
  35. package/es/src/icon.js +28 -22
  36. package/es/src/iconStore.d.ts +2 -0
  37. package/es/src/iconStore.js +4 -1
  38. package/es/src/interceptor.d.ts +2 -0
  39. package/es/src/interceptor.js +52 -54
  40. package/es/src/log.d.ts +2 -0
  41. package/es/src/log.js +14 -11
  42. package/es/src/menus.d.ts +2 -0
  43. package/es/src/menus.js +47 -48
  44. package/es/src/permission.d.ts +3 -0
  45. package/es/src/permission.js +57 -55
  46. package/es/src/popper-utils.d.ts +2 -0
  47. package/es/src/popper-utils.js +159 -179
  48. package/es/src/renderer.d.ts +5 -0
  49. package/es/src/renderer.js +37 -42
  50. package/es/src/resize.d.ts +2 -0
  51. package/es/src/resize.js +60 -70
  52. package/es/src/scrollbar-utils.d.ts +2 -0
  53. package/es/src/scrollbar-utils.js +57 -54
  54. package/es/src/store.d.ts +13 -0
  55. package/es/src/store.js +43 -45
  56. package/es/src/theme.d.ts +3 -0
  57. package/es/src/theme.js +17 -13
  58. package/es/src/themeStore.d.ts +4 -0
  59. package/es/src/themeStore.js +5 -2
  60. package/es/src/useFns.d.ts +40 -0
  61. package/es/src/useFns.js +212 -231
  62. package/es/src/validators.d.ts +2 -0
  63. package/es/src/validators.js +6 -3
  64. package/es/src/vm.d.ts +2 -0
  65. package/es/src/vm.js +9 -6
  66. package/es/src/z-index.d.ts +2 -0
  67. package/es/src/z-index.js +29 -26
  68. package/lib/index.common.js +136 -365
  69. package/lib/index.js +181 -0
  70. package/lib/index.umd.js +819 -3343
  71. package/lib/index.umd.min.js +1 -1
  72. package/lib/src/base-utils.js +39 -13
  73. package/lib/src/clipboard.js +50 -23
  74. package/lib/src/commands.js +46 -27
  75. package/lib/src/config.js +43 -23
  76. package/lib/src/configStore.js +24 -7
  77. package/lib/src/core.js +29 -11
  78. package/lib/src/dataStore.js +22 -5
  79. package/lib/src/db-utils.js +263 -0
  80. package/lib/src/dom-utils.js +40 -20
  81. package/lib/src/event.js +95 -102
  82. package/lib/src/formats.js +46 -27
  83. package/lib/src/hooks.js +33 -7
  84. package/lib/src/i18n.js +53 -38
  85. package/lib/src/i18nStore.js +25 -8
  86. package/lib/src/icon.js +46 -22
  87. package/lib/src/iconStore.js +22 -5
  88. package/lib/src/interceptor.js +40 -18
  89. package/lib/src/log.js +29 -12
  90. package/lib/src/menus.js +46 -27
  91. package/lib/src/permission.js +40 -17
  92. package/lib/src/popper-utils.js +71 -71
  93. package/lib/src/renderer.js +40 -21
  94. package/lib/src/resize.js +48 -42
  95. package/lib/src/scrollbar-utils.js +23 -6
  96. package/lib/src/store.js +44 -25
  97. package/lib/src/theme.js +31 -14
  98. package/lib/src/themeStore.js +24 -7
  99. package/lib/src/useFns.js +87 -124
  100. package/lib/src/validators.js +34 -10
  101. package/lib/src/vm.js +34 -8
  102. package/lib/src/z-index.js +38 -12
  103. package/package.json +14 -3
  104. package/packages/index.ts +171 -168
  105. package/packages/src/base-utils.ts +42 -43
  106. package/packages/src/clipboard.ts +56 -56
  107. package/packages/src/commands.ts +56 -56
  108. package/packages/src/config.ts +30 -30
  109. package/packages/src/configStore.ts +8 -8
  110. package/packages/src/core.ts +11 -11
  111. package/packages/src/dataStore.ts +3 -4
  112. package/packages/src/db-utils.ts +267 -0
  113. package/packages/src/dom-utils.ts +86 -87
  114. package/packages/src/event.ts +161 -161
  115. package/packages/src/formats.ts +56 -56
  116. package/packages/src/hooks.ts +5 -5
  117. package/packages/src/i18n.ts +63 -63
  118. package/packages/src/i18nStore.ts +11 -11
  119. package/packages/src/icon.ts +32 -32
  120. package/packages/src/iconStore.ts +3 -3
  121. package/packages/src/interceptor.ts +64 -64
  122. package/packages/src/log.ts +19 -19
  123. package/packages/src/menus.ts +56 -56
  124. package/packages/src/permission.ts +61 -61
  125. package/packages/src/popper-utils.ts +197 -194
  126. package/packages/src/renderer.ts +50 -50
  127. package/packages/src/resize.ts +89 -89
  128. package/packages/src/scrollbar-utils.ts +58 -58
  129. package/packages/src/store.ts +47 -47
  130. package/packages/src/theme.ts +20 -20
  131. package/packages/src/themeStore.ts +7 -7
  132. package/packages/src/useFns.ts +270 -275
  133. package/packages/src/validators.ts +7 -7
  134. package/packages/src/vm.ts +10 -10
  135. package/packages/src/z-index.ts +30 -30
  136. package/types/core/base-utils.d.ts +39 -40
  137. package/types/core/clipboard.d.ts +22 -22
  138. package/types/core/commands.d.ts +17 -19
  139. package/types/core/components.d.ts +5 -5
  140. package/types/core/db-utils.d.ts +44 -0
  141. package/types/core/dom-utils.d.ts +36 -37
  142. package/types/core/formats.d.ts +17 -19
  143. package/types/core/global-config.d.ts +67 -74
  144. package/types/core/global-data.d.ts +7 -7
  145. package/types/core/global-event.d.ts +48 -48
  146. package/types/core/global-icon.d.ts +10 -10
  147. package/types/core/global-lang.d.ts +28 -27
  148. package/types/core/global-resize.d.ts +3 -3
  149. package/types/core/global-theme.d.ts +1 -1
  150. package/types/core/hooks.d.ts +12 -14
  151. package/types/core/index.d.ts +343 -336
  152. package/types/core/interceptor.d.ts +20 -22
  153. package/types/core/log.d.ts +8 -8
  154. package/types/core/menus.d.ts +17 -19
  155. package/types/core/permission.d.ts +10 -10
  156. package/types/core/popper-utils.d.ts +44 -44
  157. package/types/core/renderer.d.ts +14 -14
  158. package/types/core/scrollbar-utils.d.ts +37 -38
  159. package/types/core/useFn.d.ts +121 -126
  160. package/types/core/validators.d.ts +17 -19
  161. package/types/core/z-index.d.ts +18 -18
  162. package/types/index.d.ts +13 -13
  163. package/types/tool/common.d.ts +146 -155
  164. package/types/tool/index.d.ts +2 -2
  165. package/types/tool/util.d.ts +4 -4
  166. package/lib/src/base-utils.min.js +0 -1
  167. package/lib/src/clipboard.min.js +0 -1
  168. package/lib/src/commands.min.js +0 -1
  169. package/lib/src/config.min.js +0 -1
  170. package/lib/src/configStore.min.js +0 -1
  171. package/lib/src/core.min.js +0 -1
  172. package/lib/src/dataStore.min.js +0 -1
  173. package/lib/src/dom-utils.min.js +0 -1
  174. package/lib/src/event.min.js +0 -1
  175. package/lib/src/formats.min.js +0 -1
  176. package/lib/src/hooks.min.js +0 -1
  177. package/lib/src/i18n.min.js +0 -1
  178. package/lib/src/i18nStore.min.js +0 -1
  179. package/lib/src/icon.min.js +0 -1
  180. package/lib/src/iconStore.min.js +0 -1
  181. package/lib/src/interceptor.min.js +0 -1
  182. package/lib/src/log.min.js +0 -1
  183. package/lib/src/menus.min.js +0 -1
  184. package/lib/src/permission.min.js +0 -1
  185. package/lib/src/popper-utils.min.js +0 -1
  186. package/lib/src/renderer.min.js +0 -1
  187. package/lib/src/resize.min.js +0 -1
  188. package/lib/src/scrollbar-utils.min.js +0 -1
  189. package/lib/src/store.min.js +0 -1
  190. package/lib/src/theme.min.js +0 -1
  191. package/lib/src/themeStore.min.js +0 -1
  192. package/lib/src/useFns.min.js +0 -1
  193. package/lib/src/validators.min.js +0 -1
  194. package/lib/src/vm.min.js +0 -1
  195. package/lib/src/z-index.min.js +0 -1
@@ -0,0 +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),Pt="4.5.1",I={coreVersion:Pt,uiVersion:"",tableVersion:"",designVersion:"",ganttVersion:""};import{createCommentVNode as Xe}from"vue";import yt from"xe-utils";import He from"dom-zindex";var N={size:"",version:1,zIndex:999,resizeInterval:500},Dt={theme:""};function K(t){const e=!t||t==="default"?"light":t;if(Dt.theme=e,typeof document!="undefined"){const r=document.documentElement;r&&r.setAttribute("data-vxe-ui-theme",e)}return I}function It(){return Dt.theme}function Ct(t){return t&&(t.zIndex&&He.setCurrent(t.zIndex),t.theme&&K(t.theme),yt.merge(N,t)),I}function Wt(t,e){return arguments.length?yt.get(N,t,e):N}var Nt={};import{h as Lt}from"vue";import Rt from"xe-utils";var ct={};import Ae from"xe-utils";function lt(t){return Ae.isArray(t)?t:t?[t]:[]}function kt(t){return t&&Object.assign(ct,t),I}function at(t){return arguments.length?Rt.get(ct,t):ct}function Bt(t){const e=at(t);return ut(e,t)}function ut(t,e){return Rt.isFunction(t)?Lt("span",{},lt(t({name:e}))):Lt("i",{class:t})}import _ from"xe-utils";var C={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"},ht=_.browse(),Xt={" ":"Spacebar",Apps:C.CONTEXT_MENU,Del:C.DELETE,Up:C.ARROW_UP,Down:C.ARROW_DOWN,Left:C.ARROW_LEFT,Right:C.ARROW_RIGHT},Ht=ht.firefox?"DOMMouseScroll":"mousewheel",ft=[];function T(t){const e=t.type===Ht;ft.forEach(({type:r,cb:n})=>{t.cancelBubble||(r===t.type||e&&r==="mousewheel")&&n(t)})}var At=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),_.objectEach(r,(n,o)=>{if(_.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()}},_t=(t,e,r)=>(t instanceof At&&(t=t.$event),new At(t,e,r)),Mt={on(t,e,r){ft.push({comp:t,type:e,cb:r})},off(t,e){_.remove(ft,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}};ht.isDoc&&(ht.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(Ht,_.throttle(T,100,{leading:!0,trailing:!1}),{passive:!0,capture:!1}));import Ut from"xe-utils";var jt,L=[],_e=500;function Me(){L.length&&(L.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,N.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}),L.length||Ft(),L.some(r=>r===this)||L.push(this)}}unobserve(t){Ut.remove(L,e=>e.tarList.some(r=>r.target===t))}disconnect(){Ut.remove(L,t=>t===this)}},Vt={create(t){return window.ResizeObserver?new window.ResizeObserver(t):new Ue(t)}};import zt from"xe-utils";import{reactive as je}from"vue";var k=je({language:"",langMaps:{}}),Yt=!1,Z={};function Fe(t){return t&&t.__esModule?t.default:t}function mt(t,e){const{langMaps:r,language:n}=k,{i18n:o}=N;if(o)return`${o(t,e)||""}`;if(Yt||(r[n]||console.error(`[vxe core] 语言包未安装。Language not installed. https://${I.uiVersion?"vxeui.com":"vxetable.cn"}/#/start/i18n`),Yt=!0),!e&&Z[t])return Z[t];const s=zt.toFormatString(zt.get(r[n],t,t),e);return e||(Z[t]=s),s}function $t(t){const{language:e}=k,r=t||"zh-CN";return e!==r&&(k.language=r,Z={}),I}function qt(t,e){return k.langMaps[t]=Object.assign({},Fe(e)),I}function Gt(t){const{langMaps:e}=k;return!!e[t]}function Kt(){const{language:t}=k;return t}import J from"xe-utils";function dt(t,e){return function(r,n){const o=`[vxe ${e||""}] ${mt(r,n)}`;return console[t](o),o}}var Zt="4.5.1",O={create:dt,warn:dt("warn",`v${Zt}`),err:dt("error",`v${Zt}`)},M={},R={mixin(t){return J.each(t,(e,r)=>{R.add(r,e)}),R},get(t){return M[t]||null},add(t,e){if(t&&e){const r=M[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)):M[t]=e}return R},forEach(t){return J.objectEach(M,t),R},delete(t){return delete M[t],R}};import U from"xe-utils";var Ve=class{constructor(){v(this,"store",{})}mixin(t){return U.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=U.keys(r);return U.each(e,(o,s)=>{n.includes(s)&&O.warn("vxe.error.coverProp",[t,s])}),this.store[t]=r?U.merge(r,e):e,this}delete(t){delete this.store[t]}forEach(t){U.objectEach(this.store,t)}},Jt=Ve,gt=new Jt;Object.assign(gt,{_name:"Validators"});import B from"xe-utils";var ze=class{constructor(){v(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)}},pt=new ze;Object.assign(pt,{_name:"Menus"});import X from"xe-utils";var Ye=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",["formats -> callback","cellFormatMethod"]),e={cellFormatMethod: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 Ye;Object.assign(bt,{_name:"Formats"});import H from"xe-utils";var $e=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",["commands -> callback","commandMethod"]),e={commandMethod: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 $e;Object.assign(vt,{_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 qe from"xe-utils";var P,V={text:"",html:""};function Ge(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 Qt={getStore(){return V},setStore(t){Object.assign(V,t||{})},copy(t){let e=!1;try{const r=qe.toValueString(t);Ge(r),P.select(),P.setSelectionRange(0,P.value.length),e=document.execCommand("copy"),P.blur(),V.text=r,V.html=""}catch(r){}return e},getText(){return V.text||""}};import Ke from"xe-utils";function z(t,e){let r=!0,n=!1;const o=e||N.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 Y=S[b];let w=!0,h=!1;const x=o({code:Y});if(Ke.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 te={getCheckInfo(t){return z(t)},checkVisible(t){return z(t).visible},checkDisable(t){return z(t).disabled}};import tt from"dom-zindex";var ee={next(){return tt.getNext()},getLast(){return tt.getCurrent()},nextSub(){return tt.getSubNext()},getSubLast(){return tt.getSubCurrent()}};import re from"xe-utils";var ne={toString(t){return re.eqNull(t)?"":""+t},isEmpty(t){return t==null||t===""},getDefVal(t,e){return re.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 Ze=class{constructor(t,e){v(this,"storeName","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(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)})})}},Je=class{constructor(t,e){v(this,"key"),v(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()}},oe={createStore(t,e){const r=Object.assign({},e),n=r.version||N.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 Et={};function se(t){return Et[t]||(Et[t]=new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g")),Et[t]}function wt(t,e){return t?t.classList?t.classList.contains(e):!!(t.className&&t.className.match&&t.className.match(se(e))):!1}function ie(t,e){t&&wt(t,e)&&(t.className=t.className.replace(se(e),""))}var ce={isPx(t){return t&&/^\d+(\.\d+)?(px)?$/.test(t)},isScale(t){return t&&/^\d+(\.\d+)?%$/.test(t)},hasClass:wt,removeClass:ie,addClass(t,e){t&&!wt(t,e)&&(ie(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(" ")}},St={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 A from"xe-utils";function le(t){if(!t)return null;const e=document.body,r=t.parentElement;return(r===e?document.documentElement:r)||null}function ae(t){return(t&&A.isFunction(t)?t({}):t)||"body"}function ue(t){const e=ae(t);return A.isString(e)?document.querySelector(e)||document.body:e}var he={updatePlacement(t,e,r){const{defaultTop:n,defaultLeft:o,placement:s,defaultPlacement:c,appendTo:E,teleportTo:S,marginSize:b,isMinWidth:Y}=Object.assign({appendTo:"",teleportTo:!1,marginSize:12,isMinWidth:!0},r);let w="bottom",h="",x="",g=0,$="",i="";const u={};if(e&&t){const l=document.body,f=le(S?ue(E):e);if(f){const a=t.offsetWidth,m=t.offsetHeight,p=e.offsetWidth,d=e.offsetHeight,y=f.getBoundingClientRect(),q=e.getBoundingClientRect(),Ot=t.getBoundingClientRect(),it=l.clientHeight,G=l.clientWidth,We=f.scrollLeft,Ne=f.scrollTop,Le=y.left,Re=y.top,W=Ot.left,D=Ot.top;$=t.offsetWidth,S?(g=(o||W-(p-a)/2)-We,h=(n||D+m)-Ne,s==="top"?(w="top",h=D-d):s||(c==="top"?(w="top",n||(h=D-d),h<b&&(w="bottom",h=D+m),h+d+b>it&&(w="top",h=D-d)):(h+d+b>it&&(w="top",h=D-d),h<b&&(w="bottom",h=D+m))),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,D+m+d+b>it&&D-m-d>b&&(w="top",h="",x=m)),q.left+q.width+b>G&&(g=-(q.left+q.width+b-G))),A.isNumber(h)&&(u.top=h+"px"),A.isNumber(x)&&(u.bottom=x+"px"),A.isNumber(g)&&(u.left=g+"px"),Y&&A.isNumber($)&&(u.minWidth=$+"px"),g===W?a<=p&&(i=a/2):g<W&&(g+p>W+a?i=W-g+a/2:i=W-g+(p-(W-g))/2)}}return{top:h||0,bottom:x||0,left:g||0,arrowLeft:i||0,style:u,placement:w}},getWrapperElement:le,getAppendSelector:ae,getAppendElement:ue},fe=new Jt;import tr from"xe-utils";import{computed as xt,ref as rt,inject as me,provide as de}from"vue";var{getThumbOffsetSize:nt,getThumbSize:ge,getScrollFromClick:pe,getScrollFromDrag:be}=St;function ve(t){const e=me("xeSizeInfo",null),r=xt(()=>{const{size:n}=t;return n||(e?e.value:null)});return de("xeSizeInfo",r),{computeSize:r}}function Ee(t){return{computePermissionInfo:xt(()=>z(t.permissionCode,t.permissionMethod))}}function we(t){const e=me("xeScrollbarInfo",null),r=xt(()=>{const{useScrollbar:n}=t;return tr.isBoolean(n)?n:e?e.value:null});return de("xeScrollbarInfo",r),{computeIsVScrollbar:r}}var Se=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 u=n.value,l=u?ge(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?ge(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?nt(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?nt(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:pe(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:pe(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=nt(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=be(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=nt(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=be(i.clientY-y.top,f,a.clientHeight,a.scrollHeight,d.clientHeight,m)}}}},xe={useSize:ve,useVScrollbar:we,usePermission:Ee,useInitVScrollbar:Se};import Tt from"xe-utils";var Te=[];function Oe(t,e){return t&&t.install&&Te.indexOf(t)===-1&&(t.install(st,e),Te.push(t)),st}var ot={};function Pe(t){return ot[t]||null}function ye(t){return!!ot[t]}function De(t){t&&t.name&&(ot[t.name]=t,ot[Tt.kebabCase(t.name)]=t)}function Ie(){return Xe()}function Ce(t,e,r){if(t){const n=`${t}`.match(/(\d+).(\d+).(\d+)/);if(n){const o=Tt.toNumber(n[1]);if(r){const s=Tt.toNumber(n[2]);return o>=e&&s>=r}return o>=e}}return!1}var st=Object.assign(I,{renderEmptyElement:Ie,setTheme:K,getTheme:It,setConfig:Ct,getConfig:Wt,setIcon:kt,getIcon:at,renderGlobalIcon:Bt,renderCustomIcon:ut,setLanguage:$t,hasLanguage:Gt,getLanguage:Kt,setI18n:qt,getI18n:mt,globalEvents:Mt,GLOBAL_EVENT_KEYS:C,createEvent:_t,globalResize:Vt,renderer:R,validators:gt,menus:pt,formats:bt,commands:vt,interceptor:F,clipboard:Qt,log:O,permission:te,zIndex:ee,baseUtils:ne,dbUtils:oe,domUtils:ce,scrollbarUtils:St,popperUtils:he,globalStore:Nt,hooks:fe,component:De,getComponent:Pe,hasComponent:ye,useFns:xe,getSlotVNs:lt,checkVersion:Ce,use:Oe});K();var er=st;export{C as GLOBAL_EVENT_KEYS,I as VxeCore,st as VxeUI,ne as baseUtils,Ce as checkVersion,Qt as clipboard,vt as commands,De as component,Pt as coreVersion,_t as createEvent,oe as dbUtils,er as default,ce as domUtils,bt as formats,Pe as getComponent,Wt as getConfig,mt as getI18n,at as getIcon,Kt as getLanguage,lt as getSlotVNs,It as getTheme,Mt as globalEvents,Vt as globalResize,Nt as globalStore,z as handleCheckInfo,ye as hasComponent,Gt as hasLanguage,fe as hooks,F as interceptor,O as log,pt as menus,te as permission,he as popperUtils,ut as renderCustomIcon,Ie as renderEmptyElement,Bt as renderGlobalIcon,R as renderer,St as scrollbarUtils,Ct as setConfig,qt as setI18n,kt as setIcon,$t as setLanguage,K as setTheme,Oe as use,xe as useFns,Se as useInitVScrollbar,Ee as usePermission,ve as useSize,we as useVScrollbar,gt as validators,ee as zIndex};
package/es/index.d.ts ADDED
@@ -0,0 +1,138 @@
1
+ import { setConfig } from './src/config';
2
+ import { setIcon, renderGlobalIcon, renderCustomIcon } from './src/icon';
3
+ import { setTheme, getTheme } from './src/theme';
4
+ import { getI18n, setI18n, setLanguage, hasLanguage, getLanguage } from './src/i18n';
5
+ import { getSlotVNs } from './src/vm';
6
+ import { VxeGlobalComponents, VxeUIPluginObject } from '../types';
7
+ export declare function use(Plugin: VxeUIPluginObject, options: any[]): import("../types").VxeUIExport & {
8
+ renderEmptyElement: typeof renderEmptyElement;
9
+ setTheme: typeof setTheme;
10
+ getTheme: typeof getTheme;
11
+ setConfig: typeof setConfig;
12
+ getConfig: any;
13
+ setIcon: typeof setIcon;
14
+ getIcon: any;
15
+ renderGlobalIcon: typeof renderGlobalIcon;
16
+ renderCustomIcon: typeof renderCustomIcon;
17
+ setLanguage: typeof setLanguage;
18
+ hasLanguage: typeof hasLanguage;
19
+ getLanguage: typeof getLanguage;
20
+ setI18n: typeof setI18n;
21
+ getI18n: typeof getI18n;
22
+ globalEvents: import("../types").VxeGlobalEvents;
23
+ GLOBAL_EVENT_KEYS: import("../types").VxeGlobalEventKey;
24
+ createEvent: import("../types").VxeGlobalCreateEventMethod;
25
+ globalResize: import("../types").VxeGlobalResize;
26
+ renderer: import("../types").VxeGlobalRenderer;
27
+ validators: import("../types").VxeGlobalValidators;
28
+ menus: import("../types").VxeGlobalMenus;
29
+ formats: import("../types").VxeGlobalFormats;
30
+ commands: import("../types").VxeGlobalCommands;
31
+ interceptor: import("../types").VxeGlobalInterceptor;
32
+ clipboard: import("../types").VxeGlobalClipboard;
33
+ log: import("../types").VxeGlobalLog;
34
+ permission: import("../types").VxeGlobalPermission;
35
+ zIndex: import("../types").VxeZIndex;
36
+ baseUtils: import("../types").VxeBaseUtils;
37
+ dbUtils: import("../types").VxeDBUtils;
38
+ domUtils: import("../types").VxeDomUtils;
39
+ scrollbarUtils: import("../types").VxeScrollbarUtils;
40
+ popperUtils: import("../types").VxePopperUtils;
41
+ globalStore: import("../types").VxeGlobalData;
42
+ hooks: import("../types").VxeGlobalHooks;
43
+ component: typeof component;
44
+ getComponent: typeof getComponent;
45
+ hasComponent: typeof hasComponent;
46
+ useFns: {
47
+ useSize: typeof import(".").useSize;
48
+ useVScrollbar: typeof import(".").useVScrollbar;
49
+ usePermission: typeof import(".").usePermission;
50
+ useInitVScrollbar: import("../types").VxeUseInitVScrollbar;
51
+ };
52
+ getSlotVNs: typeof getSlotVNs;
53
+ checkVersion: typeof checkVersion;
54
+ use: typeof use;
55
+ };
56
+ export declare function getComponent(name: keyof VxeGlobalComponents): any;
57
+ export declare function hasComponent(name: keyof VxeGlobalComponents): boolean;
58
+ export declare function component(comp: any): void;
59
+ export declare function renderEmptyElement(): import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
60
+ [key: string]: any;
61
+ }>;
62
+ export declare function checkVersion(version: string, pVersion: number, sVersion?: number): boolean;
63
+ export declare const VxeUI: import("../types").VxeUIExport & {
64
+ renderEmptyElement: typeof renderEmptyElement;
65
+ setTheme: typeof setTheme;
66
+ getTheme: typeof getTheme;
67
+ setConfig: typeof setConfig;
68
+ getConfig: any;
69
+ setIcon: typeof setIcon;
70
+ getIcon: any;
71
+ renderGlobalIcon: typeof renderGlobalIcon;
72
+ renderCustomIcon: typeof renderCustomIcon;
73
+ setLanguage: typeof setLanguage;
74
+ hasLanguage: typeof hasLanguage;
75
+ getLanguage: typeof getLanguage;
76
+ setI18n: typeof setI18n;
77
+ getI18n: typeof getI18n;
78
+ globalEvents: import("../types").VxeGlobalEvents;
79
+ GLOBAL_EVENT_KEYS: import("../types").VxeGlobalEventKey;
80
+ createEvent: import("../types").VxeGlobalCreateEventMethod;
81
+ globalResize: import("../types").VxeGlobalResize;
82
+ renderer: import("../types").VxeGlobalRenderer;
83
+ validators: import("../types").VxeGlobalValidators;
84
+ menus: import("../types").VxeGlobalMenus;
85
+ formats: import("../types").VxeGlobalFormats;
86
+ commands: import("../types").VxeGlobalCommands;
87
+ interceptor: import("../types").VxeGlobalInterceptor;
88
+ clipboard: import("../types").VxeGlobalClipboard;
89
+ log: import("../types").VxeGlobalLog;
90
+ permission: import("../types").VxeGlobalPermission;
91
+ zIndex: import("../types").VxeZIndex;
92
+ baseUtils: import("../types").VxeBaseUtils;
93
+ dbUtils: import("../types").VxeDBUtils;
94
+ domUtils: import("../types").VxeDomUtils;
95
+ scrollbarUtils: import("../types").VxeScrollbarUtils;
96
+ popperUtils: import("../types").VxePopperUtils;
97
+ globalStore: import("../types").VxeGlobalData;
98
+ hooks: import("../types").VxeGlobalHooks;
99
+ component: typeof component;
100
+ getComponent: typeof getComponent;
101
+ hasComponent: typeof hasComponent;
102
+ useFns: {
103
+ useSize: typeof import(".").useSize;
104
+ useVScrollbar: typeof import(".").useVScrollbar;
105
+ usePermission: typeof import(".").usePermission;
106
+ useInitVScrollbar: import("../types").VxeUseInitVScrollbar;
107
+ };
108
+ getSlotVNs: typeof getSlotVNs;
109
+ checkVersion: typeof checkVersion;
110
+ use: typeof use;
111
+ };
112
+ export * from './src/core';
113
+ export * from './src/event';
114
+ export * from './src/resize';
115
+ export * from './src/config';
116
+ export * from './src/i18n';
117
+ export * from './src/icon';
118
+ export * from './src/theme';
119
+ export * from './src/renderer';
120
+ export * from './src/validators';
121
+ export * from './src/menus';
122
+ export * from './src/formats';
123
+ export * from './src/commands';
124
+ export * from './src/interceptor';
125
+ export * from './src/clipboard';
126
+ export * from './src/permission';
127
+ export * from './src/z-index';
128
+ export * from './src/base-utils';
129
+ export * from './src/db-utils';
130
+ export * from './src/dom-utils';
131
+ export * from './src/scrollbar-utils';
132
+ export * from './src/popper-utils';
133
+ export * from './src/dataStore';
134
+ export * from './src/useFns';
135
+ export * from './src/vm';
136
+ export * from './src/log';
137
+ export * from './src/hooks';
138
+ export default VxeUI;
package/es/index.esm.js CHANGED
@@ -1,137 +1,150 @@
1
- import { VxeCore } from './src/core';
2
- import { createCommentVNode } from 'vue';
3
- import { setConfig, getConfig } from './src/config';
4
- import { globalStore } from './src/dataStore';
5
- import { setIcon, getIcon, renderGlobalIcon, renderCustomIcon } from './src/icon';
6
- import { setTheme, getTheme } from './src/theme';
7
- import { globalEvents, GLOBAL_EVENT_KEYS, createEvent } from './src/event';
8
- import { globalResize } from './src/resize';
9
- import { getI18n, setI18n, setLanguage, hasLanguage, getLanguage } from './src/i18n';
10
- import { renderer } from './src/renderer';
11
- import { validators } from './src/validators';
12
- import { menus } from './src/menus';
13
- import { formats } from './src/formats';
14
- import { commands } from './src/commands';
15
- import { interceptor } from './src/interceptor';
16
- import { clipboard } from './src/clipboard';
17
- import { permission } from './src/permission';
18
- import { zIndex } from './src/z-index';
19
- import { baseUtils } from './src/base-utils';
20
- import { domUtils } from './src/dom-utils';
21
- import { scrollbarUtils } from './src/scrollbar-utils';
22
- import { popperUtils } from './src/popper-utils';
23
- import { log } from './src/log';
24
- import { hooks } from './src/hooks';
25
- import { useFns } from './src/useFns';
26
- import { getSlotVNs } from './src/vm';
27
- import XEUtils from 'xe-utils';
1
+ import { VxeCore } from "./src/core";
2
+ import { createCommentVNode } from "vue";
3
+ import { setConfig, getConfig } from "./src/config";
4
+ import { globalStore } from "./src/dataStore";
5
+ import { setIcon, getIcon, renderGlobalIcon, renderCustomIcon } from "./src/icon";
6
+ import { setTheme, getTheme } from "./src/theme";
7
+ import { globalEvents, GLOBAL_EVENT_KEYS, createEvent } from "./src/event";
8
+ import { globalResize } from "./src/resize";
9
+ import { getI18n, setI18n, setLanguage, hasLanguage, getLanguage } from "./src/i18n";
10
+ import { renderer } from "./src/renderer";
11
+ import { validators } from "./src/validators";
12
+ import { menus } from "./src/menus";
13
+ import { formats } from "./src/formats";
14
+ import { commands } from "./src/commands";
15
+ import { interceptor } from "./src/interceptor";
16
+ import { clipboard } from "./src/clipboard";
17
+ import { permission } from "./src/permission";
18
+ import { zIndex } from "./src/z-index";
19
+ import { baseUtils } from "./src/base-utils";
20
+ import { dbUtils } from "./src/db-utils";
21
+ import { domUtils } from "./src/dom-utils";
22
+ import { scrollbarUtils } from "./src/scrollbar-utils";
23
+ import { popperUtils } from "./src/popper-utils";
24
+ import { log } from "./src/log";
25
+ import { hooks } from "./src/hooks";
26
+ import { useFns } from "./src/useFns";
27
+ import { getSlotVNs } from "./src/vm";
28
+ import XEUtils from "xe-utils";
28
29
  const installedPlugins = [];
29
- export function use(Plugin, options) {
30
- if (Plugin && Plugin.install) {
31
- if (installedPlugins.indexOf(Plugin) === -1) {
32
- Plugin.install(VxeUI, options);
33
- installedPlugins.push(Plugin);
34
- }
30
+ function use(Plugin, options) {
31
+ if (Plugin && Plugin.install) {
32
+ if (installedPlugins.indexOf(Plugin) === -1) {
33
+ Plugin.install(VxeUI, options);
34
+ installedPlugins.push(Plugin);
35
35
  }
36
- return VxeUI;
36
+ }
37
+ return VxeUI;
37
38
  }
38
39
  const components = {};
39
- export function getComponent(name) {
40
- return components[name] || null;
40
+ function getComponent(name) {
41
+ return components[name] || null;
41
42
  }
42
- export function hasComponent(name) {
43
- return !!components[name];
43
+ function hasComponent(name) {
44
+ return !!components[name];
44
45
  }
45
- export function component(comp) {
46
- if (comp && comp.name) {
47
- components[comp.name] = comp;
48
- components[XEUtils.kebabCase(comp.name)] = comp;
49
- }
46
+ function component(comp) {
47
+ if (comp && comp.name) {
48
+ components[comp.name] = comp;
49
+ components[XEUtils.kebabCase(comp.name)] = comp;
50
+ }
50
51
  }
51
- export function renderEmptyElement() {
52
- return createCommentVNode();
52
+ function renderEmptyElement() {
53
+ return createCommentVNode();
53
54
  }
54
- export function checkVersion(version, pVersion, sVersion) {
55
- if (version) {
56
- const vRest = `${version}`.match(/(\d+).(\d+).(\d+)/);
57
- if (vRest) {
58
- const pV = XEUtils.toNumber(vRest[1]);
59
- if (sVersion) {
60
- const sV = XEUtils.toNumber(vRest[2]);
61
- return pV >= pVersion && sV >= sVersion;
62
- }
63
- return pV >= pVersion;
64
- }
55
+ function checkVersion(version, pVersion, sVersion) {
56
+ if (version) {
57
+ const vRest = `${version}`.match(/(\d+).(\d+).(\d+)/);
58
+ if (vRest) {
59
+ const pV = XEUtils.toNumber(vRest[1]);
60
+ if (sVersion) {
61
+ const sV = XEUtils.toNumber(vRest[2]);
62
+ return pV >= pVersion && sV >= sVersion;
63
+ }
64
+ return pV >= pVersion;
65
65
  }
66
- return false;
66
+ }
67
+ return false;
67
68
  }
68
- export const VxeUI = Object.assign(VxeCore, {
69
- renderEmptyElement,
70
- setTheme,
71
- getTheme,
72
- setConfig,
73
- getConfig: getConfig,
74
- setIcon,
75
- getIcon: getIcon,
76
- renderGlobalIcon,
77
- renderCustomIcon,
78
- setLanguage,
79
- hasLanguage,
80
- getLanguage,
81
- setI18n,
82
- getI18n,
83
- globalEvents,
84
- GLOBAL_EVENT_KEYS,
85
- createEvent,
86
- globalResize,
87
- renderer,
88
- validators,
89
- menus,
90
- formats,
91
- commands,
92
- interceptor,
93
- clipboard,
94
- log,
95
- permission,
96
- zIndex,
97
- baseUtils,
98
- domUtils,
99
- scrollbarUtils,
100
- popperUtils,
101
- globalStore,
102
- hooks,
103
- component,
104
- getComponent,
105
- hasComponent,
106
- useFns,
107
- getSlotVNs,
108
- checkVersion,
109
- use
69
+ const VxeUI = Object.assign(VxeCore, {
70
+ renderEmptyElement,
71
+ setTheme,
72
+ getTheme,
73
+ setConfig,
74
+ getConfig,
75
+ setIcon,
76
+ getIcon,
77
+ renderGlobalIcon,
78
+ renderCustomIcon,
79
+ setLanguage,
80
+ hasLanguage,
81
+ getLanguage,
82
+ setI18n,
83
+ getI18n,
84
+ globalEvents,
85
+ GLOBAL_EVENT_KEYS,
86
+ createEvent,
87
+ globalResize,
88
+ renderer,
89
+ validators,
90
+ menus,
91
+ formats,
92
+ commands,
93
+ interceptor,
94
+ clipboard,
95
+ log,
96
+ permission,
97
+ zIndex,
98
+ baseUtils,
99
+ dbUtils,
100
+ domUtils,
101
+ scrollbarUtils,
102
+ popperUtils,
103
+ globalStore,
104
+ hooks,
105
+ component,
106
+ getComponent,
107
+ hasComponent,
108
+ useFns,
109
+ getSlotVNs,
110
+ checkVersion,
111
+ use
110
112
  });
111
113
  setTheme();
112
- export * from './src/core';
113
- export * from './src/event';
114
- export * from './src/resize';
115
- export * from './src/config';
116
- export * from './src/i18n';
117
- export * from './src/icon';
118
- export * from './src/theme';
119
- export * from './src/renderer';
120
- export * from './src/validators';
121
- export * from './src/menus';
122
- export * from './src/formats';
123
- export * from './src/commands';
124
- export * from './src/interceptor';
125
- export * from './src/clipboard';
126
- export * from './src/permission';
127
- export * from './src/z-index';
128
- export * from './src/base-utils';
129
- export * from './src/dom-utils';
130
- export * from './src/scrollbar-utils';
131
- export * from './src/popper-utils';
132
- export * from './src/dataStore';
133
- export * from './src/useFns';
134
- export * from './src/vm';
135
- export * from './src/log';
136
- export * from './src/hooks';
137
- export default VxeUI;
114
+ export * from "./src/core";
115
+ export * from "./src/event";
116
+ export * from "./src/resize";
117
+ export * from "./src/config";
118
+ export * from "./src/i18n";
119
+ export * from "./src/icon";
120
+ export * from "./src/theme";
121
+ export * from "./src/renderer";
122
+ export * from "./src/validators";
123
+ export * from "./src/menus";
124
+ export * from "./src/formats";
125
+ export * from "./src/commands";
126
+ export * from "./src/interceptor";
127
+ export * from "./src/clipboard";
128
+ export * from "./src/permission";
129
+ export * from "./src/z-index";
130
+ export * from "./src/base-utils";
131
+ export * from "./src/db-utils";
132
+ export * from "./src/dom-utils";
133
+ export * from "./src/scrollbar-utils";
134
+ export * from "./src/popper-utils";
135
+ export * from "./src/dataStore";
136
+ export * from "./src/useFns";
137
+ export * from "./src/vm";
138
+ export * from "./src/log";
139
+ export * from "./src/hooks";
140
+ var index_default = VxeUI;
141
+ export {
142
+ VxeUI,
143
+ checkVersion,
144
+ component,
145
+ index_default as default,
146
+ getComponent,
147
+ hasComponent,
148
+ renderEmptyElement,
149
+ use
150
+ };
package/es/index.js ADDED
@@ -0,0 +1,150 @@
1
+ import { VxeCore } from "./src/core";
2
+ import { createCommentVNode } from "vue";
3
+ import { setConfig, getConfig } from "./src/config";
4
+ import { globalStore } from "./src/dataStore";
5
+ import { setIcon, getIcon, renderGlobalIcon, renderCustomIcon } from "./src/icon";
6
+ import { setTheme, getTheme } from "./src/theme";
7
+ import { globalEvents, GLOBAL_EVENT_KEYS, createEvent } from "./src/event";
8
+ import { globalResize } from "./src/resize";
9
+ import { getI18n, setI18n, setLanguage, hasLanguage, getLanguage } from "./src/i18n";
10
+ import { renderer } from "./src/renderer";
11
+ import { validators } from "./src/validators";
12
+ import { menus } from "./src/menus";
13
+ import { formats } from "./src/formats";
14
+ import { commands } from "./src/commands";
15
+ import { interceptor } from "./src/interceptor";
16
+ import { clipboard } from "./src/clipboard";
17
+ import { permission } from "./src/permission";
18
+ import { zIndex } from "./src/z-index";
19
+ import { baseUtils } from "./src/base-utils";
20
+ import { dbUtils } from "./src/db-utils";
21
+ import { domUtils } from "./src/dom-utils";
22
+ import { scrollbarUtils } from "./src/scrollbar-utils";
23
+ import { popperUtils } from "./src/popper-utils";
24
+ import { log } from "./src/log";
25
+ import { hooks } from "./src/hooks";
26
+ import { useFns } from "./src/useFns";
27
+ import { getSlotVNs } from "./src/vm";
28
+ import XEUtils from "xe-utils";
29
+ const installedPlugins = [];
30
+ function use(Plugin, options) {
31
+ if (Plugin && Plugin.install) {
32
+ if (installedPlugins.indexOf(Plugin) === -1) {
33
+ Plugin.install(VxeUI, options);
34
+ installedPlugins.push(Plugin);
35
+ }
36
+ }
37
+ return VxeUI;
38
+ }
39
+ const components = {};
40
+ function getComponent(name) {
41
+ return components[name] || null;
42
+ }
43
+ function hasComponent(name) {
44
+ return !!components[name];
45
+ }
46
+ function component(comp) {
47
+ if (comp && comp.name) {
48
+ components[comp.name] = comp;
49
+ components[XEUtils.kebabCase(comp.name)] = comp;
50
+ }
51
+ }
52
+ function renderEmptyElement() {
53
+ return createCommentVNode();
54
+ }
55
+ function checkVersion(version, pVersion, sVersion) {
56
+ if (version) {
57
+ const vRest = `${version}`.match(/(\d+).(\d+).(\d+)/);
58
+ if (vRest) {
59
+ const pV = XEUtils.toNumber(vRest[1]);
60
+ if (sVersion) {
61
+ const sV = XEUtils.toNumber(vRest[2]);
62
+ return pV >= pVersion && sV >= sVersion;
63
+ }
64
+ return pV >= pVersion;
65
+ }
66
+ }
67
+ return false;
68
+ }
69
+ const VxeUI = Object.assign(VxeCore, {
70
+ renderEmptyElement,
71
+ setTheme,
72
+ getTheme,
73
+ setConfig,
74
+ getConfig,
75
+ setIcon,
76
+ getIcon,
77
+ renderGlobalIcon,
78
+ renderCustomIcon,
79
+ setLanguage,
80
+ hasLanguage,
81
+ getLanguage,
82
+ setI18n,
83
+ getI18n,
84
+ globalEvents,
85
+ GLOBAL_EVENT_KEYS,
86
+ createEvent,
87
+ globalResize,
88
+ renderer,
89
+ validators,
90
+ menus,
91
+ formats,
92
+ commands,
93
+ interceptor,
94
+ clipboard,
95
+ log,
96
+ permission,
97
+ zIndex,
98
+ baseUtils,
99
+ dbUtils,
100
+ domUtils,
101
+ scrollbarUtils,
102
+ popperUtils,
103
+ globalStore,
104
+ hooks,
105
+ component,
106
+ getComponent,
107
+ hasComponent,
108
+ useFns,
109
+ getSlotVNs,
110
+ checkVersion,
111
+ use
112
+ });
113
+ setTheme();
114
+ export * from "./src/core";
115
+ export * from "./src/event";
116
+ export * from "./src/resize";
117
+ export * from "./src/config";
118
+ export * from "./src/i18n";
119
+ export * from "./src/icon";
120
+ export * from "./src/theme";
121
+ export * from "./src/renderer";
122
+ export * from "./src/validators";
123
+ export * from "./src/menus";
124
+ export * from "./src/formats";
125
+ export * from "./src/commands";
126
+ export * from "./src/interceptor";
127
+ export * from "./src/clipboard";
128
+ export * from "./src/permission";
129
+ export * from "./src/z-index";
130
+ export * from "./src/base-utils";
131
+ export * from "./src/db-utils";
132
+ export * from "./src/dom-utils";
133
+ export * from "./src/scrollbar-utils";
134
+ export * from "./src/popper-utils";
135
+ export * from "./src/dataStore";
136
+ export * from "./src/useFns";
137
+ export * from "./src/vm";
138
+ export * from "./src/log";
139
+ export * from "./src/hooks";
140
+ var index_default = VxeUI;
141
+ export {
142
+ VxeUI,
143
+ checkVersion,
144
+ component,
145
+ index_default as default,
146
+ getComponent,
147
+ hasComponent,
148
+ renderEmptyElement,
149
+ use
150
+ };
@@ -0,0 +1,2 @@
1
+ import { VxeBaseUtils } from '../../types';
2
+ export declare const baseUtils: VxeBaseUtils;