@civicactions/cmsds-open-data-components 1.13.0-beta.1 → 1.13.0
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.
|
@@ -118,7 +118,7 @@ var DatasetBody = function DatasetBody(_ref) {
|
|
|
118
118
|
dangerouslySetInnerHTML: {
|
|
119
119
|
__html: dataset.description
|
|
120
120
|
}
|
|
121
|
-
}), Object.keys(
|
|
121
|
+
}), resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("h2", {
|
|
122
122
|
className: "dc-resource-header"
|
|
123
123
|
}, "Resource Preview"), resource.columns ? /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_ResourceHeader["default"], {
|
|
124
124
|
id: id,
|
|
@@ -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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
19
|
+
var customAccessorIndex = customHeaders.findIndex(function (header) {
|
|
23
20
|
return header.accessor === column;
|
|
24
21
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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