@kong-ui-public/core 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.es.js +448 -448
- package/dist/core.umd.js +1 -1
- package/package.json +2 -2
package/dist/core.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(h,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","axios","vue"],k):(h=typeof globalThis<"u"?globalThis:h||self,k(h["kong-ui-core"]={},h.axios,h.Vue))})(this,function(h,k,y){"use strict";function J(){return{getAxiosInstance:(n={})=>{try{const r=y.inject("get-axios-instance",void 0);return typeof r=="function"?r(n):k.create({withCredentials:!0,timeout:3e4,...n})}catch(r){return console.warn("getAxiosInstance:",r.message||r),k.create({withCredentials:!0,timeout:3e4,...n})}},getTraceIdFromError:n=>{var r;return((r=n==null?void 0:n.response)==null?void 0:r.headers["x-datadog-trace-id"])||""}}}function P(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function T(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const p=6048e5,$=864e5;let K={};function A(){return K}function M(e,t){var s,o,d,f;const n=A(),r=(t==null?void 0:t.weekStartsOn)??((o=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:o.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,a=P(e),i=a.getDay(),c=(i<r?7:0)+i-r;return a.setDate(a.getDate()-c),a.setHours(0,0,0,0),a}function C(e){return M(e,{weekStartsOn:1})}function F(e){const t=P(e),n=t.getFullYear(),r=T(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=C(r),i=T(e,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const c=C(i);return t.getTime()>=a.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function _(e){const t=P(e);return t.setHours(0,0,0,0),t}function R(e){const t=P(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function z(e,t){const n=_(e),r=_(t),a=+n-R(n),i=+r-R(r);return Math.round((a-i)/$)}function Z(e){const t=F(e),n=T(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),C(n)}function ee(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function te(e){if(!ee(e)&&typeof e!="number")return!1;const t=P(e);return!isNaN(Number(t))}function ne(e){const t=P(e),n=T(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const re={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ae=(e,t,n)=>{let r;const a=re[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function L(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const ie={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},oe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},ce={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ue={date:L({formats:ie,defaultWidth:"full"}),time:L({formats:oe,defaultWidth:"full"}),dateTime:L({formats:ce,defaultWidth:"full"})},se={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},de=(e,t,n,r)=>se[e];function x(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):c;a=e.formattingValues[s]||e.formattingValues[c]}else{const c=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[s]||e.values[c]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const fe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},le={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},he={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},me={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},ge={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},we={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},be={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:x({values:fe,defaultWidth:"wide"}),quarter:x({values:le,defaultWidth:"wide",argumentCallback:e=>e-1}),month:x({values:he,defaultWidth:"wide"}),day:x({values:me,defaultWidth:"wide"}),dayPeriod:x({values:ge,defaultWidth:"wide",formattingValues:we,defaultFormattingWidth:"wide"})};function W(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const c=i[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],o=Array.isArray(s)?Pe(s,w=>w.test(c)):ye(s,w=>w.test(c));let d;d=e.valueCallback?e.valueCallback(o):o,d=n.valueCallback?n.valueCallback(d):d;const f=t.slice(c.length);return{value:d,rest:f}}}function ye(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function Pe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function Se(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],i=t.match(e.parsePattern);if(!i)return null;let c=e.valueCallback?e.valueCallback(i[0]):i[0];c=n.valueCallback?n.valueCallback(c):c;const s=t.slice(a.length);return{value:c,rest:s}}}const Oe=/^(\d+)(th|st|nd|rd)?/i,Te=/\d+/i,De={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},ve={any:[/^b/i,/^(a|c)/i]},ke={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ee={any:[/1/i,/2/i,/3/i,/4/i]},Me={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},xe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},We={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ae={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ce={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Ye={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Le={ordinalNumber:Se({matchPattern:Oe,parsePattern:Te,valueCallback:e=>parseInt(e,10)}),era:W({matchPatterns:De,defaultMatchWidth:"wide",parsePatterns:ve,defaultParseWidth:"any"}),quarter:W({matchPatterns:ke,defaultMatchWidth:"wide",parsePatterns:Ee,defaultParseWidth:"any",valueCallback:e=>e+1}),month:W({matchPatterns:Me,defaultMatchWidth:"wide",parsePatterns:xe,defaultParseWidth:"any"}),day:W({matchPatterns:We,defaultMatchWidth:"wide",parsePatterns:Ae,defaultParseWidth:"any"}),dayPeriod:W({matchPatterns:Ce,defaultMatchWidth:"any",parsePatterns:Ye,defaultParseWidth:"any"})},Ne={code:"en-US",formatDistance:ae,formatLong:ue,formatRelative:de,localize:be,match:Le,options:{weekStartsOn:0,firstWeekContainsDate:1}};function pe(e){const t=P(e);return z(t,ne(t))+1}function Fe(e){const t=P(e),n=+C(t)-+Z(t);return Math.round(n/p)+1}function I(e,t){var f,w,l,b;const n=P(e),r=n.getFullYear(),a=A(),i=(t==null?void 0:t.firstWeekContainsDate)??((w=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:w.firstWeekContainsDate)??a.firstWeekContainsDate??((b=(l=a.locale)==null?void 0:l.options)==null?void 0:b.firstWeekContainsDate)??1,c=T(e,0);c.setFullYear(r+1,0,i),c.setHours(0,0,0,0);const s=M(c,t),o=T(e,0);o.setFullYear(r,0,i),o.setHours(0,0,0,0);const d=M(o,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function _e(e,t){var s,o,d,f;const n=A(),r=(t==null?void 0:t.firstWeekContainsDate)??((o=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:o.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=I(e,t),i=T(e,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),M(i,t)}function Re(e,t){const n=P(e),r=+M(n,t)-+_e(n,t);return Math.round(r/p)+1}function u(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const O={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return u(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):u(n+1,2)},d(e,t){return u(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return u(e.getHours()%12||12,t.length)},H(e,t){return u(e.getHours(),t.length)},m(e,t){return u(e.getMinutes(),t.length)},s(e,t){return u(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return u(a,t.length)}},E={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},H={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return O.y(e,t)},Y:function(e,t,n,r){const a=I(e,r),i=a>0?a:1-a;if(t==="YY"){const c=i%100;return u(c,2)}return t==="Yo"?n.ordinalNumber(i,{unit:"year"}):u(i,t.length)},R:function(e,t){const n=F(e);return u(n,t.length)},u:function(e,t){const n=e.getFullYear();return u(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return u(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return u(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return O.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return u(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=Re(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):u(a,t.length)},I:function(e,t,n){const r=Fe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):u(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):O.d(e,t)},D:function(e,t,n){const r=pe(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):u(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return u(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return u(i,t.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return u(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=E.noon:r===0?a=E.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=E.evening:r>=12?a=E.afternoon:r>=4?a=E.morning:a=E.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return O.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):O.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):O.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):O.s(e,t)},S:function(e,t){return O.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return j(r);case"XXXX":case"XX":return D(r);case"XXXXX":case"XXX":default:return D(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return j(r);case"xxxx":case"xx":return D(r);case"xxxxx":case"xxx":default:return D(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+q(r,":");case"OOOO":default:return"GMT"+D(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+q(r,":");case"zzzz":default:return"GMT"+D(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return u(r,t.length)},T:function(e,t,n){const r=e.getTime();return u(r,t.length)}};function q(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),i=r%60;return i===0?n+String(a):n+String(a)+t+u(i,2)}function j(e,t){return e%60===0?(e>0?"-":"+")+u(Math.abs(e)/60,2):D(e,t)}function D(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=u(Math.trunc(r/60),2),i=u(r%60,2);return n+a+t+i}const G=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},B=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Ie={p:B,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return G(e,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",G(r,t)).replace("{{time}}",B(a,t))}},He=/^D+$/,qe=/^Y+$/,je=["D","DD","YY","YYYY"];function Ge(e){return He.test(e)}function Be(e){return qe.test(e)}function Xe(e,t,n){const r=Qe(e,t,n);if(console.warn(r),je.includes(e))throw new RangeError(r)}function Qe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ue=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ve=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Je=/^'([^]*?)'?$/,$e=/''/g,Ke=/[a-zA-Z]/;function ze(e,t,n){var f,w,l,b,v,S,U,V;const r=A(),a=(n==null?void 0:n.locale)??r.locale??Ne,i=(n==null?void 0:n.firstWeekContainsDate)??((w=(f=n==null?void 0:n.locale)==null?void 0:f.options)==null?void 0:w.firstWeekContainsDate)??r.firstWeekContainsDate??((b=(l=r.locale)==null?void 0:l.options)==null?void 0:b.firstWeekContainsDate)??1,c=(n==null?void 0:n.weekStartsOn)??((S=(v=n==null?void 0:n.locale)==null?void 0:v.options)==null?void 0:S.weekStartsOn)??r.weekStartsOn??((V=(U=r.locale)==null?void 0:U.options)==null?void 0:V.weekStartsOn)??0,s=P(e);if(!te(s))throw new RangeError("Invalid time value");let o=t.match(Ve).map(g=>{const m=g[0];if(m==="p"||m==="P"){const N=Ie[m];return N(g,a.formatLong)}return g}).join("").match(Ue).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const m=g[0];if(m==="'")return{isToken:!1,value:Ze(g)};if(H[m])return{isToken:!0,value:g};if(m.match(Ke))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:g}});a.localize.preprocessor&&(o=a.localize.preprocessor(s,o));const d={firstWeekContainsDate:i,weekStartsOn:c,locale:a};return o.map(g=>{if(!g.isToken)return g.value;const m=g.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Be(m)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Ge(m))&&Xe(m,t,String(e));const N=H[m[0]];return N(s,m,a.localize,d)}).join("")}function Ze(e){const t=e.match(Je);return t?t[1].replace($e,"'"):e}function et(){return{formatDateBy:(n,r={})=>{if(isNaN(n))return null;try{return new Date(n*1e3).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",weekday:"short",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,...r})}catch{return null}},formatUnixToDate:(n,r)=>{if(!n)return"";const a=r?"yyyy-MM-dd HH:mm:ss":"yyyy-MM-dd HH:mm:ss XX";try{const i=new Date(n*1e3);return ze(i,a)}catch{return""}}}}function tt(){return{debounce:(t,n)=>{let r;return(...a)=>{clearTimeout(r),r=window==null?void 0:window.setTimeout(()=>{t(...a)},n)}}}}function nt({script:e,styles:t,onReady:n}){const r=y.ref(!0),a=y.ref(!0),i=async()=>{const{libName:o,url:d,type:f}=e;if((f!==void 0&&["umd","es"].includes(f)?f:"umd")==="es"){await import(d),typeof n=="function"&&await n();return}const l=o.startsWith("kong-ui-")?o:`kong-ui-${o}`;return window[l]||(window[l]=await new Promise((b,v)=>{const S=document.createElement("script");S.async=!0,S.addEventListener("load",async()=>{typeof n=="function"&&await n(),r.value=!1,b(window[l])}),S.addEventListener("error",()=>{v(new Error(`Could not load '${l}' from ${d}`))}),S.src=d,document.head.appendChild(S)})),window[l]},c=async(o,d)=>{var f;for(const w of o){const l=document.createElement("link");l.type="text/css",l.rel="stylesheet",l.href=w;const b=d?document.querySelector(d):null,v=d?(f=b==null?void 0:b.shadowRoot)==null?void 0:f.children[0]:null;if(b&&v)try{v.appendChild(l)}catch{document.head.appendChild(l)}else document.head.appendChild(l)}};return{importPackage:async()=>{var d,f;if(!e||!e.url||typeof window>"u"||typeof document>"u")return;const o=y.computed(()=>!!(t&&(t!=null&&t.urls)&&(t!=null&&t.urls.length)&&t.shadowRoot));if((!t||!(t!=null&&t.urls)||!((d=t==null?void 0:t.urls)!=null&&d.length))&&(a.value=!1),t!=null&&t.urls&&((f=t==null?void 0:t.urls)!=null&&f.length)&&!o.value&&(await c(t.urls),a.value=!1),(!e.type||e.type==="umd")&&!o.value)return await i();await i(),await y.nextTick(),r.value=!1,t!=null&&t.urls&&o.value&&(await c(t.urls,t==null?void 0:t.shadowRoot),await y.nextTick(),a.value=!1)},loadingPackage:y.readonly(r),loadingStyles:y.readonly(a)}}var X=(e=>(e.VALIDATING="VALIDATING",e.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",e.PENDING="PENDING",e.SUCCESS="SUCCESS",e.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",e.ERROR="ERROR",e.STALE_IF_ERROR="STALE_IF_ERROR",e))(X||{});const rt=e=>{var t,n,r,a,i;return e?!!((t=Object.keys(e))!=null&&t.length||(n=e.data)!=null&&n.length||(a=(r=e.data)==null?void 0:r.data)!=null&&a.length||!((i=e.data)!=null&&i.data)&&typeof e.data=="object"&&Object.keys(e==null?void 0:e.data).length):!1};function at(e=y.ref({}),t,n,r=rt){const a=y.ref("PENDING");return y.watchEffect(()=>{const i=r(e.value);if(e.value&&i&&n.value){a.value="VALIDATING_HAS_DATA";return}if(e.value&&n.value){a.value="VALIDATING";return}if(e.value&&t.value){a.value="STALE_IF_ERROR";return}if(e.value===void 0&&!t.value){a.value="PENDING";return}if(e.value&&!t.value&&i){a.value="SUCCESS_HAS_DATA";return}if(e.value&&!t.value){a.value="SUCCESS";return}e.value===void 0&&t&&(a.value="ERROR")}),{state:a,swrvState:X}}const Y="khcp-user-table-preferences",Q={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnWidths:{},columnVisibility:{}};function it(){const e=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch(c){console.error("useTablePreferences(tryParseJson)",c);return}},t=()=>{const i=e(localStorage.getItem(Y));return!i||!Object.keys(i).length?new Map:new Map(Object.entries(i))};return{setTablePreferences:(i,c)=>{try{const s=t();s.set(i,c),localStorage.setItem(Y,JSON.stringify(Object.fromEntries(s.entries())))}catch(s){console.error("useTablePreferences(setTablePreferences)",s)}},getTablePreferences:i=>{const c=t();return(c==null?void 0:c.get(i))||void 0||Q},deleteAllTablePreferences:()=>{localStorage.removeItem(Y)}}}function ot(){const e=()=>{var o;return((o=window==null?void 0:window.location)==null?void 0:o.search)||""};return{getLocationSearch:e,getLocationHostname:()=>{var o;return((o=window==null?void 0:window.location)==null?void 0:o.hostname)||""},getLocationHref:()=>{var o;return((o=window==null?void 0:window.location)==null?void 0:o.href)||""},getLocationPathname:()=>{var o;return((o=window==null?void 0:window.location)==null?void 0:o.pathname)||""},getLocationOrigin:()=>{var o;return((o=window==null?void 0:window.location)==null?void 0:o.origin)||""},getUrlSearchParams:()=>new URLSearchParams(e()),setLocationAssign:o=>{window.location.assign(o)},setLocationReplace:o=>{window.location.replace(o)}}}h.DEFAULT_USER_TABLE_PREFERENCES=Q,h.USER_TABLE_PREFERENCES_LOCAL_STORAGE_KEY=Y,h.useAxios=J,h.useDate=et,h.useDebounce=tt,h.usePackage=nt,h.useSwrvState=at,h.useTablePreferences=it,h.useWindow=ot,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(g,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","axios","vue"],v):(g=typeof globalThis<"u"?globalThis:g||self,v(g["kong-ui-core"]={},g.axios,g.Vue))})(this,function(g,v,y){"use strict";function X(){return{getAxiosInstance:(n={})=>{try{const r=y.inject("get-axios-instance",void 0);return typeof r=="function"?r(n):v.create({withCredentials:!0,timeout:3e4,...n})}catch(r){return console.warn("getAxiosInstance:",r.message||r),v.create({withCredentials:!0,timeout:3e4,...n})}},getTraceIdFromError:n=>{var r;return((r=n==null?void 0:n.response)==null?void 0:r.headers["x-datadog-trace-id"])||""}}}function P(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function O(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const Y=6048e5,Q=864e5;let U={};function p(){return U}function E(e,t){var s,i,d,f;const n=p(),r=(t==null?void 0:t.weekStartsOn)??((i=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:i.weekStartsOn)??n.weekStartsOn??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.weekStartsOn)??0,a=P(e),o=a.getDay(),c=(o<r?7:0)+o-r;return a.setDate(a.getDate()-c),a.setHours(0,0,0,0),a}function x(e){return E(e,{weekStartsOn:1})}function L(e){const t=P(e),n=t.getFullYear(),r=O(e,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const a=x(r),o=O(e,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const c=x(o);return t.getTime()>=a.getTime()?n+1:t.getTime()>=c.getTime()?n:n-1}function N(e){const t=P(e);return t.setHours(0,0,0,0),t}function F(e){const t=P(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function V(e,t){const n=N(e),r=N(t),a=+n-F(n),o=+r-F(r);return Math.round((a-o)/Q)}function J(e){const t=L(e),n=O(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),x(n)}function $(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function K(e){if(!$(e)&&typeof e!="number")return!1;const t=P(e);return!isNaN(Number(t))}function z(e){const t=P(e),n=O(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}const Z={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ee=(e,t,n)=>{let r;const a=Z[e];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function A(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const te={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ne={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},re={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ae={date:A({formats:te,defaultWidth:"full"}),time:A({formats:ne,defaultWidth:"full"}),dateTime:A({formats:re,defaultWidth:"full"})},oe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ie=(e,t,n,r)=>oe[e];function M(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const c=e.defaultFormattingWidth||e.defaultWidth,s=n!=null&&n.width?String(n.width):c;a=e.formattingValues[s]||e.formattingValues[c]}else{const c=e.defaultWidth,s=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[s]||e.values[c]}const o=e.argumentCallback?e.argumentCallback(t):t;return a[o]}}const ce={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},ue={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},se={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},de={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},fe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},le={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},he={ordinalNumber:(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:M({values:ce,defaultWidth:"wide"}),quarter:M({values:ue,defaultWidth:"wide",argumentCallback:e=>e-1}),month:M({values:se,defaultWidth:"wide"}),day:M({values:de,defaultWidth:"wide"}),dayPeriod:M({values:fe,defaultWidth:"wide",formattingValues:le,defaultFormattingWidth:"wide"})};function k(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;const c=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],i=Array.isArray(s)?ge(s,w=>w.test(c)):me(s,w=>w.test(c));let d;d=e.valueCallback?e.valueCallback(i):i,d=n.valueCallback?n.valueCallback(d):d;const f=t.slice(c.length);return{value:d,rest:f}}}function me(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ge(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function we(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const a=r[0],o=t.match(e.parsePattern);if(!o)return null;let c=e.valueCallback?e.valueCallback(o[0]):o[0];c=n.valueCallback?n.valueCallback(c):c;const s=t.slice(a.length);return{value:c,rest:s}}}const be=/^(\d+)(th|st|nd|rd)?/i,ye=/\d+/i,Pe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Se={any:[/^b/i,/^(a|c)/i]},Oe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Te={any:[/1/i,/2/i,/3/i,/4/i]},ve={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},De={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ee={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Me={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ke={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},pe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},xe={ordinalNumber:we({matchPattern:be,parsePattern:ye,valueCallback:e=>parseInt(e,10)}),era:k({matchPatterns:Pe,defaultMatchWidth:"wide",parsePatterns:Se,defaultParseWidth:"any"}),quarter:k({matchPatterns:Oe,defaultMatchWidth:"wide",parsePatterns:Te,defaultParseWidth:"any",valueCallback:e=>e+1}),month:k({matchPatterns:ve,defaultMatchWidth:"wide",parsePatterns:De,defaultParseWidth:"any"}),day:k({matchPatterns:Ee,defaultMatchWidth:"wide",parsePatterns:Me,defaultParseWidth:"any"}),dayPeriod:k({matchPatterns:ke,defaultMatchWidth:"any",parsePatterns:pe,defaultParseWidth:"any"})},We={code:"en-US",formatDistance:ee,formatLong:ae,formatRelative:ie,localize:he,match:xe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ae(e){const t=P(e);return V(t,z(t))+1}function Ce(e){const t=P(e),n=+x(t)-+J(t);return Math.round(n/Y)+1}function _(e,t){var f,w,h,b;const n=P(e),r=n.getFullYear(),a=p(),o=(t==null?void 0:t.firstWeekContainsDate)??((w=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:w.firstWeekContainsDate)??a.firstWeekContainsDate??((b=(h=a.locale)==null?void 0:h.options)==null?void 0:b.firstWeekContainsDate)??1,c=O(e,0);c.setFullYear(r+1,0,o),c.setHours(0,0,0,0);const s=E(c,t),i=O(e,0);i.setFullYear(r,0,o),i.setHours(0,0,0,0);const d=E(i,t);return n.getTime()>=s.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function Ye(e,t){var s,i,d,f;const n=p(),r=(t==null?void 0:t.firstWeekContainsDate)??((i=(s=t==null?void 0:t.locale)==null?void 0:s.options)==null?void 0:i.firstWeekContainsDate)??n.firstWeekContainsDate??((f=(d=n.locale)==null?void 0:d.options)==null?void 0:f.firstWeekContainsDate)??1,a=_(e,t),o=O(e,0);return o.setFullYear(a,0,r),o.setHours(0,0,0,0),E(o,t)}function Le(e,t){const n=P(e),r=+E(n,t)-+Ye(n,t);return Math.round(r/Y)+1}function u(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const S={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return u(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):u(n+1,2)},d(e,t){return u(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return u(e.getHours()%12||12,t.length)},H(e,t){return u(e.getHours(),t.length)},m(e,t){return u(e.getMinutes(),t.length)},s(e,t){return u(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return u(a,t.length)}},D={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},R={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return S.y(e,t)},Y:function(e,t,n,r){const a=_(e,r),o=a>0?a:1-a;if(t==="YY"){const c=o%100;return u(c,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):u(o,t.length)},R:function(e,t){const n=L(e);return u(n,t.length)},u:function(e,t){const n=e.getFullYear();return u(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return u(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return u(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return S.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return u(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const a=Le(e,r);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):u(a,t.length)},I:function(e,t,n){const r=Ce(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):u(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):S.d(e,t)},D:function(e,t,n){const r=Ae(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):u(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return u(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return u(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return u(a,t.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let a;switch(r===12?a=D.noon:r===0?a=D.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let a;switch(r>=17?a=D.evening:r>=12?a=D.afternoon:r>=4?a=D.morning:a=D.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return S.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):S.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):S.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):S.s(e,t)},S:function(e,t){return S.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return H(r);case"XXXX":case"XX":return T(r);case"XXXXX":case"XXX":default:return T(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return H(r);case"xxxx":case"xx":return T(r);case"xxxxx":case"xxx":default:return T(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+I(r,":");case"OOOO":default:return"GMT"+T(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+I(r,":");case"zzzz":default:return"GMT"+T(r,":")}},t:function(e,t,n){const r=Math.trunc(e.getTime()/1e3);return u(r,t.length)},T:function(e,t,n){const r=e.getTime();return u(r,t.length)}};function I(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return o===0?n+String(a):n+String(a)+t+u(o,2)}function H(e,t){return e%60===0?(e>0?"-":"+")+u(Math.abs(e)/60,2):T(e,t)}function T(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),a=u(Math.trunc(r/60),2),o=u(r%60,2);return n+a+t+o}const q=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},j=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Ne={p:j,P:(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return q(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",q(r,t)).replace("{{time}}",j(a,t))}},Fe=/^D+$/,_e=/^Y+$/,Re=["D","DD","YY","YYYY"];function Ie(e){return Fe.test(e)}function He(e){return _e.test(e)}function qe(e,t,n){const r=je(e,t,n);if(console.warn(r),Re.includes(e))throw new RangeError(r)}function je(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Ge=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Be=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Xe=/^'([^]*?)'?$/,Qe=/''/g,Ue=/[a-zA-Z]/;function Ve(e,t,n){var f,w,h,b;const r=p(),a=r.locale??We,o=r.firstWeekContainsDate??((w=(f=r.locale)==null?void 0:f.options)==null?void 0:w.firstWeekContainsDate)??1,c=r.weekStartsOn??((b=(h=r.locale)==null?void 0:h.options)==null?void 0:b.weekStartsOn)??0,s=P(e);if(!K(s))throw new RangeError("Invalid time value");let i=t.match(Be).map(m=>{const l=m[0];if(l==="p"||l==="P"){const C=Ne[l];return C(m,a.formatLong)}return m}).join("").match(Ge).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const l=m[0];if(l==="'")return{isToken:!1,value:Je(m)};if(R[l])return{isToken:!0,value:m};if(l.match(Ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(i=a.localize.preprocessor(s,i));const d={firstWeekContainsDate:o,weekStartsOn:c,locale:a};return i.map(m=>{if(!m.isToken)return m.value;const l=m.value;(He(l)||Ie(l))&&qe(l,t,String(e));const C=R[l[0]];return C(s,l,a.localize,d)}).join("")}function Je(e){const t=e.match(Xe);return t?t[1].replace(Qe,"'"):e}function $e(){return{formatDateBy:(n,r={})=>{if(isNaN(n))return null;try{return new Date(n*1e3).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",weekday:"short",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1,...r})}catch{return null}},formatUnixToDate:(n,r)=>{if(!n)return"";const a=r?"yyyy-MM-dd HH:mm:ss":"yyyy-MM-dd HH:mm:ss XX";try{const o=new Date(n*1e3);return Ve(o,a)}catch{return""}}}}function Ke(){return{debounce:(t,n)=>{let r;return(...a)=>{clearTimeout(r),r=window==null?void 0:window.setTimeout(()=>{t(...a)},n)}}}}function ze({script:e,styles:t,onReady:n}){const r=y.ref(!0),a=y.ref(!0),o=async()=>{const{libName:i,url:d,type:f}=e;if((f!==void 0&&["umd","es"].includes(f)?f:"umd")==="es"){await import(d),typeof n=="function"&&await n();return}const h=i.startsWith("kong-ui-")?i:`kong-ui-${i}`;return window[h]||(window[h]=await new Promise((b,m)=>{const l=document.createElement("script");l.async=!0,l.addEventListener("load",async()=>{typeof n=="function"&&await n(),r.value=!1,b(window[h])}),l.addEventListener("error",()=>{m(new Error(`Could not load '${h}' from ${d}`))}),l.src=d,document.head.appendChild(l)})),window[h]},c=async(i,d)=>{var f;for(const w of i){const h=document.createElement("link");h.type="text/css",h.rel="stylesheet",h.href=w;const b=d?document.querySelector(d):null,m=d?(f=b==null?void 0:b.shadowRoot)==null?void 0:f.children[0]:null;if(b&&m)try{m.appendChild(h)}catch{document.head.appendChild(h)}else document.head.appendChild(h)}};return{importPackage:async()=>{var d,f;if(!e||!e.url||typeof window>"u"||typeof document>"u")return;const i=y.computed(()=>!!(t&&(t!=null&&t.urls)&&(t!=null&&t.urls.length)&&t.shadowRoot));if((!t||!(t!=null&&t.urls)||!((d=t==null?void 0:t.urls)!=null&&d.length))&&(a.value=!1),t!=null&&t.urls&&((f=t==null?void 0:t.urls)!=null&&f.length)&&!i.value&&(await c(t.urls),a.value=!1),(!e.type||e.type==="umd")&&!i.value)return await o();await o(),await y.nextTick(),r.value=!1,t!=null&&t.urls&&i.value&&(await c(t.urls,t==null?void 0:t.shadowRoot),await y.nextTick(),a.value=!1)},loadingPackage:y.readonly(r),loadingStyles:y.readonly(a)}}var G=(e=>(e.VALIDATING="VALIDATING",e.VALIDATING_HAS_DATA="VALIDATING_HAS_DATA",e.PENDING="PENDING",e.SUCCESS="SUCCESS",e.SUCCESS_HAS_DATA="SUCCESS_HAS_DATA",e.ERROR="ERROR",e.STALE_IF_ERROR="STALE_IF_ERROR",e))(G||{});const Ze=e=>{var t,n,r,a,o;return e?!!((t=Object.keys(e))!=null&&t.length||(n=e.data)!=null&&n.length||(a=(r=e.data)==null?void 0:r.data)!=null&&a.length||!((o=e.data)!=null&&o.data)&&typeof e.data=="object"&&Object.keys(e==null?void 0:e.data).length):!1};function et(e=y.ref({}),t,n,r=Ze){const a=y.ref("PENDING");return y.watchEffect(()=>{const o=r(e.value);if(e.value&&o&&n.value){a.value="VALIDATING_HAS_DATA";return}if(e.value&&n.value){a.value="VALIDATING";return}if(e.value&&t.value){a.value="STALE_IF_ERROR";return}if(e.value===void 0&&!t.value){a.value="PENDING";return}if(e.value&&!t.value&&o){a.value="SUCCESS_HAS_DATA";return}if(e.value&&!t.value){a.value="SUCCESS";return}e.value===void 0&&t&&(a.value="ERROR")}),{state:a,swrvState:G}}const W="khcp-user-table-preferences",B={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnWidths:{},columnVisibility:{}};function tt(){const e=o=>{if(typeof o=="string")try{return JSON.parse(o)}catch(c){console.error("useTablePreferences(tryParseJson)",c);return}},t=()=>{const o=e(localStorage.getItem(W));return!o||!Object.keys(o).length?new Map:new Map(Object.entries(o))};return{setTablePreferences:(o,c)=>{try{const s=t();s.set(o,c),localStorage.setItem(W,JSON.stringify(Object.fromEntries(s.entries())))}catch(s){console.error("useTablePreferences(setTablePreferences)",s)}},getTablePreferences:o=>{const c=t();return(c==null?void 0:c.get(o))||void 0||B},deleteAllTablePreferences:()=>{localStorage.removeItem(W)}}}function nt(){const e=()=>{var i;return((i=window==null?void 0:window.location)==null?void 0:i.search)||""};return{getLocationSearch:e,getLocationHostname:()=>{var i;return((i=window==null?void 0:window.location)==null?void 0:i.hostname)||""},getLocationHref:()=>{var i;return((i=window==null?void 0:window.location)==null?void 0:i.href)||""},getLocationPathname:()=>{var i;return((i=window==null?void 0:window.location)==null?void 0:i.pathname)||""},getLocationOrigin:()=>{var i;return((i=window==null?void 0:window.location)==null?void 0:i.origin)||""},getUrlSearchParams:()=>new URLSearchParams(e()),setLocationAssign:i=>{window.location.assign(i)},setLocationReplace:i=>{window.location.replace(i)}}}g.DEFAULT_USER_TABLE_PREFERENCES=B,g.USER_TABLE_PREFERENCES_LOCAL_STORAGE_KEY=W,g.useAxios=X,g.useDate=$e,g.useDebounce=Ke,g.usePackage=ze,g.useSwrvState=et,g.useTablePreferences=tt,g.useWindow=nt,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kong-ui-public/core",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/core.umd.js",
|
|
6
6
|
"module": "./dist/core.es.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"axios": "^1.6.8",
|
|
39
39
|
"swrv": "^1.0.4",
|
|
40
|
-
"vue": "^3.4.
|
|
40
|
+
"vue": "^3.4.38"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"date-fns": "^3.6.0"
|