@commercetools-frontend-extensions/export-resources-modal 4.3.4 → 4.4.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/README.md +108 -14
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.dev.js +120 -92
- package/dist/commercetools-frontend-extensions-export-resources-modal.cjs.prod.js +115 -82
- package/dist/commercetools-frontend-extensions-export-resources-modal.esm.js +120 -91
- package/dist/declarations/src/@constants/exportable-resources.d.ts +4 -4
- package/dist/declarations/src/@types/{export-resources-modal-shape.d.ts → export-resources-modal-types.d.ts} +12 -4
- package/dist/declarations/src/@types/formik.d.ts +1 -1
- package/dist/declarations/src/@types/index.d.ts +1 -1
- package/dist/declarations/src/@types/resource-type.d.ts +2 -4
- package/dist/declarations/src/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,111 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
83
83
|
fields: [
|
|
84
84
|
{
|
|
85
85
|
name: 'custom-type-key-and-type-id',
|
|
86
|
-
label: 'Custom type key and
|
|
86
|
+
label: 'Custom type key and type id',
|
|
87
|
+
isReadOnly: true,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'general-category-attributes',
|
|
91
|
+
label: 'General category attributes',
|
|
92
|
+
fields: [
|
|
93
|
+
{
|
|
94
|
+
name: 'custom.fields.season',
|
|
95
|
+
label: 'Season',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'custom.fields.target-audience',
|
|
99
|
+
label: 'Target audience',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'book-category-attributes',
|
|
105
|
+
label: 'Book category attributes',
|
|
106
|
+
fields: [
|
|
107
|
+
{
|
|
108
|
+
name: 'custom.fields.genre',
|
|
109
|
+
label: 'Genre',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'custom.fields.age-group',
|
|
113
|
+
label: 'Age group',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
]}
|
|
120
|
+
fieldOrder={['*', 'custom']}
|
|
121
|
+
onClose={() => {
|
|
122
|
+
...
|
|
123
|
+
}}
|
|
124
|
+
/>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
// Use case: Exporting filtered resources
|
|
128
|
+
<ExportResourcesModal
|
|
129
|
+
isOpen={true}
|
|
130
|
+
outputFormat="csv"
|
|
131
|
+
resourceType="category"
|
|
132
|
+
filters={{
|
|
133
|
+
where: 'key = "category-key"',
|
|
134
|
+
total: 20
|
|
135
|
+
}}
|
|
136
|
+
totalResourcesCount={143}
|
|
137
|
+
fieldGroups={[
|
|
138
|
+
{
|
|
139
|
+
groupLabel: 'All general fields',
|
|
140
|
+
groupName: 'general',
|
|
141
|
+
fields: [
|
|
142
|
+
{
|
|
143
|
+
name: 'key',
|
|
144
|
+
label: 'Category key',
|
|
145
|
+
isRequired: true,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'externalId',
|
|
149
|
+
label: 'External id',
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: 'createdAt',
|
|
153
|
+
label: 'Created at',
|
|
154
|
+
isSelectedByDefault: true,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: 'lastModifiedAt',
|
|
158
|
+
label: 'Last modified at',
|
|
159
|
+
isSelectedByDefault: true,
|
|
160
|
+
},
|
|
161
|
+
{ name: 'name', label: 'Name', isSelectedByDefault: true },
|
|
162
|
+
{
|
|
163
|
+
name: 'parent',
|
|
164
|
+
label: 'parent',
|
|
165
|
+
isSelectedByDefault: true,
|
|
166
|
+
fields: [
|
|
167
|
+
{
|
|
168
|
+
name: 'parent.name',
|
|
169
|
+
label: 'Parent name',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: 'parent.key',
|
|
173
|
+
label: 'Parent key',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'id',
|
|
179
|
+
label: 'Id',
|
|
180
|
+
isSelectedByDefault: true,
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
groupLabel: 'All custom fields',
|
|
186
|
+
groupName: 'custom',
|
|
187
|
+
fields: [
|
|
188
|
+
{
|
|
189
|
+
name: 'custom-type-key-and-type-id',
|
|
190
|
+
label: 'Custom type key and type id',
|
|
87
191
|
isReadOnly: true,
|
|
88
192
|
},
|
|
89
193
|
{
|
|
@@ -118,11 +222,6 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
118
222
|
},
|
|
119
223
|
]}
|
|
120
224
|
fieldOrder={['*', 'custom']}
|
|
121
|
-
renderProperties={()=>(
|
|
122
|
-
<>
|
|
123
|
-
- The category parent is referenced by externalId or key.
|
|
124
|
-
</>
|
|
125
|
-
)}
|
|
126
225
|
onClose={() => {
|
|
127
226
|
...
|
|
128
227
|
}}
|
|
@@ -178,7 +277,7 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
178
277
|
fields: [
|
|
179
278
|
{
|
|
180
279
|
name: 'custom-type-key-and-typeid',
|
|
181
|
-
label: 'Custom type key and
|
|
280
|
+
label: 'Custom type key and type id',
|
|
182
281
|
isReadOnly: true,
|
|
183
282
|
isSelectedByDefault: false,
|
|
184
283
|
},
|
|
@@ -217,11 +316,6 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
217
316
|
]
|
|
218
317
|
}
|
|
219
318
|
]}
|
|
220
|
-
renderProperties={()=>(
|
|
221
|
-
<>
|
|
222
|
-
- The category parent is referenced by externalId or key.
|
|
223
|
-
</>
|
|
224
|
-
)}
|
|
225
319
|
onClose={() => {
|
|
226
320
|
...
|
|
227
321
|
}}
|
|
@@ -236,7 +330,8 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
236
330
|
| `outputFormat` | `string`<br/>Possible values: `csv`, `json` | | `csv` | The file format to export |
|
|
237
331
|
| `onExportSuccess` | `function` | | | Callback function that is called when the export operation is successful |
|
|
238
332
|
| `onClose` | `function` | | | Callback function invoked when the modal is requested to close (on overlay click, close button click or `ESC` press). This function is also called after an export operation regardless of its success or failure |
|
|
239
|
-
| `resourceType` | `string` | ✅ | | The type of the resource, example: `category`, `product`...
|
|
333
|
+
| `resourceType` | `string` | ✅ | | The type of the resource, example: `category`, `product`...
|
|
334
|
+
| `filters` | `Filters` | | | Filters can be set as simple string for [query predicates](https://docs.commercetools.com/api/predicates/query) or as a `search query` object for Search API filters, such as the [Product Search API](https://docs.commercetools.com/api/projects/product-search).
|
|
240
335
|
| `totalResourcesCount` | `number` | ✅ | | The count of all resources of identified `resourceType` |
|
|
241
336
|
| `selectedResourceIds` | `array` | | | Array of Ids of the selected resources |
|
|
242
337
|
| `fieldGroups` | `array` | ✅ | | Array of the grouped `fields` to export. |
|
|
@@ -251,7 +346,6 @@ import ExportResourcesModal from '@commercetools-frontend-extensions/export-reso
|
|
|
251
346
|
| `fieldGroups[].fields[].isSelectedByDefault` | `boolean` | | `true` | This field is a part of the `fields` array is used to control the default state of the corresponding checkbox in the UI. If `isSelectedByDefault` is set to true, the checkbox for that particular field will be checked by default when the component loads. The default value of this attribute is `true` which means unless explicitly set to `false`, the checkbox for the field will be checked on initial load. |
|
|
252
347
|
| `fieldGroups[].fields[].isExpandable` | `boolean` | | `false`| `isExpandable` property indicates if the field can be expanded/collapsed on the UI. If the `isExpandable` is passed as true, then a expand/collapse button is displayed on the UI to control |
|
|
253
348
|
| `fieldGroups[].fields[].isExpanded` | `boolean` | | `false` | This property is used along with `fieldGroups[].fields[].isExpandable` to control the default state of each expandable fields in the UI. If `fieldGroups[].fields[].isExpanded` is set to `true`, then the corresponding field will be expanded when the component loads. The default value is `false` which means unless explicitly set to `true`, the field will be collapsed on initial load |
|
|
254
|
-
| `renderProperties` | `function` | | | A prop to render properties that are resource-specific |
|
|
255
349
|
| `fieldOrder` | `string[]` | | | The field names are sorted based on the order passed. The value `*` can be passed to denote any fields and for example fieldOrder=['*', 'custom'] will push all the fields that starts with custom to the last in the list and any other fields will be at the beginning of the list |
|
|
256
350
|
|
|
257
351
|
## Releasing
|