@quillsql/react 2.8.8 → 2.8.9
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/AddToDashboardModal.js +146 -181
- package/dist/BarList.js +36 -44
- package/dist/Chart.d.ts +0 -5
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +94 -276
- package/dist/ChartBuilder.d.ts +1 -0
- package/dist/ChartBuilder.d.ts.map +1 -1
- package/dist/ChartBuilder.js +96 -93
- package/dist/ChartEditor.d.ts +2 -1
- package/dist/ChartEditor.d.ts.map +1 -1
- package/dist/ChartEditor.js +14 -21
- package/dist/Context.js +52 -57
- package/dist/Dashboard.d.ts.map +1 -1
- package/dist/Dashboard.js +181 -213
- package/dist/DateRangePicker/Calendar.js +41 -46
- package/dist/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/DateRangePicker/DateRangePicker.js +33 -62
- package/dist/DateRangePicker/DateRangePickerButton.js +14 -17
- package/dist/DateRangePicker/dateRangePickerUtils.js +76 -90
- package/dist/DateRangePicker/index.js +1 -9
- package/dist/PieChart.js +35 -70
- package/dist/QuillProvider.js +4 -7
- package/dist/ReportBuilder.js +120 -129
- package/dist/SQLEditor.d.ts +5 -1
- package/dist/SQLEditor.d.ts.map +1 -1
- package/dist/SQLEditor.js +82 -89
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +64 -66
- package/dist/TableChart.js +17 -45
- package/dist/assets/ArrowDownHeadIcon.js +3 -6
- package/dist/assets/ArrowDownIcon.js +3 -6
- package/dist/assets/ArrowDownRightIcon.js +3 -6
- package/dist/assets/ArrowLeftHeadIcon.js +3 -6
- package/dist/assets/ArrowRightHeadIcon.js +3 -6
- package/dist/assets/ArrowRightIcon.js +3 -6
- package/dist/assets/ArrowUpHeadIcon.js +3 -6
- package/dist/assets/ArrowUpIcon.js +3 -6
- package/dist/assets/ArrowUpRightIcon.js +3 -6
- package/dist/assets/CalendarIcon.js +3 -6
- package/dist/assets/CalendarNormalIcon.js +3 -6
- package/dist/assets/DoubleArrowLeftHeadIcon.js +3 -6
- package/dist/assets/DoubleArrowRightHeadIcon.js +3 -6
- package/dist/assets/ExclamationFilledIcon.js +3 -6
- package/dist/assets/FilterIcon.js +3 -6
- package/dist/assets/LoadingSpinner.js +3 -6
- package/dist/assets/RefreshIcon.js +3 -6
- package/dist/assets/SearchIcon.js +3 -6
- package/dist/assets/UpLeftArrowsIcon.js +3 -6
- package/dist/assets/XCircleIcon.js +3 -6
- package/dist/assets/XIcon.js +3 -6
- package/dist/assets/index.js +21 -49
- package/dist/components/Banner/index.d.ts +3 -0
- package/dist/components/Banner/index.d.ts.map +1 -0
- package/dist/components/Banner/index.js +24 -0
- package/dist/components/BigModal/BigModal.js +13 -39
- package/dist/components/Dropdown/Dropdown.js +24 -53
- package/dist/components/Dropdown/DropdownItem.js +9 -35
- package/dist/components/Dropdown/index.js +2 -11
- package/dist/components/Modal/Modal.js +13 -39
- package/dist/components/Modal/index.js +1 -9
- package/dist/components/QuillCard.js +8 -13
- package/dist/components/ReportBuilder/ColumnSelector.d.ts +19 -0
- package/dist/components/ReportBuilder/ColumnSelector.d.ts.map +1 -0
- package/dist/components/ReportBuilder/ColumnSelector.js +87 -0
- package/dist/components/SqlTextEditor.d.ts.map +1 -1
- package/dist/components/SqlTextEditor.js +30 -13
- package/dist/components/UiComponents.d.ts.map +1 -1
- package/dist/components/UiComponents.js +40 -53
- package/dist/components/selectUtils.js +6 -17
- package/dist/contexts/BaseColorContext.js +3 -6
- package/dist/contexts/HoveredValueContext.js +3 -6
- package/dist/contexts/RootStylesContext.js +3 -6
- package/dist/contexts/SelectedValueContext.js +3 -6
- package/dist/contexts/index.js +4 -15
- package/dist/hooks/index.js +4 -15
- package/dist/hooks/useDashboard.js +10 -15
- package/dist/hooks/useInternalState.js +3 -6
- package/dist/hooks/useOnClickOutside.js +3 -6
- package/dist/hooks/useOnWindowResize.js +4 -7
- package/dist/hooks/useQuill.js +11 -16
- package/dist/hooks/useSelectOnKeyDown.js +4 -7
- package/dist/index.js +13 -33
- package/dist/internals/ReportBuilder/PivotList.js +14 -20
- package/dist/internals/ReportBuilder/PivotModal.d.ts +2 -2
- package/dist/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/internals/ReportBuilder/PivotModal.js +116 -119
- package/dist/internals/ReportBuilder/PivotModal.spec.js +70 -73
- package/dist/lib/font.js +2 -6
- package/dist/lib/index.js +3 -20
- package/dist/lib/inputTypes.js +1 -3
- package/dist/lib/utils.js +8 -19
- package/dist/test-data/tables.d.ts +2 -0
- package/dist/test-data/tables.d.ts.map +1 -0
- package/dist/test-data/tables.js +621 -0
- package/dist/utils/aggregate.js +28 -35
- package/dist/utils/axisFormatter.d.ts +20 -0
- package/dist/utils/axisFormatter.d.ts.map +1 -0
- package/dist/utils/axisFormatter.js +185 -0
- package/dist/utils/colorToHex.js +1 -5
- package/dist/utils/dataFetcher.js +2 -8
- package/dist/utils/downloadCSV.js +1 -6
- package/dist/utils/schema.d.ts +22 -0
- package/dist/utils/schema.d.ts.map +1 -0
- package/dist/utils/schema.js +134 -0
- package/dist/utils/textFormatting.d.ts +4 -0
- package/dist/utils/textFormatting.d.ts.map +1 -0
- package/dist/utils/textFormatting.js +38 -0
- package/dist/utils/valueFormatter.d.ts +17 -0
- package/dist/utils/valueFormatter.d.ts.map +1 -0
- package/dist/utils/valueFormatter.js +166 -0
- package/dist/utils/valueFormatterCSV.d.ts +17 -0
- package/dist/utils/valueFormatterCSV.d.ts.map +1 -0
- package/dist/utils/valueFormatterCSV.js +90 -0
- package/package.json +1 -2
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
// @ts-nocheck
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { expect } from 'chai';
|
|
3
|
+
import { generatePivotTable } from './PivotModal';
|
|
4
|
+
import { subMonths } from 'date-fns';
|
|
7
5
|
describe('PivotModal', function () {
|
|
8
6
|
describe('generatePivotTable', function () {
|
|
9
7
|
context('non date pivots', function () {
|
|
@@ -27,36 +25,36 @@ describe('PivotModal', function () {
|
|
|
27
25
|
{ merchant: 'm2', amount: 8, user_name: 'u2' },
|
|
28
26
|
];
|
|
29
27
|
it('should return empty table with no data', function () {
|
|
30
|
-
const table =
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const table = generatePivotTable(rowPivot, [], [new Date(), subMonths(new Date(), 3)]);
|
|
29
|
+
expect(table.columns.length).to.equal(2);
|
|
30
|
+
expect(table.rows.length).to.equal(0);
|
|
33
31
|
});
|
|
34
32
|
it('should combine values based on row pivot', function () {
|
|
35
|
-
const table =
|
|
33
|
+
const table = generatePivotTable(rowPivot, rows, [
|
|
36
34
|
new Date(),
|
|
37
|
-
|
|
35
|
+
subMonths(new Date(), 3),
|
|
38
36
|
]);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
expect(table.columns.length).to.equal(2);
|
|
38
|
+
expect(table.columns[0].field).to.equal('merchant');
|
|
39
|
+
expect(table.columns[1].field).to.equal('amount');
|
|
40
|
+
expect(table.rows.length).to.equal(2);
|
|
41
|
+
expect(table.rows[0].amount).to.equal(12);
|
|
42
|
+
expect(table.rows[1].amount).to.equal(21);
|
|
45
43
|
});
|
|
46
44
|
it('should combine values based on row and column pivots', function () {
|
|
47
|
-
const table =
|
|
45
|
+
const table = generatePivotTable(rowColumnPivot, rows, [
|
|
48
46
|
new Date(),
|
|
49
|
-
|
|
47
|
+
subMonths(new Date(), 3),
|
|
50
48
|
]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
expect(table.columns.length).to.equal(3);
|
|
50
|
+
expect(table.columns[0].field).to.equal('merchant');
|
|
51
|
+
expect(table.columns[1].field).to.equal('u1');
|
|
52
|
+
expect(table.columns[2].field).to.equal('u2');
|
|
53
|
+
expect(table.rows.length).to.equal(2);
|
|
54
|
+
expect(table.rows[0].u1).to.equal(8);
|
|
55
|
+
expect(table.rows[0].u2).to.equal(4);
|
|
56
|
+
expect(table.rows[1].u1).to.equal(6);
|
|
57
|
+
expect(table.rows[1].u2).to.equal(15);
|
|
60
58
|
});
|
|
61
59
|
});
|
|
62
60
|
context('date pivots', function () {
|
|
@@ -104,17 +102,17 @@ describe('PivotModal', function () {
|
|
|
104
102
|
valueField: 'amount',
|
|
105
103
|
aggregationType: 'sum',
|
|
106
104
|
};
|
|
107
|
-
const table =
|
|
105
|
+
const table = generatePivotTable(pivot, rows, [
|
|
108
106
|
new Date('October 10, 2023 00:00:00'),
|
|
109
107
|
new Date('October 15, 2023 00:00:00'),
|
|
110
108
|
]);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
expect(table.columns.length).to.equal(2);
|
|
110
|
+
expect(table.columns[0].field).to.equal('date');
|
|
111
|
+
expect(table.columns[1].field).to.equal('amount');
|
|
112
|
+
expect(table.rows.length).to.equal(6);
|
|
113
|
+
expect(table.rows[3].amount).to.equal(9);
|
|
114
|
+
expect(table.rows[4].amount).to.equal(17);
|
|
115
|
+
expect(table.rows[5].amount).to.equal(0);
|
|
118
116
|
});
|
|
119
117
|
it('should handle a row timestamp pivot', function () {
|
|
120
118
|
const pivot = {
|
|
@@ -123,17 +121,17 @@ describe('PivotModal', function () {
|
|
|
123
121
|
valueField: 'amount',
|
|
124
122
|
aggregationType: 'sum',
|
|
125
123
|
};
|
|
126
|
-
const table =
|
|
124
|
+
const table = generatePivotTable(pivot, rows, [
|
|
127
125
|
new Date('October 10, 2023 00:00:00').getTime(),
|
|
128
126
|
new Date('October 15, 2023 00:00:00').getTime(),
|
|
129
127
|
]);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
expect(table.columns.length).to.equal(2);
|
|
129
|
+
expect(table.columns[0].field).to.equal('date');
|
|
130
|
+
expect(table.columns[1].field).to.equal('amount');
|
|
131
|
+
expect(table.rows.length).to.equal(6);
|
|
132
|
+
expect(table.rows[3].amount).to.equal(9);
|
|
133
|
+
expect(table.rows[4].amount).to.equal(17);
|
|
134
|
+
expect(table.rows[5].amount).to.equal(0);
|
|
137
135
|
});
|
|
138
136
|
it('should handle a string row pivot with a date column pivot', function () {
|
|
139
137
|
const pivot = {
|
|
@@ -144,20 +142,20 @@ describe('PivotModal', function () {
|
|
|
144
142
|
rowField: 'user_name',
|
|
145
143
|
rowFieldType: 'varchar',
|
|
146
144
|
};
|
|
147
|
-
const table =
|
|
145
|
+
const table = generatePivotTable(pivot, rows, [
|
|
148
146
|
new Date('October 10, 2023 00:00:00'),
|
|
149
147
|
new Date('October 15, 2023 00:00:00'),
|
|
150
148
|
]);
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
expect(table.columns.length).to.equal(7);
|
|
150
|
+
expect(table.columns[0].field).to.equal('user_name');
|
|
151
|
+
expect(table.rows.length).to.equal(2);
|
|
154
152
|
// u1
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
expect(table.rows[0].user_name).to.equal('u1');
|
|
154
|
+
expect(Object.values(table.rows[0])[4]).to.equal(9);
|
|
155
|
+
expect(Object.values(table.rows[0])[5]).to.equal(11);
|
|
158
156
|
// u2
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
expect(table.rows[1].user_name).to.equal('u2');
|
|
158
|
+
expect(Object.values(table.rows[1])[5]).to.equal(6);
|
|
161
159
|
});
|
|
162
160
|
it('should handle a date row pivot with a string column pivot', function () {
|
|
163
161
|
const pivot = {
|
|
@@ -168,23 +166,23 @@ describe('PivotModal', function () {
|
|
|
168
166
|
columnField: 'user_name',
|
|
169
167
|
columnFieldType: 'varchar',
|
|
170
168
|
};
|
|
171
|
-
const table =
|
|
169
|
+
const table = generatePivotTable(pivot, rows, [
|
|
172
170
|
new Date('October 10, 2023 00:00:00'),
|
|
173
171
|
new Date('October 15, 2023 00:00:00'),
|
|
174
172
|
]);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
expect(table.columns.length).to.equal(3);
|
|
174
|
+
expect(table.columns[0].field).to.equal('date');
|
|
175
|
+
expect(table.columns[1].field).to.equal('u1');
|
|
176
|
+
expect(table.columns[2].field).to.equal('u2');
|
|
177
|
+
expect(table.rows.length).to.equal(6);
|
|
180
178
|
// day without transactions
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
expect(table.rows[2].u1).to.equal(0);
|
|
180
|
+
expect(table.rows[2].u2).to.equal(0);
|
|
183
181
|
// days with transactions
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
expect(table.rows[3].u1).to.equal(9);
|
|
183
|
+
expect(table.rows[3].u2).to.equal(0);
|
|
184
|
+
expect(table.rows[4].u1).to.equal(11);
|
|
185
|
+
expect(table.rows[4].u2).to.equal(6);
|
|
188
186
|
});
|
|
189
187
|
it('should handle a date row pivot with a date column pivot', function () {
|
|
190
188
|
const pivot = {
|
|
@@ -195,20 +193,19 @@ describe('PivotModal', function () {
|
|
|
195
193
|
rowField: 'created_at',
|
|
196
194
|
rowFieldType: 'date',
|
|
197
195
|
};
|
|
198
|
-
const table =
|
|
196
|
+
const table = generatePivotTable(pivot, rows, [
|
|
199
197
|
new Date('October 10, 2023 00:00:00'),
|
|
200
198
|
new Date('October 15, 2023 00:00:00'),
|
|
201
199
|
]);
|
|
202
200
|
console.log(table);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
201
|
+
expect(table.columns.length).to.equal(7);
|
|
202
|
+
expect(table.columns[0].field).to.equal('created_at');
|
|
203
|
+
expect(table.rows.length).to.equal(6);
|
|
204
|
+
expect(Object.values(table.rows[3])[4]).to.equal(1);
|
|
205
|
+
expect(Object.values(table.rows[3])[5]).to.equal(2);
|
|
206
|
+
expect(Object.values(table.rows[4])[4]).to.equal(1);
|
|
207
|
+
expect(Object.values(table.rows[4])[5]).to.equal(1);
|
|
210
208
|
});
|
|
211
209
|
});
|
|
212
210
|
});
|
|
213
211
|
});
|
|
214
|
-
//# sourceMappingURL=PivotModal.spec.js.map
|
package/dist/lib/font.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fontWeight = exports.fontSize = void 0;
|
|
4
|
-
exports.fontSize = {
|
|
1
|
+
export const fontSize = {
|
|
5
2
|
xs: 'qq-text-xs',
|
|
6
3
|
sm: 'qq-text-sm',
|
|
7
4
|
md: 'qq-text-base',
|
|
@@ -9,9 +6,8 @@ exports.fontSize = {
|
|
|
9
6
|
xl: 'qq-text-xl',
|
|
10
7
|
threeXl: 'qq-text-3xl',
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export const fontWeight = {
|
|
13
10
|
sm: 'qq-font-normal',
|
|
14
11
|
md: 'qq-font-medium',
|
|
15
12
|
lg: 'qq-font-semibold',
|
|
16
13
|
};
|
|
17
|
-
//# sourceMappingURL=font.js.map
|
package/dist/lib/index.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./inputTypes"), exports);
|
|
18
|
-
__exportStar(require("./font"), exports);
|
|
19
|
-
__exportStar(require("./utils"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export * from './inputTypes';
|
|
2
|
+
export * from './font';
|
|
3
|
+
export * from './utils';
|
package/dist/lib/inputTypes.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const iconVariantValues = [
|
|
4
2
|
'simple',
|
|
5
3
|
'light',
|
|
@@ -54,4 +52,4 @@ const alignItemsValues = [
|
|
|
54
52
|
'baseline',
|
|
55
53
|
'stretch',
|
|
56
54
|
];
|
|
57
|
-
|
|
55
|
+
export {};
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const defaultValueFormatter = (value) => value.toString();
|
|
5
|
-
exports.defaultValueFormatter = defaultValueFormatter;
|
|
6
|
-
const sumNumericArray = (arr) => arr.reduce((prefixSum, num) => prefixSum + num, 0);
|
|
7
|
-
exports.sumNumericArray = sumNumericArray;
|
|
8
|
-
const removeValueFromArray = (value, array) => {
|
|
1
|
+
export const defaultValueFormatter = (value) => value.toString();
|
|
2
|
+
export const sumNumericArray = (arr) => arr.reduce((prefixSum, num) => prefixSum + num, 0);
|
|
3
|
+
export const removeValueFromArray = (value, array) => {
|
|
9
4
|
const index = array.indexOf(value);
|
|
10
5
|
if (index > -1) {
|
|
11
6
|
array.splice(index, 1);
|
|
12
7
|
}
|
|
13
8
|
return array;
|
|
14
9
|
};
|
|
15
|
-
|
|
16
|
-
const isValueInArray = (value, array) => {
|
|
10
|
+
export const isValueInArray = (value, array) => {
|
|
17
11
|
for (let i = 0; i < array.length; i++) {
|
|
18
12
|
if (array[i] === value) {
|
|
19
13
|
return true;
|
|
@@ -21,16 +15,13 @@ const isValueInArray = (value, array) => {
|
|
|
21
15
|
}
|
|
22
16
|
return false;
|
|
23
17
|
};
|
|
24
|
-
|
|
25
|
-
const stringIsNumeric = (str) => {
|
|
18
|
+
export const stringIsNumeric = (str) => {
|
|
26
19
|
return !isNaN(Number(str)) && str !== undefined;
|
|
27
20
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return (0, exports.stringIsNumeric)(str.split('-').pop());
|
|
21
|
+
export const stringEndsWithNumber = (str) => {
|
|
22
|
+
return stringIsNumeric(str.split('-').pop());
|
|
31
23
|
};
|
|
32
|
-
|
|
33
|
-
function mergeRefs(refs) {
|
|
24
|
+
export function mergeRefs(refs) {
|
|
34
25
|
return value => {
|
|
35
26
|
refs.forEach(ref => {
|
|
36
27
|
if (typeof ref === 'function') {
|
|
@@ -42,5 +33,3 @@ function mergeRefs(refs) {
|
|
|
42
33
|
});
|
|
43
34
|
};
|
|
44
35
|
}
|
|
45
|
-
exports.mergeRefs = mergeRefs;
|
|
46
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/test-data/tables.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAE,GAAG,EA4mB5B,CAAC"}
|