@gindow/vue 1.0.0 → 1.0.2
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/README.md +6 -6
- package/dist/resolver.cjs +1 -0
- package/dist/resolver.d.ts +15 -0
- package/dist/resolver.mjs +16 -0
- package/dist/style.css +1 -2
- package/dist/vue.cjs +1 -0
- package/dist/vue.d.ts +219 -0
- package/dist/vue.mjs +286 -0
- package/package.json +11 -52
- package/src/components/VueIcon.vue +65 -0
- package/src/hooks/useIcon.ts +9 -0
- package/src/index.ts +18 -9
- package/src/libs/auto-imports.d.ts +79 -0
- package/src/locale/index.ts +1 -1
- package/src/resolver.ts +19 -0
- package/src/style.css +9 -16
- package/src/utils/index.ts +0 -7
- package/dist/index.cjs +0 -2
- package/dist/index.mjs +0 -406
- package/dist/vue-go.d.ts +0 -394
- package/src/hooks/useChat.ts +0 -135
- package/src/hooks/useNanoid.ts +0 -9
- package/src/hooks/useUpload.ts +0 -59
- package/src/types/chat.ts +0 -62
- package/src/utils/datetime.ts +0 -42
- package/src/utils/download.ts +0 -11
- package/src/utils/get.ts +0 -10
- package/src/utils/platform.ts +0 -38
- package/src/utils/request.ts +0 -146
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# vue
|
|
1
|
+
# @gindow/vue
|
|
2
2
|
|
|
3
3
|
Vue3 通用基础包,为 `element-go`(桌面端)和 `vant-go`(移动端)提供公共基础设施。
|
|
4
4
|
|
|
@@ -13,7 +13,7 @@ Vue3 通用基础包,为 `element-go`(桌面端)和 `vant-go`(移动端
|
|
|
13
13
|
## 安装
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install vue
|
|
16
|
+
npm install @gindow/vue
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## 使用
|
|
@@ -21,14 +21,14 @@ npm install vue-go
|
|
|
21
21
|
```js
|
|
22
22
|
// main.js
|
|
23
23
|
import { createApp } from 'vue'
|
|
24
|
-
import
|
|
25
|
-
import 'vue
|
|
24
|
+
import Vue from '@gindow/vue'
|
|
25
|
+
import '@gindow/vue/style.css'
|
|
26
26
|
|
|
27
27
|
const app = createApp(App)
|
|
28
|
-
app.use(
|
|
28
|
+
app.use(Vue, { locale: 'zh-CN' })
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
```ts
|
|
32
32
|
// 按需引入
|
|
33
|
-
import { request, useBreak, IModel } from 'vue
|
|
33
|
+
import { request, useBreak, IModel } from '@gindow/vue'
|
|
34
34
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e={}){let{importStyle:t=!0,prefix:n=`Vue`}=e;return{type:`component`,resolve(e){if(e.startsWith(n))return{name:e,from:`@gindow/vue`,sideEffects:t?`@gindow/vue/style.css`:void 0}}}}exports.VueResolver=e;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function VueResolver(options?: VueResolverOptions): {
|
|
2
|
+
type: "component";
|
|
3
|
+
resolve(name: string): {
|
|
4
|
+
name: string;
|
|
5
|
+
from: string;
|
|
6
|
+
sideEffects: string | undefined;
|
|
7
|
+
} | undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export declare interface VueResolverOptions {
|
|
11
|
+
importStyle?: boolean;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/resolver.ts
|
|
2
|
+
function e(e = {}) {
|
|
3
|
+
let { importStyle: t = !0, prefix: n = "Vue" } = e;
|
|
4
|
+
return {
|
|
5
|
+
type: "component",
|
|
6
|
+
resolve(e) {
|
|
7
|
+
if (e.startsWith(n)) return {
|
|
8
|
+
name: e,
|
|
9
|
+
from: "@gindow/vue",
|
|
10
|
+
sideEffects: t ? "@gindow/vue/style.css" : void 0
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as VueResolver };
|
package/dist/style.css
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.static{position:static}.shrink{flex-shrink:1}}.flex-center{justify-content:center;align-items:center;display:flex!important}.flex-center-end{justify-content:end;align-items:center;display:flex!important}.flex-center-between{justify-content:space-between;align-items:center;display:flex!important}.flex-center-items{align-items:center;display:flex!important}.text-light{color:#ccc}.dark .text-light{color:#333}
|
|
1
|
+
[data-v-e336ca96] g,[data-v-e336ca96] path{stroke-width:var(--v519ff46c)}@layer theme{:root,:host{--font-sans:ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.static{position:static}.shrink{flex-shrink:1}}@media screen and (width>=768px){.mob{display:none!important}}@media screen and (width<=768px){.web{display:none!important}}.bg-light{background-color:#ccc}.text-light{color:#ccc}.dark .bg-light{background-color:#333}.dark .text-light{color:#333}.flex-center{justify-content:center;align-items:center;display:flex!important}.flex-center-end{justify-content:end;align-items:center;display:flex!important}.flex-center-between{justify-content:space-between;align-items:center;display:flex!important}.flex-center-items{align-items:center;display:flex!important}
|
|
3
2
|
/*$vite$:1*/
|
package/dist/vue.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});let e=require("vue"),t=require("@iconify/vue");var n={cancel:`取消`,confirm:`确认`,empty:{noData:`暂无数据`},dialog:{tip:`操作提示`,confirm:`操作确认`}},r={cancel:`Cancel`,confirm:`Confirm`,empty:{noData:`No data`},dialog:{tip:`Tip`,confirm:`Confirm`}},i=()=>{let e=[`en`,`zh-CN`],t=localStorage.getItem(`locale`),n=navigator.language;return t&&e.includes(t)?t:n&&e.includes(n)?n:n&&e.includes(n.split(`-`)[0])?n.split(`-`)[0]:e[0]??`zh-CN`},a=Symbol(`vue-locale`),o=(0,e.ref)(i()),s=(0,e.reactive)({en:r,"zh-CN":n}),c=t=>{if(t?.locale&&(o.value=t.locale),t?.messages)for(let[e,n]of Object.entries(t.messages))s[e]=n;return(0,e.provide)(a,{locale:o,messages:s}),{locale:o,messages:s}},l=()=>{let t=(0,e.inject)(a,void 0),n=t?.locale??o,r=t?.messages??s;return{locale:n,t:(e,t)=>{let i=r[n.value],a=e.replace(/\[(\d+)]/g,`.$1`).split(`.`),o=i;for(let t of a)if(o=o?.[t],o===void 0)return e;let s=o??e;return t&&typeof s==`string`&&(s=s.replace(/\{(\w+)\}/g,(e,n)=>t[n]===void 0?`{${n}}`:String(t[n]))),s}}},u=e=>o.value=e,d=()=>o.value,f=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,e.defineComponent)({__name:`VueIcon`,props:{vendor:{type:String,default:`icon-park-outline`},icon:{type:String,default:``},type:{type:String,default:``},size:{type:Number,default:16},strokeWidth:{type:Number,default:3},color:{type:String}},setup(n){(0,e.useCssVars)(e=>({v519ff46c:l.value}));let r=n,i={folder:`folder-close`,png:`pic-one`,jpeg:`pic-one`,jpg:`pic-one`,gif:`pic-one`,webp:`pic-one`,bmp:`pic-one`,svg:`pic-one`,mp4:`video`,avi:`video`,mov:`video`,wmv:`video`,flv:`video`,mkv:`video`,webm:`video`,mp3:`music-one`,wav:`music-one`,wma:`music-one`,aac:`music-one`,ogg:`music-one`,flac:`music-one`,pdf:`file-pdf`,doc:`file-word`,docx:`file-word`,xls:`file-excel`,xlsx:`file-excel`,csv:`file-excel`,ppt:`file-ppt`,pptx:`file-ppt`,txt:`file-txt`,md:`file-txt-one`,json:`code`,xml:`code`,html:`code`,css:`code`,js:`code`,ts:`code`,jsx:`code`,tsx:`code`,py:`code`,php:`code`,cpp:`code`,c:`code`,java:`code`,go:`code`,rs:`code`,zip:`zip`,rar:`zip`,"7z":`zip`,tar:`zip`,gz:`zip`,bz2:`zip`},a={image:`pic-one`,video:`video`,audio:`music-one`,text:`file-txt`,application:`file-text`,font:`file-text`,pdf:`file-pdf`,doc:`file-word`,sheet:`file-excel`,ppt:`file-ppt`,md:`file-txt-one`,canvas:`book-open`,album:`pic-one`,yearbook:`book-open`},o=(0,e.computed)(()=>{if(r.icon)return r.icon;if(!r.type)return``;if(r.type===`folder`)return`folder-close`;let[e,t]=r.type.toLowerCase().split(`/`);return t&&i[t]?i[t]:e&&a[e]?a[e]:e&&i[e]?i[e]:`file-text`}),s=(0,e.computed)(()=>{let e=o.value;return e?e.includes(`:`)?e:`${r.vendor}:${e}`:``}),c=(0,e.computed)(()=>r.color?{color:r.color}:void 0),l=(0,e.computed)(()=>r.strokeWidth);return(r,i)=>((0,e.openBlock)(),(0,e.createBlock)((0,e.unref)(t.Icon),{icon:s.value,width:n.size,height:n.size,style:(0,e.normalizeStyle)(c.value),"aria-hidden":null},null,8,[`icon`,`width`,`height`,`style`]))}}),[[`__scopeId`,`data-v-e336ca96`]]),p=class{static{this.config={}}static{this.set=e=>this.config=e}static{this.id=(e=``)=>e.slice(-12).toUpperCase()}static{this.date=(e=``)=>e.substring(0,10)+` `+e.substring(11,19)}static{this.idcard=(e=``)=>e?e.substring(0,6)+`****`+e.substring(14):``}static{this.phone=(e=``,t=!1)=>t||!e?e:e.substring(0,3)+`****`+e.substring(e.length-4)}static{this.email=(e=``)=>{let[t,n]=e.split(`@`);return!t||!n?e:`${t.length>2?t[0]+`****`+t[t.length-1]:t}@${n}`}}static{this.bankcard=(e=``)=>e.substring(0,4)+`****`+e.substring(e.length-4)}static{this.url=(e=``)=>e.replace(/:\/\//g,`:##`).replace(/\/+/g,`/`).replace(/:##/g,`://`)}static{this.price=(e=0,t)=>{let{locale:n,decimals:r,currency:i}=this.config,a=typeof e==`string`?parseFloat(e):e;return new Intl.NumberFormat(n,{style:`currency`,currency:t??i??`CNY`,minimumFractionDigits:r??2,maximumFractionDigits:r??2}).format(a/100)}}static{this.currency=(e=0,t)=>this.price(e,t)}},m=class e{static{this.country=``}static{this.set=e=>this.country=e}static get phone_pattern(){return this.country.toUpperCase()===`CN`?/([1][3,4,5,6,7,8,9][0-9]{9})$/:/^(?:\+?[1-9]\d{7,14}|\d{6,11})$/}static{this.email_pattern=/^([a-zA-Z0-9_\.-]+)@([\da-zA-Z\.-]+)\.([a-zA-Z\.]{2,6})$/}static{this.idcard_pattern=/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/}static{this.cname_pattern=/^(?:[\u4e00-\u9fa5·]{2,16})$/}static{this.password_pattern=/^(?![A-Za-z]+$)(?![0-9]+$)(?![^A-Za-z0-9]+$).{8,20}$/}static{this.phone=t=>e.phone_pattern.test(t)}static{this.email=t=>e.email_pattern.test(t)}static{this.idcard=t=>e.idcard_pattern.test(t)}static{this.cname=t=>e.cname_pattern.test(t)}},h=768,g=()=>{let t=(0,e.ref)(typeof window<`u`?window.matchMedia(`(min-width: ${h}px)`).matches:!0),n,r=e=>t.value=e.matches;(0,e.onMounted)(()=>{typeof window>`u`||(n=window.matchMedia(`(min-width: ${h}px)`),t.value=n.matches,n.addEventListener(`change`,r))}),(0,e.onBeforeUnmount)(()=>n?.removeEventListener(`change`,r));let i=(0,e.computed)(()=>t.value);return{isMobile:(0,e.computed)(()=>!t.value),isDesktop:i}},_=t=>{let n=(0,e.ref)(0),r=(0,e.ref)(!1),i=(e={})=>new Promise((n,i)=>{r.value||(r.value=!0,t(e).then(()=>{a(),n(!0)}).catch(e=>i(e)).finally(()=>r.value=!1))}),a=()=>{n.value=60;let e=setInterval(()=>{n.value--,n.value||clearTimeout(e)},1e3)};return{waiting:n,send:i}},v=()=>({i:(t,n={})=>t?(0,e.h)(f,{icon:t,...n}):void 0}),y=[f];y.forEach(e=>{e.install=t=>{let n=e.name??e.__name;n&&t.component(n,e)}});var b={install(e,t){c(t),y.forEach(t=>e.use(t))}};exports.Formatter=p,exports.Validate=m,exports.VueIcon=f,exports.default=b,exports.getLocale=d,exports.setLocale=u,exports.useBreak=g,exports.useCaptcha=_,exports.useIcon=v,exports.useLocale=l;
|
package/dist/vue.d.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
import { Plugin as Plugin_2 } from 'vue';
|
|
5
|
+
import { PublicProps } from 'vue';
|
|
6
|
+
import { RendererElement } from 'vue';
|
|
7
|
+
import { RendererNode } from 'vue';
|
|
8
|
+
|
|
9
|
+
export declare class Formatter {
|
|
10
|
+
static config: {
|
|
11
|
+
locale?: string;
|
|
12
|
+
currency?: string;
|
|
13
|
+
decimals?: number;
|
|
14
|
+
};
|
|
15
|
+
static set: (config: {
|
|
16
|
+
locale?: string;
|
|
17
|
+
currency?: string;
|
|
18
|
+
decimals?: number;
|
|
19
|
+
}) => {
|
|
20
|
+
locale?: string;
|
|
21
|
+
currency?: string;
|
|
22
|
+
decimals?: number;
|
|
23
|
+
};
|
|
24
|
+
static id: (str?: string) => string;
|
|
25
|
+
static date: (datestr?: string) => string;
|
|
26
|
+
static idcard: (idcard?: string) => string;
|
|
27
|
+
static phone: (phone?: string, naked?: boolean) => string;
|
|
28
|
+
static email: (email?: string) => string;
|
|
29
|
+
static bankcard: (bankcard?: string) => string;
|
|
30
|
+
static url: (url?: string) => string;
|
|
31
|
+
static price: (value?: string | number, currency?: string) => string;
|
|
32
|
+
static currency: (value?: string | number, currency?: string) => string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export declare const getLocale: () => string;
|
|
36
|
+
|
|
37
|
+
export declare interface IAsset extends IModel {
|
|
38
|
+
id: string;
|
|
39
|
+
type: string;
|
|
40
|
+
title: string;
|
|
41
|
+
url: string;
|
|
42
|
+
shrink: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export declare interface IField extends IModel {
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
readonly?: boolean;
|
|
49
|
+
multiple?: boolean;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
options?: {
|
|
52
|
+
label: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}[] | any[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare type IFilter = Omit<IField, 'name'> & {
|
|
58
|
+
label?: string;
|
|
59
|
+
rules?: any[];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export declare interface IMenu {
|
|
63
|
+
key?: string;
|
|
64
|
+
title: string;
|
|
65
|
+
path: string;
|
|
66
|
+
name?: string;
|
|
67
|
+
icon?: string;
|
|
68
|
+
depend?: string;
|
|
69
|
+
hidden?: boolean;
|
|
70
|
+
divider?: boolean;
|
|
71
|
+
disabled?: boolean;
|
|
72
|
+
children?: IMenu[];
|
|
73
|
+
isGroup?: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare interface IModel {
|
|
77
|
+
id?: string | any;
|
|
78
|
+
created_at?: string;
|
|
79
|
+
updated_at?: string;
|
|
80
|
+
deleted_at?: string;
|
|
81
|
+
[property: string]: any;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export declare interface IPagination {
|
|
85
|
+
current_page: number;
|
|
86
|
+
per_page: number;
|
|
87
|
+
count: number;
|
|
88
|
+
total: number;
|
|
89
|
+
total_pages: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export declare interface IParams extends IModel {
|
|
93
|
+
filter?: Object;
|
|
94
|
+
search?: string;
|
|
95
|
+
include?: string;
|
|
96
|
+
page?: number;
|
|
97
|
+
size?: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export declare interface IResult {
|
|
101
|
+
code: number;
|
|
102
|
+
message: string;
|
|
103
|
+
data?: IModel | IModel[] | null;
|
|
104
|
+
meta?: {
|
|
105
|
+
pagination?: IPagination;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export declare interface IUploadUserFile {
|
|
110
|
+
id?: string;
|
|
111
|
+
percentage?: number;
|
|
112
|
+
asset?: IAsset;
|
|
113
|
+
title?: string;
|
|
114
|
+
width?: number;
|
|
115
|
+
height?: number;
|
|
116
|
+
type?: string;
|
|
117
|
+
mimeType?: string;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export declare const setLocale: (lang: string) => string;
|
|
121
|
+
|
|
122
|
+
declare const useBreak_2: () => {
|
|
123
|
+
isMobile: globalThis.ComputedRef<boolean>;
|
|
124
|
+
isDesktop: globalThis.ComputedRef<boolean>;
|
|
125
|
+
};
|
|
126
|
+
export { useBreak_2 as useBreak }
|
|
127
|
+
|
|
128
|
+
declare const useCaptcha_2: (api: (data: any) => Promise<void>) => {
|
|
129
|
+
waiting: globalThis.Ref<number, number>;
|
|
130
|
+
send: (para?: {}) => Promise<unknown>;
|
|
131
|
+
};
|
|
132
|
+
export { useCaptcha_2 as useCaptcha }
|
|
133
|
+
|
|
134
|
+
declare const useIcon_2: () => {
|
|
135
|
+
i: (icon: string, para?: Object) => globalThis.VNode<RendererNode, RendererElement, {
|
|
136
|
+
[key: string]: any;
|
|
137
|
+
}> | undefined;
|
|
138
|
+
};
|
|
139
|
+
export { useIcon_2 as useIcon }
|
|
140
|
+
|
|
141
|
+
export declare const useLocale: () => {
|
|
142
|
+
locale: globalThis.Ref<string, string>;
|
|
143
|
+
t: (path: string, params?: Record<string, string | number>) => string;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export declare class Validate {
|
|
147
|
+
static country: string;
|
|
148
|
+
static set: (country: string) => string;
|
|
149
|
+
static get phone_pattern(): RegExp;
|
|
150
|
+
static email_pattern: RegExp;
|
|
151
|
+
static idcard_pattern: RegExp;
|
|
152
|
+
static cname_pattern: RegExp;
|
|
153
|
+
static password_pattern: RegExp;
|
|
154
|
+
static phone: (str: string) => boolean;
|
|
155
|
+
static email: (str: string) => boolean;
|
|
156
|
+
static idcard: (str: string) => boolean;
|
|
157
|
+
static cname: (str: string) => boolean;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
declare const Vue: Plugin_2;
|
|
161
|
+
export default Vue;
|
|
162
|
+
|
|
163
|
+
export declare const VueIcon: DefineComponent<globalThis.ExtractPropTypes<{
|
|
164
|
+
vendor: {
|
|
165
|
+
type: StringConstructor;
|
|
166
|
+
default: string;
|
|
167
|
+
};
|
|
168
|
+
icon: {
|
|
169
|
+
type: StringConstructor;
|
|
170
|
+
default: string;
|
|
171
|
+
};
|
|
172
|
+
type: {
|
|
173
|
+
type: StringConstructor;
|
|
174
|
+
default: string;
|
|
175
|
+
};
|
|
176
|
+
size: {
|
|
177
|
+
type: NumberConstructor;
|
|
178
|
+
default: number;
|
|
179
|
+
};
|
|
180
|
+
strokeWidth: {
|
|
181
|
+
type: NumberConstructor;
|
|
182
|
+
default: number;
|
|
183
|
+
};
|
|
184
|
+
color: {
|
|
185
|
+
type: StringConstructor;
|
|
186
|
+
};
|
|
187
|
+
}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<globalThis.ExtractPropTypes<{
|
|
188
|
+
vendor: {
|
|
189
|
+
type: StringConstructor;
|
|
190
|
+
default: string;
|
|
191
|
+
};
|
|
192
|
+
icon: {
|
|
193
|
+
type: StringConstructor;
|
|
194
|
+
default: string;
|
|
195
|
+
};
|
|
196
|
+
type: {
|
|
197
|
+
type: StringConstructor;
|
|
198
|
+
default: string;
|
|
199
|
+
};
|
|
200
|
+
size: {
|
|
201
|
+
type: NumberConstructor;
|
|
202
|
+
default: number;
|
|
203
|
+
};
|
|
204
|
+
strokeWidth: {
|
|
205
|
+
type: NumberConstructor;
|
|
206
|
+
default: number;
|
|
207
|
+
};
|
|
208
|
+
color: {
|
|
209
|
+
type: StringConstructor;
|
|
210
|
+
};
|
|
211
|
+
}>> & Readonly<{}>, {
|
|
212
|
+
size: number;
|
|
213
|
+
vendor: string;
|
|
214
|
+
icon: string;
|
|
215
|
+
type: string;
|
|
216
|
+
strokeWidth: number;
|
|
217
|
+
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
218
|
+
|
|
219
|
+
export { }
|
package/dist/vue.mjs
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { computed as e, createBlock as t, defineComponent as n, h as r, inject as i, normalizeStyle as a, onBeforeUnmount as o, onMounted as s, openBlock as c, provide as l, reactive as u, ref as d, unref as f, useCssVars as p } from "vue";
|
|
2
|
+
import { Icon as m } from "@iconify/vue";
|
|
3
|
+
//#region src/locale/zh-CN.ts
|
|
4
|
+
var h = {
|
|
5
|
+
cancel: "取消",
|
|
6
|
+
confirm: "确认",
|
|
7
|
+
empty: { noData: "暂无数据" },
|
|
8
|
+
dialog: {
|
|
9
|
+
tip: "操作提示",
|
|
10
|
+
confirm: "操作确认"
|
|
11
|
+
}
|
|
12
|
+
}, g = {
|
|
13
|
+
cancel: "Cancel",
|
|
14
|
+
confirm: "Confirm",
|
|
15
|
+
empty: { noData: "No data" },
|
|
16
|
+
dialog: {
|
|
17
|
+
tip: "Tip",
|
|
18
|
+
confirm: "Confirm"
|
|
19
|
+
}
|
|
20
|
+
}, _ = () => {
|
|
21
|
+
let e = ["en", "zh-CN"], t = localStorage.getItem("locale"), n = navigator.language;
|
|
22
|
+
return t && e.includes(t) ? t : n && e.includes(n) ? n : n && e.includes(n.split("-")[0]) ? n.split("-")[0] : e[0] ?? "zh-CN";
|
|
23
|
+
}, v = Symbol("vue-locale"), y = d(_()), b = u({
|
|
24
|
+
en: g,
|
|
25
|
+
"zh-CN": h
|
|
26
|
+
}), x = (e) => {
|
|
27
|
+
if (e?.locale && (y.value = e.locale), e?.messages) for (let [t, n] of Object.entries(e.messages)) b[t] = n;
|
|
28
|
+
return l(v, {
|
|
29
|
+
locale: y,
|
|
30
|
+
messages: b
|
|
31
|
+
}), {
|
|
32
|
+
locale: y,
|
|
33
|
+
messages: b
|
|
34
|
+
};
|
|
35
|
+
}, S = () => {
|
|
36
|
+
let e = i(v, void 0), t = e?.locale ?? y, n = e?.messages ?? b;
|
|
37
|
+
return {
|
|
38
|
+
locale: t,
|
|
39
|
+
t: (e, r) => {
|
|
40
|
+
let i = n[t.value], a = e.replace(/\[(\d+)]/g, ".$1").split("."), o = i;
|
|
41
|
+
for (let t of a) if (o = o?.[t], o === void 0) return e;
|
|
42
|
+
let s = o ?? e;
|
|
43
|
+
return r && typeof s == "string" && (s = s.replace(/\{(\w+)\}/g, (e, t) => r[t] === void 0 ? `{${t}}` : String(r[t]))), s;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}, C = (e) => y.value = e, w = () => y.value, T = /* @__PURE__ */ ((e, t) => {
|
|
47
|
+
let n = e.__vccOpts || e;
|
|
48
|
+
for (let [e, r] of t) n[e] = r;
|
|
49
|
+
return n;
|
|
50
|
+
})(/* @__PURE__ */ n({
|
|
51
|
+
__name: "VueIcon",
|
|
52
|
+
props: {
|
|
53
|
+
vendor: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "icon-park-outline"
|
|
56
|
+
},
|
|
57
|
+
icon: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: ""
|
|
60
|
+
},
|
|
61
|
+
type: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: ""
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 16
|
|
68
|
+
},
|
|
69
|
+
strokeWidth: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: 3
|
|
72
|
+
},
|
|
73
|
+
color: { type: String }
|
|
74
|
+
},
|
|
75
|
+
setup(n) {
|
|
76
|
+
p((e) => ({ v519ff46c: d.value }));
|
|
77
|
+
let r = n, i = {
|
|
78
|
+
folder: "folder-close",
|
|
79
|
+
png: "pic-one",
|
|
80
|
+
jpeg: "pic-one",
|
|
81
|
+
jpg: "pic-one",
|
|
82
|
+
gif: "pic-one",
|
|
83
|
+
webp: "pic-one",
|
|
84
|
+
bmp: "pic-one",
|
|
85
|
+
svg: "pic-one",
|
|
86
|
+
mp4: "video",
|
|
87
|
+
avi: "video",
|
|
88
|
+
mov: "video",
|
|
89
|
+
wmv: "video",
|
|
90
|
+
flv: "video",
|
|
91
|
+
mkv: "video",
|
|
92
|
+
webm: "video",
|
|
93
|
+
mp3: "music-one",
|
|
94
|
+
wav: "music-one",
|
|
95
|
+
wma: "music-one",
|
|
96
|
+
aac: "music-one",
|
|
97
|
+
ogg: "music-one",
|
|
98
|
+
flac: "music-one",
|
|
99
|
+
pdf: "file-pdf",
|
|
100
|
+
doc: "file-word",
|
|
101
|
+
docx: "file-word",
|
|
102
|
+
xls: "file-excel",
|
|
103
|
+
xlsx: "file-excel",
|
|
104
|
+
csv: "file-excel",
|
|
105
|
+
ppt: "file-ppt",
|
|
106
|
+
pptx: "file-ppt",
|
|
107
|
+
txt: "file-txt",
|
|
108
|
+
md: "file-txt-one",
|
|
109
|
+
json: "code",
|
|
110
|
+
xml: "code",
|
|
111
|
+
html: "code",
|
|
112
|
+
css: "code",
|
|
113
|
+
js: "code",
|
|
114
|
+
ts: "code",
|
|
115
|
+
jsx: "code",
|
|
116
|
+
tsx: "code",
|
|
117
|
+
py: "code",
|
|
118
|
+
php: "code",
|
|
119
|
+
cpp: "code",
|
|
120
|
+
c: "code",
|
|
121
|
+
java: "code",
|
|
122
|
+
go: "code",
|
|
123
|
+
rs: "code",
|
|
124
|
+
zip: "zip",
|
|
125
|
+
rar: "zip",
|
|
126
|
+
"7z": "zip",
|
|
127
|
+
tar: "zip",
|
|
128
|
+
gz: "zip",
|
|
129
|
+
bz2: "zip"
|
|
130
|
+
}, o = {
|
|
131
|
+
image: "pic-one",
|
|
132
|
+
video: "video",
|
|
133
|
+
audio: "music-one",
|
|
134
|
+
text: "file-txt",
|
|
135
|
+
application: "file-text",
|
|
136
|
+
font: "file-text",
|
|
137
|
+
pdf: "file-pdf",
|
|
138
|
+
doc: "file-word",
|
|
139
|
+
sheet: "file-excel",
|
|
140
|
+
ppt: "file-ppt",
|
|
141
|
+
md: "file-txt-one",
|
|
142
|
+
canvas: "book-open",
|
|
143
|
+
album: "pic-one",
|
|
144
|
+
yearbook: "book-open"
|
|
145
|
+
}, s = e(() => {
|
|
146
|
+
if (r.icon) return r.icon;
|
|
147
|
+
if (!r.type) return "";
|
|
148
|
+
if (r.type === "folder") return "folder-close";
|
|
149
|
+
let [e, t] = r.type.toLowerCase().split("/");
|
|
150
|
+
return t && i[t] ? i[t] : e && o[e] ? o[e] : e && i[e] ? i[e] : "file-text";
|
|
151
|
+
}), l = e(() => {
|
|
152
|
+
let e = s.value;
|
|
153
|
+
return e ? e.includes(":") ? e : `${r.vendor}:${e}` : "";
|
|
154
|
+
}), u = e(() => r.color ? { color: r.color } : void 0), d = e(() => r.strokeWidth);
|
|
155
|
+
return (e, r) => (c(), t(f(m), {
|
|
156
|
+
icon: l.value,
|
|
157
|
+
width: n.size,
|
|
158
|
+
height: n.size,
|
|
159
|
+
style: a(u.value),
|
|
160
|
+
"aria-hidden": null
|
|
161
|
+
}, null, 8, [
|
|
162
|
+
"icon",
|
|
163
|
+
"width",
|
|
164
|
+
"height",
|
|
165
|
+
"style"
|
|
166
|
+
]));
|
|
167
|
+
}
|
|
168
|
+
}), [["__scopeId", "data-v-e336ca96"]]), E = class {
|
|
169
|
+
static {
|
|
170
|
+
this.config = {};
|
|
171
|
+
}
|
|
172
|
+
static {
|
|
173
|
+
this.set = (e) => this.config = e;
|
|
174
|
+
}
|
|
175
|
+
static {
|
|
176
|
+
this.id = (e = "") => e.slice(-12).toUpperCase();
|
|
177
|
+
}
|
|
178
|
+
static {
|
|
179
|
+
this.date = (e = "") => e.substring(0, 10) + " " + e.substring(11, 19);
|
|
180
|
+
}
|
|
181
|
+
static {
|
|
182
|
+
this.idcard = (e = "") => e ? e.substring(0, 6) + "****" + e.substring(14) : "";
|
|
183
|
+
}
|
|
184
|
+
static {
|
|
185
|
+
this.phone = (e = "", t = !1) => t || !e ? e : e.substring(0, 3) + "****" + e.substring(e.length - 4);
|
|
186
|
+
}
|
|
187
|
+
static {
|
|
188
|
+
this.email = (e = "") => {
|
|
189
|
+
let [t, n] = e.split("@");
|
|
190
|
+
return !t || !n ? e : `${t.length > 2 ? t[0] + "****" + t[t.length - 1] : t}@${n}`;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
static {
|
|
194
|
+
this.bankcard = (e = "") => e.substring(0, 4) + "****" + e.substring(e.length - 4);
|
|
195
|
+
}
|
|
196
|
+
static {
|
|
197
|
+
this.url = (e = "") => e.replace(/:\/\//g, ":##").replace(/\/+/g, "/").replace(/:##/g, "://");
|
|
198
|
+
}
|
|
199
|
+
static {
|
|
200
|
+
this.price = (e = 0, t) => {
|
|
201
|
+
let { locale: n, decimals: r, currency: i } = this.config, a = typeof e == "string" ? parseFloat(e) : e;
|
|
202
|
+
return new Intl.NumberFormat(n, {
|
|
203
|
+
style: "currency",
|
|
204
|
+
currency: t ?? i ?? "CNY",
|
|
205
|
+
minimumFractionDigits: r ?? 2,
|
|
206
|
+
maximumFractionDigits: r ?? 2
|
|
207
|
+
}).format(a / 100);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
static {
|
|
211
|
+
this.currency = (e = 0, t) => this.price(e, t);
|
|
212
|
+
}
|
|
213
|
+
}, D = class e {
|
|
214
|
+
static {
|
|
215
|
+
this.country = "";
|
|
216
|
+
}
|
|
217
|
+
static {
|
|
218
|
+
this.set = (e) => this.country = e;
|
|
219
|
+
}
|
|
220
|
+
static get phone_pattern() {
|
|
221
|
+
return this.country.toUpperCase() === "CN" ? /([1][3,4,5,6,7,8,9][0-9]{9})$/ : /^(?:\+?[1-9]\d{7,14}|\d{6,11})$/;
|
|
222
|
+
}
|
|
223
|
+
static {
|
|
224
|
+
this.email_pattern = /^([a-zA-Z0-9_\.-]+)@([\da-zA-Z\.-]+)\.([a-zA-Z\.]{2,6})$/;
|
|
225
|
+
}
|
|
226
|
+
static {
|
|
227
|
+
this.idcard_pattern = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
|
|
228
|
+
}
|
|
229
|
+
static {
|
|
230
|
+
this.cname_pattern = /^(?:[\u4e00-\u9fa5·]{2,16})$/;
|
|
231
|
+
}
|
|
232
|
+
static {
|
|
233
|
+
this.password_pattern = /^(?![A-Za-z]+$)(?![0-9]+$)(?![^A-Za-z0-9]+$).{8,20}$/;
|
|
234
|
+
}
|
|
235
|
+
static {
|
|
236
|
+
this.phone = (t) => e.phone_pattern.test(t);
|
|
237
|
+
}
|
|
238
|
+
static {
|
|
239
|
+
this.email = (t) => e.email_pattern.test(t);
|
|
240
|
+
}
|
|
241
|
+
static {
|
|
242
|
+
this.idcard = (t) => e.idcard_pattern.test(t);
|
|
243
|
+
}
|
|
244
|
+
static {
|
|
245
|
+
this.cname = (t) => e.cname_pattern.test(t);
|
|
246
|
+
}
|
|
247
|
+
}, O = 768, k = () => {
|
|
248
|
+
let t = d(typeof window < "u" ? window.matchMedia(`(min-width: ${O}px)`).matches : !0), n, r = (e) => t.value = e.matches;
|
|
249
|
+
s(() => {
|
|
250
|
+
typeof window > "u" || (n = window.matchMedia(`(min-width: ${O}px)`), t.value = n.matches, n.addEventListener("change", r));
|
|
251
|
+
}), o(() => n?.removeEventListener("change", r));
|
|
252
|
+
let i = e(() => t.value);
|
|
253
|
+
return {
|
|
254
|
+
isMobile: e(() => !t.value),
|
|
255
|
+
isDesktop: i
|
|
256
|
+
};
|
|
257
|
+
}, A = (e) => {
|
|
258
|
+
let t = d(0), n = d(!1), r = (t = {}) => new Promise((r, a) => {
|
|
259
|
+
n.value || (n.value = !0, e(t).then(() => {
|
|
260
|
+
i(), r(!0);
|
|
261
|
+
}).catch((e) => a(e)).finally(() => n.value = !1));
|
|
262
|
+
}), i = () => {
|
|
263
|
+
t.value = 60;
|
|
264
|
+
let e = setInterval(() => {
|
|
265
|
+
t.value--, t.value || clearTimeout(e);
|
|
266
|
+
}, 1e3);
|
|
267
|
+
};
|
|
268
|
+
return {
|
|
269
|
+
waiting: t,
|
|
270
|
+
send: r
|
|
271
|
+
};
|
|
272
|
+
}, j = () => ({ i: (e, t = {}) => e ? r(T, {
|
|
273
|
+
icon: e,
|
|
274
|
+
...t
|
|
275
|
+
}) : void 0 }), M = [T];
|
|
276
|
+
M.forEach((e) => {
|
|
277
|
+
e.install = (t) => {
|
|
278
|
+
let n = e.name ?? e.__name;
|
|
279
|
+
n && t.component(n, e);
|
|
280
|
+
};
|
|
281
|
+
});
|
|
282
|
+
var N = { install(e, t) {
|
|
283
|
+
x(t), M.forEach((t) => e.use(t));
|
|
284
|
+
} };
|
|
285
|
+
//#endregion
|
|
286
|
+
export { E as Formatter, D as Validate, T as VueIcon, N as default, w as getLocale, C as setLocale, k as useBreak, A as useCaptcha, j as useIcon, S as useLocale };
|