@oliasoft-open-source/react-ui-library 2.4.0 → 2.4.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/README.md +0 -1
- package/package.json +1 -1
- package/src/components/table/cell/cell.jsx +20 -17
- package/src/components/table/cell/cell.module.less +33 -19
- package/src/components/table/table.stories-data.jsx +92 -0
- package/src/components/table/table.stories.jsx +2 -85
- package/src/components/table/table.variables.less +0 -8
- package/src/style/mixins.less +2 -1
package/README.md
CHANGED
|
@@ -4,4 +4,3 @@ React UI Library is a collection of reusable UI components for use in React appl
|
|
|
4
4
|
|
|
5
5
|
For usage instructions and technical documentation, see the [Wiki](https://gitlab.com/oliasoft-open-source/react-ui-library/wikis/home).
|
|
6
6
|
|
|
7
|
-
License: [MIT](https://gitlab.com/oliasoft-open-source/react-ui-library/-/blob/master/LICENSE).
|
package/package.json
CHANGED
|
@@ -227,7 +227,7 @@ const StaticCell = (props) => {
|
|
|
227
227
|
const field = (
|
|
228
228
|
<div
|
|
229
229
|
className={cx(
|
|
230
|
-
styles.
|
|
230
|
+
styles.staticCellContent,
|
|
231
231
|
type === 'Unit' ? styles.unit : '',
|
|
232
232
|
error ? styles.error : warning ? styles.warning : '',
|
|
233
233
|
)}
|
|
@@ -245,22 +245,24 @@ const StaticCell = (props) => {
|
|
|
245
245
|
</div>
|
|
246
246
|
);
|
|
247
247
|
return (
|
|
248
|
-
<
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
248
|
+
<div className={styles.inputWrapper}>
|
|
249
|
+
<Tooltip
|
|
250
|
+
error={!!error}
|
|
251
|
+
warning={!!warning}
|
|
252
|
+
text={tooltip || error || warning}
|
|
253
|
+
enabled={
|
|
254
|
+
(tooltip && isStringNumberOrNode(tooltip)) ||
|
|
255
|
+
(error && isStringNumberOrNode(error)) ||
|
|
256
|
+
(warning && isStringNumberOrNode(warning)) ||
|
|
257
|
+
false
|
|
258
|
+
}
|
|
259
|
+
maxWidth={maxTooltipWidth}
|
|
260
|
+
display="block"
|
|
261
|
+
placement="bottom-center"
|
|
262
|
+
>
|
|
263
|
+
{field}
|
|
264
|
+
</Tooltip>
|
|
265
|
+
</div>
|
|
264
266
|
);
|
|
265
267
|
};
|
|
266
268
|
|
|
@@ -364,6 +366,7 @@ export const Cell = (props) => {
|
|
|
364
366
|
cell.type === 'CheckBox' ? styles.checkBoxCell : '',
|
|
365
367
|
cell.type === 'Actions' ? styles.actionsCell : '',
|
|
366
368
|
cell.type === 'Icon' ? styles.iconCell : '',
|
|
369
|
+
cell.type === 'Static' || !cell.type ? styles.staticCell : '',
|
|
367
370
|
cell.hasSort ? styles.sortingCell : null,
|
|
368
371
|
cellAlignmentStyle,
|
|
369
372
|
cell.breakWord ? styles.breakWord : '',
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import '../../../style/variables.less';
|
|
2
|
+
@import '../../../style/mixins.less';
|
|
2
3
|
@import '../table.variables.less';
|
|
3
4
|
|
|
4
5
|
.cellWrapper {
|
|
@@ -55,30 +56,43 @@
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
.staticCell {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
border:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
59
|
+
padding: 0 !important;
|
|
60
|
+
|
|
61
|
+
.staticCellContent {
|
|
62
|
+
min-height: 100%;
|
|
63
|
+
.cellWrapperPadding();
|
|
64
|
+
line-height: 17px;
|
|
65
|
+
position: relative;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
border-radius: inherit;
|
|
69
|
+
|
|
70
|
+
&.error,
|
|
71
|
+
&.warning {
|
|
72
|
+
border: 1px solid transparent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.error {
|
|
76
|
+
.inputError();
|
|
77
|
+
}
|
|
78
|
+
&.warning {
|
|
79
|
+
.inputWarning();
|
|
80
|
+
}
|
|
81
|
+
&.unit {
|
|
82
|
+
font-weight: normal;
|
|
83
|
+
}
|
|
72
84
|
}
|
|
73
85
|
}
|
|
74
86
|
|
|
75
87
|
.sortingCell {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
.staticCellContent {
|
|
89
|
+
position: relative;
|
|
90
|
+
padding-right: 45px !important;
|
|
91
|
+
cursor: pointer !important;
|
|
79
92
|
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
&:hover {
|
|
94
|
+
background-color: rgba(0, 0, 0, 0.05) !important;
|
|
95
|
+
}
|
|
82
96
|
}
|
|
83
97
|
|
|
84
98
|
.sortingCellIcon {
|
|
@@ -764,3 +764,95 @@ export const tableHelpLibraryIcons = {
|
|
|
764
764
|
})),
|
|
765
765
|
})),
|
|
766
766
|
};
|
|
767
|
+
|
|
768
|
+
export const tableOverflowing = {
|
|
769
|
+
columnWidths: [undefined, '100px', '100px', '100px', undefined],
|
|
770
|
+
headers: [
|
|
771
|
+
{
|
|
772
|
+
cells: [
|
|
773
|
+
{ value: 'Name' },
|
|
774
|
+
{ value: 'Weight (kg)' },
|
|
775
|
+
{ value: 'Energy (kcal / 100g)' },
|
|
776
|
+
{ value: 'Origin' },
|
|
777
|
+
{ value: 'Static' },
|
|
778
|
+
],
|
|
779
|
+
},
|
|
780
|
+
],
|
|
781
|
+
rows: [
|
|
782
|
+
{
|
|
783
|
+
cells: [
|
|
784
|
+
{
|
|
785
|
+
breakWord: true,
|
|
786
|
+
value:
|
|
787
|
+
'LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur',
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
type: 'Select',
|
|
791
|
+
native: true,
|
|
792
|
+
options: [
|
|
793
|
+
{ label: 50, value: 50 },
|
|
794
|
+
{ label: 100, value: 100 },
|
|
795
|
+
],
|
|
796
|
+
value: { label: 100, value: 100 },
|
|
797
|
+
onChange: () => {},
|
|
798
|
+
disabled: true,
|
|
799
|
+
},
|
|
800
|
+
{
|
|
801
|
+
type: 'Select',
|
|
802
|
+
options: [
|
|
803
|
+
{ label: 'Vietnam', value: 'Vietnam' },
|
|
804
|
+
{ label: 'Other', value: 'Other' },
|
|
805
|
+
],
|
|
806
|
+
value: { label: 'Vietnam', value: 'Vietnam' },
|
|
807
|
+
onChange: () => {},
|
|
808
|
+
error: 'Error',
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
value: 'Brown rice',
|
|
812
|
+
type: 'Input',
|
|
813
|
+
onChange: () => {},
|
|
814
|
+
testId: 'table-tbody-cell-brown-rice',
|
|
815
|
+
warning: 'Warning message',
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
value: 'Static warning',
|
|
819
|
+
warning: 'Warning message',
|
|
820
|
+
},
|
|
821
|
+
],
|
|
822
|
+
},
|
|
823
|
+
{
|
|
824
|
+
cells: [
|
|
825
|
+
{ value: 'Buckwheat' },
|
|
826
|
+
{
|
|
827
|
+
type: 'Select',
|
|
828
|
+
native: true,
|
|
829
|
+
options: [
|
|
830
|
+
{ label: 50, value: 50 },
|
|
831
|
+
{ label: 100, value: 100 },
|
|
832
|
+
],
|
|
833
|
+
value: { label: 100, value: 100 },
|
|
834
|
+
onChange: () => {},
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
type: 'Select',
|
|
838
|
+
options: [
|
|
839
|
+
{ label: 'Vietnam', value: 'Vietnam' },
|
|
840
|
+
{ label: 'Other', value: 'Other' },
|
|
841
|
+
],
|
|
842
|
+
value: { label: 'Vietnam', value: 'Vietnam' },
|
|
843
|
+
onChange: () => {},
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
value: 'Brown rice',
|
|
847
|
+
type: 'Input',
|
|
848
|
+
onChange: () => {},
|
|
849
|
+
testId: 'table-tbody-cell-brown-rice',
|
|
850
|
+
},
|
|
851
|
+
{
|
|
852
|
+
value: 'Static error',
|
|
853
|
+
error: 'Error message',
|
|
854
|
+
},
|
|
855
|
+
],
|
|
856
|
+
},
|
|
857
|
+
],
|
|
858
|
+
};
|
|
@@ -730,88 +730,5 @@ export const OnRowEnter = () => {
|
|
|
730
730
|
);
|
|
731
731
|
};
|
|
732
732
|
|
|
733
|
-
export const OverflowingCells = ()
|
|
734
|
-
|
|
735
|
-
table={{
|
|
736
|
-
fixedWidth: '100%',
|
|
737
|
-
headers: [
|
|
738
|
-
{
|
|
739
|
-
cells: [
|
|
740
|
-
{ value: 'Name' },
|
|
741
|
-
{ value: 'Weight (kg)' },
|
|
742
|
-
{ value: 'Energy (kcal / 100g)' },
|
|
743
|
-
{ value: 'Origin' },
|
|
744
|
-
],
|
|
745
|
-
},
|
|
746
|
-
],
|
|
747
|
-
rows: [
|
|
748
|
-
{
|
|
749
|
-
cells: [
|
|
750
|
-
{
|
|
751
|
-
breakWord: true,
|
|
752
|
-
value:
|
|
753
|
-
'LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur',
|
|
754
|
-
},
|
|
755
|
-
{
|
|
756
|
-
type: 'Select',
|
|
757
|
-
native: true,
|
|
758
|
-
options: [
|
|
759
|
-
{ label: 50, value: 50 },
|
|
760
|
-
{ label: 100, value: 100 },
|
|
761
|
-
],
|
|
762
|
-
value: { label: 100, value: 100 },
|
|
763
|
-
onChange: () => {},
|
|
764
|
-
disabled: true,
|
|
765
|
-
},
|
|
766
|
-
{
|
|
767
|
-
type: 'Select',
|
|
768
|
-
options: [
|
|
769
|
-
{ label: 'Vietnam', value: 'Vietnam' },
|
|
770
|
-
{ label: 'Other', value: 'Other' },
|
|
771
|
-
],
|
|
772
|
-
value: { label: 'Vietnam', value: 'Vietnam' },
|
|
773
|
-
onChange: () => {},
|
|
774
|
-
error: 'Error',
|
|
775
|
-
},
|
|
776
|
-
{
|
|
777
|
-
value: 'Brown rice',
|
|
778
|
-
type: 'Input',
|
|
779
|
-
onChange: () => {},
|
|
780
|
-
testId: 'table-tbody-cell-brown-rice',
|
|
781
|
-
},
|
|
782
|
-
],
|
|
783
|
-
},
|
|
784
|
-
{
|
|
785
|
-
cells: [
|
|
786
|
-
{ value: 'Buckwheat' },
|
|
787
|
-
{
|
|
788
|
-
type: 'Select',
|
|
789
|
-
native: true,
|
|
790
|
-
options: [
|
|
791
|
-
{ label: 50, value: 50 },
|
|
792
|
-
{ label: 100, value: 100 },
|
|
793
|
-
],
|
|
794
|
-
value: { label: 100, value: 100 },
|
|
795
|
-
onChange: () => {},
|
|
796
|
-
},
|
|
797
|
-
{
|
|
798
|
-
type: 'Select',
|
|
799
|
-
options: [
|
|
800
|
-
{ label: 'Vietnam', value: 'Vietnam' },
|
|
801
|
-
{ label: 'Other', value: 'Other' },
|
|
802
|
-
],
|
|
803
|
-
value: { label: 'Vietnam', value: 'Vietnam' },
|
|
804
|
-
onChange: () => {},
|
|
805
|
-
},
|
|
806
|
-
{
|
|
807
|
-
value: 'Brown rice',
|
|
808
|
-
type: 'Input',
|
|
809
|
-
onChange: () => {},
|
|
810
|
-
testId: 'table-tbody-cell-brown-rice',
|
|
811
|
-
},
|
|
812
|
-
],
|
|
813
|
-
},
|
|
814
|
-
],
|
|
815
|
-
}}
|
|
816
|
-
/>
|
|
817
|
-
);
|
|
733
|
+
export const OverflowingCells = Template.bind({});
|
|
734
|
+
OverflowingCells.args = { table: storyData.tableOverflowing };
|
|
@@ -9,11 +9,3 @@
|
|
|
9
9
|
align-items: center;
|
|
10
10
|
justify-content: space-between;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
.cellErrorWarningWrapper {
|
|
14
|
-
margin: (-@input_padding_y - 1) (-@input_padding_x - 1) !important;
|
|
15
|
-
padding: @input_padding_y @input_padding_x !important;
|
|
16
|
-
display: block;
|
|
17
|
-
line-height: 17px;
|
|
18
|
-
position: relative;
|
|
19
|
-
}
|
package/src/style/mixins.less
CHANGED
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
.inputError,
|
|
30
30
|
.inputWarning {
|
|
31
31
|
position: relative;
|
|
32
|
-
z-index: 1;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
.inputError {
|
|
35
|
+
z-index: 2;
|
|
36
36
|
border-color: var(--color-border-error) !important;
|
|
37
37
|
color: var(--color-text-error) !important;
|
|
38
38
|
background-color: var(--color-background-error);
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
.inputWarning {
|
|
50
|
+
z-index: 1;
|
|
50
51
|
border-color: var(--color-border-warning) !important;
|
|
51
52
|
color: var(--color-text-warning) !important;
|
|
52
53
|
background-color: var(--color-background-warning);
|