@bento-core/table 1.0.1-ccdihub.34 → 1.0.1-ccdihub.36
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/dist/ExtendedView.js +2 -1
- package/dist/toolbar/DownloadButtonView.js +3 -1
- package/package.json +1 -1
- package/src/ExtendedView.js +1 -0
- package/src/toolbar/DownloadButtonView.js +2 -1
- package/dist/pagination/components/DownloadButton.js +0 -66
- package/src/pagination/components/DownloadButton.js +0 -68
package/dist/ExtendedView.js
CHANGED
|
@@ -17,7 +17,8 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
17
17
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
18
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
19
|
const downloadAreaStyle = {
|
|
20
|
-
display: 'flex'
|
|
20
|
+
display: 'flex',
|
|
21
|
+
borderTop: '1px solid #8A7F7C'
|
|
21
22
|
};
|
|
22
23
|
const ExtendedView = _ref => {
|
|
23
24
|
let {
|
|
@@ -18,7 +18,8 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
18
18
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
19
|
const downloadButtonStyle = {
|
|
20
20
|
color: '#d1d2d3',
|
|
21
|
-
marginTop: '7px'
|
|
21
|
+
marginTop: '7px',
|
|
22
|
+
marginRight: '41px'
|
|
22
23
|
};
|
|
23
24
|
const DownloadButton = _ref => {
|
|
24
25
|
let {
|
|
@@ -28,6 +29,7 @@ const DownloadButton = _ref => {
|
|
|
28
29
|
} = _ref;
|
|
29
30
|
if (count === 0) {
|
|
30
31
|
return /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, {
|
|
32
|
+
className: "disableButton",
|
|
31
33
|
style: downloadButtonStyle
|
|
32
34
|
});
|
|
33
35
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bento-core/table",
|
|
3
|
-
"version": "1.0.1-ccdihub.
|
|
3
|
+
"version": "1.0.1-ccdihub.36",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run lint && cross-env-shell rm -rf dist && NODE_ENV=production BABEL_ENV=es babel src --out-dir dist --copy-files",
|
package/src/ExtendedView.js
CHANGED
|
@@ -10,6 +10,7 @@ import { downloadJson } from '../util/downloadTable';
|
|
|
10
10
|
const downloadButtonStyle = {
|
|
11
11
|
color: '#d1d2d3',
|
|
12
12
|
marginTop: '7px',
|
|
13
|
+
marginRight: '41px',
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
const DownloadButton = ({
|
|
@@ -18,7 +19,7 @@ const DownloadButton = ({
|
|
|
18
19
|
table,
|
|
19
20
|
}) => {
|
|
20
21
|
if (count === 0) {
|
|
21
|
-
return <CloudDownload style={downloadButtonStyle} />;
|
|
22
|
+
return <CloudDownload className="disableButton" style={downloadButtonStyle} />;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
const client = useApolloClient();
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _client = require("@apollo/client");
|
|
9
|
-
var _core = require("@material-ui/core");
|
|
10
|
-
var _icons = require("@material-ui/icons");
|
|
11
|
-
var _downloadTable = require("../../util/downloadTable");
|
|
12
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
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; }
|
|
15
|
-
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) { _defineProperty(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; }
|
|
16
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
17
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
19
|
-
const downloadButtonStyle = {
|
|
20
|
-
color: '#d1d2d3',
|
|
21
|
-
marginTop: '7px'
|
|
22
|
-
};
|
|
23
|
-
const DownloadButton = _ref => {
|
|
24
|
-
let {
|
|
25
|
-
count,
|
|
26
|
-
queryVariables,
|
|
27
|
-
table
|
|
28
|
-
} = _ref;
|
|
29
|
-
if (count === 0) {
|
|
30
|
-
return /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, {
|
|
31
|
-
style: downloadButtonStyle
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const client = (0, _client.useApolloClient)();
|
|
35
|
-
const downloadFile = 'CCDI Inventory ';
|
|
36
|
-
async function downloadSCSVFile() {
|
|
37
|
-
const {
|
|
38
|
-
query,
|
|
39
|
-
paginationAPIField
|
|
40
|
-
} = table;
|
|
41
|
-
const downloadFileName = downloadFile.concat(paginationAPIField.replace('Overview', ''), ' download');
|
|
42
|
-
const result = await client.query({
|
|
43
|
-
query,
|
|
44
|
-
variables: _objectSpread(_objectSpread({}, queryVariables), {}, {
|
|
45
|
-
page: 0,
|
|
46
|
-
first: 25000
|
|
47
|
-
})
|
|
48
|
-
}).then(response => {
|
|
49
|
-
if (paginationAPIField && response && response.data) {
|
|
50
|
-
return response.data[paginationAPIField];
|
|
51
|
-
}
|
|
52
|
-
return response.data;
|
|
53
|
-
});
|
|
54
|
-
(0, _downloadTable.downloadJson)(result, table, downloadFileName);
|
|
55
|
-
}
|
|
56
|
-
const downloadTableCSV = (0, _react.useCallback)(() => {
|
|
57
|
-
downloadSCSVFile();
|
|
58
|
-
}, [queryVariables]);
|
|
59
|
-
return /*#__PURE__*/_react.default.createElement(_core.Tooltip, {
|
|
60
|
-
title: "Download filtered results as a CSV"
|
|
61
|
-
}, /*#__PURE__*/_react.default.createElement(_core.IconButton, {
|
|
62
|
-
onClick: downloadTableCSV
|
|
63
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.CloudDownload, null)));
|
|
64
|
-
};
|
|
65
|
-
var _default = DownloadButton;
|
|
66
|
-
exports.default = _default;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { useApolloClient } from '@apollo/client';
|
|
3
|
-
import {
|
|
4
|
-
IconButton,
|
|
5
|
-
Tooltip,
|
|
6
|
-
} from '@material-ui/core';
|
|
7
|
-
import { CloudDownload } from '@material-ui/icons';
|
|
8
|
-
import { downloadJson } from '../../util/downloadTable';
|
|
9
|
-
|
|
10
|
-
const downloadButtonStyle = {
|
|
11
|
-
color: '#d1d2d3',
|
|
12
|
-
marginTop: '7px',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const DownloadButton = ({
|
|
16
|
-
count,
|
|
17
|
-
queryVariables,
|
|
18
|
-
table,
|
|
19
|
-
}) => {
|
|
20
|
-
if (count === 0) {
|
|
21
|
-
return <CloudDownload style={downloadButtonStyle} />;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const client = useApolloClient();
|
|
25
|
-
|
|
26
|
-
const downloadFile = 'CCDI Inventory ';
|
|
27
|
-
|
|
28
|
-
async function downloadSCSVFile() {
|
|
29
|
-
const {
|
|
30
|
-
query,
|
|
31
|
-
paginationAPIField,
|
|
32
|
-
} = table;
|
|
33
|
-
|
|
34
|
-
const downloadFileName = downloadFile.concat(paginationAPIField.replace('Overview', ''), ' download');
|
|
35
|
-
|
|
36
|
-
const result = await client.query({
|
|
37
|
-
query,
|
|
38
|
-
variables: {
|
|
39
|
-
...queryVariables,
|
|
40
|
-
page: 0,
|
|
41
|
-
first: 25000,
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
.then((response) => {
|
|
45
|
-
if (paginationAPIField && response && response.data) {
|
|
46
|
-
return response.data[paginationAPIField];
|
|
47
|
-
}
|
|
48
|
-
return response.data;
|
|
49
|
-
});
|
|
50
|
-
downloadJson(result, table, downloadFileName);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const downloadTableCSV = useCallback(() => {
|
|
54
|
-
downloadSCSVFile();
|
|
55
|
-
}, [queryVariables]);
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<Tooltip title="Download filtered results as a CSV">
|
|
59
|
-
<IconButton
|
|
60
|
-
onClick={downloadTableCSV}
|
|
61
|
-
>
|
|
62
|
-
<CloudDownload />
|
|
63
|
-
</IconButton>
|
|
64
|
-
</Tooltip>
|
|
65
|
-
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export default DownloadButton;
|