dce-reactkit 3.2.2-beta.40 → 3.2.2-beta.42

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.
@@ -12,6 +12,7 @@ declare type Props = {
12
12
  [k: string]: any;
13
13
  }[];
14
14
  columns: IntelliTableColumn[];
15
+ csvName?: string;
15
16
  };
16
17
  declare const IntelliTable: React.FC<Props>;
17
18
  export default IntelliTable;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect, useReducer } from 'react';
2
2
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
- import { faExclamationTriangle, faCircle, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faCheckCircle, faXmarkCircle, faMinus, faSort, faSortDown, faSortUp, faCalendar, faTag, faHammer, faList, faTimes } from '@fortawesome/free-solid-svg-icons';
3
+ import { faExclamationTriangle, faCircle, faDotCircle, faCheckSquare, faHourglass, faClipboard, faChevronDown, faChevronRight, faCloudDownloadAlt, faMinus, faCheckCircle, faXmarkCircle, faSort, faSortDown, faSortUp, faCalendar, faTag, faHammer, faList, faTimes } from '@fortawesome/free-solid-svg-icons';
4
4
  import { faCircle as faCircle$1, faSquareMinus, faSquare } from '@fortawesome/free-regular-svg-icons';
5
5
 
6
6
  /******************************************************************************
@@ -2099,6 +2099,29 @@ const ItemPicker = (props) => {
2099
2099
  React.createElement(NestableItemList, { items: items, onChanged: onChanged }))));
2100
2100
  };
2101
2101
 
2102
+ // Import shared helpers
2103
+ /**
2104
+ * Get a human-readable description of a date (all in ET)
2105
+ * @author Gabe Abrams
2106
+ * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
2107
+ * @returns human-readable description of the date
2108
+ */
2109
+ const getHumanReadableDate = (dateOrTimestamp) => {
2110
+ // Get the date info
2111
+ const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
2112
+ const currYear = getTimeInfoInET().year;
2113
+ // Get the short month description
2114
+ const monthName = getMonthName(month).short;
2115
+ // Create start of description
2116
+ let description = `${monthName} ${day}${getOrdinal(day)}`;
2117
+ // Add on year if it's different
2118
+ if (year !== currYear) {
2119
+ description += ` ${year}`;
2120
+ }
2121
+ // Return description
2122
+ return description;
2123
+ };
2124
+
2102
2125
  /**
2103
2126
  * Path of the route for storing client-side logs
2104
2127
  * @author Gabe Abrams
@@ -2234,6 +2257,7 @@ const genCSV = (data, columns) => {
2234
2257
  .join(','));
2235
2258
  // Add each row
2236
2259
  data.forEach((datum) => {
2260
+ csv += '\n';
2237
2261
  csv += (columns
2238
2262
  .map((column) => {
2239
2263
  let contents;
@@ -2362,6 +2386,11 @@ const IntelliTable = (props) => {
2362
2386
  const data = ((props.data && props.data.length > 0)
2363
2387
  ? props.data
2364
2388
  : [{ id: 'empty-row' }]);
2389
+ if (props.csvName) {
2390
+ (props.csvName.endsWith('.csv')
2391
+ ? props.csvName
2392
+ : `${props.csvName}.csv`);
2393
+ }
2365
2394
  /* -------------- State ------------- */
2366
2395
  // Initial state
2367
2396
  const initColumnVisibilityMap = {};
@@ -2554,9 +2583,12 @@ const IntelliTable = (props) => {
2554
2583
  const noValue = (value === undefined
2555
2584
  || value === null);
2556
2585
  visibleValue = (noValue
2557
- ? (React.createElement(FontAwesomeIcon, { icon: faCheckCircle }))
2558
- : (React.createElement(FontAwesomeIcon, { icon: faXmarkCircle })));
2586
+ ? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
2587
+ : (React.createElement(FontAwesomeIcon, { icon: fullValue ? faCheckCircle : faXmarkCircle })));
2559
2588
  title = (fullValue ? 'True' : 'False');
2589
+ if (noValue) {
2590
+ title = 'Empty Cell';
2591
+ }
2560
2592
  }
2561
2593
  else if (column.type === ParamType$1.Int) {
2562
2594
  fullValue = Number.parseInt(value, 10);
@@ -2565,6 +2597,9 @@ const IntelliTable = (props) => {
2565
2597
  ? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
2566
2598
  : fullValue);
2567
2599
  title = String(fullValue);
2600
+ if (noValue) {
2601
+ title = 'Empty Cell';
2602
+ }
2568
2603
  }
2569
2604
  else if (column.type === ParamType$1.Float) {
2570
2605
  fullValue = Number.parseFloat(value);
@@ -2573,6 +2608,9 @@ const IntelliTable = (props) => {
2573
2608
  ? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
2574
2609
  : roundToNumDecimals(fullValue, 2));
2575
2610
  title = String(fullValue);
2611
+ if (noValue) {
2612
+ title = 'Empty Cell';
2613
+ }
2576
2614
  }
2577
2615
  else if (column.type === ParamType$1.String) {
2578
2616
  fullValue = String(value).trim();
@@ -2583,6 +2621,9 @@ const IntelliTable = (props) => {
2583
2621
  ? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
2584
2622
  : fullValue);
2585
2623
  title = `"${value}"`;
2624
+ if (noValue) {
2625
+ title = 'Empty Cell';
2626
+ }
2586
2627
  }
2587
2628
  else if (column.type === ParamType$1.JSON) {
2588
2629
  fullValue = JSON.stringify(value);
@@ -2592,6 +2633,7 @@ const IntelliTable = (props) => {
2592
2633
  visibleValue = (noValue
2593
2634
  ? (React.createElement(FontAwesomeIcon, { icon: faMinus }))
2594
2635
  : fullValue);
2636
+ title = "JSON Object";
2595
2637
  }
2596
2638
  // Create UI
2597
2639
  return (React.createElement("td", { key: `${datum.id}-${column.param}`, title: title, style: {
@@ -3125,14 +3167,24 @@ const LogReviewer = (props) => {
3125
3167
  } },
3126
3168
  React.createElement(FontAwesomeIcon, { icon: faHammer, className: "me-2" }),
3127
3169
  "Action"),
3128
- React.createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'}`, "aria-label": "toggle advanced filter drawer", onClick: () => {
3170
+ React.createElement("button", { type: "button", id: "LogReviewer-toggle-advanced-filter-drawer", className: `btn btn-${FilterDrawer.Advanced === expandedFilterDrawer ? 'warning' : 'light'} me-2`, "aria-label": "toggle advanced filter drawer", onClick: () => {
3129
3171
  dispatch({
3130
3172
  type: ActionType.ToggleFilterDrawer,
3131
3173
  filterDrawer: FilterDrawer.Advanced,
3132
3174
  });
3133
3175
  } },
3134
3176
  React.createElement(FontAwesomeIcon, { icon: faList, className: "me-2" }),
3135
- "Advanced"))));
3177
+ "Advanced"),
3178
+ React.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
3179
+ dispatch({
3180
+ type: ActionType.ResetFilters,
3181
+ initActionErrorFilterState,
3182
+ initAdvancedFilterState,
3183
+ initContextFilterState,
3184
+ initDateFilterState,
3185
+ initTagFilterState,
3186
+ });
3187
+ } }, "Reset All"))));
3136
3188
  // Filter drawer
3137
3189
  let filterDrawer;
3138
3190
  if (expandedFilterDrawer) {
@@ -3473,7 +3525,7 @@ const LogReviewer = (props) => {
3473
3525
  // Filters UI
3474
3526
  const filters = (React.createElement(React.Fragment, null,
3475
3527
  filterToggles,
3476
- filterDrawer && (React.createElement(Drawer, null, filterDrawer))));
3528
+ filterDrawer && (React.createElement(Drawer, { customBackgroundColor: "#eee" }, filterDrawer))));
3477
3529
  // Actually filter the logs
3478
3530
  // > Perform filters
3479
3531
  const logs = [];
@@ -3921,7 +3973,7 @@ const LogReviewer = (props) => {
3921
3973
  React.createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
3922
3974
  : undefined);
3923
3975
  // Create intelliTable
3924
- const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", id: "logs", data: logs, columns: columns }));
3976
+ const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
3925
3977
  // Main body
3926
3978
  body = (React.createElement(React.Fragment, null,
3927
3979
  filters,
@@ -5168,29 +5220,6 @@ const startMinWait = (minWaitMs) => {
5168
5220
  });
5169
5221
  };
5170
5222
 
5171
- // Import shared helpers
5172
- /**
5173
- * Get a human-readable description of a date (all in ET)
5174
- * @author Gabe Abrams
5175
- * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
5176
- * @returns human-readable description of the date
5177
- */
5178
- const getHumanReadableDate = (dateOrTimestamp) => {
5179
- // Get the date info
5180
- const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
5181
- const currYear = getTimeInfoInET().year;
5182
- // Get the short month description
5183
- const monthName = getMonthName(month).short;
5184
- // Create start of description
5185
- let description = `${monthName} ${day}${getOrdinal(day)}`;
5186
- // Add on year if it's different
5187
- if (year !== currYear) {
5188
- description += ` ${year}`;
5189
- }
5190
- // Return description
5191
- return description;
5192
- };
5193
-
5194
5223
  /**
5195
5224
  * Get the current part of day (morning, evening, etc.)
5196
5225
  * @author Gabe Abrams