1 line
16 KiB
JSON
1 line
16 KiB
JSON
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport KEYCODE from \"rc-util/es/KeyCode\";\nimport React from 'react';\nvar defaultPageSizeOptions = ['10', '20', '50', '100'];\nvar Options = function Options(props) {\n var _props$pageSizeOption = props.pageSizeOptions,\n pageSizeOptions = _props$pageSizeOption === void 0 ? defaultPageSizeOptions : _props$pageSizeOption,\n locale = props.locale,\n changeSize = props.changeSize,\n pageSize = props.pageSize,\n goButton = props.goButton,\n quickGo = props.quickGo,\n rootPrefixCls = props.rootPrefixCls,\n Select = props.selectComponentClass,\n selectPrefixCls = props.selectPrefixCls,\n disabled = props.disabled,\n buildOptionText = props.buildOptionText;\n var _React$useState = React.useState(''),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n goInputText = _React$useState2[0],\n setGoInputText = _React$useState2[1];\n var getValidValue = function getValidValue() {\n return !goInputText || Number.isNaN(goInputText) ? undefined : Number(goInputText);\n };\n var mergeBuildOptionText = typeof buildOptionText === 'function' ? buildOptionText : function (value) {\n return \"\".concat(value, \" \").concat(locale.items_per_page);\n };\n var changeSizeHandle = function changeSizeHandle(value) {\n changeSize === null || changeSize === void 0 || changeSize(Number(value));\n };\n var handleChange = function handleChange(e) {\n setGoInputText(e.target.value);\n };\n var handleBlur = function handleBlur(e) {\n if (goButton || goInputText === '') {\n return;\n }\n setGoInputText('');\n if (e.relatedTarget && (e.relatedTarget.className.indexOf(\"\".concat(rootPrefixCls, \"-item-link\")) >= 0 || e.relatedTarget.className.indexOf(\"\".concat(rootPrefixCls, \"-item\")) >= 0)) {\n return;\n }\n quickGo === null || quickGo === void 0 || quickGo(getValidValue());\n };\n var go = function go(e) {\n if (goInputText === '') {\n return;\n }\n if (e.keyCode === KEYCODE.ENTER || e.type === 'click') {\n setGoInputText('');\n quickGo === null || quickGo === void 0 || quickGo(getValidValue());\n }\n };\n var getPageSizeOptions = function getPageSizeOptions() {\n if (pageSizeOptions.some(function (option) {\n return option.toString() === pageSize.toString();\n })) {\n return pageSizeOptions;\n }\n return pageSizeOptions.concat([pageSize.toString()]).sort(function (a, b) {\n var numberA = Number.isNaN(Number(a)) ? 0 : Number(a);\n var numberB = Number.isNaN(Number(b)) ? 0 : Number(b);\n return numberA - numberB;\n });\n };\n // ============== cls ==============\n var prefixCls = \"\".concat(rootPrefixCls, \"-options\");\n\n // ============== render ==============\n\n if (!changeSize && !quickGo) {\n return null;\n }\n var changeSelect = null;\n var goInput = null;\n var gotoButton = null;\n if (changeSize && Select) {\n var options = getPageSizeOptions().map(function (opt, i) {\n return /*#__PURE__*/React.createElement(Select.Option, {\n key: i,\n value: opt.toString()\n }, mergeBuildOptionText(opt));\n });\n changeSelect = /*#__PURE__*/React.createElement(Select, {\n disabled: disabled,\n prefixCls: selectPrefixCls,\n showSearch: false,\n className: \"\".concat(prefixCls, \"-size-changer\"),\n optionLabelProp: \"children\",\n popupMatchSelectWidth: false,\n value: (pageSize || pageSizeOptions[0]).toString(),\n onChange: changeSizeHandle,\n getPopupContainer: function getPopupContainer(triggerNode) {\n return triggerNode.parentNode;\n },\n \"aria-label\": locale.page_size,\n defaultOpen: false\n }, options);\n }\n if (quickGo) {\n if (goButton) {\n gotoButton = typeof goButton === 'boolean' ? /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n onClick: go,\n onKeyUp: go,\n disabled: disabled,\n className: \"\".concat(prefixCls, \"-quick-jumper-button\")\n }, locale.jump_to_confirm) : /*#__PURE__*/React.createElement(\"span\", {\n onClick: go,\n onKeyUp: go\n }, goButton);\n }\n goInput = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-quick-jumper\")\n }, locale.jump_to, /*#__PURE__*/React.createElement(\"input\", {\n disabled: disabled,\n type: \"text\",\n value: goInputText,\n onChange: handleChange,\n onKeyUp: go,\n onBlur: handleBlur,\n \"aria-label\": locale.page\n }), locale.page, gotoButton);\n }\n return /*#__PURE__*/React.createElement(\"li\", {\n className: prefixCls\n }, changeSelect, goInput);\n};\nif (process.env.NODE_ENV !== 'production') {\n Options.displayName = 'Options';\n}\nexport default Options;","map":{"version":3,"names":["_slicedToArray","KEYCODE","React","defaultPageSizeOptions","Options","props","_props$pageSizeOption","pageSizeOptions","locale","changeSize","pageSize","goButton","quickGo","rootPrefixCls","Select","selectComponentClass","selectPrefixCls","disabled","buildOptionText","_React$useState","useState","_React$useState2","goInputText","setGoInputText","getValidValue","Number","isNaN","undefined","mergeBuildOptionText","value","concat","items_per_page","changeSizeHandle","handleChange","e","target","handleBlur","relatedTarget","className","indexOf","go","keyCode","ENTER","type","getPageSizeOptions","some","option","toString","sort","a","b","numberA","numberB","prefixCls","changeSelect","goInput","gotoButton","options","map","opt","i","createElement","Option","key","showSearch","optionLabelProp","popupMatchSelectWidth","onChange","getPopupContainer","triggerNode","parentNode","page_size","defaultOpen","onClick","onKeyUp","jump_to_confirm","jump_to","onBlur","page","process","env","NODE_ENV","displayName"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-pagination/es/Options.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport KEYCODE from \"rc-util/es/KeyCode\";\nimport React from 'react';\nvar defaultPageSizeOptions = ['10', '20', '50', '100'];\nvar Options = function Options(props) {\n var _props$pageSizeOption = props.pageSizeOptions,\n pageSizeOptions = _props$pageSizeOption === void 0 ? defaultPageSizeOptions : _props$pageSizeOption,\n locale = props.locale,\n changeSize = props.changeSize,\n pageSize = props.pageSize,\n goButton = props.goButton,\n quickGo = props.quickGo,\n rootPrefixCls = props.rootPrefixCls,\n Select = props.selectComponentClass,\n selectPrefixCls = props.selectPrefixCls,\n disabled = props.disabled,\n buildOptionText = props.buildOptionText;\n var _React$useState = React.useState(''),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n goInputText = _React$useState2[0],\n setGoInputText = _React$useState2[1];\n var getValidValue = function getValidValue() {\n return !goInputText || Number.isNaN(goInputText) ? undefined : Number(goInputText);\n };\n var mergeBuildOptionText = typeof buildOptionText === 'function' ? buildOptionText : function (value) {\n return \"\".concat(value, \" \").concat(locale.items_per_page);\n };\n var changeSizeHandle = function changeSizeHandle(value) {\n changeSize === null || changeSize === void 0 || changeSize(Number(value));\n };\n var handleChange = function handleChange(e) {\n setGoInputText(e.target.value);\n };\n var handleBlur = function handleBlur(e) {\n if (goButton || goInputText === '') {\n return;\n }\n setGoInputText('');\n if (e.relatedTarget && (e.relatedTarget.className.indexOf(\"\".concat(rootPrefixCls, \"-item-link\")) >= 0 || e.relatedTarget.className.indexOf(\"\".concat(rootPrefixCls, \"-item\")) >= 0)) {\n return;\n }\n quickGo === null || quickGo === void 0 || quickGo(getValidValue());\n };\n var go = function go(e) {\n if (goInputText === '') {\n return;\n }\n if (e.keyCode === KEYCODE.ENTER || e.type === 'click') {\n setGoInputText('');\n quickGo === null || quickGo === void 0 || quickGo(getValidValue());\n }\n };\n var getPageSizeOptions = function getPageSizeOptions() {\n if (pageSizeOptions.some(function (option) {\n return option.toString() === pageSize.toString();\n })) {\n return pageSizeOptions;\n }\n return pageSizeOptions.concat([pageSize.toString()]).sort(function (a, b) {\n var numberA = Number.isNaN(Number(a)) ? 0 : Number(a);\n var numberB = Number.isNaN(Number(b)) ? 0 : Number(b);\n return numberA - numberB;\n });\n };\n // ============== cls ==============\n var prefixCls = \"\".concat(rootPrefixCls, \"-options\");\n\n // ============== render ==============\n\n if (!changeSize && !quickGo) {\n return null;\n }\n var changeSelect = null;\n var goInput = null;\n var gotoButton = null;\n if (changeSize && Select) {\n var options = getPageSizeOptions().map(function (opt, i) {\n return /*#__PURE__*/React.createElement(Select.Option, {\n key: i,\n value: opt.toString()\n }, mergeBuildOptionText(opt));\n });\n changeSelect = /*#__PURE__*/React.createElement(Select, {\n disabled: disabled,\n prefixCls: selectPrefixCls,\n showSearch: false,\n className: \"\".concat(prefixCls, \"-size-changer\"),\n optionLabelProp: \"children\",\n popupMatchSelectWidth: false,\n value: (pageSize || pageSizeOptions[0]).toString(),\n onChange: changeSizeHandle,\n getPopupContainer: function getPopupContainer(triggerNode) {\n return triggerNode.parentNode;\n },\n \"aria-label\": locale.page_size,\n defaultOpen: false\n }, options);\n }\n if (quickGo) {\n if (goButton) {\n gotoButton = typeof goButton === 'boolean' ? /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n onClick: go,\n onKeyUp: go,\n disabled: disabled,\n className: \"\".concat(prefixCls, \"-quick-jumper-button\")\n }, locale.jump_to_confirm) : /*#__PURE__*/React.createElement(\"span\", {\n onClick: go,\n onKeyUp: go\n }, goButton);\n }\n goInput = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-quick-jumper\")\n }, locale.jump_to, /*#__PURE__*/React.createElement(\"input\", {\n disabled: disabled,\n type: \"text\",\n value: goInputText,\n onChange: handleChange,\n onKeyUp: go,\n onBlur: handleBlur,\n \"aria-label\": locale.page\n }), locale.page, gotoButton);\n }\n return /*#__PURE__*/React.createElement(\"li\", {\n className: prefixCls\n }, changeSelect, goInput);\n};\nif (process.env.NODE_ENV !== 'production') {\n Options.displayName = 'Options';\n}\nexport default Options;"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,OAAO,MAAM,oBAAoB;AACxC,OAAOC,KAAK,MAAM,OAAO;AACzB,IAAIC,sBAAsB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC;AACtD,IAAIC,OAAO,GAAG,SAASA,OAAOA,CAACC,KAAK,EAAE;EACpC,IAAIC,qBAAqB,GAAGD,KAAK,CAACE,eAAe;IAC/CA,eAAe,GAAGD,qBAAqB,KAAK,KAAK,CAAC,GAAGH,sBAAsB,GAAGG,qBAAqB;IACnGE,MAAM,GAAGH,KAAK,CAACG,MAAM;IACrBC,UAAU,GAAGJ,KAAK,CAACI,UAAU;IAC7BC,QAAQ,GAAGL,KAAK,CAACK,QAAQ;IACzBC,QAAQ,GA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