@synerise/ds-table 0.46.24 → 0.46.25

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.46.25](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.46.24...@synerise/ds-table@0.46.25) (2023-08-22)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-table
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.46.24](https://github.com/synerise/synerise-design/compare/@synerise/ds-table@0.46.23...@synerise/ds-table@0.46.24) (2023-08-20)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-table
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-table",
3
- "version": "0.46.24",
3
+ "version": "0.46.25",
4
4
  "description": "Table UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -32,26 +32,26 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-alert": "^0.7.37",
35
+ "@synerise/ds-alert": "^0.7.38",
36
36
  "@synerise/ds-button": "^0.18.0",
37
37
  "@synerise/ds-button-group": "^0.6.28",
38
38
  "@synerise/ds-checkbox": "^0.11.39",
39
- "@synerise/ds-column-manager": "^0.11.0",
39
+ "@synerise/ds-column-manager": "^0.11.1",
40
40
  "@synerise/ds-data-format": "^0.4.0",
41
- "@synerise/ds-dropdown": "^0.17.72",
41
+ "@synerise/ds-dropdown": "^0.17.73",
42
42
  "@synerise/ds-flag": "^0.4.0",
43
43
  "@synerise/ds-icon": "^0.58.0",
44
- "@synerise/ds-input": "^0.18.46",
44
+ "@synerise/ds-input": "^0.18.47",
45
45
  "@synerise/ds-loader": "^0.2.40",
46
- "@synerise/ds-menu": "^0.17.15",
46
+ "@synerise/ds-menu": "^0.17.16",
47
47
  "@synerise/ds-pagination": "^0.7.28",
48
- "@synerise/ds-search": "^0.8.59",
49
- "@synerise/ds-search-bar": "^0.6.36",
50
- "@synerise/ds-select": "^0.15.11",
48
+ "@synerise/ds-search": "^0.8.60",
49
+ "@synerise/ds-search-bar": "^0.6.37",
50
+ "@synerise/ds-select": "^0.15.12",
51
51
  "@synerise/ds-skeleton": "^0.3.4",
52
- "@synerise/ds-status": "^0.5.76",
53
- "@synerise/ds-tags": "^0.8.6",
54
- "@synerise/ds-tooltip": "^0.14.1",
52
+ "@synerise/ds-status": "^0.5.77",
53
+ "@synerise/ds-tags": "^0.8.7",
54
+ "@synerise/ds-tooltip": "^0.14.2",
55
55
  "@synerise/ds-typography": "^0.12.8",
56
56
  "@synerise/ds-utils": "^0.19.0",
57
57
  "@types/react-window": "^1.8.5",
@@ -67,5 +67,5 @@
67
67
  "antd": "^4",
68
68
  "react": ">=16.9.0 < 17.0.0"
69
69
  },
70
- "gitHead": "0795eb5071d9160e429731ba8f8807c1ae509085"
70
+ "gitHead": "1f03e5affd1f22c9d3c7b4f1401887263d32d3d5"
71
71
  }
@@ -1,173 +0,0 @@
1
- import { getColumnsWithActiveSorting, sortRows, sortDataSourceRows } from '../groupedColumnsSort'; // For tests column data can be any
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
-
4
- var fakeColumns = [{
5
- key: 'columnAsc',
6
- sorter: jest.fn()
7
- }, {
8
- key: 'columnDsc',
9
- sorter: jest.fn()
10
- }, {
11
- key: 'columnNull',
12
- sorter: undefined
13
- }];
14
- var fakeSortStateActive = {
15
- columnAsc: {
16
- sortOrder: 'ascend',
17
- multiple: false
18
- },
19
- columnDsc: {
20
- sortOrder: 'descend',
21
- multiple: false
22
- },
23
- columnNull: {
24
- sortOrder: null,
25
- multiple: false
26
- }
27
- };
28
- var fakeSortStateInactive = {
29
- columnAsc: {
30
- sortOrder: null,
31
- multiple: false
32
- },
33
- columnDsc: {
34
- sortOrder: null,
35
- multiple: false
36
- },
37
- columnNull: {
38
- sortOrder: null,
39
- multiple: false
40
- }
41
- };
42
-
43
- var setupStateApi = function setupStateApi(sortState) {
44
- return {
45
- columnsSortState: sortState,
46
- getColumnSortOrder: jest.fn().mockImplementation(function (key) {
47
- return sortState[key].sortOrder;
48
- }),
49
- setColumnSortOrder: jest.fn(),
50
- updateColumnsData: jest.fn()
51
- };
52
- };
53
-
54
- describe('getColumnsWithActiveSorting', function () {
55
- it('should return empty array if there are no columns provided', function () {
56
- var fakeSortStateApi = setupStateApi(fakeSortStateActive);
57
- expect(getColumnsWithActiveSorting(fakeSortStateApi, [])).toEqual([]);
58
- });
59
- it('shuld return empty array if there is no column with active sorting', function () {
60
- var fakeSortStateApi = setupStateApi(fakeSortStateInactive);
61
- var actual = getColumnsWithActiveSorting(fakeSortStateApi, fakeColumns);
62
- var expected = [];
63
- expect(actual).toEqual(expected);
64
- });
65
- it('should return columns which has active sorting in state', function () {
66
- var fakeSortStateApi = setupStateApi(fakeSortStateActive);
67
- var actual = getColumnsWithActiveSorting(fakeSortStateApi, fakeColumns);
68
- var expected = [fakeColumns[0], fakeColumns[1]];
69
- expect(actual).toEqual(expected);
70
- });
71
- });
72
- describe('sortRows', function () {
73
- it('should exec sorting using provided compare function when sort order is ascend', function () {
74
- var fakeCompareFn = jest.fn().mockImplementation(function () {
75
- return 0;
76
- });
77
- var inputRows = [1, 2, 3, 4];
78
- var actual = sortRows('ascend', fakeCompareFn, inputRows);
79
- var expected = [1, 2, 3, 4];
80
- expect(actual).toEqual(expected);
81
- expect(fakeCompareFn).toHaveBeenCalled();
82
- });
83
- it('should not exec sorting using provided compare function when sort order is null', function () {
84
- var fakeCompareFn = jest.fn().mockImplementation(function () {
85
- return 0;
86
- });
87
- var inputRows = [1, 2, 3, 4];
88
- var actual = sortRows(null, fakeCompareFn, inputRows);
89
- expect(actual).toEqual(inputRows);
90
- expect(fakeCompareFn).not.toHaveBeenCalled();
91
- });
92
- it('should exec sorting using provided compare function when sort order is descend', function () {
93
- var fakeCompareFn = jest.fn().mockImplementation(function () {
94
- return 0;
95
- });
96
- var inputRows = [1, 2, 3, 4];
97
- var actual = sortRows('descend', fakeCompareFn, inputRows);
98
- var expected = [4, 3, 2, 1];
99
- expect(actual).toEqual(expected);
100
- expect(fakeCompareFn).toHaveBeenCalled();
101
- });
102
- });
103
- describe('sortDataSourceRows', function () {
104
- it('should return empty array if provided dataSource is empty', function () {
105
- var fakeSortStateApi = setupStateApi(fakeSortStateActive);
106
- expect(sortDataSourceRows(fakeSortStateApi, fakeColumns, [])).toEqual([]);
107
- });
108
- it('should sort rows using compareFn from column with active sorting', function () {
109
- var fakeSortingColumns = [{
110
- key: 'columnAsc',
111
- sorter: jest.fn().mockImplementation(function (a, b) {
112
- return a - b;
113
- }) // sort ascending
114
-
115
- }, {
116
- key: 'columnNull',
117
- sorter: undefined
118
- }];
119
- var fakeDataSource = [{
120
- column: 'c1',
121
- groupType: 'groupType',
122
- value: 'value',
123
- key: 'k1',
124
- rows: [4, 1, 2, 3]
125
- }, {
126
- column: 'c1',
127
- groupType: 'groupType',
128
- value: 'value',
129
- key: 'k1',
130
- rows: [4, 1, 2, 3]
131
- }, {
132
- column: 'c1',
133
- groupType: 'groupType',
134
- value: 'value',
135
- key: 'k1',
136
- rows: [4, 1, 2, 3]
137
- }, {
138
- column: 'c1',
139
- groupType: 'groupType',
140
- value: 'value',
141
- key: 'k1',
142
- rows: [4, 1, 2, 3]
143
- }];
144
- var fakeSortStateApi = setupStateApi(fakeSortStateActive);
145
- var actual = sortDataSourceRows(fakeSortStateApi, fakeSortingColumns, fakeDataSource);
146
- var expected = [{
147
- column: 'c1',
148
- groupType: 'groupType',
149
- value: 'value',
150
- key: 'k1',
151
- rows: [1, 2, 3, 4]
152
- }, {
153
- column: 'c1',
154
- groupType: 'groupType',
155
- value: 'value',
156
- key: 'k1',
157
- rows: [1, 2, 3, 4]
158
- }, {
159
- column: 'c1',
160
- groupType: 'groupType',
161
- value: 'value',
162
- key: 'k1',
163
- rows: [1, 2, 3, 4]
164
- }, {
165
- column: 'c1',
166
- groupType: 'groupType',
167
- value: 'value',
168
- key: 'k1',
169
- rows: [1, 2, 3, 4]
170
- }];
171
- expect(actual).toEqual(expected);
172
- });
173
- });