UNPKG

epn-ui

Version:

Дизайн система кабинета ВМ

768 lines (723 loc) 123 kB
'use strict'; var React = require('react'); var clsx = require('clsx'); var Button$2 = require('antd/lib/button'); var reactFontawesome = require('@fortawesome/react-fontawesome'); var faCopy = require('@fortawesome/pro-regular-svg-icons/faCopy'); var Input = require('antd/lib/input'); var InputMask = require('antd-mask-input'); var faEye = require('@fortawesome/pro-regular-svg-icons/faEye'); var faEyeSlash = require('@fortawesome/pro-regular-svg-icons/faEyeSlash'); var faAngleLeft = require('@fortawesome/pro-regular-svg-icons/faAngleLeft'); var faAngleRight = require('@fortawesome/pro-regular-svg-icons/faAngleRight'); var debounce = require('lodash/debounce'); var Spin = require('antd/lib/spin'); var Modal = require('antd/lib/modal'); var Select = require('antd/lib/select'); var faChevronDown = require('@fortawesome/pro-regular-svg-icons/faChevronDown'); var faCheck = require('@fortawesome/pro-regular-svg-icons/faCheck'); var faStar$1 = require('@fortawesome/pro-light-svg-icons/faStar'); var faStar = require('@fortawesome/pro-solid-svg-icons/faStar'); var dayjs = require('dayjs'); var Empty$1 = require('antd/lib/empty'); var templite = require('templite'); var TreeSelectAnt = require('antd/lib/tree-select'); var faTimes = require('@fortawesome/pro-regular-svg-icons/faTimes'); var Switch$1 = require('antd/lib/switch'); var Collapse = require('antd/lib/collapse'); var faChevronDown$1 = require('@fortawesome/pro-light-svg-icons/faChevronDown'); var Upload = require('antd/lib/upload'); var faPaperclip = require('@fortawesome/pro-light-svg-icons/faPaperclip'); var faSpinnerThird = require('@fortawesome/pro-light-svg-icons/faSpinnerThird'); var faTimes$1 = require('@fortawesome/pro-light-svg-icons/faTimes'); var List = require('antd/lib/list'); var Form = require('antd/lib/form'); var Rate = require('antd/lib/rate'); var faStar$2 = require('@fortawesome/pro-regular-svg-icons/faStar'); var antd = require('antd'); var weekday = require('dayjs/plugin/weekday'); var localeData = require('dayjs/plugin/localeData'); var Alert = require('antd/lib/alert'); var CheckboxAnt = require('antd/lib/checkbox'); var RadioAnt = require('antd/lib/radio'); var Space$1 = require('antd/lib/space'); var faEllipsisH = require('@fortawesome/pro-regular-svg-icons/faEllipsisH'); var Tabs = require('antd/lib/tabs'); var sortBy = require('lodash/sortBy'); var keyBy = require('lodash/keyBy'); var Table = require('antd/lib/table'); var isString = require('lodash/isString'); var Divider = require('antd/lib/divider'); var exportToCsv = require('export-to-csv'); var get = require('lodash/get'); var ReactDOMServer = require('react-dom/server'); var enDayjs = require('dayjs/locale/en'); var ruDayjs = require('dayjs/locale/ru'); var ScrollContainer = require('react-indiana-drag-scroll'); var faFileDownload = require('@fortawesome/pro-regular-svg-icons/faFileDownload'); var Dropdown = require('antd/lib/dropdown'); var Tooltip = require('antd/lib/tooltip'); var core = require('@dnd-kit/core'); var sortable = require('@dnd-kit/sortable'); var modifiers = require('@dnd-kit/modifiers'); var faSortAlt = require('@fortawesome/pro-regular-svg-icons/faSortAlt'); var faBars = require('@fortawesome/pro-regular-svg-icons/faBars'); var utilities = require('@dnd-kit/utilities'); var faCog = require('@fortawesome/pro-regular-svg-icons/faCog'); var faArrowsH = require('@fortawesome/pro-regular-svg-icons/faArrowsH'); var faLineHeight = require('@fortawesome/pro-regular-svg-icons/faLineHeight'); var faBorderNone = require('@fortawesome/pro-regular-svg-icons/faBorderNone'); var faDownload = require('@fortawesome/pro-regular-svg-icons/faDownload'); var faQuestionCircle = require('@fortawesome/pro-regular-svg-icons/faQuestionCircle'); var Avatar = require('antd/lib/avatar'); var Badge = require('antd/lib/badge'); var Row = require('antd/lib/grid/row'); var ColAnt = require('antd/lib/grid/col'); var AntLayout = require('antd/lib/layout'); var TreeAnt = require('antd/lib/tree/index'); var AntMenu = require('antd/lib/menu'); var AntSkeleton = require('antd/lib/skeleton'); var ruLocale$1 = require('antd/lib/locale/ru_RU'); var enLocale$1 = require('antd/lib/locale/en_GB'); var Confirm$1 = "Подтвердить"; var Save$1 = "Сохранить"; var Clear$1 = "Очистить"; var Ok$1 = "Ок"; var Small$1 = "Маленький"; var Middle$1 = "Средний"; var Large$1 = "Большой"; var Formatted$1 = "Форматированный"; var Raw$1 = "Сырой"; var Total$1 = "Всего"; var Borders$1 = "Границы"; var ruLocale = { "Re-call again": "Повторный вызов", "Send SMS": "Отправить СМС", Confirm: Confirm$1, Save: Save$1, Clear: Clear$1, Ok: Ok$1, Small: Small$1, Middle: Middle$1, Large: Large$1, Formatted: Formatted$1, Raw: Raw$1, "Can be re-requested in": "Может быть запрошен повторно через", "Nothing found": "Ничего не найдено", "You have hidden all columns of this table.": "Вы скрыли все колонки данной таблицы.", "To display the data again, please turn on the columns you need.": "Чтобы отобразить данные вновь, пожалуйста, включите нужные вам колонки.", Total: Total$1, "Personalize table": "Персонализировать таблицу", "Without title": "Без названия", "Save table data to file": "Сохранить таблицу в файл", "Changes was saved": "Изменения сохранены", "Native table scroll": "Нативная прокрутка таблицы", "Disabling this option will allow you to horizontally move around the table by dragging.": "Отключение данной опции позволит горизонтально перемещаться по таблице перетаскиванием.", "Table size": "Размер таблицы", "Resizing affects padding within the table.": "Изменение размера влияет на отступы внутри таблицы.", Borders: Borders$1, "Display table borders, cells and columns.": "Отображение границ таблицы, ячеек и столбцов.", "Export data format": "Формат экспорта", "The data will be uploaded to the file as presented on the website.": "В файл будут выгружены данные в том виде в котором представлены на сайте.", "You will get the maximum amount of data, but in a «raw» form.": "Вы получите максимальное кол-во данных, но в «сыром» виде.", "Customize table": "Настроить таблицу", "Reload page": "Перезагрузить страницу", "Settings was saved": "Настройки сохранены", "Failed to save settings": "Не удалось сохранить настройки", "No data to export": "Нет данных для экспорта", "An error occurred while saving data": "При сохранении данных произошла ошибка" }; var Confirm = "Confirm"; var Save = "Save"; var Clear = "Clear"; var Ok = "Ok"; var Small = "Small"; var Middle = "Middle"; var Large = "Large"; var Formatted = "Formatted"; var Raw = "Raw"; var Total = "Total"; var Borders = "Borders"; var enLocale = { "Re-call again": "Re-call again", "Send SMS": "Send SMS", Confirm: Confirm, Save: Save, Clear: Clear, Ok: Ok, Small: Small, Middle: Middle, Large: Large, Formatted: Formatted, Raw: Raw, "Can be re-requested in": "Can be re-requested in", "Nothing found": "Nothing found", "You have hidden all columns of this table.": "You have hidden all columns of this table.", "To display the data again, please turn on the columns you need.": "To display the data again, please turn on the columns you need.", Total: Total, "Personalize table": "Personalize table", "Without title": "Без названия", "Save table data to file": "Save table data to file", "Changes was saved": "Changes was saved", "Native table scroll": "Native table scroll", "Disabling this option will allow you to horizontally move around the table by dragging.": "Disabling this option will allow you to horizontally move around the table by dragging.", "Table size": "Table size", "Resizing affects padding within the table.": "Resizing affects padding within the table.", Borders: Borders, "Display table borders, cells and columns.": "Display table borders, cells and columns.", "Export data format": "Export data", "The data will be uploaded to the file as presented on the website.": "The data will be uploaded to the file as presented on the website.", "You will get the maximum amount of data, but in a «raw» form.": "You will get the maximum amount of data, but in a «raw» form.", "Customize table": "Customize table", "Reload page": "Reload page", "Settings was saved": "Settings was saved", "Failed to save settings": "Failed to save settings", "No data to export": "No data to export", "An error occurred while saving data": "An error occurred while saving data" }; var translationObj = { en: enLocale, ru: ruLocale, }; var LOCALE_TYPES = { ru: 'ru', en: 'en', }; function useI18n() { var _a = React.useState(LOCALE_TYPES.ru), locale = _a[0], setLocale = _a[1]; var changeLanguage = function (language) { return setLocale(language); }; var t = function (key) { var _a; if (typeof locale !== 'string') { return key; } var translation = (_a = translationObj[locale]) === null || _a === void 0 ? void 0 : _a[key]; if (!translation) return key; return templite(translation, {}); }; return { t: t, changeLanguage: changeLanguage, }; } /****************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __spreadArray(to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); } typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { var e = new Error(message); return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; }; var BaseButton = function (_a) { var id = _a.id, className = _a.className, style = _a.style, type = _a.type, shape = _a.shape, size = _a.size, htmlType = _a.htmlType, disabled = _a.disabled, loading = _a.loading, href = _a.href, target = _a.target, block = _a.block, icon = _a.icon, children = _a.children, onClick = _a.onClick, rest = __rest(_a, ["id", "className", "style", "type", "shape", "size", "htmlType", "disabled", "loading", "href", "target", "block", "icon", "children", "onClick"]); return (React.createElement(Button$2, __assign({ type: type, shape: shape, icon: icon, id: id, style: style, className: clsx('epn-btn', className), size: size, htmlType: htmlType, disabled: disabled, block: block, href: href, target: target, loading: loading, onClick: onClick }, rest), children)); }; var Button$1 = BaseButton; var TextArea = Input.TextArea; var InputTextArea = function (_a) { var className = _a.className, autoSize = _a.autoSize, defaultValue = _a.defaultValue, maxLength = _a.maxLength, showCount = _a.showCount, value = _a.value, placeholder = _a.placeholder, id = _a.id, disabled = _a.disabled, readOnly = _a.readOnly, prefix = _a.prefix, onPressEnter = _a.onPressEnter, onResize = _a.onResize, onChange = _a.onChange; return (React.createElement(TextArea, { id: id, className: clsx('epn-inputText', className), readOnly: readOnly, disabled: disabled, placeholder: placeholder, autoSize: autoSize, defaultValue: defaultValue, value: value, maxLength: maxLength, showCount: showCount, prefix: prefix, onPressEnter: onPressEnter, onResize: onResize, onChange: onChange })); }; var Password = Input.Password; var InputTextPassword = function (_a) { var className = _a.className, id = _a.id, defaultValue = _a.defaultValue, maxLength = _a.maxLength, showCount = _a.showCount, value = _a.value, placeholder = _a.placeholder, disabled = _a.disabled, prefix = _a.prefix, onPressEnter = _a.onPressEnter, onChange = _a.onChange; return (React.createElement(Password, { id: id, className: clsx('epn-inputText', className), defaultValue: defaultValue, maxLength: maxLength, showCount: showCount, value: value, placeholder: placeholder, disabled: disabled, prefix: prefix, iconRender: function (visible) { return visible ? React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faEye.faEye }) : React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faEyeSlash.faEyeSlash }); }, onPressEnter: onPressEnter, onChange: onChange })); }; function TextInput(_a) { var className = _a.className, style = _a.style, placeholder = _a.placeholder, id = _a.id, maxLength = _a.maxLength, type = _a.type, value = _a.value, prefix = _a.prefix, suffix = _a.suffix, disabled = _a.disabled, readOnly = _a.readOnly, allowClear = _a.allowClear, mask = _a.mask, maskOptions = _a.maskOptions, autoComplete = _a.autoComplete, onChange = _a.onChange, onPressEnter = _a.onPressEnter, onClick = _a.onClick, onPaste = _a.onPaste, rest = __rest(_a, ["className", "style", "placeholder", "id", "maxLength", "type", "value", "prefix", "suffix", "disabled", "readOnly", "allowClear", "mask", "maskOptions", "autoComplete", "onChange", "onPressEnter", "onClick", "onPaste"]); var commonCustomEpnProps = { id: id, style: style, allowClear: allowClear, type: type, prefix: prefix, suffix: suffix, disabled: disabled, readOnly: readOnly, className: clsx('epn-inputText', className), autoComplete: autoComplete, onChange: onChange, onPressEnter: onPressEnter, onClick: onClick, onPaste: onPaste, }; if (typeof mask !== 'undefined') { var onPasteFix = function (e) { e.preventDefault(); }; return (React.createElement(InputMask, __assign({ value: typeof value === 'string' || typeof value === 'undefined' ? value : undefined, mask: mask, maskOptions: maskOptions }, commonCustomEpnProps, rest, { onPaste: onPasteFix }))); } return (React.createElement(Input, __assign({ value: value, placeholder: placeholder, maxLength: maxLength }, commonCustomEpnProps, rest))); } TextInput.TextArea = InputTextArea; TextInput.Password = InputTextPassword; TextInput.OTP = Input.OTP; function fallbackCopyTextToClipboard(text) { var textArea = document.createElement('textarea'); textArea.value = text; document.body.appendChild(textArea); textArea.focus(); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); } function copyTextToClipboard(text) { return new Promise(function (resolve, reject) { try { if (!navigator.clipboard) { fallbackCopyTextToClipboard(text); return; } navigator.clipboard.writeText(text).then(resolve, reject); resolve(); } catch (err) { throw new Error(String(err)); } }); } var CopyInput = function (_a) { var id = _a.id, value = _a.value, className = _a.className, _b = _a.readOnly, readOnly = _b === void 0 ? true : _b, placeholder = _a.placeholder, onFailed = _a.onFailed, onCompleted = _a.onCompleted, onClick = _a.onClick, link = _a.link, onComplete = _a.onComplete; var inputValue = link || value; var onCopyHandler = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: if (!inputValue) { if (typeof onFailed === 'function') { onFailed(); } return [2]; } return [4, copyTextToClipboard(inputValue)]; case 1: _a.sent(); if (typeof onCompleted === 'function') { onCompleted(inputValue || ''); } if (typeof onComplete === 'function') { onComplete(inputValue || ''); } return [2]; } }); }); }; return (React.createElement(TextInput, { id: id || undefined, className: clsx('epn-copyinput', className), placeholder: placeholder, readOnly: readOnly, value: inputValue, onClick: onClick, suffix: React.createElement(reactFontawesome.FontAwesomeIcon, { className: "epn-copyinput--button", icon: faCopy.faCopy, onClick: onCopyHandler }) })); }; var CopyInput$1 = CopyInput; var IconButton = function (_a) { var icon = _a.icon, onClick = _a.onClick, _b = _a.disabled, disabled = _b === void 0 ? false : _b; return (React.createElement(Button$1, { type: "default", onClick: onClick, disabled: disabled, className: "epn-slider-button" }, React.createElement(reactFontawesome.FontAwesomeIcon, { icon: icon }))); }; var ITEMS_MARGIN = 24; var DEBOUNCE_VALUE = 100; var ItemsSlider = function (_a) { var title = _a.title, children = _a.children; var containerRef = React.useRef(null); var childRefs = React.useRef([]); var _b = React.useState(true), leftButtonDisabled = _b[0], setLeftButtonDisabled = _b[1]; var _c = React.useState(false), rightButtonDisabled = _c[0], setRightButtonDisabled = _c[1]; var scrollRight = function () { if (containerRef.current && childRefs.current[0]) { containerRef.current.scrollLeft += childRefs.current[0].clientWidth + ITEMS_MARGIN; } }; var scrollLeft = function () { if (containerRef.current && childRefs.current[0]) { containerRef.current.scrollLeft -= childRefs.current[0].clientWidth + ITEMS_MARGIN; } }; React.useEffect(function () { if (containerRef.current) { if (containerRef.current.offsetWidth + containerRef.current.scrollLeft === containerRef.current.scrollWidth) { setRightButtonDisabled(true); } else { setRightButtonDisabled(false); } } }, [children]); var handleScroll = debounce(function () { if (containerRef.current) { if (containerRef.current.scrollLeft === 0) { setLeftButtonDisabled(true); } else { setLeftButtonDisabled(false); } if (containerRef.current.offsetWidth + containerRef.current.scrollLeft === containerRef.current.scrollWidth) { setRightButtonDisabled(true); } else { setRightButtonDisabled(false); } } }, DEBOUNCE_VALUE); return (React.createElement("div", { className: "epn-slider" }, React.createElement("div", { className: "epn-slider__head" }, React.createElement("h2", { className: "epn-slider__title" }, title), React.createElement("div", { className: "epn-slider__buttons" }, React.createElement(IconButton, { disabled: leftButtonDisabled, icon: faAngleLeft.faAngleLeft, onClick: scrollLeft }), React.createElement(IconButton, { disabled: rightButtonDisabled, icon: faAngleRight.faAngleRight, onClick: scrollRight }))), React.createElement("div", { ref: containerRef, className: "epn-slider__body smooth hide-scrollbar", onScroll: handleScroll }, React.Children.map(children, function (child, index) { return (React.createElement("div", { ref: function (el) { childRefs.current[index] = el; }, className: "epn-slider__item" }, child)); })))); }; var BaseLoader = function (_a) { var _b = _a.className, className = _b === void 0 ? 'epn-loader__circle_red' : _b, wrapperClassName = _a.wrapperClassName, style = _a.style, delay = _a.delay, _c = _a.loading, loading = _c === void 0 ? true : _c, children = _a.children; return (React.createElement(Spin, { className: className, wrapperClassName: wrapperClassName, style: style, delay: delay, spinning: loading }, children)); }; var Loader = BaseLoader; var DIALOG_WIDTH = { lg: 770, md: 688, sm: 512, xs: 448, }; var BaseDialog = function (_a) { var style = _a.style, children = _a.children, _b = _a.size, size = _b === void 0 ? 'lg' : _b, _c = _a.footer, footer = _c === void 0 ? null : _c, props = __rest(_a, ["style", "children", "size", "footer"]); return (React.createElement(Modal, __assign({ destroyOnClose: true, centered: true, width: DIALOG_WIDTH[size], style: style, footer: footer }, props), children)); }; var Dialog = BaseDialog; var format = function (date, template) { return dayjs(new Date(date)).format(template); }; var FavouriteOption = function (_a) { var label = _a.label, value = _a.value, className = _a.className, isFavourite = _a.isFavourite, onFavToggle = _a.onFavToggle, date = _a.date; return (React.createElement("div", { className: clsx('epn-select-option epn-select-option--favorite', className) }, React.createElement("span", { className: "epn-select-option--favorite-label" }, label), React.createElement("div", { className: "epn-select-option--favorite-actions" }, React.createElement("button", { type: "button", className: clsx('epn-select-option--favorite-actionsBtn', { 'epn-select-option--favorite-btnActive': isFavourite, }), onClick: function (event) { event.stopPropagation(); onFavToggle(value, isFavourite); } }, React.createElement(reactFontawesome.FontAwesomeIcon, { icon: isFavourite ? faStar.faStar : faStar$1.faStar })), date && React.createElement("span", null, format(new Date(date), 'DD.MM.YYYY'))))); }; var BaseEmpty = function (_a) { var _b = _a.showImage, showImage = _b === void 0 ? false : _b, _c = _a.description, description = _c === void 0 ? 'Nothing found' : _c, image = _a.image, imageStyle = _a.imageStyle, className = _a.className, children = _a.children, locale = _a.locale; var _d = useI18n(), t = _d.t, changeLanguage = _d.changeLanguage; React.useEffect(function () { changeLanguage(locale); }, [locale]); return (React.createElement(Empty$1, { description: description || t('Nothing found'), image: showImage ? image : null, imageStyle: imageStyle, className: clsx('epn-empty', className, { 'epn-empty-withoutImage': !showImage, }) }, children)); }; var Empty = BaseEmpty; var toLower = function (value) { if (typeof value !== 'string') return value; return value.toLowerCase(); }; var defaultFilterOptions = function (input, option) { if (typeof (option === null || option === void 0 ? void 0 : option.value) !== 'string') return false; return (((option === null || option === void 0 ? void 0 : option.value) !== null && toLower(option === null || option === void 0 ? void 0 : option.value).includes(toLower(input))) || ((option === null || option === void 0 ? void 0 : option.label) !== null && toLower(option === null || option === void 0 ? void 0 : option.label).includes(toLower(input)))); }; var Option = Select.Option; function BaseSelect(_a) { var showSearch = _a.showSearch, options = _a.options, _b = _a.filterOption, filterOption = _b === void 0 ? defaultFilterOptions : _b, disabled = _a.disabled, defaultValue = _a.defaultValue, mode = _a.mode, value = _a.value, _c = _a.maxTagCount, maxTagCount = _c === void 0 ? 4 : _c, placeholder = _a.placeholder, customOption = _a.customOption, className = _a.className, dropdownClassName = _a.dropdownClassName, fieldNames = _a.fieldNames, optionLabelProp = _a.optionLabelProp, loading = _a.loading, notFoundContent = _a.notFoundContent, style = _a.style, _d = _a.size, size = _d === void 0 ? 'middle' : _d, defaultOpen = _a.defaultOpen, id = _a.id, status = _a.status, searchValue = _a.searchValue, placement = _a.placement, autoFocus = _a.autoFocus, allowClear = _a.allowClear, open = _a.open, tokenSeparators = _a.tokenSeparators, maxTagPlaceholder = _a.maxTagPlaceholder, getPopupContainer = _a.getPopupContainer, onInputKeyDown = _a.onInputKeyDown, onBlur = _a.onBlur, onChange = _a.onChange, onFocus = _a.onFocus, onClear = _a.onClear, onPopupScroll = _a.onPopupScroll, onSearch = _a.onSearch, onSelect = _a.onSelect; var isSearchField = Array.isArray(options) && options.length >= 7; return (React.createElement(Select, { onInputKeyDown: onInputKeyDown, onChange: onChange, onBlur: onBlur, onFocus: onFocus, onClear: onClear, onPopupScroll: onPopupScroll, onSearch: onSearch, onSelect: onSelect, style: style, className: clsx('epn-select', className), popupClassName: clsx('epn-select-dropdown', dropdownClassName), id: id, open: open, getPopupContainer: getPopupContainer, status: status, placement: placement, allowClear: allowClear, autoFocus: autoFocus, loading: loading, defaultOpen: defaultOpen, fieldNames: fieldNames, notFoundContent: notFoundContent || React.createElement(Empty, { locale: "ru" }), optionLabelProp: optionLabelProp, placeholder: placeholder, maxTagCount: maxTagCount, mode: mode, value: value, defaultValue: defaultValue, disabled: disabled, options: customOption !== undefined ? undefined : options, showSearch: showSearch !== undefined ? showSearch : isSearchField, filterOption: filterOption, searchValue: searchValue, suffixIcon: !loading ? React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faChevronDown.faChevronDown }) : undefined, menuItemSelectedIcon: mode === 'multiple' ? React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faCheck.faCheck }) : undefined, tagRender: function (_a) { var label = _a.label; return React.createElement("div", { className: "epn-select-customTag" }, label); }, tokenSeparators: tokenSeparators, maxTagPlaceholder: typeof maxTagPlaceholder !== 'undefined' ? maxTagPlaceholder : function (omittedValues) { var overflowItemsCount = omittedValues.length; return "+".concat(overflowItemsCount); }, dropdownRender: loading ? function (menu) { if (Array.isArray(options) && (options === null || options === void 0 ? void 0 : options.length) === 0) return (React.createElement("div", { className: "epn-select-dropdown-loading" }, React.createElement(Loader, null))); return (React.createElement(React.Fragment, null, menu, React.createElement(Loader, null))); } : undefined, size: size }, customOption !== undefined && options && options.map(function (item) { var CustomOptionsComponent = customOption; return (React.createElement(Option, __assign({ key: item.value }, item), React.createElement(CustomOptionsComponent, __assign({}, item)))); }))); } BaseSelect.FavouriteOption = FavouriteOption; function TreeSelect(_a) { var treeData = _a.treeData, treeDefaultExpandAll = _a.treeDefaultExpandAll, allowClear = _a.allowClear, treeLine = _a.treeLine, placeholder = _a.placeholder, value = _a.value, defaultValue = _a.defaultValue, open = _a.open, disabled = _a.disabled, loading = _a.loading, notFoundContent = _a.notFoundContent, fieldNames = _a.fieldNames, className = _a.className, style = _a.style, status = _a.status, id = _a.id, dropdownStyle = _a.dropdownStyle, dropdownClassName = _a.dropdownClassName, treeCheckable = _a.treeCheckable, showCheckedStrategy = _a.showCheckedStrategy, children = _a.children, maxTagCount = _a.maxTagCount, filterTreeNode = _a.filterTreeNode, _b = _a.treeNodeFilterProp, treeNodeFilterProp = _b === void 0 ? 'title' : _b, multiple = _a.multiple, placement = _a.placement, showSearch = _a.showSearch, searchValue = _a.searchValue, treeExpandAction = _a.treeExpandAction, treeLoadedKeys = _a.treeLoadedKeys, treeIcon = _a.treeIcon, dropdownMatchSelectWidth = _a.dropdownMatchSelectWidth, loadData = _a.loadData, getPopupContainer = _a.getPopupContainer, onSearch = _a.onSearch, onSelect = _a.onSelect, onTreeExpand = _a.onTreeExpand, onDropdownVisibleChange = _a.onDropdownVisibleChange, onChange = _a.onChange; return (React.createElement(TreeSelectAnt, { id: id, fieldNames: fieldNames, className: clsx('epn-treeSelect', className), style: style, dropdownClassName: dropdownClassName, dropdownStyle: dropdownStyle, status: status, treeData: treeData, treeDefaultExpandAll: treeDefaultExpandAll, placeholder: placeholder, value: value, defaultValue: defaultValue, loading: loading, open: open, maxTagCount: maxTagCount, removeIcon: React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faTimes.faTimes }), disabled: disabled, allowClear: allowClear, treeLine: treeLine, treeCheckable: treeCheckable, showCheckedStrategy: showCheckedStrategy, treeLoadedKeys: treeLoadedKeys, treeExpandAction: treeExpandAction, searchValue: searchValue, showSearch: showSearch, placement: placement, multiple: multiple, filterTreeNode: filterTreeNode, treeNodeFilterProp: treeNodeFilterProp, suffixIcon: !loading ? React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faChevronDown.faChevronDown }) : undefined, switcherIcon: React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faChevronDown.faChevronDown }), notFoundContent: notFoundContent || React.createElement(Empty, { locale: "ru" }), treeIcon: treeIcon, dropdownMatchSelectWidth: dropdownMatchSelectWidth, loadData: loadData, onChange: onChange, onDropdownVisibleChange: onDropdownVisibleChange, onTreeExpand: onTreeExpand, onSelect: onSelect, onSearch: onSearch, getPopupContainer: getPopupContainer, tagRender: function (_a) { var label = _a.label; return React.createElement("div", { className: "epn-select-customTag" }, label); }, dropdownRender: loading ? function (tree) { if (Array.isArray(treeData) && (treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0) return (React.createElement("div", { className: "epn-select-dropdown-loading" }, React.createElement(Loader, null))); return (React.createElement(React.Fragment, null, tree, React.createElement(Loader, null))); } : undefined, virtual: false, showArrow: true }, children)); } TreeSelect.TreeNode = TreeSelectAnt.TreeNode; TreeSelect.SHOW_ALL = TreeSelectAnt.SHOW_ALL; TreeSelect.SHOW_PARENT = TreeSelectAnt.SHOW_PARENT; TreeSelect.SHOW_CHILD = TreeSelectAnt.SHOW_CHILD; var BaseSwitch = function (_a) { var className = _a.className, style = _a.style, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.loading, loading = _d === void 0 ? false : _d, _e = _a.autoFocus, autoFocus = _e === void 0 ? false : _e, id = _a.id, onChange = _a.onChange, onClick = _a.onClick; return (React.createElement(Switch$1, { id: id, className: clsx('epn-switch', className), style: style, checked: checked, disabled: disabled, loading: loading, autoFocus: autoFocus, onChange: onChange, onClick: onClick })); }; var Switch = BaseSwitch; var Panel = Collapse.Panel; var BaseCollapse = function (_a) { var items = _a.items, defaultActiveKey = _a.defaultActiveKey, _b = _a.expandFirstItem, expandFirstItem = _b === void 0 ? true : _b, expandIcon = _a.expandIcon, className = _a.className, style = _a.style, _c = _a.accordion, accordion = _c === void 0 ? false : _c, _d = _a.showArrow, showArrow = _d === void 0 ? true : _d, onChange = _a.onChange, ghost = _a.ghost; var emptyItems = !Array.isArray(items) || items.length === 0; var getDefaultActiveKey = function () { var _a; if (defaultActiveKey) return defaultActiveKey; if (!Array.isArray(items)) return undefined; if (expandFirstItem) return (_a = items[0]) === null || _a === void 0 ? void 0 : _a.key; return undefined; }; return (React.createElement(Collapse, { accordion: accordion, defaultActiveKey: getDefaultActiveKey(), className: clsx('epn-collapse', className), style: style, expandIconPosition: "end", expandIcon: expandIcon || (function (_a) { var isActive = _a.isActive; return (React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faChevronDown$1.faChevronDown, className: clsx('epn-collapse__icon', { 'epn-collapse__icon--active': isActive, }) })); }), bordered: false, onChange: onChange, ghost: ghost }, !emptyItems && items.map(function (item) { return (React.createElement(Panel, { showArrow: showArrow, header: item.title, key: item.key, className: clsx('epn-collapse__item') }, item.body)); }))); }; var BaseCollapse$1 = BaseCollapse; var UploadItem = function (_a) { var file = _a.file, actions = _a.actions, loading = _a.loading; return (React.createElement("div", { className: "epn-upload-list-item" }, React.createElement("div", { className: "epn-upload-list-item__icon" }, !loading && React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faPaperclip.faPaperclip }), loading && (React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faSpinnerThird.faSpinnerThird, className: "animate-spin" }))), React.createElement("div", { className: "epn-upload-list-item__name" }, file.name), React.createElement("div", { className: "epn-upload-list-item__action" }, React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faTimes$1.faTimes, className: clsx(undefined, { 'epn-upload-list-item__action--disabled': loading, }), onClick: function () { if (!loading) { actions.remove(); } } })))); }; function BaseUpload(_a) { var accept = _a.accept, maxCount = _a.maxCount, multiple = _a.multiple, children = _a.children, _b = _a.fileListDir, fileListDir = _b === void 0 ? 'horizontal' : _b, showUploadList = _a.showUploadList, action = _a.action, disabled = _a.disabled, className = _a.className, onChange = _a.onChange, customRequest = _a.customRequest, renderItem = _a.renderItem, beforeUpload = _a.beforeUpload; return (React.createElement(Upload, { className: clsx('epn-upload', className, { 'epn-upload__vertical': fileListDir === 'vertical', 'epn-upload__horizontal': fileListDir === 'horizontal', }), showUploadList: showUploadList, accept: accept, maxCount: maxCount, multiple: multiple, disabled: disabled, action: customRequest ? undefined : action, customRequest: action ? undefined : customRequest, itemRender: renderItem, beforeUpload: beforeUpload, onChange: onChange }, children)); } BaseUpload.UploadItem = UploadItem; BaseUpload.LIST_IGNORE = Upload.LIST_IGNORE; BaseUpload.Dragger = Upload.Dragger; var Item = List.Item; function BaseList(_a) { var className = _a.className, loadMoreClassName = _a.loadMoreClassName, bordered = _a.bordered, dataSource = _a.dataSource, loadMore = _a.loadMore, customEmpty = _a.customEmpty, rowKey = _a.rowKey, _b = _a.separator, separator = _b === void 0 ? false : _b, loading = _a.loading, size = _a.size, grid = _a.grid, renderItem = _a.renderItem; return (React.createElement(List, { size: size, bordered: bordered, loading: loading ? { indicator: React.createElement(Loader, { className: "epn-loader__circle_red" }), } : false, className: clsx('epn-list', className, { 'epn-list-sepless': !separator, 'epn-list-bordered': loadMore !== undefined && bordered, }), grid: grid, dataSource: dataSource, loadMore: loadMore !== undefined ? (React.createElement("div", { className: clsx('epn-list-loadMore', loadMoreClassName) }, loadMore)) : undefined, rowKey: rowKey, renderItem: renderItem, locale: { emptyText: customEmpty || React.createElement(Empty, { locale: "ru" }), } })); } BaseList.Item = Item; var FormItem = function (_a) { var colon = _a.colon, dependencies = _a.dependencies, extra = _a.extra, hasFeedback = _a.hasFeedback, help = _a.help, hidden = _a.hidden, htmlFor = _a.htmlFor, initialValue = _a.initialValue, label = _a.label, labelAlign = _a.labelAlign, labelCol = _a.labelCol, messageVariables = _a.messageVariables, name = _a.name, noStyle = _a.noStyle, preserve = _a.preserve, required = _a.required, rules = _a.rules, shouldUpdate = _a.shouldUpdate, tooltip = _a.tooltip, trigger = _a.trigger, validateFirst = _a.validateFirst, validateStatus = _a.validateStatus, validateTrigger = _a.validateTrigger, valuePropName = _a.valuePropName, wrapperCol = _a.wrapperCol, children = _a.children, className = _a.className, style = _a.style, getValueFromEvent = _a.getValueFromEvent, getValueProps = _a.getValueProps, normalize = _a.normalize; return (React.createElement(Form.Item, { colon: colon, dependencies: dependencies, extra: extra, hasFeedback: hasFeedback, help: help, hidden: hidden, htmlFor: htmlFor, initialValue: initialValue, label: label, labelAlign: labelAlign, labelCol: labelCol, messageVariables: messageVariables, name: name, noStyle: noStyle, className: className, style: style, preserve: preserve, required: required, rules: rules, shouldUpdate: shouldUpdate, tooltip: tooltip, trigger: trigger, validateFirst: validateFirst, validateStatus: validateStatus, validateTrigger: validateTrigger, valuePropName: valuePropName, wrapperCol: wrapperCol, normalize: normalize, getValueFromEvent: getValueFromEvent, getValueProps: getValueProps }, children)); }; function BaseForm(_a) { var colon = _a.colon, component = _a.component, fields = _a.fields, form = _a.form, initialValues = _a.initialValues, labelAlign = _a.labelAlign, labelWrap = _a.labelWrap, labelCol = _a.labelCol, _b = _a.layout, layout = _b === void 0 ? 'vertical' : _b, name = _a.name, preserve = _a.preserve, requiredMark = _a.requiredMark, scrollToFirstError = _a.scrollToFirstError, validateMessages = _a.validateMessages, validateTrigger = _a.validateTrigger, wrapperCol = _a.wrapperCol, children = _a.children, className = _a.className, style = _a.style, disabled = _a.disabled, onFieldsChange = _a.onFieldsChange, onFinish = _a.onFinish, onFinishFailed = _a.onFinishFailed, onValuesChange = _a.onValuesChange; return (React.createElement(Form, { colon: colon, component: component, fields: fields, initialValues: initialValues, preserve: preserve, validateMessages: validateMessages, validateTrigger: validateTrigger, name: name, layout: layout, labelAlign: labelAlign, labelWrap: labelWrap, labelCol: labelCol, wrapperCol: wrapperCol, form: form, scrollToFirstError: scrollToFirstError, requiredMark: requiredMark, className: clsx('epn-form', className), style: style, disabled: disabled, onFieldsChange: onFieldsChange, onFinish: onFinish, onFinishFailed: onFinishFailed, onValuesChange: onValuesChange }, children)); } BaseForm.useForm = Form.useForm; BaseForm.useWatch = Form.useWatch; BaseForm.Item = FormItem; var BaseRate = function (_a) { var _b = _a.allowClear, allowClear = _b === void 0 ? false : _b, className = _a.className, _c = _a.count, count = _c === void 0 ? 5 : _c, _d = _a.defaultValue, defaultValue = _d === void 0 ? 0 : _d, disabled = _a.disabled, style = _a.style, _e = _a.value, value = _e === void 0 ? 0 : _e, onChange = _a.onChange, onHoverChange = _a.onHoverChange; var _f = React.useState(defaultValue || value), currentValue = _f[0], setCurrentValue = _f[1]; return (React.createElement(Rate, { allowClear: allowClear, className: className, style: style, count: count, value: value, defaultValue: defaultValue, disabled: disabled, onChange: function (newValue) { setCurrentValue(newValue); if (typeof onChange !== 'undefined') { onChange(newValue); } }, onHoverChange: onHoverChange, character: function (_a) { var index = _a.index; if (index >= currentValue) { return React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faStar$2.faStar }); } return React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faStar.faStar }); } })); }; var BaseRate$1 = BaseRate; function disabledDate(disabledValue) { return function (date) { var _a = disabledValue || [], before = _a[0], after = _a[1]; if (!before && !after) { return false; } if (before === null) { return date.isAfter(after); } if (after === null) { return date.isBefore(before); } return date.isBefore(before) || date.isAfter(after); }; } var DatePickerPro = function (_a) { var className = _a.className, _b = _a.format, format = _b === void 0 ? 'DD/MM' : _b, disabledValue = _a.disabledValue, props = __rest(_a, ["className", "format", "disabledValue"]); return (React.createElement(antd.DatePicker, __assign({ className: clsx('epn-datepicker', className), format: format, disabledDate: disabledDate(disabledValue) }, props))); }; var DatePickerPro$1 = DatePickerPro; dayjs.extend(weekday); dayjs.extend(localeData); var RangePicker = antd.DatePicker.RangePicker; var DatePickerRange = function (_a) { var className = _a.className, props = __rest(_a, ["className"]); return (React.createElement(RangePicker, __assign({ className: clsx('epn-datepicker epn-datepicker--range', className) }, props))); }; var DatePickerRange$1 = DatePickerRange; var BaseAlert = function (_a) { var id = _a.id, background = _a.background, backgroundStyle = _a.backgroundStyle, type = _a.type, message = _a.message, closable = _a.closable, className = _a.className, style = _a.style, action = _a.action, banner = _a.banner, _b = _a.showIcon, showIcon = _b === void 0 ? false : _b, onClose = _a.onClose, afterClose = _a.afterClose; return (React.createElement(Alert, { closeIcon: React.createElement(reactFontawesome.FontAwesomeIcon, { icon: faTimes.faTimes }), className: clsx('epn-alert', className), style: style, type: type, banner: banner, message: id ? React.createElement("span", { id: id }, message) : message, description: background ? (React.createElement("div", { className: "epn-alert-background", style: backgroundStyle }, background)) : undefined, closable: closable, action: action, showIcon: showIcon, onClose: onClose, afterClose: afterClose })); }; var BaseAlert$1 = BaseAlert; var ConfirmCodeInput = function (_a) { var length = _a.length, onChange = _a.onChange, disabled = _a.disabled, status = _a.status; return (React.createElement(TextInput.OTP, { length: length, onChange: onChange, disabled: disabled, status: status, size: "large", variant: status === 'error' ? 'filled' : 'outlined' })); }; var ConfirmCodeInput$1 = ConfirmCodeInput; var BaseCheckbox = React.forwardRef(function (_a, ref) { var id = _a.id, autoFocus = _a.autoFocus, checked = _a.checked, defaultChecked = _a.defaultChecked, disabled = _a.disabled, indeterminate = _a.indeterminate, className = _a.className, children = _a.children, onChange = _a.onChange, label = _a.label, defaultValue = _a.defaultValue; var _b = React.useState(defaultValue || defaultChecked), active = _b[0], setActive = _b[1]; return (React.createElement(CheckboxAnt, { ref: ref, id: id, autoFocus: autoFocus, checked: checked || active, defaultChecked: defaultValue || defaultChecked, disabled: disabled, indeterminate: indeterminate, className: clsx('epn-checkbox', className), onChange: function (e) { setActive(e.target.checked); if (typeof onChange === 'function') { onChange(e); } } }, React.createElement("span", { className: "epn-checkbox--label" }, label || children))); }); var Checkbox = BaseCheckbox; Checkbox.Group = CheckboxAnt.Group; var Checkbox$1 = Checkbox; var Group = RadioAnt.Group, Button = RadioAnt.Button; var BaseRadio = function (_a) { var id = _a.id, name = _a.name, _b = _a.autoFocus, autoFocus = _b === void 0 ? false : _b, _c = _a.checked, checked = _c === void 0 ? false : _c, _d = _a.defaultChecked, defaultChecked = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, value = _a.value, className = _a.className, style = _a.style, children = _a.children, onChange = _a.onChange; var _f = React.useState(defaultChecked), active = _f[0], setActive = _f[1]; return (React.createElement(RadioAnt, { id: id, name: name, autoFocus: autoFocus, checked: checked || active, disabled: disabled, value: value, className: clsx('epn-radio', className), style: style, onChange: function (e) { setActive(e.target.checked); if (typeof onChange === 'function') { onChange(e); } } }, React.createElement("span", { className: "epn-radio__label" }, children))); }; BaseRadio.displayName = 'Radio'; var Radio = BaseRadio; Radio.Button = Button; Radio.Group = Group; var Radio$1 = Radio; var TIMER_TICK = 1000; var Countdown = function (_a) { var id = _a.id, className = _a.className, _b = _a.animate, animate = _b === void 0 ? false : _b, seconds = _a.seconds, renderer = _a.renderer, onCompleted = _a.onComplet