@trackunit/react-table-helpers 1.7.83 → 1.7.85
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/index.cjs.js +358 -5
- package/index.esm.js +356 -6
- package/package.json +20 -11
- package/src/ExportTableButton/ExportTableButton.d.ts +17 -0
- package/src/generated/graphql-api/fragment-masking.d.ts +19 -0
- package/src/generated/graphql-api/gql.d.ts +35 -0
- package/src/generated/graphql-api/graphql.d.ts +330 -0
- package/src/generated/graphql-api/index.d.ts +2 -0
- package/src/index.d.ts +3 -0
- package/src/useColumnDefinitionsFromCustomFieldDefinition/customFieldToExportString.d.ts +7 -0
package/index.cjs.js
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var reactTable = require('@trackunit/react-table');
|
|
5
|
+
var reactComponents = require('@trackunit/react-components');
|
|
6
|
+
var reactCoreHooks = require('@trackunit/react-core-hooks');
|
|
8
7
|
var react = require('react');
|
|
9
8
|
var polyfill = require('@js-temporal/polyfill');
|
|
10
9
|
var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
|
|
11
10
|
var reactTableBaseComponents = require('@trackunit/react-table-base-components');
|
|
11
|
+
var customFieldComponents = require('@trackunit/custom-field-components');
|
|
12
|
+
var filtersGraphqlHook = require('@trackunit/filters-graphql-hook');
|
|
13
|
+
var reactTable = require('@trackunit/react-table');
|
|
12
14
|
|
|
13
15
|
var defaultTranslations = {
|
|
14
16
|
|
|
@@ -52,6 +54,56 @@ const setupLibraryTranslations = () => {
|
|
|
52
54
|
i18nLibraryTranslation.registerTranslations(translations);
|
|
53
55
|
};
|
|
54
56
|
|
|
57
|
+
/**
|
|
58
|
+
* This component is used to export the table data to an Excel file.
|
|
59
|
+
*/
|
|
60
|
+
const ExportTableButton = ({ columnVisibility, rowCount, allTableColumns, variables, document, name, headers, }) => {
|
|
61
|
+
const { exportData } = reactCoreHooks.useExportDataContext();
|
|
62
|
+
const exportColumns = react.useMemo(() => {
|
|
63
|
+
return allTableColumns
|
|
64
|
+
.filter(column => columnVisibility[column.id] === true)
|
|
65
|
+
.reduce((acc, value) => {
|
|
66
|
+
const metaExport = value.columnDef.meta?.export;
|
|
67
|
+
if (!metaExport || !value.columnDef.id || value.columnDef.header === undefined) {
|
|
68
|
+
return acc;
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(metaExport)) {
|
|
71
|
+
return [
|
|
72
|
+
...acc,
|
|
73
|
+
...metaExport
|
|
74
|
+
.filter(exportColumn => acc.find(column => column.id === exportColumn.id) === undefined)
|
|
75
|
+
.map(exportColumn => ({
|
|
76
|
+
...exportColumn,
|
|
77
|
+
})),
|
|
78
|
+
];
|
|
79
|
+
}
|
|
80
|
+
else if (acc.find(column => column.id === value.columnDef.id?.toString()) === undefined) {
|
|
81
|
+
return [
|
|
82
|
+
...acc,
|
|
83
|
+
{
|
|
84
|
+
...metaExport,
|
|
85
|
+
id: value.columnDef.id.toString(),
|
|
86
|
+
header: value.columnDef.header.toString(),
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
return acc;
|
|
91
|
+
}, []);
|
|
92
|
+
}, [allTableColumns, columnVisibility]);
|
|
93
|
+
if (exportColumns.length === 0) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return (jsxRuntime.jsx(reactComponents.Button, { dataTestId: "export-table-button", disabled: rowCount === 0, onClick: () => {
|
|
97
|
+
void exportData({
|
|
98
|
+
document,
|
|
99
|
+
variables: variables,
|
|
100
|
+
columns: exportColumns,
|
|
101
|
+
name,
|
|
102
|
+
headers: headers ?? {},
|
|
103
|
+
});
|
|
104
|
+
}, variant: "secondary", children: "Export" }));
|
|
105
|
+
};
|
|
106
|
+
|
|
55
107
|
/**
|
|
56
108
|
* Takes a custom fields data object and returns a react node that can be used as a cell in a table.
|
|
57
109
|
*/
|
|
@@ -95,6 +147,298 @@ const customFieldToCell = (customField, unitTranslation, unitPreference, languag
|
|
|
95
147
|
}
|
|
96
148
|
};
|
|
97
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Takes a custom fields data object and returns a react node that can be used as a cell in a table.
|
|
152
|
+
*/
|
|
153
|
+
const customFieldToExportString = (customField, unitTranslation, unitPreference, language) => {
|
|
154
|
+
const type = customField.__typename;
|
|
155
|
+
switch (type) {
|
|
156
|
+
case "BooleanFieldValueAndDefinition": {
|
|
157
|
+
const checked = customField.booleanValue ?? false;
|
|
158
|
+
return checked;
|
|
159
|
+
}
|
|
160
|
+
case "StringFieldValueAndDefinition":
|
|
161
|
+
return customField.stringValue?.toString() ?? "";
|
|
162
|
+
case "EmailFieldValueAndDefinition":
|
|
163
|
+
return customField.emailValue?.toString() ?? "";
|
|
164
|
+
case "PhoneNumberFieldValueAndDefinition":
|
|
165
|
+
return customField.phoneNumberValue?.toString() ?? "";
|
|
166
|
+
case "WebAddressFieldValueAndDefinition": {
|
|
167
|
+
return customField.webAddressValue ?? "";
|
|
168
|
+
}
|
|
169
|
+
case "DateFieldValueAndDefinition": {
|
|
170
|
+
const date = customField.dateValue;
|
|
171
|
+
return date;
|
|
172
|
+
}
|
|
173
|
+
case "StringListFieldValueAndDefinition":
|
|
174
|
+
case "DropDownFieldValueAndDefinition": {
|
|
175
|
+
const tags = customField.stringArrayValue ?? [];
|
|
176
|
+
return tags.join(", ");
|
|
177
|
+
}
|
|
178
|
+
case "JsonFieldValueAndDefinition":
|
|
179
|
+
return customField.jsonValue?.toString() ?? "";
|
|
180
|
+
case "NumberFieldValueAndDefinition": {
|
|
181
|
+
const unitType = unitPreference === "SI" ? customField.definition.unitSi : customField.definition.unitUs;
|
|
182
|
+
const value = Boolean(customField.numberValue) ? customField.numberValue + "" : undefined;
|
|
183
|
+
const updatedValue = irisAppRuntimeCore.getCustomFieldValueForDisplayInUI(value, unitType, unitPreference, language);
|
|
184
|
+
return `${updatedValue} ${unitTranslation(unitType)}`;
|
|
185
|
+
}
|
|
186
|
+
case "MonetaryFieldValueAndDefinition":
|
|
187
|
+
return customField.monetaryValue?.toString() ?? "";
|
|
188
|
+
default:
|
|
189
|
+
throw new Error(`Unexpected value: ${type}`);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const AssetCustomFieldsFragmentDoc = {
|
|
194
|
+
kind: "Document",
|
|
195
|
+
definitions: [
|
|
196
|
+
{
|
|
197
|
+
kind: "FragmentDefinition",
|
|
198
|
+
name: { kind: "Name", value: "AssetCustomFields" },
|
|
199
|
+
typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Asset" } },
|
|
200
|
+
selectionSet: {
|
|
201
|
+
kind: "SelectionSet",
|
|
202
|
+
selections: [
|
|
203
|
+
{
|
|
204
|
+
kind: "Field",
|
|
205
|
+
name: { kind: "Name", value: "customFields" },
|
|
206
|
+
arguments: [
|
|
207
|
+
{
|
|
208
|
+
kind: "Argument",
|
|
209
|
+
name: { kind: "Name", value: "definitionIds" },
|
|
210
|
+
value: { kind: "Variable", name: { kind: "Name", value: "definitionIds" } },
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
selectionSet: {
|
|
214
|
+
kind: "SelectionSet",
|
|
215
|
+
selections: [
|
|
216
|
+
{
|
|
217
|
+
kind: "Field",
|
|
218
|
+
name: { kind: "Name", value: "edges" },
|
|
219
|
+
selectionSet: {
|
|
220
|
+
kind: "SelectionSet",
|
|
221
|
+
selections: [
|
|
222
|
+
{
|
|
223
|
+
kind: "Field",
|
|
224
|
+
name: { kind: "Name", value: "node" },
|
|
225
|
+
selectionSet: {
|
|
226
|
+
kind: "SelectionSet",
|
|
227
|
+
selections: [
|
|
228
|
+
{ kind: "Field", name: { kind: "Name", value: "__typename" } },
|
|
229
|
+
{
|
|
230
|
+
kind: "Field",
|
|
231
|
+
name: { kind: "Name", value: "definition" },
|
|
232
|
+
selectionSet: {
|
|
233
|
+
kind: "SelectionSet",
|
|
234
|
+
selections: [
|
|
235
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
236
|
+
{ kind: "Field", name: { kind: "Name", value: "title" } },
|
|
237
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
kind: "InlineFragment",
|
|
243
|
+
typeCondition: {
|
|
244
|
+
kind: "NamedType",
|
|
245
|
+
name: { kind: "Name", value: "BooleanFieldValueAndDefinition" },
|
|
246
|
+
},
|
|
247
|
+
selectionSet: {
|
|
248
|
+
kind: "SelectionSet",
|
|
249
|
+
selections: [
|
|
250
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
251
|
+
{ kind: "Field", name: { kind: "Name", value: "booleanValue" } },
|
|
252
|
+
],
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
kind: "InlineFragment",
|
|
257
|
+
typeCondition: {
|
|
258
|
+
kind: "NamedType",
|
|
259
|
+
name: { kind: "Name", value: "DateFieldValueAndDefinition" },
|
|
260
|
+
},
|
|
261
|
+
selectionSet: {
|
|
262
|
+
kind: "SelectionSet",
|
|
263
|
+
selections: [
|
|
264
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
265
|
+
{ kind: "Field", name: { kind: "Name", value: "dateValue" } },
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
kind: "InlineFragment",
|
|
271
|
+
typeCondition: {
|
|
272
|
+
kind: "NamedType",
|
|
273
|
+
name: { kind: "Name", value: "DropDownFieldValueAndDefinition" },
|
|
274
|
+
},
|
|
275
|
+
selectionSet: {
|
|
276
|
+
kind: "SelectionSet",
|
|
277
|
+
selections: [
|
|
278
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
279
|
+
{ kind: "Field", name: { kind: "Name", value: "stringArrayValue" } },
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
kind: "InlineFragment",
|
|
285
|
+
typeCondition: {
|
|
286
|
+
kind: "NamedType",
|
|
287
|
+
name: { kind: "Name", value: "EmailFieldValueAndDefinition" },
|
|
288
|
+
},
|
|
289
|
+
selectionSet: {
|
|
290
|
+
kind: "SelectionSet",
|
|
291
|
+
selections: [
|
|
292
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
293
|
+
{ kind: "Field", name: { kind: "Name", value: "emailValue" } },
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
kind: "InlineFragment",
|
|
299
|
+
typeCondition: {
|
|
300
|
+
kind: "NamedType",
|
|
301
|
+
name: { kind: "Name", value: "NumberFieldValueAndDefinition" },
|
|
302
|
+
},
|
|
303
|
+
selectionSet: {
|
|
304
|
+
kind: "SelectionSet",
|
|
305
|
+
selections: [
|
|
306
|
+
{
|
|
307
|
+
kind: "Field",
|
|
308
|
+
name: { kind: "Name", value: "definition" },
|
|
309
|
+
selectionSet: {
|
|
310
|
+
kind: "SelectionSet",
|
|
311
|
+
selections: [
|
|
312
|
+
{ kind: "Field", name: { kind: "Name", value: "unitSi" } },
|
|
313
|
+
{ kind: "Field", name: { kind: "Name", value: "unitUs" } },
|
|
314
|
+
],
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
318
|
+
{
|
|
319
|
+
kind: "Field",
|
|
320
|
+
name: { kind: "Name", value: "numberValue" },
|
|
321
|
+
arguments: [
|
|
322
|
+
{
|
|
323
|
+
kind: "Argument",
|
|
324
|
+
name: { kind: "Name", value: "systemOfMeasurement" },
|
|
325
|
+
value: {
|
|
326
|
+
kind: "Variable",
|
|
327
|
+
name: { kind: "Name", value: "systemOfMeasurement" },
|
|
328
|
+
},
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
kind: "InlineFragment",
|
|
337
|
+
typeCondition: {
|
|
338
|
+
kind: "NamedType",
|
|
339
|
+
name: { kind: "Name", value: "PhoneNumberFieldValueAndDefinition" },
|
|
340
|
+
},
|
|
341
|
+
selectionSet: {
|
|
342
|
+
kind: "SelectionSet",
|
|
343
|
+
selections: [
|
|
344
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
345
|
+
{ kind: "Field", name: { kind: "Name", value: "phoneNumberValue" } },
|
|
346
|
+
],
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
kind: "InlineFragment",
|
|
351
|
+
typeCondition: {
|
|
352
|
+
kind: "NamedType",
|
|
353
|
+
name: { kind: "Name", value: "StringFieldValueAndDefinition" },
|
|
354
|
+
},
|
|
355
|
+
selectionSet: {
|
|
356
|
+
kind: "SelectionSet",
|
|
357
|
+
selections: [
|
|
358
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
359
|
+
{ kind: "Field", name: { kind: "Name", value: "stringValue" } },
|
|
360
|
+
],
|
|
361
|
+
},
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
kind: "InlineFragment",
|
|
365
|
+
typeCondition: {
|
|
366
|
+
kind: "NamedType",
|
|
367
|
+
name: { kind: "Name", value: "WebAddressFieldValueAndDefinition" },
|
|
368
|
+
},
|
|
369
|
+
selectionSet: {
|
|
370
|
+
kind: "SelectionSet",
|
|
371
|
+
selections: [
|
|
372
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
373
|
+
{ kind: "Field", name: { kind: "Name", value: "webAddressValue" } },
|
|
374
|
+
],
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
kind: "InlineFragment",
|
|
379
|
+
typeCondition: {
|
|
380
|
+
kind: "NamedType",
|
|
381
|
+
name: { kind: "Name", value: "JsonFieldValueAndDefinition" },
|
|
382
|
+
},
|
|
383
|
+
selectionSet: {
|
|
384
|
+
kind: "SelectionSet",
|
|
385
|
+
selections: [
|
|
386
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
387
|
+
{ kind: "Field", name: { kind: "Name", value: "jsonValue" } },
|
|
388
|
+
],
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
kind: "InlineFragment",
|
|
393
|
+
typeCondition: {
|
|
394
|
+
kind: "NamedType",
|
|
395
|
+
name: { kind: "Name", value: "MonetaryFieldValueAndDefinition" },
|
|
396
|
+
},
|
|
397
|
+
selectionSet: {
|
|
398
|
+
kind: "SelectionSet",
|
|
399
|
+
selections: [
|
|
400
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
401
|
+
{ kind: "Field", name: { kind: "Name", value: "monetaryValue" } },
|
|
402
|
+
],
|
|
403
|
+
},
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
kind: "InlineFragment",
|
|
407
|
+
typeCondition: {
|
|
408
|
+
kind: "NamedType",
|
|
409
|
+
name: { kind: "Name", value: "StringListFieldValueAndDefinition" },
|
|
410
|
+
},
|
|
411
|
+
selectionSet: {
|
|
412
|
+
kind: "SelectionSet",
|
|
413
|
+
selections: [
|
|
414
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
415
|
+
{ kind: "Field", name: { kind: "Name", value: "stringArrayValue" } },
|
|
416
|
+
],
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
],
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
kind: "Field",
|
|
427
|
+
name: { kind: "Name", value: "pageInfo" },
|
|
428
|
+
selectionSet: {
|
|
429
|
+
kind: "SelectionSet",
|
|
430
|
+
selections: [{ kind: "Field", name: { kind: "Name", value: "count" } }],
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
],
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
],
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
],
|
|
440
|
+
};
|
|
441
|
+
|
|
98
442
|
/**
|
|
99
443
|
* Generates an array of table column definitions based on custom field definitions.
|
|
100
444
|
*
|
|
@@ -119,11 +463,17 @@ const useColumnDefinitionsFromCustomFieldDefinition = ({ customFieldDefinitions,
|
|
|
119
463
|
})?.node, {
|
|
120
464
|
header: customFieldDefinition.node.title,
|
|
121
465
|
id: customFieldDefinition.node.id,
|
|
122
|
-
enableSorting: customFieldDefinition.node.__typename !== "DropDownFieldDefinition" &&
|
|
466
|
+
enableSorting: customFieldDefinition.node.__typename !== "DropDownFieldDefinition" &&
|
|
467
|
+
customFieldDefinition.node.__typename !== "StringListFieldDefinition",
|
|
123
468
|
meta: {
|
|
469
|
+
fragment: AssetCustomFieldsFragmentDoc,
|
|
124
470
|
hiddenByDefault: true,
|
|
125
|
-
isCustomField:
|
|
471
|
+
isCustomField: { definitionId: customFieldDefinition.node.id },
|
|
126
472
|
filterName: isKeyFound && filterBarDefinition ? filterBarDefinition[id]?.filterKey : undefined,
|
|
473
|
+
export: {
|
|
474
|
+
accessor: "customFields.edges[].node",
|
|
475
|
+
transformer: { type: "customFields", id: customFieldDefinition.node.id },
|
|
476
|
+
},
|
|
127
477
|
},
|
|
128
478
|
cell: cell => {
|
|
129
479
|
const cellValue = cell.getValue();
|
|
@@ -146,4 +496,7 @@ const useColumnDefinitionsFromCustomFieldDefinition = ({ customFieldDefinitions,
|
|
|
146
496
|
*/
|
|
147
497
|
setupLibraryTranslations();
|
|
148
498
|
|
|
499
|
+
exports.ExportTableButton = ExportTableButton;
|
|
500
|
+
exports.customFieldToCell = customFieldToCell;
|
|
501
|
+
exports.customFieldToExportString = customFieldToExportString;
|
|
149
502
|
exports.useColumnDefinitionsFromCustomFieldDefinition = useColumnDefinitionsFromCustomFieldDefinition;
|
package/index.esm.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { registerTranslations } from '@trackunit/i18n-library-translation';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createColumnHelper } from '@trackunit/react-table';
|
|
3
|
+
import { Button } from '@trackunit/react-components';
|
|
4
|
+
import { useExportDataContext } from '@trackunit/react-core-hooks';
|
|
6
5
|
import { useMemo } from 'react';
|
|
7
6
|
import { Temporal } from '@js-temporal/polyfill';
|
|
8
7
|
import { getCustomFieldValueForDisplayInUI } from '@trackunit/iris-app-runtime-core';
|
|
9
8
|
import { NumberCell, TextCell, TagsCell, PlainDateCell, LinkCell, CheckboxCell } from '@trackunit/react-table-base-components';
|
|
9
|
+
import { useUnitTranslation } from '@trackunit/custom-field-components';
|
|
10
|
+
import { CustomFieldPrefix } from '@trackunit/filters-graphql-hook';
|
|
11
|
+
import { createColumnHelper } from '@trackunit/react-table';
|
|
10
12
|
|
|
11
13
|
var defaultTranslations = {
|
|
12
14
|
|
|
@@ -50,6 +52,56 @@ const setupLibraryTranslations = () => {
|
|
|
50
52
|
registerTranslations(translations);
|
|
51
53
|
};
|
|
52
54
|
|
|
55
|
+
/**
|
|
56
|
+
* This component is used to export the table data to an Excel file.
|
|
57
|
+
*/
|
|
58
|
+
const ExportTableButton = ({ columnVisibility, rowCount, allTableColumns, variables, document, name, headers, }) => {
|
|
59
|
+
const { exportData } = useExportDataContext();
|
|
60
|
+
const exportColumns = useMemo(() => {
|
|
61
|
+
return allTableColumns
|
|
62
|
+
.filter(column => columnVisibility[column.id] === true)
|
|
63
|
+
.reduce((acc, value) => {
|
|
64
|
+
const metaExport = value.columnDef.meta?.export;
|
|
65
|
+
if (!metaExport || !value.columnDef.id || value.columnDef.header === undefined) {
|
|
66
|
+
return acc;
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(metaExport)) {
|
|
69
|
+
return [
|
|
70
|
+
...acc,
|
|
71
|
+
...metaExport
|
|
72
|
+
.filter(exportColumn => acc.find(column => column.id === exportColumn.id) === undefined)
|
|
73
|
+
.map(exportColumn => ({
|
|
74
|
+
...exportColumn,
|
|
75
|
+
})),
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
else if (acc.find(column => column.id === value.columnDef.id?.toString()) === undefined) {
|
|
79
|
+
return [
|
|
80
|
+
...acc,
|
|
81
|
+
{
|
|
82
|
+
...metaExport,
|
|
83
|
+
id: value.columnDef.id.toString(),
|
|
84
|
+
header: value.columnDef.header.toString(),
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
return acc;
|
|
89
|
+
}, []);
|
|
90
|
+
}, [allTableColumns, columnVisibility]);
|
|
91
|
+
if (exportColumns.length === 0) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return (jsx(Button, { dataTestId: "export-table-button", disabled: rowCount === 0, onClick: () => {
|
|
95
|
+
void exportData({
|
|
96
|
+
document,
|
|
97
|
+
variables: variables,
|
|
98
|
+
columns: exportColumns,
|
|
99
|
+
name,
|
|
100
|
+
headers: headers ?? {},
|
|
101
|
+
});
|
|
102
|
+
}, variant: "secondary", children: "Export" }));
|
|
103
|
+
};
|
|
104
|
+
|
|
53
105
|
/**
|
|
54
106
|
* Takes a custom fields data object and returns a react node that can be used as a cell in a table.
|
|
55
107
|
*/
|
|
@@ -93,6 +145,298 @@ const customFieldToCell = (customField, unitTranslation, unitPreference, languag
|
|
|
93
145
|
}
|
|
94
146
|
};
|
|
95
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Takes a custom fields data object and returns a react node that can be used as a cell in a table.
|
|
150
|
+
*/
|
|
151
|
+
const customFieldToExportString = (customField, unitTranslation, unitPreference, language) => {
|
|
152
|
+
const type = customField.__typename;
|
|
153
|
+
switch (type) {
|
|
154
|
+
case "BooleanFieldValueAndDefinition": {
|
|
155
|
+
const checked = customField.booleanValue ?? false;
|
|
156
|
+
return checked;
|
|
157
|
+
}
|
|
158
|
+
case "StringFieldValueAndDefinition":
|
|
159
|
+
return customField.stringValue?.toString() ?? "";
|
|
160
|
+
case "EmailFieldValueAndDefinition":
|
|
161
|
+
return customField.emailValue?.toString() ?? "";
|
|
162
|
+
case "PhoneNumberFieldValueAndDefinition":
|
|
163
|
+
return customField.phoneNumberValue?.toString() ?? "";
|
|
164
|
+
case "WebAddressFieldValueAndDefinition": {
|
|
165
|
+
return customField.webAddressValue ?? "";
|
|
166
|
+
}
|
|
167
|
+
case "DateFieldValueAndDefinition": {
|
|
168
|
+
const date = customField.dateValue;
|
|
169
|
+
return date;
|
|
170
|
+
}
|
|
171
|
+
case "StringListFieldValueAndDefinition":
|
|
172
|
+
case "DropDownFieldValueAndDefinition": {
|
|
173
|
+
const tags = customField.stringArrayValue ?? [];
|
|
174
|
+
return tags.join(", ");
|
|
175
|
+
}
|
|
176
|
+
case "JsonFieldValueAndDefinition":
|
|
177
|
+
return customField.jsonValue?.toString() ?? "";
|
|
178
|
+
case "NumberFieldValueAndDefinition": {
|
|
179
|
+
const unitType = unitPreference === "SI" ? customField.definition.unitSi : customField.definition.unitUs;
|
|
180
|
+
const value = Boolean(customField.numberValue) ? customField.numberValue + "" : undefined;
|
|
181
|
+
const updatedValue = getCustomFieldValueForDisplayInUI(value, unitType, unitPreference, language);
|
|
182
|
+
return `${updatedValue} ${unitTranslation(unitType)}`;
|
|
183
|
+
}
|
|
184
|
+
case "MonetaryFieldValueAndDefinition":
|
|
185
|
+
return customField.monetaryValue?.toString() ?? "";
|
|
186
|
+
default:
|
|
187
|
+
throw new Error(`Unexpected value: ${type}`);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const AssetCustomFieldsFragmentDoc = {
|
|
192
|
+
kind: "Document",
|
|
193
|
+
definitions: [
|
|
194
|
+
{
|
|
195
|
+
kind: "FragmentDefinition",
|
|
196
|
+
name: { kind: "Name", value: "AssetCustomFields" },
|
|
197
|
+
typeCondition: { kind: "NamedType", name: { kind: "Name", value: "Asset" } },
|
|
198
|
+
selectionSet: {
|
|
199
|
+
kind: "SelectionSet",
|
|
200
|
+
selections: [
|
|
201
|
+
{
|
|
202
|
+
kind: "Field",
|
|
203
|
+
name: { kind: "Name", value: "customFields" },
|
|
204
|
+
arguments: [
|
|
205
|
+
{
|
|
206
|
+
kind: "Argument",
|
|
207
|
+
name: { kind: "Name", value: "definitionIds" },
|
|
208
|
+
value: { kind: "Variable", name: { kind: "Name", value: "definitionIds" } },
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
selectionSet: {
|
|
212
|
+
kind: "SelectionSet",
|
|
213
|
+
selections: [
|
|
214
|
+
{
|
|
215
|
+
kind: "Field",
|
|
216
|
+
name: { kind: "Name", value: "edges" },
|
|
217
|
+
selectionSet: {
|
|
218
|
+
kind: "SelectionSet",
|
|
219
|
+
selections: [
|
|
220
|
+
{
|
|
221
|
+
kind: "Field",
|
|
222
|
+
name: { kind: "Name", value: "node" },
|
|
223
|
+
selectionSet: {
|
|
224
|
+
kind: "SelectionSet",
|
|
225
|
+
selections: [
|
|
226
|
+
{ kind: "Field", name: { kind: "Name", value: "__typename" } },
|
|
227
|
+
{
|
|
228
|
+
kind: "Field",
|
|
229
|
+
name: { kind: "Name", value: "definition" },
|
|
230
|
+
selectionSet: {
|
|
231
|
+
kind: "SelectionSet",
|
|
232
|
+
selections: [
|
|
233
|
+
{ kind: "Field", name: { kind: "Name", value: "id" } },
|
|
234
|
+
{ kind: "Field", name: { kind: "Name", value: "title" } },
|
|
235
|
+
{ kind: "Field", name: { kind: "Name", value: "key" } },
|
|
236
|
+
],
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
kind: "InlineFragment",
|
|
241
|
+
typeCondition: {
|
|
242
|
+
kind: "NamedType",
|
|
243
|
+
name: { kind: "Name", value: "BooleanFieldValueAndDefinition" },
|
|
244
|
+
},
|
|
245
|
+
selectionSet: {
|
|
246
|
+
kind: "SelectionSet",
|
|
247
|
+
selections: [
|
|
248
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
249
|
+
{ kind: "Field", name: { kind: "Name", value: "booleanValue" } },
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
kind: "InlineFragment",
|
|
255
|
+
typeCondition: {
|
|
256
|
+
kind: "NamedType",
|
|
257
|
+
name: { kind: "Name", value: "DateFieldValueAndDefinition" },
|
|
258
|
+
},
|
|
259
|
+
selectionSet: {
|
|
260
|
+
kind: "SelectionSet",
|
|
261
|
+
selections: [
|
|
262
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
263
|
+
{ kind: "Field", name: { kind: "Name", value: "dateValue" } },
|
|
264
|
+
],
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
kind: "InlineFragment",
|
|
269
|
+
typeCondition: {
|
|
270
|
+
kind: "NamedType",
|
|
271
|
+
name: { kind: "Name", value: "DropDownFieldValueAndDefinition" },
|
|
272
|
+
},
|
|
273
|
+
selectionSet: {
|
|
274
|
+
kind: "SelectionSet",
|
|
275
|
+
selections: [
|
|
276
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
277
|
+
{ kind: "Field", name: { kind: "Name", value: "stringArrayValue" } },
|
|
278
|
+
],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
kind: "InlineFragment",
|
|
283
|
+
typeCondition: {
|
|
284
|
+
kind: "NamedType",
|
|
285
|
+
name: { kind: "Name", value: "EmailFieldValueAndDefinition" },
|
|
286
|
+
},
|
|
287
|
+
selectionSet: {
|
|
288
|
+
kind: "SelectionSet",
|
|
289
|
+
selections: [
|
|
290
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
291
|
+
{ kind: "Field", name: { kind: "Name", value: "emailValue" } },
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
kind: "InlineFragment",
|
|
297
|
+
typeCondition: {
|
|
298
|
+
kind: "NamedType",
|
|
299
|
+
name: { kind: "Name", value: "NumberFieldValueAndDefinition" },
|
|
300
|
+
},
|
|
301
|
+
selectionSet: {
|
|
302
|
+
kind: "SelectionSet",
|
|
303
|
+
selections: [
|
|
304
|
+
{
|
|
305
|
+
kind: "Field",
|
|
306
|
+
name: { kind: "Name", value: "definition" },
|
|
307
|
+
selectionSet: {
|
|
308
|
+
kind: "SelectionSet",
|
|
309
|
+
selections: [
|
|
310
|
+
{ kind: "Field", name: { kind: "Name", value: "unitSi" } },
|
|
311
|
+
{ kind: "Field", name: { kind: "Name", value: "unitUs" } },
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
316
|
+
{
|
|
317
|
+
kind: "Field",
|
|
318
|
+
name: { kind: "Name", value: "numberValue" },
|
|
319
|
+
arguments: [
|
|
320
|
+
{
|
|
321
|
+
kind: "Argument",
|
|
322
|
+
name: { kind: "Name", value: "systemOfMeasurement" },
|
|
323
|
+
value: {
|
|
324
|
+
kind: "Variable",
|
|
325
|
+
name: { kind: "Name", value: "systemOfMeasurement" },
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
kind: "InlineFragment",
|
|
335
|
+
typeCondition: {
|
|
336
|
+
kind: "NamedType",
|
|
337
|
+
name: { kind: "Name", value: "PhoneNumberFieldValueAndDefinition" },
|
|
338
|
+
},
|
|
339
|
+
selectionSet: {
|
|
340
|
+
kind: "SelectionSet",
|
|
341
|
+
selections: [
|
|
342
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
343
|
+
{ kind: "Field", name: { kind: "Name", value: "phoneNumberValue" } },
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
kind: "InlineFragment",
|
|
349
|
+
typeCondition: {
|
|
350
|
+
kind: "NamedType",
|
|
351
|
+
name: { kind: "Name", value: "StringFieldValueAndDefinition" },
|
|
352
|
+
},
|
|
353
|
+
selectionSet: {
|
|
354
|
+
kind: "SelectionSet",
|
|
355
|
+
selections: [
|
|
356
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
357
|
+
{ kind: "Field", name: { kind: "Name", value: "stringValue" } },
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
kind: "InlineFragment",
|
|
363
|
+
typeCondition: {
|
|
364
|
+
kind: "NamedType",
|
|
365
|
+
name: { kind: "Name", value: "WebAddressFieldValueAndDefinition" },
|
|
366
|
+
},
|
|
367
|
+
selectionSet: {
|
|
368
|
+
kind: "SelectionSet",
|
|
369
|
+
selections: [
|
|
370
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
371
|
+
{ kind: "Field", name: { kind: "Name", value: "webAddressValue" } },
|
|
372
|
+
],
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
kind: "InlineFragment",
|
|
377
|
+
typeCondition: {
|
|
378
|
+
kind: "NamedType",
|
|
379
|
+
name: { kind: "Name", value: "JsonFieldValueAndDefinition" },
|
|
380
|
+
},
|
|
381
|
+
selectionSet: {
|
|
382
|
+
kind: "SelectionSet",
|
|
383
|
+
selections: [
|
|
384
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
385
|
+
{ kind: "Field", name: { kind: "Name", value: "jsonValue" } },
|
|
386
|
+
],
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
kind: "InlineFragment",
|
|
391
|
+
typeCondition: {
|
|
392
|
+
kind: "NamedType",
|
|
393
|
+
name: { kind: "Name", value: "MonetaryFieldValueAndDefinition" },
|
|
394
|
+
},
|
|
395
|
+
selectionSet: {
|
|
396
|
+
kind: "SelectionSet",
|
|
397
|
+
selections: [
|
|
398
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
399
|
+
{ kind: "Field", name: { kind: "Name", value: "monetaryValue" } },
|
|
400
|
+
],
|
|
401
|
+
},
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
kind: "InlineFragment",
|
|
405
|
+
typeCondition: {
|
|
406
|
+
kind: "NamedType",
|
|
407
|
+
name: { kind: "Name", value: "StringListFieldValueAndDefinition" },
|
|
408
|
+
},
|
|
409
|
+
selectionSet: {
|
|
410
|
+
kind: "SelectionSet",
|
|
411
|
+
selections: [
|
|
412
|
+
{ kind: "Field", name: { kind: "Name", value: "valueId" } },
|
|
413
|
+
{ kind: "Field", name: { kind: "Name", value: "stringArrayValue" } },
|
|
414
|
+
],
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
],
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
],
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
kind: "Field",
|
|
425
|
+
name: { kind: "Name", value: "pageInfo" },
|
|
426
|
+
selectionSet: {
|
|
427
|
+
kind: "SelectionSet",
|
|
428
|
+
selections: [{ kind: "Field", name: { kind: "Name", value: "count" } }],
|
|
429
|
+
},
|
|
430
|
+
},
|
|
431
|
+
],
|
|
432
|
+
},
|
|
433
|
+
},
|
|
434
|
+
],
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
],
|
|
438
|
+
};
|
|
439
|
+
|
|
96
440
|
/**
|
|
97
441
|
* Generates an array of table column definitions based on custom field definitions.
|
|
98
442
|
*
|
|
@@ -117,11 +461,17 @@ const useColumnDefinitionsFromCustomFieldDefinition = ({ customFieldDefinitions,
|
|
|
117
461
|
})?.node, {
|
|
118
462
|
header: customFieldDefinition.node.title,
|
|
119
463
|
id: customFieldDefinition.node.id,
|
|
120
|
-
enableSorting: customFieldDefinition.node.__typename !== "DropDownFieldDefinition" &&
|
|
464
|
+
enableSorting: customFieldDefinition.node.__typename !== "DropDownFieldDefinition" &&
|
|
465
|
+
customFieldDefinition.node.__typename !== "StringListFieldDefinition",
|
|
121
466
|
meta: {
|
|
467
|
+
fragment: AssetCustomFieldsFragmentDoc,
|
|
122
468
|
hiddenByDefault: true,
|
|
123
|
-
isCustomField:
|
|
469
|
+
isCustomField: { definitionId: customFieldDefinition.node.id },
|
|
124
470
|
filterName: isKeyFound && filterBarDefinition ? filterBarDefinition[id]?.filterKey : undefined,
|
|
471
|
+
export: {
|
|
472
|
+
accessor: "customFields.edges[].node",
|
|
473
|
+
transformer: { type: "customFields", id: customFieldDefinition.node.id },
|
|
474
|
+
},
|
|
125
475
|
},
|
|
126
476
|
cell: cell => {
|
|
127
477
|
const cellValue = cell.getValue();
|
|
@@ -144,4 +494,4 @@ const useColumnDefinitionsFromCustomFieldDefinition = ({ customFieldDefinitions,
|
|
|
144
494
|
*/
|
|
145
495
|
setupLibraryTranslations();
|
|
146
496
|
|
|
147
|
-
export { useColumnDefinitionsFromCustomFieldDefinition };
|
|
497
|
+
export { ExportTableButton, customFieldToCell, customFieldToExportString, useColumnDefinitionsFromCustomFieldDefinition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-table-helpers",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.85",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -8,17 +8,26 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"react": "19.0.0",
|
|
11
|
-
"@trackunit/filters-filter-bar": "1.8.
|
|
12
|
-
"@trackunit/filters-graphql-hook": "1.11.
|
|
13
|
-
"@trackunit/i18n-library-translation": "1.7.
|
|
14
|
-
"@trackunit/custom-field-components": "1.7.
|
|
15
|
-
"@trackunit/iris-app-runtime-core": "1.8.
|
|
16
|
-
"@trackunit/react-core-contexts-api": "1.8.
|
|
17
|
-
"@trackunit/react-table-base-components": "1.7.
|
|
18
|
-
"@trackunit/iris-app-runtime-core-api": "1.7.
|
|
19
|
-
"@trackunit/react-table": "1.7.
|
|
11
|
+
"@trackunit/filters-filter-bar": "1.8.80",
|
|
12
|
+
"@trackunit/filters-graphql-hook": "1.11.23",
|
|
13
|
+
"@trackunit/i18n-library-translation": "1.7.59",
|
|
14
|
+
"@trackunit/custom-field-components": "1.7.76",
|
|
15
|
+
"@trackunit/iris-app-runtime-core": "1.8.52",
|
|
16
|
+
"@trackunit/react-core-contexts-api": "1.8.52",
|
|
17
|
+
"@trackunit/react-table-base-components": "1.7.78",
|
|
18
|
+
"@trackunit/iris-app-runtime-core-api": "1.7.52",
|
|
19
|
+
"@trackunit/react-table": "1.7.79",
|
|
20
20
|
"@trackunit/react-test-setup": "1.4.47",
|
|
21
|
-
"@js-temporal/polyfill": "^0.5.1"
|
|
21
|
+
"@js-temporal/polyfill": "^0.5.1",
|
|
22
|
+
"@tanstack/react-table": "^8.20.6",
|
|
23
|
+
"@trackunit/react-components": "1.10.13",
|
|
24
|
+
"@trackunit/react-core-hooks": "1.7.56",
|
|
25
|
+
"@trackunit/react-graphql-hooks": "1.7.73",
|
|
26
|
+
"@trackunit/iris-app-api": "1.7.49",
|
|
27
|
+
"@graphql-codegen/cli": "^5.0.3",
|
|
28
|
+
"@trackunit/iris-app-build-utilities": "1.7.49",
|
|
29
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
30
|
+
"graphql": "^16.10.0"
|
|
22
31
|
},
|
|
23
32
|
"module": "./index.esm.js",
|
|
24
33
|
"main": "./index.cjs.js",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Column, VisibilityState } from "@tanstack/react-table";
|
|
2
|
+
import { TypedDocumentNode } from "@trackunit/react-graphql-hooks";
|
|
3
|
+
import { ReactElement } from "react";
|
|
4
|
+
interface ExportTableButtonProps<TData, TVariables> {
|
|
5
|
+
document: TypedDocumentNode<TData, TVariables>;
|
|
6
|
+
variables: TVariables;
|
|
7
|
+
columnVisibility: VisibilityState;
|
|
8
|
+
allTableColumns: Array<Column<any, unknown>>;
|
|
9
|
+
rowCount: number;
|
|
10
|
+
name: string;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* This component is used to export the table data to an Excel file.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ExportTableButton: <TData, TVariables>({ columnVisibility, rowCount, allTableColumns, variables, document, name, headers, }: ExportTableButtonProps<TData, TVariables>) => ReactElement | null;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
import { Incremental } from './graphql';
|
|
3
|
+
export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{
|
|
4
|
+
' $fragmentName'?: infer TKey;
|
|
5
|
+
}] ? TKey extends string ? {
|
|
6
|
+
' $fragmentRefs'?: {
|
|
7
|
+
[key in TKey]: TType;
|
|
8
|
+
};
|
|
9
|
+
} : never : never : never;
|
|
10
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>): TType;
|
|
11
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined): TType | undefined;
|
|
12
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null): TType | null;
|
|
13
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined): TType | null | undefined;
|
|
14
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>): Array<TType>;
|
|
15
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): Array<TType> | null | undefined;
|
|
16
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
|
|
17
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
|
|
18
|
+
export declare function makeFragmentData<F extends DocumentTypeDecoration<any, any>, FT extends ResultOf<F>>(data: FT, _fragment: F): FragmentType<F>;
|
|
19
|
+
export declare function isFragmentReady<TQuery, TFrag>(queryNode: DocumentTypeDecoration<TQuery, any>, fragmentNode: TypedDocumentNode<TFrag>, data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined): data is FragmentType<typeof fragmentNode>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as types from './graphql';
|
|
2
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
+
/**
|
|
4
|
+
* Map of all GraphQL operations in the project.
|
|
5
|
+
*
|
|
6
|
+
* This map has several performance disadvantages:
|
|
7
|
+
* 1. It is not tree-shakeable, so it will include all operations in the project.
|
|
8
|
+
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
|
|
9
|
+
* 3. It does not support dead code elimination, so it will add unused operations.
|
|
10
|
+
*
|
|
11
|
+
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
12
|
+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
|
|
13
|
+
*/
|
|
14
|
+
declare const documents: {
|
|
15
|
+
"fragment AssetCustomFields on Asset {\n customFields(definitionIds: $definitionIds) {\n edges {\n node {\n __typename\n definition {\n id\n title\n key\n }\n ... on BooleanFieldValueAndDefinition {\n valueId\n booleanValue\n }\n ... on DateFieldValueAndDefinition {\n valueId\n dateValue\n }\n ... on DropDownFieldValueAndDefinition {\n valueId\n stringArrayValue\n }\n ... on EmailFieldValueAndDefinition {\n valueId\n emailValue\n }\n ... on NumberFieldValueAndDefinition {\n definition {\n unitSi\n unitUs\n }\n valueId\n numberValue(systemOfMeasurement: $systemOfMeasurement)\n }\n ... on PhoneNumberFieldValueAndDefinition {\n valueId\n phoneNumberValue\n }\n ... on StringFieldValueAndDefinition {\n valueId\n stringValue\n }\n ... on WebAddressFieldValueAndDefinition {\n valueId\n webAddressValue\n }\n ... on JsonFieldValueAndDefinition {\n valueId\n jsonValue\n }\n ... on MonetaryFieldValueAndDefinition {\n valueId\n monetaryValue\n }\n ... on StringListFieldValueAndDefinition {\n valueId\n stringArrayValue\n }\n }\n }\n pageInfo {\n count\n }\n }\n}": DocumentNode<types.AssetCustomFieldsFragment, unknown>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The query argument is unknown!
|
|
27
|
+
* Please regenerate the types.
|
|
28
|
+
*/
|
|
29
|
+
export declare function graphql(source: string): unknown;
|
|
30
|
+
/**
|
|
31
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
32
|
+
*/
|
|
33
|
+
export declare function graphql(source: "fragment AssetCustomFields on Asset {\n customFields(definitionIds: $definitionIds) {\n edges {\n node {\n __typename\n definition {\n id\n title\n key\n }\n ... on BooleanFieldValueAndDefinition {\n valueId\n booleanValue\n }\n ... on DateFieldValueAndDefinition {\n valueId\n dateValue\n }\n ... on DropDownFieldValueAndDefinition {\n valueId\n stringArrayValue\n }\n ... on EmailFieldValueAndDefinition {\n valueId\n emailValue\n }\n ... on NumberFieldValueAndDefinition {\n definition {\n unitSi\n unitUs\n }\n valueId\n numberValue(systemOfMeasurement: $systemOfMeasurement)\n }\n ... on PhoneNumberFieldValueAndDefinition {\n valueId\n phoneNumberValue\n }\n ... on StringFieldValueAndDefinition {\n valueId\n stringValue\n }\n ... on WebAddressFieldValueAndDefinition {\n valueId\n webAddressValue\n }\n ... on JsonFieldValueAndDefinition {\n valueId\n jsonValue\n }\n ... on MonetaryFieldValueAndDefinition {\n valueId\n monetaryValue\n }\n ... on StringListFieldValueAndDefinition {\n valueId\n stringArrayValue\n }\n }\n }\n pageInfo {\n count\n }\n }\n}"): (typeof documents)["fragment AssetCustomFields on Asset {\n customFields(definitionIds: $definitionIds) {\n edges {\n node {\n __typename\n definition {\n id\n title\n key\n }\n ... on BooleanFieldValueAndDefinition {\n valueId\n booleanValue\n }\n ... on DateFieldValueAndDefinition {\n valueId\n dateValue\n }\n ... on DropDownFieldValueAndDefinition {\n valueId\n stringArrayValue\n }\n ... on EmailFieldValueAndDefinition {\n valueId\n emailValue\n }\n ... on NumberFieldValueAndDefinition {\n definition {\n unitSi\n unitUs\n }\n valueId\n numberValue(systemOfMeasurement: $systemOfMeasurement)\n }\n ... on PhoneNumberFieldValueAndDefinition {\n valueId\n phoneNumberValue\n }\n ... on StringFieldValueAndDefinition {\n valueId\n stringValue\n }\n ... on WebAddressFieldValueAndDefinition {\n valueId\n webAddressValue\n }\n ... on JsonFieldValueAndDefinition {\n valueId\n jsonValue\n }\n ... on MonetaryFieldValueAndDefinition {\n valueId\n monetaryValue\n }\n ... on StringListFieldValueAndDefinition {\n valueId\n stringArrayValue\n }\n }\n }\n pageInfo {\n count\n }\n }\n}"];
|
|
34
|
+
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/core";
|
|
2
|
+
import type { PublicIrisAppManifest } from "@trackunit/iris-app-api";
|
|
3
|
+
export type Maybe<T> = T | null;
|
|
4
|
+
export type InputMaybe<T> = Maybe<T> | undefined;
|
|
5
|
+
export type Exact<T extends {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}> = {
|
|
8
|
+
[K in keyof T]: T[K];
|
|
9
|
+
};
|
|
10
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
11
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
12
|
+
};
|
|
13
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
14
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
15
|
+
};
|
|
16
|
+
export type MakeEmpty<T extends {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}, K extends keyof T> = {
|
|
19
|
+
[_ in K]?: never;
|
|
20
|
+
};
|
|
21
|
+
export type Incremental<T> = T | {
|
|
22
|
+
[P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never;
|
|
23
|
+
};
|
|
24
|
+
export type DateTimeISOString = string;
|
|
25
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
26
|
+
export type Scalars = {
|
|
27
|
+
ID: {
|
|
28
|
+
input: string;
|
|
29
|
+
output: string;
|
|
30
|
+
};
|
|
31
|
+
String: {
|
|
32
|
+
input: string;
|
|
33
|
+
output: string;
|
|
34
|
+
};
|
|
35
|
+
Boolean: {
|
|
36
|
+
input: boolean;
|
|
37
|
+
output: boolean;
|
|
38
|
+
};
|
|
39
|
+
Int: {
|
|
40
|
+
input: number;
|
|
41
|
+
output: number;
|
|
42
|
+
};
|
|
43
|
+
Float: {
|
|
44
|
+
input: number;
|
|
45
|
+
output: number;
|
|
46
|
+
};
|
|
47
|
+
/** The ISO 4217 currency code of the monetary field definition. */
|
|
48
|
+
Currency: {
|
|
49
|
+
input: string;
|
|
50
|
+
output: string;
|
|
51
|
+
};
|
|
52
|
+
/** Cursor scalar. */
|
|
53
|
+
Cursor: {
|
|
54
|
+
input: string;
|
|
55
|
+
output: string;
|
|
56
|
+
};
|
|
57
|
+
/** Date without time, Eg. 2019-01-01 */
|
|
58
|
+
Date: {
|
|
59
|
+
input: DateTimeISOString;
|
|
60
|
+
output: DateTimeISOString;
|
|
61
|
+
};
|
|
62
|
+
/** DateTime represents a “date-time” as specified in section 5.6 of RFC 3339 */
|
|
63
|
+
DateTime: {
|
|
64
|
+
input: DateTimeISOString;
|
|
65
|
+
output: DateTimeISOString;
|
|
66
|
+
};
|
|
67
|
+
/** Duration represents an ISO 8601 duration */
|
|
68
|
+
Duration: {
|
|
69
|
+
input: any;
|
|
70
|
+
output: any;
|
|
71
|
+
};
|
|
72
|
+
/** Valid email address according to https://owasp.org/www-community/OWASP_Validation_Regex_Repository */
|
|
73
|
+
EmailAddress: {
|
|
74
|
+
input: string;
|
|
75
|
+
output: string;
|
|
76
|
+
};
|
|
77
|
+
/** A (possiblely multidimensional) set of coordinates following x, y, z order. */
|
|
78
|
+
GeoJSONCoordinates: {
|
|
79
|
+
input: [number, number] | [number, number][] | [number, number][][];
|
|
80
|
+
output: [number, number] | [number, number][] | [number, number][][];
|
|
81
|
+
};
|
|
82
|
+
Integer: {
|
|
83
|
+
input: any;
|
|
84
|
+
output: any;
|
|
85
|
+
};
|
|
86
|
+
/** Raw JSON object structure, not serialized to string */
|
|
87
|
+
JSON: {
|
|
88
|
+
input: any;
|
|
89
|
+
output: any;
|
|
90
|
+
};
|
|
91
|
+
/** The `JSONObject` scalar type represents JSON values as a string */
|
|
92
|
+
JSONObject: {
|
|
93
|
+
input: any;
|
|
94
|
+
output: any;
|
|
95
|
+
};
|
|
96
|
+
/** LocalDate scalar */
|
|
97
|
+
LocalDate: {
|
|
98
|
+
input: any;
|
|
99
|
+
output: any;
|
|
100
|
+
};
|
|
101
|
+
/** 24-hour clock time string in the format hh:mm:ss.sss or hh:mm:ss if partial seconds is zero */
|
|
102
|
+
LocalTime: {
|
|
103
|
+
input: any;
|
|
104
|
+
output: any;
|
|
105
|
+
};
|
|
106
|
+
/** Javascript `Long`. Type represents a 64 bit integer. */
|
|
107
|
+
Long: {
|
|
108
|
+
input: any;
|
|
109
|
+
output: any;
|
|
110
|
+
};
|
|
111
|
+
/** Phone number in E.164 format */
|
|
112
|
+
PhoneNumber: {
|
|
113
|
+
input: string;
|
|
114
|
+
output: string;
|
|
115
|
+
};
|
|
116
|
+
/** The `PublicIrisAppManifest` scalar type represents an Iris App Manifest as JSON */
|
|
117
|
+
PublicIrisAppManifest: {
|
|
118
|
+
input: PublicIrisAppManifest;
|
|
119
|
+
output: PublicIrisAppManifest;
|
|
120
|
+
};
|
|
121
|
+
/** The `Upload` scalar type represents a file upload. */
|
|
122
|
+
Upload: {
|
|
123
|
+
input: any;
|
|
124
|
+
output: any;
|
|
125
|
+
};
|
|
126
|
+
/** Uniform resource locator */
|
|
127
|
+
Url: {
|
|
128
|
+
input: string;
|
|
129
|
+
output: string;
|
|
130
|
+
};
|
|
131
|
+
/** YearMonth scalar */
|
|
132
|
+
YearMonth: {
|
|
133
|
+
input: any;
|
|
134
|
+
output: any;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export declare const unitOfMeasurement: {
|
|
138
|
+
readonly ACRE: "ACRE";
|
|
139
|
+
readonly AMPERE: "AMPERE";
|
|
140
|
+
readonly AMPERE_HOUR: "AMPERE_HOUR";
|
|
141
|
+
readonly ARE: "ARE";
|
|
142
|
+
readonly BAR: "BAR";
|
|
143
|
+
readonly CELSIUS: "CELSIUS";
|
|
144
|
+
readonly CENTIMETRE: "CENTIMETRE";
|
|
145
|
+
readonly CUBIC_FOOT: "CUBIC_FOOT";
|
|
146
|
+
readonly CUBIC_METRE: "CUBIC_METRE";
|
|
147
|
+
readonly DAY: "DAY";
|
|
148
|
+
readonly DEGREE_ANGLE: "DEGREE_ANGLE";
|
|
149
|
+
readonly FAHRENHEIT: "FAHRENHEIT";
|
|
150
|
+
readonly FOOT: "FOOT";
|
|
151
|
+
readonly GALLONS_PER_HOUR: "GALLONS_PER_HOUR";
|
|
152
|
+
readonly GALLON_LIQUID: "GALLON_LIQUID";
|
|
153
|
+
readonly GRAM: "GRAM";
|
|
154
|
+
readonly G_FORCE: "G_FORCE";
|
|
155
|
+
readonly HECTARE: "HECTARE";
|
|
156
|
+
readonly HERTZ: "HERTZ";
|
|
157
|
+
readonly HOUR: "HOUR";
|
|
158
|
+
readonly INCH: "INCH";
|
|
159
|
+
readonly INCHES_OF_WATER: "INCHES_OF_WATER";
|
|
160
|
+
readonly KILOGRAM: "KILOGRAM";
|
|
161
|
+
readonly KILOGRAM_PER_HOUR: "KILOGRAM_PER_HOUR";
|
|
162
|
+
readonly KILOGRAM_PER_SECOND: "KILOGRAM_PER_SECOND";
|
|
163
|
+
readonly KILOMETRE: "KILOMETRE";
|
|
164
|
+
readonly KILOMETRE_PER_HOUR: "KILOMETRE_PER_HOUR";
|
|
165
|
+
readonly KILOPASCAL: "KILOPASCAL";
|
|
166
|
+
readonly KILOWATT: "KILOWATT";
|
|
167
|
+
readonly KILOWATT_HOUR: "KILOWATT_HOUR";
|
|
168
|
+
readonly LITRE: "LITRE";
|
|
169
|
+
readonly LITRES_PER_HOUR: "LITRES_PER_HOUR";
|
|
170
|
+
readonly METRE: "METRE";
|
|
171
|
+
readonly METRE_PER_SECOND: "METRE_PER_SECOND";
|
|
172
|
+
readonly METRE_PER_SECOND_SQUARED: "METRE_PER_SECOND_SQUARED";
|
|
173
|
+
readonly METRIC_TON: "METRIC_TON";
|
|
174
|
+
readonly MILE: "MILE";
|
|
175
|
+
readonly MILE_PER_HOUR: "MILE_PER_HOUR";
|
|
176
|
+
readonly MILLIMETRE: "MILLIMETRE";
|
|
177
|
+
readonly MILLISECOND: "MILLISECOND";
|
|
178
|
+
readonly MINUTE: "MINUTE";
|
|
179
|
+
readonly MONTH: "MONTH";
|
|
180
|
+
readonly NEWTON: "NEWTON";
|
|
181
|
+
readonly OUNCE: "OUNCE";
|
|
182
|
+
readonly PASCAL: "PASCAL";
|
|
183
|
+
readonly PERCENT: "PERCENT";
|
|
184
|
+
readonly POUND: "POUND";
|
|
185
|
+
readonly POUND_PER_HOUR: "POUND_PER_HOUR";
|
|
186
|
+
readonly POUND_PER_SECOND: "POUND_PER_SECOND";
|
|
187
|
+
readonly POUND_PER_SQUARE_INCH: "POUND_PER_SQUARE_INCH";
|
|
188
|
+
readonly REVOLUTIONS_PER_MINUTE: "REVOLUTIONS_PER_MINUTE";
|
|
189
|
+
readonly SECOND: "SECOND";
|
|
190
|
+
readonly SQUARE_FOOT: "SQUARE_FOOT";
|
|
191
|
+
readonly SQUARE_KILOMETRE: "SQUARE_KILOMETRE";
|
|
192
|
+
readonly SQUARE_METRE: "SQUARE_METRE";
|
|
193
|
+
readonly US_TON: "US_TON";
|
|
194
|
+
readonly VOLT: "VOLT";
|
|
195
|
+
readonly VOLT_AMPERE: "VOLT_AMPERE";
|
|
196
|
+
readonly WATT: "WATT";
|
|
197
|
+
readonly WEEK: "WEEK";
|
|
198
|
+
readonly YARD: "YARD";
|
|
199
|
+
readonly YEAR: "YEAR";
|
|
200
|
+
};
|
|
201
|
+
export type UnitOfMeasurement = (typeof unitOfMeasurement)[keyof typeof unitOfMeasurement];
|
|
202
|
+
export type AssetCustomFieldsFragment = {
|
|
203
|
+
__typename?: "Asset";
|
|
204
|
+
customFields: {
|
|
205
|
+
__typename?: "CustomFieldValueAndDefinitionConnection";
|
|
206
|
+
edges: Array<{
|
|
207
|
+
__typename?: "CustomFieldValueAndDefinitionEdge";
|
|
208
|
+
node: {
|
|
209
|
+
__typename: "BooleanFieldValueAndDefinition";
|
|
210
|
+
valueId: string | null;
|
|
211
|
+
booleanValue: boolean | null;
|
|
212
|
+
definition: {
|
|
213
|
+
__typename?: "BooleanFieldDefinition";
|
|
214
|
+
id: string;
|
|
215
|
+
title: string | null;
|
|
216
|
+
key: string | null;
|
|
217
|
+
};
|
|
218
|
+
} | {
|
|
219
|
+
__typename: "DateFieldValueAndDefinition";
|
|
220
|
+
valueId: string | null;
|
|
221
|
+
dateValue: DateTimeISOString | null;
|
|
222
|
+
definition: {
|
|
223
|
+
__typename?: "DateFieldDefinition";
|
|
224
|
+
id: string;
|
|
225
|
+
title: string | null;
|
|
226
|
+
key: string | null;
|
|
227
|
+
};
|
|
228
|
+
} | {
|
|
229
|
+
__typename: "DropDownFieldValueAndDefinition";
|
|
230
|
+
valueId: string | null;
|
|
231
|
+
stringArrayValue: Array<string> | null;
|
|
232
|
+
definition: {
|
|
233
|
+
__typename?: "DropDownFieldDefinition";
|
|
234
|
+
id: string;
|
|
235
|
+
title: string | null;
|
|
236
|
+
key: string | null;
|
|
237
|
+
};
|
|
238
|
+
} | {
|
|
239
|
+
__typename: "EmailFieldValueAndDefinition";
|
|
240
|
+
valueId: string | null;
|
|
241
|
+
emailValue: string | null;
|
|
242
|
+
definition: {
|
|
243
|
+
__typename?: "EmailFieldDefinition";
|
|
244
|
+
id: string;
|
|
245
|
+
title: string | null;
|
|
246
|
+
key: string | null;
|
|
247
|
+
};
|
|
248
|
+
} | {
|
|
249
|
+
__typename: "JsonFieldValueAndDefinition";
|
|
250
|
+
valueId: string | null;
|
|
251
|
+
jsonValue: any | null;
|
|
252
|
+
definition: {
|
|
253
|
+
__typename?: "JsonFieldDefinition";
|
|
254
|
+
id: string;
|
|
255
|
+
title: string | null;
|
|
256
|
+
key: string | null;
|
|
257
|
+
};
|
|
258
|
+
} | {
|
|
259
|
+
__typename: "MonetaryFieldValueAndDefinition";
|
|
260
|
+
valueId: string | null;
|
|
261
|
+
monetaryValue: number | null;
|
|
262
|
+
definition: {
|
|
263
|
+
__typename?: "MonetaryFieldDefinition";
|
|
264
|
+
id: string;
|
|
265
|
+
title: string | null;
|
|
266
|
+
key: string | null;
|
|
267
|
+
};
|
|
268
|
+
} | {
|
|
269
|
+
__typename: "NumberFieldValueAndDefinition";
|
|
270
|
+
valueId: string | null;
|
|
271
|
+
numberValue: number | null;
|
|
272
|
+
definition: {
|
|
273
|
+
__typename?: "NumberFieldDefinition";
|
|
274
|
+
unitSi: UnitOfMeasurement | null;
|
|
275
|
+
unitUs: UnitOfMeasurement | null;
|
|
276
|
+
id: string;
|
|
277
|
+
title: string | null;
|
|
278
|
+
key: string | null;
|
|
279
|
+
};
|
|
280
|
+
} | {
|
|
281
|
+
__typename: "PhoneNumberFieldValueAndDefinition";
|
|
282
|
+
valueId: string | null;
|
|
283
|
+
phoneNumberValue: string | null;
|
|
284
|
+
definition: {
|
|
285
|
+
__typename?: "PhoneNumberFieldDefinition";
|
|
286
|
+
id: string;
|
|
287
|
+
title: string | null;
|
|
288
|
+
key: string | null;
|
|
289
|
+
};
|
|
290
|
+
} | {
|
|
291
|
+
__typename: "StringFieldValueAndDefinition";
|
|
292
|
+
valueId: string | null;
|
|
293
|
+
stringValue: string | null;
|
|
294
|
+
definition: {
|
|
295
|
+
__typename?: "StringFieldDefinition";
|
|
296
|
+
id: string;
|
|
297
|
+
title: string | null;
|
|
298
|
+
key: string | null;
|
|
299
|
+
};
|
|
300
|
+
} | {
|
|
301
|
+
__typename: "StringListFieldValueAndDefinition";
|
|
302
|
+
valueId: string | null;
|
|
303
|
+
stringArrayValue: Array<string> | null;
|
|
304
|
+
definition: {
|
|
305
|
+
__typename?: "StringListFieldDefinition";
|
|
306
|
+
id: string;
|
|
307
|
+
title: string | null;
|
|
308
|
+
key: string | null;
|
|
309
|
+
};
|
|
310
|
+
} | {
|
|
311
|
+
__typename: "WebAddressFieldValueAndDefinition";
|
|
312
|
+
valueId: string | null;
|
|
313
|
+
webAddressValue: string | null;
|
|
314
|
+
definition: {
|
|
315
|
+
__typename?: "WebAddressFieldDefinition";
|
|
316
|
+
id: string;
|
|
317
|
+
title: string | null;
|
|
318
|
+
key: string | null;
|
|
319
|
+
};
|
|
320
|
+
} | null;
|
|
321
|
+
} | null> | null;
|
|
322
|
+
pageInfo: {
|
|
323
|
+
__typename?: "PageInfo";
|
|
324
|
+
count: number | null;
|
|
325
|
+
} | null;
|
|
326
|
+
} | null;
|
|
327
|
+
} & {
|
|
328
|
+
" $fragmentName"?: "AssetCustomFieldsFragment";
|
|
329
|
+
};
|
|
330
|
+
export declare const AssetCustomFieldsFragmentDoc: DocumentNode<AssetCustomFieldsFragment, unknown>;
|
package/src/index.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
export * from "./ExportTableButton/ExportTableButton";
|
|
2
|
+
export * from "./useColumnDefinitionsFromCustomFieldDefinition/customFieldToCell";
|
|
3
|
+
export * from "./useColumnDefinitionsFromCustomFieldDefinition/customFieldToExportString";
|
|
1
4
|
export type { CustomFieldData } from "./useColumnDefinitionsFromCustomFieldDefinition/types";
|
|
2
5
|
export * from "./useColumnDefinitionsFromCustomFieldDefinition/useColumnDefinitionsFromCustomFieldDefinition";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UnitType } from "@trackunit/custom-field-components";
|
|
2
|
+
import { SystemOfMeasurementType } from "@trackunit/react-core-contexts-api";
|
|
3
|
+
import { CustomFieldData } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Takes a custom fields data object and returns a react node that can be used as a cell in a table.
|
|
6
|
+
*/
|
|
7
|
+
export declare const customFieldToExportString: (customField: CustomFieldData, unitTranslation: (unit: UnitType) => string | null, unitPreference?: SystemOfMeasurementType | null, language?: string) => React.ReactNode;
|