@gindow/vue 1.0.4 → 1.0.5
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 +1 -1
- package/dist/style.css +1 -1
- package/dist/vue.cjs +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.mjs +47 -47
- package/package.json +20 -4
- package/src/assets/avatar.png +0 -0
- package/src/assets/icon.png +0 -0
- package/src/components/chart/index.ts +29 -0
- package/src/components/chart/vBar.vue +51 -0
- package/src/components/chart/vFunnel.vue +36 -0
- package/src/components/chart/vLine.vue +79 -0
- package/src/components/chart/vNum.vue +33 -0
- package/src/components/chart/vPie.vue +52 -0
- package/src/hooks/useCaptcha.ts +2 -2
- package/src/index.ts +3 -2
- package/src/libs/auto-imports.d.ts +0 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Vue3 通用基础包,为 `element-go`(桌面端)和 `vant-go`(移动端
|
|
|
5
5
|
## 特性
|
|
6
6
|
|
|
7
7
|
- **工具函数**:`request`(HTTP 请求封装)、`resource`(RESTful 资源)、`DateTime`、`Formatter`、`Validate`、`Platform`、`download`、`get`
|
|
8
|
-
- **Hooks**:`useBreak`(响应式断点)、`useNanoid`(ID 生成)、`useCaptcha`(验证码倒计时)、`useUpload
|
|
8
|
+
- **Hooks**:`useBreak`(响应式断点)、`useNanoid`(ID 生成)、`useCaptcha`(验证码倒计时)、`useUpload`(图片上传处理)
|
|
9
9
|
- **类型定义**:`IModel`、`IAsset`、`IPagination`、`IResult`、`IMenu` 等通用接口
|
|
10
10
|
- **国际化**:Vue3 provide/inject 模式的 i18n 系统,内置中英文
|
|
11
11
|
- **基础样式**:TailwindCSS + 通用布局工具类
|
package/dist/style.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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}
|
|
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;--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--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{.visible{visibility:visible}.static{position:static}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.h-full{height:100%}.min-h-40{min-height:calc(var(--spacing) * 40)}.min-h-60{min-height:calc(var(--spacing) * 60)}.shrink{flex-shrink:1}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@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}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/vue.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("vue"),u=require("@iconify/vue");var d={cancel:`取消`,confirm:`确认`,empty:{noData:`暂无数据`},dialog:{tip:`操作提示`,confirm:`操作确认`}},f={cancel:`Cancel`,confirm:`Confirm`,empty:{noData:`No data`},dialog:{tip:`Tip`,confirm:`Confirm`}},p=()=>{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`},m=Symbol(`vue-locale`),h=(0,l.ref)(p()),g=(0,l.reactive)({en:f,"zh-CN":d}),_=e=>{if(e?.locale&&(h.value=e.locale),e?.messages)for(let[t,n]of Object.entries(e.messages))g[t]=n;return(0,l.provide)(m,{locale:h,messages:g}),{locale:h,messages:g}},v=()=>{let e=(0,l.inject)(m,void 0),t=e?.locale??h,n=e?.messages??g;return{locale:t,t:(e,r)=>{let i=n[t.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 r&&typeof s==`string`&&(s=s.replace(/\{(\w+)\}/g,(e,t)=>r[t]===void 0?`{${t}}`:String(r[t]))),s}}},y=e=>h.value=e,b=()=>h.value,x=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,l.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(e){(0,l.useCssVars)(e=>({v519ff46c:s.value}));let t=e,n={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`},r={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`},i=(0,l.computed)(()=>{if(t.icon)return t.icon;if(!t.type)return``;if(t.type===`folder`)return`folder-close`;let[e,i]=t.type.toLowerCase().split(`/`);return i&&n[i]?n[i]:e&&r[e]?r[e]:e&&n[e]?n[e]:`file-text`}),a=(0,l.computed)(()=>{let e=i.value;return e?e.includes(`:`)?e:`${t.vendor}:${e}`:``}),o=(0,l.computed)(()=>t.color?{color:t.color}:void 0),s=(0,l.computed)(()=>t.strokeWidth);return(t,n)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Icon),{icon:a.value,width:e.size,height:e.size,style:(0,l.normalizeStyle)(o.value),"aria-hidden":null},null,8,[`icon`,`width`,`height`,`style`]))}}),[[`__scopeId`,`data-v-e336ca96`]]),S=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)}},C=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)}},w=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1),T=class e{static{this.dayjs=w.default}static s(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD HH:mm:ss`.replace(/\//g,n))}static m(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD HH:mm`.replace(/\//g,n))}static h(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD HH`.replace(/\//g,n))}static d(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD`.replace(/\//g,n))}static M(t,n=`/`){return e.dayjs(t).format(`YYYY/MM`.replace(/\//g,n))}static y(t){return e.dayjs(t).format(`YYYY`)}static date(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD`.replace(/\//g,n))}static time(t){return e.dayjs(t).format(`HH:mm`)}static format(t,n=`YYYY/MM/DD HH:mm:ss`){return e.dayjs(t).format(n)}},E=class e{static get userAgent(){return window.navigator.userAgent.toLowerCase()}static get isFlutter(){return e.userAgent.match(/flutter/i)!==null}static get isFlutterIOS(){return e.isFlutter&&e.isIOS}static get isWeb(){return window.matchMedia(`(min-width: 992px)`).matches}static get isMobile(){return e.userAgent.match(/(phone|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)!==null}static get isIOS(){return e.userAgent.match(/iphone|ipad|ipod|ios/i)!==null}static get isWechat(){return e.userAgent.match(/MicroMessenger/i)!==null}static get isWxwork(){return e.userAgent.match(/MicroMessenger/i)!==null&&e.userAgent.match(/wxwork/i)!==null}static get isMiniprogram(){return e.userAgent.match(/MicroMessenger/i)!==null&&e.userAgent.match(/miniprogram/i)!==null}},D=768,O=()=>{let e=(0,l.ref)(typeof window<`u`?window.matchMedia(`(min-width: ${D}px)`).matches:!0),t,n=t=>e.value=t.matches;(0,l.onMounted)(()=>{typeof window>`u`||(t=window.matchMedia(`(min-width: ${D}px)`),e.value=t.matches,t.addEventListener(`change`,n))}),(0,l.onBeforeUnmount)(()=>t?.removeEventListener(`change`,n));let r=(0,l.computed)(()=>e.value);return{isMobile:(0,l.computed)(()=>!e.value),isDesktop:r}},k=e=>{let t=(0,l.ref)(0),n=(0,l.ref)(!1),r=(t={})=>new Promise((r,a)=>{n.value||(n.value=!0,e(t).then(()=>{i(),r(!0)}).catch(e=>a(e)).finally(()=>n.value=!1))}),i=()=>{t.value=60;let e=setInterval(()=>{t.value--,t.value||clearTimeout(e)},1e3)};return{waiting:t,send:r}},A=()=>({i:(e,t={})=>e?(0,l.h)(x,{icon:e,...t}):void 0}),j=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,M=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=j[n[e]&63];return t},N=(e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i-->0;)r+=e[Math.random()*e.length|0];return r},P=()=>({nanoid:M,numeric:(e=10)=>N(`1234567890`,e)()}),F=[x];F.forEach(e=>{e.install=t=>{let n=e.name??e.__name;n&&t.component(n,e)}});var I={install(e,t){_(t),F.forEach(t=>e.use(t))}};exports.DateTime=T,exports.Formatter=S,exports.Platform=E,exports.Validate=C,exports.VueIcon=x,exports.default=I,exports.getLocale=b,exports.setLocale=y,exports.useBreak=O,exports.useCaptcha=k,exports.useIcon=A,exports.useLocale=v,exports.useNanoid=P;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("vue"),u=require("@iconify/vue");var d={cancel:`取消`,confirm:`确认`,empty:{noData:`暂无数据`},dialog:{tip:`操作提示`,confirm:`操作确认`}},f={cancel:`Cancel`,confirm:`Confirm`,empty:{noData:`No data`},dialog:{tip:`Tip`,confirm:`Confirm`}},p=()=>{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`},m=Symbol(`vue-locale`),h=(0,l.ref)(p()),g=(0,l.reactive)({en:f,"zh-CN":d}),_=e=>{if(e?.locale&&(h.value=e.locale),e?.messages)for(let[t,n]of Object.entries(e.messages))g[t]=n;return(0,l.provide)(m,{locale:h,messages:g}),{locale:h,messages:g}},v=()=>{let e=(0,l.inject)(m,void 0),t=e?.locale??h,n=e?.messages??g;return{locale:t,t:(e,r)=>{let i=n[t.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 r&&typeof s==`string`&&(s=s.replace(/\{(\w+)\}/g,(e,t)=>r[t]===void 0?`{${t}}`:String(r[t]))),s}}},y=e=>h.value=e,b=()=>h.value,x=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,l.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(e){(0,l.useCssVars)(e=>({v519ff46c:s.value}));let t=e,n={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`},r={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`},i=(0,l.computed)(()=>{if(t.icon)return t.icon;if(!t.type)return``;if(t.type===`folder`)return`folder-close`;let[e,i]=t.type.toLowerCase().split(`/`);return i&&n[i]?n[i]:e&&r[e]?r[e]:e&&n[e]?n[e]:`file-text`}),a=(0,l.computed)(()=>{let e=i.value;return e?e.includes(`:`)?e:`${t.vendor}:${e}`:``}),o=(0,l.computed)(()=>t.color?{color:t.color}:void 0),s=(0,l.computed)(()=>t.strokeWidth);return(t,n)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Icon),{icon:a.value,width:e.size,height:e.size,style:(0,l.normalizeStyle)(o.value),"aria-hidden":null},null,8,[`icon`,`width`,`height`,`style`]))}}),[[`__scopeId`,`data-v-e336ca96`]]),S=768,C=()=>{let e=(0,l.ref)(typeof window<`u`?window.matchMedia(`(min-width: ${S}px)`).matches:!0),t,n=t=>e.value=t.matches;(0,l.onMounted)(()=>{typeof window>`u`||(t=window.matchMedia(`(min-width: ${S}px)`),e.value=t.matches,t.addEventListener(`change`,n))}),(0,l.onBeforeUnmount)(()=>t?.removeEventListener(`change`,n));let r=(0,l.computed)(()=>e.value);return{isMobile:(0,l.computed)(()=>!e.value),isDesktop:r}},w=e=>{let t=(0,l.ref)(0),n=(0,l.ref)(!1),r=(t={})=>new Promise((r,a)=>{n.value||(n.value=!0,e(t).then(()=>{i(),r(!0)}).catch(e=>a(e)).finally(()=>n.value=!1))}),i=()=>{t.value=60;let e=setInterval(()=>{t.value--,t.value||clearTimeout(e)},1e3)};return{waiting:t,send:r}},T=()=>({i:(e,t={})=>e?(0,l.h)(x,{icon:e,...t}):void 0}),E=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,D=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=E[n[e]&63];return t},O=(e,t=21)=>(n=t)=>{let r=``,i=n|0;for(;i-->0;)r+=e[Math.random()*e.length|0];return r},k=()=>({nanoid:D,numeric:(e=10)=>O(`1234567890`,e)()}),A=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)}},j=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)}},M=c(o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}))(),1),N=class e{static{this.dayjs=M.default}static s(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD HH:mm:ss`.replace(/\//g,n))}static m(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD HH:mm`.replace(/\//g,n))}static h(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD HH`.replace(/\//g,n))}static d(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD`.replace(/\//g,n))}static M(t,n=`/`){return e.dayjs(t).format(`YYYY/MM`.replace(/\//g,n))}static y(t){return e.dayjs(t).format(`YYYY`)}static date(t,n=`/`){return e.dayjs(t).format(`YYYY/MM/DD`.replace(/\//g,n))}static time(t){return e.dayjs(t).format(`HH:mm`)}static format(t,n=`YYYY/MM/DD HH:mm:ss`){return e.dayjs(t).format(n)}},P=class e{static get userAgent(){return window.navigator.userAgent.toLowerCase()}static get isFlutter(){return e.userAgent.match(/flutter/i)!==null}static get isFlutterIOS(){return e.isFlutter&&e.isIOS}static get isWeb(){return window.matchMedia(`(min-width: 992px)`).matches}static get isMobile(){return e.userAgent.match(/(phone|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)!==null}static get isIOS(){return e.userAgent.match(/iphone|ipad|ipod|ios/i)!==null}static get isWechat(){return e.userAgent.match(/MicroMessenger/i)!==null}static get isWxwork(){return e.userAgent.match(/MicroMessenger/i)!==null&&e.userAgent.match(/wxwork/i)!==null}static get isMiniprogram(){return e.userAgent.match(/MicroMessenger/i)!==null&&e.userAgent.match(/miniprogram/i)!==null}},F=[x];F.forEach(e=>{e.install=t=>{let n=e.name??e.__name;n&&t.component(n,e)}});var I={install(e,t){_(t),F.forEach(t=>e.use(t))}};exports.DateTime=N,exports.Formatter=A,exports.Platform=P,exports.Validate=j,exports.VueIcon=x,exports.default=I,exports.getLocale=b,exports.setLocale=y,exports.useBreak=C,exports.useCaptcha=w,exports.useIcon=T,exports.useLocale=v,exports.useNanoid=k;
|
package/dist/vue.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ declare const useBreak_2: () => {
|
|
|
152
152
|
};
|
|
153
153
|
export { useBreak_2 as useBreak }
|
|
154
154
|
|
|
155
|
-
declare const useCaptcha_2: (
|
|
155
|
+
declare const useCaptcha_2: (fetch: (data: any) => Promise<void>) => {
|
|
156
156
|
waiting: globalThis.Ref<number, number>;
|
|
157
157
|
send: (para?: {}) => Promise<unknown>;
|
|
158
158
|
};
|
package/dist/vue.mjs
CHANGED
|
@@ -174,7 +174,46 @@ var h = Object.create, g = Object.defineProperty, _ = Object.getOwnPropertyDescr
|
|
|
174
174
|
"style"
|
|
175
175
|
]));
|
|
176
176
|
}
|
|
177
|
-
}), [["__scopeId", "data-v-e336ca96"]]), F =
|
|
177
|
+
}), [["__scopeId", "data-v-e336ca96"]]), F = 768, I = () => {
|
|
178
|
+
let t = d(typeof window < "u" ? window.matchMedia(`(min-width: ${F}px)`).matches : !0), n, r = (e) => t.value = e.matches;
|
|
179
|
+
s(() => {
|
|
180
|
+
typeof window > "u" || (n = window.matchMedia(`(min-width: ${F}px)`), t.value = n.matches, n.addEventListener("change", r));
|
|
181
|
+
}), o(() => n?.removeEventListener("change", r));
|
|
182
|
+
let i = e(() => t.value);
|
|
183
|
+
return {
|
|
184
|
+
isMobile: e(() => !t.value),
|
|
185
|
+
isDesktop: i
|
|
186
|
+
};
|
|
187
|
+
}, L = (e) => {
|
|
188
|
+
let t = d(0), n = d(!1), r = (t = {}) => new Promise((r, a) => {
|
|
189
|
+
n.value || (n.value = !0, e(t).then(() => {
|
|
190
|
+
i(), r(!0);
|
|
191
|
+
}).catch((e) => a(e)).finally(() => n.value = !1));
|
|
192
|
+
}), i = () => {
|
|
193
|
+
t.value = 60;
|
|
194
|
+
let e = setInterval(() => {
|
|
195
|
+
t.value--, t.value || clearTimeout(e);
|
|
196
|
+
}, 1e3);
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
waiting: t,
|
|
200
|
+
send: r
|
|
201
|
+
};
|
|
202
|
+
}, R = () => ({ i: (e, t = {}) => e ? r(P, {
|
|
203
|
+
icon: e,
|
|
204
|
+
...t
|
|
205
|
+
}) : void 0 }), z = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", B = (e = 21) => {
|
|
206
|
+
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
|
|
207
|
+
for (; e--;) t += z[n[e] & 63];
|
|
208
|
+
return t;
|
|
209
|
+
}, V = (e, t = 21) => (n = t) => {
|
|
210
|
+
let r = "", i = n | 0;
|
|
211
|
+
for (; i-- > 0;) r += e[Math.random() * e.length | 0];
|
|
212
|
+
return r;
|
|
213
|
+
}, H = () => ({
|
|
214
|
+
nanoid: B,
|
|
215
|
+
numeric: (e = 10) => V("1234567890", e)()
|
|
216
|
+
}), U = class {
|
|
178
217
|
static {
|
|
179
218
|
this.config = {};
|
|
180
219
|
}
|
|
@@ -219,7 +258,7 @@ var h = Object.create, g = Object.defineProperty, _ = Object.getOwnPropertyDescr
|
|
|
219
258
|
static {
|
|
220
259
|
this.currency = (e = 0, t) => this.price(e, t);
|
|
221
260
|
}
|
|
222
|
-
},
|
|
261
|
+
}, W = class e {
|
|
223
262
|
static {
|
|
224
263
|
this.country = "";
|
|
225
264
|
}
|
|
@@ -253,7 +292,7 @@ var h = Object.create, g = Object.defineProperty, _ = Object.getOwnPropertyDescr
|
|
|
253
292
|
static {
|
|
254
293
|
this.cname = (t) => e.cname_pattern.test(t);
|
|
255
294
|
}
|
|
256
|
-
},
|
|
295
|
+
}, G = /* @__PURE__ */ C((/* @__PURE__ */ x(((e, t) => {
|
|
257
296
|
(function(n, r) {
|
|
258
297
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).dayjs = r();
|
|
259
298
|
})(e, (function() {
|
|
@@ -547,9 +586,9 @@ var h = Object.create, g = Object.defineProperty, _ = Object.getOwnPropertyDescr
|
|
|
547
586
|
return w(1e3 * e);
|
|
548
587
|
}, w.en = b[y], w.Ls = b, w.p = {}, w;
|
|
549
588
|
}));
|
|
550
|
-
})))(), 1),
|
|
589
|
+
})))(), 1), K = class e {
|
|
551
590
|
static {
|
|
552
|
-
this.dayjs =
|
|
591
|
+
this.dayjs = G.default;
|
|
553
592
|
}
|
|
554
593
|
static s(t, n = "/") {
|
|
555
594
|
return e.dayjs(t).format("YYYY/MM/DD HH:mm:ss".replace(/\//g, n));
|
|
@@ -578,7 +617,7 @@ var h = Object.create, g = Object.defineProperty, _ = Object.getOwnPropertyDescr
|
|
|
578
617
|
static format(t, n = "YYYY/MM/DD HH:mm:ss") {
|
|
579
618
|
return e.dayjs(t).format(n);
|
|
580
619
|
}
|
|
581
|
-
},
|
|
620
|
+
}, q = class e {
|
|
582
621
|
static get userAgent() {
|
|
583
622
|
return window.navigator.userAgent.toLowerCase();
|
|
584
623
|
}
|
|
@@ -606,46 +645,7 @@ var h = Object.create, g = Object.defineProperty, _ = Object.getOwnPropertyDescr
|
|
|
606
645
|
static get isMiniprogram() {
|
|
607
646
|
return e.userAgent.match(/MicroMessenger/i) !== null && e.userAgent.match(/miniprogram/i) !== null;
|
|
608
647
|
}
|
|
609
|
-
},
|
|
610
|
-
let t = d(typeof window < "u" ? window.matchMedia(`(min-width: ${B}px)`).matches : !0), n, r = (e) => t.value = e.matches;
|
|
611
|
-
s(() => {
|
|
612
|
-
typeof window > "u" || (n = window.matchMedia(`(min-width: ${B}px)`), t.value = n.matches, n.addEventListener("change", r));
|
|
613
|
-
}), o(() => n?.removeEventListener("change", r));
|
|
614
|
-
let i = e(() => t.value);
|
|
615
|
-
return {
|
|
616
|
-
isMobile: e(() => !t.value),
|
|
617
|
-
isDesktop: i
|
|
618
|
-
};
|
|
619
|
-
}, H = (e) => {
|
|
620
|
-
let t = d(0), n = d(!1), r = (t = {}) => new Promise((r, a) => {
|
|
621
|
-
n.value || (n.value = !0, e(t).then(() => {
|
|
622
|
-
i(), r(!0);
|
|
623
|
-
}).catch((e) => a(e)).finally(() => n.value = !1));
|
|
624
|
-
}), i = () => {
|
|
625
|
-
t.value = 60;
|
|
626
|
-
let e = setInterval(() => {
|
|
627
|
-
t.value--, t.value || clearTimeout(e);
|
|
628
|
-
}, 1e3);
|
|
629
|
-
};
|
|
630
|
-
return {
|
|
631
|
-
waiting: t,
|
|
632
|
-
send: r
|
|
633
|
-
};
|
|
634
|
-
}, U = () => ({ i: (e, t = {}) => e ? r(P, {
|
|
635
|
-
icon: e,
|
|
636
|
-
...t
|
|
637
|
-
}) : void 0 }), W = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", G = (e = 21) => {
|
|
638
|
-
let t = "", n = crypto.getRandomValues(new Uint8Array(e |= 0));
|
|
639
|
-
for (; e--;) t += W[n[e] & 63];
|
|
640
|
-
return t;
|
|
641
|
-
}, K = (e, t = 21) => (n = t) => {
|
|
642
|
-
let r = "", i = n | 0;
|
|
643
|
-
for (; i-- > 0;) r += e[Math.random() * e.length | 0];
|
|
644
|
-
return r;
|
|
645
|
-
}, q = () => ({
|
|
646
|
-
nanoid: G,
|
|
647
|
-
numeric: (e = 10) => K("1234567890", e)()
|
|
648
|
-
}), J = [P];
|
|
648
|
+
}, J = [P];
|
|
649
649
|
J.forEach((e) => {
|
|
650
650
|
e.install = (t) => {
|
|
651
651
|
let n = e.name ?? e.__name;
|
|
@@ -656,4 +656,4 @@ var Y = { install(e, t) {
|
|
|
656
656
|
A(t), J.forEach((t) => e.use(t));
|
|
657
657
|
} };
|
|
658
658
|
//#endregion
|
|
659
|
-
export {
|
|
659
|
+
export { K as DateTime, U as Formatter, q as Platform, W as Validate, P as VueIcon, Y as default, N as getLocale, M as setLocale, I as useBreak, L as useCaptcha, R as useIcon, j as useLocale, H as useNanoid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gindow/vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Vue3 通用基础包,包含工具函数、Hooks、类型定义、国际化、基础样式",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@iconify/vue": "^5.0.0",
|
|
43
|
+
"@visactor/vchart": "^2.0.0",
|
|
44
|
+
"@vueuse/core": "^12.0.0 || ^13.0.0 || ^14.0.0",
|
|
43
45
|
"dayjs": "^1.11.0",
|
|
46
|
+
"lodash": "^4.17.0",
|
|
44
47
|
"nanoid": "^5.0.0",
|
|
45
48
|
"vue": "^3.5.0"
|
|
46
49
|
},
|
|
@@ -48,25 +51,38 @@
|
|
|
48
51
|
"@iconify/vue": {
|
|
49
52
|
"optional": true
|
|
50
53
|
},
|
|
54
|
+
"@visactor/vchart": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"@vueuse/core": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
51
60
|
"dayjs": {
|
|
52
61
|
"optional": true
|
|
53
62
|
},
|
|
63
|
+
"lodash": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
54
66
|
"nanoid": {
|
|
55
67
|
"optional": true
|
|
56
68
|
}
|
|
57
69
|
},
|
|
58
70
|
"devDependencies": {
|
|
59
71
|
"@iconify/vue": "^5.0.1",
|
|
60
|
-
"@tailwindcss/vite": "^4.3.
|
|
72
|
+
"@tailwindcss/vite": "^4.3.2",
|
|
73
|
+
"@types/lodash": "^4.17.24",
|
|
61
74
|
"@types/node": "^22.20.0",
|
|
75
|
+
"@visactor/vchart": "^2.1.2",
|
|
62
76
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
63
77
|
"@vue/tsconfig": "^0.5.1",
|
|
78
|
+
"@vueuse/core": "^14.3.0",
|
|
64
79
|
"dayjs": "^1.11.21",
|
|
80
|
+
"lodash": "^4.18.1",
|
|
65
81
|
"nanoid": "^5.1.16",
|
|
66
|
-
"tailwindcss": "^4.3.
|
|
82
|
+
"tailwindcss": "^4.3.2",
|
|
67
83
|
"typescript": "^5.9.3",
|
|
68
84
|
"unplugin-auto-import": "^21.0.0",
|
|
69
|
-
"vite": "^8.1.
|
|
85
|
+
"vite": "^8.1.1",
|
|
70
86
|
"vite-plugin-dts": "^4.5.4",
|
|
71
87
|
"vue": "^3.5.39",
|
|
72
88
|
"vue-tsc": "^2.2.12"
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import VChart, { type ISpec } from '@visactor/vchart'
|
|
2
|
+
import { computed, watch, onUnmounted } from 'vue'
|
|
3
|
+
import { useDark } from '@vueuse/core'
|
|
4
|
+
|
|
5
|
+
export { default as vBar } from './vBar.vue'
|
|
6
|
+
export { default as vFunnel } from './vFunnel.vue'
|
|
7
|
+
export { default as vLine } from './vLine.vue'
|
|
8
|
+
export { default as vNum } from './vNum.vue'
|
|
9
|
+
export { default as vPie } from './vPie.vue'
|
|
10
|
+
|
|
11
|
+
export const useChart = () => {
|
|
12
|
+
|
|
13
|
+
let chart: VChart
|
|
14
|
+
|
|
15
|
+
const isDark = useDark()
|
|
16
|
+
const theme = computed(() => isDark.value ? 'dark' : 'light')
|
|
17
|
+
const draw = (spec: ISpec, dom?: HTMLDivElement) => {
|
|
18
|
+
chart = new VChart(spec, { dom })
|
|
19
|
+
chart.setCurrentThemeSync(theme.value).renderAsync()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
watch(() => isDark.value, () => chart.setCurrentThemeSync(theme.value).renderSync())
|
|
23
|
+
|
|
24
|
+
const update = (spec: ISpec) => chart.updateSpec(spec).then(() => chart.renderSync())
|
|
25
|
+
|
|
26
|
+
onUnmounted(() => chart && chart.release())
|
|
27
|
+
|
|
28
|
+
return { draw, update }
|
|
29
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="chartRef" class="h-full min-h-60" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import type { PropType } from 'vue'
|
|
7
|
+
import type { IModel } from '../../types'
|
|
8
|
+
import { ref, computed, watch, onMounted } from 'vue'
|
|
9
|
+
import { useChart } from '.'
|
|
10
|
+
|
|
11
|
+
const { title, props, values } = defineProps({
|
|
12
|
+
title: { type: String, required: true },
|
|
13
|
+
props: { type: Object, default: () => ({}) },
|
|
14
|
+
values: { type: Array as PropType<IModel[]> },
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const chartRef = ref<HTMLDivElement>()
|
|
18
|
+
const spec = computed(() => ({
|
|
19
|
+
type: 'bar',
|
|
20
|
+
xField: props.xField ?? 'month',
|
|
21
|
+
yField: props.yField ?? 'sales',
|
|
22
|
+
background: 'transparent',
|
|
23
|
+
data: [
|
|
24
|
+
{
|
|
25
|
+
values: values ?? [
|
|
26
|
+
{ month: 'Monday', sales: 22 },
|
|
27
|
+
{ month: 'Tuesday', sales: 13 },
|
|
28
|
+
{ month: 'Wednesday', sales: 25 },
|
|
29
|
+
{ month: 'Thursday', sales: 29 },
|
|
30
|
+
{ month: 'Friday', sales: 38 }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
axes: [
|
|
35
|
+
props.autoRotate ? {
|
|
36
|
+
orient: 'bottom',
|
|
37
|
+
sampling: false,
|
|
38
|
+
label: {
|
|
39
|
+
autoRotate: true
|
|
40
|
+
}
|
|
41
|
+
} : {}
|
|
42
|
+
],
|
|
43
|
+
title: { text: title, textStyle: { fontSize: 14 } },
|
|
44
|
+
}))
|
|
45
|
+
|
|
46
|
+
const chart = useChart()
|
|
47
|
+
|
|
48
|
+
watch(() => values, () => chart.update(spec.value))
|
|
49
|
+
|
|
50
|
+
onMounted(() => chart.draw(spec.value, chartRef.value))
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="chartRef" class="h-full min-h-60" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import type { PropType } from 'vue'
|
|
7
|
+
import type { IModel } from '../../types'
|
|
8
|
+
import { ref, onMounted } from 'vue'
|
|
9
|
+
import { useChart } from '.'
|
|
10
|
+
|
|
11
|
+
const { title, values } = defineProps({
|
|
12
|
+
title: { type: String, required: true },
|
|
13
|
+
props: { type: Object, default: () => ({}) },
|
|
14
|
+
values: { type: Array as PropType<IModel[]>, default: () => ([]) },
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const chartRef = ref<HTMLDivElement>()
|
|
18
|
+
const spec = {
|
|
19
|
+
type: 'funnel',
|
|
20
|
+
categoryField: 'name',
|
|
21
|
+
valueField: 'value',
|
|
22
|
+
background: 'transparent',
|
|
23
|
+
isTransform: true,
|
|
24
|
+
isCone: false,
|
|
25
|
+
data: [{ values }],
|
|
26
|
+
title: { text: title },
|
|
27
|
+
transformLabel: { visible: true },
|
|
28
|
+
outerLabel: {
|
|
29
|
+
position: 'right',
|
|
30
|
+
visible: true,
|
|
31
|
+
},
|
|
32
|
+
legends: [{ visible: true }],
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
onMounted(() => useChart().draw(spec, chartRef.value))
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="chartRef" class="h-full min-h-60" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import type { PropType } from 'vue'
|
|
7
|
+
import type { ISpec } from '@visactor/vchart'
|
|
8
|
+
import type { IModel } from '../../types'
|
|
9
|
+
import { ref, computed, watch, onMounted } from 'vue'
|
|
10
|
+
import { useChart } from '.'
|
|
11
|
+
import _ from 'lodash'
|
|
12
|
+
|
|
13
|
+
const { title, props, values, ...rest } = defineProps({
|
|
14
|
+
title: { type: String },
|
|
15
|
+
props: { type: Object, default: () => ({}) },
|
|
16
|
+
series: { type: Array as PropType<IModel[]> },
|
|
17
|
+
values: { type: Array as PropType<IModel[]> },
|
|
18
|
+
spec: { type: Object as PropType<ISpec> },
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const chartRef = ref<HTMLDivElement>()
|
|
22
|
+
const chart = useChart()
|
|
23
|
+
const chartSpec = computed(() => _.merge({}, {
|
|
24
|
+
type: 'line',
|
|
25
|
+
xField: 'label',
|
|
26
|
+
yField: 'value',
|
|
27
|
+
seriesField: 'series',
|
|
28
|
+
background: 'transparent',
|
|
29
|
+
stack: true,
|
|
30
|
+
data: {
|
|
31
|
+
values: values ?? [
|
|
32
|
+
{ label: 'Nail polish', series: 'Africa', value: 4229 },
|
|
33
|
+
{ label: 'Nail polish', series: 'China', value: 3054 },
|
|
34
|
+
{ label: 'Nail polish', series: 'USA', value: 12814 },
|
|
35
|
+
{ label: 'Eyebrow pencil', series: 'Africa', value: 3932 },
|
|
36
|
+
{ label: 'Eyebrow pencil', series: 'China', value: 5067 },
|
|
37
|
+
{ label: 'Eyebrow pencil', series: 'USA', value: 13012 },
|
|
38
|
+
{ label: 'Rouge', series: 'Africa', value: 5221 },
|
|
39
|
+
{ label: 'Rouge', series: 'China', value: 7004 },
|
|
40
|
+
{ label: 'Rouge', series: 'USA', value: 11624 },
|
|
41
|
+
{ label: 'Lipstick', series: 'Africa', value: 9256 },
|
|
42
|
+
{ label: 'Lipstick', series: 'China', value: 9054 },
|
|
43
|
+
{ label: 'Lipstick', series: 'USA', value: 8814 },
|
|
44
|
+
{ label: 'Eyeshadows', series: 'Africa', value: 3308 },
|
|
45
|
+
{ label: 'Eyeshadows', series: 'China', value: 12043 },
|
|
46
|
+
{ label: 'Eyeshadows', series: 'USA', value: 12998 },
|
|
47
|
+
{ label: 'Eyeliner', series: 'Africa', value: 5432 },
|
|
48
|
+
{ label: 'Eyeliner', series: 'China', value: 15067 },
|
|
49
|
+
{ label: 'Eyeliner', series: 'USA', value: 12321 },
|
|
50
|
+
{ label: 'Foundation', series: 'Africa', value: 13701 },
|
|
51
|
+
{ label: 'Foundation', series: 'China', value: 10119 },
|
|
52
|
+
{ label: 'Foundation', series: 'USA', value: 10342 },
|
|
53
|
+
{ label: 'Lip gloss', series: 'Africa', value: 4008 },
|
|
54
|
+
{ label: 'Lip gloss', series: 'China', value: 12043 },
|
|
55
|
+
{ label: 'Lip gloss', series: 'USA', value: 22998 },
|
|
56
|
+
{ label: 'Mascara', series: 'Africa', value: 18712 },
|
|
57
|
+
{ label: 'Mascara', series: 'China', value: 10419 },
|
|
58
|
+
{ label: 'Mascara', series: 'USA', value: 11261 }
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
title: { text: title, textStyle: { fontSize: 14 } },
|
|
62
|
+
line: {
|
|
63
|
+
style: { lineWidth: 1 }
|
|
64
|
+
},
|
|
65
|
+
}, props))
|
|
66
|
+
|
|
67
|
+
const spec = computed(() => rest.spec || chartSpec.value)
|
|
68
|
+
|
|
69
|
+
let drawn = false
|
|
70
|
+
|
|
71
|
+
watch(spec, value => {
|
|
72
|
+
if (drawn) chart.update(value)
|
|
73
|
+
}, { deep: true })
|
|
74
|
+
|
|
75
|
+
onMounted(() => {
|
|
76
|
+
chart.draw(spec.value, chartRef.value)
|
|
77
|
+
drawn = true
|
|
78
|
+
})
|
|
79
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="v-num h-full min-h-40 flex-center text-center bg-color-overlay">
|
|
3
|
+
<div class="text-sm">
|
|
4
|
+
<div v-if="icon" class="flex-center">
|
|
5
|
+
<div class="icon" :style="{ backgroundColor: color }">
|
|
6
|
+
<vue-icon :icon />
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="mt-3 text-2xl">{{ (amount).toLocaleString() }}</div>
|
|
10
|
+
<div class="mt-1">{{ title }}</div>
|
|
11
|
+
<div v-if="growth !== null" class="mt-2" :class="raise ? 'text-green' : 'text-red'">{{ raise ? '+' : '' }}{{ growth }}</div>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import VueIcon from '../VueIcon.vue';
|
|
18
|
+
|
|
19
|
+
const { growth } = defineProps({
|
|
20
|
+
icon: { type: String },
|
|
21
|
+
color: { type: String, default: '#093' },
|
|
22
|
+
title: { type: String, default: 'Total' },
|
|
23
|
+
amount: { type: Number, default: 0 },
|
|
24
|
+
growth: { type: [Number, String], default: null },
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const value = computed(() => typeof growth === 'string' ? Number(growth.match(/-?\d+(\.\d+)?/g)?.[0] || 0) : growth as number)
|
|
28
|
+
const raise = computed(() => value.value > 0)
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style scoped>
|
|
32
|
+
.v-num .icon { display: inline-flex; color: #fff; padding: 8px; border-radius: 50%; }
|
|
33
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="chartRef" class="h-full min-h-60" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script setup lang="ts">
|
|
6
|
+
import type { PropType } from 'vue'
|
|
7
|
+
import type { IModel } from '../../types'
|
|
8
|
+
import { ref, computed, watch, onMounted } from 'vue'
|
|
9
|
+
import { useChart } from '.'
|
|
10
|
+
import _ from 'lodash'
|
|
11
|
+
|
|
12
|
+
const { title, props, values } = defineProps({
|
|
13
|
+
title: { type: String, required: true },
|
|
14
|
+
props: { type: Object, default: () => ({}) },
|
|
15
|
+
values: { type: Array as PropType<IModel[]> },
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const chartRef = ref<HTMLDivElement>()
|
|
19
|
+
const chart = useChart()
|
|
20
|
+
const spec = computed(() => _.merge({}, {
|
|
21
|
+
type: 'pie',
|
|
22
|
+
valueField: 'value',
|
|
23
|
+
categoryField: 'type',
|
|
24
|
+
background: 'transparent',
|
|
25
|
+
outerRadius: 1,
|
|
26
|
+
innerRadius: 0.4,
|
|
27
|
+
data: [
|
|
28
|
+
{
|
|
29
|
+
values: values ?? [
|
|
30
|
+
{ type: 'oxygen', value: '46.60' },
|
|
31
|
+
{ type: 'silicon', value: '27.72' },
|
|
32
|
+
{ type: 'aluminum', value: '8.13' },
|
|
33
|
+
{ type: 'iron', value: '5' },
|
|
34
|
+
{ type: 'calcium', value: '3.63' },
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
title: { text: title, textStyle: { fontSize: 14 } },
|
|
39
|
+
label: { visible: true },
|
|
40
|
+
}, props))
|
|
41
|
+
|
|
42
|
+
let drawn = false
|
|
43
|
+
|
|
44
|
+
watch(spec, value => {
|
|
45
|
+
if (drawn) chart.update(value)
|
|
46
|
+
}, { deep: true })
|
|
47
|
+
|
|
48
|
+
onMounted(() => {
|
|
49
|
+
chart.draw(spec.value, chartRef.value)
|
|
50
|
+
drawn = true
|
|
51
|
+
})
|
|
52
|
+
</script>
|
package/src/hooks/useCaptcha.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref } from 'vue'
|
|
2
2
|
|
|
3
|
-
export const useCaptcha = (
|
|
3
|
+
export const useCaptcha = (fetch: (data: any) => Promise<void>) => {
|
|
4
4
|
|
|
5
5
|
const waiting = ref(0)
|
|
6
6
|
const loading = ref(false)
|
|
@@ -9,7 +9,7 @@ export const useCaptcha = (api: (data: any) => Promise<void>) => {
|
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
10
10
|
if (loading.value) return
|
|
11
11
|
loading.value = true
|
|
12
|
-
|
|
12
|
+
fetch(para).then(() => {
|
|
13
13
|
timer()
|
|
14
14
|
resolve(true)
|
|
15
15
|
}).catch(err => reject(err))
|
package/src/index.ts
CHANGED
|
@@ -22,13 +22,14 @@ const Vue: Plugin = {
|
|
|
22
22
|
},
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export * from './types'
|
|
26
|
-
export * from './utils'
|
|
27
25
|
export { useBreak } from './hooks/useBreak'
|
|
28
26
|
export { useCaptcha } from './hooks/useCaptcha'
|
|
29
27
|
export { useIcon } from './hooks/useIcon'
|
|
30
28
|
export { useNanoid } from './hooks/useNanoid'
|
|
31
29
|
|
|
30
|
+
export * from './types'
|
|
31
|
+
export * from './utils'
|
|
32
|
+
|
|
32
33
|
export default Vue
|
|
33
34
|
|
|
34
35
|
export {
|
|
@@ -56,7 +56,6 @@ declare global {
|
|
|
56
56
|
const useAttrs: typeof import('vue').useAttrs
|
|
57
57
|
const useBreak: typeof import('../hooks/useBreak').useBreak
|
|
58
58
|
const useCaptcha: typeof import('../hooks/useCaptcha').useCaptcha
|
|
59
|
-
const useChat: typeof import('../hooks/useChat').useChat
|
|
60
59
|
const useCssModule: typeof import('vue').useCssModule
|
|
61
60
|
const useCssVars: typeof import('vue').useCssVars
|
|
62
61
|
const useIcon: typeof import('../hooks/useIcon').useIcon
|