@civicactions/cmsds-open-data-components 1.13.0-alpha.2 → 1.13.0-alpha.3

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.
@@ -102,9 +102,9 @@ var ResourceHeader = function ResourceHeader(_ref) {
102
102
  }, /*#__PURE__*/_react["default"].createElement("div", {
103
103
  className: "ds-u-font-weight--bold"
104
104
  }, /*#__PURE__*/_react["default"].createElement(_dataCatalogComponents.DataTablePageResults, {
105
- totalRows: intCount,
106
- limit: limit,
107
- offset: offset
105
+ totalRows: parseInt(intCount),
106
+ limit: parseInt(limit),
107
+ offset: parseInt(offset)
108
108
  })), /*#__PURE__*/_react["default"].createElement("div", {
109
109
  className: "dc-c-resource-header--buttons"
110
110
  }, includeDownload && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_designSystem.Button, {
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -11,29 +9,35 @@ exports.cleanText = cleanText;
11
9
  exports.convertUTCToLocalDate = convertUTCToLocalDate;
12
10
  exports.operatorMapping = void 0;
13
11
 
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
-
12
+ // Example custom column headers, where only effective date has an ! at the end
13
+ // [
14
+ // {schema: 'date', Cell: ({ value }) => localeDate(value),},
15
+ // {accessor: 'effective_date',Cell: ({ value }) => localeDate(value) + '!',},
16
+ // ]
20
17
  function buildCustomColHeaders(customHeaders, columns, schema) {
21
18
  return columns.map(function (column) {
22
- var customHeaderIndex = customHeaders.findIndex(function (header) {
19
+ var customAccessorIndex = customHeaders.findIndex(function (header) {
23
20
  return header.accessor === column;
24
21
  });
25
-
26
- if (customHeaderIndex > -1) {
27
- return _objectSpread({
28
- Header: schema && schema.fields[column].description ? schema.fields[column].description : column,
29
- accessor: column
30
- }, customHeaders[customHeaderIndex]);
22
+ var customSchemaIndex = customHeaders.findIndex(function (header) {
23
+ return header.schema === schema.fields[column].mysql_type;
24
+ });
25
+ var newColumn = {}; // If specific accessor is passed, this will override a general mysql_type Cell rewrite.
26
+
27
+ if (customAccessorIndex > -1) {
28
+ newColumn.Header = schema && schema.fields[column].description ? schema.fields[column].description : column;
29
+ newColumn.accessor = column;
30
+ newColumn.Cell = customHeaders[customAccessorIndex].Cell;
31
+ } else {
32
+ newColumn.Header = schema && schema.fields[column].description ? schema.fields[column].description : column;
33
+ newColumn.accessor = column;
34
+
35
+ if (customSchemaIndex > -1) {
36
+ newColumn.Cell = customHeaders[customSchemaIndex].Cell;
37
+ }
31
38
  }
32
39
 
33
- return {
34
- Header: schema && schema.fields[column].description ? schema.fields[column].description : column,
35
- accessor: column
36
- };
40
+ return newColumn;
37
41
  });
38
42
  }
39
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@civicactions/cmsds-open-data-components",
3
- "version": "1.13.0-alpha.2",
3
+ "version": "1.13.0-alpha.3",
4
4
  "description": "Components for the open data catalog frontend using CMS Design System",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {