1 line
9.3 KiB
JSON
1 line
9.3 KiB
JSON
{"ast":null,"code":"var __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { useState } from 'react';\nimport extendsObject from '../../_util/extendsObject';\nexport const DEFAULT_PAGE_SIZE = 10;\nexport function getPaginationParam(mergedPagination, pagination) {\n const param = {\n current: mergedPagination.current,\n pageSize: mergedPagination.pageSize\n };\n const paginationObj = pagination && typeof pagination === 'object' ? pagination : {};\n Object.keys(paginationObj).forEach(pageProp => {\n const value = mergedPagination[pageProp];\n if (typeof value !== 'function') {\n param[pageProp] = value;\n }\n });\n return param;\n}\nfunction usePagination(total, onChange, pagination) {\n const _a = pagination && typeof pagination === 'object' ? pagination : {},\n {\n total: paginationTotal = 0\n } = _a,\n paginationObj = __rest(_a, [\"total\"]);\n const [innerPagination, setInnerPagination] = useState(() => ({\n current: 'defaultCurrent' in paginationObj ? paginationObj.defaultCurrent : 1,\n pageSize: 'defaultPageSize' in paginationObj ? paginationObj.defaultPageSize : DEFAULT_PAGE_SIZE\n }));\n // ============ Basic Pagination Config ============\n const mergedPagination = extendsObject(innerPagination, paginationObj, {\n total: paginationTotal > 0 ? paginationTotal : total\n });\n // Reset `current` if data length or pageSize changed\n const maxPage = Math.ceil((paginationTotal || total) / mergedPagination.pageSize);\n if (mergedPagination.current > maxPage) {\n // Prevent a maximum page count of 0\n mergedPagination.current = maxPage || 1;\n }\n const refreshPagination = (current, pageSize) => {\n setInnerPagination({\n current: current !== null && current !== void 0 ? current : 1,\n pageSize: pageSize || mergedPagination.pageSize\n });\n };\n const onInternalChange = (current, pageSize) => {\n var _a;\n if (pagination) {\n (_a = pagination.onChange) === null || _a === void 0 ? void 0 : _a.call(pagination, current, pageSize);\n }\n refreshPagination(current, pageSize);\n onChange(current, pageSize || (mergedPagination === null || mergedPagination === void 0 ? void 0 : mergedPagination.pageSize));\n };\n if (pagination === false) {\n return [{}, () => {}];\n }\n return [Object.assign(Object.assign({}, mergedPagination), {\n onChange: onInternalChange\n }), refreshPagination];\n}\nexport default usePagination;","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","useState","extendsObject","DEFAULT_PAGE_SIZE","getPaginationParam","mergedPagination","pagination","param","current","pageSize","paginationObj","keys","forEach","pageProp","value","usePagination","total","onChange","_a","paginationTotal","innerPagination","setInnerPagination","defaultCurrent","defaultPageSize","maxPage","Math","ceil","refreshPagination","onInternalChange","assign"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/table/hooks/usePagination.js"],"sourcesContent":["var __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { useState } from 'react';\nimport extendsObject from '../../_util/extendsObject';\nexport const DEFAULT_PAGE_SIZE = 10;\nexport function getPaginationParam(mergedPagination, pagination) {\n const param = {\n current: mergedPagination.current,\n pageSize: mergedPagination.pageSize\n };\n const paginationObj = pagination && typeof pagination === 'object' ? pagination : {};\n Object.keys(paginationObj).forEach(pageProp => {\n const value = mergedPagination[pageProp];\n if (typeof value !== 'function') {\n param[pageProp] = value;\n }\n });\n return param;\n}\nfunction usePagination(total, onChange, pagination) {\n const _a = pagination && typeof pagination === 'object' ? pagination : {},\n {\n total: paginationTotal = 0\n } = _a,\n paginationObj = __rest(_a, [\"total\"]);\n const [innerPagination, setInnerPagination] = useState(() => ({\n current: 'defaultCurrent' in paginationObj ? paginationObj.defaultCurrent : 1,\n pageSize: 'defaultPageSize' in paginationObj ? paginationObj.defaultPageSize : DEFAULT_PAGE_SIZE\n }));\n // ============ Basic Pagination Config ============\n const mergedPagination = extendsObject(innerPagination, paginationObj, {\n total: paginationTotal > 0 ? paginationTotal : total\n });\n // Reset `current` if data length or pageSize changed\n const maxPage = Math.ceil((paginationTotal || total) / mergedPagination.pageSize);\n if (mergedPagination.current > maxPage) {\n // Prevent a maximum page count of 0\n mergedPagination.current = maxPage || 1;\n }\n const refreshPagination = (current, pageSize) => {\n setInnerPagination({\n current: current !== null && current !== void 0 ? current : 1,\n pageSize: pageSize || mergedPagination.pageSize\n });\n };\n const onInternalChange = (current, pageSize) => {\n var _a;\n if (pagination) {\n (_a = pagination.onChange) === null || _a === void 0 ? void 0 : _a.call(pagination, current, pageSize);\n }\n refreshPagination(current, pageSize);\n onChange(current, pageSize || (mergedPagination === null || mergedPagination === void 0 ? void 0 : mergedPagination.pageSize));\n };\n if (pagination === false) {\n return [{}, () => {}];\n }\n return [Object.assign(Object.assign({}, mergedPagination), {\n onChange: onInternalChange\n }), refreshPagination];\n}\nexport default usePagination;"],"mappings":"AAAA,IAAIA,MAAM,GAAG,IAAI,IAAI,IAAI,CAACA,MAAM,IAAI,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAAED,CAAC,CAACC,CAAC,CAAC,GAAGH,CAAC,CAACG,CAAC,CAAC;EAChG,IAAIH,CAAC,IAAI,IAAI,IAAI,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