dinocollab-core 1.1.1 → 1.1.2
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createClass as e,classCallCheck as t,defineProperty as i,objectSpread2 as a}from"../_virtual/_rollupPluginBabelHelpers.js";import{deepRemoveEmptyFields as r}from"../utils/helpers.js";import"../utils/dayjs-config.js";import"react/jsx-runtime";import"react";import"react-router-dom";import{QueryParam as l}from"../utils/query-param.js";var o=new(e((function e(){var o=this;t(this,e),i(this,"getUrlQuery",(function(e){try{var t=l.Gets("table");return t.table?JSON.parse(t.table):null==e?void 0:e.defaultFilter}catch(t){return null==e?void 0:e.defaultFilter}})),i(this,"setUrlQuery",(function(e,t){var i=o.extractFilter(e,t),a=r(i);if(0===Object.keys(a).length)return l.ReplaceDeletes("table");l.ReplacePatch({table:JSON.stringify(a)})})),i(this,"extractFilter",(function(e,t){var i,r,l,o,n=(null==t?void 0:t.defaultFilter)||{},s=a({},e);delete s.details;var u=(null===(i=s.pagination)||void 0===i?void 0:i.page)===(null===(r=n.pagination)||void 0===r?void 0:r.page),p=(null===(l=s.pagination)||void 0===l?void 0:l.pageSize)===(null===(o=n.pagination)||void 0===o?void 0:o.pageSize);return u&&p&&delete s.pagination,s}))})));export{o as default};
|
|
1
|
+
import{createClass as e,classCallCheck as t,defineProperty as i,objectSpread2 as a}from"../_virtual/_rollupPluginBabelHelpers.js";import{deepRemoveEmptyFields as r}from"../utils/helpers.js";import"../utils/dayjs-config.js";import"react/jsx-runtime";import"react";import"react-router-dom";import{QueryParam as l}from"../utils/query-param.js";var o=new(e((function e(){var o=this;t(this,e),i(this,"getUrlQuery",(function(e){try{var t=l.Gets("table");return t.table?JSON.parse(t.table):null==e?void 0:e.defaultFilter}catch(t){return null==e?void 0:e.defaultFilter}})),i(this,"setUrlQuery",(function(e,t){var i=o.extractFilter(e,t),a=r(i);if(0===Object.keys(a).length)return l.ReplaceDeletes("table");l.ReplacePatch({table:JSON.stringify(a)})})),i(this,"extractFilter",(function(e,t){var i,r,l,o,n=(null==t?void 0:t.defaultFilter)||{},s=a({},e);delete s.details,delete s.loading;var u=(null===(i=s.pagination)||void 0===i?void 0:i.page)===(null===(r=n.pagination)||void 0===r?void 0:r.page),p=(null===(l=s.pagination)||void 0===l?void 0:l.pageSize)===(null===(o=n.pagination)||void 0===o?void 0:o.pageSize);return u&&p&&delete s.pagination,s}))})));export{o as default};
|
|
2
2
|
//# sourceMappingURL=url-query-param.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url-query-param.js","sources":["../../src/table-grid/url-query-param.ts"],"sourcesContent":["import { ITableGridFilter } from './types'\r\nimport { deepRemoveEmptyFields, QueryParam } from '../utils'\r\n\r\nexport interface ITableGridQueryParams {\r\n table?: string\r\n}\r\n\r\nexport interface IUrlQueryParamOptions<T> {\r\n defaultFilter?: ITableGridFilter<T>\r\n}\r\n\r\nclass UrlQueryParamBase {\r\n getUrlQuery = <T>(options?: IUrlQueryParamOptions<T>) => {\r\n try {\r\n const query = QueryParam.Gets<ITableGridQueryParams>('table')\r\n return query.table ? JSON.parse(query.table) : options?.defaultFilter\r\n } catch (error) {\r\n return options?.defaultFilter\r\n }\r\n }\r\n\r\n setUrlQuery = <T>(params: ITableGridFilter<T>, options?: IUrlQueryParamOptions<T>) => {\r\n const filter = this.extractFilter(params, options)\r\n const filterRemovedEmpty = deepRemoveEmptyFields(filter)\r\n\r\n if (Object.keys(filterRemovedEmpty).length === 0) {\r\n return QueryParam.ReplaceDeletes<ITableGridQueryParams>('table')\r\n }\r\n QueryParam.ReplacePatch<ITableGridQueryParams>({ table: JSON.stringify(filterRemovedEmpty) })\r\n }\r\n\r\n extractFilter = <T>(filter: ITableGridFilter<T>, options?: IUrlQueryParamOptions<T>): ITableGridFilter<T> => {\r\n const dFilter: Partial<ITableGridFilter<T>> = options?.defaultFilter || {}\r\n const obj = { ...filter }\r\n delete obj.details\r\n\r\n const checkPagination1 = obj.pagination?.page === dFilter.pagination?.page\r\n const checkPagination2 = obj.pagination?.pageSize === dFilter.pagination?.pageSize\r\n if (checkPagination1 && checkPagination2) delete obj.pagination\r\n\r\n return obj\r\n }\r\n}\r\n\r\nconst UrlQueryParam = new UrlQueryParamBase()\r\nexport default UrlQueryParam\r\n"],"names":["UrlQueryParam","_createClass","UrlQueryParamBase","_this","this","_classCallCheck","_defineProperty","options","query","QueryParam","Gets","table","JSON","parse","defaultFilter","error","params","filter","extractFilter","filterRemovedEmpty","deepRemoveEmptyFields","Object","keys","length","ReplaceDeletes","ReplacePatch","stringify","_obj$pagination","_dFilter$pagination","_obj$pagination2","_dFilter$pagination2","dFilter","obj","_objectSpread","details","checkPagination1","pagination","page","checkPagination2","pageSize"],"mappings":"qVAC4D,
|
|
1
|
+
{"version":3,"file":"url-query-param.js","sources":["../../src/table-grid/url-query-param.ts"],"sourcesContent":["import { ITableGridFilter } from './types'\r\nimport { deepRemoveEmptyFields, QueryParam } from '../utils'\r\n\r\nexport interface ITableGridQueryParams {\r\n table?: string\r\n}\r\n\r\nexport interface IUrlQueryParamOptions<T> {\r\n defaultFilter?: ITableGridFilter<T>\r\n}\r\n\r\nclass UrlQueryParamBase {\r\n getUrlQuery = <T>(options?: IUrlQueryParamOptions<T>) => {\r\n try {\r\n const query = QueryParam.Gets<ITableGridQueryParams>('table')\r\n return query.table ? JSON.parse(query.table) : options?.defaultFilter\r\n } catch (error) {\r\n return options?.defaultFilter\r\n }\r\n }\r\n\r\n setUrlQuery = <T>(params: ITableGridFilter<T>, options?: IUrlQueryParamOptions<T>) => {\r\n const filter = this.extractFilter(params, options)\r\n const filterRemovedEmpty = deepRemoveEmptyFields(filter)\r\n\r\n if (Object.keys(filterRemovedEmpty).length === 0) {\r\n return QueryParam.ReplaceDeletes<ITableGridQueryParams>('table')\r\n }\r\n QueryParam.ReplacePatch<ITableGridQueryParams>({ table: JSON.stringify(filterRemovedEmpty) })\r\n }\r\n\r\n extractFilter = <T>(filter: ITableGridFilter<T>, options?: IUrlQueryParamOptions<T>): ITableGridFilter<T> => {\r\n const dFilter: Partial<ITableGridFilter<T>> = options?.defaultFilter || {}\r\n const obj = { ...filter }\r\n delete obj.details\r\n delete obj.loading\r\n\r\n const checkPagination1 = obj.pagination?.page === dFilter.pagination?.page\r\n const checkPagination2 = obj.pagination?.pageSize === dFilter.pagination?.pageSize\r\n if (checkPagination1 && checkPagination2) delete obj.pagination\r\n\r\n return obj\r\n }\r\n}\r\n\r\nconst UrlQueryParam = new UrlQueryParamBase()\r\nexport default UrlQueryParam\r\n"],"names":["UrlQueryParam","_createClass","UrlQueryParamBase","_this","this","_classCallCheck","_defineProperty","options","query","QueryParam","Gets","table","JSON","parse","defaultFilter","error","params","filter","extractFilter","filterRemovedEmpty","deepRemoveEmptyFields","Object","keys","length","ReplaceDeletes","ReplacePatch","stringify","_obj$pagination","_dFilter$pagination","_obj$pagination2","_dFilter$pagination2","dFilter","obj","_objectSpread","details","loading","checkPagination1","pagination","page","checkPagination2","pageSize"],"mappings":"qVAC4D,IA4CtDA,EAAgB,IAlCCC,GAAA,SAAAC,IAAA,IAAAC,EAAAC,KAAAC,OAAAH,GAAAI,EAAAF,KAAA,eACP,SAAIG,GAChB,IACE,IAAMC,EAAQC,EAAWC,KAA4B,SACrD,OAAOF,EAAMG,MAAQC,KAAKC,MAAML,EAAMG,OAASJ,aAAAA,EAAAA,EAASO,aACzD,CAAC,MAAOC,GACP,OAAOR,aAAAA,EAAAA,EAASO,aACjB,KACFR,EAEaF,KAAA,eAAA,SAAIY,EAA6BT,GAC7C,IAAMU,EAASd,EAAKe,cAAcF,EAAQT,GACpCY,EAAqBC,EAAsBH,GAEjD,GAA+C,IAA3CI,OAAOC,KAAKH,GAAoBI,OAClC,OAAOd,EAAWe,eAAsC,SAE1Df,EAAWgB,aAAoC,CAAEd,MAAOC,KAAKc,UAAUP,QACxEb,EAEeF,KAAA,iBAAA,SAAIa,EAA6BV,GAA2D,IAAAoB,EAAAC,EAAAC,EAAAC,EACpGC,GAAwCxB,aAAAA,EAAAA,EAASO,gBAAiB,CAAE,EACpEkB,EAAGC,EAAA,CAAA,EAAQhB,UACVe,EAAIE,eACJF,EAAIG,QAEX,IAAMC,GAAiCT,QAAdA,EAAAK,EAAIK,kBAAJV,IAAcA,OAAdA,EAAAA,EAAgBW,SAA2B,QAAvBV,EAAKG,EAAQM,kBAAU,IAAAT,OAAA,EAAlBA,EAAoBU,MAChEC,GAAiCV,QAAdA,EAAAG,EAAIK,kBAAJR,IAAcA,OAAdA,EAAAA,EAAgBW,aAA+B,QAAvBV,EAAKC,EAAQM,kBAAU,IAAAP,OAAA,EAAlBA,EAAoBU,UAG1E,OAFIJ,GAAoBG,UAAyBP,EAAIK,WAE9CL,IACR"}
|