@performant-software/semantic-components 1.0.23-beta.0 → 1.0.23-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/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/List.js +8 -4
- package/types/components/List.js.flow +8 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@performant-software/semantic-components",
|
|
3
|
-
"version": "1.0.23-beta.
|
|
3
|
+
"version": "1.0.23-beta.2",
|
|
4
4
|
"description": "A package of shared components based on the Semantic UI Framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./build/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "webpack --mode production && flow-copy-source -v src types"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@performant-software/shared-components": "^1.0.23-beta.
|
|
15
|
+
"@performant-software/shared-components": "^1.0.23-beta.2",
|
|
16
16
|
"@react-google-maps/api": "^2.8.1",
|
|
17
17
|
"axios": "^0.26.1",
|
|
18
18
|
"i18next": "^19.4.4",
|
package/src/components/List.js
CHANGED
|
@@ -357,16 +357,20 @@ const useList = (WrappedComponent: ComponentType<any>) => (
|
|
|
357
357
|
* @param items
|
|
358
358
|
*/
|
|
359
359
|
onCsvExportButton() {
|
|
360
|
-
|
|
361
|
-
let csv = `${keys.map((k) => `"${k}"`).join(',')}\n`;
|
|
360
|
+
let csv = `${this.props.columns.map((col) => `"${col.label}"`).join(',')}\n`;
|
|
362
361
|
|
|
363
362
|
this.props.items.forEach((item) => {
|
|
364
|
-
csv = csv.concat(`${
|
|
363
|
+
csv = csv.concat(`${this.props.columns.map((col) => {
|
|
364
|
+
if (col.resolve) {
|
|
365
|
+
return col.resolve(item);
|
|
366
|
+
}
|
|
367
|
+
return `"${item[col.name]}"`;
|
|
368
|
+
}).join(',')}\n`);
|
|
365
369
|
});
|
|
366
370
|
|
|
367
371
|
const element = document.createElement('a');
|
|
368
372
|
element.setAttribute('href', `data:text/plain;charset=utf-8,${encodeURIComponent(csv)}`);
|
|
369
|
-
element.setAttribute('download', 'table.csv
|
|
373
|
+
element.setAttribute('download', `${this.props.collectionName || 'table'}.csv`);
|
|
370
374
|
|
|
371
375
|
element.style.display = 'none';
|
|
372
376
|
document.body.appendChild(element);
|
|
@@ -357,16 +357,20 @@ const useList = (WrappedComponent: ComponentType<any>) => (
|
|
|
357
357
|
* @param items
|
|
358
358
|
*/
|
|
359
359
|
onCsvExportButton() {
|
|
360
|
-
|
|
361
|
-
let csv = `${keys.map((k) => `"${k}"`).join(',')}\n`;
|
|
360
|
+
let csv = `${this.props.columns.map((col) => `"${col.label}"`).join(',')}\n`;
|
|
362
361
|
|
|
363
362
|
this.props.items.forEach((item) => {
|
|
364
|
-
csv = csv.concat(`${
|
|
363
|
+
csv = csv.concat(`${this.props.columns.map((col) => {
|
|
364
|
+
if (col.resolve) {
|
|
365
|
+
return col.resolve(item);
|
|
366
|
+
}
|
|
367
|
+
return `"${item[col.name]}"`;
|
|
368
|
+
}).join(',')}\n`);
|
|
365
369
|
});
|
|
366
370
|
|
|
367
371
|
const element = document.createElement('a');
|
|
368
372
|
element.setAttribute('href', `data:text/plain;charset=utf-8,${encodeURIComponent(csv)}`);
|
|
369
|
-
element.setAttribute('download', 'table.csv
|
|
373
|
+
element.setAttribute('download', `${this.props.collectionName || 'table'}.csv`);
|
|
370
374
|
|
|
371
375
|
element.style.display = 'none';
|
|
372
376
|
document.body.appendChild(element);
|