@sarafapp/iron_core 1.0.39 → 1.0.40

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/IronCore.js CHANGED
@@ -1469,14 +1469,17 @@ class D {
1469
1469
  this.observers = [], this.next(e);
1470
1470
  }
1471
1471
  attach(e) {
1472
- this.observers.push(e);
1472
+ this.observers.push(e), this.notifyObject(e);
1473
1473
  }
1474
1474
  detach(e) {
1475
1475
  this.observers = this.observers.filter((r) => r !== e);
1476
1476
  }
1477
1477
  notify() {
1478
1478
  for (const e of this.observers)
1479
- typeof e == "function" ? e(this._value) : e.update(this._value);
1479
+ this.notifyObject(e);
1480
+ }
1481
+ notifyObject(e) {
1482
+ typeof e == "function" ? e(this._value) : e.update(this._value);
1480
1483
  }
1481
1484
  next(e) {
1482
1485
  typeof e == "function" ? this._value = e(this._value) : this._value = e, this.notify();
@@ -1,5 +1,5 @@
1
1
  (function(o,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("dayjs"),require("vue"),require("json2typescript"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","dayjs","vue","json2typescript","pinia"],_):(o=typeof globalThis<"u"?globalThis:o||self,_(o.IronCore={},o.dayjs,o.Vue,o.json2typescript,o.pinia))})(this,function(o,_,g,C,Ke){"use strict";var oe=(t=>(t.BankCard="####-####-####-####",t.Iban="##-####-####-####-####-####-##",t))(oe||{}),J=(t=>(t.FullDate="YYYY/M/D HH:mm",t.SimpleDate="YYYY/M/D",t.CompactGregorianDate="YYYYMMDD",t.ShortJalaliDate="YYMM",t.JustHour="HH:mm:ss",t))(J||{});const Ze=[{62198619:{persian:"بلو",english:"blue"}},{603799:{persian:"بانک ملی ایران",english:"melli"}},{589210:{persian:"بانک سپه",english:"sepah"}},{627648:{persian:"بانک توسعه صادرات",english:"export-development"}},{627961:{persian:"بانک صنعت و معدن",english:"industry-mine"}},{603770:{persian:"بانک کشاورزی",english:"agriculture"}},{628023:{persian:"بانک مسکن",english:"housing"}},{627760:{persian:"پست بانک ایران",english:"post"}},{502908:{persian:"بانک توسعه تعاون",english:"development-cooperation"}},{627412:{persian:"بانک اقتصاد نوین",english:"eghtesad-novin"}},{622106:{persian:"بانک پارسیان",english:"parsian"}},{502229:{persian:"بانک پاسارگاد",english:"pasargad"}},{639599:{persian:"بانک قوامین",english:"ghavamin"}},{627488:{persian:"بانک کارآفرین",english:"karafarin"}},{621986:{persian:"بانک سامان",english:"saman"}},{639346:{persian:"بانک سینا",english:"sina"}},{639607:{persian:"بانک سرمایه",english:"sarmayeh"}},{504706:{persian:"بانک شهر",english:"shahr"}},{502806:{persian:"بانک شهر",english:"shahr"}},{502938:{persian:"بانک دی",english:"day"}},{603769:{persian:"بانک صادرات",english:"saderat"}},{610433:{persian:"بانک ملت",english:"mellat"}},{627353:{persian:"بانک تجارت",english:"tejarat"}},{585983:{persian:"بانک تجارت",english:"tejarat"}},{589463:{persian:"بانک رفاه",english:"refah"}},{627381:{persian:"بانک انصار",english:"ansar"}},{639370:{persian:"بانک مهر اقتصاد",english:"mehr-eqtesad"}},{505801:{persian:"موسسه اعتباری کوثر",english:"kosar"}},{606373:{persian:"بانک قرض الحسنه مهرایرانیان",english:"mehr"}},{186214:{persian:"بانک آینده",english:"ayandeh"}},{504172:{persian:"بانک قرض الحسنه رسالت",english:"resalat"}},{505416:{persian:"بانک گردشگری",english:"tourism"}},{505785:{persian:"بانک ایران‌زمین",english:"iran-zamin"}},{505809:{persian:"بانک خاورمیانه",english:"middle-east"}},{585947:{persian:"بانک خاورمیانه",english:"middle-east"}},{604932:{persian:"بانک سپه",english:"sepah"}},{627961:{persian:"بانک صنعت و معدن",english:"industry-mine"}},{636214:{persian:"بانک آینده",english:"ayandeh"}},{636795:{persian:"بانک مرکزی",english:"markazi"}},{636949:{persian:"بانک حکمت ایرانیان",english:"hekmat-iranian"}},{639217:{persian:"بانک کشاورزی",english:"agriculture"}}],Xe=[{"010":{persian:"بانک مرکزی",english:"markazi"}},{"011":{persian:"بانک صنعت و معدن",english:"industry-mine"}},{"012":{persian:"بانک ملت",english:"mellat"}},{"013":{persian:"بانک رفاه",english:"refah"}},{"014":{persian:"بانک مسکن",english:"housing"}},{"015":{persian:"بانک سپه",english:"sepah"}},{"016":{persian:"بانک کشاورزی",english:"agriculture"}},{"017":{persian:"بانک ملّی ایران",english:"melli"}},{"018":{persian:"بانک تجارت",english:"tejarat"}},{"019":{persian:"بانک صادرات",english:"saderat"}},{"020":{persian:"بانک توسعه صادرات",english:"export-development"}},{"021":{persian:"پست بانک",english:"post"}},{"053":{persian:"بانک کارآفرین",english:"karafarin"}},{"054":{persian:"بانک پارسیان",english:"parsian"}},{"055":{persian:"بانک اقتصاد نوین",english:"eghtesad-novin"}},{"056":{persian:"بانک سامان",english:"saman"}},{"057":{persian:"بانک پاسارگاد",english:"pasargad"}},{"058":{persian:"بانک سرمایه",english:"sarmayeh"}},{"059":{persian:"بانک سینا",english:"sina"}},{"060":{persian:"بانک قرض الحسنه مهرایرانیان",english:"mehr"}},{"061":{persian:"بانک شهر",english:"shahr"}},{"062":{persian:"بانک آینده",english:"ayandeh"}},{"065":{persian:"بانک حکمت ایرانیان",english:"hekmat-iranian"}},{"066":{persian:"بانک دی",english:"day"}},{"069":{persian:"بانک ایران زمین",english:"iran-zamin"}},{"070":{persian:"بانک قرض الحسنه رسالت",english:"resalat"}},{"078":{persian:"بانک خاورمیانه",english:"middle-east"}}];var Qe=(t=>(t.Normal="YYYY-MM-DD",t.ContainsHour="YYYY-MM-DD HH:mm",t.OnlyHour="HH:mm",t))(Qe||{});function le(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ue={exports:{}},Ct=ue.exports,et;function Mt(){return et||(et=1,function(t,e){(function(r,s){t.exports=s()})(Ct,function(){return function(r,s){s.prototype.weekday=function(n){var i=this.$locale().weekStart||0,a=this.$W,u=(a<i?a+7:a)-i;return this.$utils().u(n)?u:this.subtract(u,"day").add(n,"day")}}})}(ue)),ue.exports}var Tt=Mt();const Et=le(Tt);var ce={exports:{}},Lt=ce.exports,tt;function Ot(){return tt||(tt=1,function(t,e){(function(r,s){t.exports=s()})(Lt,function(){var r="week",s="year";return function(n,i,a){var u=i.prototype;u.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var v=a(this).startOf(s).add(1,s).date(c),f=a(this).endOf(r);if(v.isBefore(f))return 1}var p=a(this).startOf(s).date(c).startOf(r).subtract(1,"millisecond"),S=this.diff(p,r,!0);return S<0?a(this).startOf("week").week():Math.ceil(S)},u.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(ce)),ce.exports}var Pt=Ot();const kt=le(Pt);var he={exports:{}},Vt=he.exports,rt;function $t(){return rt||(rt=1,function(t,e){(function(r,s){t.exports=s()})(Vt,function(){return function(r,s){s.prototype.weekYear=function(){var n=this.month(),i=this.week(),a=this.year();return i===1&&n===11?a+1:n===0&&i>=52?a-1:a}}})}(he)),he.exports}var Ft=$t();const Nt=le(Ft);var de={exports:{}},Bt=de.exports,st;function jt(){return st||(st=1,function(t,e){(function(r,s){t.exports=s(_)})(Bt,function(r){function s(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var n=s(r),i={name:"fa",weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(a){return a},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"}};return n.default.locale(i,null,!0),i})}(de)),de.exports}var Ut=jt();const Yt=le(Ut);function fe(t,e){return Ht(t)||qt(t,e)||zt()}function Ht(t){if(Array.isArray(t))return t}function qt(t,e){var r=[],s=!0,n=!1,i=void 0;try{for(var a=t[Symbol.iterator](),u;!(s=(u=a.next()).done)&&(r.push(u.value),!(e&&r.length===e));s=!0);}catch(l){n=!0,i=l}finally{try{!s&&a.return!=null&&a.return()}finally{if(n)throw i}}return r}function zt(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function nt(t,e,r){e<=2&&(t-=1,e+=12);var s=Math.floor(t/100),n=2-s+Math.floor(s/4),i=Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r+n-1524.5;return i}function Jt(t){t=t+.5;var e=Math.floor(t),r=t-e,s=e;if(e>=2299161){var n=Math.floor((e-186721625e-2)/36524.25);s=e+1+n-Math.floor(n/4)}var i=s+1524,a=Math.floor((i-122.1)/365.25),u=Math.floor(365.25*a),l=Math.floor((i-u)/30.6001),c=i-u-Math.floor(30.6001*l)+r,v=l<14?l-1:l-13,f=v>2?a-4716:a-4715;return Wt(f,v,c)}function Gt(t){t=t+.5;var e=Math.floor(t),r=t-e,s=e;if(e>=2299161){var n=Math.floor((e-186721625e-2)/36524.25);s=e+1+n-Math.floor(n/4)}var i=s+1524,a=Math.floor((i-122.1)/365.25),u=Math.floor(365.25*a),l=Math.floor((i-u)/30.6001),c=i-u-Math.floor(30.6001*l)+r,v=l<14?l-1:l-13,f=v>2?a-4716:a-4715;return[Math.floor(f),Math.floor(v),Math.floor(c)]}function xt(t,e,r){var s=[31,28,31,30,31,30,31,31,30,31,30,31],n=[31,31,31,31,31,31,30,30,30,30,30,29];function i(S,A){return Math.floor(S/A)}t-=979;for(var a=365*t+i(t,33)*8+i(t%33+3,4),u=0;u<e-1;++u)a+=n[u];a+=r-1;var l=a+79,c=1600+400*i(l,146097);l=l%146097;var v=!0;for(l>=36525&&(l--,c+=100*i(l,36524),l=l%36524,l>=365?l++:v=!1),c+=4*i(l,1461),l%=1461,l>=366&&(v=!1,l--,c+=i(l,365),l=l%365),u=0;l>=s[u]+(u==1&&v);u++)l-=s[u]+(u==1&&v);var f=u+1,p=l+1;return nt(c,f,p)}function Wt(t,e,r){var s=[31,28,31,30,31,30,31,31,30,31,30,31],n=[31,31,31,31,31,31,30,30,30,30,30,29];function i(Q,ee){return Math.floor(Q/ee)}for(var a=t-1600,u=e-1,l=r-1,c=365*a+i(a+3,4)-i(a+99,100)+i(a+399,400),v=0;v<u;++v)c+=s[v];u>1&&(t%4==0&&t%100!=0||t%400==0)&&c++,c+=l;var f=c-79,p=i(f,12053);f%=12053;var S=979+33*p+4*i(f,1461);f%=1461,f>=366&&(S+=i(f-1,365),f=(f-1)%365);for(var A=0;A<11&&f>=n[A];++A)f-=n[A];var Z=A+1,X=f+1;return[S,Z,X]}var ve={J:function(e,r,s){return Jt(nt(e,r,s))},G:function(e,r,s){return Gt(xt(e,r,s))}},Kt=/^(\d{4})[-/]?(\d{1,2})[-/]?(\d{0,2})(.*)?$/,Zt=/\[.*?\]|jY{2,4}|jM{1,4}|jD{1,2}|Y{2,4}|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,Ee="date",G="day",$="month",F="year",it="week",Xt="YYYY-MM-DDTHH:mm:ssZ",Qt={jmonths:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_")},er=function(t,e,r){var s=e.prototype,n=s.$utils(),i=function(d){return d.$C==="jalali"},a=n.prettyUnit||n.p,u=n.isUndefined||n.u,l=n.padStart||n.s,c=n.monthDiff||n.m,v=n.absFloor||n.a,f=function(d){return function(){var m=d.bind(this).apply(void 0,arguments);return m.$C=this.$C,m.isJalali()&&m.InitJalali(),m}};s.startOf=f(s.startOf),s.endOf=f(s.endOf),s.add=f(s.add),s.subtract=f(s.subtract),s.set=f(s.set);var p=s.parse,S=s.init,A=s.startOf,Z=s.$set,X=s.add,Q=s.format,ee=s.diff,Ge=s.year,xe=s.month,_e=s.date,We=s.daysInMonth,ie=s.toArray;r.$C="gregory",r.$fdow=6,r.calendar=function(h){return r.$C=h,r},s.calendar=function(h){var d=this.clone();return d.$C=h,d.isJalali()&&d.InitJalali(),d},s.isJalali=function(){return i(this)},r.en.jmonths="Farvardin_Ordibehesht_Khordaad_Tir_Mordaad_Shahrivar_Mehr_Aabaan_Aazar_Dey_Bahman_Esfand".split("_"),r.locale("fa",Object.assign({},Yt,{},Qt),!0);var te=function(d,m){return r(d,{locale:m.$L,utc:m.$u,calendar:m.$C})};s.init=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};S.bind(this)(h),this.isJalali()&&this.InitJalali()},s.parse=function(h){var d;if(this.$C=h.calendar||this.$C||r.$C,h.jalali&&typeof h.date=="string"&&/.*[^Z]$/i.test(h.date)&&(d=h.date.match(Kt))){var m=ve.G(parseInt(d[1],10),parseInt(d[2],10),parseInt(d[3]||1,10)),I=fe(m,3),b=I[0],w=I[1],R=I[2];h.date="".concat(b,"-").concat(w,"-").concat(R).concat(d[4]||"")}return p.bind(this)(h)},s.InitJalali=function(){var h=ve.J(this.$y,this.$M+1,this.$D),d=fe(h,3),m=d[0],I=d[1],b=d[2];this.$jy=m,this.$jM=I-1,this.$jD=b},s.startOf=function(h,d){var m=this;if(!i(this))return A.bind(this)(h,d);var I=u(d)?!0:d,b=a(h),w=function(re,q){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.$jy,Me=ve.G(P,q+1,re),z=fe(Me,3),ae=z[0],Te=z[1],Ds=z[2],_t=te(new Date(ae,Te-1,Ds),m);return(I?_t:_t.endOf(G)).$set("hour",1)},R=(this.$W+(7-r.$fdow))%7;switch(b){case F:return I?w(1,0):w(0,0,this.$jy+1);case $:return I?w(1,this.$jM):w(0,(this.$jM+1)%12,this.$jy+parseInt((this.$jM+1)/12,10));case it:return I?w(this.$jD-R,this.$jM):w(this.$jD+(6-R),this.$jM);default:return A.bind(this)(h,d)}},s.$set=function(h,d){var m=this;if(!i(this))return Z.bind(this)(h,d);var I=a(h),b=function(R,Ce){var re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.$jy,q=ve.G(re,Ce+1,R),P=fe(q,3),Me=P[0],z=P[1],ae=P[2];return m.$d.setFullYear(Me),m.$d.setMonth(z-1),m.$d.setDate(ae),m};switch(I){case Ee:case G:b(d,this.$jM);break;case $:b(this.$jD,d);break;case F:b(this.$jD,this.$jM,d);break;default:return Z.bind(this)(h,d)}return this.init(),this},s.add=function(h,d){var m=this;if(!i(this))return X.bind(this)(h,d);h=Number(h);var I=d&&(d.length===1||d==="ms")?d:a(d),b=function(z,ae){var Te=m.set(Ee,1).set(z,ae+h);return Te.set(Ee,Math.min(m.$jD,Te.daysInMonth()))};if(["M",$].indexOf(I)>-1){var w=this.$jM+h,R=w<0?-Math.ceil(-w/12):Math.floor(w/12),Ce=this.$jD,re=this.set(G,1).add(R,F).set($,w-R*12);return re.set(G,Math.min(re.daysInMonth(),Ce))}if(["y",F].indexOf(I)>-1)return b(F,this.$jy);if(["d",G].indexOf(I)>-1){var q=new Date(this.$d);return q.setDate(q.getDate()+h),te(q,this)}if(["w",it].indexOf(I)>-1){var P=new Date(this.$d);return P.setDate(P.getDate()+h*7),te(P,this)}return X.bind(this)(h,d)},s.format=function(h,d){var m=this;if(!i(this))return Q.bind(this)(h,d);var I=h||Xt,b=d||this.$locale(),w=b.jmonths;return I.replace(Zt,function(R){if(R.indexOf("[")>-1)return R.replace(/\[|\]/g,"");switch(R){case"YY":return String(m.$jy).slice(-2);case"YYYY":return String(m.$jy);case"M":return String(m.$jM+1);case"MM":return l(m.$jM+1,2,"0");case"MMM":return w[m.$jM].slice(0,3);case"MMMM":return w[m.$jM];case"D":return String(m.$jD);case"DD":return l(m.$jD,2,"0");default:return Q.bind(m)(R,d)}})},s.diff=function(h,d,m){if(!i(this))return ee.bind(this)(h,d,m);var I=a(d),b=r(h),w=c(this,b);switch(I){case F:w/=12;break;case $:break;default:return ee.bind(this)(h,d,m)}return m?w:v(w)},s.$g=function(h,d,m){return u(h)?this[d]:this.set(m,h)},s.year=function(h){return i(this)?this.$g(h,"$jy",F):Ge.bind(this)(h)},s.month=function(h){return i(this)?this.$g(h,"$jM",$):xe.bind(this)(h)},s.date=function(h){return i(this)?this.$g(h,"$jD",G):_e.bind(this)(h)},s.daysInMonth=function(){return i(this)?this.endOf($).$jD:We.bind(this)()},ie&&(s.toArray=function(){return i(this)?[this.$jy,this.$jM,this.$jD,this.$H,this.$m,this.$s,this.$ms]:ie.bind(this)()}),s.clone=function(){return te(this.toDate(),this)}};const tr={ordinal(t){},relativeTime:void 0,name:"fa",weekdays:"یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),weekdaysShort:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),months:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),monthsShort:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),weekStart:6,formats:{L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"}};function at(){_.extend(er),_.calendar("jalali"),_.extend(Et),_.extend(kt),_.extend(Nt),_.locale(tr,{},!0)}class rr{constructor(e,r){this.start=e,this.end=r}}class sr{constructor(e,r,s){this.maxDate=e,this.minDate=r,this.disabledDates=s}}class N{static standardToUnix(e){return Math.floor(new Date(e).getTime()/1e3)}static unixToStandard(e){return new Date(e*1e3).toString()}static getUnixEndOfDayInUnix(e){return _.unix(e).endOf("day").unix()}}class se{static isDateDisabled(e,r){for(const s of e.disabledDates)if(se.areUnixesInSameDate(s,r.unix()))return!0;return!!(e.maxDate&&se.isDateGraterOrSame(e.maxDate,r.unix())||e.minDate&&se.isDateLowerOrSame(e.minDate,r.unix()))}static areUnixesInSameDate(e,r){return N.getUnixEndOfDayInUnix(e)===N.getUnixEndOfDayInUnix(r)}static isDateGraterOrSame(e,r){return N.getUnixEndOfDayInUnix(r)>=N.getUnixEndOfDayInUnix(e)}static isDateLowerOrSame(e,r){return N.getUnixEndOfDayInUnix(r)<=N.getUnixEndOfDayInUnix(e)}}at();class M{static toCurrency(e,r){return e.toLocaleString("en-US",r)}static toCurrencyWithDotSeparator(e){return M.toCurrency(e).replaceAll(",",".")}static applyMask(e,r){let s="",n=0,i=0;for(;n<e.length;){if(e[n]==="#"){if(i>=r.length)throw new Error("Value length does not match the format.");s+=r[i],i++}else s+=e[n];n++}if(i!==r.length)throw new Error("Value length does not match the format.");return s}static applyBankCardMask(e){return M.applyMask(oe.BankCard,String(e))}static applyIbanMask(e){return M.applyMask(oe.Iban,String(e))}static toEnglishDigits(e){const r=["۱","۲","۳","۴","۵","۶","۷","۸","۹","۰"],s=["١","٢","٣","٤","٥","٦","٧","٨","٩","٠"],n=["1","2","3","4","5","6","7","8","9","0"];return e.split("").map(i=>n[r.indexOf(i)]||n[s.indexOf(i)]||i).join("")}static mapUnixToDate(e,r){return _(new Date(e)).subtract(1,"day").format(r)}}var y=(t=>(t.FetchList="fetchList",t.AutoRefresh="autoRefresh",t.FetchItem="fetchItem",t.FetchLastItems="fetchLastItems",t.FetchPreviousItems="fetchPreviousItems",t.Create="CREATE",t.Update="UPDATE",t.Delete="DELETE",t.Search="SEARCH",t.Sort="SORT",t.Success="SUCCESS",t.Error="ERROR",t.Idle="IDLE",t))(y||{}),k=(t=>(t.Width="width",t.Height="height",t[t.DefaultWidth=500]="DefaultWidth",t[t.DefaultHeight=350]="DefaultHeight",t[t.MinimalAvailableSize=0]="MinimalAvailableSize",t))(k||{}),O=(t=>(t.ASC="ASC",t.DESC="DESC",t))(O||{}),ot=(t=>(t.ASC="ascend",t.DESC="descend",t))(ot||{}),me=(t=>(t.Left="left",t.Right="right",t.Center="center",t))(me||{}),pe=(t=>(t.Text="text",t))(pe||{}),ge=(t=>(t.Text="text",t.ACTION="action",t.Tag="tag",t.Iban="iban",t.BankCard="bankCard",t.Symbol="symbol",t.TradeDetail="tradeDetail",t.SymbolPrice="symbolPrice",t.TradeSymbol="tradeSymbol",t.Price="price",t.DynamicCurrencyPrice="dynamicCurrencyPrice",t.TradeDate="tradeDate",t.RequestResponseIdentity="requestResponseIdentity",t.Image="image",t))(ge||{}),Le=(t=>(t[t.MINIMAL_LOADABLE_HEADER_COUNT=0]="MINIMAL_LOADABLE_HEADER_COUNT",t[t.DEFAULT_ITEM_COUNT_PER_PAGE=20]="DEFAULT_ITEM_COUNT_PER_PAGE",t.PAGINATION_POSITION="bottomCenter",t))(Le||{});o.ApplicationTheme=(t=>(t.FontFamily="IRANSansX",t))(o.ApplicationTheme||{});var x=(t=>(t.Open="open",t.Close="close",t))(x||{}),lt=(t=>(t[t.NotFound=404]="NotFound",t[t.Unauthorized=401]="Unauthorized",t[t.ServerError=500]="ServerError",t))(lt||{}),ne=(t=>(t[t.Invalid=0]="Invalid",t[t.Valid=1]="Valid",t))(ne||{}),V=(t=>(t.Theme="theme",t.AccessList="accessList",t.Token="token",t.SSO_ACCESS_LIST="ssoAccessList",t))(V||{});o.ApplicationTheme=(t=>(t.Light="light",t.Dark="dark",t))(o.ApplicationTheme||{});var ye=(t=>(t.Dialog="dialog",t.Drawer="drawer",t.Module="module",t.Toast="toast",t))(ye||{}),ut=(t=>(t.USDT="USDT",t))(ut||{});class B{static getBankImageBaseOnCardInfo(e,r){return e===void 0?"/img/banks/shetab.png":r==="IBAN"?(e=M.toEnglishDigits(e.replace(/IR/g,"").split(" ").join("")),`/img/banks/${B.iban(e).english}.png`):(e=M.toEnglishDigits(e.replace(/ /g,"")),`/img/banks/${B.card(e).english}.png`)}static card(e){const r={persian:"نامشخص",english:"shetab"};if(e==null)return r;e=e.substring(0,6);try{const s=Ze.find(n=>Object.keys(n)[0]===e);return s===void 0?r:Object.values(s)[0]}catch{return r}}static iban(e){const r={persian:"نامشخص",english:"shetab"};if(e==null)return r;e=e.substring(2,5);try{const s=Xe.find(n=>Object.keys(n)[0]===e);return s===void 0?r:Object.values(s)[0]}catch{return r}}static async copyValueToClipboard(e){await navigator.clipboard.writeText(String(e))}static downloadBlob(e,r=B.extractFileNameFromHeader(e)){const s=document.createElement("a");s.href=URL.createObjectURL(e.data),s.download=r,s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0})),s.remove()}static extractFileNameFromHeader(e){var s,n,i,a;return((a=(s=e.headers["content-disposition"])==null?void 0:s.split("filename=")[1])==null?void 0:a.slice(1,((i=(n=e.headers["content-disposition"])==null?void 0:n.split("filename="))==null?void 0:i[1].length)-1))||"Saraf-File"}static removeSpacesFromString(e){return e&&typeof e.normalize=="function"&&(e=e.normalize("NFC")),e.replace(/[\s\u00A0\u1680\u180E\u2000-\u200A\u200B-\u200D\u2060\uFEFF\u2028\u2029\u202F\u205F\u3000]+/g,"")}static isArraySorted(e,r=n=>n,s=O.ASC){return e.every((n,i)=>e.length-1===i?!0:s===O.ASC?r(n)<=r(e[i+1]):r(n)>=r(e[i+1]))}}const U=class U{constructor(){this.availableAccesses=new Set}setAvailableAccesses(e){this.setAccessListToStorage(e);for(const r of e)this.availableAccesses.add(r)}setAccessListToStorage(e){localStorage.setItem(V.AccessList,JSON.stringify(e))}everyAccess(e){return e.every(r=>this.availableAccesses.has(r))}someAccess(e){return e.some(r=>this.availableAccesses.has(r))}clearAvailableAccesses(){this.availableAccesses.clear(),localStorage.removeItem(V.AccessList)}initialize(){const e=localStorage.getItem(V.AccessList);e!==null&&this.setAvailableAccesses(JSON.parse(e))}static GetInstance(){return U.Instance||(U.Instance=new U),U.Instance}};U.Instance=null;let W=U;class Oe{constructor(){this.mounted=(e,r)=>{this.checkAccess(e,r.value)},this.updated=(e,r)=>{this.checkAccess(e,r.value)},this.checkAccess=(e,r)=>{this.hasAccess(r)||e.remove()},this.accessService=W.GetInstance()}}class nr extends Oe{hasAccess(e){return this.accessService.everyAccess(e)}}class ir extends Oe{hasAccess(e){return this.accessService.someAccess(e)}}const Y=class Y{constructor(){this._accessLevels=new Map}initialize(){this.setAccessLevelFromStorage()}setAccessLevels(e){for(const r in e)this._accessLevels.set(r,new Set(e[r]));this.setAccessLevelsToStorage(e)}setAccessLevelsToStorage(e){localStorage.setItem(V.SSO_ACCESS_LIST,JSON.stringify(e))}getAccessLevelsFromStorage(){let e=localStorage.getItem(V.SSO_ACCESS_LIST);return e!==null?JSON.parse(e):e}getAccessLevelsOfScope(e){if(this._accessLevels.has(e))return this._accessLevels.get(e);throw new Error(`The scope is not exists ${e}`)}setAccessLevelFromStorage(){const e=this.getAccessLevelsFromStorage();e&&this.setAccessLevels(e)}everyAccess(e,r){const s=this.getAccessLevelsOfScope(e);return s?r.every(n=>s.has(n)):!1}someAccess(e,r){const s=this.getAccessLevelsOfScope(e);return s?r.some(n=>s.has(n)):!1}hasScope(e){return this._accessLevels.has(e)}clear(){localStorage.removeItem(V.SSO_ACCESS_LIST),this._accessLevels=new Map}static GetInstance(){return Y._instance||(Y._instance=new Y),Y._instance}};Y._instance=null;let Se=Y;class Pe{constructor(){this._authorizationService=Se.GetInstance(),this.mounted=this.mounted.bind(this),this.updated=this.updated.bind(this),this.hasAccess=this.hasAccess.bind(this),this.manageElement=this.manageElement.bind(this)}mounted(e,r,s){this.manageElement(e,r.arg,r.modifiers)}updated(e,r,s){this.manageElement(e,r.arg,r.modifiers)}manageElement(e,r,s){if(!this._authorizationService.hasScope(r)){e.remove();return}const n=this.getAccessLevels(r,s);this.hasAccess(r,n)||e.remove()}getAccessLevels(e,r){var n;let s=Object.keys(r);return s.length||(s=Array.from(((n=this._authorizationService.getAccessLevelsOfScope(e))==null?void 0:n.values())??[])),s}}class ar extends Pe{hasAccess(e,r){return this._authorizationService.everyAccess(e,r)}}class or extends Pe{hasAccess(e,r){return this._authorizationService.someAccess(e,r)}}class ct{constructor(){this.value=null,this.initialValue=null,this.name="",this.isValid=!1,this.isBlurSensitive=!1,this.isRequired=!1,this.isIncludeInRequestBody=!0,this.isChangeSensitive=!1,this.notValidMessage="",this.isEmptySensitive=!0,this.hasCustomValidationCheck=!1,this.shouldRemoveValidationMessageOnInteract=!1}}function lr(t){return t===1}function ur(t,e){return t-1===e}function ht(t){return String(t).length===0||t===null||t===void 0}function cr(t){t()}class hr{constructor(e,r){this.initialData=null,this.data=new ct,this._validators=[],this._id=Math.random(),this.data.value=r,this.data.name=e,this.shouldRunValidation()&&this.runValidation(!0)}shouldRunValidation(){return this.data.hasCustomValidationCheck?!1:this.data.isRequired?!0:!ht(this.data.value)}async runValidation(e=!1){for(const r of this._validators){const s=await r.validate(this.data.value);if(s){this.setFormToInvalidState(e,s);return}}this.setFormToValidState()}setFormToInvalidState(e,r){this.data.isValid=!1,(this.data.isChangeSensitive||e)&&this.setNotValidMessage(r)}setFormToValidState(){this.data.isValid=!0,this.setNotValidMessage("")}reset(){this.initialData?this.data=structuredClone(g.toRaw(this.initialData)):console.warn("The "+this.data.name+`input control has no initial data,
2
- the initial data will be available after calling the [markAsInitial] method on this instance`)}markAsInitial(){this.initialData=structuredClone(g.toRaw(this.data))}setValidators(e){this._validators=e}getChangeSensitive(){return this.data.isChangeSensitive}setChangeSensitive(e){if(e&&this.data.shouldRemoveValidationMessageOnInteract)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.isChangeSensitive=e}getIsBlurSensitive(){return this.data.isBlurSensitive}setIsBlurSensitive(e){this.data.isBlurSensitive=e}getIsRequired(){return this.data.isRequired}setIsRequired(e){this.data.isRequired=e}getIsValid(){return this.data.isValid}setIsValid(e){this.data.isValid=e}getIsIncludeInRequestBody(){return this.data.isIncludeInRequestBody}setIsIncludeInRequestBody(e){this.data.isIncludeInRequestBody=e}getNotValidMessage(){return this.data.notValidMessage}setNotValidMessage(e){this.data.notValidMessage=e}getName(){return this.data.name}setName(e){this.data.name=e}setId(e){this._id=e}getId(){return this._id}getIsEmptySensitive(){return this.data.isEmptySensitive}setIsEmptySensitive(e){this.data.isEmptySensitive=e}setHasCustomValidationCheck(e){this.data.hasCustomValidationCheck=e}setShouldRemoveValidationOnInteract(e){if(e&&this.data.isChangeSensitive)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.shouldRemoveValidationMessageOnInteract=e}getShouldRemoveValidationOnInteract(){return this.data.shouldRemoveValidationMessageOnInteract}hasCustomValidationCheck(){return this.data.hasCustomValidationCheck}set value(e){this.data.value=e,this.shouldRunValidation()&&this.runValidation(),this.getShouldRemoveValidationOnInteract()&&this.setNotValidMessage("")}get value(){return this.data.value}}class dr{constructor(e){this._inputControl=e}setValidators(e){return this._inputControl.setValidators(e),this}setChangeSensitive(){return this._inputControl.setChangeSensitive(!0),this}setRequired(){return this._inputControl.setIsRequired(!0),this}setValid(){return this._inputControl.setIsValid(!0),this}setBlurSensitive(){return this._inputControl.setIsBlurSensitive(!0),this}setId(e){return this._inputControl.setId(e),this}removeEmptySensitive(){return this._inputControl.setIsEmptySensitive(!1),this}setHasCustomValidationCheck(){return this._inputControl.setHasCustomValidationCheck(!0),this}removeErrorOnInteract(){return this._inputControl.setShouldRemoveValidationOnInteract(!0),this}build(){return this._inputControl}}class fr{constructor(){this.mounted=(e,r)=>{r.value&&r.value.getIsBlurSensitive()&&(e.addEventListener("click",this.handleFocus.bind(this,r.value)),e.addEventListener("blur",this.handleBlur.bind(this,r.value),!0))},this.beforeUnMount=(e,r)=>{e.removeEventListener("blur",this.handleBlur.bind(this,r.value)),e.removeEventListener("click",this.handleFocus.bind(this,r.value))}}handleBlur(e){e.runValidation(!0)}handleFocus(e){e.value||e.getIsEmptySensitive()||e.setNotValidMessage("")}}class vr{constructor(){this._inputControls=new Map,this._isValid=!1,this._id=Math.random()}getInputControlsAsArray(){return Array.from(this._inputControls.values())}async runValidation(e){let r=!0;for(const s of this.getInputControlsAsArray())if(e&&await s.runValidation(!0),!s.getIsValid()&&(r=!1,!e)){this._isValid=!1;return}this._isValid=r}addInputControls(e){for(const r of e)this._inputControls.set(r.getName(),r)}getInputControl(e){const r=this._inputControls.get(e);if(!r)throw new Error(`The provided input name (${e}}) has no controls.`);return r}resetControls(e){for(const r of e){const s=this._inputControls.get(r);s?s.reset():console.warn(`Provided input name ${r} has no controllers in this form`)}}resetAll(){for(const e of this.getInputControlsAsArray())e.reset()}createRequestBody(){const e={};for(const r of this.getInputControlsAsArray())r.getIsIncludeInRequestBody()&&(e[r.getName()]=r.value);return e}setIsValid(e){this._isValid=e}getIsValid(){return this._isValid}setId(e){this._id=e}getId(){return this._id}}function mr(t,e=!1){const r=g.reactive(t),s=g.ref(ne.Invalid);return g.watch(()=>r.getInputControlsAsArray(),()=>{e||(r.runValidation(),r.getIsValid()?s.value=ne.Valid:s.value=ne.Invalid)},{immediate:!0,deep:!0}),{reactiveForm:r,validationStatus:s}}class ke{constructor(e){this.timerId=null,this.setupInterval=this.setupInterval.bind(this),this.schedule=e}setupInterval(e){const r=this;this.timerId=setTimeout(async function s(){await r.schedule.runAction(),r.timerId=setTimeout(()=>{s()},e)},e)}clearInterval(){this.timerId&&clearInterval(this.timerId)}}const Ve="150px",$e=2,pr={path:"id",key:"id",title:"عملیات",colspan:$e,width:Ve,cellType:ge.ACTION,align:me.Center,headerType:pe.Text,accessLevel:null},dt={width:Ve,align:me.Center,headerType:pe.Text,cellType:ge.Text,colspan:$e};class we{constructor(e,r){this.key=e,this.order=r}}class Fe{aSort(e,r){return e.sort((s,n)=>{const i=s[r]??s,a=n[r]??n;if(typeof i=="string"&&typeof a=="string")return i.localeCompare(a);if(typeof i=="number"&&typeof a=="number")return i-a;throw new Error("Not supported data type")})}bSort(e,r){return e.sort((s,n)=>{const i=s[r]??s,a=n[r]??n;if(typeof i=="string"&&typeof a=="string")return a.localeCompare(i);if(typeof i=="number"&&typeof a=="number")return a-i;throw new Error("Not supported data type")})}}class gr{arrayOfObjectSort(e,r,s,n=new Fe){return s===O.ASC?n.aSort(e,r):n.bSort(e,r)}arraySort(e,r,s=new Fe){return r===O.ASC?s.aSort(e):s.bSort(e)}}class ft{constructor(e){this.currentPage=1,this.currentPageSize=20,this.currentSortDetail=new we("id",O.DESC),this.loadedRows=[],this.headerSchema=[],this.service=e,this.accessService=W.GetInstance()}addHeader(e){this.headerSchema.push(e)}async load(){this.headerSchema=this.filterItemsBaseOnAccessLevel(await this.loadHeader()),await this.loadRows()}filterItemsBaseOnAccessLevel(e){return e.filter(r=>r.hasAccess?r.hasAccess():!0)}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail=e,this.loadedRows=(await this.handleSort(this.currentSortDetail)).items)}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.key||e.order!==this.currentSortDetail.order}async paginate(e,r){this.shouldSendPaginationRequest(e,r)&&(this.currentPage=e,this.currentPageSize=r,this.loadedRows=(await this.handlePagination(this.currentPage,this.currentPageSize)).items)}shouldSendPaginationRequest(e,r){return this.currentPage!==e||this.currentPageSize!==r}async loadRows(){return this.loadedRows=(await this.service.fetchRows()).items,this.loadedRows}getData(){return this.service.getData()}async handleSort(e){return await this.service.sort(e)}async handlePagination(e,r){return await this.service.paginate(e,r)}getItemCountPerPage(){return Le.DEFAULT_ITEM_COUNT_PER_PAGE}isLoading(){const e=this.getLoadingStatuses();return e.has(y.Search)||e.has(y.FetchList)||e.has(y.Sort)||e.has(y.FetchLastItems)||e.has(y.FetchPreviousItems)}getLoadingStatuses(){return this.getData().loadingStatus}hasAnyAction(){for(const e of this.loadedRows)if(this.getAccessedActions(e).length)return!0;return!1}getAccessedActions(e){return this.filterItemsBaseOnAccessLevel(this.getActions(e))}getActions(e){return[]}getScrollDetail(){return null}isExpandable(){return!1}async handleClick(e){}async handleMetaClick(e){}async handleDoubleClick(e){}async onDestroy(){}async loadHeader(){throw new Error("No header provided for the table.")}loadSummarySchema(){return{summaryTitle:"",summaryItems:[]}}}class T{constructor(e){this.observers=[],this.next(e)}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(r=>r!==e)}notify(){for(const e of this.observers)typeof e=="function"?e(this._value):e.update(this._value)}next(e){typeof e=="function"?this._value=e(this._value):this._value=e,this.notify()}getValue(){return this._value}}class yr extends ft{constructor(e){super(e),this.selectedRows=new T(new Map),this.rowSelect=this.rowSelect.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.handlePagination=this.handlePagination.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRows=this.getSelectedRows.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}rowSelect(e){this.getSelectedRowsValue().has(e.id)?(this.getSelectedRowsValue().delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.loadedRows)this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRowsValue().size===this.currentPageSize||this.loadedRows.length===this.getSelectedRowsValue().size}async handlePagination(e,r){return this.clearAllSelectedItems(),await super.handlePagination(e,r)}async handleSort(e){return this.clearAllSelectedItems(),await super.handleSort(e)}clearAllSelectedItems(){this.selectedRows.getValue().clear(),this.selectedRows.next(this.selectedRows.getValue())}getSelectedRows(){return this.selectedRows}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}getSelectedRowsValue(){return this.selectedRows.getValue()}}function Sr(t){return{...dt,...t}}function wr(t){return function(r,s){r.constructor.prototype.headers||(r.constructor.prototype.headers=[]),r.constructor.prototype.headers.push({path:s,...t})}}function Ir(t){return function(r){async function s(){return r.prototype._table=this,r.prototype.headers}function n(u){const l=[],c=r.prototype.actions||[];for(const v of c){if(!v.isAvailable(u))continue;const f={handler:v.handler.bind(u),accessLevel:v.accessLevel,actionName:v.actionName};l.push(f)}return l}async function i(u){r.prototype.rowClick&&await r.prototype.rowClick.call(u)}async function a(){r.prototype.tableDestroy&&await r.prototype.tableDestroy()}t.prototype.loadHeader=s,t.prototype.getActions=n,t.prototype.handleClick=i,t.prototype.onDestroy=a}}function br(t){return function(r,s,n){r.constructor.prototype.actions||(r.constructor.prototype.actions=[]),t.handler=n.value,r.constructor.prototype.actions.push(t)}}function Ar(){return function(e,r,s){e.constructor.prototype.tableDestroy=s.value}}function Dr(){return function(e,r,s){e.constructor.prototype.rowClick=s.value}}class Rr{constructor(){this.observers=[]}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(r=>r!==e)}notify(){for(const e of this.observers)e.update(this)}}class vt{constructor(e){this.rows=new T([]),this.headerSchema=new T([]),this.currentPage=new T(1),this.currentPageSize=new T(20),this.totalItems=new T(0),this.currentSortDetail=new T(new we("id",O.DESC)),this.scrollDetail=new T(null),this.isExpandable=new T(!1),this.tableSource=e,this.accessService=W.GetInstance()}async load(){this.rows.next(await this.tableSource.loadRows()),this.headerSchema.next(this.filterItemsBaseOnAccessLevel(await this.tableSource.loadHeaderSchema()))}async paginate(e,r){this.shouldSendPaginationRequest(e,r)&&(this.currentPage.next(e),this.currentPageSize.next(r),this.rows.next(await this.tableSource.paginate(e,r)))}shouldSendPaginationRequest(e,r){return this.currentPage.getValue()!==e||this.currentPageSize.getValue()!==r}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail.next(e),this.rows.next(await this.tableSource.sort(e)))}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.getValue().key||e.order!==this.currentSortDetail.getValue().order}async handleClick(e){this.tableSource.onRowClick&&await this.tableSource.onRowClick()}async handleMetaClick(e){this.tableSource.onRowMetaClick&&await this.tableSource.onRowMetaClick}async handleDoubleClick(e){this.tableSource.onRowDoubleClick&&await this.tableSource.onRowDoubleClick()}hasAnyAction(){for(const e of this.rows.getValue())if(this.getRowActions(e).length)return!0;return!1}getRowActions(e){return this.filterItemsBaseOnAccessLevel(this.tableSource.loadRowActions(e))}loadSummarySchema(){return this.tableSource.loadSummarySchema?this.tableSource.loadSummarySchema():{summaryTitle:"",summaryItems:[]}}filterItemsBaseOnAccessLevel(e){return e.filter(r=>r.hasAccess?r.hasAccess():!0)}async onDestroy(){this.tableSource.onTableDestroy()}}class _r extends vt{constructor(e){super(e),this.selectedRows=new T(new Map),this.selectRow=this.selectRow.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}selectRow(e){const r=this.getSelectedRows();r.has(e.id)?(r.delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(r.set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.rows.getValue())this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRows().size===this.currentPageSize.getValue()||this.rows.getValue().length===this.getSelectedRows().size}clearAllSelectedItems(){this.getSelectedRows().clear(),this.selectedRows.next(this.selectedRows.getValue)}getSelectedRows(){return this.selectedRows.getValue()}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}}var Ne;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Ne||(Ne={}));const D=Ne;/*! *****************************************************************************
2
+ the initial data will be available after calling the [markAsInitial] method on this instance`)}markAsInitial(){this.initialData=structuredClone(g.toRaw(this.data))}setValidators(e){this._validators=e}getChangeSensitive(){return this.data.isChangeSensitive}setChangeSensitive(e){if(e&&this.data.shouldRemoveValidationMessageOnInteract)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.isChangeSensitive=e}getIsBlurSensitive(){return this.data.isBlurSensitive}setIsBlurSensitive(e){this.data.isBlurSensitive=e}getIsRequired(){return this.data.isRequired}setIsRequired(e){this.data.isRequired=e}getIsValid(){return this.data.isValid}setIsValid(e){this.data.isValid=e}getIsIncludeInRequestBody(){return this.data.isIncludeInRequestBody}setIsIncludeInRequestBody(e){this.data.isIncludeInRequestBody=e}getNotValidMessage(){return this.data.notValidMessage}setNotValidMessage(e){this.data.notValidMessage=e}getName(){return this.data.name}setName(e){this.data.name=e}setId(e){this._id=e}getId(){return this._id}getIsEmptySensitive(){return this.data.isEmptySensitive}setIsEmptySensitive(e){this.data.isEmptySensitive=e}setHasCustomValidationCheck(e){this.data.hasCustomValidationCheck=e}setShouldRemoveValidationOnInteract(e){if(e&&this.data.isChangeSensitive)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.shouldRemoveValidationMessageOnInteract=e}getShouldRemoveValidationOnInteract(){return this.data.shouldRemoveValidationMessageOnInteract}hasCustomValidationCheck(){return this.data.hasCustomValidationCheck}set value(e){this.data.value=e,this.shouldRunValidation()&&this.runValidation(),this.getShouldRemoveValidationOnInteract()&&this.setNotValidMessage("")}get value(){return this.data.value}}class dr{constructor(e){this._inputControl=e}setValidators(e){return this._inputControl.setValidators(e),this}setChangeSensitive(){return this._inputControl.setChangeSensitive(!0),this}setRequired(){return this._inputControl.setIsRequired(!0),this}setValid(){return this._inputControl.setIsValid(!0),this}setBlurSensitive(){return this._inputControl.setIsBlurSensitive(!0),this}setId(e){return this._inputControl.setId(e),this}removeEmptySensitive(){return this._inputControl.setIsEmptySensitive(!1),this}setHasCustomValidationCheck(){return this._inputControl.setHasCustomValidationCheck(!0),this}removeErrorOnInteract(){return this._inputControl.setShouldRemoveValidationOnInteract(!0),this}build(){return this._inputControl}}class fr{constructor(){this.mounted=(e,r)=>{r.value&&r.value.getIsBlurSensitive()&&(e.addEventListener("click",this.handleFocus.bind(this,r.value)),e.addEventListener("blur",this.handleBlur.bind(this,r.value),!0))},this.beforeUnMount=(e,r)=>{e.removeEventListener("blur",this.handleBlur.bind(this,r.value)),e.removeEventListener("click",this.handleFocus.bind(this,r.value))}}handleBlur(e){e.runValidation(!0)}handleFocus(e){e.value||e.getIsEmptySensitive()||e.setNotValidMessage("")}}class vr{constructor(){this._inputControls=new Map,this._isValid=!1,this._id=Math.random()}getInputControlsAsArray(){return Array.from(this._inputControls.values())}async runValidation(e){let r=!0;for(const s of this.getInputControlsAsArray())if(e&&await s.runValidation(!0),!s.getIsValid()&&(r=!1,!e)){this._isValid=!1;return}this._isValid=r}addInputControls(e){for(const r of e)this._inputControls.set(r.getName(),r)}getInputControl(e){const r=this._inputControls.get(e);if(!r)throw new Error(`The provided input name (${e}}) has no controls.`);return r}resetControls(e){for(const r of e){const s=this._inputControls.get(r);s?s.reset():console.warn(`Provided input name ${r} has no controllers in this form`)}}resetAll(){for(const e of this.getInputControlsAsArray())e.reset()}createRequestBody(){const e={};for(const r of this.getInputControlsAsArray())r.getIsIncludeInRequestBody()&&(e[r.getName()]=r.value);return e}setIsValid(e){this._isValid=e}getIsValid(){return this._isValid}setId(e){this._id=e}getId(){return this._id}}function mr(t,e=!1){const r=g.reactive(t),s=g.ref(ne.Invalid);return g.watch(()=>r.getInputControlsAsArray(),()=>{e||(r.runValidation(),r.getIsValid()?s.value=ne.Valid:s.value=ne.Invalid)},{immediate:!0,deep:!0}),{reactiveForm:r,validationStatus:s}}class ke{constructor(e){this.timerId=null,this.setupInterval=this.setupInterval.bind(this),this.schedule=e}setupInterval(e){const r=this;this.timerId=setTimeout(async function s(){await r.schedule.runAction(),r.timerId=setTimeout(()=>{s()},e)},e)}clearInterval(){this.timerId&&clearInterval(this.timerId)}}const Ve="150px",$e=2,pr={path:"id",key:"id",title:"عملیات",colspan:$e,width:Ve,cellType:ge.ACTION,align:me.Center,headerType:pe.Text,accessLevel:null},dt={width:Ve,align:me.Center,headerType:pe.Text,cellType:ge.Text,colspan:$e};class we{constructor(e,r){this.key=e,this.order=r}}class Fe{aSort(e,r){return e.sort((s,n)=>{const i=s[r]??s,a=n[r]??n;if(typeof i=="string"&&typeof a=="string")return i.localeCompare(a);if(typeof i=="number"&&typeof a=="number")return i-a;throw new Error("Not supported data type")})}bSort(e,r){return e.sort((s,n)=>{const i=s[r]??s,a=n[r]??n;if(typeof i=="string"&&typeof a=="string")return a.localeCompare(i);if(typeof i=="number"&&typeof a=="number")return a-i;throw new Error("Not supported data type")})}}class gr{arrayOfObjectSort(e,r,s,n=new Fe){return s===O.ASC?n.aSort(e,r):n.bSort(e,r)}arraySort(e,r,s=new Fe){return r===O.ASC?s.aSort(e):s.bSort(e)}}class ft{constructor(e){this.currentPage=1,this.currentPageSize=20,this.currentSortDetail=new we("id",O.DESC),this.loadedRows=[],this.headerSchema=[],this.service=e,this.accessService=W.GetInstance()}addHeader(e){this.headerSchema.push(e)}async load(){this.headerSchema=this.filterItemsBaseOnAccessLevel(await this.loadHeader()),await this.loadRows()}filterItemsBaseOnAccessLevel(e){return e.filter(r=>r.hasAccess?r.hasAccess():!0)}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail=e,this.loadedRows=(await this.handleSort(this.currentSortDetail)).items)}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.key||e.order!==this.currentSortDetail.order}async paginate(e,r){this.shouldSendPaginationRequest(e,r)&&(this.currentPage=e,this.currentPageSize=r,this.loadedRows=(await this.handlePagination(this.currentPage,this.currentPageSize)).items)}shouldSendPaginationRequest(e,r){return this.currentPage!==e||this.currentPageSize!==r}async loadRows(){return this.loadedRows=(await this.service.fetchRows()).items,this.loadedRows}getData(){return this.service.getData()}async handleSort(e){return await this.service.sort(e)}async handlePagination(e,r){return await this.service.paginate(e,r)}getItemCountPerPage(){return Le.DEFAULT_ITEM_COUNT_PER_PAGE}isLoading(){const e=this.getLoadingStatuses();return e.has(y.Search)||e.has(y.FetchList)||e.has(y.Sort)||e.has(y.FetchLastItems)||e.has(y.FetchPreviousItems)}getLoadingStatuses(){return this.getData().loadingStatus}hasAnyAction(){for(const e of this.loadedRows)if(this.getAccessedActions(e).length)return!0;return!1}getAccessedActions(e){return this.filterItemsBaseOnAccessLevel(this.getActions(e))}getActions(e){return[]}getScrollDetail(){return null}isExpandable(){return!1}async handleClick(e){}async handleMetaClick(e){}async handleDoubleClick(e){}async onDestroy(){}async loadHeader(){throw new Error("No header provided for the table.")}loadSummarySchema(){return{summaryTitle:"",summaryItems:[]}}}class T{constructor(e){this.observers=[],this.next(e)}attach(e){this.observers.push(e),this.notifyObject(e)}detach(e){this.observers=this.observers.filter(r=>r!==e)}notify(){for(const e of this.observers)this.notifyObject(e)}notifyObject(e){typeof e=="function"?e(this._value):e.update(this._value)}next(e){typeof e=="function"?this._value=e(this._value):this._value=e,this.notify()}getValue(){return this._value}}class yr extends ft{constructor(e){super(e),this.selectedRows=new T(new Map),this.rowSelect=this.rowSelect.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.handlePagination=this.handlePagination.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRows=this.getSelectedRows.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}rowSelect(e){this.getSelectedRowsValue().has(e.id)?(this.getSelectedRowsValue().delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.loadedRows)this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRowsValue().size===this.currentPageSize||this.loadedRows.length===this.getSelectedRowsValue().size}async handlePagination(e,r){return this.clearAllSelectedItems(),await super.handlePagination(e,r)}async handleSort(e){return this.clearAllSelectedItems(),await super.handleSort(e)}clearAllSelectedItems(){this.selectedRows.getValue().clear(),this.selectedRows.next(this.selectedRows.getValue())}getSelectedRows(){return this.selectedRows}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}getSelectedRowsValue(){return this.selectedRows.getValue()}}function Sr(t){return{...dt,...t}}function wr(t){return function(r,s){r.constructor.prototype.headers||(r.constructor.prototype.headers=[]),r.constructor.prototype.headers.push({path:s,...t})}}function Ir(t){return function(r){async function s(){return r.prototype._table=this,r.prototype.headers}function n(u){const l=[],c=r.prototype.actions||[];for(const v of c){if(!v.isAvailable(u))continue;const f={handler:v.handler.bind(u),accessLevel:v.accessLevel,actionName:v.actionName};l.push(f)}return l}async function i(u){r.prototype.rowClick&&await r.prototype.rowClick.call(u)}async function a(){r.prototype.tableDestroy&&await r.prototype.tableDestroy()}t.prototype.loadHeader=s,t.prototype.getActions=n,t.prototype.handleClick=i,t.prototype.onDestroy=a}}function br(t){return function(r,s,n){r.constructor.prototype.actions||(r.constructor.prototype.actions=[]),t.handler=n.value,r.constructor.prototype.actions.push(t)}}function Ar(){return function(e,r,s){e.constructor.prototype.tableDestroy=s.value}}function Dr(){return function(e,r,s){e.constructor.prototype.rowClick=s.value}}class Rr{constructor(){this.observers=[]}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(r=>r!==e)}notify(){for(const e of this.observers)e.update(this)}}class vt{constructor(e){this.rows=new T([]),this.headerSchema=new T([]),this.currentPage=new T(1),this.currentPageSize=new T(20),this.totalItems=new T(0),this.currentSortDetail=new T(new we("id",O.DESC)),this.scrollDetail=new T(null),this.isExpandable=new T(!1),this.tableSource=e,this.accessService=W.GetInstance()}async load(){this.rows.next(await this.tableSource.loadRows()),this.headerSchema.next(this.filterItemsBaseOnAccessLevel(await this.tableSource.loadHeaderSchema()))}async paginate(e,r){this.shouldSendPaginationRequest(e,r)&&(this.currentPage.next(e),this.currentPageSize.next(r),this.rows.next(await this.tableSource.paginate(e,r)))}shouldSendPaginationRequest(e,r){return this.currentPage.getValue()!==e||this.currentPageSize.getValue()!==r}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail.next(e),this.rows.next(await this.tableSource.sort(e)))}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.getValue().key||e.order!==this.currentSortDetail.getValue().order}async handleClick(e){this.tableSource.onRowClick&&await this.tableSource.onRowClick()}async handleMetaClick(e){this.tableSource.onRowMetaClick&&await this.tableSource.onRowMetaClick}async handleDoubleClick(e){this.tableSource.onRowDoubleClick&&await this.tableSource.onRowDoubleClick()}hasAnyAction(){for(const e of this.rows.getValue())if(this.getRowActions(e).length)return!0;return!1}getRowActions(e){return this.filterItemsBaseOnAccessLevel(this.tableSource.loadRowActions(e))}loadSummarySchema(){return this.tableSource.loadSummarySchema?this.tableSource.loadSummarySchema():{summaryTitle:"",summaryItems:[]}}filterItemsBaseOnAccessLevel(e){return e.filter(r=>r.hasAccess?r.hasAccess():!0)}async onDestroy(){this.tableSource.onTableDestroy()}}class _r extends vt{constructor(e){super(e),this.selectedRows=new T(new Map),this.selectRow=this.selectRow.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}selectRow(e){const r=this.getSelectedRows();r.has(e.id)?(r.delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(r.set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.rows.getValue())this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRows().size===this.currentPageSize.getValue()||this.rows.getValue().length===this.getSelectedRows().size}clearAllSelectedItems(){this.getSelectedRows().clear(),this.selectedRows.next(this.selectedRows.getValue)}getSelectedRows(){return this.selectedRows.getValue()}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}}var Ne;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Ne||(Ne={}));const D=Ne;/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
5
5
  Permission to use, copy, modify, and/or distribute this software for any
@@ -9,6 +9,7 @@ export declare class BehaviorSubject<T> implements Subject<T> {
9
9
  attach(observer: Observer<T> | ObserverCallback<T>): void;
10
10
  detach(observer: Observer<T> | ObserverCallback<T>): void;
11
11
  notify(): void;
12
+ private notifyObject;
12
13
  next(newValue: T | ObserverUpdaterCallback<T>): void;
13
14
  getValue(): T;
14
15
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sarafapp/iron_core",
3
3
  "private": false,
4
- "version": "1.0.39",
4
+ "version": "1.0.40",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"