@performant-software/semantic-components 1.0.23-beta.3 → 1.0.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@performant-software/semantic-components",
3
- "version": "1.0.23-beta.3",
3
+ "version": "1.0.23",
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.3",
15
+ "@performant-software/shared-components": "^1.0.23",
16
16
  "@react-google-maps/api": "^2.8.1",
17
17
  "axios": "^0.26.1",
18
18
  "i18next": "^19.4.4",
@@ -83,6 +83,7 @@ type Props = {
83
83
  * If provided, a CSV export button will be rendered in the list header.
84
84
  */
85
85
  csvExportButton?: {
86
+ basic: boolean,
86
87
  color: string,
87
88
  location: string,
88
89
  onClick?: () => void
@@ -357,14 +358,21 @@ const useList = (WrappedComponent: ComponentType<any>) => (
357
358
  * @param items
358
359
  */
359
360
  onCsvExportButton() {
360
- let csv = `${this.props.columns.map((col) => `"${col.label}"`).join(',')}\n`;
361
+ const visibleColumns = _.filter(this.props.columns, (col) => !col.hidden);
362
+
363
+ let csv = `${_.map(visibleColumns, (col) => `"${col.label}"`).join(',')}\n`;
361
364
 
362
- this.props.items.forEach((item) => {
363
- csv = csv.concat(`${this.props.columns.map((col) => {
365
+ _.each(this.props.items, (item) => {
366
+ csv = csv.concat(`${visibleColumns.map((col) => {
364
367
  if (col.resolve) {
365
368
  return `"${col.resolve(item)}"`;
366
369
  }
367
- return `"${item[col.name]}"`;
370
+
371
+ if (item[col.name]) {
372
+ return `"${item[col.name]}"`;
373
+ }
374
+
375
+ return '';
368
376
  }).join(',')}\n`);
369
377
  });
370
378
 
@@ -594,12 +602,12 @@ const useList = (WrappedComponent: ComponentType<any>) => (
594
602
 
595
603
  return (
596
604
  <Button
597
- basic
605
+ basic={this.props.csvExportButton.basic}
598
606
  color={this.props.csvExportButton.color}
599
607
  key={BUTTON_KEY_CSV_EXPORT}
600
608
  onClick={this.onCsvExportButton.bind(this)}
601
609
  >
602
- <Icon name='shopping basket' />
610
+ <Icon name='download' />
603
611
  { i18n.t('List.buttons.csvExport') }
604
612
  </Button>
605
613
  );
@@ -14,15 +14,6 @@ type Props = DataListProps & DataTableProps & {
14
14
  */
15
15
  configurable?: boolean,
16
16
 
17
- /**
18
- * If provided, a CSV export button will be rendered in the list header.
19
- */
20
- csvExportButton?: {
21
- color: string,
22
- location: string,
23
- onClick?: () => void
24
- },
25
-
26
17
  /**
27
18
  * The name of the default sort column.
28
19
  */
@@ -83,6 +83,7 @@ type Props = {
83
83
  * If provided, a CSV export button will be rendered in the list header.
84
84
  */
85
85
  csvExportButton?: {
86
+ basic: boolean,
86
87
  color: string,
87
88
  location: string,
88
89
  onClick?: () => void
@@ -357,14 +358,21 @@ const useList = (WrappedComponent: ComponentType<any>) => (
357
358
  * @param items
358
359
  */
359
360
  onCsvExportButton() {
360
- let csv = `${this.props.columns.map((col) => `"${col.label}"`).join(',')}\n`;
361
+ const visibleColumns = _.filter(this.props.columns, (col) => !col.hidden);
362
+
363
+ let csv = `${_.map(visibleColumns, (col) => `"${col.label}"`).join(',')}\n`;
361
364
 
362
- this.props.items.forEach((item) => {
363
- csv = csv.concat(`${this.props.columns.map((col) => {
365
+ _.each(this.props.items, (item) => {
366
+ csv = csv.concat(`${visibleColumns.map((col) => {
364
367
  if (col.resolve) {
365
368
  return `"${col.resolve(item)}"`;
366
369
  }
367
- return `"${item[col.name]}"`;
370
+
371
+ if (item[col.name]) {
372
+ return `"${item[col.name]}"`;
373
+ }
374
+
375
+ return '';
368
376
  }).join(',')}\n`);
369
377
  });
370
378
 
@@ -594,12 +602,12 @@ const useList = (WrappedComponent: ComponentType<any>) => (
594
602
 
595
603
  return (
596
604
  <Button
597
- basic
605
+ basic={this.props.csvExportButton.basic}
598
606
  color={this.props.csvExportButton.color}
599
607
  key={BUTTON_KEY_CSV_EXPORT}
600
608
  onClick={this.onCsvExportButton.bind(this)}
601
609
  >
602
- <Icon name='shopping basket' />
610
+ <Icon name='download' />
603
611
  { i18n.t('List.buttons.csvExport') }
604
612
  </Button>
605
613
  );
@@ -14,15 +14,6 @@ type Props = DataListProps & DataTableProps & {
14
14
  */
15
15
  configurable?: boolean,
16
16
 
17
- /**
18
- * If provided, a CSV export button will be rendered in the list header.
19
- */
20
- csvExportButton?: {
21
- color: string,
22
- location: string,
23
- onClick?: () => void
24
- },
25
-
26
17
  /**
27
18
  * The name of the default sort column.
28
19
  */