@sarafapp/iron_core 1.0.42 → 1.0.43
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
|
@@ -2235,6 +2235,9 @@ var Cr = Object.getOwnPropertyDescriptor, Mr = (t, e, r, s) => {
|
|
|
2235
2235
|
return n;
|
|
2236
2236
|
};
|
|
2237
2237
|
let Qe = class {
|
|
2238
|
+
constructor() {
|
|
2239
|
+
this.setCellComponentRegistry = this.setCellComponentRegistry.bind(this), this.getCellComponentRegistry = this.getCellComponentRegistry.bind(this);
|
|
2240
|
+
}
|
|
2238
2241
|
setCellComponentRegistry(t) {
|
|
2239
2242
|
this.cellComponentRegistry = t;
|
|
2240
2243
|
}
|
package/dist/IronCore.umd.cjs
CHANGED
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */var Be=function(t,e){return Be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)s.hasOwnProperty(n)&&(r[n]=s[n])},Be(t,e)};function je(t,e){Be(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Cr(t,e,r,s){function n(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function u(v){try{c(s.next(v))}catch(f){a(f)}}function l(v){try{c(s.throw(v))}catch(f){a(f)}}function c(v){v.done?i(v.value):n(v.value).then(u,l)}c((s=s.apply(t,[])).next())})}function Mr(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(v){return l([c,v])}}function l(c){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(v){c=[6,v],n=0}finally{s=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function be(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,i=[],a;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return i}function j(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(be(arguments[e]));return t}var Tr="injectionTokens";function Er(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(Tr,t)||{};return Object.keys(r).forEach(function(s){e[+s]=r[s]}),e}function mt(t){return!!t.useClass}function Ue(t){return!!t.useFactory}var pt=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,s={},n=!1,i,a=function(){return n||(i=e(r.wrap()),n=!0),i};return new Proxy(s,this.createHandler(a))},t.prototype.createHandler=function(e){var r={},s=function(n){r[n]=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];i[0]=e();var u=Reflect[n];return u.apply(void 0,j(i))}};return this.reflectMethods.forEach(s),r},t}();function K(t){return typeof t=="string"||typeof t=="symbol"}function Lr(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function gt(t){return typeof t=="object"&&"token"in t&&"transform"in t}function Or(t){return typeof t=="function"||t instanceof pt}function Ae(t){return!!t.useToken}function De(t){return t.useValue!=null}function Pr(t){return mt(t)||De(t)||Ae(t)||Ue(t)}var Ye=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t}(),kr=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),Re=function(){function t(){this.scopedResolutions=new Map}return t}();function Vr(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function $r(t,e,r){return r===void 0&&(r=" "),j([t],e.message.split(`
|
|
16
16
|
`).map(function(s){return r+s})).join(`
|
|
17
|
-
`)}function Fr(t,e,r){var s=be(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),n=s[1],i=n===void 0?null:n,a=Vr(i,e);return $r("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',r)}function Nr(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Br=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),jr=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),Ur=function(){function t(){this.preResolution=new Br,this.postResolution=new jr}return t}(),yt=new Map,Yr=function(){function t(e){this.parent=e,this._registry=new kr,this.interceptors=new Ur,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,s){s===void 0&&(s={lifecycle:D.Transient}),this.ensureNotDisposed();var n;if(Pr(r)?n=r:n={useClass:r},Ae(n))for(var i=[e],a=n;a!=null;){var u=a.useToken;if(i.includes(u))throw new Error("Token registration cycle detected! "+j(i,[u]).join(" -> "));i.push(u);var l=this._registry.get(u);l&&Ae(l.provider)?a=l.provider:a=null}if((s.lifecycle===D.Singleton||s.lifecycle==D.ContainerScoped||s.lifecycle==D.ResolutionScoped)&&(De(n)||Ue(n)))throw new Error('Cannot use lifecycle "'+D[s.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:s}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),K(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),K(e)){if(K(r))return this.register(e,{useToken:r},{lifecycle:D.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:D.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var s=e;return r&&!K(r)&&(s=r),this.register(e,{useClass:s},{lifecycle:D.Singleton})},t.prototype.resolve=function(e,r,s){r===void 0&&(r=new Re),s===void 0&&(s=!1),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&K(e)){if(s)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Or(e)){var i=this.construct(e,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var s,n;if(this.interceptors.preResolution.has(e)){var i=[];try{for(var a=Ie(this.interceptors.preResolution.getAll(e)),u=a.next();!u.done;u=a.next()){var l=u.value;l.options.frequency!="Once"&&i.push(l),l.callback(e,r)}}catch(c){s={error:c}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(s)throw s.error}}this.interceptors.preResolution.setAll(e,i)}},t.prototype.executePostResolutionInterceptor=function(e,r,s){var n,i;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var u=Ie(this.interceptors.postResolution.getAll(e)),l=u.next();!l.done;l=u.next()){var c=l.value;c.options.frequency!="Once"&&a.push(c),c.callback(e,r,s)}}catch(v){n={error:v}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===D.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var s=e.options.lifecycle===D.Singleton,n=e.options.lifecycle===D.ContainerScoped,i=s||n,a;return De(e.provider)?a=e.provider.useValue:Ae(e.provider)?a=i?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):mt(e.provider)?a=i?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Ue(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,r),e.options.lifecycle===D.ResolutionScoped&&r.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,r,s){var n=this;r===void 0&&(r=new Re),s===void 0&&(s=!1),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&K(e)){if(s)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),i){var a=i.map(function(l){return n.resolveRegistration(l,r)});return this.executePostResolutionInterceptor(e,a,"All"),a}var u=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,u,"All"),u},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var s=Ie(this._registry.entries()),n=s.next();!n.done;n=s.next()){var i=be(n.value,2),a=i[0],u=i[1];this._registry.setAll(a,u.filter(function(l){return!De(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var s=new t(this);try{for(var n=Ie(this._registry.entries()),i=n.next();!i.done;i=n.next()){var a=be(i.value,2),u=a[0],l=a[1];l.some(function(c){var v=c.options;return v.lifecycle===D.ContainerScoped})&&s._registry.setAll(u,l.map(function(c){return c.options.lifecycle===D.ContainerScoped?{provider:c.provider,options:c.options}:c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return s},t.prototype.beforeResolution=function(e,r,s){s===void 0&&(s={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:s})},t.prototype.afterResolution=function(e,r,s){s===void 0&&(s={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:s})},t.prototype.dispose=function(){return Cr(this,void 0,void 0,function(){var e;return Mr(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(s){var n=s.dispose();n&&e.push(n)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var s=this;if(e instanceof pt)return e.createProxy(function(i){return s.resolve(i,r)});var n=function(){var i=yt.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=i.map(s.resolveParams(r,e));return new(e.bind.apply(e,j([void 0],a)))}();return Nr(n)&&this.disposables.add(n),n},t.prototype.resolveParams=function(e,r){var s=this;return function(n,i){var a,u,l;try{return Lr(n)?gt(n)?n.multiple?(a=s.resolve(n.transform)).transform.apply(a,j([s.resolveAll(n.token,new Re,n.isOptional)],n.transformArgs)):(u=s.resolve(n.transform)).transform.apply(u,j([s.resolve(n.token,e,n.isOptional)],n.transformArgs)):n.multiple?s.resolveAll(n.token,new Re,n.isOptional):s.resolve(n.token,e,n.isOptional):gt(n)?(l=s.resolve(n.transform,e)).transform.apply(l,j([s.resolve(n.token,e)],n.transformArgs)):s.resolve(n,e)}catch(c){throw new Error(Fr(r,i,c))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),Hr=new Yr;function qr(t){return function(e){yt.set(e,Er(e))}}function zr(){return function(t){qr()(t),Hr.registerSingleton(t)}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Jr=Object.getOwnPropertyDescriptor,Gr=(t,e,r,s)=>{for(var n=s>1?void 0:s?Jr(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(n=a(n)||n);return n};o.TableConfig=class{setCellComponentRegistry(e){this.cellComponentRegistry=e}getCellComponentRegistry(){return this.cellComponentRegistry}},o.TableConfig=Gr([zr()],o.TableConfig);class xr{constructor(){this.registeredComponents=new Map}initialize(){this.registerComponents()}getRegisteredComponents(){return this.registeredComponents}}function Wr(t){return function(r,s){r.constructor.prototype.headers||(r.constructor.prototype.headers=[]),r.constructor.prototype.headers.push({path:s,...t})}}function Kr(t){return function(r){async function s(){return r.prototype.headers||[]}t.loadHeaderSchema=s}}function St(){const t=g.ref(new Map),e=g.ref(0),r=g.ref(null),s=g.computed(()=>Array.from(t.value.values()));function n(p){e.value=p}function i(p){for(const S of p)a(S)}function a(p){t.value.set(p.id,p)}function u(p){return r.value=t.value.get(p)||null,r.value}function l(p){const S=u(p);return S&&t.value.delete(p),!!S}function c(){t.value.clear()}function v(p){r.value=p}function f(){r.value=null}return{itemsAsArray:s,totalCount:e,currentItem:r,setTotalCount:n,addOrReplaceItems:i,getById:u,removeById:l,clearItems:c,setCurrentItem:v,clearCurrentItem:f}}class wt{constructor(){this.pageNumber=1,this.itemCount=20,this.sortDetail=new we("id",O.DESC),this.filters=[]}}class Zr{constructor(e,r){this.items=e,this.totalItems=r}}class Xr{constructor(e,r){this.shouldKeepSync=e,this.intervalInMillisecond=r}}const It=new wt;function bt(){const t=g.ref(structuredClone(It));function e(){t.value.pageNumber=t.value.pageNumber+1}function r(){t.value.pageNumber=t.value.pageNumber-1}function s(f){t.value.pageNumber=f}function n(f){t.value.itemCount=f}function i(f){t.value.sortDetail.key=f.key,t.value.sortDetail.order=f.order}function a(f){for(const p in f)u(p,f[p])}function u(f,p){const S=t.value.filters.findIndex(A=>A.key===f);S>-1?t.value.filters[S].value=p:t.value.filters.push({key:f,value:p})}function l(f){let p=t.value.filters;p=p.filter(S=>S.key!==f),t.value.filters=p}function c(){const f={page:t.value.pageNumber,count:t.value.itemCount};t.value.sortDetail&&(f.by=t.value.sortDetail.key,f.order=t.value.sortDetail.order);for(const p of t.value.filters)if(p.value)if(typeof p.value=="string"||typeof p.value=="number")f[p.key]=p.value;else{const S=JSON.stringify(p.value);S!=="[]"&&S!=="{}"&&(f[p.key]=S)}return f}function v(){t.value=structuredClone(It)}return{params:t,setNextPage:e,setPreventPage:r,setPageNumber:s,setItemCount:n,setSortDetail:i,setFilter:u,removeFilter:l,getRequestParams:c,clearParam:v,setFiltersBaseOnRequestBody:a}}function At(){const t=g.ref(new Set),e=g.computed(()=>t.value.has(y.FetchList)),r=g.computed(()=>t.value.has(y.FetchItem)),s=g.computed(()=>t.value.has(y.FetchLastItems)),n=g.computed(()=>t.value.has(y.FetchPreviousItems)),i=g.computed(()=>t.value.has(y.Create)),a=g.computed(()=>t.value.has(y.Update)),u=g.computed(()=>t.value.has(y.Delete)),l=g.computed(()=>t.value.has(y.Search)),c=g.computed(()=>t.value.has(y.Sort));function v(p){t.value.add(p)}function f(p){t.value.delete(p)}return{loadingStatus:t,isFetchingList:e,isFetchingItem:r,isFetchingLastItems:s,isFetchingPreviousItems:n,isCreating:i,isUpdating:a,isDeleting:u,isSearching:l,isSorting:c,setStatus:v,removeStatus:f}}function Qr(t){const e=St(),r=bt(),s=At(),n=new ke({runAction:async()=>f(y.AutoRefresh)}),i=g.computed(()=>{const h=r.params.value.pageNumber,d=r.params.value.itemCount,m=h*d-d,I=h*d-1,b=[];for(let w=m;w<=I&&e.itemsAsArray.value[w];w++)b.push(e.itemsAsArray.value[w]);return b}),a=g.computed(()=>({totalItems:e.totalCount.value,currentPage:r.params.value.pageNumber,rows:e.itemsAsArray.value,loadingStatus:s.loadingStatus.value,currentPageItems:i.value})),u=g.computed(()=>({getData:c,sort:ie,paginate:_e,fetchRows:f})),l=g.computed(()=>t.getSyncDetail());function c(){return a.value}async function v(h){const d=await t.fetchList(h);return e.clearItems(),e.addOrReplaceItems(d.items),e.setTotalCount(d.totalItems),d}async function f(h=y.FetchList){s.setStatus(h);const d=await v(r.getRequestParams());return s.removeStatus(h),d}async function p(){S(),await f()}function S(){if(!l.value.shouldKeepSync)throw new Error("The provided repository does not support auto refresh");n.setupInterval(l.value.intervalInMillisecond)}function A(){n.clearInterval()}async function Z(h,d=!0){s.setStatus(y.FetchItem),d&&e.clearCurrentItem();const m=await t.fetchItemById(h);return e.setCurrentItem(m),s.removeStatus(y.FetchItem),m}async function X(h){s.setStatus(y.Create);const d=await t.createItem(h);return d&&e.addOrReplaceItems([d]),s.removeStatus(y.Create),d}async function Q(h,d){s.setStatus(y.Update);const m=await t.updateItem(h,d);return m&&e.addOrReplaceItems([m]),s.removeStatus(y.Update),m}async function ee(h){return s.setStatus(y.Delete),await t.deleteItem(h),s.removeStatus(y.Delete),e.removeById(h)}async function Ge(){r.setNextPage(),s.setStatus(y.FetchLastItems);const h=await v(r.getRequestParams());return s.removeStatus(y.FetchLastItems),h}async function xe(){r.setPreventPage(),s.setStatus(y.FetchPreviousItems);const h=await v(r.getRequestParams());return s.removeStatus(y.FetchPreviousItems),h}async function _e(h){r.setPageNumber(h),s.setStatus(y.FetchList);const d=await v(r.getRequestParams());return s.removeStatus(y.FetchList),d}async function We(h){r.setFilter("search",h),s.setStatus(y.Search),e.clearItems();const d=await v(r.getRequestParams());return s.removeStatus(y.Search),d}async function ie(h){r.setSortDetail(h),s.setStatus(y.Sort),e.clearItems();const d=await v(r.getRequestParams());return s.removeStatus(y.Sort),d}async function te(){return r.clearParam(),await f()}return g.onBeforeUnmount(()=>{A()}),{loadingStatusManager:s,dataManger:e,paramsManager:r,tableRenderingData:a,fetchList:f,fetchWithAutoRefresh:p,setupAutoRefresh:S,stopAutoRefresh:A,fetchItemById:Z,createItem:X,updateItem:Q,deleteItem:ee,fetchLastItems:Ge,fetchPreviousItems:xe,fetchItemsByPageNumber:_e,search:We,sort:ie,clearFilters:te,tableService:u,currentPageItems:i}}function es(t){const e=g.ref(t),r=g.computed(()=>({getData(){return{totalItems:e.value.length,currentPageItems:e.value,loadingStatus:new Set,rows:e.value,currentPage:1}},async sort(s){return{totalItems:e.value.length,items:e.value}},async fetchRows(){return{totalItems:e.value.length,items:e.value}},async paginate(s,n){return{totalItems:e.value.length,items:e.value}}}));return{tableRows:e,staticTableService:r}}function ts(){const t=g.ref(new Map),e=g.ref(0),r=g.computed(()=>e.value),s=g.computed(()=>Array.from(t.value.values()));function n(v){e.value=v}function i(v){for(const f of v)a(f)}function a(v){t.value.set(String(v.id),v)}function u(v){const f=l(v);return t.value.delete(String(v)),f}function l(v){return t.value.get(String(v))||null}function c(){t.value.clear()}return{entityItemsAsArray:s,addOrReplaceItems:i,removeById:u,getItemById:l,clearItems:c,setTotalCount:n,getTotalCount:r}}class rs{constructor(e,r=500){this.timerId=null,this.debounceTimeout=r,this.action=e}runAction(){this.cancelDebounce(),this.action.runImmediate(),this.timerId=setTimeout(()=>{this.action.runDebounce()},this.debounceTimeout)}cancelDebounce(){this.timerId&&clearTimeout(this.timerId)}}function ss(t){return function(e,r,s){const n=s.value;s.value=async function(...i){try{return await n.apply(this,i)}catch(a){for(const u of t)await u.handleError(a)}}}}function ns(t){return function(e,r,s){const n=s.value;s.value=async function(...i){try{const a=await n.apply(this,i);for(const u of t)u.shouldResolveSuccess(a)&&await u.handleSuccess(a);return a}catch(a){for(const u of t)u.shouldResolveFailure(a)&&await u.handleFailure(a)}}}}class is{constructor(e,r,s=()=>!0,n=()=>!0){this.successMessageResolver=e,this.failureMessageResolver=r,this.shouldResolveSuccess=s,this.shouldResolveFailure=n}async handleSuccess(e){}async handleFailure(e){}async handleInfo(){}async handleWarning(){}}const L=class L{constructor(){}static GetInstance(){return L.instance||(L.instance=new L),L.instance}static registerHandler(e,r){L.handlers.set(e,r)}handle(e){var n;const r=((n=e.response)==null?void 0:n.status)??0,s=L.handlers.get(r);s&&s.handleError(e)}};L.handlers=new Map,L.instance=null;let He=L;class as{constructor(e){this.axiosInstance=e}setBaseURL(e){return this.axiosInstance.defaults.baseURL=e,this}setTimeout(e){return this.axiosInstance.defaults.timeout=e,this}setHeaders(e){return this.axiosInstance.defaults.headers.common=e,this}attachRequestInterceptors(e){return this.axiosInstance.interceptors.request.use(r=>{for(const s of e)s.intercept(r);return r},r=>Promise.reject(r)),this}attachResponseInterceptors(e){return this.axiosInstance.interceptors.response.use(r=>r,r=>{throw e.handle(r),r}),this}build(){return this.axiosInstance}}class os{constructor(e){this.axiosInstance=e}async get(e,r){return await this.axiosInstance.get(e,r)}async post(e,r,s){return await this.axiosInstance.post(e,r,s)}async patch(e,r,s){return await this.axiosInstance.patch(e,r,s)}async put(e,r,s){return await this.axiosInstance.put(e,r,s)}async delete(e,r){return await this.axiosInstance.delete(e,r)}}class ls{constructor(){this._initializer=[]}setupInitializers(e){this._initializer.push(...e)}initialize(){for(const e of this._initializer)e.initialize()}}const H=class H{constructor(){this.jsonConverter=new C.JsonConvert}serializeObject(e,r){return this.jsonConverter.serializeObject(e,r)}deserializeObject(e,r){return this.jsonConverter.deserializeObject(e,r)}deserializeArray(e,r){return this.jsonConverter.deserializeArray(e,r)}tryDeserialize(e,r){for(const s of r)try{return this.deserializeObject(e,s)}catch{}throw new Error("Unable to deserialize object")}static GetInstance(){return H.Instance||(H.Instance=new H),H.Instance}};H.Instance=null;let qe=H;var Dt=(t=>(t.Success="success",t.Failure="error",t.Info="info",t.Warning="warning",t))(Dt||{}),ze=(t=>(t.BottomLeft="bottomLeft",t.TopLeft="topLeft",t))(ze||{});class us{constructor(e,r,s){this.placement=ze.BottomLeft,this.type=e,this.message=r,this.description=s}}const cs=Ke.defineStore(ye.Dialog,()=>{const t=g.reactive({dialogComponent:null,width:k.DefaultWidth,height:k.DefaultHeight,props:null,header:""}),e=g.computed(()=>!!t.dialogComponent),r=g.computed(()=>!!t.header);function s(l){t.dialogComponent=l}function n(l){t.header=l}function i(l){if(!e.value)throw new Error("there is no dialog to set props on");t.props=l}function a(l,c){if(!e.value)throw new Error("there is no dialog to set size on");if(l<k.MinimalAvailableSize)throw new Error("negative size not supported");c===k.Width?t.width=l:t.height=l}function u(){t.props=null,t.height=k.DefaultHeight,t.width=k.DefaultWidth,t.header="",t.dialogComponent=null}return{dialogData:t,openDialog:s,clearDialog:u,setSize:a,setDialogHeader:n,setProps:i,isDialogExists:e,hasDefaultHeader:r}}),hs=Ke.defineStore(ye.Drawer,()=>{const t=g.ref(x.Close),e=g.computed(()=>t.value===x.Open);function r(){t.value=x.Close}function s(){t.value=x.Open}return{closeDrawer:r,openDrawer:s,isDrawerOpen:e}});class ds{constructor(e){this.mapProcesses=new Map,this.processes=e,this.assignProcessManager()}assignProcessManager(){this.processes.addToManager(this)}setProcessToMap(e){this.mapProcesses.set(e.name,e)}async start(){await this.processes.execute()}async startFrom(e){const r=this.mapProcesses.get(e);if(!r)throw new Error(`Process ${e} not found`);await r.execute()}}class fs{constructor(e,r){this.next=null,this.name=e,this.next=r}addToManager(e){e.setProcessToMap(this),this.next&&this.next.addToManager(e)}}class vs{constructor(){this.checkAccessibility=this.checkAccessibility.bind(this),this.isAccessible=this.isAccessible.bind(this),this.getDestinationRouteName=this.getDestinationRouteName.bind(this)}async checkAccessibility(e,r,s){if(await this.isAccessible(e,r)){s();return}if(await this.getDestinationRouteName()){s({name:await this.getDestinationRouteName()});return}if(await this.getDestinationRouteLocation(e,r)){s(await this.getDestinationRouteLocation(e,r));return}s(!1)}async getDestinationRouteName(){return""}async getDestinationRouteLocation(e,r){return null}}class ms{constructor(e,r,s){this.scheduler=new ke({runAction:async()=>{await this.fetchList()}}),this.repository=e,this.crudDataManagement=r,this.syncDetail=this.repository.getSyncDetail(),this.paramManager=s,this.syncListWithApi()}async fetchList(){const e=await this.repository.fetchList(this.paramManager.getRequestParams());return this.crudDataManagement.addOrReplaceItems(e.items),this.crudDataManagement.setTotalCount(e.totalItems),e}async fetchItemById(e){const r=await this.repository.fetchItemById(e);return r&&this.crudDataManagement.addOrReplaceItems([r]),r}async createItem(e){const r=await this.repository.createItem(e);return r&&!this.shouldRefreshListAfterCreate()&&this.crudDataManagement.addOrReplaceItems([r]),r&&this.shouldRefreshListAfterCreate()&&await this.fetchList(),r}shouldRefreshListAfterCreate(){return!0}async deleteItem(e){return await this.repository.deleteItem(e)?this.crudDataManagement.removeById(e):null}async updateItem(e,r){const s=await this.repository.updateItem(e,r);return this.shouldRefreshListAfterUpdate()&&s?(await this.fetchList(),this.crudDataManagement.getItemById(e)):s}shouldRefreshListAfterUpdate(){return!0}async removeItem(e){const r=await this.repository.deleteItem(e);return r&&this.shouldRefreshListAfterDelete()&&await this.fetchList(),r?this.crudDataManagement.removeById(e):null}shouldRefreshListAfterDelete(){return!1}syncListWithApi(){this.scheduler.clearInterval(),this.syncDetail.shouldKeepSync&&this.scheduler.setupInterval(this.syncDetail.intervalInMillisecond)}onDestroy(){this.crudDataManagement.clearItems(),this.clearInterval()}clearInterval(){this.scheduler.clearInterval()}}class Rt{}class ps extends Rt{search(e,r,s){const n=[];e:for(const i of e)for(const a of s(i))if(B.removeSpacesFromString(String(a).toLowerCase()).indexOf(B.removeSpacesFromString(String(r).toLowerCase()))>-1){n.push(i);continue e}return n}}var Je=(t=>(t.Hidden="hidden",t.Visible="visible",t))(Je||{});class gs{constructor(e){this._visibilityControl=e,this.mangeVisibilityEvent()}mangeVisibilityEvent(){document.addEventListener("visibilitychange",e=>{document.visibilityState===Je.Hidden?this._visibilityControl.screenInvisible(e):this._visibilityControl.screenVisible(e)})}}var ys=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,E=(t,e,r,s)=>{for(var n=s>1?void 0:s?Ss(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(n=(s?a(e,r,n):a(n))||n);return s&&n&&ys(e,r,n),n};o.Amount=class{constructor(){this.value="",this.symbol=""}get tradeValueInNumber(){return Number(this.value)}get truncatedValue(){return this.tradeValueInNumber.toLocaleString("en-US",{maximumFractionDigits:8})}},E([C.JsonProperty("value",String,!0)],o.Amount.prototype,"value",2),E([C.JsonProperty("symbol",String)],o.Amount.prototype,"symbol",2),o.Amount=E([C.JsonObject("Amount")],o.Amount),o.BaseModel=class{getTable(){const e=Object.getPrototypeOf(this)._table;if(!e)throw new Error("No Table found for the model. are you sure decorated the model with @Table() ?");return e}},E([C.JsonProperty("id",Object)],o.BaseModel.prototype,"id",2),o.BaseModel=E([C.JsonObject("BaseModel")],o.BaseModel),o.MinifiedSymbolModel=class extends o.BaseModel{},E([C.JsonProperty("symbol",String)],o.MinifiedSymbolModel.prototype,"symbol",2),E([C.JsonProperty("enName",String)],o.MinifiedSymbolModel.prototype,"enName",2),E([C.JsonProperty("faName",String)],o.MinifiedSymbolModel.prototype,"faName",2),E([C.JsonProperty("image",String)],o.MinifiedSymbolModel.prototype,"image",2),o.MinifiedSymbolModel=E([C.JsonObject("MinifiedSymbolModel")],o.MinifiedSymbolModel);class ws{constructor(e,r){this.requestedDate=e,this.executedDate=r}get requestedDateInJalali(){return M.mapUnixToDate(this.requestedDate,J.SimpleDate)}get requestedTime(){return M.mapUnixToDate(this.requestedDate,J.JustHour)}get executedDateInJalali(){return M.mapUnixToDate(this.executedDate,J.SimpleDate)}get executedDateTime(){return M.mapUnixToDate(this.executedDate,J.JustHour)}}class Is{constructor(e,r){this.requestedAmount=e,this.executedAmount=r}}class bs{constructor(e,r,s,n,i){this.symbolPrice=e,this.USDTPrice=r,this.symobl=s,this.symbolImage=n,this.USDTImage=i}get truncatedSymbolPrice(){return this.symbolPrice.toLocaleString("en-US",{maximumFractionDigits:8})}get truncatedUSDTPrice(){return this.USDTPrice.toLocaleString("en-US",{maximumFractionDigits:8})}}class As{constructor(e,r){this.soldSymbol=e,this.buySymbol=r}}o.APIErrorHandlerRegistry=He,o.AbstractSubject=Rr,o.AccessControl=Oe,o.AccessLevel=W,o.Action=br,o.ApiBuilder=as,o.ApplicationDrawerStatus=x,o.ApplicationInitializer=ls,o.AuthorizationDirective=Pe,o.AuthorizationService=Se,o.BaseTable=ft,o.BehaviorSubject=T,o.CellType=ge,o.ClientArraySearch=ps,o.ClientSearch=Rt,o.Column=wr,o.CommonMaskFormats=oe,o.CrudService=ms,o.DateConverter=N,o.DateDisabledOptions=sr,o.DateFormat=J,o.DateFormats=Qe,o.DateTools=se,o.DebounceService=rs,o.DialogDimensions=k,o.EveryAccess=nr,o.EveryLevelAuthorizationDirective=ar,o.Feedback=is,o.FetchListResponse=Zr,o.FormManager=vr,o.FormValidationStatus=ne,o.Formatter=M,o.GColumn=Wr,o.GTable=Kr,o.HandleError=ss,o.HandleFeedback=ns,o.HeaderType=pe,o.HttpClient=os,o.InputControl=hr,o.InputControlBuilder=dr,o.InputControlData=ct,o.JsonMapper=qe,o.LoadingStatus=y,o.Params=wt,o.Process=fs,o.ProcessManager=ds,o.RangeValue=rr,o.RouteGuard=vs,o.Scheduler=ke,o.SelectableTable=yr,o.SelectableTableGenerator=_r,o.SimpleSort=Fe,o.SomeAccess=ir,o.SomeLevelsAuthorizationDirective=or,o.SortDetail=we,o.SortOrder=O,o.SortOrderTableHeader=ot,o.Sorter=gr,o.StatusCode=lt,o.StorageKeys=V,o.StoreNames=ye,o.SymbolInTrade=As,o.SymbolPriceInTrade=bs,o.Symbols=ut,o.SyncDetail=Xr,o.TABLE_ACTION_COLUMN=pr,o.TABLE_COLUMN_DEFAULT_COLSPAN=$e,o.TABLE_COLUMN_DEFAULT_VALUES=dt,o.TABLE_COLUMN_DEFAULT_WIDTH=Ve,o.Table=Ir,o.TableCellComponentRegistry=xr,o.TableConstants=Le,o.TableDestroy=Ar,o.TableGenerator=vt,o.TableHeaderAlign=me,o.TableRowClick=Dr,o.ToastLocation=ze,o.ToastMessage=us,o.ToastType=Dt,o.TouchSensitiveControl=fr,o.TradeAmount=Is,o.TradeDate=ws,o.Util=B,o.VisibilityManager=gs,o.VisibilityState=Je,o.cards=Ze,o.generateHeader=Sr,o.ibans=Xe,o.isEmpty=ht,o.isLastItem=ur,o.isOnlyOneItem=lr,o.setupJalaliDate=at,o.setupStore=cr,o.useCrud=ts,o.useData=St,o.useDialogService=cs,o.useDrawerService=hs,o.useForm=mr,o.useLoadingStatus=At,o.useParams=bt,o.useRepository=Qr,o.useStaticTableService=es,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
17
|
+
`)}function Fr(t,e,r){var s=be(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),n=s[1],i=n===void 0?null:n,a=Vr(i,e);return $r("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',r)}function Nr(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Br=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),jr=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),Ur=function(){function t(){this.preResolution=new Br,this.postResolution=new jr}return t}(),yt=new Map,Yr=function(){function t(e){this.parent=e,this._registry=new kr,this.interceptors=new Ur,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,s){s===void 0&&(s={lifecycle:D.Transient}),this.ensureNotDisposed();var n;if(Pr(r)?n=r:n={useClass:r},Ae(n))for(var i=[e],a=n;a!=null;){var u=a.useToken;if(i.includes(u))throw new Error("Token registration cycle detected! "+j(i,[u]).join(" -> "));i.push(u);var l=this._registry.get(u);l&&Ae(l.provider)?a=l.provider:a=null}if((s.lifecycle===D.Singleton||s.lifecycle==D.ContainerScoped||s.lifecycle==D.ResolutionScoped)&&(De(n)||Ue(n)))throw new Error('Cannot use lifecycle "'+D[s.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:s}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),K(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),K(e)){if(K(r))return this.register(e,{useToken:r},{lifecycle:D.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:D.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var s=e;return r&&!K(r)&&(s=r),this.register(e,{useClass:s},{lifecycle:D.Singleton})},t.prototype.resolve=function(e,r,s){r===void 0&&(r=new Re),s===void 0&&(s=!1),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&K(e)){if(s)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Or(e)){var i=this.construct(e,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var s,n;if(this.interceptors.preResolution.has(e)){var i=[];try{for(var a=Ie(this.interceptors.preResolution.getAll(e)),u=a.next();!u.done;u=a.next()){var l=u.value;l.options.frequency!="Once"&&i.push(l),l.callback(e,r)}}catch(c){s={error:c}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(s)throw s.error}}this.interceptors.preResolution.setAll(e,i)}},t.prototype.executePostResolutionInterceptor=function(e,r,s){var n,i;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var u=Ie(this.interceptors.postResolution.getAll(e)),l=u.next();!l.done;l=u.next()){var c=l.value;c.options.frequency!="Once"&&a.push(c),c.callback(e,r,s)}}catch(v){n={error:v}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===D.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var s=e.options.lifecycle===D.Singleton,n=e.options.lifecycle===D.ContainerScoped,i=s||n,a;return De(e.provider)?a=e.provider.useValue:Ae(e.provider)?a=i?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):mt(e.provider)?a=i?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Ue(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,r),e.options.lifecycle===D.ResolutionScoped&&r.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,r,s){var n=this;r===void 0&&(r=new Re),s===void 0&&(s=!1),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&K(e)){if(s)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),i){var a=i.map(function(l){return n.resolveRegistration(l,r)});return this.executePostResolutionInterceptor(e,a,"All"),a}var u=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,u,"All"),u},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var s=Ie(this._registry.entries()),n=s.next();!n.done;n=s.next()){var i=be(n.value,2),a=i[0],u=i[1];this._registry.setAll(a,u.filter(function(l){return!De(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var s=new t(this);try{for(var n=Ie(this._registry.entries()),i=n.next();!i.done;i=n.next()){var a=be(i.value,2),u=a[0],l=a[1];l.some(function(c){var v=c.options;return v.lifecycle===D.ContainerScoped})&&s._registry.setAll(u,l.map(function(c){return c.options.lifecycle===D.ContainerScoped?{provider:c.provider,options:c.options}:c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return s},t.prototype.beforeResolution=function(e,r,s){s===void 0&&(s={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:s})},t.prototype.afterResolution=function(e,r,s){s===void 0&&(s={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:s})},t.prototype.dispose=function(){return Cr(this,void 0,void 0,function(){var e;return Mr(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(s){var n=s.dispose();n&&e.push(n)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var s=this;if(e instanceof pt)return e.createProxy(function(i){return s.resolve(i,r)});var n=function(){var i=yt.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=i.map(s.resolveParams(r,e));return new(e.bind.apply(e,j([void 0],a)))}();return Nr(n)&&this.disposables.add(n),n},t.prototype.resolveParams=function(e,r){var s=this;return function(n,i){var a,u,l;try{return Lr(n)?gt(n)?n.multiple?(a=s.resolve(n.transform)).transform.apply(a,j([s.resolveAll(n.token,new Re,n.isOptional)],n.transformArgs)):(u=s.resolve(n.transform)).transform.apply(u,j([s.resolve(n.token,e,n.isOptional)],n.transformArgs)):n.multiple?s.resolveAll(n.token,new Re,n.isOptional):s.resolve(n.token,e,n.isOptional):gt(n)?(l=s.resolve(n.transform,e)).transform.apply(l,j([s.resolve(n.token,e)],n.transformArgs)):s.resolve(n,e)}catch(c){throw new Error(Fr(r,i,c))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),Hr=new Yr;function qr(t){return function(e){yt.set(e,Er(e))}}function zr(){return function(t){qr()(t),Hr.registerSingleton(t)}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Jr=Object.getOwnPropertyDescriptor,Gr=(t,e,r,s)=>{for(var n=s>1?void 0:s?Jr(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(n=a(n)||n);return n};o.TableConfig=class{constructor(){this.setCellComponentRegistry=this.setCellComponentRegistry.bind(this),this.getCellComponentRegistry=this.getCellComponentRegistry.bind(this)}setCellComponentRegistry(e){this.cellComponentRegistry=e}getCellComponentRegistry(){return this.cellComponentRegistry}},o.TableConfig=Gr([zr()],o.TableConfig);class xr{constructor(){this.registeredComponents=new Map}initialize(){this.registerComponents()}getRegisteredComponents(){return this.registeredComponents}}function Wr(t){return function(r,s){r.constructor.prototype.headers||(r.constructor.prototype.headers=[]),r.constructor.prototype.headers.push({path:s,...t})}}function Kr(t){return function(r){async function s(){return r.prototype.headers||[]}t.loadHeaderSchema=s}}function St(){const t=g.ref(new Map),e=g.ref(0),r=g.ref(null),s=g.computed(()=>Array.from(t.value.values()));function n(p){e.value=p}function i(p){for(const S of p)a(S)}function a(p){t.value.set(p.id,p)}function u(p){return r.value=t.value.get(p)||null,r.value}function l(p){const S=u(p);return S&&t.value.delete(p),!!S}function c(){t.value.clear()}function v(p){r.value=p}function f(){r.value=null}return{itemsAsArray:s,totalCount:e,currentItem:r,setTotalCount:n,addOrReplaceItems:i,getById:u,removeById:l,clearItems:c,setCurrentItem:v,clearCurrentItem:f}}class wt{constructor(){this.pageNumber=1,this.itemCount=20,this.sortDetail=new we("id",O.DESC),this.filters=[]}}class Zr{constructor(e,r){this.items=e,this.totalItems=r}}class Xr{constructor(e,r){this.shouldKeepSync=e,this.intervalInMillisecond=r}}const It=new wt;function bt(){const t=g.ref(structuredClone(It));function e(){t.value.pageNumber=t.value.pageNumber+1}function r(){t.value.pageNumber=t.value.pageNumber-1}function s(f){t.value.pageNumber=f}function n(f){t.value.itemCount=f}function i(f){t.value.sortDetail.key=f.key,t.value.sortDetail.order=f.order}function a(f){for(const p in f)u(p,f[p])}function u(f,p){const S=t.value.filters.findIndex(A=>A.key===f);S>-1?t.value.filters[S].value=p:t.value.filters.push({key:f,value:p})}function l(f){let p=t.value.filters;p=p.filter(S=>S.key!==f),t.value.filters=p}function c(){const f={page:t.value.pageNumber,count:t.value.itemCount};t.value.sortDetail&&(f.by=t.value.sortDetail.key,f.order=t.value.sortDetail.order);for(const p of t.value.filters)if(p.value)if(typeof p.value=="string"||typeof p.value=="number")f[p.key]=p.value;else{const S=JSON.stringify(p.value);S!=="[]"&&S!=="{}"&&(f[p.key]=S)}return f}function v(){t.value=structuredClone(It)}return{params:t,setNextPage:e,setPreventPage:r,setPageNumber:s,setItemCount:n,setSortDetail:i,setFilter:u,removeFilter:l,getRequestParams:c,clearParam:v,setFiltersBaseOnRequestBody:a}}function At(){const t=g.ref(new Set),e=g.computed(()=>t.value.has(y.FetchList)),r=g.computed(()=>t.value.has(y.FetchItem)),s=g.computed(()=>t.value.has(y.FetchLastItems)),n=g.computed(()=>t.value.has(y.FetchPreviousItems)),i=g.computed(()=>t.value.has(y.Create)),a=g.computed(()=>t.value.has(y.Update)),u=g.computed(()=>t.value.has(y.Delete)),l=g.computed(()=>t.value.has(y.Search)),c=g.computed(()=>t.value.has(y.Sort));function v(p){t.value.add(p)}function f(p){t.value.delete(p)}return{loadingStatus:t,isFetchingList:e,isFetchingItem:r,isFetchingLastItems:s,isFetchingPreviousItems:n,isCreating:i,isUpdating:a,isDeleting:u,isSearching:l,isSorting:c,setStatus:v,removeStatus:f}}function Qr(t){const e=St(),r=bt(),s=At(),n=new ke({runAction:async()=>f(y.AutoRefresh)}),i=g.computed(()=>{const h=r.params.value.pageNumber,d=r.params.value.itemCount,m=h*d-d,I=h*d-1,b=[];for(let w=m;w<=I&&e.itemsAsArray.value[w];w++)b.push(e.itemsAsArray.value[w]);return b}),a=g.computed(()=>({totalItems:e.totalCount.value,currentPage:r.params.value.pageNumber,rows:e.itemsAsArray.value,loadingStatus:s.loadingStatus.value,currentPageItems:i.value})),u=g.computed(()=>({getData:c,sort:ie,paginate:_e,fetchRows:f})),l=g.computed(()=>t.getSyncDetail());function c(){return a.value}async function v(h){const d=await t.fetchList(h);return e.clearItems(),e.addOrReplaceItems(d.items),e.setTotalCount(d.totalItems),d}async function f(h=y.FetchList){s.setStatus(h);const d=await v(r.getRequestParams());return s.removeStatus(h),d}async function p(){S(),await f()}function S(){if(!l.value.shouldKeepSync)throw new Error("The provided repository does not support auto refresh");n.setupInterval(l.value.intervalInMillisecond)}function A(){n.clearInterval()}async function Z(h,d=!0){s.setStatus(y.FetchItem),d&&e.clearCurrentItem();const m=await t.fetchItemById(h);return e.setCurrentItem(m),s.removeStatus(y.FetchItem),m}async function X(h){s.setStatus(y.Create);const d=await t.createItem(h);return d&&e.addOrReplaceItems([d]),s.removeStatus(y.Create),d}async function Q(h,d){s.setStatus(y.Update);const m=await t.updateItem(h,d);return m&&e.addOrReplaceItems([m]),s.removeStatus(y.Update),m}async function ee(h){return s.setStatus(y.Delete),await t.deleteItem(h),s.removeStatus(y.Delete),e.removeById(h)}async function Ge(){r.setNextPage(),s.setStatus(y.FetchLastItems);const h=await v(r.getRequestParams());return s.removeStatus(y.FetchLastItems),h}async function xe(){r.setPreventPage(),s.setStatus(y.FetchPreviousItems);const h=await v(r.getRequestParams());return s.removeStatus(y.FetchPreviousItems),h}async function _e(h){r.setPageNumber(h),s.setStatus(y.FetchList);const d=await v(r.getRequestParams());return s.removeStatus(y.FetchList),d}async function We(h){r.setFilter("search",h),s.setStatus(y.Search),e.clearItems();const d=await v(r.getRequestParams());return s.removeStatus(y.Search),d}async function ie(h){r.setSortDetail(h),s.setStatus(y.Sort),e.clearItems();const d=await v(r.getRequestParams());return s.removeStatus(y.Sort),d}async function te(){return r.clearParam(),await f()}return g.onBeforeUnmount(()=>{A()}),{loadingStatusManager:s,dataManger:e,paramsManager:r,tableRenderingData:a,fetchList:f,fetchWithAutoRefresh:p,setupAutoRefresh:S,stopAutoRefresh:A,fetchItemById:Z,createItem:X,updateItem:Q,deleteItem:ee,fetchLastItems:Ge,fetchPreviousItems:xe,fetchItemsByPageNumber:_e,search:We,sort:ie,clearFilters:te,tableService:u,currentPageItems:i}}function es(t){const e=g.ref(t),r=g.computed(()=>({getData(){return{totalItems:e.value.length,currentPageItems:e.value,loadingStatus:new Set,rows:e.value,currentPage:1}},async sort(s){return{totalItems:e.value.length,items:e.value}},async fetchRows(){return{totalItems:e.value.length,items:e.value}},async paginate(s,n){return{totalItems:e.value.length,items:e.value}}}));return{tableRows:e,staticTableService:r}}function ts(){const t=g.ref(new Map),e=g.ref(0),r=g.computed(()=>e.value),s=g.computed(()=>Array.from(t.value.values()));function n(v){e.value=v}function i(v){for(const f of v)a(f)}function a(v){t.value.set(String(v.id),v)}function u(v){const f=l(v);return t.value.delete(String(v)),f}function l(v){return t.value.get(String(v))||null}function c(){t.value.clear()}return{entityItemsAsArray:s,addOrReplaceItems:i,removeById:u,getItemById:l,clearItems:c,setTotalCount:n,getTotalCount:r}}class rs{constructor(e,r=500){this.timerId=null,this.debounceTimeout=r,this.action=e}runAction(){this.cancelDebounce(),this.action.runImmediate(),this.timerId=setTimeout(()=>{this.action.runDebounce()},this.debounceTimeout)}cancelDebounce(){this.timerId&&clearTimeout(this.timerId)}}function ss(t){return function(e,r,s){const n=s.value;s.value=async function(...i){try{return await n.apply(this,i)}catch(a){for(const u of t)await u.handleError(a)}}}}function ns(t){return function(e,r,s){const n=s.value;s.value=async function(...i){try{const a=await n.apply(this,i);for(const u of t)u.shouldResolveSuccess(a)&&await u.handleSuccess(a);return a}catch(a){for(const u of t)u.shouldResolveFailure(a)&&await u.handleFailure(a)}}}}class is{constructor(e,r,s=()=>!0,n=()=>!0){this.successMessageResolver=e,this.failureMessageResolver=r,this.shouldResolveSuccess=s,this.shouldResolveFailure=n}async handleSuccess(e){}async handleFailure(e){}async handleInfo(){}async handleWarning(){}}const L=class L{constructor(){}static GetInstance(){return L.instance||(L.instance=new L),L.instance}static registerHandler(e,r){L.handlers.set(e,r)}handle(e){var n;const r=((n=e.response)==null?void 0:n.status)??0,s=L.handlers.get(r);s&&s.handleError(e)}};L.handlers=new Map,L.instance=null;let He=L;class as{constructor(e){this.axiosInstance=e}setBaseURL(e){return this.axiosInstance.defaults.baseURL=e,this}setTimeout(e){return this.axiosInstance.defaults.timeout=e,this}setHeaders(e){return this.axiosInstance.defaults.headers.common=e,this}attachRequestInterceptors(e){return this.axiosInstance.interceptors.request.use(r=>{for(const s of e)s.intercept(r);return r},r=>Promise.reject(r)),this}attachResponseInterceptors(e){return this.axiosInstance.interceptors.response.use(r=>r,r=>{throw e.handle(r),r}),this}build(){return this.axiosInstance}}class os{constructor(e){this.axiosInstance=e}async get(e,r){return await this.axiosInstance.get(e,r)}async post(e,r,s){return await this.axiosInstance.post(e,r,s)}async patch(e,r,s){return await this.axiosInstance.patch(e,r,s)}async put(e,r,s){return await this.axiosInstance.put(e,r,s)}async delete(e,r){return await this.axiosInstance.delete(e,r)}}class ls{constructor(){this._initializer=[]}setupInitializers(e){this._initializer.push(...e)}initialize(){for(const e of this._initializer)e.initialize()}}const H=class H{constructor(){this.jsonConverter=new C.JsonConvert}serializeObject(e,r){return this.jsonConverter.serializeObject(e,r)}deserializeObject(e,r){return this.jsonConverter.deserializeObject(e,r)}deserializeArray(e,r){return this.jsonConverter.deserializeArray(e,r)}tryDeserialize(e,r){for(const s of r)try{return this.deserializeObject(e,s)}catch{}throw new Error("Unable to deserialize object")}static GetInstance(){return H.Instance||(H.Instance=new H),H.Instance}};H.Instance=null;let qe=H;var Dt=(t=>(t.Success="success",t.Failure="error",t.Info="info",t.Warning="warning",t))(Dt||{}),ze=(t=>(t.BottomLeft="bottomLeft",t.TopLeft="topLeft",t))(ze||{});class us{constructor(e,r,s){this.placement=ze.BottomLeft,this.type=e,this.message=r,this.description=s}}const cs=Ke.defineStore(ye.Dialog,()=>{const t=g.reactive({dialogComponent:null,width:k.DefaultWidth,height:k.DefaultHeight,props:null,header:""}),e=g.computed(()=>!!t.dialogComponent),r=g.computed(()=>!!t.header);function s(l){t.dialogComponent=l}function n(l){t.header=l}function i(l){if(!e.value)throw new Error("there is no dialog to set props on");t.props=l}function a(l,c){if(!e.value)throw new Error("there is no dialog to set size on");if(l<k.MinimalAvailableSize)throw new Error("negative size not supported");c===k.Width?t.width=l:t.height=l}function u(){t.props=null,t.height=k.DefaultHeight,t.width=k.DefaultWidth,t.header="",t.dialogComponent=null}return{dialogData:t,openDialog:s,clearDialog:u,setSize:a,setDialogHeader:n,setProps:i,isDialogExists:e,hasDefaultHeader:r}}),hs=Ke.defineStore(ye.Drawer,()=>{const t=g.ref(x.Close),e=g.computed(()=>t.value===x.Open);function r(){t.value=x.Close}function s(){t.value=x.Open}return{closeDrawer:r,openDrawer:s,isDrawerOpen:e}});class ds{constructor(e){this.mapProcesses=new Map,this.processes=e,this.assignProcessManager()}assignProcessManager(){this.processes.addToManager(this)}setProcessToMap(e){this.mapProcesses.set(e.name,e)}async start(){await this.processes.execute()}async startFrom(e){const r=this.mapProcesses.get(e);if(!r)throw new Error(`Process ${e} not found`);await r.execute()}}class fs{constructor(e,r){this.next=null,this.name=e,this.next=r}addToManager(e){e.setProcessToMap(this),this.next&&this.next.addToManager(e)}}class vs{constructor(){this.checkAccessibility=this.checkAccessibility.bind(this),this.isAccessible=this.isAccessible.bind(this),this.getDestinationRouteName=this.getDestinationRouteName.bind(this)}async checkAccessibility(e,r,s){if(await this.isAccessible(e,r)){s();return}if(await this.getDestinationRouteName()){s({name:await this.getDestinationRouteName()});return}if(await this.getDestinationRouteLocation(e,r)){s(await this.getDestinationRouteLocation(e,r));return}s(!1)}async getDestinationRouteName(){return""}async getDestinationRouteLocation(e,r){return null}}class ms{constructor(e,r,s){this.scheduler=new ke({runAction:async()=>{await this.fetchList()}}),this.repository=e,this.crudDataManagement=r,this.syncDetail=this.repository.getSyncDetail(),this.paramManager=s,this.syncListWithApi()}async fetchList(){const e=await this.repository.fetchList(this.paramManager.getRequestParams());return this.crudDataManagement.addOrReplaceItems(e.items),this.crudDataManagement.setTotalCount(e.totalItems),e}async fetchItemById(e){const r=await this.repository.fetchItemById(e);return r&&this.crudDataManagement.addOrReplaceItems([r]),r}async createItem(e){const r=await this.repository.createItem(e);return r&&!this.shouldRefreshListAfterCreate()&&this.crudDataManagement.addOrReplaceItems([r]),r&&this.shouldRefreshListAfterCreate()&&await this.fetchList(),r}shouldRefreshListAfterCreate(){return!0}async deleteItem(e){return await this.repository.deleteItem(e)?this.crudDataManagement.removeById(e):null}async updateItem(e,r){const s=await this.repository.updateItem(e,r);return this.shouldRefreshListAfterUpdate()&&s?(await this.fetchList(),this.crudDataManagement.getItemById(e)):s}shouldRefreshListAfterUpdate(){return!0}async removeItem(e){const r=await this.repository.deleteItem(e);return r&&this.shouldRefreshListAfterDelete()&&await this.fetchList(),r?this.crudDataManagement.removeById(e):null}shouldRefreshListAfterDelete(){return!1}syncListWithApi(){this.scheduler.clearInterval(),this.syncDetail.shouldKeepSync&&this.scheduler.setupInterval(this.syncDetail.intervalInMillisecond)}onDestroy(){this.crudDataManagement.clearItems(),this.clearInterval()}clearInterval(){this.scheduler.clearInterval()}}class Rt{}class ps extends Rt{search(e,r,s){const n=[];e:for(const i of e)for(const a of s(i))if(B.removeSpacesFromString(String(a).toLowerCase()).indexOf(B.removeSpacesFromString(String(r).toLowerCase()))>-1){n.push(i);continue e}return n}}var Je=(t=>(t.Hidden="hidden",t.Visible="visible",t))(Je||{});class gs{constructor(e){this._visibilityControl=e,this.mangeVisibilityEvent()}mangeVisibilityEvent(){document.addEventListener("visibilitychange",e=>{document.visibilityState===Je.Hidden?this._visibilityControl.screenInvisible(e):this._visibilityControl.screenVisible(e)})}}var ys=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,E=(t,e,r,s)=>{for(var n=s>1?void 0:s?Ss(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(n=(s?a(e,r,n):a(n))||n);return s&&n&&ys(e,r,n),n};o.Amount=class{constructor(){this.value="",this.symbol=""}get tradeValueInNumber(){return Number(this.value)}get truncatedValue(){return this.tradeValueInNumber.toLocaleString("en-US",{maximumFractionDigits:8})}},E([C.JsonProperty("value",String,!0)],o.Amount.prototype,"value",2),E([C.JsonProperty("symbol",String)],o.Amount.prototype,"symbol",2),o.Amount=E([C.JsonObject("Amount")],o.Amount),o.BaseModel=class{getTable(){const e=Object.getPrototypeOf(this)._table;if(!e)throw new Error("No Table found for the model. are you sure decorated the model with @Table() ?");return e}},E([C.JsonProperty("id",Object)],o.BaseModel.prototype,"id",2),o.BaseModel=E([C.JsonObject("BaseModel")],o.BaseModel),o.MinifiedSymbolModel=class extends o.BaseModel{},E([C.JsonProperty("symbol",String)],o.MinifiedSymbolModel.prototype,"symbol",2),E([C.JsonProperty("enName",String)],o.MinifiedSymbolModel.prototype,"enName",2),E([C.JsonProperty("faName",String)],o.MinifiedSymbolModel.prototype,"faName",2),E([C.JsonProperty("image",String)],o.MinifiedSymbolModel.prototype,"image",2),o.MinifiedSymbolModel=E([C.JsonObject("MinifiedSymbolModel")],o.MinifiedSymbolModel);class ws{constructor(e,r){this.requestedDate=e,this.executedDate=r}get requestedDateInJalali(){return M.mapUnixToDate(this.requestedDate,J.SimpleDate)}get requestedTime(){return M.mapUnixToDate(this.requestedDate,J.JustHour)}get executedDateInJalali(){return M.mapUnixToDate(this.executedDate,J.SimpleDate)}get executedDateTime(){return M.mapUnixToDate(this.executedDate,J.JustHour)}}class Is{constructor(e,r){this.requestedAmount=e,this.executedAmount=r}}class bs{constructor(e,r,s,n,i){this.symbolPrice=e,this.USDTPrice=r,this.symobl=s,this.symbolImage=n,this.USDTImage=i}get truncatedSymbolPrice(){return this.symbolPrice.toLocaleString("en-US",{maximumFractionDigits:8})}get truncatedUSDTPrice(){return this.USDTPrice.toLocaleString("en-US",{maximumFractionDigits:8})}}class As{constructor(e,r){this.soldSymbol=e,this.buySymbol=r}}o.APIErrorHandlerRegistry=He,o.AbstractSubject=Rr,o.AccessControl=Oe,o.AccessLevel=W,o.Action=br,o.ApiBuilder=as,o.ApplicationDrawerStatus=x,o.ApplicationInitializer=ls,o.AuthorizationDirective=Pe,o.AuthorizationService=Se,o.BaseTable=ft,o.BehaviorSubject=T,o.CellType=ge,o.ClientArraySearch=ps,o.ClientSearch=Rt,o.Column=wr,o.CommonMaskFormats=oe,o.CrudService=ms,o.DateConverter=N,o.DateDisabledOptions=sr,o.DateFormat=J,o.DateFormats=Qe,o.DateTools=se,o.DebounceService=rs,o.DialogDimensions=k,o.EveryAccess=nr,o.EveryLevelAuthorizationDirective=ar,o.Feedback=is,o.FetchListResponse=Zr,o.FormManager=vr,o.FormValidationStatus=ne,o.Formatter=M,o.GColumn=Wr,o.GTable=Kr,o.HandleError=ss,o.HandleFeedback=ns,o.HeaderType=pe,o.HttpClient=os,o.InputControl=hr,o.InputControlBuilder=dr,o.InputControlData=ct,o.JsonMapper=qe,o.LoadingStatus=y,o.Params=wt,o.Process=fs,o.ProcessManager=ds,o.RangeValue=rr,o.RouteGuard=vs,o.Scheduler=ke,o.SelectableTable=yr,o.SelectableTableGenerator=_r,o.SimpleSort=Fe,o.SomeAccess=ir,o.SomeLevelsAuthorizationDirective=or,o.SortDetail=we,o.SortOrder=O,o.SortOrderTableHeader=ot,o.Sorter=gr,o.StatusCode=lt,o.StorageKeys=V,o.StoreNames=ye,o.SymbolInTrade=As,o.SymbolPriceInTrade=bs,o.Symbols=ut,o.SyncDetail=Xr,o.TABLE_ACTION_COLUMN=pr,o.TABLE_COLUMN_DEFAULT_COLSPAN=$e,o.TABLE_COLUMN_DEFAULT_VALUES=dt,o.TABLE_COLUMN_DEFAULT_WIDTH=Ve,o.Table=Ir,o.TableCellComponentRegistry=xr,o.TableConstants=Le,o.TableDestroy=Ar,o.TableGenerator=vt,o.TableHeaderAlign=me,o.TableRowClick=Dr,o.ToastLocation=ze,o.ToastMessage=us,o.ToastType=Dt,o.TouchSensitiveControl=fr,o.TradeAmount=Is,o.TradeDate=ws,o.Util=B,o.VisibilityManager=gs,o.VisibilityState=Je,o.cards=Ze,o.generateHeader=Sr,o.ibans=Xe,o.isEmpty=ht,o.isLastItem=ur,o.isOnlyOneItem=lr,o.setupJalaliDate=at,o.setupStore=cr,o.useCrud=ts,o.useData=St,o.useDialogService=cs,o.useDrawerService=hs,o.useForm=mr,o.useLoadingStatus=At,o.useParams=bt,o.useRepository=Qr,o.useStaticTableService=es,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TableCellComponentRegistry } from './TableCellComponentRegistry';
|
|
2
2
|
export declare class TableConfig {
|
|
3
3
|
private cellComponentRegistry;
|
|
4
|
+
constructor();
|
|
4
5
|
setCellComponentRegistry(registry: TableCellComponentRegistry): void;
|
|
5
6
|
getCellComponentRegistry(): TableCellComponentRegistry;
|
|
6
7
|
}
|