@qoretechnologies/reqore 0.35.2 → 0.36.0

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.
Files changed (50) hide show
  1. package/dist/components/Collection/index.d.ts +11 -2
  2. package/dist/components/Collection/index.d.ts.map +1 -1
  3. package/dist/components/Collection/index.js +33 -7
  4. package/dist/components/Collection/index.js.map +1 -1
  5. package/dist/components/KeyValueTable/index.d.ts +27 -0
  6. package/dist/components/KeyValueTable/index.d.ts.map +1 -0
  7. package/dist/components/KeyValueTable/index.js +87 -0
  8. package/dist/components/KeyValueTable/index.js.map +1 -0
  9. package/dist/components/Table/body.d.ts +0 -1
  10. package/dist/components/Table/body.d.ts.map +1 -1
  11. package/dist/components/Table/body.js +6 -2
  12. package/dist/components/Table/body.js.map +1 -1
  13. package/dist/components/Table/index.d.ts +3 -1
  14. package/dist/components/Table/index.d.ts.map +1 -1
  15. package/dist/components/Table/index.js +50 -39
  16. package/dist/components/Table/index.js.map +1 -1
  17. package/dist/components/Table/row.d.ts.map +1 -1
  18. package/dist/components/Table/row.js +9 -3
  19. package/dist/components/Table/row.js.map +1 -1
  20. package/dist/components/Table/value.d.ts +7 -0
  21. package/dist/components/Table/value.d.ts.map +1 -0
  22. package/dist/components/Table/value.js +37 -0
  23. package/dist/components/Table/value.js.map +1 -0
  24. package/dist/components/Tree/index.d.ts +3 -1
  25. package/dist/components/Tree/index.d.ts.map +1 -1
  26. package/dist/components/Tree/index.js +9 -2
  27. package/dist/components/Tree/index.js.map +1 -1
  28. package/dist/constants/paging.d.ts +1 -0
  29. package/dist/constants/paging.d.ts.map +1 -1
  30. package/dist/constants/paging.js +20 -1
  31. package/dist/constants/paging.js.map +1 -1
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +6 -2
  35. package/dist/index.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/Collection/index.tsx +41 -6
  38. package/src/components/KeyValueTable/index.tsx +123 -0
  39. package/src/components/Table/body.tsx +9 -4
  40. package/src/components/Table/index.tsx +86 -52
  41. package/src/components/Table/row.tsx +9 -3
  42. package/src/components/Table/value.tsx +27 -0
  43. package/src/components/Tree/index.tsx +13 -2
  44. package/src/constants/paging.ts +22 -0
  45. package/src/index.tsx +2 -0
  46. package/src/stories/Collection/Collection.stories.tsx +16 -0
  47. package/src/stories/KeyValueTable/KeyValueTable.stories.tsx +199 -0
  48. package/src/stories/Table/Table.stories.tsx +18 -1
  49. package/src/stories/Tree/Tree.stories.tsx +13 -0
  50. package/tests.json +1 -1
@@ -0,0 +1,199 @@
1
+ import { Meta, Story } from '@storybook/react/types-6-0';
2
+ import ReqoreIcon from '../../components/Icon';
3
+ import { IReqoreKeyValueTableProps, ReqoreKeyValueTable } from '../../components/KeyValueTable';
4
+ import {
5
+ IReqoreTableProps,
6
+ IReqoreTableRowData,
7
+ TReqoreTableColumnContent,
8
+ } from '../../components/Table';
9
+ import { TReqorePaginationType } from '../../constants/paging';
10
+ import { CustomIntentArg, FlatArg, IntentArg, SizeArg, argManager } from '../utils/args';
11
+
12
+ const { createArg } = argManager<IReqoreKeyValueTableProps>();
13
+
14
+ export default {
15
+ title: 'Collections/Key Value Table/Stories',
16
+ argTypes: {
17
+ ...createArg('rounded', {
18
+ type: 'boolean',
19
+ name: 'Rounded',
20
+ description: 'If the table should have rounded corners',
21
+ }),
22
+ ...createArg('striped', {
23
+ type: 'boolean',
24
+ name: 'Striped',
25
+ description: 'If the table should have striped rows',
26
+ }),
27
+ ...createArg('width', {
28
+ type: 'number',
29
+ defaultValue: undefined,
30
+ name: 'Width',
31
+ description: 'The width of the table',
32
+ }),
33
+ ...createArg('height', {
34
+ type: 'number',
35
+ defaultValue: 600,
36
+ name: 'Height',
37
+ description: 'The height of the table',
38
+ }),
39
+ ...createArg('data', {
40
+ defaultValue: {
41
+ firstName: 'Filip',
42
+ lastName: 'Machinia',
43
+ age: 25,
44
+ married: false,
45
+ 'In Relationship': true,
46
+ DOB: '1995-01-01',
47
+ occupation: 'Software Engineer',
48
+ address: {
49
+ street: 'Some street',
50
+ city: 'Some city',
51
+ country: 'Some country',
52
+ },
53
+ groups: ['Admin', 'User'],
54
+ race: 'Human',
55
+ sex: 'Male',
56
+ height: 180,
57
+ weight: 80,
58
+ device: undefined,
59
+ OS: 'MacOS',
60
+ browser: 'Chrome',
61
+ email: 'test@test.com',
62
+ phone: '+420 123 456 789',
63
+ website: 'https://machinia.com',
64
+ company: 'Machinia',
65
+ },
66
+ name: 'Data',
67
+ description: 'The data to be displayed in the table',
68
+ }),
69
+ ...createArg('fill', {
70
+ type: 'boolean',
71
+ defaultValue: false,
72
+ name: 'Fill',
73
+ description: 'Whether the table should fill the parent',
74
+ }),
75
+ ...SizeArg,
76
+ ...FlatArg,
77
+ ...IntentArg,
78
+ ...CustomIntentArg('selectedRowIntent'),
79
+ },
80
+ } as Meta<IReqoreTableProps>;
81
+
82
+ const Template: Story<IReqoreKeyValueTableProps> = (args) => {
83
+ return <ReqoreKeyValueTable label='Table' {...args} />;
84
+ };
85
+
86
+ export const Basic = Template.bind({});
87
+ export const NoLabel = Template.bind({});
88
+ NoLabel.args = {
89
+ label: undefined,
90
+ };
91
+
92
+ export const CustomWidth = Template.bind({});
93
+ CustomWidth.args = {
94
+ width: 400,
95
+ };
96
+
97
+ export const NotFlat = Template.bind({});
98
+ NotFlat.args = {
99
+ flat: false,
100
+ };
101
+ export const Striped = Template.bind({});
102
+ Striped.args = {
103
+ striped: true,
104
+ };
105
+ export const Filterable = Template.bind({});
106
+ Filterable.args = {
107
+ filterable: true,
108
+ };
109
+ export const DefaultFilter = Template.bind({});
110
+ DefaultFilter.args = {
111
+ filterable: true,
112
+ filter: 'Mach',
113
+ };
114
+
115
+ export const DefaultValueFilter = Template.bind({});
116
+ DefaultValueFilter.args = {
117
+ defaultValueFilter: 80,
118
+ };
119
+
120
+ export const AllFiltersActive = Template.bind({});
121
+ AllFiltersActive.args = {
122
+ filterable: true,
123
+ filter: 1,
124
+ defaultValueFilter: 80,
125
+ };
126
+
127
+ export const NoDataMessage = Template.bind({});
128
+ NoDataMessage.args = {
129
+ filterable: true,
130
+ filter: 'asjkghakshgjkashg',
131
+ };
132
+
133
+ export const Zoomable = Template.bind({});
134
+ Zoomable.args = {
135
+ zoomable: true,
136
+ };
137
+
138
+ export const FillParent = Template.bind({});
139
+ FillParent.args = {
140
+ fill: true,
141
+ };
142
+
143
+ export const Sizes = Template.bind({});
144
+ Sizes.args = {
145
+ size: 'small',
146
+ filterable: true,
147
+ wrapperSize: 'big',
148
+ };
149
+
150
+ export const DefaultPaging = Template.bind({});
151
+ DefaultPaging.args = {
152
+ paging: 'buttons',
153
+ };
154
+
155
+ export const CustomColumnWidths = Template.bind({});
156
+ CustomColumnWidths.args = {
157
+ minValueWidth: 500,
158
+ maxKeyWidth: 100,
159
+ };
160
+
161
+ export const CustomKeyIntent = Template.bind({});
162
+ CustomKeyIntent.args = {
163
+ keyColumnIntent: 'success',
164
+ };
165
+
166
+ export const CustomAlign = Template.bind({});
167
+ CustomAlign.args = {
168
+ keyAlign: 'right',
169
+ valueAlign: 'center',
170
+ };
171
+
172
+ export const CustomPaging = Template.bind({});
173
+ CustomPaging.args = {
174
+ paging: {
175
+ fluid: true,
176
+ loadMoreLabel: 'Load more rows...',
177
+ showLabels: true,
178
+ infinite: true,
179
+ itemsPerPage: 2,
180
+ } as TReqorePaginationType<IReqoreTableRowData>,
181
+ };
182
+
183
+ export const CustomValueRenderer = Template.bind({});
184
+ CustomValueRenderer.args = {
185
+ valueRenderer: ({ value, tableKey }, Component): TReqoreTableColumnContent | JSX.Element => {
186
+ switch (tableKey) {
187
+ case 'race':
188
+ return 'tag:success';
189
+ case 'sex':
190
+ return <ReqoreIcon icon={value === 'Male' ? 'User6Line' : 'User6Fill'} />;
191
+ case 'height':
192
+ return <>{value} cm</>;
193
+ case 'weight':
194
+ return <Component value={value} />;
195
+ default:
196
+ return undefined;
197
+ }
198
+ },
199
+ };
@@ -1,8 +1,9 @@
1
1
  import { Meta, Story } from '@storybook/react/types-6-0';
2
2
  import { StyledEffect } from '../../components/Effect';
3
- import { IReqoreTableColumn, IReqoreTableProps } from '../../components/Table';
3
+ import { IReqoreTableColumn, IReqoreTableProps, IReqoreTableRowData } from '../../components/Table';
4
4
  import { IReqoreCustomTableBodyCellProps } from '../../components/Table/cell';
5
5
  import { IReqoreCustomHeaderCellProps } from '../../components/Table/header';
6
+ import { TReqorePaginationType } from '../../constants/paging';
6
7
  import {
7
8
  ReqoreH3,
8
9
  ReqoreH4,
@@ -430,6 +431,22 @@ Sizes.args = {
430
431
  wrapperSize: 'big',
431
432
  };
432
433
 
434
+ export const DefaultPaging = Template.bind({});
435
+ DefaultPaging.args = {
436
+ paging: 'buttons',
437
+ };
438
+
439
+ export const CustomPaging = Template.bind({});
440
+ CustomPaging.args = {
441
+ paging: {
442
+ fluid: true,
443
+ loadMoreLabel: 'Load more rows...',
444
+ showLabels: true,
445
+ infinite: true,
446
+ itemsPerPage: 100,
447
+ } as TReqorePaginationType<IReqoreTableRowData>,
448
+ };
449
+
433
450
  const CustomHeaderCell = (props: IReqoreCustomHeaderCellProps) => {
434
451
  if (props.hasColumns) {
435
452
  return <ReqoreH3 intent='success'>{props.label}</ReqoreH3>;
@@ -47,3 +47,16 @@ export const NoControls = Template.bind({});
47
47
  NoControls.args = {
48
48
  showControls: false,
49
49
  };
50
+
51
+ export const Zoomable = Template.bind({});
52
+ Zoomable.args = {
53
+ zoomable: true,
54
+ };
55
+
56
+ export const WithDefaultZoom = Template.bind({});
57
+ WithDefaultZoom.args = {
58
+ label: 'Collection of items',
59
+ zoomable: true,
60
+ size: 'tiny',
61
+ defaultZoom: 2,
62
+ };