@true-engineering/true-react-common-ui-kit 4.0.0-alpha44 → 4.0.0-alpha45
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/dist/components/ControlWrapper/ControlWrapper.d.ts +2 -2
- package/dist/components/ControlWrapper/constants.d.ts +1 -0
- package/dist/components/ControlWrapper/index.d.ts +1 -0
- package/dist/components/ControlWrapper/types.d.ts +2 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/helpers/misc.d.ts +1 -0
- package/dist/true-react-common-ui-kit.js +169 -259
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +169 -259
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +3 -6
- package/src/components/AccountInfo/AccountInfo.stories.tsx +19 -27
- package/src/components/AddButton/AddButton.stories.tsx +14 -17
- package/src/components/Button/Button.stories.tsx +7 -24
- package/src/components/Checkbox/Checkbox.stories.tsx +24 -26
- package/src/components/CloseButton/CloseButton.stories.tsx +5 -6
- package/src/components/Colors/Colors.stories.tsx +63 -3
- package/src/components/ControlWrapper/ControlWrapper.stories.tsx +43 -38
- package/src/components/ControlWrapper/ControlWrapper.tsx +2 -11
- package/src/components/ControlWrapper/constants.ts +11 -0
- package/src/components/ControlWrapper/index.ts +1 -0
- package/src/components/ControlWrapper/types.ts +3 -0
- package/src/components/DateInput/DateInput.stories.tsx +13 -30
- package/src/components/DatePicker/DatePicker.stories.tsx +15 -52
- package/src/components/Description/Description.stories.tsx +11 -16
- package/src/components/FileInput/FileInput.stories.tsx +59 -63
- package/src/components/FileItem/FileItem.stories.tsx +46 -45
- package/src/components/FiltersPane/FiltersPane.stories.tsx +27 -30
- package/src/components/Flag/Flag.stories.tsx +15 -20
- package/src/components/FlexibleTable/FlexibleTable.stories.tsx +47 -50
- package/src/components/FloatDocActions/FloatDocActions.stories.tsx +18 -24
- package/src/components/Icon/Icon.stories.tsx +9 -5
- package/src/components/IconButton/IconButton.stories.tsx +7 -11
- package/src/components/IncrementInput/IncrementInput.stories.tsx +25 -25
- package/src/components/Input/Input.stories.tsx +35 -61
- package/src/components/List/List.stories.tsx +22 -17
- package/src/components/List/List.styles.ts +2 -1
- package/src/components/Modal/Modal.stories.tsx +50 -59
- package/src/components/MoreMenu/MoreMenu.stories.tsx +24 -15
- package/src/components/MultiSelect/MultiSelect.stories.tsx +23 -20
- package/src/components/NewMoreMenu/NewMoreMenu.stories.tsx +42 -40
- package/src/components/Notification/Notification.stories.tsx +34 -32
- package/src/components/NumberInput/NumberInput.stories.tsx +27 -27
- package/src/components/PhoneInput/PhoneInput.stories.tsx +28 -54
- package/src/components/PhoneInput/components/PhoneInputCountryList/PhoneInputCountryList.stories.tsx +5 -11
- package/src/components/RadioButton/RadioButton.stories.tsx +27 -30
- package/src/components/SearchInput/SearchInput.stories.tsx +14 -14
- package/src/components/Select/CustomSelect.stories.tsx +29 -33
- package/src/components/Select/MultiSelect.stories.tsx +40 -45
- package/src/components/Select/Select.stories.tsx +40 -45
- package/src/components/Selector/Selector.stories.tsx +25 -27
- package/src/components/Skeleton/Skeleton.stories.tsx +13 -12
- package/src/components/SmartInput/SmartInput.stories.tsx +23 -23
- package/src/components/Status/Status.stories.tsx +28 -29
- package/src/components/Switch/Switch.stories.tsx +19 -26
- package/src/components/TextArea/TextArea.stories.tsx +31 -34
- package/src/components/TextButton/TextButton.stories.tsx +6 -16
- package/src/components/TextWithInfo/TextWithInfo.stories.tsx +13 -21
- package/src/components/TextWithTooltip/TextWithTooltip.stories.tsx +26 -25
- package/src/components/ThemedPreloader/ThemedPreloader.stories.tsx +12 -23
- package/src/components/Toaster/Toaster.stories.tsx +16 -14
- package/src/components/Tooltip/Tooltip.stories.tsx +5 -4
- package/src/components/WithMessages/WithMessages.stories.tsx +16 -20
- package/src/components/WithPopup/WithPopup.stories.tsx +27 -26
- package/src/components/WithTooltip/WithTooltip.stories.tsx +28 -28
- package/src/components/index.ts +0 -1
- package/src/helpers/misc.ts +3 -0
- package/dist/components/Colors/Colors.d.ts +0 -2
- package/dist/components/Colors/Colors.styles.d.ts +0 -1
- package/dist/components/Colors/index.d.ts +0 -1
- package/src/components/Colors/Colors.styles.ts +0 -36
- package/src/components/Colors/Colors.tsx +0 -26
- package/src/components/Colors/index.ts +0 -1
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Meta } from '@storybook/react';
|
|
2
2
|
import { Description } from './Description';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const meta: Meta<typeof Description> = {
|
|
5
5
|
title: 'Data Display/Description',
|
|
6
6
|
component: Description,
|
|
7
|
+
args: {
|
|
8
|
+
text: 'Lorem ipsum dolor, sit amet consectetur adipisicing. Alias necessitatibus quidem nobis molestiae dolor sed at, voluptatum nulla qui enim maiores consectetur dolorum atque odit id ratione pariatur ut nihil. http://google.com',
|
|
9
|
+
moreTitle: 'подробнее',
|
|
10
|
+
lessTitle: 'скрыть',
|
|
11
|
+
truncateIndex: 150,
|
|
12
|
+
isAlwaysOpen: false,
|
|
13
|
+
},
|
|
7
14
|
argTypes: {
|
|
8
15
|
truncateIndex: {
|
|
9
16
|
control: { type: 'range', min: 20, max: 600, step: 10 },
|
|
@@ -11,17 +18,5 @@ export default {
|
|
|
11
18
|
},
|
|
12
19
|
};
|
|
13
20
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const Template: ComponentStory<typeof Description> = (args) => <Description {...args} />;
|
|
18
|
-
|
|
19
|
-
export const Default = Template.bind({});
|
|
20
|
-
|
|
21
|
-
Default.args = {
|
|
22
|
-
text: lorem,
|
|
23
|
-
moreTitle: 'подробнее',
|
|
24
|
-
lessTitle: 'скрыть',
|
|
25
|
-
truncateIndex: 150,
|
|
26
|
-
isAlwaysOpen: false,
|
|
27
|
-
};
|
|
21
|
+
export default meta;
|
|
22
|
+
export const Default = {};
|
|
@@ -1,75 +1,71 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { format } from 'date-fns';
|
|
2
3
|
import { ru } from 'date-fns/locale';
|
|
3
|
-
import {
|
|
4
|
+
import { type Meta } from '@storybook/react';
|
|
4
5
|
import { mimeTypes } from '../../constants';
|
|
6
|
+
import { excludeStorybookParams } from '../../helpers';
|
|
5
7
|
import { FileItem } from '../FileItem';
|
|
6
|
-
import {
|
|
7
|
-
import { FileInput } from './FileInput';
|
|
8
|
+
import { FileInput, IFileInputProps } from './FileInput';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const Story: FC<IFileInputProps> = (args) => {
|
|
11
|
+
const handleAdd = (newFiles: File[]) =>
|
|
12
|
+
console.log(
|
|
13
|
+
'added:',
|
|
14
|
+
newFiles.map(({ name }) => name),
|
|
15
|
+
);
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
return (
|
|
18
|
+
<div style={{ width: 652 }}>
|
|
19
|
+
<FileInput
|
|
20
|
+
{...args}
|
|
21
|
+
tweakStyles={{
|
|
22
|
+
fileList: {
|
|
23
|
+
'& > div': {
|
|
24
|
+
width: '270px',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}}
|
|
28
|
+
text={
|
|
29
|
+
<div style={{ display: 'flex', alignItems: 'center' }}>Перетащите или выберите файл</div>
|
|
30
|
+
}
|
|
31
|
+
fileList={
|
|
32
|
+
<>
|
|
33
|
+
<FileItem
|
|
34
|
+
fileInfo={{ name: 'file1', type: mimeTypes.jpeg, size: 10000 }}
|
|
35
|
+
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
36
|
+
/>
|
|
37
|
+
<FileItem
|
|
38
|
+
fileInfo={{ name: 'file 2', type: mimeTypes.xls }}
|
|
39
|
+
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
40
|
+
isDisabled
|
|
41
|
+
/>
|
|
42
|
+
</>
|
|
43
|
+
}
|
|
44
|
+
onAdd={handleAdd}
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
28
47
|
);
|
|
48
|
+
};
|
|
29
49
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
onAdd: handleAdd,
|
|
47
|
-
tweakStyles: {
|
|
48
|
-
fileList: {
|
|
49
|
-
'& > div': {
|
|
50
|
-
width: '270px',
|
|
51
|
-
},
|
|
50
|
+
const meta: Meta<typeof Story> = {
|
|
51
|
+
title: 'Inputs/FileInput',
|
|
52
|
+
component: Story,
|
|
53
|
+
args: {
|
|
54
|
+
label: 'Скан документа',
|
|
55
|
+
isDragAndDropDisabled: false,
|
|
56
|
+
isRequired: true,
|
|
57
|
+
isReadOnly: false,
|
|
58
|
+
isMultipleDisabled: false,
|
|
59
|
+
isDisabled: false,
|
|
60
|
+
isActive: false,
|
|
61
|
+
description: 'Форматы файла: xlsx, xlsm. Размер — до 1 МБ',
|
|
62
|
+
},
|
|
63
|
+
parameters: {
|
|
64
|
+
controls: {
|
|
65
|
+
exclude: excludeStorybookParams(['text', 'fileList', 'accept']),
|
|
52
66
|
},
|
|
53
67
|
},
|
|
54
|
-
description,
|
|
55
|
-
text,
|
|
56
|
-
fileList: (
|
|
57
|
-
<>
|
|
58
|
-
<FileItem
|
|
59
|
-
fileInfo={{ name: 'file1', type: mimeTypes.jpeg, size: 10000 }}
|
|
60
|
-
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
61
|
-
/>
|
|
62
|
-
<FileItem
|
|
63
|
-
fileInfo={{ name: 'file 2', type: mimeTypes.xls }}
|
|
64
|
-
metadata={<span>Обновлен {format(new Date(), 'dd MMM, HH:mm', { locale: ru })}</span>}
|
|
65
|
-
isDisabled
|
|
66
|
-
/>
|
|
67
|
-
</>
|
|
68
|
-
),
|
|
69
68
|
};
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
exclude: ['onAdd', 'tweakStyles'],
|
|
74
|
-
},
|
|
75
|
-
};
|
|
70
|
+
export default meta;
|
|
71
|
+
export const Default = {};
|
|
@@ -1,58 +1,59 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { format } from 'date-fns';
|
|
2
3
|
import { ru } from 'date-fns/locale';
|
|
3
|
-
import {
|
|
4
|
+
import { type Meta } from '@storybook/react';
|
|
5
|
+
import { excludeStorybookParams } from '../../helpers';
|
|
4
6
|
import { FILE_ITEM_SIZES } from '../FileItem/constants';
|
|
5
7
|
import { iconsMap } from '../Icon';
|
|
6
8
|
import { FileItem, IFileItemProps } from './FileItem';
|
|
7
9
|
|
|
8
|
-
export default {
|
|
9
|
-
title: 'Data Display/FileItem',
|
|
10
|
-
component: FileItem,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
10
|
const icons = [undefined, ...Object.keys(iconsMap)];
|
|
14
11
|
|
|
15
12
|
const preloaderTypes: Array<IFileItemProps['preloaderType']> = ['dots', 'default', 'logo'];
|
|
16
13
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
14
|
+
const Story: FC<IFileItemProps> = (args) => (
|
|
15
|
+
<FileItem
|
|
16
|
+
{...args}
|
|
17
|
+
metadata={
|
|
18
|
+
<span>Обновлен {format(new Date(1712298796990), 'dd MMM, HH:mm', { locale: ru })}</span>
|
|
19
|
+
}
|
|
20
|
+
fileInfo={{
|
|
21
|
+
name: 'Document_Filename.docx',
|
|
22
|
+
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
23
|
+
size: 1000000,
|
|
24
|
+
}}
|
|
25
|
+
onRemove={() => console.log('remove file')}
|
|
26
|
+
onClick={() => new Promise(() => console.log('download file'))}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const meta: Meta<typeof Story> = {
|
|
31
|
+
title: 'Data Display/FileItem',
|
|
32
|
+
component: Story,
|
|
33
|
+
args: {
|
|
34
|
+
icon: undefined,
|
|
35
|
+
error: 'Страшная ошибка',
|
|
36
|
+
itemSize: 'm',
|
|
37
|
+
preloaderType: 'default',
|
|
38
|
+
removeIcon: 'trash-can',
|
|
39
|
+
isDisabled: false,
|
|
40
|
+
areActionsDisabled: false,
|
|
41
|
+
isLoading: false,
|
|
42
|
+
shouldShowSize: true,
|
|
43
|
+
info: 'Нет, Вы это видели вообще?',
|
|
40
44
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
preloaderType: { options: preloaderTypes, control: 'inline-radio' },
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
Default.parameters = {
|
|
55
|
-
controls: {
|
|
56
|
-
exclude: ['data', 'testId', 'tweakStyles', 'onRemove', 'onClick'],
|
|
45
|
+
parameters: {
|
|
46
|
+
controls: {
|
|
47
|
+
exclude: excludeStorybookParams(['fileInfo', 'metadata']),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
argTypes: {
|
|
51
|
+
icon: { options: icons, control: 'select' },
|
|
52
|
+
removeIcon: { options: icons, control: 'select' },
|
|
53
|
+
itemSize: { options: FILE_ITEM_SIZES, control: 'inline-radio' },
|
|
54
|
+
preloaderType: { options: preloaderTypes, control: 'inline-radio' },
|
|
57
55
|
},
|
|
58
56
|
};
|
|
57
|
+
|
|
58
|
+
export default meta;
|
|
59
|
+
export const Default = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactNode, useState } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { FC, ReactNode, useState } from 'react';
|
|
2
|
+
import { type Meta } from '@storybook/react';
|
|
3
3
|
import { IMultiSelectListValues } from '../MultiSelectList';
|
|
4
4
|
import { FiltersPane, IFiltersPaneProps } from './FiltersPane';
|
|
5
5
|
import { FilterSelect } from './components';
|
|
@@ -8,11 +8,13 @@ import { ConfigType, IDatePeriod, IFiltersPaneSearchPayload, IPeriod } from './t
|
|
|
8
8
|
const LONG_STRING = 'or veeeeeeeeery looooooooooooooooooooooooooooooooooooooooong';
|
|
9
9
|
|
|
10
10
|
const convertVToString = (val: { v: string }): string => val.v;
|
|
11
|
+
|
|
11
12
|
const convertVToNode = (val: { v: string }): ReactNode => (
|
|
12
13
|
<b>
|
|
13
14
|
<i>{val.v}</i>
|
|
14
15
|
</b>
|
|
15
16
|
);
|
|
17
|
+
|
|
16
18
|
const fieldTranslates = {
|
|
17
19
|
interval: 'Interval',
|
|
18
20
|
name: 'Name',
|
|
@@ -57,8 +59,7 @@ const fetchOptionsMock = [
|
|
|
57
59
|
'or vee444ee',
|
|
58
60
|
];
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
type ConfigValues = {
|
|
62
|
+
interface ConfigValues extends Record<string, unknown> {
|
|
62
63
|
name: string;
|
|
63
64
|
date: IPeriod;
|
|
64
65
|
select: string;
|
|
@@ -68,9 +69,9 @@ type ConfigValues = {
|
|
|
68
69
|
isActive: boolean;
|
|
69
70
|
selectSearch: string;
|
|
70
71
|
custom: string;
|
|
71
|
-
}
|
|
72
|
+
}
|
|
72
73
|
|
|
73
|
-
interface
|
|
74
|
+
interface IFiltersPaneCustomProps<Values extends Record<string, unknown>, Content>
|
|
74
75
|
extends IFiltersPaneProps<Values, Content> {
|
|
75
76
|
containerWidth: number;
|
|
76
77
|
isSearchDisabled: boolean;
|
|
@@ -82,7 +83,7 @@ interface IFiltersPaneWithCustomProps<Values extends Record<string, unknown>, Co
|
|
|
82
83
|
isSearchAutoSized: boolean;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
const Story: FC<IFiltersPaneCustomProps<ConfigValues, unknown>> = ({
|
|
86
87
|
containerWidth,
|
|
87
88
|
isSearchDisabled,
|
|
88
89
|
shouldShowSettingsButton,
|
|
@@ -92,7 +93,7 @@ function FiltersPaneWithCustomProps<Values extends Record<string, unknown>, Cont
|
|
|
92
93
|
isClearableFields,
|
|
93
94
|
isSearchAutoSized,
|
|
94
95
|
...args
|
|
95
|
-
}
|
|
96
|
+
}) => {
|
|
96
97
|
const config: ConfigType<ConfigValues> = {
|
|
97
98
|
name: {
|
|
98
99
|
name: 'name',
|
|
@@ -264,11 +265,24 @@ function FiltersPaneWithCustomProps<Values extends Record<string, unknown>, Cont
|
|
|
264
265
|
/>
|
|
265
266
|
</div>
|
|
266
267
|
);
|
|
267
|
-
}
|
|
268
|
+
};
|
|
268
269
|
|
|
269
|
-
|
|
270
|
+
const meta: Meta<typeof Story> = {
|
|
270
271
|
title: 'Table/FiltersPane',
|
|
271
|
-
component:
|
|
272
|
+
component: Story,
|
|
273
|
+
args: {
|
|
274
|
+
shouldShowSettingsButton: false,
|
|
275
|
+
isSearchDisabled: false,
|
|
276
|
+
hasClearButton: true,
|
|
277
|
+
isClearableFields: false,
|
|
278
|
+
isDisabled: false,
|
|
279
|
+
shouldRenderDataId: false,
|
|
280
|
+
containerWidth: 400,
|
|
281
|
+
withFieldNameInLabel: true,
|
|
282
|
+
isGroupingEnabled: true,
|
|
283
|
+
checkboxPosition: 'left',
|
|
284
|
+
isSearchAutoSized: false,
|
|
285
|
+
},
|
|
272
286
|
argTypes: {
|
|
273
287
|
containerWidth: {
|
|
274
288
|
control: { type: 'range', min: 100, max: 1000, step: 100 },
|
|
@@ -280,22 +294,5 @@ export default {
|
|
|
280
294
|
},
|
|
281
295
|
};
|
|
282
296
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
);
|
|
286
|
-
|
|
287
|
-
export const Default = Template.bind({});
|
|
288
|
-
|
|
289
|
-
Default.args = {
|
|
290
|
-
shouldShowSettingsButton: false,
|
|
291
|
-
isSearchDisabled: false,
|
|
292
|
-
hasClearButton: true,
|
|
293
|
-
isClearableFields: false,
|
|
294
|
-
isDisabled: false,
|
|
295
|
-
shouldRenderDataId: false,
|
|
296
|
-
containerWidth: 400,
|
|
297
|
-
withFieldNameInLabel: true,
|
|
298
|
-
isGroupingEnabled: true,
|
|
299
|
-
checkboxPosition: 'left',
|
|
300
|
-
isSearchAutoSized: false,
|
|
301
|
-
};
|
|
297
|
+
export default meta;
|
|
298
|
+
export const Default = {};
|
|
@@ -1,30 +1,25 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { countries } from 'country-flag-icons';
|
|
2
|
-
import {
|
|
3
|
-
import { Flag } from './Flag';
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
4
|
+
import { Flag, IFlagProps } from './Flag';
|
|
4
5
|
import { customFlags } from './customFlags';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
title: 'Data Display/Flag',
|
|
8
|
-
component: Flag,
|
|
9
|
-
argTypes: {
|
|
10
|
-
countryCode: { control: 'select', options: [...countries, ...Object.keys(customFlags)] },
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const Template: ComponentStory<typeof Flag> = (args) => (
|
|
7
|
+
const Story: FC<IFlagProps> = (args) => (
|
|
15
8
|
<div style={{ width: 60, height: 40 }}>
|
|
16
9
|
<Flag {...args} />
|
|
17
10
|
</div>
|
|
18
11
|
);
|
|
19
12
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
exclude: ['data'],
|
|
13
|
+
const meta: Meta<typeof Story> = {
|
|
14
|
+
title: 'Data Display/Flag',
|
|
15
|
+
component: Story,
|
|
16
|
+
args: {
|
|
17
|
+
countryCode: 'ug',
|
|
18
|
+
},
|
|
19
|
+
argTypes: {
|
|
20
|
+
countryCode: { control: 'select', options: [...countries, ...Object.keys(customFlags)] },
|
|
29
21
|
},
|
|
30
22
|
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
export const Default = {};
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { isNotEmpty } from '@true-engineering/true-react-platform-helpers';
|
|
3
|
-
import {
|
|
4
|
-
import { FlexibleTable } from './FlexibleTable';
|
|
3
|
+
import { type Meta } from '@storybook/react';
|
|
4
|
+
import { FlexibleTable, IFlexibleTableProps } from './FlexibleTable';
|
|
5
5
|
import { IFlexibleTableConfigType, IValueComponentProps } from './types';
|
|
6
6
|
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Table/FlexibleTable',
|
|
9
|
-
component: FlexibleTable,
|
|
10
|
-
} as ComponentMeta<typeof FlexibleTable>;
|
|
11
|
-
|
|
12
7
|
interface ITableContent {
|
|
13
8
|
contractCode: string;
|
|
14
9
|
validFrom: Date;
|
|
@@ -77,7 +72,7 @@ const config: IFlexibleTableConfigType<ITableContent> = {
|
|
|
77
72
|
|
|
78
73
|
const content: ITableContent[] = [
|
|
79
74
|
{
|
|
80
|
-
contractCode: '
|
|
75
|
+
contractCode: 'SOME_CODE1',
|
|
81
76
|
validFrom: new Date('2015-05-18'),
|
|
82
77
|
validTo: new Date('2020-05-18'),
|
|
83
78
|
title: 'Название',
|
|
@@ -91,7 +86,7 @@ const content: ITableContent[] = [
|
|
|
91
86
|
publicNote: 'Public Note',
|
|
92
87
|
},
|
|
93
88
|
{
|
|
94
|
-
contractCode: '
|
|
89
|
+
contractCode: 'SOME_CODE2',
|
|
95
90
|
validFrom: new Date('2015-05-18'),
|
|
96
91
|
validTo: new Date('2020-05-18'),
|
|
97
92
|
title: 'Название',
|
|
@@ -104,7 +99,7 @@ const content: ITableContent[] = [
|
|
|
104
99
|
note: 'Only Note',
|
|
105
100
|
},
|
|
106
101
|
{
|
|
107
|
-
contractCode: '
|
|
102
|
+
contractCode: 'SOME_CODE3',
|
|
108
103
|
validFrom: new Date('2015-05-18'),
|
|
109
104
|
validTo: new Date('2020-05-18'),
|
|
110
105
|
title: 'Название',
|
|
@@ -117,7 +112,7 @@ const content: ITableContent[] = [
|
|
|
117
112
|
publicNote: 'Only Public Note',
|
|
118
113
|
},
|
|
119
114
|
{
|
|
120
|
-
contractCode: '
|
|
115
|
+
contractCode: 'SOME_CODE4',
|
|
121
116
|
validFrom: new Date('2015-05-18'),
|
|
122
117
|
validTo: new Date('2020-05-18'),
|
|
123
118
|
title: 'Название',
|
|
@@ -129,7 +124,7 @@ const content: ITableContent[] = [
|
|
|
129
124
|
status: 'Active',
|
|
130
125
|
},
|
|
131
126
|
{
|
|
132
|
-
contractCode: '
|
|
127
|
+
contractCode: 'SOME_CODE5',
|
|
133
128
|
validFrom: new Date('2015-05-18'),
|
|
134
129
|
validTo: new Date('2020-05-18'),
|
|
135
130
|
title: 'Название',
|
|
@@ -141,7 +136,7 @@ const content: ITableContent[] = [
|
|
|
141
136
|
status: 'Active',
|
|
142
137
|
},
|
|
143
138
|
{
|
|
144
|
-
contractCode: '
|
|
139
|
+
contractCode: 'SOME_CODE6',
|
|
145
140
|
validFrom: new Date('2015-05-18'),
|
|
146
141
|
validTo: new Date('2020-05-18'),
|
|
147
142
|
title: 'Название',
|
|
@@ -153,7 +148,7 @@ const content: ITableContent[] = [
|
|
|
153
148
|
status: 'Active',
|
|
154
149
|
},
|
|
155
150
|
{
|
|
156
|
-
contractCode: '
|
|
151
|
+
contractCode: 'SOME_CODE7',
|
|
157
152
|
validFrom: new Date('2015-05-18'),
|
|
158
153
|
validTo: new Date('2020-05-18'),
|
|
159
154
|
title: 'Название',
|
|
@@ -165,7 +160,7 @@ const content: ITableContent[] = [
|
|
|
165
160
|
status: 'Active',
|
|
166
161
|
},
|
|
167
162
|
{
|
|
168
|
-
contractCode: '
|
|
163
|
+
contractCode: 'SOME_CODE8',
|
|
169
164
|
validFrom: new Date('2015-05-18'),
|
|
170
165
|
validTo: new Date('2020-05-18'),
|
|
171
166
|
title: 'Название',
|
|
@@ -177,7 +172,7 @@ const content: ITableContent[] = [
|
|
|
177
172
|
status: 'Active',
|
|
178
173
|
},
|
|
179
174
|
{
|
|
180
|
-
contractCode: '
|
|
175
|
+
contractCode: 'SOME_CODE9',
|
|
181
176
|
validFrom: new Date('2015-05-18'),
|
|
182
177
|
validTo: new Date('2020-05-18'),
|
|
183
178
|
title: 'Название',
|
|
@@ -189,7 +184,7 @@ const content: ITableContent[] = [
|
|
|
189
184
|
status: 'Active',
|
|
190
185
|
},
|
|
191
186
|
{
|
|
192
|
-
contractCode: '
|
|
187
|
+
contractCode: 'SOME_CODE10',
|
|
193
188
|
validFrom: new Date('2015-05-18'),
|
|
194
189
|
validTo: new Date('2020-05-18'),
|
|
195
190
|
title: 'Название',
|
|
@@ -201,7 +196,7 @@ const content: ITableContent[] = [
|
|
|
201
196
|
status: 'Active',
|
|
202
197
|
},
|
|
203
198
|
{
|
|
204
|
-
contractCode: '
|
|
199
|
+
contractCode: 'SOME_CODE11',
|
|
205
200
|
validFrom: new Date('2015-05-18'),
|
|
206
201
|
validTo: new Date('2020-05-18'),
|
|
207
202
|
title: 'Название',
|
|
@@ -213,7 +208,7 @@ const content: ITableContent[] = [
|
|
|
213
208
|
status: 'Active',
|
|
214
209
|
},
|
|
215
210
|
{
|
|
216
|
-
contractCode: '
|
|
211
|
+
contractCode: 'SOME_CODE12',
|
|
217
212
|
validFrom: new Date('2015-05-18'),
|
|
218
213
|
validTo: new Date('2020-05-18'),
|
|
219
214
|
title: 'Название',
|
|
@@ -225,7 +220,7 @@ const content: ITableContent[] = [
|
|
|
225
220
|
status: 'Active',
|
|
226
221
|
},
|
|
227
222
|
{
|
|
228
|
-
contractCode: '
|
|
223
|
+
contractCode: 'OB_UT_M13',
|
|
229
224
|
validFrom: new Date('2015-05-18'),
|
|
230
225
|
validTo: new Date('2020-05-18'),
|
|
231
226
|
title: 'Название',
|
|
@@ -237,7 +232,7 @@ const content: ITableContent[] = [
|
|
|
237
232
|
status: 'Active',
|
|
238
233
|
},
|
|
239
234
|
{
|
|
240
|
-
contractCode: '
|
|
235
|
+
contractCode: 'SOME_CODE14',
|
|
241
236
|
validFrom: new Date('2015-05-18'),
|
|
242
237
|
validTo: new Date('2020-05-18'),
|
|
243
238
|
title: 'Название',
|
|
@@ -250,13 +245,15 @@ const content: ITableContent[] = [
|
|
|
250
245
|
},
|
|
251
246
|
];
|
|
252
247
|
|
|
253
|
-
const
|
|
248
|
+
const Story: FC<IFlexibleTableProps<ITableContent, unknown, 'contractCode'>> = (args) => (
|
|
254
249
|
<div style={{ width: 700, overflow: 'auto' }}>
|
|
255
250
|
<FlexibleTable<ITableContent>
|
|
256
251
|
{...args}
|
|
257
252
|
config={config}
|
|
258
253
|
content={content}
|
|
259
254
|
rowAttributes={['contractCode']}
|
|
255
|
+
enabledColumns={undefined}
|
|
256
|
+
uniqueField="contractCode"
|
|
260
257
|
expandableRowComponent={(_0, _1, close) => (
|
|
261
258
|
<div onClick={close}>
|
|
262
259
|
всем привет :)
|
|
@@ -268,33 +265,33 @@ const Template: ComponentStory<typeof FlexibleTable<ITableContent>> = (args) =>
|
|
|
268
265
|
</div>
|
|
269
266
|
);
|
|
270
267
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
'onRowHover',
|
|
297
|
-
'expandableRowComponent',
|
|
298
|
-
],
|
|
268
|
+
const meta: Meta<typeof Story> = {
|
|
269
|
+
title: 'Table/FlexibleTable',
|
|
270
|
+
component: Story,
|
|
271
|
+
args: {
|
|
272
|
+
isLoading: false,
|
|
273
|
+
isFirstColumnSticky: true,
|
|
274
|
+
isHorizontallyScrollable: true,
|
|
275
|
+
isExpandableRowComponentInitiallyOpen: false,
|
|
276
|
+
},
|
|
277
|
+
parameters: {
|
|
278
|
+
controls: {
|
|
279
|
+
exclude: [
|
|
280
|
+
'data',
|
|
281
|
+
'testId',
|
|
282
|
+
'content',
|
|
283
|
+
'config',
|
|
284
|
+
'rowAttributes',
|
|
285
|
+
'headerContent',
|
|
286
|
+
'tweakStyles',
|
|
287
|
+
'onHeadClick',
|
|
288
|
+
'onRowClick',
|
|
289
|
+
'onRowHover',
|
|
290
|
+
'expandableRowComponent',
|
|
291
|
+
],
|
|
292
|
+
},
|
|
299
293
|
},
|
|
300
294
|
};
|
|
295
|
+
|
|
296
|
+
export default meta;
|
|
297
|
+
export const Default = {};
|