@civicactions/cmsds-open-data-components 3.1.7 → 3.1.8-alpha.2
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/main.js +14 -10
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1304,7 +1304,7 @@ var $b4aa9c66f2e86959$export$2e2bcd8739ae039 = $b4aa9c66f2e86959$var$useMetastor
|
|
|
1304
1304
|
|
|
1305
1305
|
|
|
1306
1306
|
|
|
1307
|
-
const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, additionalParams = {})=>{
|
|
1307
|
+
const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, additionalParams = {}, enabledParam = true)=>{
|
|
1308
1308
|
const keys = options.keys ? options.keys : true;
|
|
1309
1309
|
const { prepareColumns: prepareColumns } = options;
|
|
1310
1310
|
const [values, setValues] = (0, $hgUW1$useState)([]);
|
|
@@ -1331,13 +1331,15 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
1331
1331
|
...additionalParams
|
|
1332
1332
|
};
|
|
1333
1333
|
const additionalParamsString = Object.keys(params).length ? `&${(0, $hgUW1$qs).stringify(params)}` : "";
|
|
1334
|
+
const enabled = enabledParam && id !== null && id != "";
|
|
1334
1335
|
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
1335
1336
|
queryKey: [
|
|
1336
1337
|
"datastore" + id + additionalParamsString
|
|
1337
1338
|
],
|
|
1338
1339
|
queryFn: ()=>{
|
|
1339
1340
|
return fetch(`${rootUrl}/datastore/query/${id}?${additionalParamsString}`).then((res)=>res.json());
|
|
1340
|
-
}
|
|
1341
|
+
},
|
|
1342
|
+
enabled: enabled
|
|
1341
1343
|
});
|
|
1342
1344
|
(0, $hgUW1$useEffect)(()=>{
|
|
1343
1345
|
if (data) {
|
|
@@ -1350,7 +1352,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
1350
1352
|
data
|
|
1351
1353
|
]);
|
|
1352
1354
|
return {
|
|
1353
|
-
loading: isPending,
|
|
1355
|
+
loading: enabled ? isPending : false,
|
|
1354
1356
|
values: values,
|
|
1355
1357
|
count: count,
|
|
1356
1358
|
columns: columns,
|
|
@@ -2451,8 +2453,8 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = (props)=>{
|
|
|
2451
2453
|
};
|
|
2452
2454
|
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2453
2455
|
className: "dc-query-builder ds-u-margin-bottom--3",
|
|
2454
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)(
|
|
2455
|
-
|
|
2456
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2457
|
+
className: "ds-c-accordion ds-c-accordion--bordered",
|
|
2456
2458
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
|
|
2457
2459
|
heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
|
|
2458
2460
|
schema: schema[id],
|
|
@@ -2959,6 +2961,7 @@ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
|
|
|
2959
2961
|
|
|
2960
2962
|
|
|
2961
2963
|
|
|
2964
|
+
|
|
2962
2965
|
const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, count: count, pageSize: pageSize })=>{
|
|
2963
2966
|
const [pagination, setPagination] = (0, $hgUW1$useState)({
|
|
2964
2967
|
pageIndex: 1,
|
|
@@ -3137,11 +3140,12 @@ const $6012b86ffcaf3f71$var$DataDictionary = ({ datasetDictionaryEndpoint: datas
|
|
|
3137
3140
|
"dictionary" + datasetDictionaryEndpoint
|
|
3138
3141
|
],
|
|
3139
3142
|
queryFn: ()=>{
|
|
3140
|
-
return
|
|
3143
|
+
return (0, $hgUW1$axios).get(`${datasetDictionaryEndpoint}?${(0, $hgUW1$qs).stringify(additionalParams, {
|
|
3141
3144
|
arrayFormat: "comma",
|
|
3142
3145
|
encode: false
|
|
3143
|
-
})}`).then((res)=>res.
|
|
3144
|
-
}
|
|
3146
|
+
})}`).then((res)=>res.data).catch((error)=>console.error(error));
|
|
3147
|
+
},
|
|
3148
|
+
enabled: datasetDictionaryEndpoint !== undefined
|
|
3145
3149
|
});
|
|
3146
3150
|
const datasetDictionary = data && data.data && data.data.fields && data.data.fields.length ? data.data.fields : null;
|
|
3147
3151
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
@@ -5475,8 +5479,8 @@ const $3b6ca952e79f0695$var$QueryBuilder = ({ resource: resource, id: id, includ
|
|
|
5475
5479
|
};
|
|
5476
5480
|
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
5477
5481
|
className: "dc-query-builder ds-u-margin-bottom--3",
|
|
5478
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)(
|
|
5479
|
-
|
|
5482
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
5483
|
+
className: "ds-c-accordion ds-c-accordion--bordered",
|
|
5480
5484
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
|
|
5481
5485
|
heading: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $bef7bff2823feea2$export$2e2bcd8739ae039), {
|
|
5482
5486
|
schema: schema[id],
|