dce-reactkit 3.2.2-beta.41 → 3.2.2-beta.44

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
@@ -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;
@@ -2281,7 +2305,7 @@ const CSVDownloadButton = (props) => {
2281
2305
  /* Main UI */
2282
2306
  /*----------------------------------------*/
2283
2307
  // Render the button
2284
- return (React.createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${csv}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
2308
+ return (React.createElement("a", { id: id, download: filename, href: `data:application/octet-stream,${encodeURIComponent(csv)}`, className: `CSVDownloadButton-button ${className !== null && className !== void 0 ? className : 'btn btn-secondary'}`, "aria-label": (ariaLabel
2285
2309
  ? `Click to download ${filename}`
2286
2310
  : ariaLabel), style: style, onClick: onClick },
2287
2311
  !children && (React.createElement(React.Fragment, null,
@@ -2362,6 +2386,13 @@ const IntelliTable = (props) => {
2362
2386
  const data = ((props.data && props.data.length > 0)
2363
2387
  ? props.data
2364
2388
  : [{ id: 'empty-row' }]);
2389
+ // Get CSV filename
2390
+ let filename = `${title}.csv`;
2391
+ if (props.csvName) {
2392
+ filename = (props.csvName.endsWith('.csv')
2393
+ ? props.csvName
2394
+ : `${props.csvName}.csv`);
2395
+ }
2365
2396
  /* -------------- State ------------- */
2366
2397
  // Initial state
2367
2398
  const initColumnVisibilityMap = {};
@@ -2634,7 +2665,7 @@ const IntelliTable = (props) => {
2634
2665
  React.createElement("div", { className: "d-flex align-items-center justify-content-start" },
2635
2666
  React.createElement("h3", { className: "m-0" }, title),
2636
2667
  React.createElement("div", { className: "flex-grow-1 text-end" },
2637
- React.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: `${title}.csv`, csv: csv }),
2668
+ React.createElement(CSVDownloadButton, { "aria-label": `download data as csv for ${title}`, id: `IntelliTable-${id}-download-as-csv`, filename: filename, csv: csv }),
2638
2669
  React.createElement("button", { type: "button", className: "btn btn-secondary ms-2", "aria-label": `show panel for customizing which columns show in table ${title}`, id: `IntelliTable-${id}-show-column-customization-modal`, onClick: () => {
2639
2670
  dispatch({
2640
2671
  type: ActionType$1.ToggleColVisCusModalVisibility,
@@ -3138,14 +3169,24 @@ const LogReviewer = (props) => {
3138
3169
  } },
3139
3170
  React.createElement(FontAwesomeIcon, { icon: faHammer, className: "me-2" }),
3140
3171
  "Action"),
3141
- 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: () => {
3172
+ 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: () => {
3142
3173
  dispatch({
3143
3174
  type: ActionType.ToggleFilterDrawer,
3144
3175
  filterDrawer: FilterDrawer.Advanced,
3145
3176
  });
3146
3177
  } },
3147
3178
  React.createElement(FontAwesomeIcon, { icon: faList, className: "me-2" }),
3148
- "Advanced"))));
3179
+ "Advanced"),
3180
+ React.createElement("button", { type: "button", id: "LogReviewer-reset-filters-button", className: "btn btn-light", "aria-label": "reset filters", onClick: () => {
3181
+ dispatch({
3182
+ type: ActionType.ResetFilters,
3183
+ initActionErrorFilterState,
3184
+ initAdvancedFilterState,
3185
+ initContextFilterState,
3186
+ initDateFilterState,
3187
+ initTagFilterState,
3188
+ });
3189
+ } }, "Reset All"))));
3149
3190
  // Filter drawer
3150
3191
  let filterDrawer;
3151
3192
  if (expandedFilterDrawer) {
@@ -3934,7 +3975,7 @@ const LogReviewer = (props) => {
3934
3975
  React.createElement("div", null, "Either your filters are too strict or no matching logs have been created yet.")))
3935
3976
  : undefined);
3936
3977
  // Create intelliTable
3937
- const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", id: "logs", data: logs, columns: columns }));
3978
+ const dataTable = (React.createElement(IntelliTable, { title: "Matching Logs:", csvName: `Logs from ${getHumanReadableDate()}`, id: "logs", data: logs, columns: columns }));
3938
3979
  // Main body
3939
3980
  body = (React.createElement(React.Fragment, null,
3940
3981
  filters,
@@ -5181,29 +5222,6 @@ const startMinWait = (minWaitMs) => {
5181
5222
  });
5182
5223
  };
5183
5224
 
5184
- // Import shared helpers
5185
- /**
5186
- * Get a human-readable description of a date (all in ET)
5187
- * @author Gabe Abrams
5188
- * @param [dateOrTimestamp=today] the date or timestamp for the date to describe
5189
- * @returns human-readable description of the date
5190
- */
5191
- const getHumanReadableDate = (dateOrTimestamp) => {
5192
- // Get the date info
5193
- const { month, day, year, } = getTimeInfoInET(dateOrTimestamp);
5194
- const currYear = getTimeInfoInET().year;
5195
- // Get the short month description
5196
- const monthName = getMonthName(month).short;
5197
- // Create start of description
5198
- let description = `${monthName} ${day}${getOrdinal(day)}`;
5199
- // Add on year if it's different
5200
- if (year !== currYear) {
5201
- description += ` ${year}`;
5202
- }
5203
- // Return description
5204
- return description;
5205
- };
5206
-
5207
5225
  /**
5208
5226
  * Get the current part of day (morning, evening, etc.)
5209
5227
  * @author Gabe Abrams