@civicactions/cmsds-open-data-components 3.1.2 → 3.1.3-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 +123 -158
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1010,7 +1010,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1010
1010
|
["page-size"]: pageSize !== 10 ? pageSize : undefined,
|
|
1011
1011
|
...additionalParams
|
|
1012
1012
|
};
|
|
1013
|
-
const { data: data,
|
|
1013
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
1014
1014
|
queryKey: [
|
|
1015
1015
|
"datasets",
|
|
1016
1016
|
params
|
|
@@ -1110,7 +1110,7 @@ const $e873081a6e8f024e$var$DatasetSearch = (props)=>{
|
|
|
1110
1110
|
}),
|
|
1111
1111
|
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
1112
1112
|
className: "ds-l-col--12 ds-l-sm-col--8",
|
|
1113
|
-
children:
|
|
1113
|
+
children: isPending ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
1114
1114
|
className: "ds-u-valign--middle",
|
|
1115
1115
|
"aria-valuetext": "Dataset Search loading",
|
|
1116
1116
|
role: "status"
|
|
@@ -1271,24 +1271,24 @@ const $b4aa9c66f2e86959$var$useMetastoreDataset = (datasetId, rootAPIUrl, additi
|
|
|
1271
1271
|
const [id, setId] = (0, $hgUW1$useState)(datasetId);
|
|
1272
1272
|
const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
|
|
1273
1273
|
const additionalParamsString = Object.keys(additionalParams).length ? `&${(0, $hgUW1$qs).stringify(additionalParams)}` : "";
|
|
1274
|
-
(0, $hgUW1$
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
modified: dataset.modified
|
|
1283
|
-
}));
|
|
1274
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
1275
|
+
queryKey: [
|
|
1276
|
+
"metastore" + id
|
|
1277
|
+
],
|
|
1278
|
+
queryFn: ()=>{
|
|
1279
|
+
return fetch(`${rootUrl}/metastore/schemas/dataset/items/${id}?show-reference-ids${additionalParamsString}`).then((res)=>res.json()).then((res)=>{
|
|
1280
|
+
return res;
|
|
1281
|
+
});
|
|
1284
1282
|
}
|
|
1285
|
-
|
|
1283
|
+
});
|
|
1284
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
1285
|
+
if (data && data != dataset) setDataset(data);
|
|
1286
1286
|
}, [
|
|
1287
|
-
|
|
1288
|
-
rootUrl
|
|
1287
|
+
data
|
|
1289
1288
|
]);
|
|
1290
1289
|
return {
|
|
1291
1290
|
dataset: dataset,
|
|
1291
|
+
isPending: isPending,
|
|
1292
1292
|
setId: setId,
|
|
1293
1293
|
setRootUrl: setRootUrl
|
|
1294
1294
|
};
|
|
@@ -1301,47 +1301,9 @@ var $b4aa9c66f2e86959$export$2e2bcd8739ae039 = $b4aa9c66f2e86959$var$useMetastor
|
|
|
1301
1301
|
|
|
1302
1302
|
|
|
1303
1303
|
|
|
1304
|
-
async function $0e7628cf73c71646$export$55f990b5477765d6(id, rootUrl, options, additionalParams) {
|
|
1305
|
-
const { keys: keys, limit: limit, offset: offset, conditions: conditions, sort: sort, groupings: groupings, prepareColumns: prepareColumns, properties: properties, setValues: setValues, setCount: setCount, setColumns: setColumns, setLoading: setLoading, setSchema: setSchema } = options;
|
|
1306
|
-
if (!id) // TODO: Throw error
|
|
1307
|
-
return false;
|
|
1308
|
-
if (typeof setLoading === "function") setLoading(true);
|
|
1309
|
-
return await (0, $hgUW1$axios)({
|
|
1310
|
-
method: "GET",
|
|
1311
|
-
url: `${rootUrl}/datastore/query/${id}`,
|
|
1312
|
-
params: {
|
|
1313
|
-
keys: keys,
|
|
1314
|
-
limit: limit,
|
|
1315
|
-
offset: offset,
|
|
1316
|
-
conditions: conditions,
|
|
1317
|
-
sorts: sort,
|
|
1318
|
-
properties: properties,
|
|
1319
|
-
groupings: groupings,
|
|
1320
|
-
...additionalParams
|
|
1321
|
-
},
|
|
1322
|
-
//paramsSerializer: {
|
|
1323
|
-
// serialize: qs.stringify
|
|
1324
|
-
//},
|
|
1325
|
-
paramsSerializer: (params)=>{
|
|
1326
|
-
return (0, $hgUW1$qs).stringify(params);
|
|
1327
|
-
}
|
|
1328
|
-
}).then((res)=>{
|
|
1329
|
-
const { data: data } = res;
|
|
1330
|
-
const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
|
|
1331
|
-
setValues(data.results), setCount(data.count);
|
|
1332
|
-
if (propertyKeys.length) setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys);
|
|
1333
|
-
setSchema(data.schema);
|
|
1334
|
-
if (typeof setLoading === "function") setLoading(false);
|
|
1335
|
-
return data;
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
1304
|
const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, additionalParams = {})=>{
|
|
1341
1305
|
const keys = options.keys ? options.keys : true;
|
|
1342
1306
|
const { prepareColumns: prepareColumns } = options;
|
|
1343
|
-
const [manual, setManual] = (0, $hgUW1$useState)(options.manual ? options.manual : false);
|
|
1344
|
-
const [requireConditions, setRequireConditions] = (0, $hgUW1$useState)(options.requireConditions ? options.requireConditions : false);
|
|
1345
1307
|
const [values, setValues] = (0, $hgUW1$useState)([]);
|
|
1346
1308
|
const [id, setResource] = (0, $hgUW1$useState)(resourceId);
|
|
1347
1309
|
const [rootUrl, setRootUrl] = (0, $hgUW1$useState)(rootAPIUrl);
|
|
@@ -1349,63 +1311,43 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
1349
1311
|
const [count, setCount] = (0, $hgUW1$useState)(null);
|
|
1350
1312
|
const [columns, setColumns] = (0, $hgUW1$useState)([]);
|
|
1351
1313
|
const [offset, setOffset] = (0, $hgUW1$useState)(options.offset ? options.offset : 0);
|
|
1352
|
-
const [loading, setLoading] = (0, $hgUW1$useState)(false);
|
|
1353
1314
|
const [conditions, setConditions] = (0, $hgUW1$useState)(options.conditions ? options.conditions : undefined);
|
|
1354
1315
|
const [sort, setSort] = (0, $hgUW1$useState)(options.sort ? options.sort : undefined);
|
|
1355
1316
|
const [groupings, setGroupings] = (0, $hgUW1$useState)(options.groupings ? options.groupings : undefined);
|
|
1356
1317
|
const [schema, setSchema] = (0, $hgUW1$useState)({});
|
|
1357
1318
|
// const [joins, setJoins] = useState()
|
|
1358
1319
|
const [properties, setProperties] = (0, $hgUW1$useState)(options.properties ? options.properties : undefined);
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1320
|
+
let params = {
|
|
1321
|
+
keys: keys,
|
|
1322
|
+
limit: limit,
|
|
1323
|
+
offset: offset,
|
|
1324
|
+
conditions: conditions,
|
|
1325
|
+
sorts: sort,
|
|
1326
|
+
properties: properties,
|
|
1327
|
+
groupings: groupings,
|
|
1328
|
+
...additionalParams
|
|
1329
|
+
};
|
|
1330
|
+
const additionalParamsString = Object.keys(params).length ? `&${(0, $hgUW1$qs).stringify(params)}` : "";
|
|
1331
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
1332
|
+
queryKey: [
|
|
1333
|
+
"datastore" + id + additionalParamsString
|
|
1334
|
+
],
|
|
1335
|
+
queryFn: ()=>{
|
|
1336
|
+
return fetch(`${rootUrl}/datastore/query/${id}?${additionalParamsString}`).then((res)=>res.json());
|
|
1337
|
+
}
|
|
1364
1338
|
});
|
|
1365
|
-
const prevLimit = prevLimitRef.current;
|
|
1366
|
-
const prevOffset = prevOffsetRef.current;
|
|
1367
|
-
function fetchData() {
|
|
1368
|
-
let newOffset = prevLimit === limit ? prevOffset !== offset ? offset : 0 : 0;
|
|
1369
|
-
setOffset(newOffset);
|
|
1370
|
-
(0, $0e7628cf73c71646$export$55f990b5477765d6)(id, rootUrl, {
|
|
1371
|
-
keys: keys,
|
|
1372
|
-
limit: limit,
|
|
1373
|
-
offset: newOffset,
|
|
1374
|
-
conditions: conditions,
|
|
1375
|
-
sort: sort,
|
|
1376
|
-
groupings: groupings,
|
|
1377
|
-
prepareColumns: prepareColumns,
|
|
1378
|
-
properties: properties,
|
|
1379
|
-
setValues: setValues,
|
|
1380
|
-
setCount: setCount,
|
|
1381
|
-
setColumns: setColumns,
|
|
1382
|
-
setLoading: setLoading,
|
|
1383
|
-
setSchema: setSchema,
|
|
1384
|
-
setProperties: setProperties
|
|
1385
|
-
}, additionalParams);
|
|
1386
|
-
}
|
|
1387
1339
|
(0, $hgUW1$useEffect)(()=>{
|
|
1388
|
-
if (
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
setCount(null);
|
|
1394
|
-
setValues([]);
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1340
|
+
if (data) {
|
|
1341
|
+
const propertyKeys = data.schema[id] && data.schema[id].fields ? Object.keys(data.schema[id].fields) : [];
|
|
1342
|
+
setValues(data.results), setCount(data.count);
|
|
1343
|
+
if (propertyKeys.length) setColumns(prepareColumns ? prepareColumns(propertyKeys) : propertyKeys);
|
|
1344
|
+
setSchema(data.schema);
|
|
1397
1345
|
}
|
|
1398
1346
|
}, [
|
|
1399
|
-
|
|
1400
|
-
rootUrl,
|
|
1401
|
-
offset,
|
|
1402
|
-
conditions,
|
|
1403
|
-
sort,
|
|
1404
|
-
limit,
|
|
1405
|
-
requireConditions
|
|
1347
|
+
data
|
|
1406
1348
|
]);
|
|
1407
1349
|
return {
|
|
1408
|
-
loading:
|
|
1350
|
+
loading: isPending,
|
|
1409
1351
|
values: values,
|
|
1410
1352
|
count: count,
|
|
1411
1353
|
columns: columns,
|
|
@@ -1421,10 +1363,7 @@ const $1d3d480a9cfaabe0$var$useDatastore = (resourceId, rootAPIUrl, options, add
|
|
|
1421
1363
|
setLimit: setLimit,
|
|
1422
1364
|
setOffset: setOffset,
|
|
1423
1365
|
setConditions: setConditions,
|
|
1424
|
-
setSort: setSort
|
|
1425
|
-
setManual: setManual,
|
|
1426
|
-
setRequireConditions: setRequireConditions,
|
|
1427
|
-
fetchData: fetchData
|
|
1366
|
+
setSort: setSort
|
|
1428
1367
|
};
|
|
1429
1368
|
};
|
|
1430
1369
|
var $1d3d480a9cfaabe0$export$2e2bcd8739ae039 = $1d3d480a9cfaabe0$var$useDatastore;
|
|
@@ -2194,8 +2133,15 @@ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHe
|
|
|
2194
2133
|
|
|
2195
2134
|
const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
|
|
2196
2135
|
const { fields: fields } = schema;
|
|
2197
|
-
|
|
2198
|
-
children: "
|
|
2136
|
+
const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
2137
|
+
children: "Data filters: "
|
|
2138
|
+
});
|
|
2139
|
+
if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
|
|
2140
|
+
className: "ds-u-margin-y--0",
|
|
2141
|
+
children: [
|
|
2142
|
+
prependedMessage,
|
|
2143
|
+
" none"
|
|
2144
|
+
]
|
|
2199
2145
|
});
|
|
2200
2146
|
function formatValue(text, property) {
|
|
2201
2147
|
if (customColumns && customColumns.length > 0) {
|
|
@@ -2207,42 +2153,48 @@ const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: sche
|
|
|
2207
2153
|
return text;
|
|
2208
2154
|
} else return text;
|
|
2209
2155
|
}
|
|
2210
|
-
return /*#__PURE__*/ (0, $hgUW1$
|
|
2156
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2211
2157
|
className: "dc-querybuilder-title",
|
|
2212
|
-
children:
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2158
|
+
children: [
|
|
2159
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2160
|
+
className: "ds-u-margin-y--0",
|
|
2161
|
+
children: prependedMessage
|
|
2162
|
+
}),
|
|
2163
|
+
conditions.map((c)=>{
|
|
2164
|
+
const field = fields[c.property];
|
|
2165
|
+
const description = field && field.description ? field.description : c.property;
|
|
2166
|
+
const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
|
|
2167
|
+
const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
|
|
2168
|
+
const formattedText = formatValue(cleanedText, c.property);
|
|
2169
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2170
|
+
className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
|
|
2171
|
+
children: [
|
|
2172
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2173
|
+
className: "ds-u-font-weight--bold",
|
|
2174
|
+
children: description
|
|
2175
|
+
}),
|
|
2176
|
+
" ",
|
|
2177
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2178
|
+
className: "ds-u-font-weight--normal",
|
|
2179
|
+
children: operator.label.toUpperCase()
|
|
2180
|
+
}),
|
|
2181
|
+
" ",
|
|
2182
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2183
|
+
className: "ds-u-color--success",
|
|
2184
|
+
children: formattedText
|
|
2185
|
+
})
|
|
2186
|
+
]
|
|
2187
|
+
});
|
|
2188
|
+
}).reduce((prev, curr)=>[
|
|
2189
|
+
prev,
|
|
2190
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
2191
|
+
className: "ds-u-margin-x--1",
|
|
2192
|
+
variation: "info",
|
|
2193
|
+
children: "AND"
|
|
2229
2194
|
}),
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
children: formattedText
|
|
2234
|
-
})
|
|
2235
|
-
]
|
|
2236
|
-
});
|
|
2237
|
-
}).reduce((prev, curr)=>[
|
|
2238
|
-
prev,
|
|
2239
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
2240
|
-
className: "ds-u-margin-x--1",
|
|
2241
|
-
variation: "info",
|
|
2242
|
-
children: "AND"
|
|
2243
|
-
}),
|
|
2244
|
-
curr
|
|
2245
|
-
])
|
|
2195
|
+
curr
|
|
2196
|
+
])
|
|
2197
|
+
]
|
|
2246
2198
|
});
|
|
2247
2199
|
};
|
|
2248
2200
|
var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
|
|
@@ -2788,7 +2740,7 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
|
|
|
2788
2740
|
className: "ds-l-col--12 ds-u-padding-left--0 ds-text-heading--2xl",
|
|
2789
2741
|
children: "Resources"
|
|
2790
2742
|
}),
|
|
2791
|
-
distributions.length
|
|
2743
|
+
distributions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
2792
2744
|
className: "ds-c-list ds-c-list--bare dc-c-resource-full-width",
|
|
2793
2745
|
children: distributions.map((dist)=>{
|
|
2794
2746
|
const fileFormat = getFormatType(dist);
|
|
@@ -2831,6 +2783,8 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
|
|
|
2831
2783
|
]
|
|
2832
2784
|
}, dist.identifier);
|
|
2833
2785
|
})
|
|
2786
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2787
|
+
className: "ds-u-margin-top--2"
|
|
2834
2788
|
})
|
|
2835
2789
|
]
|
|
2836
2790
|
});
|
|
@@ -3049,7 +3003,7 @@ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
|
|
|
3049
3003
|
|
|
3050
3004
|
|
|
3051
3005
|
const $a0f13962e513caa1$var$getSiteWideDataDictionary = (rootUrl, dataDictionaryUrl)=>{
|
|
3052
|
-
const { data: data,
|
|
3006
|
+
const { data: data, isPending: isPending, error: error } = (0, $hgUW1$useQuery)({
|
|
3053
3007
|
queryKey: [
|
|
3054
3008
|
"dictionary"
|
|
3055
3009
|
],
|
|
@@ -3059,7 +3013,7 @@ const $a0f13962e513caa1$var$getSiteWideDataDictionary = (rootUrl, dataDictionary
|
|
|
3059
3013
|
});
|
|
3060
3014
|
return {
|
|
3061
3015
|
siteWideDataDictionary: data,
|
|
3062
|
-
dataDictionaryLoading:
|
|
3016
|
+
dataDictionaryLoading: isPending
|
|
3063
3017
|
};
|
|
3064
3018
|
};
|
|
3065
3019
|
const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalParams: additionalParams, customColumns: customColumns, setDatasetTitle: setDatasetTitle, customMetadataMapping: customMetadataMapping, apiPageUrl: apiPageUrl = "/api", dataDictionaryUrl: dataDictionaryUrl, borderlessTabs: borderlessTabs = false, defaultPageSize: defaultPageSize = 25 })=>{
|
|
@@ -3070,7 +3024,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3070
3024
|
} : {
|
|
3071
3025
|
conditions: []
|
|
3072
3026
|
};
|
|
3073
|
-
const { dataset: dataset } = (0, $b4aa9c66f2e86959$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
|
|
3027
|
+
const { dataset: dataset, isPending: isPending } = (0, $b4aa9c66f2e86959$export$2e2bcd8739ae039)(id, rootUrl, additionalParams);
|
|
3074
3028
|
const title = dataset.title ? dataset.title : "";
|
|
3075
3029
|
const metadataMapping = {
|
|
3076
3030
|
...(0, $6da0396069e23175$export$bc27cf7ecf44639d),
|
|
@@ -3092,19 +3046,20 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3092
3046
|
const datasetDictionary = siteWideDataDictionary && resource && resource.schema[distribution.identifier] ? siteWideDataDictionary.data.fields.filter((field)=>{
|
|
3093
3047
|
return Object.keys(resource.schema[distribution.identifier].fields).indexOf(field.name) !== -1;
|
|
3094
3048
|
}) : null;
|
|
3095
|
-
|
|
3049
|
+
const getlocalFileFormat = ()=>{
|
|
3050
|
+
let localFileFormat = "";
|
|
3096
3051
|
if (distribution.identifier) {
|
|
3097
|
-
let localFileFormat = "";
|
|
3098
3052
|
if (distribution.data.format) localFileFormat = distribution.data.format.toUpperCase();
|
|
3099
3053
|
else if (distribution.data.mediaType) {
|
|
3100
3054
|
const mediaType = distribution.data.mediaType.split("/");
|
|
3101
3055
|
if (mediaType.length && mediaType[1]) localFileFormat = mediaType[1].toUpperCase();
|
|
3102
3056
|
}
|
|
3103
|
-
if (localFileFormat === "CSV") {
|
|
3104
|
-
resource.setResource(distribution.identifier);
|
|
3105
|
-
resource.setManual(false);
|
|
3106
|
-
}
|
|
3107
3057
|
}
|
|
3058
|
+
return localFileFormat;
|
|
3059
|
+
};
|
|
3060
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
3061
|
+
const localFileFormat = getlocalFileFormat();
|
|
3062
|
+
if (localFileFormat === "CSV") resource.setResource(distribution.identifier);
|
|
3108
3063
|
}, [
|
|
3109
3064
|
distribution
|
|
3110
3065
|
]);
|
|
@@ -3146,6 +3101,17 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3146
3101
|
})
|
|
3147
3102
|
]
|
|
3148
3103
|
});
|
|
3104
|
+
// The below code manages the selected tab in the Design System tab group manually to ensure we can still use the
|
|
3105
|
+
// Data Table tab as the default since it no longer exists on initial render (By default, Overview will appear as default)
|
|
3106
|
+
const getDefaultTab = ()=>{
|
|
3107
|
+
return distribution && distribution.data && getlocalFileFormat() === "CSV" ? "data-table" : "overview";
|
|
3108
|
+
};
|
|
3109
|
+
const [selectedTab, setSelectedTab] = (0, $hgUW1$useState)(window.location.hash.substring(1) ? window.location.hash.substring(1) : getDefaultTab());
|
|
3110
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
3111
|
+
setSelectedTab(getDefaultTab());
|
|
3112
|
+
}, [
|
|
3113
|
+
distribution
|
|
3114
|
+
]);
|
|
3149
3115
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
3150
3116
|
children: dataset.error ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $026cb986f9fea2b1$export$2e2bcd8739ae039), {
|
|
3151
3117
|
content: notFoundContent,
|
|
@@ -3193,11 +3159,13 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3193
3159
|
className: "ds-l-row",
|
|
3194
3160
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3195
3161
|
className: "ds-l-md-col--12 dc-dataset",
|
|
3196
|
-
children:
|
|
3197
|
-
onChange:
|
|
3198
|
-
|
|
3162
|
+
children: !isPending && /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tabs), {
|
|
3163
|
+
onChange: (selectedId, prevSelectedId)=>{
|
|
3164
|
+
setSelectedTab(selectedId);
|
|
3165
|
+
},
|
|
3166
|
+
selectedId: selectedTab,
|
|
3199
3167
|
children: [
|
|
3200
|
-
distribution.data
|
|
3168
|
+
distribution && distribution.data && getlocalFileFormat() === "CSV" && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3201
3169
|
id: "data-table",
|
|
3202
3170
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3203
3171
|
className: "ds-u-color--primary",
|
|
@@ -3236,7 +3204,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3236
3204
|
metadataMapping: metadataMapping
|
|
3237
3205
|
})
|
|
3238
3206
|
}),
|
|
3239
|
-
datasetDictionary && datasetDictionary.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3207
|
+
distribution && distribution.data && datasetDictionary && datasetDictionary.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3240
3208
|
id: "data-dictionary",
|
|
3241
3209
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3242
3210
|
className: "ds-u-color--primary",
|
|
@@ -3253,7 +3221,7 @@ const $a0f13962e513caa1$var$Dataset = ({ id: id, rootUrl: rootUrl, additionalPar
|
|
|
3253
3221
|
title: "Data Dictionary"
|
|
3254
3222
|
})
|
|
3255
3223
|
}) : null,
|
|
3256
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3224
|
+
distribution && distribution.data && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TabPanel), {
|
|
3257
3225
|
id: "api",
|
|
3258
3226
|
tab: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3259
3227
|
className: "ds-u-color--primary",
|
|
@@ -5407,10 +5375,7 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset,
|
|
|
5407
5375
|
manual: true
|
|
5408
5376
|
}, additionalParams);
|
|
5409
5377
|
(0, $hgUW1$useEffect)(()=>{
|
|
5410
|
-
if (distribution.identifier)
|
|
5411
|
-
resource.setResource(distribution.identifier);
|
|
5412
|
-
resource.setManual(false);
|
|
5413
|
-
}
|
|
5378
|
+
if (distribution.identifier) resource.setResource(distribution.identifier);
|
|
5414
5379
|
}, [
|
|
5415
5380
|
distribution
|
|
5416
5381
|
]);
|