@dhis2-ui/table 10.0.0-alpha.6 → 10.0.0-alpha.8
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/build/cjs/data-table/__tests__/data-table-cell.test.js +26 -26
- package/build/cjs/data-table/__tests__/data-table-column-header/filter-handle.test.js +3 -3
- package/build/cjs/data-table/__tests__/data-table-column-header/sorter.test.js +2 -2
- package/build/cjs/data-table/__tests__/data-table-column-header.test.js +18 -18
- package/build/cjs/data-table/__tests__/data-table-row/expand-handle-cell.js +3 -3
- package/build/cjs/data-table/__tests__/data-table-row/expanded-row.test.js +6 -6
- package/build/cjs/data-table/__tests__/data-table-row.test.js +13 -13
- package/build/cjs/data-table/__tests__/data-table.test.js +11 -11
- package/build/cjs/data-table/data-table-cell.js +4 -10
- package/build/cjs/data-table/data-table-column-header/data-table-column-header.js +1 -4
- package/build/cjs/data-table/data-table-row/data-table-row.js +1 -4
- package/build/cjs/data-table/data-table.js +3 -8
- package/build/cjs/data-table/table-elements/__tests__/table-body.test.js +5 -5
- package/build/cjs/data-table/table-elements/__tests__/table-data-cell.test.js +19 -19
- package/build/cjs/data-table/table-elements/__tests__/table-foot.test.js +5 -5
- package/build/cjs/data-table/table-elements/__tests__/table-head.test.js +5 -5
- package/build/cjs/data-table/table-elements/__tests__/table-header-cell-action.test.js +6 -6
- package/build/cjs/data-table/table-elements/__tests__/table-header-cell.test.js +20 -20
- package/build/cjs/data-table/table-elements/__tests__/table-row.test.js +7 -7
- package/build/cjs/data-table/table-elements/__tests__/table-scroll-box.test.js +6 -6
- package/build/cjs/data-table/table-elements/__tests__/table-toolbar.test.js +7 -7
- package/build/cjs/data-table/table-elements/__tests__/table.test.js +8 -8
- package/build/cjs/data-table/table-elements/table-body.js +1 -4
- package/build/cjs/data-table/table-elements/table-data-cell/table-data-cell.js +4 -10
- package/build/cjs/data-table/table-elements/table-foot.js +1 -4
- package/build/cjs/data-table/table-elements/table-head.js +0 -3
- package/build/cjs/data-table/table-elements/table-header-cell/table-header-cell.js +5 -12
- package/build/cjs/data-table/table-elements/table-header-cell-action.js +1 -4
- package/build/cjs/data-table/table-elements/table-row.js +1 -4
- package/build/cjs/data-table/table-elements/table-scroll-box.js +3 -8
- package/build/cjs/data-table/table-elements/table-toolbar.js +2 -6
- package/build/cjs/data-table/table-elements/table.js +3 -8
- package/build/cjs/stacked-table/stacked-table-body.js +1 -4
- package/build/cjs/stacked-table/stacked-table-cell-head.js +2 -6
- package/build/cjs/stacked-table/stacked-table-cell.js +3 -6
- package/build/cjs/stacked-table/stacked-table-foot.js +1 -4
- package/build/cjs/stacked-table/stacked-table-head.js +1 -4
- package/build/cjs/stacked-table/stacked-table-row-head.js +1 -4
- package/build/cjs/stacked-table/stacked-table-row.js +1 -4
- package/build/cjs/stacked-table/stacked-table.js +1 -4
- package/build/cjs/stacked-table/stacked-table.test.js +3 -3
- package/build/cjs/table/table-body.js +1 -4
- package/build/cjs/table/table-cell-head.js +1 -4
- package/build/cjs/table/table-cell.js +1 -4
- package/build/cjs/table/table-foot.js +1 -4
- package/build/cjs/table/table-head.js +1 -4
- package/build/cjs/table/table-row-head.js +1 -4
- package/build/cjs/table/table-row.js +1 -4
- package/build/cjs/table/table.js +1 -4
- package/build/es/data-table/__tests__/data-table-cell.test.js +26 -26
- package/build/es/data-table/__tests__/data-table-column-header/filter-handle.test.js +3 -3
- package/build/es/data-table/__tests__/data-table-column-header/sorter.test.js +2 -2
- package/build/es/data-table/__tests__/data-table-column-header.test.js +18 -18
- package/build/es/data-table/__tests__/data-table-row/expand-handle-cell.js +3 -3
- package/build/es/data-table/__tests__/data-table-row/expanded-row.test.js +6 -6
- package/build/es/data-table/__tests__/data-table-row.test.js +13 -13
- package/build/es/data-table/__tests__/data-table.test.js +11 -11
- package/build/es/data-table/data-table-cell.js +4 -10
- package/build/es/data-table/data-table-column-header/data-table-column-header.js +1 -4
- package/build/es/data-table/data-table-row/data-table-row.js +1 -4
- package/build/es/data-table/data-table.js +3 -8
- package/build/es/data-table/table-elements/__tests__/table-body.test.js +5 -5
- package/build/es/data-table/table-elements/__tests__/table-data-cell.test.js +19 -19
- package/build/es/data-table/table-elements/__tests__/table-foot.test.js +5 -5
- package/build/es/data-table/table-elements/__tests__/table-head.test.js +5 -5
- package/build/es/data-table/table-elements/__tests__/table-header-cell-action.test.js +6 -6
- package/build/es/data-table/table-elements/__tests__/table-header-cell.test.js +20 -20
- package/build/es/data-table/table-elements/__tests__/table-row.test.js +7 -7
- package/build/es/data-table/table-elements/__tests__/table-scroll-box.test.js +6 -6
- package/build/es/data-table/table-elements/__tests__/table-toolbar.test.js +7 -7
- package/build/es/data-table/table-elements/__tests__/table.test.js +8 -8
- package/build/es/data-table/table-elements/table-body.js +1 -4
- package/build/es/data-table/table-elements/table-data-cell/table-data-cell.js +4 -10
- package/build/es/data-table/table-elements/table-foot.js +1 -4
- package/build/es/data-table/table-elements/table-head.js +0 -3
- package/build/es/data-table/table-elements/table-header-cell/table-header-cell.js +5 -12
- package/build/es/data-table/table-elements/table-header-cell-action.js +1 -4
- package/build/es/data-table/table-elements/table-row.js +1 -4
- package/build/es/data-table/table-elements/table-scroll-box.js +3 -8
- package/build/es/data-table/table-elements/table-toolbar.js +2 -6
- package/build/es/data-table/table-elements/table.js +3 -8
- package/build/es/stacked-table/stacked-table-body.js +1 -4
- package/build/es/stacked-table/stacked-table-cell-head.js +2 -6
- package/build/es/stacked-table/stacked-table-cell.js +3 -6
- package/build/es/stacked-table/stacked-table-foot.js +1 -4
- package/build/es/stacked-table/stacked-table-head.js +1 -4
- package/build/es/stacked-table/stacked-table-row-head.js +1 -4
- package/build/es/stacked-table/stacked-table-row.js +1 -4
- package/build/es/stacked-table/stacked-table.js +1 -4
- package/build/es/stacked-table/stacked-table.test.js +3 -3
- package/build/es/table/table-body.js +1 -4
- package/build/es/table/table-cell-head.js +1 -4
- package/build/es/table/table-cell.js +1 -4
- package/build/es/table/table-foot.js +1 -4
- package/build/es/table/table-head.js +1 -4
- package/build/es/table/table-row-head.js +1 -4
- package/build/es/table/table-row.js +1 -4
- package/build/es/table/table.js +1 -4
- package/package.json +7 -7
|
@@ -4,132 +4,132 @@ import { TableHeaderCell } from '../table-header-cell/table-header-cell.js';
|
|
|
4
4
|
describe('<TableHeaderCell>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
13
13
|
ref: ref
|
|
14
14
|
})))));
|
|
15
15
|
expect(wrapper.find('th').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts an active prop', () => {
|
|
18
|
-
const wrapper = shallow(
|
|
18
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
19
19
|
active: true
|
|
20
20
|
}));
|
|
21
21
|
expect(wrapper.find('th').hasClass('active')).toBe(true);
|
|
22
22
|
});
|
|
23
23
|
it('accepts an align prop', () => {
|
|
24
24
|
const align = 'right';
|
|
25
|
-
const wrapper = shallow(
|
|
25
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
26
26
|
align: align
|
|
27
27
|
}));
|
|
28
28
|
expect(wrapper.html()).toContain(`text-align: ${align};`);
|
|
29
29
|
});
|
|
30
30
|
it('accepts a bordered prop', () => {
|
|
31
|
-
const wrapper = shallow(
|
|
31
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
32
32
|
bordered: true
|
|
33
33
|
}));
|
|
34
34
|
expect(wrapper.find('th').hasClass('bordered')).toBe(true);
|
|
35
35
|
});
|
|
36
36
|
it('accepts a className prop', () => {
|
|
37
37
|
const className = 'test';
|
|
38
|
-
const wrapper = shallow(
|
|
38
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
39
39
|
className: className
|
|
40
40
|
}));
|
|
41
41
|
expect(wrapper.find('th').hasClass(className)).toBe(true);
|
|
42
42
|
});
|
|
43
43
|
it('accepts a colSpan prop', () => {
|
|
44
44
|
const colSpan = '3';
|
|
45
|
-
const wrapper = shallow(
|
|
45
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
46
46
|
colSpan: colSpan
|
|
47
47
|
}));
|
|
48
48
|
expect(wrapper.find('th').prop('colSpan')).toBe(colSpan);
|
|
49
49
|
});
|
|
50
50
|
it('accepts a dataTest prop', () => {
|
|
51
51
|
const dataTest = 'test';
|
|
52
|
-
const wrapper = shallow(
|
|
52
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
53
53
|
dataTest: dataTest
|
|
54
54
|
}));
|
|
55
55
|
expect(wrapper.find('th').prop('data-test')).toBe(dataTest);
|
|
56
56
|
});
|
|
57
57
|
it('accepts an error prop', () => {
|
|
58
|
-
const wrapper = shallow(
|
|
58
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
59
59
|
error: true
|
|
60
60
|
}));
|
|
61
61
|
expect(wrapper.find('th').hasClass('error')).toBe(true);
|
|
62
62
|
});
|
|
63
63
|
it('accepts a fixed prop', () => {
|
|
64
|
-
const wrapper = shallow(
|
|
64
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
65
65
|
fixed: true
|
|
66
66
|
}));
|
|
67
67
|
expect(wrapper.type()).toBe('th');
|
|
68
68
|
expect(wrapper.find('th').hasClass('fixed')).toBe(true);
|
|
69
69
|
});
|
|
70
70
|
it('accepts a large prop', () => {
|
|
71
|
-
const wrapper = shallow(
|
|
71
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
72
72
|
large: true
|
|
73
73
|
}));
|
|
74
74
|
expect(wrapper.find('th').hasClass('large')).toBe(true);
|
|
75
75
|
});
|
|
76
76
|
it('accepts a left prop', () => {
|
|
77
77
|
const left = '200px';
|
|
78
|
-
const wrapper = shallow(
|
|
78
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
79
79
|
left: left
|
|
80
80
|
}));
|
|
81
81
|
expect(wrapper.html()).toContain(`inset-inline-start: ${left};`);
|
|
82
82
|
});
|
|
83
83
|
it('accepts an muted prop', () => {
|
|
84
|
-
const wrapper = shallow(
|
|
84
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
85
85
|
muted: true
|
|
86
86
|
}));
|
|
87
87
|
expect(wrapper.find('th').hasClass('muted')).toBe(true);
|
|
88
88
|
});
|
|
89
89
|
it('accepts a role prop', () => {
|
|
90
90
|
const role = 'test';
|
|
91
|
-
const wrapper = shallow(
|
|
91
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
92
92
|
role: role
|
|
93
93
|
}));
|
|
94
94
|
expect(wrapper.find('th').prop('role')).toBe(role);
|
|
95
95
|
});
|
|
96
96
|
it('accepts a rowSpan prop', () => {
|
|
97
97
|
const rowSpan = '3';
|
|
98
|
-
const wrapper = shallow(
|
|
98
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
99
99
|
rowSpan: rowSpan
|
|
100
100
|
}));
|
|
101
101
|
expect(wrapper.find('th').prop('rowSpan')).toBe(rowSpan);
|
|
102
102
|
});
|
|
103
103
|
it('accepts a scope prop', () => {
|
|
104
104
|
const scope = 'row';
|
|
105
|
-
const wrapper = shallow(
|
|
105
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
106
106
|
scope: scope
|
|
107
107
|
}));
|
|
108
108
|
expect(wrapper.find('th').prop('scope')).toBe(scope);
|
|
109
109
|
});
|
|
110
110
|
it('accepts a top prop', () => {
|
|
111
111
|
const top = '200px';
|
|
112
|
-
const wrapper = shallow(
|
|
112
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
113
113
|
top: top
|
|
114
114
|
}));
|
|
115
115
|
expect(wrapper.html()).toContain(`top: ${top};`);
|
|
116
116
|
});
|
|
117
117
|
it('accepts a valid prop', () => {
|
|
118
|
-
const wrapper = shallow(
|
|
118
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
119
119
|
valid: true
|
|
120
120
|
}));
|
|
121
121
|
expect(wrapper.find('th').hasClass('valid')).toBe(true);
|
|
122
122
|
});
|
|
123
123
|
it('accepts a width prop', () => {
|
|
124
124
|
const width = '200px';
|
|
125
|
-
const wrapper = shallow(
|
|
125
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
126
126
|
width: width
|
|
127
127
|
}));
|
|
128
128
|
expect(wrapper.html()).toContain(`width: ${width};`);
|
|
129
129
|
});
|
|
130
130
|
it('accepts an onClick prop', () => {
|
|
131
131
|
const onClick = jest.fn();
|
|
132
|
-
const wrapper = shallow(
|
|
132
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
133
133
|
onClick: onClick
|
|
134
134
|
}));
|
|
135
135
|
wrapper.simulate('click');
|
|
@@ -4,45 +4,45 @@ import { TableRow } from '../table-row.js';
|
|
|
4
4
|
describe('<TableRow>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement("table", null, /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(TableRow, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}))));
|
|
15
15
|
expect(wrapper.find('tr').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('tr').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('tr').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a draggable prop', () => {
|
|
32
|
-
const wrapper = shallow(
|
|
32
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
33
33
|
draggable: true
|
|
34
34
|
}));
|
|
35
35
|
expect(wrapper.find('tr').hasClass('draggable')).toBe(true);
|
|
36
36
|
});
|
|
37
37
|
it('accepts a role prop', () => {
|
|
38
38
|
const role = 'test';
|
|
39
|
-
const wrapper = shallow(
|
|
39
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
40
40
|
role: role
|
|
41
41
|
}));
|
|
42
42
|
expect(wrapper.find('tr').prop('role')).toBe(role);
|
|
43
43
|
});
|
|
44
44
|
it('accepts a selected prop', () => {
|
|
45
|
-
const wrapper = shallow(
|
|
45
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableRow, {
|
|
46
46
|
selected: true
|
|
47
47
|
}));
|
|
48
48
|
expect(wrapper.find('tr').hasClass('selected')).toBe(true);
|
|
@@ -4,40 +4,40 @@ import { TableScrollBox } from '../table-scroll-box.js';
|
|
|
4
4
|
describe('<TableScrollBox>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}));
|
|
15
15
|
expect(wrapper.find('div').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('div').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('div').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a maxHeight prop', () => {
|
|
32
32
|
const maxHeight = '200px';
|
|
33
|
-
const wrapper = shallow(
|
|
33
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
34
34
|
maxHeight: maxHeight
|
|
35
35
|
}));
|
|
36
36
|
expect(wrapper.html()).toContain('max-height: 200px;');
|
|
37
37
|
});
|
|
38
38
|
it('accepts a maxWidth prop', () => {
|
|
39
39
|
const maxWidth = '200px';
|
|
40
|
-
const wrapper = shallow(
|
|
40
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableScrollBox, {
|
|
41
41
|
maxWidth: maxWidth
|
|
42
42
|
}));
|
|
43
43
|
expect(wrapper.html()).toContain('max-width: 200px;');
|
|
@@ -4,36 +4,36 @@ import { TableToolbar } from '../table-toolbar.js';
|
|
|
4
4
|
describe('<TableToolbar>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableToolbar, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}));
|
|
15
15
|
expect(wrapper.find('div').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a className prop', () => {
|
|
18
18
|
const className = 'test';
|
|
19
|
-
const wrapper = shallow(
|
|
19
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
20
20
|
className: className
|
|
21
21
|
}));
|
|
22
22
|
expect(wrapper.find('div').hasClass(className)).toBe(true);
|
|
23
23
|
});
|
|
24
24
|
it('accepts a dataTest prop', () => {
|
|
25
25
|
const dataTest = 'test';
|
|
26
|
-
const wrapper = shallow(
|
|
26
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
27
27
|
dataTest: dataTest
|
|
28
28
|
}));
|
|
29
29
|
expect(wrapper.find('div').prop('data-test')).toBe(dataTest);
|
|
30
30
|
});
|
|
31
31
|
it('accepts a position prop', () => {
|
|
32
|
-
const wrapperDefault = shallow(
|
|
33
|
-
const wrapperTop = shallow(
|
|
32
|
+
const wrapperDefault = shallow(/*#__PURE__*/React.createElement(TableToolbar, null));
|
|
33
|
+
const wrapperTop = shallow(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
34
34
|
position: "top"
|
|
35
35
|
}));
|
|
36
|
-
const wrapperBottom = shallow(
|
|
36
|
+
const wrapperBottom = shallow(/*#__PURE__*/React.createElement(TableToolbar, {
|
|
37
37
|
position: "bottom"
|
|
38
38
|
}));
|
|
39
39
|
expect(wrapperDefault.find('div').hasClass('top')).toBe(true);
|
|
@@ -4,53 +4,53 @@ import { Table } from '../table.js';
|
|
|
4
4
|
describe('<Table>', () => {
|
|
5
5
|
it('renders children', () => {
|
|
6
6
|
const children = 'children';
|
|
7
|
-
const wrapper = shallow(
|
|
7
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, null, children));
|
|
8
8
|
expect(wrapper.containsMatchingElement(children)).toBe(true);
|
|
9
9
|
});
|
|
10
10
|
it('accepts a ref', () => {
|
|
11
11
|
const ref = /*#__PURE__*/React.createRef();
|
|
12
|
-
const wrapper = mount(
|
|
12
|
+
const wrapper = mount(/*#__PURE__*/React.createElement(Table, {
|
|
13
13
|
ref: ref
|
|
14
14
|
}));
|
|
15
15
|
expect(wrapper.find('table').getDOMNode()).toBe(ref.current);
|
|
16
16
|
});
|
|
17
17
|
it('accepts a borderless prop', () => {
|
|
18
|
-
const wrapper = shallow(
|
|
18
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
19
19
|
borderless: true
|
|
20
20
|
}));
|
|
21
21
|
expect(wrapper.find('table').hasClass('borderless')).toBe(true);
|
|
22
22
|
});
|
|
23
23
|
it('accepts a className prop', () => {
|
|
24
24
|
const className = 'test';
|
|
25
|
-
const wrapper = shallow(
|
|
25
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
26
26
|
className: className
|
|
27
27
|
}));
|
|
28
28
|
expect(wrapper.find('table').hasClass(className)).toBe(true);
|
|
29
29
|
});
|
|
30
30
|
it('accepts a dataTest prop', () => {
|
|
31
31
|
const dataTest = 'test';
|
|
32
|
-
const wrapper = shallow(
|
|
32
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
33
33
|
dataTest: dataTest
|
|
34
34
|
}));
|
|
35
35
|
expect(wrapper.find('table').prop('data-test')).toBe(dataTest);
|
|
36
36
|
});
|
|
37
37
|
it('accepts a layout prop', () => {
|
|
38
38
|
const layout = 'fixed';
|
|
39
|
-
const wrapper = shallow(
|
|
39
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
40
40
|
layout: layout
|
|
41
41
|
}));
|
|
42
42
|
expect(wrapper.html()).toContain(`table-layout: ${layout};`);
|
|
43
43
|
});
|
|
44
44
|
it('accepts a role prop', () => {
|
|
45
45
|
const role = 'test';
|
|
46
|
-
const wrapper = shallow(
|
|
46
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
47
47
|
role: role
|
|
48
48
|
}));
|
|
49
49
|
expect(wrapper.find('table').prop('role')).toBe(role);
|
|
50
50
|
});
|
|
51
51
|
it('accepts a width prop', () => {
|
|
52
52
|
const width = '200px';
|
|
53
|
-
const wrapper = shallow(
|
|
53
|
+
const wrapper = shallow(/*#__PURE__*/React.createElement(Table, {
|
|
54
54
|
width: width
|
|
55
55
|
}));
|
|
56
56
|
expect(wrapper.html()).toContain(`width: ${width};`);
|
|
@@ -8,7 +8,7 @@ export const TableBody = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
8
8
|
let {
|
|
9
9
|
children,
|
|
10
10
|
className,
|
|
11
|
-
dataTest,
|
|
11
|
+
dataTest = 'dhis2-uicore-tablebody',
|
|
12
12
|
role,
|
|
13
13
|
loading,
|
|
14
14
|
...props
|
|
@@ -26,9 +26,6 @@ export const TableBody = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
26
26
|
}, ["tbody.__jsx-style-dynamic-selector{position:relative;}", ".loading.__jsx-style-dynamic-selector:before{content:'';position:absolute;top:0;bottom:0;inset-inline-start:0;inset-inline-end:0;background-color:rgba(255,255,255,0.8);}", `.loading.__jsx-style-dynamic-selector:after{content:'';position:absolute;top:calc(50% - 24px);inset-inline-start:calc(50% - 24px);width:48px;height:48px;border:6px solid rgba(110,122,138,0.15);border-bottom-color:${colors.blue600};border-radius:50%;-webkit-animation:rotation-__jsx-style-dynamic-selector 1s linear infinite;animation:rotation-__jsx-style-dynamic-selector 1s linear infinite;}`, "@-webkit-keyframes rotation-__jsx-style-dynamic-selector{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}", "@keyframes rotation-__jsx-style-dynamic-selector{0%{-webkit-transform:rotate(0);-ms-transform:rotate(0);transform:rotate(0);}100%{-webkit-transform:rotate(360deg);-ms-transform:rotate(360deg);transform:rotate(360deg);}}"]));
|
|
27
27
|
});
|
|
28
28
|
TableBody.displayName = 'TableBody';
|
|
29
|
-
TableBody.defaultProps = {
|
|
30
|
-
dataTest: 'dhis2-uicore-tablebody'
|
|
31
|
-
};
|
|
32
29
|
TableBody.propTypes = {
|
|
33
30
|
/** Should be `<TableRow>` components */
|
|
34
31
|
children: PropTypes.node,
|
|
@@ -15,23 +15,23 @@ export const TableDataCell = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
15
15
|
var _rtlCorrespondingAlig;
|
|
16
16
|
let {
|
|
17
17
|
active,
|
|
18
|
-
align,
|
|
18
|
+
align = 'left',
|
|
19
19
|
backgroundColor,
|
|
20
20
|
bordered,
|
|
21
21
|
children,
|
|
22
22
|
className,
|
|
23
23
|
colSpan,
|
|
24
|
-
dataTest,
|
|
24
|
+
dataTest = 'dhis2-uicore-tabledatacel',
|
|
25
25
|
error,
|
|
26
26
|
large,
|
|
27
|
-
left,
|
|
27
|
+
left = 'auto',
|
|
28
28
|
muted,
|
|
29
29
|
role,
|
|
30
30
|
rowSpan,
|
|
31
31
|
scope,
|
|
32
32
|
staticStyle,
|
|
33
33
|
valid,
|
|
34
|
-
width,
|
|
34
|
+
width = 'auto',
|
|
35
35
|
onClick,
|
|
36
36
|
...props
|
|
37
37
|
} = _ref;
|
|
@@ -61,12 +61,6 @@ export const TableDataCell = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
61
61
|
}, [`td.__jsx-style-dynamic-selector{inset-inline-start:${left};text-align:${align};width:${width};background-color:${backgroundColor || colors.white};}`, `.__jsx-style-dynamic-selector:dir(rtl){text-align:${rtlAlign};}`, `tr.selected>td.__jsx-style-dynamic-selector{background-color:${backgroundColor || colors.teal100};}`, `tr:hover>td.__jsx-style-dynamic-selector:not(.staticStyle){background-color:${backgroundColor || colors.grey100};}`, `tr:active>td.__jsx-style-dynamic-selector:not(.staticStyle){background-color:${backgroundColor || colors.grey200};}`, `tr.selected:hover>td.__jsx-style-dynamic-selector:not(.staticStyle){background-color:${backgroundColor || '#cdeae8'};}`]));
|
|
62
62
|
});
|
|
63
63
|
TableDataCell.displayName = 'TableDataCell';
|
|
64
|
-
TableDataCell.defaultProps = {
|
|
65
|
-
align: 'left',
|
|
66
|
-
dataTest: 'dhis2-uicore-tabledatacel',
|
|
67
|
-
left: 'auto',
|
|
68
|
-
width: 'auto'
|
|
69
|
-
};
|
|
70
64
|
const stylePropType = mutuallyExclusive(['valid', 'error', 'muted'], PropTypes.bool);
|
|
71
65
|
TableDataCell.propTypes = {
|
|
72
66
|
/** To toggle border color, for example for editing */
|
|
@@ -5,7 +5,7 @@ export const TableFoot = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
7
7
|
className,
|
|
8
|
-
dataTest,
|
|
8
|
+
dataTest = 'dhis2-uicore-tablefoot',
|
|
9
9
|
role,
|
|
10
10
|
...props
|
|
11
11
|
} = _ref;
|
|
@@ -17,9 +17,6 @@ export const TableFoot = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
17
17
|
}), children);
|
|
18
18
|
});
|
|
19
19
|
TableFoot.displayName = 'TableFoot';
|
|
20
|
-
TableFoot.defaultProps = {
|
|
21
|
-
dataTest: 'dhis2-uicore-tablefoot'
|
|
22
|
-
};
|
|
23
20
|
TableFoot.propTypes = {
|
|
24
21
|
/** Should be `<TableRow>` components */
|
|
25
22
|
children: PropTypes.node,
|
|
@@ -17,9 +17,6 @@ export const TableHead = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
17
17
|
}), children);
|
|
18
18
|
});
|
|
19
19
|
TableHead.displayName = 'TableHead';
|
|
20
|
-
TableHead.defaultProps = {
|
|
21
|
-
dataTest: 'dhis2-uicore-tablehead'
|
|
22
|
-
};
|
|
23
20
|
TableHead.propTypes = {
|
|
24
21
|
/** Should be `<TableRowHead>` components */
|
|
25
22
|
children: PropTypes.node,
|
|
@@ -10,25 +10,25 @@ const AUTO = 'auto';
|
|
|
10
10
|
export const TableHeaderCell = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
11
11
|
let {
|
|
12
12
|
active,
|
|
13
|
-
align,
|
|
13
|
+
align = 'left',
|
|
14
14
|
backgroundColor,
|
|
15
15
|
bordered,
|
|
16
16
|
children,
|
|
17
17
|
className,
|
|
18
18
|
colSpan,
|
|
19
|
-
dataTest,
|
|
19
|
+
dataTest = 'dhis2-uicore-tablecell',
|
|
20
20
|
error,
|
|
21
21
|
fixed,
|
|
22
22
|
large,
|
|
23
|
-
left,
|
|
23
|
+
left = AUTO,
|
|
24
24
|
muted,
|
|
25
25
|
rowSpan,
|
|
26
26
|
role,
|
|
27
27
|
scope,
|
|
28
28
|
staticStyle,
|
|
29
|
-
top,
|
|
29
|
+
top = AUTO,
|
|
30
30
|
valid,
|
|
31
|
-
width,
|
|
31
|
+
width = AUTO,
|
|
32
32
|
onClick,
|
|
33
33
|
...props
|
|
34
34
|
} = _ref;
|
|
@@ -59,13 +59,6 @@ export const TableHeaderCell = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
59
59
|
}, [`th.__jsx-style-dynamic-selector{inset-inline-start:${left};top:${top};text-align:${align};width:${width};background-color:${backgroundColor || colors.grey200};}`, `thead th.fixedHorizontally.__jsx-style-dynamic-selector{background-color:${backgroundColor || colors.grey300};}`, `tbody>tr:hover>th.__jsx-style-dynamic-selector:not(.staticStyle),tfoot>tr:hover>th.__jsx-style-dynamic-selector:not(.staticStyle){background-color:${backgroundColor || colors.grey300};}`, `tbody>tr:active>th.__jsx-style-dynamic-selector:not(.staticStyle){background-color:${backgroundColor || colors.grey200};}`]));
|
|
60
60
|
});
|
|
61
61
|
TableHeaderCell.displayName = 'TableHeaderCell';
|
|
62
|
-
TableHeaderCell.defaultProps = {
|
|
63
|
-
align: 'left',
|
|
64
|
-
dataTest: 'dhis2-uicore-tablecell',
|
|
65
|
-
left: AUTO,
|
|
66
|
-
width: AUTO,
|
|
67
|
-
top: AUTO
|
|
68
|
-
};
|
|
69
62
|
const stylePropType = mutuallyExclusive(['valid', 'error', 'muted'], PropTypes.bool);
|
|
70
63
|
TableHeaderCell.propTypes = {
|
|
71
64
|
/** To toggle border color, for example for editing */
|
|
@@ -8,7 +8,7 @@ export const TableHeaderCellAction = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
8
8
|
onClick,
|
|
9
9
|
children,
|
|
10
10
|
className,
|
|
11
|
-
dataTest,
|
|
11
|
+
dataTest = 'dhis2-uicore-tableheadercellaction',
|
|
12
12
|
title,
|
|
13
13
|
...props
|
|
14
14
|
} = _ref;
|
|
@@ -24,9 +24,6 @@ export const TableHeaderCellAction = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
24
24
|
}, ["button.__jsx-style-dynamic-selector{border:none;padding:0;background:transparent;width:24px;height:24px;display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;border-radius:4px;margin-inline-start:2px;}", `button.__jsx-style-dynamic-selector:hover,button.__jsx-style-dynamic-selector:focus-visible{background:${colors.grey400};}`, "button.__jsx-style-dynamic-selector:active,button.__jsx-style-dynamic-selector:focus{outline:none;}"]));
|
|
25
25
|
});
|
|
26
26
|
TableHeaderCellAction.displayName = 'TableHeaderCellAction';
|
|
27
|
-
TableHeaderCellAction.defaultProps = {
|
|
28
|
-
dataTest: 'dhis2-uicore-tableheadercellaction'
|
|
29
|
-
};
|
|
30
27
|
TableHeaderCellAction.propTypes = {
|
|
31
28
|
children: PropTypes.node,
|
|
32
29
|
className: PropTypes.string,
|
|
@@ -7,7 +7,7 @@ export const TableRow = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
7
7
|
let {
|
|
8
8
|
children,
|
|
9
9
|
className,
|
|
10
|
-
dataTest,
|
|
10
|
+
dataTest = 'dhis2-uicore-tablerow',
|
|
11
11
|
draggable,
|
|
12
12
|
role,
|
|
13
13
|
selected,
|
|
@@ -26,9 +26,6 @@ export const TableRow = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
26
26
|
}, ["tbody>tr.draggable.jsx-1820444258,tfoot>tr.draggable.jsx-1820444258{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}"]));
|
|
27
27
|
});
|
|
28
28
|
TableRow.displayName = 'TableRow';
|
|
29
|
-
TableRow.defaultProps = {
|
|
30
|
-
dataTest: 'dhis2-uicore-tablerow'
|
|
31
|
-
};
|
|
32
29
|
TableRow.propTypes = {
|
|
33
30
|
/** Should be `<TableDataCell>` or `<TableDataCellHead>` components */
|
|
34
31
|
children: PropTypes.node,
|
|
@@ -7,9 +7,9 @@ export const TableScrollBox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
7
7
|
let {
|
|
8
8
|
children,
|
|
9
9
|
className,
|
|
10
|
-
dataTest,
|
|
11
|
-
maxHeight,
|
|
12
|
-
maxWidth,
|
|
10
|
+
dataTest = 'dhis2-uicore-tablescrollbox',
|
|
11
|
+
maxHeight = 'auto',
|
|
12
|
+
maxWidth = 'auto',
|
|
13
13
|
...props
|
|
14
14
|
} = _ref;
|
|
15
15
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
@@ -22,11 +22,6 @@ export const TableScrollBox = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
22
22
|
}, [`div.__jsx-style-dynamic-selector{border:1px solid ${colors.grey300};border-top:none;box-sizing:border-box;max-height:${maxHeight};max-width:${maxWidth};overflow:auto;}`]));
|
|
23
23
|
});
|
|
24
24
|
TableScrollBox.displayName = 'TableScrollBox';
|
|
25
|
-
TableScrollBox.defaultProps = {
|
|
26
|
-
dataTest: 'dhis2-uicore-tablescrollbox',
|
|
27
|
-
maxHeight: 'auto',
|
|
28
|
-
maxWidth: 'auto'
|
|
29
|
-
};
|
|
30
25
|
TableScrollBox.propTypes = {
|
|
31
26
|
children: PropTypes.node,
|
|
32
27
|
className: PropTypes.string,
|
|
@@ -8,8 +8,8 @@ export const TableToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
8
8
|
let {
|
|
9
9
|
children,
|
|
10
10
|
className,
|
|
11
|
-
dataTest,
|
|
12
|
-
position,
|
|
11
|
+
dataTest = 'dhis2-uicore-tabletoolbar',
|
|
12
|
+
position = 'top',
|
|
13
13
|
...props
|
|
14
14
|
} = _ref;
|
|
15
15
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
@@ -22,10 +22,6 @@ export const TableToolbar = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
22
22
|
}, [`div.__jsx-style-dynamic-selector{width:100%;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;border:1px solid ${colors.grey300};padding:${spacers.dp12};}`, "div.top.__jsx-style-dynamic-selector{border-bottom:none;}", "div.bottom.__jsx-style-dynamic-selector{border-top:none;}"]));
|
|
23
23
|
});
|
|
24
24
|
TableToolbar.displayName = 'TableToolbar';
|
|
25
|
-
TableToolbar.defaultProps = {
|
|
26
|
-
dataTest: 'dhis2-uicore-tabletoolbar',
|
|
27
|
-
position: 'top'
|
|
28
|
-
};
|
|
29
25
|
TableToolbar.propTypes = {
|
|
30
26
|
children: PropTypes.node,
|
|
31
27
|
className: PropTypes.string,
|
|
@@ -8,11 +8,11 @@ export const Table = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
8
8
|
let {
|
|
9
9
|
children,
|
|
10
10
|
className,
|
|
11
|
-
dataTest,
|
|
12
|
-
layout,
|
|
11
|
+
dataTest = 'dhis2-uicore-table',
|
|
12
|
+
layout = 'auto',
|
|
13
13
|
role,
|
|
14
14
|
borderless,
|
|
15
|
-
width,
|
|
15
|
+
width = '100%',
|
|
16
16
|
...props
|
|
17
17
|
} = _ref;
|
|
18
18
|
return /*#__PURE__*/React.createElement("table", _extends({}, props, {
|
|
@@ -28,11 +28,6 @@ export const Table = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
28
28
|
}, [`table.__jsx-style-dynamic-selector{table-layout:${layout};border-collapse:separate;border-spacing:0;width:${width};box-sizing:border-box;border:1px solid ${colors.grey300};}`, "table.borderless.__jsx-style-dynamic-selector{border:none;}"]));
|
|
29
29
|
});
|
|
30
30
|
Table.displayName = 'Table';
|
|
31
|
-
Table.defaultProps = {
|
|
32
|
-
dataTest: 'dhis2-uicore-table',
|
|
33
|
-
width: '100%',
|
|
34
|
-
layout: 'auto'
|
|
35
|
-
};
|
|
36
31
|
Table.propTypes = {
|
|
37
32
|
/**
|
|
38
33
|
* Removes border from the table
|
|
@@ -5,7 +5,7 @@ export const StackedTableBody = _ref => {
|
|
|
5
5
|
let {
|
|
6
6
|
children,
|
|
7
7
|
className,
|
|
8
|
-
dataTest
|
|
8
|
+
dataTest = 'dhis2-uicore-stackedtablebody'
|
|
9
9
|
} = _ref;
|
|
10
10
|
return /*#__PURE__*/React.createElement("tbody", {
|
|
11
11
|
"data-tset": dataTest,
|
|
@@ -18,7 +18,4 @@ StackedTableBody.propTypes = {
|
|
|
18
18
|
children: PropTypes.node,
|
|
19
19
|
className: PropTypes.string,
|
|
20
20
|
dataTest: PropTypes.string
|
|
21
|
-
};
|
|
22
|
-
StackedTableBody.defaultProps = {
|
|
23
|
-
dataTest: 'dhis2-uicore-stackedtablebody'
|
|
24
21
|
};
|
|
@@ -4,10 +4,10 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
export const StackedTableCellHead = _ref => {
|
|
6
6
|
let {
|
|
7
|
-
children,
|
|
7
|
+
children = '',
|
|
8
8
|
className,
|
|
9
9
|
colSpan,
|
|
10
|
-
dataTest,
|
|
10
|
+
dataTest = 'dhis2-uicore-stackedtablecellhead',
|
|
11
11
|
rowSpan
|
|
12
12
|
} = _ref;
|
|
13
13
|
return /*#__PURE__*/React.createElement("th", {
|
|
@@ -28,8 +28,4 @@ StackedTableCellHead.propTypes = {
|
|
|
28
28
|
colSpan: PropTypes.string,
|
|
29
29
|
dataTest: PropTypes.string,
|
|
30
30
|
rowSpan: PropTypes.string
|
|
31
|
-
};
|
|
32
|
-
StackedTableCellHead.defaultProps = {
|
|
33
|
-
children: '',
|
|
34
|
-
dataTest: 'dhis2-uicore-stackedtablecellhead'
|
|
35
31
|
};
|