@trackunit/react-table-helpers 2.33.5-alpha-c071292d523.0 → 3.0.0
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 +0 -388
- package/index.esm.js +2 -387
- package/migrations/assets/custom-field-table-helpers/package.json +31 -0
- package/migrations/utils/jsx-utils.js +233 -0
- package/migrations/utils/move-named-imports.js +409 -0
- package/migrations/utils/package-json-utils.js +73 -0
- package/migrations/v3-0-0/move-custom-field-table-helpers.js +70 -0
- package/migrations.json +7 -1
- package/package.json +6 -15
- package/src/index.d.ts +0 -4
- package/migrations/entry.js.map +0 -1
- package/src/generated/graphql-api/fragment-masking.d.ts +0 -19
- package/src/generated/graphql-api/gql.d.ts +0 -35
- package/src/generated/graphql-api/graphql.d.ts +0 -323
- package/src/generated/graphql-api/index.d.ts +0 -2
- package/src/useColumnDefinitionsFromCustomFieldDefinition/customFieldToCell.d.ts +0 -8
- package/src/useColumnDefinitionsFromCustomFieldDefinition/customFieldToExportString.d.ts +0 -8
- package/src/useColumnDefinitionsFromCustomFieldDefinition/types.d.ts +0 -165
- package/src/useColumnDefinitionsFromCustomFieldDefinition/useColumnDefinitionsFromCustomFieldDefinition.d.ts +0 -18
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { UnitOfMeasurementType } from "@trackunit/iris-app-runtime-core-api";
|
|
2
|
-
/**
|
|
3
|
-
* The different types of custom fields that are available.
|
|
4
|
-
* Hardcoded to match the GraphQL API, to keep the lib independent of the API.
|
|
5
|
-
*/
|
|
6
|
-
export type CustomFieldType = "BOOLEAN" | "DATE" | "DROPDOWN" | "STRING_LIST" | "EMAIL" | "FILE" | "NUMBER" | "PHONE_NUMBER" | "STRING" | "WEB_ADDRESS" | "JSON" | "MONETARY";
|
|
7
|
-
/**
|
|
8
|
-
* The type for the CustomFieldDefinition object from the GraphQL API.
|
|
9
|
-
* This is manually created to match the GraphQL API, to keep the lib independent of the API.
|
|
10
|
-
*/
|
|
11
|
-
export interface CustomFieldDefinition {
|
|
12
|
-
id: string;
|
|
13
|
-
title?: string | null;
|
|
14
|
-
key?: string | null;
|
|
15
|
-
__typename?: "BooleanFieldDefinition" | "DateFieldDefinition" | "DropDownFieldDefinition" | "EmailFieldDefinition" | "FileFieldDefinition" | "JsonFieldDefinition" | "MonetaryFieldDefinition" | "NumberFieldDefinition" | "PhoneNumberFieldDefinition" | "StringFieldDefinition" | "StringListFieldDefinition" | "WebAddressFieldDefinition" | null;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A representation of the CustomField data exprected to be in the table Data object when using custom fields.
|
|
19
|
-
*/
|
|
20
|
-
export type CustomFieldData = {
|
|
21
|
-
valueId?: string | null;
|
|
22
|
-
booleanValue?: boolean | null;
|
|
23
|
-
__typename?: "BooleanFieldValueAndDefinition";
|
|
24
|
-
definition: {
|
|
25
|
-
__typename?: "BooleanFieldDefinition";
|
|
26
|
-
title?: string | null;
|
|
27
|
-
key?: string | null;
|
|
28
|
-
id?: string | null;
|
|
29
|
-
};
|
|
30
|
-
} | {
|
|
31
|
-
valueId?: string | null;
|
|
32
|
-
dateValue?: string | null;
|
|
33
|
-
__typename?: "DateFieldValueAndDefinition";
|
|
34
|
-
definition: {
|
|
35
|
-
__typename?: "DateFieldDefinition";
|
|
36
|
-
title?: string | null;
|
|
37
|
-
key?: string | null;
|
|
38
|
-
id?: string | null;
|
|
39
|
-
};
|
|
40
|
-
} | {
|
|
41
|
-
valueId?: string | null;
|
|
42
|
-
__typename?: "DropDownFieldValueAndDefinition";
|
|
43
|
-
definition: {
|
|
44
|
-
__typename?: "DropDownFieldDefinition";
|
|
45
|
-
title?: string | null;
|
|
46
|
-
key?: string | null;
|
|
47
|
-
id?: string | null;
|
|
48
|
-
};
|
|
49
|
-
stringArrayValue?: Array<string> | null;
|
|
50
|
-
} | {
|
|
51
|
-
valueId?: string | null;
|
|
52
|
-
__typename?: "StringListFieldValueAndDefinition";
|
|
53
|
-
definition: {
|
|
54
|
-
__typename?: "StringListFieldDefinition";
|
|
55
|
-
title?: string | null;
|
|
56
|
-
key?: string | null;
|
|
57
|
-
id?: string | null;
|
|
58
|
-
};
|
|
59
|
-
stringArrayValue?: Array<string> | null;
|
|
60
|
-
} | {
|
|
61
|
-
valueId?: string | null;
|
|
62
|
-
emailValue?: string | null;
|
|
63
|
-
__typename?: "EmailFieldValueAndDefinition";
|
|
64
|
-
definition: {
|
|
65
|
-
__typename?: "EmailFieldDefinition";
|
|
66
|
-
title?: string | null;
|
|
67
|
-
key?: string | null;
|
|
68
|
-
id?: string | null;
|
|
69
|
-
};
|
|
70
|
-
} | {
|
|
71
|
-
valueId?: string | null;
|
|
72
|
-
jsonValue?: unknown | null;
|
|
73
|
-
__typename?: "JsonFieldValueAndDefinition";
|
|
74
|
-
definition: {
|
|
75
|
-
__typename?: "JsonFieldDefinition";
|
|
76
|
-
title?: string | null;
|
|
77
|
-
key?: string | null;
|
|
78
|
-
id?: string | null;
|
|
79
|
-
};
|
|
80
|
-
} | {
|
|
81
|
-
valueId?: string | null;
|
|
82
|
-
numberValue?: number | null;
|
|
83
|
-
__typename?: "NumberFieldValueAndDefinition";
|
|
84
|
-
definition: {
|
|
85
|
-
__typename?: "NumberFieldDefinition";
|
|
86
|
-
title?: string | null;
|
|
87
|
-
key?: string | null;
|
|
88
|
-
id?: string | null;
|
|
89
|
-
unitSi?: UnitOfMeasurementType | null;
|
|
90
|
-
unitUs?: UnitOfMeasurementType | null;
|
|
91
|
-
};
|
|
92
|
-
} | {
|
|
93
|
-
valueId?: string | null;
|
|
94
|
-
monetaryValue?: number | null;
|
|
95
|
-
__typename?: "MonetaryFieldValueAndDefinition";
|
|
96
|
-
definition: {
|
|
97
|
-
__typename?: "MonetaryFieldDefinition";
|
|
98
|
-
title?: string | null;
|
|
99
|
-
key?: string | null;
|
|
100
|
-
id?: string | null;
|
|
101
|
-
};
|
|
102
|
-
} | {
|
|
103
|
-
valueId?: string | null;
|
|
104
|
-
webAddressValue?: string | null;
|
|
105
|
-
__typename?: "WebAddressFieldValueAndDefinition";
|
|
106
|
-
definition: {
|
|
107
|
-
__typename?: "WebAddressFieldDefinition";
|
|
108
|
-
title?: string | null;
|
|
109
|
-
key?: string | null;
|
|
110
|
-
id?: string | null;
|
|
111
|
-
};
|
|
112
|
-
} | {
|
|
113
|
-
valueId?: string | null;
|
|
114
|
-
phoneNumberValue?: string | null;
|
|
115
|
-
__typename?: "PhoneNumberFieldValueAndDefinition";
|
|
116
|
-
definition: {
|
|
117
|
-
__typename?: "PhoneNumberFieldDefinition";
|
|
118
|
-
title?: string | null;
|
|
119
|
-
key?: string | null;
|
|
120
|
-
id?: string | null;
|
|
121
|
-
};
|
|
122
|
-
} | {
|
|
123
|
-
valueId?: string | null;
|
|
124
|
-
stringValue?: string | null;
|
|
125
|
-
__typename?: "StringFieldValueAndDefinition";
|
|
126
|
-
definition: {
|
|
127
|
-
__typename?: "StringFieldDefinition";
|
|
128
|
-
title?: string | null;
|
|
129
|
-
key?: string | null;
|
|
130
|
-
id?: string | null;
|
|
131
|
-
};
|
|
132
|
-
} | {
|
|
133
|
-
valueId?: string | null;
|
|
134
|
-
fileId?: string | null;
|
|
135
|
-
fileName?: string | null;
|
|
136
|
-
downloadLink?: string | null;
|
|
137
|
-
__typename?: "FileFieldValueAndDefinition";
|
|
138
|
-
definition: {
|
|
139
|
-
__typename?: "FileFieldDefinition";
|
|
140
|
-
title?: string | null;
|
|
141
|
-
key?: string | null;
|
|
142
|
-
id?: string | null;
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* This is the type for a data object that has custom fields.
|
|
147
|
-
* This is the type of the data that is returned from the GraphQL API when attaching custom fields to a query.
|
|
148
|
-
*/
|
|
149
|
-
export interface DataWithCustomFields {
|
|
150
|
-
customFields?: {
|
|
151
|
-
edges?: Array<{
|
|
152
|
-
node?: CustomFieldData | null;
|
|
153
|
-
} | null> | null;
|
|
154
|
-
} | null;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* This is the type of the data that is returned from the GraphQL API for the custom field definitions.
|
|
158
|
-
* This is what is used to generate the ColumnDefinitions for the table.
|
|
159
|
-
*/
|
|
160
|
-
export type CustomFieldDefinitionEdgesContainer = {
|
|
161
|
-
edges?: Array<{
|
|
162
|
-
node?: CustomFieldDefinition | null;
|
|
163
|
-
} | null> | null;
|
|
164
|
-
} | null;
|
|
165
|
-
export type CustomFieldDefinitionArray = NonNullable<CustomFieldDefinitionEdgesContainer>["edges"];
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FilterBarDefinition } from "@trackunit/filters-filter-bar";
|
|
2
|
-
import { SystemOfMeasurementType } from "@trackunit/iris-app-runtime-core-api";
|
|
3
|
-
import { ColumnDef } from "@trackunit/react-table";
|
|
4
|
-
import { CustomFieldData, CustomFieldDefinitionArray, DataWithCustomFields } from "./types";
|
|
5
|
-
export interface UseColumnDefinitionsFromCustomFieldDefinitionProps {
|
|
6
|
-
customFieldDefinitions?: CustomFieldDefinitionArray;
|
|
7
|
-
unitPreference: SystemOfMeasurementType | null | undefined;
|
|
8
|
-
language?: string;
|
|
9
|
-
filterBarDefinition?: FilterBarDefinition;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Generates an array of table column definitions based on custom field definitions.
|
|
13
|
-
*
|
|
14
|
-
* @template TDataType - The data type with custom fields.
|
|
15
|
-
* @param {CustomFieldDefinitionArray} customFieldDefinitions - An array of custom field definitions.
|
|
16
|
-
* @returns {ColumnDef<TDataType, CustomFieldData | undefined>[]} - An array of column definitions.
|
|
17
|
-
*/
|
|
18
|
-
export declare const useColumnDefinitionsFromCustomFieldDefinition: <TDataType extends DataWithCustomFields>({ customFieldDefinitions, unitPreference, language, filterBarDefinition, }: UseColumnDefinitionsFromCustomFieldDefinitionProps) => ColumnDef<TDataType, CustomFieldData | undefined>[];
|