@teselagen/ui 0.8.5 → 0.8.6-beta.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/DataTable/utils/filterLocalEntitiesToHasura.d.ts +5 -0
- package/DataTable/utils/initializeHasuraWhereAndFilter.d.ts +2 -0
- package/DataTable/utils/queryParams.d.ts +7 -14
- package/DataTable/utils/tableQueryParamsToHasuraClauses.d.ts +26 -0
- package/index.cjs.js +846 -972
- package/index.d.ts +1 -0
- package/index.es.js +846 -972
- package/package.json +1 -1
- package/src/DataTable/Columns.js +1 -1
- package/src/DataTable/DisplayOptions.js +1 -1
- package/src/DataTable/FilterAndSortMenu.js +27 -30
- package/src/DataTable/index.js +3 -14
- package/src/DataTable/style.css +1 -1
- package/src/DataTable/utils/filterLocalEntitiesToHasura.js +236 -0
- package/src/DataTable/utils/filterLocalEntitiesToHasura.test.js +587 -0
- package/src/DataTable/utils/initializeHasuraWhereAndFilter.js +26 -0
- package/src/DataTable/utils/queryParams.js +64 -772
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.js +260 -0
- package/src/DataTable/utils/tableQueryParamsToHasuraClauses.test.js +206 -0
- package/src/DataTable/utils/withTableParams.js +3 -16
- package/src/FormComponents/Uploader.js +5 -1
- package/src/FormComponents/index.js +2 -2
- package/src/autoTooltip.js +1 -0
- package/src/index.js +1 -0
- package/ui.css +1 -1
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { camelCase, set } from "lodash-es";
|
|
2
|
+
|
|
3
|
+
export function tableQueryParamsToHasuraClauses({
|
|
4
|
+
page,
|
|
5
|
+
pageSize,
|
|
6
|
+
searchTerm,
|
|
7
|
+
filters,
|
|
8
|
+
order,
|
|
9
|
+
schema, // Add schema as a parameter
|
|
10
|
+
additionalFilter
|
|
11
|
+
}) {
|
|
12
|
+
const ccFields = getFieldsMappedByCCDisplayName(schema);
|
|
13
|
+
let where = {};
|
|
14
|
+
const order_by = {};
|
|
15
|
+
const limit = pageSize || 25;
|
|
16
|
+
const offset = page && pageSize ? (page - 1) * pageSize : 0;
|
|
17
|
+
|
|
18
|
+
if (searchTerm) {
|
|
19
|
+
const searchTermFilters = [];
|
|
20
|
+
schema.fields.forEach(field => {
|
|
21
|
+
const { type, path, searchDisabled } = field;
|
|
22
|
+
if (searchDisabled || field.filterDisabled || type === "color") return;
|
|
23
|
+
const filterValue = searchTerm; // No cleaning needed here, we're using _ilike
|
|
24
|
+
|
|
25
|
+
if (type === "string" || type === "lookup") {
|
|
26
|
+
const o = set({}, path, { _ilike: `%${filterValue}%` });
|
|
27
|
+
searchTermFilters.push(o);
|
|
28
|
+
} else if (type === "boolean") {
|
|
29
|
+
let regex;
|
|
30
|
+
try {
|
|
31
|
+
regex = new RegExp("^" + searchTerm, "ig");
|
|
32
|
+
} catch (error) {
|
|
33
|
+
//ignore
|
|
34
|
+
}
|
|
35
|
+
if (regex) {
|
|
36
|
+
if ("true".replace(regex, "") !== "true") {
|
|
37
|
+
const o = set({}, path, { _eq: true });
|
|
38
|
+
searchTermFilters.push(o);
|
|
39
|
+
} else if ("false".replace(regex, "") !== "false") {
|
|
40
|
+
const o = set({}, path, { _eq: false });
|
|
41
|
+
searchTermFilters.push(o);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else if (
|
|
45
|
+
(type === "number" || type === "integer") &&
|
|
46
|
+
!isNaN(filterValue)
|
|
47
|
+
) {
|
|
48
|
+
const o = set({}, path, { _eq: parseFloat(filterValue) });
|
|
49
|
+
searchTermFilters.push(o);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (searchTermFilters.length > 0) {
|
|
53
|
+
if (Object.keys(where).length > 0) {
|
|
54
|
+
where = { _and: [where, { _or: searchTermFilters }] };
|
|
55
|
+
} else {
|
|
56
|
+
where = { _or: searchTermFilters };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (filters && filters.length > 0) {
|
|
62
|
+
const filterClauses = filters
|
|
63
|
+
.map(filter => {
|
|
64
|
+
let { selectedFilter, filterOn, filterValue } = filter;
|
|
65
|
+
const fieldSchema = ccFields[filterOn] || {};
|
|
66
|
+
|
|
67
|
+
const { path, reference, type } = fieldSchema;
|
|
68
|
+
let stringFilterValue =
|
|
69
|
+
filterValue && filterValue.toString
|
|
70
|
+
? filterValue.toString()
|
|
71
|
+
: filterValue;
|
|
72
|
+
if (stringFilterValue === false) {
|
|
73
|
+
// we still want to be able to search for the string "false" which will get parsed to false
|
|
74
|
+
stringFilterValue = "false";
|
|
75
|
+
} else {
|
|
76
|
+
stringFilterValue = stringFilterValue || "";
|
|
77
|
+
}
|
|
78
|
+
const arrayFilterValue = Array.isArray(filterValue)
|
|
79
|
+
? filterValue
|
|
80
|
+
: stringFilterValue.split(";");
|
|
81
|
+
|
|
82
|
+
if (type === "number" || type === "integer") {
|
|
83
|
+
filterValue = Array.isArray(filterValue)
|
|
84
|
+
? filterValue.map(val => Number(val))
|
|
85
|
+
: Number(filterValue);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (fieldSchema.normalizeFilter) {
|
|
89
|
+
filterValue = fieldSchema.normalizeFilter(
|
|
90
|
+
filterValue,
|
|
91
|
+
selectedFilter,
|
|
92
|
+
filterOn
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (reference) {
|
|
97
|
+
filterOn = reference.sourceField;
|
|
98
|
+
} else {
|
|
99
|
+
filterOn = path || filterOn;
|
|
100
|
+
}
|
|
101
|
+
switch (selectedFilter) {
|
|
102
|
+
case "none":
|
|
103
|
+
return {};
|
|
104
|
+
case "startsWith":
|
|
105
|
+
return { [filterOn]: { _ilike: `${filterValue}%` } };
|
|
106
|
+
case "endsWith":
|
|
107
|
+
return { [filterOn]: { _ilike: `%${filterValue}` } };
|
|
108
|
+
case "contains":
|
|
109
|
+
return { [filterOn]: { _ilike: `%${filterValue}%` } };
|
|
110
|
+
case "notContains":
|
|
111
|
+
return { [filterOn]: { _not_ilike: `%${filterValue}%` } };
|
|
112
|
+
case "isExactly":
|
|
113
|
+
return { [filterOn]: { _eq: filterValue } };
|
|
114
|
+
case "isEmpty":
|
|
115
|
+
return {
|
|
116
|
+
_or: [
|
|
117
|
+
{ [filterOn]: { _eq: "" } },
|
|
118
|
+
{ [filterOn]: { _is_null: true } }
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
case "notEmpty":
|
|
122
|
+
return {
|
|
123
|
+
_and: [
|
|
124
|
+
{ [filterOn]: { _neq: "" } },
|
|
125
|
+
{ [filterOn]: { _is_null: false } }
|
|
126
|
+
]
|
|
127
|
+
};
|
|
128
|
+
case "inList":
|
|
129
|
+
return { [filterOn]: { _in: filterValue } };
|
|
130
|
+
case "notInList":
|
|
131
|
+
return { [filterOn]: { _nin: filterValue } };
|
|
132
|
+
case "true":
|
|
133
|
+
return { [filterOn]: { _eq: true } };
|
|
134
|
+
case "false":
|
|
135
|
+
return { [filterOn]: { _eq: false } };
|
|
136
|
+
case "dateIs":
|
|
137
|
+
return { [filterOn]: { _eq: filterValue } };
|
|
138
|
+
case "notBetween":
|
|
139
|
+
return {
|
|
140
|
+
_or: [
|
|
141
|
+
{
|
|
142
|
+
[filterOn]: {
|
|
143
|
+
_lt: new Date(arrayFilterValue[0])
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
[filterOn]: {
|
|
148
|
+
_gt: new Date(
|
|
149
|
+
new Date(arrayFilterValue[1]).setHours(23, 59)
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
};
|
|
155
|
+
case "isBetween":
|
|
156
|
+
return {
|
|
157
|
+
[filterOn]: {
|
|
158
|
+
_gte: new Date(arrayFilterValue[0]),
|
|
159
|
+
_lte: new Date(new Date(arrayFilterValue[1]).setHours(23, 59))
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
case "isBefore":
|
|
163
|
+
return { [filterOn]: { _lt: new Date(filterValue) } };
|
|
164
|
+
case "isAfter":
|
|
165
|
+
return { [filterOn]: { _gt: new Date(filterValue) } };
|
|
166
|
+
case "greaterThan":
|
|
167
|
+
return { [filterOn]: { _gt: parseFloat(filterValue) } };
|
|
168
|
+
case "lessThan":
|
|
169
|
+
return { [filterOn]: { _lt: parseFloat(filterValue) } };
|
|
170
|
+
case "inRange":
|
|
171
|
+
return {
|
|
172
|
+
[filterOn]: {
|
|
173
|
+
_gte: parseFloat(arrayFilterValue[0]),
|
|
174
|
+
_lte: parseFloat(arrayFilterValue[1])
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
case "outsideRange":
|
|
178
|
+
return {
|
|
179
|
+
_or: [
|
|
180
|
+
{
|
|
181
|
+
[filterOn]: {
|
|
182
|
+
_lt: parseFloat(arrayFilterValue[0])
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
[filterOn]: {
|
|
187
|
+
_gt: parseFloat(arrayFilterValue[1])
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
};
|
|
192
|
+
case "equalTo":
|
|
193
|
+
return {
|
|
194
|
+
[filterOn]: {
|
|
195
|
+
_eq:
|
|
196
|
+
type === "number" || type === "integer"
|
|
197
|
+
? parseFloat(filterValue)
|
|
198
|
+
: filterValue
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
case "regex":
|
|
202
|
+
return { [filterOn]: { _regex: filterValue } };
|
|
203
|
+
default:
|
|
204
|
+
console.warn(`Unsupported filter type: ${selectedFilter}`);
|
|
205
|
+
return {};
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
.map(filter => {
|
|
209
|
+
const o = {};
|
|
210
|
+
set(o, Object.keys(filter)[0], filter[Object.keys(filter)[0]]);
|
|
211
|
+
return o;
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
if (filterClauses.length > 0) {
|
|
215
|
+
if (Object.keys(where).length > 0) {
|
|
216
|
+
where = { _and: [where, ...filterClauses] };
|
|
217
|
+
} else {
|
|
218
|
+
where = { _and: filterClauses };
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (order && order.length > 0) {
|
|
224
|
+
order.forEach(item => {
|
|
225
|
+
const field = item.startsWith("-") ? item.substring(1) : item;
|
|
226
|
+
const direction = item.startsWith("-") ? "desc" : "asc";
|
|
227
|
+
order_by[field] = direction;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (additionalFilter) {
|
|
232
|
+
where = { _and: [where, additionalFilter] };
|
|
233
|
+
}
|
|
234
|
+
return { where, order_by, limit, offset };
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Takes a schema and returns an object with the fields mapped by their camelCased display name.
|
|
239
|
+
* If the displayName is not set or is a jsx element, the path is used instead.
|
|
240
|
+
* The same conversion must be done when using the result of this method
|
|
241
|
+
*/
|
|
242
|
+
export function getFieldsMappedByCCDisplayName(schema) {
|
|
243
|
+
if (!schema || !schema.fields) return {};
|
|
244
|
+
return schema.fields.reduce((acc, field) => {
|
|
245
|
+
const ccDisplayName = getCCDisplayName(field);
|
|
246
|
+
acc[ccDisplayName] = field;
|
|
247
|
+
return acc;
|
|
248
|
+
}, {});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
*
|
|
253
|
+
* @param {object} field
|
|
254
|
+
* @returns the camelCase display name of the field, to be used for filters, sorting, etc
|
|
255
|
+
*/
|
|
256
|
+
export function getCCDisplayName(field) {
|
|
257
|
+
return camelCase(
|
|
258
|
+
typeof field.displayName === "string" ? field.displayName : field.path
|
|
259
|
+
);
|
|
260
|
+
}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { tableQueryParamsToHasuraClauses } from "./tableQueryParamsToHasuraClauses";
|
|
2
|
+
|
|
3
|
+
describe("tableQueryParamsToHasuraClauses", () => {
|
|
4
|
+
const schema = {
|
|
5
|
+
fields: [
|
|
6
|
+
{ path: "name", type: "string" },
|
|
7
|
+
{ path: "age", type: "number" },
|
|
8
|
+
{ path: "isActive", type: "boolean" },
|
|
9
|
+
{ path: "email", type: "string" }
|
|
10
|
+
]
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
it("should handle empty query params", () => {
|
|
14
|
+
const result = tableQueryParamsToHasuraClauses({});
|
|
15
|
+
expect(result).toEqual({
|
|
16
|
+
where: {},
|
|
17
|
+
order_by: {},
|
|
18
|
+
limit: 25,
|
|
19
|
+
offset: 0
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("should handle page and pageSize", () => {
|
|
24
|
+
const result = tableQueryParamsToHasuraClauses({ page: 2, pageSize: 10 });
|
|
25
|
+
expect(result).toEqual({
|
|
26
|
+
where: {},
|
|
27
|
+
order_by: {},
|
|
28
|
+
limit: 10,
|
|
29
|
+
offset: 10
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should handle searchTerm with string fields", () => {
|
|
34
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
35
|
+
searchTerm: "test",
|
|
36
|
+
schema
|
|
37
|
+
});
|
|
38
|
+
expect(result).toEqual({
|
|
39
|
+
where: {
|
|
40
|
+
_or: [{ name: { _ilike: "%test%" } }, { email: { _ilike: "%test%" } }]
|
|
41
|
+
},
|
|
42
|
+
order_by: {},
|
|
43
|
+
limit: 25,
|
|
44
|
+
offset: 0
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("should handle searchTerm with number fields", () => {
|
|
49
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
50
|
+
searchTerm: "30",
|
|
51
|
+
schema
|
|
52
|
+
});
|
|
53
|
+
expect(result).toEqual({
|
|
54
|
+
where: {
|
|
55
|
+
_or: [
|
|
56
|
+
{ name: { _ilike: "%30%" } },
|
|
57
|
+
{ age: { _eq: 30 } },
|
|
58
|
+
{ email: { _ilike: "%30%" } }
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
order_by: {},
|
|
62
|
+
limit: 25,
|
|
63
|
+
offset: 0
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("should handle searchTerm with boolean fields", () => {
|
|
68
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
69
|
+
searchTerm: "true",
|
|
70
|
+
schema
|
|
71
|
+
});
|
|
72
|
+
expect(result).toEqual({
|
|
73
|
+
where: {
|
|
74
|
+
_or: [
|
|
75
|
+
{ name: { _ilike: "%true%" } },
|
|
76
|
+
{ isActive: { _eq: true } },
|
|
77
|
+
{ email: { _ilike: "%true%" } }
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
order_by: {},
|
|
81
|
+
limit: 25,
|
|
82
|
+
offset: 0
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("should handle searchTerm with multiple field types", () => {
|
|
87
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
88
|
+
searchTerm: "test",
|
|
89
|
+
schema
|
|
90
|
+
});
|
|
91
|
+
expect(result).toEqual({
|
|
92
|
+
where: {
|
|
93
|
+
_or: [{ name: { _ilike: "%test%" } }, { email: { _ilike: "%test%" } }]
|
|
94
|
+
},
|
|
95
|
+
order_by: {},
|
|
96
|
+
limit: 25,
|
|
97
|
+
offset: 0
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("should handle contains filter", () => {
|
|
102
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
103
|
+
filters: [
|
|
104
|
+
{
|
|
105
|
+
selectedFilter: "contains",
|
|
106
|
+
filterOn: "name",
|
|
107
|
+
filterValue: "test"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
expect(result).toEqual({
|
|
112
|
+
where: { _and: [{ name: { _ilike: "%test%" } }] },
|
|
113
|
+
order_by: {},
|
|
114
|
+
limit: 25,
|
|
115
|
+
offset: 0
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("should handle equalTo filter for number", () => {
|
|
120
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
121
|
+
filters: [
|
|
122
|
+
{ selectedFilter: "equalTo", filterOn: "age", filterValue: "30" }
|
|
123
|
+
],
|
|
124
|
+
schema
|
|
125
|
+
});
|
|
126
|
+
expect(result).toEqual({
|
|
127
|
+
where: { _and: [{ age: { _eq: 30 } }] },
|
|
128
|
+
order_by: {},
|
|
129
|
+
limit: 25,
|
|
130
|
+
offset: 0
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("should handle order", () => {
|
|
135
|
+
const result = tableQueryParamsToHasuraClauses({ order: ["name", "-age"] });
|
|
136
|
+
expect(result).toEqual({
|
|
137
|
+
where: {},
|
|
138
|
+
order_by: { name: "asc", age: "desc" },
|
|
139
|
+
limit: 25,
|
|
140
|
+
offset: 0
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("should combine all params", () => {
|
|
145
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
146
|
+
page: 2,
|
|
147
|
+
pageSize: 10,
|
|
148
|
+
searchTerm: "test",
|
|
149
|
+
filters: [
|
|
150
|
+
{
|
|
151
|
+
selectedFilter: "greaterThan",
|
|
152
|
+
filterOn: "age",
|
|
153
|
+
filterValue: "30"
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
order: ["name"],
|
|
157
|
+
schema
|
|
158
|
+
});
|
|
159
|
+
expect(result).toEqual({
|
|
160
|
+
where: {
|
|
161
|
+
_and: [
|
|
162
|
+
{
|
|
163
|
+
_or: [
|
|
164
|
+
{ name: { _ilike: "%test%" } },
|
|
165
|
+
{ email: { _ilike: "%test%" } }
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
{ age: { _gt: 30 } }
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
order_by: { name: "asc" },
|
|
172
|
+
limit: 10,
|
|
173
|
+
offset: 10
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("should combine searchTerm and filters", () => {
|
|
178
|
+
const result = tableQueryParamsToHasuraClauses({
|
|
179
|
+
searchTerm: "test",
|
|
180
|
+
filters: [
|
|
181
|
+
{
|
|
182
|
+
selectedFilter: "greaterThan",
|
|
183
|
+
filterOn: "age",
|
|
184
|
+
filterValue: "30"
|
|
185
|
+
}
|
|
186
|
+
],
|
|
187
|
+
schema
|
|
188
|
+
});
|
|
189
|
+
expect(result).toEqual({
|
|
190
|
+
where: {
|
|
191
|
+
_and: [
|
|
192
|
+
{
|
|
193
|
+
_or: [
|
|
194
|
+
{ name: { _ilike: "%test%" } },
|
|
195
|
+
{ email: { _ilike: "%test%" } }
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{ age: { _gt: 30 } }
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
order_by: {},
|
|
202
|
+
limit: 25,
|
|
203
|
+
offset: 0
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
});
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
makeDataTableHandlers,
|
|
7
7
|
getQueryParams,
|
|
8
8
|
setCurrentParamsOnUrl,
|
|
9
|
-
getCurrentParamsFromUrl
|
|
10
|
-
getCCDisplayName
|
|
9
|
+
getCurrentParamsFromUrl
|
|
11
10
|
} from "./queryParams";
|
|
12
11
|
import { withRouter } from "react-router-dom";
|
|
13
12
|
import getTableConfigFromStorage from "./getTableConfigFromStorage";
|
|
14
13
|
import { useDeepEqualMemo } from "../../utils/hooks/useDeepEqualMemo";
|
|
15
14
|
import { branch, compose } from "recompose";
|
|
15
|
+
import { getCCDisplayName } from "./tableQueryParamsToHasuraClauses";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Note all these options can be passed at Design Time or at Runtime (like reduxForm())
|
|
@@ -32,7 +32,6 @@ import { branch, compose } from "recompose";
|
|
|
32
32
|
export const useTableParams = props => {
|
|
33
33
|
const {
|
|
34
34
|
additionalFilter,
|
|
35
|
-
additionalOrFilter,
|
|
36
35
|
controlled_pageSize,
|
|
37
36
|
defaults: _defaults,
|
|
38
37
|
doNotCoercePageSize,
|
|
@@ -166,16 +165,6 @@ export const useTableParams = props => {
|
|
|
166
165
|
);
|
|
167
166
|
|
|
168
167
|
const queryParams = useMemo(() => {
|
|
169
|
-
const additionalFilterToUse =
|
|
170
|
-
typeof additionalFilter === "function"
|
|
171
|
-
? additionalFilter
|
|
172
|
-
: () => additionalFilter;
|
|
173
|
-
|
|
174
|
-
const additionalOrFilterToUse =
|
|
175
|
-
typeof additionalOrFilter === "function"
|
|
176
|
-
? additionalOrFilter
|
|
177
|
-
: () => additionalOrFilter;
|
|
178
|
-
|
|
179
168
|
return getQueryParams({
|
|
180
169
|
doNotCoercePageSize,
|
|
181
170
|
currentParams,
|
|
@@ -185,8 +174,7 @@ export const useTableParams = props => {
|
|
|
185
174
|
schema: convertedSchema,
|
|
186
175
|
isInfinite: isInfinite || (isSimple && !withPaging),
|
|
187
176
|
isLocalCall,
|
|
188
|
-
additionalFilter
|
|
189
|
-
additionalOrFilter: additionalOrFilterToUse,
|
|
177
|
+
additionalFilter,
|
|
190
178
|
noOrderError,
|
|
191
179
|
isCodeModel,
|
|
192
180
|
ownProps: passingProps
|
|
@@ -194,7 +182,6 @@ export const useTableParams = props => {
|
|
|
194
182
|
}, [
|
|
195
183
|
additionalFilter,
|
|
196
184
|
passingProps,
|
|
197
|
-
additionalOrFilter,
|
|
198
185
|
doNotCoercePageSize,
|
|
199
186
|
currentParams,
|
|
200
187
|
entities,
|
|
@@ -788,7 +788,11 @@ const Uploader = ({
|
|
|
788
788
|
.join(", ")
|
|
789
789
|
: undefined
|
|
790
790
|
}
|
|
791
|
-
onDrop={async (_acceptedFiles, rejectedFiles) => {
|
|
791
|
+
onDrop={async (_acceptedFiles, rejectedFiles, e) => {
|
|
792
|
+
const parentDropzone = e.target.closest(".tg-dropzone");
|
|
793
|
+
if (parentDropzone) {
|
|
794
|
+
parentDropzone.blur();
|
|
795
|
+
}
|
|
792
796
|
let acceptedFiles = [];
|
|
793
797
|
for (const file of _acceptedFiles) {
|
|
794
798
|
if ((validateAgainstSchema || autoUnzip) && isZipFile(file)) {
|
|
@@ -114,14 +114,14 @@ function removeUnwantedProps(props) {
|
|
|
114
114
|
|
|
115
115
|
const LabelWithTooltipInfo = ({ label, tooltipInfo, labelStyle }) =>
|
|
116
116
|
tooltipInfo ? (
|
|
117
|
-
<
|
|
117
|
+
<span style={{ display: "flex", alignItems: "center", ...labelStyle }}>
|
|
118
118
|
{label}{" "}
|
|
119
119
|
<InfoHelper
|
|
120
120
|
style={{ marginLeft: "5px", marginTop: "-6px" }}
|
|
121
121
|
size={12}
|
|
122
122
|
content={tooltipInfo}
|
|
123
123
|
/>
|
|
124
|
-
</
|
|
124
|
+
</span>
|
|
125
125
|
) : (
|
|
126
126
|
label || null
|
|
127
127
|
);
|
package/src/autoTooltip.js
CHANGED
package/src/index.js
CHANGED
|
@@ -85,3 +85,4 @@ const noop = () => undefined;
|
|
|
85
85
|
export { noop };
|
|
86
86
|
export { default as showDialogOnDocBody } from "./showDialogOnDocBody";
|
|
87
87
|
export { default as TableFormTrackerContext } from "./DataTable/TableFormTrackerContext";
|
|
88
|
+
export { initializeHasuraWhereAndFilter } from "./DataTable/utils/initializeHasuraWhereAndFilter";
|