m-tool-store 1.0.23 → 1.0.24

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.
@@ -98,7 +98,7 @@ class m {
98
98
  var e, a, l, n, o, i, c, u;
99
99
  (a = (e = this.globalCallbacks).onRequestEnd) == null || a.call(e, t.config);
100
100
  const r = t.config;
101
- return (n = (l = r.callbacks) == null ? void 0 : l.onRequestEnd) == null || n.call(l, t.config), (i = (o = this.globalCallbacks).onResponseSuccess) == null || i.call(o, t), (u = (c = r.callbacks) == null ? void 0 : c.onResponseSuccess) == null || u.call(c, t), t;
101
+ return (n = (l = r.callbacks) == null ? void 0 : l.onRequestEnd) == null || n.call(l, t.config), (i = (o = this.globalCallbacks).onResponseSuccess) == null || i.call(o, t), (u = (c = r.callbacks) == null ? void 0 : c.onResponseSuccess) == null || u.call(c, t), t == null ? void 0 : t.data;
102
102
  },
103
103
  (t) => {
104
104
  var r, e, a, l, n, o, i, c;
@@ -1 +1 @@
1
- (function(s,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("dayjs"),require("lodash"),require("axios")):typeof define=="function"&&define.amd?define(["exports","dayjs","lodash","axios"],f):(s=typeof globalThis<"u"?globalThis:s||self,f(s.MToolStore={},s.dayjs,s._,s.axios))})(this,function(s,f,y,Y){"use strict";class S{static formatMoney(t,n){if(t==null)return"";let e=Number(t);if(isNaN(e))return t;let l=/([\-\+]?)(\d*)(\.\d+)?/g.exec(""+e),i=l&&l[1]||"",o=(l&&l[2]||"").split(""),r=l&&l[3]||"",c=o.length%3,u=o.reduce(function(d,_,b){return b+1===c||(b+1-c)%3===0?d+_+",":d+_},"").replace(/\,$/g,"");return u===""&&(u="0"),n!=null&&(n==0?r&&parseFloat(r)>.5?(r="",u=parseInt(u)+1+""):r="":n>0&&(!r||r=="0"||r==".0"?r="."+"0".repeat(n):(r=parseFloat(r).toFixed(2),r>="1"&&(u=parseInt(u)+1+"",r="."+"0".repeat(n)))),r=(r||"").replace("0.",".")),i+u+r}}var m=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var p={exports:{}};(function(a,t){(function(n,e){a.exports=e()})(m,function(){return function(n,e){e.prototype.weekday=function(l){var i=this.$locale().weekStart||0,o=this.$W,r=(o<i?o+7:o)-i;return this.$utils().u(l)?r:this.subtract(r,"day").add(l,"day")}}})})(p);var M=p.exports;const k=x(M);var C={exports:{}};(function(a,t){(function(n,e){a.exports=e(f)})(m,function(n){function e(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var l=e(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(o,r){return r==="W"?o+"周":o+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(o,r){var c=100*o+r;return c<600?"凌晨":c<900?"早上":c<1100?"上午":c<1300?"中午":c<1800?"下午":"晚上"}};return l.default.locale(i,null,!0),i})})(C),f.extend(k),f.locale("zh-cn");const w=(a,t="YYYY-MM-DD")=>f(a).format(t),R=a=>(console.log("🌸 信息输出 ~ testFunc ~ record:",a),"testFunc");function D(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){const t=Math.random()*16|0;return(a=="x"?t:t&3|8).toString(16)})}function U(){return Date.now().toString(36)+Math.random().toString(36).substr(2)}function q(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function L(a=1){const t=Math.floor(Math.random()*256),n=Math.floor(Math.random()*256),e=Math.floor(Math.random()*256);return`rgba(${t}, ${n}, ${e}, ${a})`}const H=y;class h{constructor(t){this.globalCallbacks={};const{callbacks:n,...e}=t||{};this.globalCallbacks=n||{},this.instance=Y.create({baseURL:(e==null?void 0:e.baseURL)||"",timeout:1e4,...e}),this.setupInterceptors()}setupInterceptors(){this.instance.interceptors.request.use(t=>{var e,l,i,o;return(l=(e=this.globalCallbacks).onRequestStart)==null||l.call(e,t),(o=(i=t.callbacks)==null?void 0:i.onRequestStart)==null||o.call(i,t),t},t=>{var n,e;return(e=(n=this.globalCallbacks).onRequestError)==null||e.call(n,t),Promise.reject(t)}),this.instance.interceptors.response.use(t=>{var e,l,i,o,r,c,u,d;(l=(e=this.globalCallbacks).onRequestEnd)==null||l.call(e,t.config);const n=t.config;return(o=(i=n.callbacks)==null?void 0:i.onRequestEnd)==null||o.call(i,t.config),(c=(r=this.globalCallbacks).onResponseSuccess)==null||c.call(r,t),(d=(u=n.callbacks)==null?void 0:u.onResponseSuccess)==null||d.call(u,t),t},t=>{var n,e,l,i,o,r,c,u;return t.config&&((e=(n=this.globalCallbacks).onRequestEnd)==null||e.call(n,t.config),(i=(l=t.config.callbacks)==null?void 0:l.onRequestEnd)==null||i.call(l,t.config)),(r=(o=this.globalCallbacks).onResponseError)==null||r.call(o,t),t.config&&((u=(c=t.config.callbacks)==null?void 0:c.onResponseError)==null||u.call(c,t)),Promise.reject(t)})}request(t){return this.instance.request(t)}get(t,n){return this.instance.get(t,n)}post(t,n,e){return this.instance.post(t,n,e)}put(t,n,e){return this.instance.put(t,n,e)}delete(t,n){return this.instance.delete(t,n)}patch(t,n,e){return this.instance.patch(t,n,e)}}const I=new h,v=a=>new h(a);class g{constructor(t="local"){this.storage=t==="local"?localStorage:sessionStorage}set(t,n){try{const e=typeof n=="string"?n:JSON.stringify(n);this.storage.setItem(t,e)}catch(e){console.error("Storage set error:",e)}}get(t,n=null){try{const e=this.storage.getItem(t);if(e===null)return n;try{return JSON.parse(e)}catch{return e}}catch(e){return console.error("Storage get error:",e),n}}remove(t){try{this.storage.removeItem(t)}catch(n){console.error("Storage remove error:",n)}}clear(){try{this.storage.clear()}catch(t){console.error("Storage clear error:",t)}}has(t){return this.storage.getItem(t)!==null}keys(){return Object.keys(this.storage)}length(){return this.storage.length}}const F=new g("local"),j=new g("session");s.dayjs=f,s.FormatterUtils=S,s.Http=h,s.StorageUtil=g,s.createHttp=v,s.formatDate=w,s.generateUUID=D,s.generateUniqueId=U,s.getRandomColor=q,s.getRandomRgbaColor=L,s.http=I,s.localStorageUtil=F,s.lodash=H,s.sessionStorageUtil=j,s.testFunc=R,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(a,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("dayjs"),require("lodash"),require("axios")):typeof define=="function"&&define.amd?define(["exports","dayjs","lodash","axios"],d):(a=typeof globalThis<"u"?globalThis:a||self,d(a.MToolStore={},a.dayjs,a._,a.axios))})(this,function(a,d,y,Y){"use strict";class S{static formatMoney(t,n){if(t==null)return"";let e=Number(t);if(isNaN(e))return t;let l=/([\-\+]?)(\d*)(\.\d+)?/g.exec(""+e),i=l&&l[1]||"",o=(l&&l[2]||"").split(""),r=l&&l[3]||"",c=o.length%3,u=o.reduce(function(f,_,b){return b+1===c||(b+1-c)%3===0?f+_+",":f+_},"").replace(/\,$/g,"");return u===""&&(u="0"),n!=null&&(n==0?r&&parseFloat(r)>.5?(r="",u=parseInt(u)+1+""):r="":n>0&&(!r||r=="0"||r==".0"?r="."+"0".repeat(n):(r=parseFloat(r).toFixed(2),r>="1"&&(u=parseInt(u)+1+"",r="."+"0".repeat(n)))),r=(r||"").replace("0.",".")),i+u+r}}var m=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function x(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var p={exports:{}};(function(s,t){(function(n,e){s.exports=e()})(m,function(){return function(n,e){e.prototype.weekday=function(l){var i=this.$locale().weekStart||0,o=this.$W,r=(o<i?o+7:o)-i;return this.$utils().u(l)?r:this.subtract(r,"day").add(l,"day")}}})})(p);var M=p.exports;const k=x(M);var C={exports:{}};(function(s,t){(function(n,e){s.exports=e(d)})(m,function(n){function e(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var l=e(n),i={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(o,r){return r==="W"?o+"周":o+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(o,r){var c=100*o+r;return c<600?"凌晨":c<900?"早上":c<1100?"上午":c<1300?"中午":c<1800?"下午":"晚上"}};return l.default.locale(i,null,!0),i})})(C),d.extend(k),d.locale("zh-cn");const w=(s,t="YYYY-MM-DD")=>d(s).format(t),R=s=>(console.log("🌸 信息输出 ~ testFunc ~ record:",s),"testFunc");function D(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){const t=Math.random()*16|0;return(s=="x"?t:t&3|8).toString(16)})}function U(){return Date.now().toString(36)+Math.random().toString(36).substr(2)}function q(){return"#"+Math.floor(Math.random()*16777215).toString(16).padStart(6,"0")}function L(s=1){const t=Math.floor(Math.random()*256),n=Math.floor(Math.random()*256),e=Math.floor(Math.random()*256);return`rgba(${t}, ${n}, ${e}, ${s})`}const H=y;class h{constructor(t){this.globalCallbacks={};const{callbacks:n,...e}=t||{};this.globalCallbacks=n||{},this.instance=Y.create({baseURL:(e==null?void 0:e.baseURL)||"",timeout:1e4,...e}),this.setupInterceptors()}setupInterceptors(){this.instance.interceptors.request.use(t=>{var e,l,i,o;return(l=(e=this.globalCallbacks).onRequestStart)==null||l.call(e,t),(o=(i=t.callbacks)==null?void 0:i.onRequestStart)==null||o.call(i,t),t},t=>{var n,e;return(e=(n=this.globalCallbacks).onRequestError)==null||e.call(n,t),Promise.reject(t)}),this.instance.interceptors.response.use(t=>{var e,l,i,o,r,c,u,f;(l=(e=this.globalCallbacks).onRequestEnd)==null||l.call(e,t.config);const n=t.config;return(o=(i=n.callbacks)==null?void 0:i.onRequestEnd)==null||o.call(i,t.config),(c=(r=this.globalCallbacks).onResponseSuccess)==null||c.call(r,t),(f=(u=n.callbacks)==null?void 0:u.onResponseSuccess)==null||f.call(u,t),t==null?void 0:t.data},t=>{var n,e,l,i,o,r,c,u;return t.config&&((e=(n=this.globalCallbacks).onRequestEnd)==null||e.call(n,t.config),(i=(l=t.config.callbacks)==null?void 0:l.onRequestEnd)==null||i.call(l,t.config)),(r=(o=this.globalCallbacks).onResponseError)==null||r.call(o,t),t.config&&((u=(c=t.config.callbacks)==null?void 0:c.onResponseError)==null||u.call(c,t)),Promise.reject(t)})}request(t){return this.instance.request(t)}get(t,n){return this.instance.get(t,n)}post(t,n,e){return this.instance.post(t,n,e)}put(t,n,e){return this.instance.put(t,n,e)}delete(t,n){return this.instance.delete(t,n)}patch(t,n,e){return this.instance.patch(t,n,e)}}const I=new h,v=s=>new h(s);class g{constructor(t="local"){this.storage=t==="local"?localStorage:sessionStorage}set(t,n){try{const e=typeof n=="string"?n:JSON.stringify(n);this.storage.setItem(t,e)}catch(e){console.error("Storage set error:",e)}}get(t,n=null){try{const e=this.storage.getItem(t);if(e===null)return n;try{return JSON.parse(e)}catch{return e}}catch(e){return console.error("Storage get error:",e),n}}remove(t){try{this.storage.removeItem(t)}catch(n){console.error("Storage remove error:",n)}}clear(){try{this.storage.clear()}catch(t){console.error("Storage clear error:",t)}}has(t){return this.storage.getItem(t)!==null}keys(){return Object.keys(this.storage)}length(){return this.storage.length}}const F=new g("local"),j=new g("session");a.dayjs=d,a.FormatterUtils=S,a.Http=h,a.StorageUtil=g,a.createHttp=v,a.formatDate=w,a.generateUUID=D,a.generateUniqueId=U,a.getRandomColor=q,a.getRandomRgbaColor=L,a.http=I,a.localStorageUtil=F,a.lodash=H,a.sessionStorageUtil=j,a.testFunc=R,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "m-tool-store",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "description": "JavaScript 工具库",
5
5
  "type": "module",
6
6
  "author": "Mmm",