@consta/uikit 3.24.0 → 3.24.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.
- package/Attach/package.json +1 -1
- package/Attachment/package.json +1 -1
- package/Avatar/package.json +1 -1
- package/Badge/package.json +1 -1
- package/BasicSelectDeprecated/package.json +1 -1
- package/Breadcrumbs/package.json +1 -1
- package/BreadcrumbsCanary/package.json +1 -1
- package/Button/package.json +1 -1
- package/CHANGELOG.md +20 -16
- package/Calendar/package.json +1 -1
- package/Card/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/CheckboxGroup/package.json +1 -1
- package/CheckboxGroupCanary/package.json +1 -1
- package/ChoiceGroup/package.json +1 -1
- package/ChoiceGroupCanary/package.json +1 -1
- package/Collapse/package.json +1 -1
- package/CollapseGroup/package.json +1 -1
- package/Combobox/package.json +1 -1
- package/ComboboxDeprecated/package.json +1 -1
- package/ContextMenu/package.json +1 -1
- package/ContextMenuCanary/package.json +1 -1
- package/DatePickerCanary/package.json +1 -1
- package/DateTimeCanary/package.json +1 -1
- package/DragNDropField/package.json +1 -1
- package/EventInterceptor/package.json +1 -1
- package/FieldCaption/package.json +1 -1
- package/FieldLabel/package.json +1 -1
- package/File/package.json +1 -1
- package/FileField/package.json +1 -1
- package/FileIcon/package.json +1 -1
- package/FileIconAvi/package.json +1 -1
- package/FileIconBmp/package.json +1 -1
- package/FileIconCsv/package.json +1 -1
- package/FileIconDoc/package.json +1 -1
- package/FileIconExe/package.json +1 -1
- package/FileIconGif/package.json +1 -1
- package/FileIconJpg/package.json +1 -1
- package/FileIconJson/package.json +1 -1
- package/FileIconLoading/package.json +1 -1
- package/FileIconMov/package.json +1 -1
- package/FileIconMp3/package.json +1 -1
- package/FileIconMp4/package.json +1 -1
- package/FileIconPdf/package.json +1 -1
- package/FileIconPng/package.json +1 -1
- package/FileIconPpt/package.json +1 -1
- package/FileIconRar/package.json +1 -1
- package/FileIconRtf/package.json +1 -1
- package/FileIconTiff/package.json +1 -1
- package/FileIconTxt/package.json +1 -1
- package/FileIconUndefined/package.json +1 -1
- package/FileIconWav/package.json +1 -1
- package/FileIconXls/package.json +1 -1
- package/FileIconZip/package.json +1 -1
- package/Grid/package.json +1 -1
- package/Header/package.json +1 -1
- package/Icon/package.json +1 -1
- package/IconAdd/package.json +1 -1
- package/IconAddToComparison/package.json +1 -1
- package/IconAlert/package.json +1 -1
- package/IconAlignBlocksLeft/package.json +1 -1
- package/IconAlignBlocksRight/package.json +1 -1
- package/IconAlignCenter/package.json +1 -1
- package/IconAlignJustify/package.json +1 -1
- package/IconAlignLeft/package.json +1 -1
- package/IconAlignRight/package.json +1 -1
- package/IconAllDone/package.json +1 -1
- package/IconArrowDown/package.json +1 -1
- package/IconArrowLeft/package.json +1 -1
- package/IconArrowRight/package.json +1 -1
- package/IconArrowUp/package.json +1 -1
- package/IconArtBrush/package.json +1 -1
- package/IconAttach/package.json +1 -1
- package/IconBackward/package.json +1 -1
- package/IconBag/package.json +1 -1
- package/IconBarrier/package.json +1 -1
- package/IconBento/package.json +1 -1
- package/IconBold/package.json +1 -1
- package/IconBook/package.json +1 -1
- package/IconBookmarkFilled/package.json +1 -1
- package/IconBookmarkStroked/package.json +1 -1
- package/IconCalculator/package.json +1 -1
- package/IconCalendar/package.json +1 -1
- package/IconCamera/package.json +1 -1
- package/IconCancel/package.json +1 -1
- package/IconCards/package.json +1 -1
- package/IconChat/package.json +1 -1
- package/IconCheck/package.json +1 -1
- package/IconClose/package.json +1 -1
- package/IconCollapse/package.json +1 -1
- package/IconColorFill/package.json +1 -1
- package/IconColorText/package.json +1 -1
- package/IconColumns/package.json +1 -1
- package/IconComment/package.json +1 -1
- package/IconConnection/package.json +1 -1
- package/IconCopy/package.json +1 -1
- package/IconCrown/package.json +1 -1
- package/IconCursorMouse/package.json +1 -1
- package/IconDataNull/package.json +1 -1
- package/IconDiamond/package.json +1 -1
- package/IconDinosaur/package.json +1 -1
- package/IconDisconnection/package.json +1 -1
- package/IconDocAdd/package.json +1 -1
- package/IconDocBlank/package.json +1 -1
- package/IconDocDelete/package.json +1 -1
- package/IconDocExport/package.json +1 -1
- package/IconDocFilled/package.json +1 -1
- package/IconDown/package.json +1 -1
- package/IconDownload/package.json +1 -1
- package/IconDrag/package.json +1 -1
- package/IconDraggable/package.json +1 -1
- package/IconDrillingRig/package.json +1 -1
- package/IconDrop/package.json +1 -1
- package/IconEdit/package.json +1 -1
- package/IconExit/package.json +1 -1
- package/IconExpand/package.json +1 -1
- package/IconEye/package.json +1 -1
- package/IconEyeClose/package.json +1 -1
- package/IconFacebook/package.json +1 -1
- package/IconFavorite/package.json +1 -1
- package/IconFilter/package.json +1 -1
- package/IconFitToDefault/package.json +1 -1
- package/IconFlagFilled/package.json +1 -1
- package/IconFlagStroked/package.json +1 -1
- package/IconFolders/package.json +1 -1
- package/IconForward/package.json +1 -1
- package/IconFunnel/package.json +1 -1
- package/IconGas/package.json +1 -1
- package/IconGeo/package.json +1 -1
- package/IconGrouping/package.json +1 -1
- package/IconHamburger/package.json +1 -1
- package/IconHand/package.json +1 -1
- package/IconHealth/package.json +1 -1
- package/IconHome/package.json +1 -1
- package/IconInComparison/package.json +1 -1
- package/IconInfo/package.json +1 -1
- package/IconInstagram/package.json +1 -1
- package/IconIntroduction/package.json +1 -1
- package/IconIpad/package.json +1 -1
- package/IconItalic/package.json +1 -1
- package/IconKebab/package.json +1 -1
- package/IconLaptop/package.json +1 -1
- package/IconLayers/package.json +1 -1
- package/IconLeaf/package.json +1 -1
- package/IconLightningBolt/package.json +1 -1
- package/IconLineAndBarChart/package.json +1 -1
- package/IconLink/package.json +1 -1
- package/IconList/package.json +1 -1
- package/IconListNumbered/package.json +1 -1
- package/IconLock/package.json +1 -1
- package/IconLogicalElement/package.json +1 -1
- package/IconMBU/package.json +1 -1
- package/IconMGRP/package.json +1 -1
- package/IconMLSP/package.json +1 -1
- package/IconMMP/package.json +1 -1
- package/IconMail/package.json +1 -1
- package/IconMap/package.json +1 -1
- package/IconMaxHeight/package.json +1 -1
- package/IconMaxWidth/package.json +1 -1
- package/IconMeatball/package.json +1 -1
- package/IconMic/package.json +1 -1
- package/IconMolecules/package.json +1 -1
- package/IconMoon/package.json +1 -1
- package/IconNodeEnd/package.json +1 -1
- package/IconNodeStart/package.json +1 -1
- package/IconNodeStep/package.json +1 -1
- package/IconNodes/package.json +1 -1
- package/IconOpenInNew/package.json +1 -1
- package/IconOperators/package.json +1 -1
- package/IconPanelBottom/package.json +1 -1
- package/IconPanelLeft/package.json +1 -1
- package/IconPanelRight/package.json +1 -1
- package/IconPanelTop/package.json +1 -1
- package/IconPaste/package.json +1 -1
- package/IconPause/package.json +1 -1
- package/IconPhone/package.json +1 -1
- package/IconPhoto/package.json +1 -1
- package/IconPicture/package.json +1 -1
- package/IconPlay/package.json +1 -1
- package/IconPressure/package.json +1 -1
- package/IconPriceLabel/package.json +1 -1
- package/IconProcessing/package.json +1 -1
- package/IconQuestion/package.json +1 -1
- package/IconQuote/package.json +1 -1
- package/IconRUO/package.json +1 -1
- package/IconRUS/package.json +1 -1
- package/IconRecord/package.json +1 -1
- package/IconRemove/package.json +1 -1
- package/IconRemoveFromComparison/package.json +1 -1
- package/IconReply/package.json +1 -1
- package/IconResize/package.json +1 -1
- package/IconRestart/package.json +1 -1
- package/IconRevert/package.json +1 -1
- package/IconRing/package.json +1 -1
- package/IconRouble/package.json +1 -1
- package/IconRuler/package.json +1 -1
- package/IconSave/package.json +1 -1
- package/IconScreen/package.json +1 -1
- package/IconSearch/package.json +1 -1
- package/IconSelect/package.json +1 -1
- package/IconSelectOpen/package.json +1 -1
- package/IconSendMessage/package.json +1 -1
- package/IconSettings/package.json +1 -1
- package/IconShape/package.json +1 -1
- package/IconShuffle/package.json +1 -1
- package/IconSmile/package.json +1 -1
- package/IconSortDown/package.json +1 -1
- package/IconSortDownCenter/package.json +1 -1
- package/IconSortUp/package.json +1 -1
- package/IconSortUpCenter/package.json +1 -1
- package/IconStop/package.json +1 -1
- package/IconStorage/package.json +1 -1
- package/IconStrikethrough/package.json +1 -1
- package/IconSun/package.json +1 -1
- package/IconTable/package.json +1 -1
- package/IconTable2/package.json +1 -1
- package/IconTarget/package.json +1 -1
- package/IconTeam/package.json +1 -1
- package/IconTechResponse/package.json +1 -1
- package/IconTest/package.json +1 -1
- package/IconThumbUp/package.json +1 -1
- package/IconTie/package.json +1 -1
- package/IconTop/package.json +1 -1
- package/IconTrash/package.json +1 -1
- package/IconType/package.json +1 -1
- package/IconUnderline/package.json +1 -1
- package/IconUnlock/package.json +1 -1
- package/IconUnsort/package.json +1 -1
- package/IconUnsortCenter/package.json +1 -1
- package/IconUpload/package.json +1 -1
- package/IconUser/package.json +1 -1
- package/IconVZD/package.json +1 -1
- package/IconVideo/package.json +1 -1
- package/IconVkontakte/package.json +1 -1
- package/IconWarning/package.json +1 -1
- package/IconWatch/package.json +1 -1
- package/IconWideScreen/package.json +1 -1
- package/IconWorld/package.json +1 -1
- package/IconWrench/package.json +1 -1
- package/IconYandexDzen/package.json +1 -1
- package/IconYoutube/package.json +1 -1
- package/Informer/package.json +1 -1
- package/LayoutCanary/package.json +1 -1
- package/Loader/package.json +1 -1
- package/MixCard/package.json +1 -1
- package/MixFocus/package.json +1 -1
- package/MixPopoverAnimate/package.json +1 -1
- package/MixPopoverArrow/package.json +1 -1
- package/MixSpace/package.json +1 -1
- package/MixVisuallyHidden/package.json +1 -1
- package/Modal/package.json +1 -1
- package/MultiComboboxDeprecated/package.json +1 -1
- package/Pagination/package.json +1 -1
- package/Popover/package.json +1 -1
- package/PortalWithTheme/package.json +1 -1
- package/ProgressSpin/package.json +1 -1
- package/ProgressStepBarCanary/package.json +1 -1
- package/Radio/package.json +1 -1
- package/RadioGroup/package.json +1 -1
- package/Responses/package.json +1 -1
- package/Responses403/package.json +1 -1
- package/Responses404/package.json +1 -1
- package/Responses500/package.json +1 -1
- package/Responses503/package.json +1 -1
- package/ResponsesConnectionError/package.json +1 -1
- package/ResponsesDeleted/package.json +1 -1
- package/ResponsesEmptyBox/package.json +1 -1
- package/ResponsesEmptyPockets/package.json +1 -1
- package/ResponsesExit/package.json +1 -1
- package/ResponsesImage/package.json +1 -1
- package/ResponsesImage403/package.json +1 -1
- package/ResponsesImage404/package.json +1 -1
- package/ResponsesImage500/package.json +1 -1
- package/ResponsesImage503/package.json +1 -1
- package/ResponsesImageConnectionError/package.json +1 -1
- package/ResponsesImageDeleted/package.json +1 -1
- package/ResponsesImageEmptyBox/package.json +1 -1
- package/ResponsesImageEmptyPockets/package.json +1 -1
- package/ResponsesImageNothingFound/package.json +1 -1
- package/ResponsesImageSuccess/package.json +1 -1
- package/ResponsesNothingFound/package.json +1 -1
- package/ResponsesSuccess/package.json +1 -1
- package/Select/package.json +1 -1
- package/Sidebar/package.json +1 -1
- package/Skeleton/package.json +1 -1
- package/SliderCanary/package.json +1 -1
- package/SnackBar/package.json +1 -1
- package/Steps/package.json +1 -1
- package/StepsCanary/package.json +1 -1
- package/Switch/package.json +1 -1
- package/SwitchGroup/package.json +1 -1
- package/SwitchGroupCanary/package.json +1 -1
- package/Table/package.json +1 -1
- package/Tabs/package.json +1 -1
- package/TabsCanary/package.json +1 -1
- package/Tag/package.json +1 -1
- package/TagBase/package.json +1 -1
- package/Text/package.json +1 -1
- package/TextField/package.json +1 -1
- package/Theme/package.json +1 -1
- package/ThemeToggler/package.json +1 -1
- package/Timer/package.json +1 -1
- package/Tooltip/package.json +1 -1
- package/User/package.json +1 -1
- package/UserSelect/package.json +1 -1
- package/UserSelectDeprecated/package.json +1 -1
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenu.css +4 -1
- package/__internal__/cjs-src/components/ContextMenuCanary/ContextMenuCanary.js +6 -2
- package/__internal__/cjs-src/components/DateTimeCanary/DateTimeItem/DateTimeItem.d.ts +1 -1
- package/__internal__/cjs-src/components/DragNDropField/DragNDropField.d.ts +2 -10
- package/__internal__/cjs-src/components/DragNDropField/DragNDropField.js +8 -3
- package/__internal__/cjs-src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.js +5 -6
- package/__internal__/cjs-src/components/DragNDropField/DragNDropFieldContent/formatFileRequirements.d.ts +2 -1
- package/__internal__/cjs-src/components/DragNDropField/DragNDropFieldContent/formatFileRequirements.js +8 -3
- package/__internal__/cjs-src/components/DragNDropField/formatFileSize.d.ts +2 -1
- package/__internal__/cjs-src/components/DragNDropField/formatFileSize.js +16 -13
- package/__internal__/cjs-src/components/DragNDropField/getErrorsList.d.ts +2 -1
- package/__internal__/cjs-src/components/DragNDropField/getErrorsList.js +26 -21
- package/__internal__/cjs-src/components/DragNDropField/locale.d.ts +30 -0
- package/__internal__/cjs-src/components/DragNDropField/locale.js +35 -0
- package/__internal__/cjs-src/components/DragNDropField/types.d.ts +28 -0
- package/__internal__/cjs-src/components/DragNDropField/types.js +2 -0
- package/__internal__/cjs-src/components/Popover/Popover.js +17 -17
- package/__internal__/cjs-src/components/Popover/usePopoverReposition.d.ts +1 -2
- package/__internal__/cjs-src/components/Popover/usePopoverReposition.js +17 -17
- package/__internal__/cjs-src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts +1 -0
- package/__internal__/cjs-src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js +3 -3
- package/__internal__/cjs-src/components/SelectComponents/SelectLoader/SelectLoader.d.ts +1 -0
- package/__internal__/cjs-src/components/SelectComponents/SelectLoader/SelectLoader.js +4 -4
- package/__internal__/cjs-src/components/Table/RowsCollapse/TableRowsCollapse.js +1 -1
- package/__internal__/cjs-src/components/Table/Table.js +3 -3
- package/__internal__/src/components/ContextMenuCanary/ContextMenu.css +4 -1
- package/__internal__/src/components/ContextMenuCanary/ContextMenuCanary.js +6 -2
- package/__internal__/src/components/DateTimeCanary/DateTimeItem/DateTimeItem.d.ts +1 -1
- package/__internal__/src/components/DragNDropField/DragNDropField.d.ts +2 -10
- package/__internal__/src/components/DragNDropField/DragNDropField.js +8 -3
- package/__internal__/src/components/DragNDropField/DragNDropFieldContent/DragNDropFieldContent.js +5 -6
- package/__internal__/src/components/DragNDropField/DragNDropFieldContent/formatFileRequirements.d.ts +2 -1
- package/__internal__/src/components/DragNDropField/DragNDropFieldContent/formatFileRequirements.js +8 -3
- package/__internal__/src/components/DragNDropField/formatFileSize.d.ts +2 -1
- package/__internal__/src/components/DragNDropField/formatFileSize.js +16 -13
- package/__internal__/src/components/DragNDropField/getErrorsList.d.ts +2 -1
- package/__internal__/src/components/DragNDropField/getErrorsList.js +27 -22
- package/__internal__/src/components/DragNDropField/locale.d.ts +30 -0
- package/__internal__/src/components/DragNDropField/locale.js +32 -0
- package/__internal__/src/components/DragNDropField/types.d.ts +28 -0
- package/__internal__/src/components/DragNDropField/types.js +0 -0
- package/__internal__/src/components/Popover/Popover.js +18 -18
- package/__internal__/src/components/Popover/usePopoverReposition.d.ts +1 -2
- package/__internal__/src/components/Popover/usePopoverReposition.js +17 -16
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts +1 -0
- package/__internal__/src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js +1 -1
- package/__internal__/src/components/SelectComponents/SelectLoader/SelectLoader.d.ts +1 -0
- package/__internal__/src/components/SelectComponents/SelectLoader/SelectLoader.js +1 -1
- package/__internal__/src/components/Table/RowsCollapse/TableRowsCollapse.js +1 -1
- package/__internal__/src/components/Table/Table.js +4 -4
- package/createIcon/package.json +1 -1
- package/createResponsesImage/package.json +1 -1
- package/package.json +1 -1
- package/useBreakpoints/package.json +1 -1
- package/useChoiceGroup/package.json +1 -1
- package/useChoiceGroupIndexed/package.json +1 -1
- package/useClickOutside/package.json +1 -1
- package/useComponentSize/package.json +1 -1
- package/useDebounce/package.json +1 -1
- package/useFlag/package.json +1 -1
- package/useForkRef/package.json +1 -1
- package/useGlobalKeys/package.json +1 -1
- package/useHideElementsInLine/package.json +1 -1
- package/useKeys/package.json +1 -1
- package/useMutableRef/package.json +1 -1
- package/useOverflow/package.json +1 -1
- package/usePrevious/package.json +1 -1
- package/useRefs/package.json +1 -1
- package/useResizeObserved/package.json +1 -1
- package/useScrollElements/package.json +1 -1
- package/useScrollPosition/package.json +1 -1
- package/useSelect/package.json +1 -1
- package/useSortSteps/package.json +1 -1
- package/useThemeVars/package.json +1 -1
- package/useTimer/package.json +1 -1
- package/withTooltip/package.json +1 -1
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
exports.__esModule = true;
|
|
3
3
|
exports.formatFileSize = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
var getUnits = function (locale) {
|
|
6
|
+
return [
|
|
7
|
+
{ value: 1024 * 1024 * 1024, name: locale.gigabyte },
|
|
8
|
+
{ value: 1024 * 1024, name: locale.megabyte },
|
|
9
|
+
{ value: 1024, name: locale.kilobyte },
|
|
10
|
+
{ value: 1, name: locale.byte },
|
|
11
|
+
];
|
|
12
|
+
};
|
|
13
|
+
var floorToDecimals = function (num, decimals) {
|
|
14
|
+
return Math.floor(Math.pow(10, decimals) * num) / Math.pow(10, decimals);
|
|
15
|
+
};
|
|
16
|
+
exports.formatFileSize = function (sizeInBytes, locale) {
|
|
12
17
|
var e_1, _a;
|
|
18
|
+
var units = getUnits(locale);
|
|
13
19
|
try {
|
|
14
|
-
for (var
|
|
15
|
-
var step =
|
|
20
|
+
for (var units_1 = tslib_1.__values(units), units_1_1 = units_1.next(); !units_1_1.done; units_1_1 = units_1.next()) {
|
|
21
|
+
var step = units_1_1.value;
|
|
16
22
|
if (sizeInBytes >= step.value) {
|
|
17
23
|
return floorToDecimals(sizeInBytes / step.value, 1) + " " + step.name;
|
|
18
24
|
}
|
|
@@ -21,12 +27,9 @@ exports.formatFileSize = function (sizeInBytes) {
|
|
|
21
27
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
22
28
|
finally {
|
|
23
29
|
try {
|
|
24
|
-
if (
|
|
30
|
+
if (units_1_1 && !units_1_1.done && (_a = units_1["return"])) _a.call(units_1);
|
|
25
31
|
}
|
|
26
32
|
finally { if (e_1) throw e_1.error; }
|
|
27
33
|
}
|
|
28
34
|
return undefined;
|
|
29
35
|
};
|
|
30
|
-
var floorToDecimals = function (num, decimals) {
|
|
31
|
-
return Math.floor(Math.pow(10, decimals) * num) / Math.pow(10, decimals);
|
|
32
|
-
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { FileRejection } from 'react-dropzone';
|
|
2
|
-
|
|
2
|
+
import { DragNDropFieldPropLocale, FileSizes } from './types';
|
|
3
|
+
export declare const getErrorsList: (fileRejections: FileRejection[], sizes: FileSizes | undefined, locale: Required<DragNDropFieldPropLocale>) => string[];
|
|
@@ -3,45 +3,45 @@ exports.__esModule = true;
|
|
|
3
3
|
exports.getErrorsList = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var type_guards_1 = require("../../utils/type-guards");
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
6
|
+
var defaultFileSizes = {
|
|
7
|
+
maxSize: 1024 * 1024 * 1024,
|
|
8
|
+
minSize: 1
|
|
9
|
+
};
|
|
10
|
+
var NO_MESSAGE = 'no-message';
|
|
11
|
+
var getErrorMessage = function (error, file, sizes, locale) {
|
|
12
|
+
var code = error.code;
|
|
13
|
+
var message = locale[code];
|
|
14
|
+
if (!type_guards_1.isNotNil(message)) {
|
|
15
|
+
return file ? file.name + ": " + locale['general-error'] : NO_MESSAGE;
|
|
16
|
+
}
|
|
17
|
+
if (file) {
|
|
18
|
+
return file.name + ": " + (type_guards_1.isString(message) ? message : message({ file: file, sizes: sizes }));
|
|
19
19
|
}
|
|
20
|
+
return type_guards_1.isString(message) ? message : NO_MESSAGE;
|
|
20
21
|
};
|
|
21
|
-
|
|
22
|
-
exports.getErrorsList = function (fileRejections) {
|
|
22
|
+
exports.getErrorsList = function (fileRejections, sizes, locale) {
|
|
23
23
|
var e_1, _a, e_2, _b;
|
|
24
|
-
|
|
24
|
+
if (sizes === void 0) { sizes = defaultFileSizes; }
|
|
25
25
|
var errorsList = [];
|
|
26
26
|
var tooManyFilesErrorsCount = 0;
|
|
27
27
|
try {
|
|
28
28
|
for (var fileRejections_1 = tslib_1.__values(fileRejections), fileRejections_1_1 = fileRejections_1.next(); !fileRejections_1_1.done; fileRejections_1_1 = fileRejections_1.next()) {
|
|
29
29
|
var rejection = fileRejections_1_1.value;
|
|
30
30
|
try {
|
|
31
|
-
for (var
|
|
32
|
-
var error =
|
|
31
|
+
for (var _c = (e_2 = void 0, tslib_1.__values(rejection.errors)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
32
|
+
var error = _d.value;
|
|
33
33
|
if (error.code === 'too-many-files') {
|
|
34
34
|
tooManyFilesErrorsCount++;
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
errorsList.push(
|
|
37
|
+
errorsList.push(getErrorMessage(error, rejection.file, sizes, locale));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
42
42
|
finally {
|
|
43
43
|
try {
|
|
44
|
-
if (
|
|
44
|
+
if (_d && !_d.done && (_b = _c["return"])) _b.call(_c);
|
|
45
45
|
}
|
|
46
46
|
finally { if (e_2) throw e_2.error; }
|
|
47
47
|
}
|
|
@@ -55,7 +55,12 @@ exports.getErrorsList = function (fileRejections) {
|
|
|
55
55
|
finally { if (e_1) throw e_1.error; }
|
|
56
56
|
}
|
|
57
57
|
if (tooManyFilesErrorsCount) {
|
|
58
|
-
errorsList.unshift(
|
|
58
|
+
errorsList.unshift(getErrorMessage({ code: 'too-many-files', message: '' }, undefined, sizes, locale));
|
|
59
|
+
}
|
|
60
|
+
if (type_guards_1.isNotNil(errorsList.find(function (text) { return text === NO_MESSAGE; }))) {
|
|
61
|
+
var list = errorsList.filter(function (text) { return text !== NO_MESSAGE; });
|
|
62
|
+
list.unshift(locale['general-error']);
|
|
63
|
+
return list;
|
|
59
64
|
}
|
|
60
65
|
return errorsList;
|
|
61
66
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FileSizes } from './types';
|
|
2
|
+
declare type LocaleError = string | ((props: {
|
|
3
|
+
file: File;
|
|
4
|
+
sizes: FileSizes;
|
|
5
|
+
}) => string);
|
|
6
|
+
declare type LocaleLabel = string | ((props: {
|
|
7
|
+
fileText: string;
|
|
8
|
+
}) => string);
|
|
9
|
+
export declare type Locale = {
|
|
10
|
+
'file-invalid-type'?: LocaleError;
|
|
11
|
+
'file-too-large'?: LocaleError;
|
|
12
|
+
'file-too-small'?: LocaleError;
|
|
13
|
+
'too-many-files'?: string;
|
|
14
|
+
'general-error'?: string;
|
|
15
|
+
'fit-files'?: string;
|
|
16
|
+
'file'?: string;
|
|
17
|
+
'files'?: string;
|
|
18
|
+
'before'?: string;
|
|
19
|
+
'gigabyte'?: string;
|
|
20
|
+
'megabyte'?: string;
|
|
21
|
+
'kilobyte'?: string;
|
|
22
|
+
'byte'?: string;
|
|
23
|
+
'max'?: string;
|
|
24
|
+
'call-to-action'?: LocaleLabel;
|
|
25
|
+
'action-button'?: LocaleLabel;
|
|
26
|
+
};
|
|
27
|
+
export declare const defaultLocale: Required<Locale>;
|
|
28
|
+
export declare const getText: <PROPS>(textOrFn: string | ((props: PROPS) => string), props: PROPS) => string;
|
|
29
|
+
export declare const withdefaultLocale: (locale?: Locale | undefined) => Required<Locale>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.withdefaultLocale = exports.getText = exports.defaultLocale = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var type_guards_1 = require("../../utils/type-guards");
|
|
6
|
+
var formatFileSize_1 = require("./formatFileSize");
|
|
7
|
+
exports.defaultLocale = {
|
|
8
|
+
'file-invalid-type': function (props) {
|
|
9
|
+
return ['формат файла не подходит', props.file.type && "(" + props.file.type + ")"]
|
|
10
|
+
.filter(type_guards_1.isNotNil)
|
|
11
|
+
.join(' ');
|
|
12
|
+
},
|
|
13
|
+
'file-too-large': function (props) { var _a; return "\u0444\u0430\u0439\u043B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u0431\u043E\u043B\u044C\u0448\u043E\u0439 (\u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C " + formatFileSize_1.formatFileSize((_a = props.sizes.maxSize) !== null && _a !== void 0 ? _a : 0, exports.defaultLocale) + ")"; },
|
|
14
|
+
'file-too-small': function (props) { var _a; return "\u0444\u0430\u0439\u043B \u0441\u043B\u0438\u0448\u043A\u043E\u043C \u043C\u0430\u043B\u0435\u043D\u044C\u043A\u0438\u0439 (\u043C\u0438\u043D\u0438\u043C\u0443\u043C " + formatFileSize_1.formatFileSize((_a = props.sizes.minSize) !== null && _a !== void 0 ? _a : 0, exports.defaultLocale) + ")"; },
|
|
15
|
+
'too-many-files': 'Вы перетащили несколько файлов. Выберите один, пожалуйста',
|
|
16
|
+
'general-error': 'не получилось добавить файл',
|
|
17
|
+
'fit-files': 'Подходят файлы',
|
|
18
|
+
'file': 'файл',
|
|
19
|
+
'files': 'файлы',
|
|
20
|
+
'before': 'до',
|
|
21
|
+
'max': 'Максимум',
|
|
22
|
+
'gigabyte': 'Гб',
|
|
23
|
+
'megabyte': 'Мб',
|
|
24
|
+
'kilobyte': 'Кб',
|
|
25
|
+
'byte': 'байт',
|
|
26
|
+
'call-to-action': function (props) { return "\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 " + props.fileText + " \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u043F\u043E \u043A\u043D\u043E\u043F\u043A\u0435"; },
|
|
27
|
+
'action-button': function (props) { return "\u0412\u044B\u0431\u0440\u0430\u0442\u044C " + props.fileText; }
|
|
28
|
+
};
|
|
29
|
+
exports.getText = function (textOrFn, props) {
|
|
30
|
+
return type_guards_1.isString(textOrFn) ? textOrFn : textOrFn(props);
|
|
31
|
+
};
|
|
32
|
+
exports.withdefaultLocale = function (locale) {
|
|
33
|
+
return type_guards_1.isDefined(locale)
|
|
34
|
+
? tslib_1.__assign(tslib_1.__assign({}, exports.defaultLocale), locale) : exports.defaultLocale;
|
|
35
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Locale } from './locale';
|
|
3
|
+
export declare type DragNDropFieldPropLocale = Locale;
|
|
4
|
+
export declare type FileError = {
|
|
5
|
+
message: string;
|
|
6
|
+
code: 'file-too-large' | 'file-too-small' | 'too-many-files' | 'file-invalid-type';
|
|
7
|
+
};
|
|
8
|
+
export declare type FileRejection = {
|
|
9
|
+
file: File;
|
|
10
|
+
errors: FileError[];
|
|
11
|
+
};
|
|
12
|
+
export declare type DragNDropFieldPropErrorMessages = Partial<Record<FileError['code'], string | ((file: File | undefined, error?: FileError) => string)>>;
|
|
13
|
+
export declare type DragNDropFieldChildrenRenderProp = (props: {
|
|
14
|
+
openFileDialog: () => void;
|
|
15
|
+
locale: Required<DragNDropFieldPropLocale>;
|
|
16
|
+
} & Pick<DragNDropFieldProps, 'accept' | 'maxSize' | 'multiple'>) => React.ReactNode;
|
|
17
|
+
export declare type FileSizes = {
|
|
18
|
+
minSize?: number;
|
|
19
|
+
maxSize?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare type DragNDropFieldProps = {
|
|
22
|
+
accept?: string | string[];
|
|
23
|
+
maxSize?: number;
|
|
24
|
+
multiple?: boolean;
|
|
25
|
+
onDropFiles: (files: File[]) => void;
|
|
26
|
+
children?: React.ReactNode | DragNDropFieldChildrenRenderProp;
|
|
27
|
+
locale?: DragNDropFieldPropLocale;
|
|
28
|
+
};
|
|
@@ -73,7 +73,7 @@ var ContextConsumer = function (_a) {
|
|
|
73
73
|
return react_1["default"].createElement(react_1["default"].Fragment, null, children);
|
|
74
74
|
};
|
|
75
75
|
var cnPopover = bem_1.cn('Popover');
|
|
76
|
-
exports.Popover = react_1
|
|
76
|
+
exports.Popover = react_1.forwardRef(function (props, componentRef) {
|
|
77
77
|
var _a;
|
|
78
78
|
var children = props.children, _b = props.direction, passedDirection = _b === void 0 ? 'upCenter' : _b, _c = props.offset, offset = _c === void 0 ? 0 : _c, arrowOffset = props.arrowOffset, _d = props.possibleDirections, possibleDirections = _d === void 0 ? exports.directions : _d, _e = props.isInteractive, isInteractive = _e === void 0 ? true : _e, onClickOutside = props.onClickOutside, _f = props.spareDirection, spareDirection = _f === void 0 ? 'downStartLeft' : _f, style = props.style, className = props.className, passedPosition = props.position, anchorRef = props.anchorRef, equalAnchorWidth = props.equalAnchorWidth, onSetDirection = props.onSetDirection, otherProps = tslib_1.__rest(props, ["children", "direction", "offset", "arrowOffset", "possibleDirections", "isInteractive", "onClickOutside", "spareDirection", "style", "className", "position", "anchorRef", "equalAnchorWidth", "onSetDirection"]);
|
|
79
79
|
var ref = react_1["default"].useRef(null);
|
|
@@ -82,22 +82,12 @@ exports.Popover = react_1["default"].forwardRef(function (props, componentRef) {
|
|
|
82
82
|
var _h = useComponentSize_1.useComponentSize(ref), width = _h.width, height = _h.height;
|
|
83
83
|
var anchorSize = useComponentSize_1.useComponentSize(anchorRef || { current: null });
|
|
84
84
|
var previousDirectionRef = react_1["default"].useRef(null);
|
|
85
|
-
var previousDirection = previousDirectionRef.current;
|
|
86
85
|
var _j = tslib_1.__read(react_1["default"].useState([]), 2), bannedDirections = _j[0], setBannedDirections = _j[1];
|
|
87
86
|
var resetBannedDirections = function () {
|
|
88
87
|
setBannedDirections(function (state) { return (state.length ? [] : state); });
|
|
89
88
|
previousDirectionRef.current = null;
|
|
90
89
|
};
|
|
91
90
|
var updateAnchorClientRect = function () { var _a; return setAnchorClientRect((_a = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()); };
|
|
92
|
-
react_1["default"].useLayoutEffect(updateAnchorClientRect, [anchorSize]);
|
|
93
|
-
usePopoverReposition_1.usePopoverReposition({
|
|
94
|
-
isActive: true,
|
|
95
|
-
scrollAnchorRef: anchorRef || { current: null },
|
|
96
|
-
onRequestReposition: function () {
|
|
97
|
-
resetBannedDirections();
|
|
98
|
-
updateAnchorClientRect();
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
91
|
var _k = helpers_1.getComputedPositionAndDirection({
|
|
102
92
|
contentSize: { width: width, height: height },
|
|
103
93
|
viewportSize: {
|
|
@@ -115,23 +105,33 @@ exports.Popover = react_1["default"].forwardRef(function (props, componentRef) {
|
|
|
115
105
|
anchorSize: anchorSize,
|
|
116
106
|
spareDirection: spareDirection
|
|
117
107
|
}), position = _k.position, direction = _k.direction;
|
|
118
|
-
|
|
108
|
+
var content = isRenderProp(children) ? children(direction) : children;
|
|
109
|
+
react_1.useLayoutEffect(function () { return onSetDirection === null || onSetDirection === void 0 ? void 0 : onSetDirection(direction); }, [direction]);
|
|
110
|
+
react_1.useLayoutEffect(resetBannedDirections, [props]);
|
|
111
|
+
react_1.useEffect(updateAnchorClientRect, [anchorSize]);
|
|
112
|
+
usePopoverReposition_1.usePopoverReposition({
|
|
113
|
+
scrollAnchorRef: anchorRef || { current: null },
|
|
114
|
+
onRequestReposition: function () {
|
|
115
|
+
resetBannedDirections();
|
|
116
|
+
updateAnchorClientRect();
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
119
|
/**
|
|
120
120
|
* Может возникнуть ситуация, когда перерасчет поповера всегда будет выдавать 2 направления
|
|
121
121
|
* и бесконечно зацикливать себя. Для избежания таких кейсов мы запоминаем стороны,
|
|
122
122
|
* которые не подошли, чтобы не возвращаться к ним и предотвратить бесконечный ререндер.
|
|
123
123
|
* См. PopoverBannedPositionsStory
|
|
124
124
|
*/
|
|
125
|
-
if (
|
|
126
|
-
if (
|
|
127
|
-
setBannedDirections(
|
|
125
|
+
if (previousDirectionRef.current !== direction) {
|
|
126
|
+
if (previousDirectionRef.current && !bannedDirections.includes(previousDirectionRef.current)) {
|
|
127
|
+
setBannedDirections(function (state) {
|
|
128
|
+
return previousDirectionRef.current ? tslib_1.__spread(state, [previousDirectionRef.current]) : state;
|
|
129
|
+
});
|
|
128
130
|
}
|
|
129
131
|
previousDirectionRef.current = direction;
|
|
130
132
|
}
|
|
131
133
|
// Сбрасываем при любом изменении пропсов, чтобы заново начать перебор направлений
|
|
132
134
|
// Главное не сбрасывать при изменении размеров поповера, т.к. именно оно может вызвать бесконечный перебор
|
|
133
|
-
react_1["default"].useLayoutEffect(resetBannedDirections, [props]);
|
|
134
|
-
var content = isRenderProp(children) ? children(direction) : children;
|
|
135
135
|
return (react_1["default"].createElement(PortalWithTheme_1.PortalWithTheme, tslib_1.__assign({}, otherProps, { preset: theme, className: cnPopover({ direction: direction }, [className]), container: window.document.body, ref: useForkRef_1.useForkRef([ref, componentRef]), style: tslib_1.__assign(tslib_1.__assign({}, style), (_a = {}, _a['--popover-top'] = ((position === null || position === void 0 ? void 0 : position.y) || 0) + window.scrollY + "px", _a['--popover-left'] = ((position === null || position === void 0 ? void 0 : position.x) || 0) + window.scrollX + "px", _a["--popover-width"] = equalAnchorWidth ? anchorSize.width + "px" : undefined, _a["--popover-pointer-events"] = isInteractive ? undefined : 'none', _a["--popover-visibility"] = position ? undefined : 'hidden', _a["--popover-offset"] = typeof offset === 'string' ? "var(--space-" + offset + ")" : offset + "px", _a)) }),
|
|
136
136
|
react_1["default"].createElement(ContextConsumer, { onClickOutside: onClickOutside, ignoreClicksInsideRefs: [ref, anchorRef || { current: null }] }, content)));
|
|
137
137
|
});
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/** Запрос репозиции поповера при ресайзе окна и скролле */
|
|
3
|
-
export declare const usePopoverReposition: ({
|
|
4
|
-
isActive: boolean;
|
|
3
|
+
export declare const usePopoverReposition: ({ scrollAnchorRef, onRequestReposition, }: {
|
|
5
4
|
/** При скролле родителей этого элемента будет запрашиваться репозиция поповера */
|
|
6
5
|
scrollAnchorRef: React.RefObject<HTMLElement | null>;
|
|
7
6
|
onRequestReposition: () => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
3
|
exports.usePopoverReposition = void 0;
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var react_1 = require("react");
|
|
5
|
+
var useMutableRef_1 = require("../../hooks/useMutableRef/useMutableRef");
|
|
6
6
|
var getAllParents = function (element) {
|
|
7
7
|
var mutableParents = [];
|
|
8
8
|
var currentNode = element;
|
|
@@ -14,19 +14,19 @@ var getAllParents = function (element) {
|
|
|
14
14
|
};
|
|
15
15
|
/** Запрос репозиции поповера при ресайзе окна и скролле */
|
|
16
16
|
exports.usePopoverReposition = function (_a) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [
|
|
17
|
+
var scrollAnchorRef = _a.scrollAnchorRef, onRequestReposition = _a.onRequestReposition;
|
|
18
|
+
var onRequestRepositionRef = useMutableRef_1.useMutableRef(onRequestReposition);
|
|
19
|
+
react_1.useEffect(function () {
|
|
20
|
+
window.addEventListener('resize', onRequestRepositionRef.current);
|
|
21
|
+
var allParents = (scrollAnchorRef === null || scrollAnchorRef === void 0 ? void 0 : scrollAnchorRef.current) ? getAllParents(scrollAnchorRef.current) : [];
|
|
22
|
+
allParents.forEach(function (parentEl) {
|
|
23
|
+
return parentEl.addEventListener('scroll', onRequestRepositionRef.current);
|
|
24
|
+
});
|
|
25
|
+
return function () {
|
|
26
|
+
window.removeEventListener('resize', onRequestRepositionRef.current);
|
|
27
|
+
allParents.forEach(function (parentEl) {
|
|
28
|
+
return parentEl.removeEventListener('scroll', onRequestRepositionRef.current);
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
}, [scrollAnchorRef]);
|
|
32
32
|
};
|
package/__internal__/cjs-src/components/SelectComponents/SelectCreateButton/SelectCreateButton.d.ts
CHANGED
|
@@ -10,5 +10,6 @@ declare type SelectCreateButtonProps = PropsWithHTMLAttributes<{
|
|
|
10
10
|
size: PropSize;
|
|
11
11
|
indent: 'normal' | 'increased';
|
|
12
12
|
}, HTMLDivElement>;
|
|
13
|
+
export declare const cnSelectCreateButton: import("@bem-react/classname").ClassNameFormatter;
|
|
13
14
|
export declare const SelectCreateButton: React.FC<SelectCreateButtonProps>;
|
|
14
15
|
export {};
|
package/__internal__/cjs-src/components/SelectComponents/SelectCreateButton/SelectCreateButton.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.SelectCreateButton = void 0;
|
|
3
|
+
exports.SelectCreateButton = exports.cnSelectCreateButton = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./SelectCreateButton.css");
|
|
6
6
|
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
7
|
var bem_1 = require("../../../utils/bem");
|
|
8
|
-
|
|
8
|
+
exports.cnSelectCreateButton = bem_1.cn('SelectCreateButton');
|
|
9
9
|
exports.SelectCreateButton = function (props) {
|
|
10
10
|
var className = props.className, labelForCreate = props.labelForCreate, inputValue = props.inputValue, active = props.active, hovered = props.hovered, size = props.size, indent = props.indent, otherProps = tslib_1.__rest(props, ["className", "labelForCreate", "inputValue", "active", "hovered", "size", "indent"]);
|
|
11
|
-
return (react_1["default"].createElement("div", tslib_1.__assign({}, otherProps, { className: cnSelectCreateButton({ active: active, hovered: hovered, size: size, indent: indent }, [className]), "aria-selected": active, role: "option" }),
|
|
11
|
+
return (react_1["default"].createElement("div", tslib_1.__assign({}, otherProps, { className: exports.cnSelectCreateButton({ active: active, hovered: hovered, size: size, indent: indent }, [className]), "aria-selected": active, role: "option" }),
|
|
12
12
|
labelForCreate,
|
|
13
13
|
" \u00AB",
|
|
14
14
|
react_1["default"].createElement("b", null, inputValue),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.SelectLoader = void 0;
|
|
3
|
+
exports.SelectLoader = exports.cnSelectLoader = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./SelectLoader.css");
|
|
6
6
|
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
7
|
var bem_1 = require("../../../utils/bem");
|
|
8
8
|
var Loader_1 = require("../../Loader/Loader");
|
|
9
9
|
var types_1 = require("../types");
|
|
10
|
-
|
|
10
|
+
exports.cnSelectLoader = bem_1.cn('SelectLoader');
|
|
11
11
|
exports.SelectLoader = function (props) {
|
|
12
12
|
var _a = props.mode, mode = _a === void 0 ? 'empty' : _a, _b = props.size, size = _b === void 0 ? types_1.defaultPropSize : _b;
|
|
13
|
-
return (react_1["default"].createElement("div", { className: cnSelectLoader({ mode: mode, size: size }) },
|
|
14
|
-
react_1["default"].createElement(Loader_1.Loader, { className: cnSelectLoader('Loader'), size: "s" })));
|
|
13
|
+
return (react_1["default"].createElement("div", { className: exports.cnSelectLoader({ mode: mode, size: size }) },
|
|
14
|
+
react_1["default"].createElement(Loader_1.Loader, { className: exports.cnSelectLoader('Loader'), size: "s" })));
|
|
15
15
|
};
|
|
@@ -16,7 +16,7 @@ exports.TableRowsCollapse = function (props) {
|
|
|
16
16
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
17
17
|
react_1["default"].createElement("div", { style: style, className: exports.cnTableRowsCollapse(), onClick: toggleCollapse, onKeyDown: toggleCollapse },
|
|
18
18
|
!isExpandedByDefault && withCollapseButton && (react_1["default"].createElement("div", { className: exports.cnTableRowsCollapse('buttonContainer') },
|
|
19
|
-
react_1["default"].createElement(Button_1.Button, { iconLeft: isExpanded ? IconArrowUp_1.IconArrowUp : IconArrowDown_1.IconArrowDown, iconSize: "s", size: "xs", onlyIcon: true, view: "clear" }))),
|
|
19
|
+
react_1["default"].createElement(Button_1.Button, { "aria-expanded": isExpanded, iconLeft: isExpanded ? IconArrowUp_1.IconArrowUp : IconArrowDown_1.IconArrowDown, iconSize: "s", size: "xs", onlyIcon: true, view: "clear" }))),
|
|
20
20
|
react_1["default"].createElement("div", { className: exports.cnTableRowsCollapse('cellContainer', {
|
|
21
21
|
withExpanderPadding: !isExpandedByDefault
|
|
22
22
|
}) }, children)));
|
|
@@ -60,7 +60,7 @@ var sortingData = function (rows, sorting, onSortBy) {
|
|
|
60
60
|
var defaultEmptyRowsPlaceholder = (react_1["default"].createElement(Text_1.Text, { as: "span", view: "primary", size: "s", lineHeight: "s" }, "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445"));
|
|
61
61
|
var InternalTable = function (props, ref) {
|
|
62
62
|
var _a, _b, _c, _d;
|
|
63
|
-
var columns = props.columns, rows = props.rows, _e = props.size, size = _e === void 0 ? 'l' : _e, rawFilters = props.filters, _f = props.isResizable, isResizable = _f === void 0 ? false : _f, _g = props.stickyHeader, stickyHeader = _g === void 0 ? false : _g, _h = props.stickyColumns, stickyColumns = _h === void 0 ? 0 : _h, _j = props.minColumnWidth, minColumnWidth = _j === void 0 ? 150 : _j, activeRow = props.activeRow, _k = props.verticalAlign, verticalAlign = _k === void 0 ? 'top' : _k, _l = props.headerVerticalAlign, headerVerticalAlign = _l === void 0 ? 'center' : _l, zebraStriped = props.zebraStriped, _m = props.borderBetweenRows, borderBetweenRows = _m === void 0 ? false : _m, _o = props.borderBetweenColumns, borderBetweenColumns = _o === void 0 ? false : _o, _p = props.emptyRowsPlaceholder, emptyRowsPlaceholder = _p === void 0 ? defaultEmptyRowsPlaceholder : _p, className = props.className, onRowHover = props.onRowHover, onRowClick = props.onRowClick, onRowCreate = props.onRowCreate, onCellClick = props.onCellClick, getAdditionalClassName = props.getAdditionalClassName, _q = props.rowCreateText, rowCreateText = _q === void 0 ? '+ Добавить строку' : _q, lazyLoad = props.lazyLoad, onSortBy = props.onSortBy, onFiltersUpdated = props.onFiltersUpdated, getTagLabel = props.getTagLabel, _r = props.isExpandedRowsByDefault, isExpandedRowsByDefault = _r === void 0 ? false : _r;
|
|
63
|
+
var columns = props.columns, rows = props.rows, _e = props.size, size = _e === void 0 ? 'l' : _e, rawFilters = props.filters, _f = props.isResizable, isResizable = _f === void 0 ? false : _f, _g = props.stickyHeader, stickyHeader = _g === void 0 ? false : _g, _h = props.stickyColumns, stickyColumns = _h === void 0 ? 0 : _h, _j = props.minColumnWidth, minColumnWidth = _j === void 0 ? 150 : _j, activeRow = props.activeRow, _k = props.verticalAlign, verticalAlign = _k === void 0 ? 'top' : _k, _l = props.headerVerticalAlign, headerVerticalAlign = _l === void 0 ? 'center' : _l, zebraStriped = props.zebraStriped, _m = props.borderBetweenRows, borderBetweenRows = _m === void 0 ? false : _m, _o = props.borderBetweenColumns, borderBetweenColumns = _o === void 0 ? false : _o, _p = props.emptyRowsPlaceholder, emptyRowsPlaceholder = _p === void 0 ? defaultEmptyRowsPlaceholder : _p, className = props.className, onRowHover = props.onRowHover, onRowClick = props.onRowClick, onRowCreate = props.onRowCreate, onCellClick = props.onCellClick, getAdditionalClassName = props.getAdditionalClassName, _q = props.rowCreateText, rowCreateText = _q === void 0 ? '+ Добавить строку' : _q, lazyLoad = props.lazyLoad, onSortBy = props.onSortBy, onFiltersUpdated = props.onFiltersUpdated, getTagLabel = props.getTagLabel, _r = props.isExpandedRowsByDefault, isExpandedRowsByDefault = _r === void 0 ? false : _r, otherProps = tslib_1.__rest(props, ["columns", "rows", "size", "filters", "isResizable", "stickyHeader", "stickyColumns", "minColumnWidth", "activeRow", "verticalAlign", "headerVerticalAlign", "zebraStriped", "borderBetweenRows", "borderBetweenColumns", "emptyRowsPlaceholder", "className", "onRowHover", "onRowClick", "onRowCreate", "onCellClick", "getAdditionalClassName", "rowCreateText", "lazyLoad", "onSortBy", "onFiltersUpdated", "getTagLabel", "isExpandedRowsByDefault"]);
|
|
64
64
|
var _s = helpers_1.useHeaderData(columns), headers = _s.headers, flattenedHeaders = _s.flattenedHeaders, lowHeaders = _s.lowHeaders, headerRowsRefs = _s.headerRowsRefs, headerRowsHeights = _s.headerRowsHeights, resizerTopOffsets = _s.resizerTopOffsets;
|
|
65
65
|
var stickyColumnsGrid = ((_a = headers[0][stickyColumns - 1]) === null || _a === void 0 ? void 0 : _a.position.gridIndex) +
|
|
66
66
|
(((_b = headers[0][stickyColumns - 1]) === null || _b === void 0 ? void 0 : _b.position.colSpan) || 1);
|
|
@@ -344,12 +344,12 @@ var InternalTable = function (props, ref) {
|
|
|
344
344
|
var handleCellClick = function (params) {
|
|
345
345
|
onCellClick === null || onCellClick === void 0 ? void 0 : onCellClick(params);
|
|
346
346
|
};
|
|
347
|
-
return (react_1["default"].createElement("div", { ref: useForkRef_1.useForkRef([tableRef, ref]), className: cnTable({
|
|
347
|
+
return (react_1["default"].createElement("div", tslib_1.__assign({}, otherProps, { ref: useForkRef_1.useForkRef([tableRef, ref]), className: cnTable({
|
|
348
348
|
size: size,
|
|
349
349
|
isResizable: isResizable,
|
|
350
350
|
zebraStriped: zebraStriped,
|
|
351
351
|
withBorderBottom: !filteredData.length
|
|
352
|
-
}, [className]), style: tableStyle, onScroll: handleScroll },
|
|
352
|
+
}, [className]), style: tableStyle, onScroll: handleScroll }),
|
|
353
353
|
columnsWithMetaData(lowHeaders).map(function (column, columnIdx) { return (react_1["default"].createElement(TableCell_1.TableCell, { type: "resizer", key: columnIdx, ref: function (ref) {
|
|
354
354
|
columnsRefs.current[columnIdx] = ref;
|
|
355
355
|
}, style: {
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
.ContextMenuCanary-Level_playAnimation.MixPopoverAnimate {
|
|
10
10
|
opacity: 0 !important;
|
|
11
|
-
pointer-events: none;
|
|
12
11
|
-webkit-transition: opacity 0.2s, -webkit-transform 0.2s !important;
|
|
13
12
|
transition: opacity 0.2s, -webkit-transform 0.2s !important;
|
|
14
13
|
transition: opacity 0.2s, transform 0.2s !important;
|
|
@@ -16,3 +15,7 @@
|
|
|
16
15
|
-webkit-transform: var(--mix-dropdown-animate-transform) !important;
|
|
17
16
|
transform: var(--mix-dropdown-animate-transform) !important;
|
|
18
17
|
}
|
|
18
|
+
|
|
19
|
+
.ContextMenuCanary-Level_eventsNone.MixPopoverAnimate {
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
@@ -15,12 +15,16 @@ function ContextMenuRender(props, ref) {
|
|
|
15
15
|
var levelRef = useForkRef([ref, nodeRef]);
|
|
16
16
|
var _a = usePropsHandler(COMPONENT_NAME, props, levelRef), isOpen = _a.isOpen, className = _a.className, onSetDirection = _a.onSetDirection, otherProps = __rest(_a, ["isOpen", "className", "onSetDirection"]);
|
|
17
17
|
var _b = __read(useFlag(), 2), playAnimation = _b[0], setPlayAnimation = _b[1];
|
|
18
|
-
var _c = __read(
|
|
18
|
+
var _c = __read(useFlag(true), 2), eventsNone = _c[0], setEventsNone = _c[1];
|
|
19
|
+
var _d = __read(useState(props.direction), 2), direction = _d[0], setDirection = _d[1];
|
|
19
20
|
var handleSetDirection = function (d) {
|
|
20
21
|
setDirection(d);
|
|
21
22
|
onSetDirection === null || onSetDirection === void 0 ? void 0 : onSetDirection(d);
|
|
22
23
|
};
|
|
23
|
-
return (React.createElement(Transition, { "in": isOpen, unmountOnExit: true, timeout: animateTimeout,
|
|
24
|
+
return (React.createElement(Transition, { "in": isOpen, unmountOnExit: true, timeout: animateTimeout, onEntered: setEventsNone.off, onEnter: setPlayAnimation.off, onExit: function () {
|
|
25
|
+
setPlayAnimation.on();
|
|
26
|
+
setEventsNone.on();
|
|
27
|
+
}, nodeRef: nodeRef }, function (animate) { return (React.createElement(ContextMenuLevels, __assign({}, otherProps, { ref: levelRef, onSetDirection: handleSetDirection, className: cnContextMenu('Level', { playAnimation: playAnimation, eventsNone: eventsNone }, [
|
|
24
28
|
className,
|
|
25
29
|
cnMixPopoverAnimate({ animate: animate, direction: direction }),
|
|
26
30
|
]) }))); }));
|