@civicactions/cmsds-open-data-components 3.10.0-alpha.1 → 3.10.0-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.css +398 -6
- package/dist/main.css.map +1 -1
- package/dist/main.js +1017 -646
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +9 -8
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {jsx as $hgUW1$jsx, jsxs as $hgUW1$jsxs, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
|
|
3
|
-
import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Dropdown as $hgUW1$Dropdown, Choice as $hgUW1$Choice, Pagination as $hgUW1$Pagination,
|
|
3
|
+
import {Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, Button as $hgUW1$Button, CloseIconThin as $hgUW1$CloseIconThin, ArrowIcon as $hgUW1$ArrowIcon, Spinner as $hgUW1$Spinner, Alert as $hgUW1$Alert, Dialog as $hgUW1$Dialog, TextField as $hgUW1$TextField, Tooltip as $hgUW1$Tooltip, TooltipIcon as $hgUW1$TooltipIcon, Dropdown as $hgUW1$Dropdown, Choice as $hgUW1$Choice, Pagination as $hgUW1$Pagination, Table as $hgUW1$Table, TableHead as $hgUW1$TableHead, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableBody as $hgUW1$TableBody, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Badge as $hgUW1$Badge} from "@cmsgov/design-system";
|
|
4
4
|
import $hgUW1$react, {createContext as $hgUW1$createContext, useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, useContext as $hgUW1$useContext, useMemo as $hgUW1$useMemo, useCallback as $hgUW1$useCallback} from "react";
|
|
5
5
|
import {NavLink as $hgUW1$NavLink, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams} from "react-router-dom";
|
|
6
6
|
import $hgUW1$qs from "qs";
|
|
@@ -2348,6 +2348,67 @@ var $23763e27eda0e8d7$export$2e2bcd8739ae039 = $23763e27eda0e8d7$var$FixedSizeTH
|
|
|
2348
2348
|
|
|
2349
2349
|
|
|
2350
2350
|
|
|
2351
|
+
const $43a30d745a7bbc86$var$DataTableContext = /*#__PURE__*/ (0, $hgUW1$createContext)({
|
|
2352
|
+
id: null
|
|
2353
|
+
});
|
|
2354
|
+
var $43a30d745a7bbc86$export$2e2bcd8739ae039 = $43a30d745a7bbc86$var$DataTableContext;
|
|
2355
|
+
|
|
2356
|
+
|
|
2357
|
+
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
// Create a defaults object for reusability
|
|
2361
|
+
const $ee0d4d4f34048447$var$DataTableActionsContextDefaults = {
|
|
2362
|
+
columnOrder: [],
|
|
2363
|
+
setColumnOrder: ()=>{},
|
|
2364
|
+
columnVisibility: {},
|
|
2365
|
+
setColumnVisibility: ()=>{},
|
|
2366
|
+
page: 1,
|
|
2367
|
+
setPage: ()=>{},
|
|
2368
|
+
tableDensity: "normal",
|
|
2369
|
+
setTableDensity: ()=>{}
|
|
2370
|
+
};
|
|
2371
|
+
const $ee0d4d4f34048447$export$f814ea079e65d8fe = /*#__PURE__*/ (0, $hgUW1$createContext)($ee0d4d4f34048447$var$DataTableActionsContextDefaults);
|
|
2372
|
+
// Define our reusable provider component
|
|
2373
|
+
const $ee0d4d4f34048447$var$DataTableActionsProvider = ({ children: children })=>{
|
|
2374
|
+
// Set up all of the state
|
|
2375
|
+
const { id: id, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
2376
|
+
// a wrapper component to keep column state synced between full screen and regular modes
|
|
2377
|
+
const localStorageData = id ? JSON.parse(localStorage.getItem(id)) : null;
|
|
2378
|
+
const [page, setPage] = (0, $hgUW1$useState)(1);
|
|
2379
|
+
const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
|
|
2380
|
+
if (datasetTableControls && localStorageData) return localStorageData.tableColumnOrder;
|
|
2381
|
+
else return [];
|
|
2382
|
+
});
|
|
2383
|
+
const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
|
|
2384
|
+
if (datasetTableControls && localStorageData) return localStorageData.tableColumnVisibility;
|
|
2385
|
+
else return {};
|
|
2386
|
+
});
|
|
2387
|
+
const [tableDensity, setTableDensity] = (0, $hgUW1$useState)("normal");
|
|
2388
|
+
const providerValue = {
|
|
2389
|
+
columnOrder: columnOrder,
|
|
2390
|
+
setColumnOrder: setColumnOrder,
|
|
2391
|
+
columnVisibility: columnVisibility,
|
|
2392
|
+
setColumnVisibility: setColumnVisibility,
|
|
2393
|
+
page: page,
|
|
2394
|
+
setPage: setPage,
|
|
2395
|
+
tableDensity: tableDensity,
|
|
2396
|
+
setTableDensity: setTableDensity
|
|
2397
|
+
};
|
|
2398
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)($ee0d4d4f34048447$export$f814ea079e65d8fe.Provider, {
|
|
2399
|
+
value: providerValue,
|
|
2400
|
+
children: children
|
|
2401
|
+
});
|
|
2402
|
+
};
|
|
2403
|
+
const $ee0d4d4f34048447$export$67f91330d613e8f4 = ({ children: children, value: value = $ee0d4d4f34048447$var$DataTableActionsContextDefaults })=>/*#__PURE__*/ (0, $hgUW1$jsx)($ee0d4d4f34048447$export$f814ea079e65d8fe.Provider, {
|
|
2404
|
+
value: value,
|
|
2405
|
+
children: children
|
|
2406
|
+
});
|
|
2407
|
+
var $ee0d4d4f34048447$export$2e2bcd8739ae039 = $ee0d4d4f34048447$var$DataTableActionsProvider;
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
|
|
2411
|
+
|
|
2351
2412
|
|
|
2352
2413
|
|
|
2353
2414
|
|
|
@@ -2417,10 +2478,6 @@ var $5fe94aeb50e0798b$export$2e2bcd8739ae039 = $5fe94aeb50e0798b$var$Card;
|
|
|
2417
2478
|
|
|
2418
2479
|
|
|
2419
2480
|
|
|
2420
|
-
const $ebda441784d176a5$var$ManageColumnsContext = /*#__PURE__*/ (0, $hgUW1$createContext)({});
|
|
2421
|
-
var $ebda441784d176a5$export$2e2bcd8739ae039 = $ebda441784d176a5$var$ManageColumnsContext;
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
2481
|
|
|
2425
2482
|
class $5d9e2ce238d53d29$var$ExcludeCheckboxKeyboardSensor extends (0, $hgUW1$KeyboardSensor) {
|
|
2426
2483
|
// Custom function to exclude checkbox from keyboard dragging
|
|
@@ -2458,8 +2515,10 @@ class $5d9e2ce238d53d29$var$ExcludeCheckboxPointerSensor extends (0, $hgUW1$Poin
|
|
|
2458
2515
|
}
|
|
2459
2516
|
];
|
|
2460
2517
|
}
|
|
2461
|
-
const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder
|
|
2462
|
-
const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $
|
|
2518
|
+
const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, defaultColumnOrder: defaultColumnOrder })=>{
|
|
2519
|
+
const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, setColumnVisibility: setColumnVisibility, columnVisibility: contextColumnVisibility } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
2520
|
+
const columnVisibility = contextColumnVisibility || {};
|
|
2521
|
+
const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
|
|
2463
2522
|
// maintain card state separately from table state - only sync states when the Save button is pressed
|
|
2464
2523
|
const [cards, setCards] = (0, $hgUW1$useState)(columns.map((c)=>{
|
|
2465
2524
|
return {
|
|
@@ -2516,137 +2575,164 @@ const $5d9e2ce238d53d29$var$ManageColumns = ({ id: id, columns: columns, default
|
|
|
2516
2575
|
};
|
|
2517
2576
|
}));
|
|
2518
2577
|
};
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2530
|
-
className: "ds-u-display--flex ds-u-justify-content--between ds-u-flex-wrap--wrap ds-u-padding-x--3 ds-u-padding-bottom--1 ds-u-sm-padding-bottom--3",
|
|
2578
|
+
const hiddenColumns = Object.keys(columnVisibility).filter((key)=>columnVisibility[key] === false).length;
|
|
2579
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2580
|
+
className: "dkan-manage-columns-wrapper",
|
|
2581
|
+
children: [
|
|
2582
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
|
|
2583
|
+
"aria-label": "Manage columns - Opens in a dialog",
|
|
2584
|
+
className: "dkan-filter-dataset-toolbar-button ds-u-color--primary ds-u-text-decoration--underline ds-u-font-size--sm ds-u-padding-x--2 ds-u-margin--0 ds-u-border--0 ds-u-fill--transparent",
|
|
2585
|
+
onClick: ()=>{
|
|
2586
|
+
setModalOpen(true);
|
|
2587
|
+
},
|
|
2531
2588
|
children: [
|
|
2532
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2533
|
-
className: "
|
|
2589
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2590
|
+
className: "fa fa-columns ds-u-margin-right--1"
|
|
2591
|
+
}),
|
|
2592
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2534
2593
|
children: [
|
|
2535
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)(
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
onClick: ()=>{
|
|
2539
|
-
setModalOpen(false);
|
|
2540
|
-
// update table state
|
|
2541
|
-
// Visibility
|
|
2542
|
-
// This code is building a new columnVisibility state object from the card state and doing a single setState on the table
|
|
2543
|
-
// vs doing a setState on every changed column individually
|
|
2544
|
-
const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
|
|
2545
|
-
setColumnVisibility(newColumnVisibility);
|
|
2546
|
-
// Card order
|
|
2547
|
-
const newCardOrder = cards.map((c)=>{
|
|
2548
|
-
return c.id;
|
|
2549
|
-
});
|
|
2550
|
-
setColumnOrder(newCardOrder);
|
|
2551
|
-
// save to localStorage
|
|
2552
|
-
const localStorageData = {
|
|
2553
|
-
tableColumnOrder: newCardOrder,
|
|
2554
|
-
tableColumnVisibility: newColumnVisibility
|
|
2555
|
-
};
|
|
2556
|
-
localStorage.setItem(id, JSON.stringify(localStorageData));
|
|
2557
|
-
},
|
|
2558
|
-
children: "Save"
|
|
2594
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2595
|
+
className: "ds-u-display--none ds-u-lg-display--inline-block",
|
|
2596
|
+
children: "Manage Columns"
|
|
2559
2597
|
}),
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2598
|
+
hiddenColumns ? ` (${hiddenColumns})` : ""
|
|
2599
|
+
]
|
|
2600
|
+
})
|
|
2601
|
+
]
|
|
2602
|
+
}),
|
|
2603
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2604
|
+
className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
|
|
2605
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Dialog), {
|
|
2606
|
+
heading: "Manage columns",
|
|
2607
|
+
isOpen: modalOpen,
|
|
2608
|
+
onExit: ()=>{
|
|
2609
|
+
setModalOpen(false);
|
|
2610
|
+
resetCards();
|
|
2611
|
+
},
|
|
2612
|
+
className: "dkan-manage-columns-dialog",
|
|
2613
|
+
actions: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2614
|
+
className: "ds-u-display--flex ds-u-justify-content--between ds-u-flex-wrap--wrap ds-u-padding-x--3 ds-u-padding-bottom--1 ds-u-sm-padding-bottom--3",
|
|
2615
|
+
children: [
|
|
2616
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2617
|
+
className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0",
|
|
2618
|
+
children: [
|
|
2619
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2620
|
+
variation: "solid",
|
|
2621
|
+
className: "ds-l-col--6 ds-l-sm-col--auto",
|
|
2622
|
+
onClick: ()=>{
|
|
2623
|
+
setModalOpen(false);
|
|
2624
|
+
// update table state
|
|
2625
|
+
// Visibility
|
|
2626
|
+
// This code is building a new columnVisibility state object from the card state and doing a single setState on the table
|
|
2627
|
+
// vs doing a setState on every changed column individually
|
|
2628
|
+
const newColumnVisibility = Object.fromEntries(cards.map((c)=>Object.values(c)));
|
|
2629
|
+
setColumnVisibility(newColumnVisibility);
|
|
2630
|
+
// Card order
|
|
2631
|
+
const newCardOrder = cards.map((c)=>{
|
|
2632
|
+
return c.id;
|
|
2633
|
+
});
|
|
2634
|
+
setColumnOrder(newCardOrder);
|
|
2635
|
+
// save to localStorage
|
|
2636
|
+
const localStorageData = {
|
|
2637
|
+
tableColumnOrder: newCardOrder,
|
|
2638
|
+
tableColumnVisibility: newColumnVisibility
|
|
2639
|
+
};
|
|
2640
|
+
localStorage.setItem(id, JSON.stringify(localStorageData));
|
|
2641
|
+
},
|
|
2642
|
+
children: "Save"
|
|
2643
|
+
}),
|
|
2644
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2645
|
+
variation: "ghost",
|
|
2646
|
+
className: "ds-l-col--6 ds-l-sm-col--auto",
|
|
2647
|
+
onClick: ()=>{
|
|
2648
|
+
setModalOpen(false);
|
|
2649
|
+
resetCards();
|
|
2650
|
+
},
|
|
2651
|
+
children: "Cancel"
|
|
2652
|
+
})
|
|
2653
|
+
]
|
|
2654
|
+
}),
|
|
2655
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2656
|
+
className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-padding-top--1 ds-u-sm-padding-y--0",
|
|
2657
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2658
|
+
variation: "ghost",
|
|
2659
|
+
className: "ds-l-col--6 ds-l-sm-col--auto",
|
|
2660
|
+
onClick: ()=>{
|
|
2661
|
+
// reset to default column order and set all cards to visible
|
|
2662
|
+
// do not save this to the table state until the "Save" button is clicked
|
|
2663
|
+
setCards(defaultColumnOrder.map((column)=>{
|
|
2664
|
+
const card = cards.filter((c)=>c.id === column)[0];
|
|
2665
|
+
return {
|
|
2666
|
+
...card,
|
|
2667
|
+
visible: true
|
|
2668
|
+
};
|
|
2669
|
+
}));
|
|
2670
|
+
},
|
|
2671
|
+
children: "Reset Columns"
|
|
2672
|
+
})
|
|
2568
2673
|
})
|
|
2569
2674
|
]
|
|
2570
2675
|
}),
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2676
|
+
children: [
|
|
2677
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2678
|
+
id: "reorder-help",
|
|
2679
|
+
className: "ds-u-padding-x--3",
|
|
2680
|
+
children: "Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder. Press escape to cancel the reordering."
|
|
2681
|
+
}),
|
|
2682
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
|
|
2683
|
+
checked: cardHiddenColumns === 0,
|
|
2684
|
+
type: "checkbox",
|
|
2685
|
+
onChange: ()=>{
|
|
2686
|
+
setCards(cards.map((c)=>{
|
|
2581
2687
|
return {
|
|
2582
|
-
...
|
|
2583
|
-
visible:
|
|
2688
|
+
...c,
|
|
2689
|
+
visible: cardHiddenColumns !== 0
|
|
2584
2690
|
};
|
|
2585
2691
|
}));
|
|
2586
2692
|
},
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
children: [
|
|
2593
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2594
|
-
id: "reorder-help",
|
|
2595
|
-
className: "ds-u-padding-x--3",
|
|
2596
|
-
children: "Activate the reorder button and use the arrow keys to reorder the list or use your mouse to drag/reorder. Press escape to cancel the reordering."
|
|
2597
|
-
}),
|
|
2598
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Choice), {
|
|
2599
|
-
checked: cardHiddenColumns === 0,
|
|
2600
|
-
type: "checkbox",
|
|
2601
|
-
onChange: ()=>{
|
|
2602
|
-
setCards(cards.map((c)=>{
|
|
2603
|
-
return {
|
|
2604
|
-
...c,
|
|
2605
|
-
visible: cardHiddenColumns !== 0
|
|
2606
|
-
};
|
|
2607
|
-
}));
|
|
2608
|
-
},
|
|
2609
|
-
className: "ds-u-padding-x--3",
|
|
2610
|
-
name: "",
|
|
2611
|
-
value: "",
|
|
2612
|
-
label: "Select all",
|
|
2613
|
-
hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
|
|
2614
|
-
}),
|
|
2615
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2616
|
-
className: "ds-u-display--flex ds-u-justify-content--between ds-u-font-weight--bold ds-u-padding-y--2 ds-u-padding-x--3 ds-u-border-y--1 ds-u-margin-top--2",
|
|
2617
|
-
children: [
|
|
2618
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2619
|
-
children: "Display column"
|
|
2693
|
+
className: "ds-u-padding-x--3",
|
|
2694
|
+
name: "",
|
|
2695
|
+
value: "",
|
|
2696
|
+
label: "Select all",
|
|
2697
|
+
hint: cardHiddenColumns && cardHiddenColumns + " columns hidden"
|
|
2620
2698
|
}),
|
|
2621
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2699
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2700
|
+
className: "ds-u-display--flex ds-u-justify-content--between ds-u-font-weight--bold ds-u-padding-y--2 ds-u-padding-x--3 ds-u-border-y--1 ds-u-margin-top--2",
|
|
2701
|
+
children: [
|
|
2702
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2703
|
+
children: "Display column"
|
|
2704
|
+
}),
|
|
2705
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2706
|
+
children: "Reorder"
|
|
2707
|
+
})
|
|
2708
|
+
]
|
|
2709
|
+
}),
|
|
2710
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$DndContext), {
|
|
2711
|
+
collisionDetection: (0, $hgUW1$closestCenter),
|
|
2712
|
+
modifiers: [
|
|
2713
|
+
(0, $hgUW1$restrictToVerticalAxis)
|
|
2714
|
+
],
|
|
2715
|
+
sensors: sensors,
|
|
2716
|
+
onDragEnd: handleDragEnd,
|
|
2717
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$SortableContext), {
|
|
2718
|
+
items: cardOrder,
|
|
2719
|
+
strategy: (0, $hgUW1$verticalListSortingStrategy),
|
|
2720
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
|
|
2721
|
+
className: "dkan-manage-columns-list",
|
|
2722
|
+
children: cards.map((card)=>{
|
|
2723
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $5fe94aeb50e0798b$export$2e2bcd8739ae039), {
|
|
2724
|
+
id: card.id,
|
|
2725
|
+
visible: card.visible,
|
|
2726
|
+
updateVisibility: updateVisibility
|
|
2727
|
+
}, card.id);
|
|
2728
|
+
})
|
|
2729
|
+
})
|
|
2644
2730
|
})
|
|
2645
2731
|
})
|
|
2646
|
-
|
|
2732
|
+
]
|
|
2647
2733
|
})
|
|
2648
|
-
|
|
2649
|
-
|
|
2734
|
+
})
|
|
2735
|
+
]
|
|
2650
2736
|
});
|
|
2651
2737
|
};
|
|
2652
2738
|
var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColumns;
|
|
@@ -2665,139 +2751,111 @@ var $5d9e2ce238d53d29$export$2e2bcd8739ae039 = $5d9e2ce238d53d29$var$ManageColum
|
|
|
2665
2751
|
|
|
2666
2752
|
|
|
2667
2753
|
|
|
2754
|
+
function $a35cf16d1488f54e$export$1147582dfae658c6(columns, schema) {
|
|
2755
|
+
return columns.map((column)=>({
|
|
2756
|
+
header: schema && schema.fields[column].description ? schema.fields[column].description : column,
|
|
2757
|
+
accessor: column
|
|
2758
|
+
}));
|
|
2759
|
+
}
|
|
2760
|
+
const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFullScreenModal: closeFullScreenModal, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
|
|
2761
|
+
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
2762
|
+
const { page: page, setPage: setPage, tableDensity: tableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
2763
|
+
const defaultPageSize = 10;
|
|
2764
|
+
const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
|
|
2765
|
+
const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
|
|
2766
|
+
const { limit: limit, setOffset: setOffset } = resource;
|
|
2767
|
+
const pageSize = limit ? limit : defaultPageSize;
|
|
2768
|
+
const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
|
|
2769
|
+
conditions: resource.conditions
|
|
2770
|
+
}, {
|
|
2771
|
+
encode: true
|
|
2772
|
+
})}&format=csv`;
|
|
2773
|
+
if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
2774
|
+
children: [
|
|
2775
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2776
|
+
className: isModal ? "dkan-datatable-fullscreen-mode" : "",
|
|
2777
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
|
|
2778
|
+
canResize: true,
|
|
2779
|
+
columns: columns,
|
|
2780
|
+
sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
|
|
2781
|
+
tablePadding: tableDensity === "normal" ? "ds-u-padding-y--2" : tableDensity === "compact" ? "ds-u-padding-y--1" : "ds-u-padding-y--3",
|
|
2782
|
+
loading: resource.loading,
|
|
2783
|
+
isModal: isModal,
|
|
2784
|
+
closeFullScreenModal: closeFullScreenModal,
|
|
2785
|
+
downloadURL: downloadURL,
|
|
2786
|
+
unfilteredDownloadURL: distribution.data.downloadURL,
|
|
2787
|
+
setPage: setPage,
|
|
2788
|
+
showCopyLinkButton: showCopyLinkButton,
|
|
2789
|
+
showDownloadFilteredDataButton: showDownloadFilteredDataButton,
|
|
2790
|
+
showDownloadFullDataButton: showDownloadFullDataButton,
|
|
2791
|
+
showStoredQueryDownloadButton: showStoredQueryDownloadButton
|
|
2792
|
+
})
|
|
2793
|
+
}),
|
|
2794
|
+
!resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2795
|
+
className: "ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end ds-u-md-justify-content--between ds-u-margin-top--2 ds-u-align-items--center",
|
|
2796
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
|
|
2797
|
+
totalPages: Math.ceil(resource.count ? resource.count / pageSize : 1),
|
|
2798
|
+
currentPage: Number(page),
|
|
2799
|
+
onPageChange: (evt, page)=>{
|
|
2800
|
+
evt.preventDefault();
|
|
2801
|
+
setOffset((page - 1) * limit);
|
|
2802
|
+
setPage(page);
|
|
2803
|
+
},
|
|
2804
|
+
renderHref: (p)=>`?page=${p}`,
|
|
2805
|
+
className: "ds-l-col--12 ds-u-padding-x--0"
|
|
2806
|
+
})
|
|
2807
|
+
})
|
|
2808
|
+
]
|
|
2809
|
+
});
|
|
2810
|
+
else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
2811
|
+
"aria-valuetext": "Dataset loading",
|
|
2812
|
+
role: "status",
|
|
2813
|
+
className: "ds-u-margin--3"
|
|
2814
|
+
});
|
|
2815
|
+
};
|
|
2816
|
+
var $a35cf16d1488f54e$export$2e2bcd8739ae039 = $a35cf16d1488f54e$var$DatasetTable;
|
|
2668
2817
|
|
|
2669
2818
|
|
|
2670
|
-
const $
|
|
2671
|
-
const
|
|
2672
|
-
|
|
2673
|
-
const rowOptions = [
|
|
2674
|
-
10,
|
|
2675
|
-
25,
|
|
2676
|
-
50,
|
|
2677
|
-
100
|
|
2678
|
-
];
|
|
2819
|
+
const $16bd41951b91f02d$var$FullScreenDataTable = ({ isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
|
|
2820
|
+
const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
|
|
2821
|
+
if (isModal) return null;
|
|
2679
2822
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2680
|
-
className: "
|
|
2823
|
+
className: "dkan-fullscreen-data-table-wrapper",
|
|
2681
2824
|
children: [
|
|
2682
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("
|
|
2683
|
-
|
|
2825
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
|
|
2826
|
+
"aria-label": isModal ? "Close Full Screen dialog" : "Full Screen mode - Opens in a dialog",
|
|
2827
|
+
className: "dkan-filter-dataset-toolbar-button ds-u-color--primary ds-u-text-decoration--underline ds-u-font-size--sm ds-u-padding-x--2 ds-u-margin--0 ds-u-border--0 ds-u-fill--transparent",
|
|
2828
|
+
onClick: ()=>{
|
|
2829
|
+
if (isModal) closeFullScreenModal();
|
|
2830
|
+
else setModalOpen(true);
|
|
2831
|
+
},
|
|
2684
2832
|
children: [
|
|
2685
|
-
|
|
2686
|
-
className: "
|
|
2687
|
-
children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
|
|
2688
|
-
onOpen: ()=>{
|
|
2689
|
-
navigator.clipboard.writeText(window.location.href);
|
|
2690
|
-
},
|
|
2691
|
-
className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
|
|
2692
|
-
placement: "bottom",
|
|
2693
|
-
dialog: true,
|
|
2694
|
-
ariaLabel: "Copy link to filtered data",
|
|
2695
|
-
title: "Link copied to clipboard",
|
|
2696
|
-
"aria-disabled": !conditions || conditions.length === 0,
|
|
2697
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2698
|
-
className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
|
|
2699
|
-
children: [
|
|
2700
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2701
|
-
className: "fas fa-copy"
|
|
2702
|
-
}),
|
|
2703
|
-
" Copy link to filtered data"
|
|
2704
|
-
]
|
|
2705
|
-
})
|
|
2706
|
-
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2707
|
-
"aria-disabled": true,
|
|
2708
|
-
"aria-label": "Copy link to filtered data",
|
|
2709
|
-
className: "ds-c-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12",
|
|
2710
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2711
|
-
className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
|
|
2712
|
-
children: [
|
|
2713
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2714
|
-
className: "fas fa-copy"
|
|
2715
|
-
}),
|
|
2716
|
-
" Copy link to filtered data"
|
|
2717
|
-
]
|
|
2718
|
-
})
|
|
2719
|
-
})
|
|
2833
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2834
|
+
className: `fa ${isModal ? "fa-compress" : "fa-expand"} ds-u-margin-right--1`
|
|
2720
2835
|
}),
|
|
2721
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2722
|
-
className: "ds-
|
|
2723
|
-
children:
|
|
2724
|
-
(showDownloadFilteredDataButton || showStoredQueryDownloadButton) && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2725
|
-
className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
|
|
2726
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2727
|
-
className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
|
|
2728
|
-
href: downloadURL,
|
|
2729
|
-
"aria-disabled": !conditions || conditions.length === 0,
|
|
2730
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2731
|
-
className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
|
|
2732
|
-
children: [
|
|
2733
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2734
|
-
className: "fas fa-file-csv"
|
|
2735
|
-
}),
|
|
2736
|
-
" ",
|
|
2737
|
-
showDownloadFilteredDataButton ? `Download filtered data (CSV)` : `Download stored query data (CSV)`
|
|
2738
|
-
]
|
|
2739
|
-
})
|
|
2740
|
-
})
|
|
2741
|
-
}),
|
|
2742
|
-
showDownloadFullDataButton && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2743
|
-
className: "ds-l-col--12 ds-l-sm-col--auto ds-u-padding-x--0 ds-u-sm-margin-left--2 ds-u-margin-bottom--2",
|
|
2744
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2745
|
-
className: "ds-u-text-align--center ds-u-font-weight--normal ds-u-font-size--base ds-u-margin-right--1 ds-u-display--inline-block ds-l-col--12",
|
|
2746
|
-
href: unfilteredDownloadURL,
|
|
2747
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2748
|
-
className: "ds-u-font-weight--semibold ds-u-margin-left--1 ds-u-padding--0",
|
|
2749
|
-
children: [
|
|
2750
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
2751
|
-
className: "fas fa-file-csv"
|
|
2752
|
-
}),
|
|
2753
|
-
" Download full dataset (CSV)"
|
|
2754
|
-
]
|
|
2755
|
-
})
|
|
2756
|
-
})
|
|
2757
|
-
})
|
|
2758
|
-
]
|
|
2836
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2837
|
+
className: "ds-u-display--none ds-u-lg-display--inline-block",
|
|
2838
|
+
children: isModal ? "Exit Full Screen" : "Full Screen"
|
|
2759
2839
|
})
|
|
2760
2840
|
]
|
|
2761
2841
|
}),
|
|
2762
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2763
|
-
className:
|
|
2764
|
-
children:
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
}),
|
|
2773
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2774
|
-
className: "ds-l-col--12 ds-l-sm-col--4 ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--0",
|
|
2775
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2776
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
2777
|
-
options: rowOptions.map((row)=>({
|
|
2778
|
-
label: row.toString(),
|
|
2779
|
-
value: row
|
|
2780
|
-
})),
|
|
2781
|
-
size: "medium",
|
|
2782
|
-
label: "Rows per page:",
|
|
2783
|
-
labelClassName: "ds-u-margin-top--0",
|
|
2784
|
-
name: "datatable_rows_per_page",
|
|
2785
|
-
onChange: (e)=>{
|
|
2786
|
-
setLimit(parseInt(e.target.value));
|
|
2787
|
-
setPage(1);
|
|
2788
|
-
setOffset(0);
|
|
2789
|
-
},
|
|
2790
|
-
value: limit.toString(),
|
|
2791
|
-
defaultValue: limit.toString()
|
|
2792
|
-
})
|
|
2793
|
-
})
|
|
2842
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
2843
|
+
className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
|
|
2844
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
|
|
2845
|
+
heading: "Dataset Explorer",
|
|
2846
|
+
isOpen: modalOpen,
|
|
2847
|
+
onExit: ()=>setModalOpen(false),
|
|
2848
|
+
className: "dkan-full-screen-dataset-dialog",
|
|
2849
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
|
|
2850
|
+
isModal: true,
|
|
2851
|
+
closeFullScreenModal: ()=>setModalOpen(false)
|
|
2794
2852
|
})
|
|
2795
|
-
|
|
2853
|
+
})
|
|
2796
2854
|
})
|
|
2797
2855
|
]
|
|
2798
2856
|
});
|
|
2799
2857
|
};
|
|
2800
|
-
var $
|
|
2858
|
+
var $16bd41951b91f02d$export$2e2bcd8739ae039 = $16bd41951b91f02d$var$FullScreenDataTable;
|
|
2801
2859
|
|
|
2802
2860
|
|
|
2803
2861
|
|
|
@@ -2809,96 +2867,27 @@ var $6380a4a580b24362$export$2e2bcd8739ae039 = $6380a4a580b24362$var$DataTableHe
|
|
|
2809
2867
|
|
|
2810
2868
|
|
|
2811
2869
|
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
}
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
}
|
|
2834
|
-
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2835
|
-
className: "dc-querybuilder-title",
|
|
2836
|
-
children: [
|
|
2837
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
2838
|
-
className: "ds-u-margin-y--0",
|
|
2839
|
-
children: prependedMessage
|
|
2840
|
-
}),
|
|
2841
|
-
conditions.map((c)=>{
|
|
2842
|
-
const field = fields[c.property];
|
|
2843
|
-
const description = field && field.description ? field.description : c.property;
|
|
2844
|
-
const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
|
|
2845
|
-
const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
|
|
2846
|
-
const formattedText = formatValue(cleanedText, c.property);
|
|
2847
|
-
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
2848
|
-
className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
|
|
2849
|
-
children: [
|
|
2850
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2851
|
-
className: "ds-u-font-weight--bold",
|
|
2852
|
-
children: description
|
|
2853
|
-
}),
|
|
2854
|
-
" ",
|
|
2855
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2856
|
-
className: "ds-u-font-weight--normal",
|
|
2857
|
-
children: operator.label.toUpperCase()
|
|
2858
|
-
}),
|
|
2859
|
-
" ",
|
|
2860
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2861
|
-
className: "ds-u-color--success",
|
|
2862
|
-
children: formattedText
|
|
2863
|
-
})
|
|
2864
|
-
]
|
|
2865
|
-
});
|
|
2866
|
-
}).reduce((prev, curr)=>[
|
|
2867
|
-
prev,
|
|
2868
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
2869
|
-
className: "ds-u-margin-x--1",
|
|
2870
|
-
variation: "info",
|
|
2871
|
-
children: "AND"
|
|
2872
|
-
}),
|
|
2873
|
-
curr
|
|
2874
|
-
])
|
|
2875
|
-
]
|
|
2876
|
-
});
|
|
2877
|
-
};
|
|
2878
|
-
var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
function $6369abf590ca298f$var$getStartDate(condition, schema, id) {
|
|
2889
|
-
if (schema[id].fields[condition.property].mysql_type === "date") {
|
|
2890
|
-
const newDate = new Date(condition.value.toString());
|
|
2891
|
-
if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
|
|
2892
|
-
}
|
|
2893
|
-
return new Date();
|
|
2894
|
-
}
|
|
2895
|
-
const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema })=>{
|
|
2896
|
-
const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
|
|
2897
|
-
const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
|
|
2898
|
-
const [value, setValue] = (0, $hgUW1$useState)(condition.value);
|
|
2899
|
-
const [startDate, setStartDate] = (0, $hgUW1$react).useState($6369abf590ca298f$var$getStartDate(condition, schema, id));
|
|
2900
|
-
const xl = (0, $hgUW1$useMediaQuery)({
|
|
2901
|
-
minWidth: 1280
|
|
2870
|
+
|
|
2871
|
+
|
|
2872
|
+
|
|
2873
|
+
|
|
2874
|
+
|
|
2875
|
+
|
|
2876
|
+
|
|
2877
|
+
function $eadd6431fddf4b6c$var$getStartDate(condition, schema, id) {
|
|
2878
|
+
if (schema[id].fields[condition.property].mysql_type === "date") {
|
|
2879
|
+
const newDate = new Date(condition.value.toString());
|
|
2880
|
+
if (newDate instanceof Date && !isNaN(newDate.getTime())) return newDate;
|
|
2881
|
+
}
|
|
2882
|
+
return new Date();
|
|
2883
|
+
}
|
|
2884
|
+
const $eadd6431fddf4b6c$var$FilterItem = ({ id: id, condition: condition, index: index, update: update, remove: remove, propertyOptions: propertyOptions, schema: schema, className: className = "" })=>{
|
|
2885
|
+
const [operator, setOperator] = (0, $hgUW1$useState)(condition.operator);
|
|
2886
|
+
const [property, setProperty] = (0, $hgUW1$useState)(condition.property);
|
|
2887
|
+
const [value, setValue] = (0, $hgUW1$useState)(condition.value);
|
|
2888
|
+
const [startDate, setStartDate] = (0, $hgUW1$react).useState($eadd6431fddf4b6c$var$getStartDate(condition, schema, id));
|
|
2889
|
+
const xl = (0, $hgUW1$useMediaQuery)({
|
|
2890
|
+
minWidth: 1280
|
|
2902
2891
|
});
|
|
2903
2892
|
(0, $hgUW1$useEffect)(()=>{
|
|
2904
2893
|
if (property !== condition.property) {
|
|
@@ -2933,102 +2922,95 @@ const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: i
|
|
|
2933
2922
|
value
|
|
2934
2923
|
]);
|
|
2935
2924
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)("fieldset", {
|
|
2936
|
-
className:
|
|
2925
|
+
className: `dkan-filter-dataset-control ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--1 ds-u-margin-top--05${className !== "" ? ` ${className}` : ""}`,
|
|
2937
2926
|
children: [
|
|
2938
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
label: "Column Name",
|
|
2946
|
-
name: `${condition.key}_property`,
|
|
2947
|
-
onChange: (e)=>setProperty(e.target.value)
|
|
2948
|
-
}),
|
|
2949
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
2950
|
-
options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
|
|
2951
|
-
className: "ds-l-col--4 ds-u-padding-x--0",
|
|
2952
|
-
value: operator,
|
|
2953
|
-
label: "Operator",
|
|
2954
|
-
name: `${condition.key}_operator`,
|
|
2955
|
-
onChange: (e)=>setOperator(e.target.value)
|
|
2956
|
-
})
|
|
2957
|
-
]
|
|
2927
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
2928
|
+
options: propertyOptions,
|
|
2929
|
+
className: "ds-u-padding-x--0",
|
|
2930
|
+
value: property,
|
|
2931
|
+
label: "Column Name",
|
|
2932
|
+
name: `${condition.key}_property`,
|
|
2933
|
+
onChange: (e)=>setProperty(e.target.value)
|
|
2958
2934
|
}),
|
|
2959
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
2960
|
-
|
|
2935
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
2936
|
+
options: (0, $7264a673914aa746$export$2b9377795161999)(schema[id].fields[property].mysql_type),
|
|
2937
|
+
className: "ds-u-padding-x--0",
|
|
2938
|
+
value: operator,
|
|
2939
|
+
label: "Condition",
|
|
2940
|
+
name: `${condition.key}_operator`,
|
|
2941
|
+
onChange: (e)=>setOperator(e.target.value)
|
|
2942
|
+
}),
|
|
2943
|
+
schema[id].fields[property].mysql_type === "date" ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
2961
2944
|
children: [
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
htmlFor: `${condition.key}_date_value`,
|
|
2967
|
-
id: `${condition.key}_date_value-label`,
|
|
2968
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2969
|
-
children: "Value"
|
|
2970
|
-
})
|
|
2971
|
-
}),
|
|
2972
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
|
|
2973
|
-
name: `${condition.key}_date_value`,
|
|
2974
|
-
selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
|
|
2975
|
-
onChange: (date)=>{
|
|
2976
|
-
setStartDate(date);
|
|
2977
|
-
setValue(date.toJSON().slice(0, 10));
|
|
2978
|
-
},
|
|
2979
|
-
showMonthDropdown: true,
|
|
2980
|
-
showYearDropdown: true,
|
|
2981
|
-
dropdownMode: "select",
|
|
2982
|
-
className: "ds-c-field",
|
|
2983
|
-
withPortal: true
|
|
2984
|
-
})
|
|
2985
|
-
]
|
|
2986
|
-
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
|
|
2987
|
-
className: "ds-l-col--11 ds-u-padding-x--0",
|
|
2988
|
-
label: "Value",
|
|
2989
|
-
name: `${condition.key}_value`,
|
|
2990
|
-
value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
|
|
2991
|
-
onChange: (e)=>setValue(e.target.value)
|
|
2992
|
-
}),
|
|
2993
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2994
|
-
variation: "ghost",
|
|
2995
|
-
size: "small",
|
|
2996
|
-
className: "ds-u-margin-top--6 ds-u-padding-right--0",
|
|
2997
|
-
"aria-label": "Delete filter",
|
|
2998
|
-
onClick: ()=>remove(index),
|
|
2945
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("label", {
|
|
2946
|
+
className: "ds-c-label",
|
|
2947
|
+
htmlFor: `${condition.key}_date_value`,
|
|
2948
|
+
id: `${condition.key}_date_value-label`,
|
|
2999
2949
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
3000
|
-
|
|
2950
|
+
children: "Value"
|
|
3001
2951
|
})
|
|
2952
|
+
}),
|
|
2953
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$reactdatepicker), {
|
|
2954
|
+
name: `${condition.key}_date_value`,
|
|
2955
|
+
selected: (0, $7264a673914aa746$export$e284ae5d89467c8f)(startDate),
|
|
2956
|
+
onChange: (date)=>{
|
|
2957
|
+
setStartDate(date);
|
|
2958
|
+
setValue(date.toJSON().slice(0, 10));
|
|
2959
|
+
},
|
|
2960
|
+
showMonthDropdown: true,
|
|
2961
|
+
showYearDropdown: true,
|
|
2962
|
+
dropdownMode: "select",
|
|
2963
|
+
className: "ds-c-field",
|
|
2964
|
+
withPortal: true
|
|
3002
2965
|
})
|
|
3003
2966
|
]
|
|
2967
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
|
|
2968
|
+
className: "ds-u-padding-x--0",
|
|
2969
|
+
label: "Value",
|
|
2970
|
+
name: `${condition.key}_value`,
|
|
2971
|
+
value: (0, $7264a673914aa746$export$6b5e57d20078142b)(value, operator),
|
|
2972
|
+
onChange: (e)=>setValue(e.target.value),
|
|
2973
|
+
placeholder: "Enter value"
|
|
2974
|
+
}),
|
|
2975
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
2976
|
+
variation: "ghost",
|
|
2977
|
+
size: "small",
|
|
2978
|
+
className: "dkan-delete-dataset-filter-button ds-u-padding-x--0 ds-u-margin-left--05 ds-u-md-margin-top--0 ds-u-border--1 ds-u-border--dark ds-u-color--black",
|
|
2979
|
+
"aria-label": "Delete filter",
|
|
2980
|
+
onClick: ()=>remove(index),
|
|
2981
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
2982
|
+
className: "far fa-trash"
|
|
2983
|
+
})
|
|
3004
2984
|
})
|
|
3005
2985
|
]
|
|
3006
2986
|
});
|
|
3007
2987
|
};
|
|
3008
|
-
var $
|
|
2988
|
+
var $eadd6431fddf4b6c$export$2e2bcd8739ae039 = $eadd6431fddf4b6c$var$FilterItem;
|
|
3009
2989
|
|
|
3010
2990
|
|
|
3011
2991
|
|
|
3012
2992
|
|
|
3013
2993
|
|
|
3014
2994
|
|
|
3015
|
-
|
|
2995
|
+
|
|
2996
|
+
const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn, disableDefaultClasses: disableDefaultClasses = false, className: className = "" })=>{
|
|
3016
2997
|
const small = (0, $hgUW1$useMediaQuery)({
|
|
3017
2998
|
minWidth: 0,
|
|
3018
2999
|
maxWidth: 544
|
|
3019
3000
|
});
|
|
3020
3001
|
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3021
3002
|
disabled: disabled,
|
|
3022
|
-
className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5"
|
|
3003
|
+
className: `dkan-clear-dataset-filters-button ${disableDefaultClasses ? "" : " ds-u-float--right ds-l-md-col--6 ds-l-col--5"}${className !== "" ? ` ${className}` : ""}`,
|
|
3023
3004
|
variation: small ? "ghost" : undefined,
|
|
3024
3005
|
onClick: ()=>clearFiltersFn(),
|
|
3025
|
-
children:
|
|
3006
|
+
children: "Reset"
|
|
3026
3007
|
});
|
|
3027
3008
|
};
|
|
3028
3009
|
var $2eec38d4d0dbf714$export$2e2bcd8739ae039 = $2eec38d4d0dbf714$var$ClearFiltersButton;
|
|
3029
3010
|
|
|
3030
3011
|
|
|
3031
|
-
|
|
3012
|
+
|
|
3013
|
+
function $6f4318b1e14124e5$var$updateQueryForDatastore(condition) {
|
|
3032
3014
|
let cond = condition;
|
|
3033
3015
|
delete cond.key;
|
|
3034
3016
|
if (cond.operator === "=" || cond.operator === "<>") {
|
|
@@ -3046,12 +3028,19 @@ function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
|
|
|
3046
3028
|
if (Array.isArray(cond.value)) cond.value = cond.value.map((v)=>v.trim().replace(/(^\%+|\%+$)/gm, ""));
|
|
3047
3029
|
return cond;
|
|
3048
3030
|
}
|
|
3049
|
-
const $
|
|
3050
|
-
const {
|
|
3031
|
+
const $6f4318b1e14124e5$var$FilterDataset = ()=>{
|
|
3032
|
+
const { distribution: distribution, resource: resource, customColumns: customColumns = [] } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3033
|
+
const { setPage: setPage } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
3034
|
+
if (!resource) return null;
|
|
3035
|
+
const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
|
|
3036
|
+
const id = distribution.identifier;
|
|
3037
|
+
const columns = customColumnHeaders ? customColumnHeaders : (0, $a35cf16d1488f54e$export$1147582dfae658c6)(resource.columns, resource.schema[id]);
|
|
3038
|
+
const { conditions: conditions, schema: schema, setConditions: setConditions, setOffset: setOffset } = resource;
|
|
3051
3039
|
const fields = Object.keys(schema[id].fields);
|
|
3052
3040
|
const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
|
|
3053
|
-
const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]);
|
|
3041
|
+
const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]);
|
|
3054
3042
|
const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);
|
|
3043
|
+
const [modalOpen, setModalOpen] = (0, $hgUW1$useState)(false);
|
|
3055
3044
|
const syncConditions = ()=>{
|
|
3056
3045
|
if (conditions && conditions.length) {
|
|
3057
3046
|
const keyedConditions = conditions.map((oc)=>({
|
|
@@ -3086,7 +3075,7 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, custom
|
|
|
3086
3075
|
]);
|
|
3087
3076
|
};
|
|
3088
3077
|
// Sync the UI with the actual data conditions whenever those change
|
|
3089
|
-
(0, $hgUW1$
|
|
3078
|
+
(0, $hgUW1$useEffect)(()=>{
|
|
3090
3079
|
syncConditions();
|
|
3091
3080
|
setTitleConditions(conditions);
|
|
3092
3081
|
}, [
|
|
@@ -3112,21 +3101,37 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, custom
|
|
|
3112
3101
|
});
|
|
3113
3102
|
window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
|
|
3114
3103
|
};
|
|
3115
|
-
const submitConditions = (
|
|
3104
|
+
const submitConditions = ()=>{
|
|
3116
3105
|
// only update the data conditions when "Apply filters" is pressed
|
|
3117
|
-
e.preventDefault();
|
|
3118
3106
|
const submitConditions = queryConditions.filter((oc)=>{
|
|
3119
3107
|
if (oc.property) return oc;
|
|
3120
3108
|
return false;
|
|
3121
3109
|
}).map((oc)=>{
|
|
3122
3110
|
let cond = Object.assign({}, oc);
|
|
3123
|
-
return $
|
|
3111
|
+
return $6f4318b1e14124e5$var$updateQueryForDatastore(cond);
|
|
3124
3112
|
});
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3113
|
+
const completeConditions = conditionsReadyToSubmit(submitConditions);
|
|
3114
|
+
if (completeConditions.length) {
|
|
3115
|
+
setConditions(completeConditions);
|
|
3116
|
+
setPage(1);
|
|
3117
|
+
setOffset(0);
|
|
3118
|
+
setConditionsChanged(false);
|
|
3119
|
+
updateBrowserURL(completeConditions);
|
|
3120
|
+
setModalOpen(false);
|
|
3121
|
+
}
|
|
3122
|
+
};
|
|
3123
|
+
const conditionsReadyToSubmit = (conditions)=>{
|
|
3124
|
+
const isEmpty = (val)=>{
|
|
3125
|
+
if (typeof val === "string") return val.trim() === "";
|
|
3126
|
+
if (Array.isArray(val)) return val.length === 0;
|
|
3127
|
+
return true;
|
|
3128
|
+
};
|
|
3129
|
+
const completeConditions = conditions.filter((condition)=>{
|
|
3130
|
+
if (condition) {
|
|
3131
|
+
if (!isEmpty(condition.property) && !isEmpty(condition.operator) && !isEmpty(condition.value)) return condition;
|
|
3132
|
+
}
|
|
3133
|
+
});
|
|
3134
|
+
return completeConditions;
|
|
3130
3135
|
};
|
|
3131
3136
|
const updateCondition = (index, key, value)=>{
|
|
3132
3137
|
let newConditions = [
|
|
@@ -3142,258 +3147,451 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = ({ resource: resource, id: id, custom
|
|
|
3142
3147
|
newConditions.splice(index, 1);
|
|
3143
3148
|
setQueryConditions(newConditions);
|
|
3144
3149
|
setConditionsChanged(true);
|
|
3150
|
+
if (newConditions.length === 0) {
|
|
3151
|
+
setConditions([]);
|
|
3152
|
+
updateBrowserURL([]);
|
|
3153
|
+
}
|
|
3145
3154
|
};
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3155
|
+
const disableFilterSubmitButton = ()=>{
|
|
3156
|
+
return !conditionsChanged || queryConditions.length === 0 || conditionsReadyToSubmit(queryConditions).length === 0;
|
|
3157
|
+
};
|
|
3158
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
3159
|
+
children: Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3160
|
+
className: "dkan-filter-dataset-wrapper",
|
|
3161
|
+
children: [
|
|
3162
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
|
|
3163
|
+
"aria-label": "Filter dataset - Opens in a dialog",
|
|
3164
|
+
className: "dkan-filter-dataset-toolbar-button ds-u-color--primary ds-u-text-decoration--underline ds-u-font-size--sm ds-u-padding-x--2 ds-u-margin--0 ds-u-border--0 ds-u-fill--transparent",
|
|
3165
|
+
onClick: ()=>{
|
|
3166
|
+
setModalOpen(true);
|
|
3167
|
+
},
|
|
3159
3168
|
children: [
|
|
3160
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("
|
|
3161
|
-
|
|
3162
|
-
id: id,
|
|
3163
|
-
schema: schema,
|
|
3164
|
-
condition: qf,
|
|
3165
|
-
index: index,
|
|
3166
|
-
propertyOptions: propertyOptions,
|
|
3167
|
-
update: updateCondition,
|
|
3168
|
-
remove: removeCondition
|
|
3169
|
-
}, qf.key))
|
|
3169
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3170
|
+
className: "fa fa-filter ds-u-margin-right--1"
|
|
3170
3171
|
}),
|
|
3171
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("
|
|
3172
|
-
className: "dc-query-bulder--form-buttons ds-u-padding-x--2 ds-u-padding-top--0 ds-u-md-padding-top--2 ds-u-display--flex ds-u-flex-wrap--wrap",
|
|
3172
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3173
3173
|
children: [
|
|
3174
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)("
|
|
3175
|
-
className: "ds-
|
|
3176
|
-
children:
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3174
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
3175
|
+
className: "ds-u-display--none ds-u-lg-display--inline-block",
|
|
3176
|
+
children: conditions.length > 0 ? `Edit Filters` : "Filter Dataset"
|
|
3177
|
+
}),
|
|
3178
|
+
conditions.length > 0 && ` (${conditions.length})`
|
|
3179
|
+
]
|
|
3180
|
+
})
|
|
3181
|
+
]
|
|
3182
|
+
}),
|
|
3183
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3184
|
+
className: `ds-c-dialog-wrap${modalOpen ? " open" : ""}`,
|
|
3185
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dialog), {
|
|
3186
|
+
heading: "Filter Dataset",
|
|
3187
|
+
isOpen: modalOpen,
|
|
3188
|
+
onExit: ()=>setModalOpen(false),
|
|
3189
|
+
className: "dkan-filter-dataset-dialog",
|
|
3190
|
+
ariaCloseLabel: "Close filter dataset dialog",
|
|
3191
|
+
actions: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3192
|
+
className: "ds-u-display--flex ds-u-justify-content--end ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--2",
|
|
3193
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3194
|
+
className: "ds-u-display--flex ",
|
|
3195
|
+
children: [
|
|
3196
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
|
|
3197
|
+
disabled: queryConditions.length === 0,
|
|
3198
|
+
clearFiltersFn: ()=>{
|
|
3199
|
+
setConditions([]);
|
|
3200
|
+
updateBrowserURL([]);
|
|
3201
|
+
},
|
|
3202
|
+
disableDefaultClasses: true,
|
|
3203
|
+
className: "ds-l-md-col--auto ds-l-col--auto ds-u-margin--right--0 ds-u-sm-margin-right--2"
|
|
3204
|
+
}),
|
|
3205
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3206
|
+
disabled: disableFilterSubmitButton(),
|
|
3207
|
+
className: "dkan-apply-dataset-filters-button ds-u-float--right ds-l-md-col--auto ds-l-col--auto",
|
|
3208
|
+
onClick: submitConditions,
|
|
3209
|
+
variation: "solid",
|
|
3210
|
+
children: `Apply ${conditionsReadyToSubmit(queryConditions).length || ""} filter${conditionsReadyToSubmit(queryConditions).length === 1 ? "" : "s"}`
|
|
3181
3211
|
})
|
|
3212
|
+
]
|
|
3213
|
+
})
|
|
3214
|
+
}),
|
|
3215
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3216
|
+
children: [
|
|
3217
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
3218
|
+
className: "ds-u-margin--0 ds-u-margin-top--1 ds-u-margin-bottom--2 ds-u-padding-x--2 ds-u-md-padding-x--3",
|
|
3219
|
+
children: "Add filters to only display data that meets your criteria. Filtered results can be downloaded."
|
|
3182
3220
|
}),
|
|
3183
3221
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3184
|
-
className: "ds-u-
|
|
3222
|
+
className: "dkan-filter-dataset-controls-header ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--1 ds-u-margin-top--05 ds-u-fill--gray-lightest",
|
|
3185
3223
|
children: [
|
|
3186
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)(
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
type: "submit",
|
|
3190
|
-
variation: "solid",
|
|
3191
|
-
children: "Apply filters"
|
|
3224
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
|
|
3225
|
+
className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
|
|
3226
|
+
children: "Column Name"
|
|
3192
3227
|
}),
|
|
3193
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)(
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3228
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
|
|
3229
|
+
className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
|
|
3230
|
+
children: "Condition"
|
|
3231
|
+
}),
|
|
3232
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h3", {
|
|
3233
|
+
className: "ds-u-margin--0 ds-u-font-weight--bold ds-u-padding--0",
|
|
3234
|
+
children: "Value"
|
|
3235
|
+
}),
|
|
3236
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3237
|
+
className: "dkan-filter-dataset-controls-header-gutter"
|
|
3199
3238
|
})
|
|
3200
3239
|
]
|
|
3240
|
+
}),
|
|
3241
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3242
|
+
className: "dkan-filter-dataset-form-container ds-u-display--flex ds-u-flex-direction--column ds-u-border-bottom--1",
|
|
3243
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3244
|
+
className: "ds-u-padding-bottom--05",
|
|
3245
|
+
children: [
|
|
3246
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3247
|
+
className: "dkan-filter-dataset-controls",
|
|
3248
|
+
children: queryConditions.map((qf, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $eadd6431fddf4b6c$export$2e2bcd8739ae039), {
|
|
3249
|
+
id: id,
|
|
3250
|
+
schema: schema,
|
|
3251
|
+
condition: qf,
|
|
3252
|
+
index: index,
|
|
3253
|
+
propertyOptions: propertyOptions,
|
|
3254
|
+
update: updateCondition,
|
|
3255
|
+
remove: removeCondition,
|
|
3256
|
+
className: index !== 0 ? "ds-u-border-top--1" : "ds-u-border--0"
|
|
3257
|
+
}, qf.key))
|
|
3258
|
+
}),
|
|
3259
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3260
|
+
className: "ds-u-padding-x--2 ds-u-md-padding-x--3 ds-u-padding-y--1 ds-u-border-top--1 ds-u-margin-top--05",
|
|
3261
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3262
|
+
onClick: ()=>addCondition(null),
|
|
3263
|
+
className: "dkan-add-dataset-filter-button ds-l-col--12 ds-u-radius--pill ds-u-margin-top--05 ds-u-font-weight--normal",
|
|
3264
|
+
children: "+ Add filter"
|
|
3265
|
+
})
|
|
3266
|
+
})
|
|
3267
|
+
]
|
|
3268
|
+
})
|
|
3201
3269
|
})
|
|
3202
3270
|
]
|
|
3203
3271
|
})
|
|
3204
|
-
|
|
3272
|
+
})
|
|
3205
3273
|
})
|
|
3206
|
-
|
|
3207
|
-
})
|
|
3274
|
+
]
|
|
3275
|
+
}) : null
|
|
3208
3276
|
});
|
|
3209
3277
|
};
|
|
3210
|
-
var $
|
|
3211
|
-
|
|
3278
|
+
var $6f4318b1e14124e5$export$2e2bcd8739ae039 = $6f4318b1e14124e5$var$FilterDataset;
|
|
3212
3279
|
|
|
3213
3280
|
|
|
3214
|
-
const $43a30d745a7bbc86$var$DataTableContext = /*#__PURE__*/ (0, $hgUW1$createContext)({
|
|
3215
|
-
id: null
|
|
3216
|
-
});
|
|
3217
|
-
var $43a30d745a7bbc86$export$2e2bcd8739ae039 = $43a30d745a7bbc86$var$DataTableContext;
|
|
3218
3281
|
|
|
3219
3282
|
|
|
3220
3283
|
|
|
3221
|
-
|
|
3222
|
-
return
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
}));
|
|
3226
|
-
}
|
|
3227
|
-
const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFullScreenModal: closeFullScreenModal, showQueryBuilder: showQueryBuilder = true, showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
|
|
3228
|
-
const { id: id, distribution: distribution, resource: resource, rootUrl: rootUrl, customColumns: customColumns = [], dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3229
|
-
const { page: page, setPage: setPage } = (0, $hgUW1$useContext)((0, $ebda441784d176a5$export$2e2bcd8739ae039));
|
|
3230
|
-
const defaultPageSize = 10;
|
|
3231
|
-
const customColumnHeaders = (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution.identifier]);
|
|
3232
|
-
const columns = customColumnHeaders ? customColumnHeaders : $a35cf16d1488f54e$export$1147582dfae658c6(resource.columns, resource.schema[id]);
|
|
3233
|
-
const { limit: limit, setOffset: setOffset } = resource;
|
|
3234
|
-
const pageSize = limit ? limit : defaultPageSize;
|
|
3235
|
-
const downloadURL = `${rootUrl}/datastore/query/${id}/0/download?${(0, $hgUW1$qs).stringify({
|
|
3236
|
-
conditions: resource.conditions
|
|
3237
|
-
}, {
|
|
3238
|
-
encode: true
|
|
3239
|
-
})}&format=csv`;
|
|
3240
|
-
if (Object.keys(resource).length && columns.length && resource.schema && Object.keys(distribution).length) return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
3284
|
+
const $c5b172e8d1a8197c$var$FliterChip = ({ iconClass: iconClass, text: text, onClick: onClick })=>{
|
|
3285
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("button", {
|
|
3286
|
+
className: "dkan-filter-chip ds-u-display--flex ds-u-font-size--sm ds-u-align-items--center ds-u-padding-x--1 ds-u-padding-y--05 ds-u-margin--0 ds-u-margin-right--1 ds-u-margin-bottom--1",
|
|
3287
|
+
onClick: onClick,
|
|
3241
3288
|
children: [
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
id: distribution.identifier,
|
|
3245
|
-
customColumns: customColumnHeaders,
|
|
3246
|
-
isModal: isModal,
|
|
3247
|
-
setPage: setPage,
|
|
3248
|
-
setOffset: setOffset
|
|
3249
|
-
}),
|
|
3250
|
-
dataDictionaryBanner && !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3251
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
3252
|
-
children: 'Click on the "Data Dictionary" tab above for full column definitions'
|
|
3253
|
-
})
|
|
3254
|
-
}),
|
|
3255
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6380a4a580b24362$export$2e2bcd8739ae039), {
|
|
3256
|
-
resource: resource,
|
|
3257
|
-
downloadURL: downloadURL,
|
|
3258
|
-
unfilteredDownloadURL: distribution.data.downloadURL,
|
|
3259
|
-
setPage: setPage,
|
|
3260
|
-
showCopyLinkButton: showCopyLinkButton,
|
|
3261
|
-
showDownloadFilteredDataButton: showDownloadFilteredDataButton,
|
|
3262
|
-
showDownloadFullDataButton: showDownloadFullDataButton,
|
|
3263
|
-
showStoredQueryDownloadButton: showStoredQueryDownloadButton
|
|
3289
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3290
|
+
className: `${iconClass} ds-u-color--primary ds-u-margin-right--1`
|
|
3264
3291
|
}),
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3292
|
+
text,
|
|
3293
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3294
|
+
className: "fa fa-xmark ds-u-font-size--sm ds-u-margin-left--1"
|
|
3295
|
+
})
|
|
3296
|
+
]
|
|
3297
|
+
});
|
|
3298
|
+
};
|
|
3299
|
+
var $c5b172e8d1a8197c$export$2e2bcd8739ae039 = $c5b172e8d1a8197c$var$FliterChip;
|
|
3300
|
+
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
|
|
3307
|
+
|
|
3308
|
+
const $dae856e97a09bcd6$var$DisplaySettings = ()=>{
|
|
3309
|
+
const { resource: resource } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3310
|
+
const { setPage: setPage, tableDensity: tableDensity, setTableDensity: setTableDensity } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
3311
|
+
const rowOptions = [
|
|
3312
|
+
10,
|
|
3313
|
+
25,
|
|
3314
|
+
50,
|
|
3315
|
+
100
|
|
3316
|
+
];
|
|
3317
|
+
if (!resource) return null;
|
|
3318
|
+
const { limit: limit, setLimit: setLimit, setOffset: setOffset } = resource;
|
|
3319
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3320
|
+
className: "dkan-display-settings-wrapper",
|
|
3321
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
|
|
3322
|
+
className: "dkan-filter-dataset-toolbar-button ds-u-display--flex ds-u-align-items--center ds-u-color--primary ds-u-border--0 ds-u-padding--0 ds-u-padding-x--2 ds-u-margin--0 ds-u-fill--transparent ds-u-font-size--sm",
|
|
3323
|
+
activeClassName: "dkan-data-table-display-settings-tooltip-open",
|
|
3324
|
+
dialog: true,
|
|
3325
|
+
offset: [
|
|
3326
|
+
0,
|
|
3327
|
+
5
|
|
3328
|
+
],
|
|
3329
|
+
placement: "bottom-start",
|
|
3330
|
+
maxWidth: "350px",
|
|
3331
|
+
"aria-label": "Display Settings",
|
|
3332
|
+
title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3333
|
+
className: "ds-u-display--flex ds-u-flex-direction--column",
|
|
3334
|
+
children: [
|
|
3335
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3336
|
+
className: "dkan-data-table-display-settings-row ds-u-padding-bottom--1",
|
|
3337
|
+
children: [
|
|
3338
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3339
|
+
className: "",
|
|
3340
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
3341
|
+
className: "ds-u-font-size--md ds-u-font-weight--normal",
|
|
3342
|
+
children: "Row height"
|
|
3343
|
+
})
|
|
3344
|
+
}),
|
|
3345
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3346
|
+
className: "ds-u-display--flex ds-u-align-items--start",
|
|
3347
|
+
children: [
|
|
3348
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
3349
|
+
onClick: ()=>setTableDensity("expanded"),
|
|
3350
|
+
"aria-label": "Row height, Expanded",
|
|
3351
|
+
className: `dkan-table-density-button ds-u-leading--reset ds-u-padding--1 ds-u-margin--0 ${tableDensity === "expanded" ? "active ds-u-fill--primary-lightest" : ""}`,
|
|
3352
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3353
|
+
className: "ds-u-display--block",
|
|
3354
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
|
|
3355
|
+
className: "ds-u-display--block",
|
|
3356
|
+
viewBox: "0 0 512 512",
|
|
3357
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3358
|
+
"aria-hidden": "true",
|
|
3359
|
+
focusable: "false",
|
|
3360
|
+
height: "16",
|
|
3361
|
+
role: "img",
|
|
3362
|
+
width: "16",
|
|
3363
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
3364
|
+
d: "M496,384 C504.836556,384 512,391.163444 512,400 L512,496 C512,504.836556 504.836556,512 496,512 L16,512 C7.163444,512 1.082166e-15,504.836556 0,496 L0,400 C-1.082166e-15,391.163444 7.163444,384 16,384 L496,384 Z M496,192 C504.836556,192 512,199.163444 512,208 L512,304 C512,312.836556 504.836556,320 496,320 L16,320 C7.163444,320 1.082166e-15,312.836556 0,304 L0,208 C-1.082166e-15,199.163444 7.163444,192 16,192 L496,192 Z M496,0 C504.836556,-1.623249e-15 512,7.163444 512,16 L512,112 C512,120.836556 504.836556,128 496,128 L16,128 C7.163444,128 1.082166e-15,120.836556 0,112 L0,16 C-1.082166e-15,7.163444 7.163444,1.623249e-15 16,0 L496,0 Z"
|
|
3365
|
+
})
|
|
3366
|
+
})
|
|
3367
|
+
})
|
|
3368
|
+
}),
|
|
3369
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
3370
|
+
onClick: ()=>setTableDensity("normal"),
|
|
3371
|
+
"aria-label": "Row height, Normal",
|
|
3372
|
+
className: `dkan-table-density-button ds-u-leading--reset ds-u-padding--1 ds-u-margin--0 ${tableDensity === "normal" ? "active ds-u-fill--primary-lightest" : ""}`,
|
|
3373
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3374
|
+
className: "ds-u-display--block",
|
|
3375
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
|
|
3376
|
+
className: "ds-u-display--block",
|
|
3377
|
+
viewBox: "0 0 512 512",
|
|
3378
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3379
|
+
"aria-hidden": "true",
|
|
3380
|
+
focusable: "false",
|
|
3381
|
+
height: "16",
|
|
3382
|
+
role: "img",
|
|
3383
|
+
width: "16",
|
|
3384
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
3385
|
+
d: "M496,416 C504.836556,416 512,423.163444 512,432 L512,496 C512,504.836556 504.836556,512 496,512 L16,512 C7.163444,512 1.082166e-15,504.836556 0,496 L0,432 C-1.082166e-15,423.163444 7.163444,416 16,416 L496,416 Z M496,277 C504.836556,277 512,284.163444 512,293 L512,357 C512,365.836556 504.836556,373 496,373 L16,373 C7.163444,373 1.082166e-15,365.836556 0,357 L0,293 C-1.082166e-15,284.163444 7.163444,277 16,277 L496,277 Z M496,139 C504.836556,139 512,146.163444 512,155 L512,219 C512,227.836556 504.836556,235 496,235 L16,235 C7.163444,235 1.082166e-15,227.836556 0,219 L0,155 C-1.082166e-15,146.163444 7.163444,139 16,139 L496,139 Z M496,0 C504.836556,-1.623249e-15 512,7.163444 512,16 L512,80 C512,88.836556 504.836556,96 496,96 L16,96 C7.163444,96 1.082166e-15,88.836556 0,80 L0,16 C-1.082166e-15,7.163444 7.163444,1.623249e-15 16,0 L496,0 Z"
|
|
3386
|
+
})
|
|
3387
|
+
})
|
|
3388
|
+
})
|
|
3389
|
+
}),
|
|
3390
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
3391
|
+
onClick: ()=>setTableDensity("compact"),
|
|
3392
|
+
"aria-label": "Row height, Compact",
|
|
3393
|
+
className: `dkan-table-density-button ds-u-leading--reset ds-u-padding--1 ds-u-margin--0 ${tableDensity === "compact" ? "active ds-u-fill--primary-lightest " : ""}`,
|
|
3394
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3395
|
+
className: "ds-u-display--block",
|
|
3396
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("svg", {
|
|
3397
|
+
className: "ds-u-display--block",
|
|
3398
|
+
viewBox: "0 0 512 512",
|
|
3399
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3400
|
+
"aria-hidden": "true",
|
|
3401
|
+
focusable: "false",
|
|
3402
|
+
height: "16",
|
|
3403
|
+
role: "img",
|
|
3404
|
+
width: "16",
|
|
3405
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("path", {
|
|
3406
|
+
d: "M496,448 C504.836556,448 512,455.163444 512,464 L512,496 C512,504.836556 504.836556,512 496,512 L16,512 C7.163444,512 1.082166e-15,504.836556 0,496 L0,464 C-1.082166e-15,455.163444 7.163444,448 16,448 L496,448 Z M496,336 C504.836556,336 512,343.163444 512,352 L512,384 C512,392.836556 504.836556,400 496,400 L16,400 C7.163444,400 1.082166e-15,392.836556 0,384 L0,352 C-1.082166e-15,343.163444 7.163444,336 16,336 L496,336 Z M496,224 C504.836556,224 512,231.163444 512,240 L512,272 C512,280.836556 504.836556,288 496,288 L16,288 C7.163444,288 1.082166e-15,280.836556 0,272 L0,240 C-1.082166e-15,231.163444 7.163444,224 16,224 L496,224 Z M496,112 C504.836556,112 512,119.163444 512,128 L512,160 C512,168.836556 504.836556,176 496,176 L16,176 C7.163444,176 1.082166e-15,168.836556 0,160 L0,128 C-1.082166e-15,119.163444 7.163444,112 16,112 L496,112 Z M496,0 C504.836556,-1.623249e-15 512,7.163444 512,16 L512,48 C512,56.836556 504.836556,64 496,64 L16,64 C7.163444,64 1.082166e-15,56.836556 0,48 L0,16 C-1.082166e-15,7.163444 7.163444,1.623249e-15 16,0 L496,0 Z"
|
|
3407
|
+
})
|
|
3408
|
+
})
|
|
3409
|
+
})
|
|
3410
|
+
})
|
|
3411
|
+
]
|
|
3412
|
+
})
|
|
3413
|
+
]
|
|
3414
|
+
}),
|
|
3415
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3416
|
+
className: "dkan-data-table-display-settings-row ds-u-border-top--1 ds-u-padding-top--1",
|
|
3417
|
+
children: [
|
|
3418
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3419
|
+
className: "",
|
|
3420
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
3421
|
+
className: "ds-u-font-size--md ds-u-font-weight--normal",
|
|
3422
|
+
children: "Rows per page"
|
|
3423
|
+
})
|
|
3424
|
+
}),
|
|
3425
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
|
|
3426
|
+
className: "",
|
|
3427
|
+
options: rowOptions.map((row)=>({
|
|
3428
|
+
label: row.toString(),
|
|
3429
|
+
value: row
|
|
3430
|
+
})),
|
|
3431
|
+
size: "medium",
|
|
3432
|
+
label: "Rows per page:",
|
|
3433
|
+
labelClassName: "ds-u-margin-top--0 ds-u-font-size--md ds-u-font-weight--normal",
|
|
3434
|
+
name: "datatable_rows_per_page",
|
|
3435
|
+
onChange: (e)=>{
|
|
3436
|
+
setLimit(parseInt(e.target.value));
|
|
3437
|
+
setPage(1);
|
|
3438
|
+
setOffset(0);
|
|
3439
|
+
},
|
|
3440
|
+
value: limit.toString(),
|
|
3441
|
+
defaultValue: limit.toString()
|
|
3442
|
+
})
|
|
3443
|
+
]
|
|
3444
|
+
})
|
|
3445
|
+
]
|
|
3276
3446
|
}),
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3447
|
+
children: [
|
|
3448
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3449
|
+
className: "far fa-sliders-h ds-u-margin-right--1"
|
|
3450
|
+
}),
|
|
3451
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
3452
|
+
className: "ds-u-display--none ds-u-lg-display--inline-block",
|
|
3453
|
+
children: "Display Settings"
|
|
3454
|
+
}),
|
|
3455
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3456
|
+
className: "fa fa-chevron-down ds-u-margin-left--1 ds-u-font-weight--bold"
|
|
3457
|
+
}),
|
|
3458
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3459
|
+
className: "fa fa-chevron-up ds-u-margin-left--1 ds-u-font-weight--bold"
|
|
3289
3460
|
})
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
});
|
|
3293
|
-
else return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
|
|
3294
|
-
"aria-valuetext": "Dataset loading",
|
|
3295
|
-
role: "status",
|
|
3296
|
-
className: "ds-u-margin--3"
|
|
3461
|
+
]
|
|
3462
|
+
})
|
|
3297
3463
|
});
|
|
3298
3464
|
};
|
|
3299
|
-
var $
|
|
3465
|
+
var $dae856e97a09bcd6$export$2e2bcd8739ae039 = $dae856e97a09bcd6$var$DisplaySettings;
|
|
3300
3466
|
|
|
3301
3467
|
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
|
|
3311
|
-
isModal: true,
|
|
3312
|
-
closeFullScreenModal: ()=>setModalOpen(false)
|
|
3313
|
-
})
|
|
3314
|
-
})
|
|
3468
|
+
|
|
3469
|
+
const $85f8ff1ff89899c7$var$updateBrowserURL = (newConditions)=>{
|
|
3470
|
+
const url = new URL(window.location.href);
|
|
3471
|
+
const urlString = (0, $hgUW1$qs).stringify({
|
|
3472
|
+
conditions: newConditions
|
|
3473
|
+
}, {
|
|
3474
|
+
encodeValuesOnly: true,
|
|
3475
|
+
addQueryPrefix: true
|
|
3315
3476
|
});
|
|
3477
|
+
window.history.pushState({}, "", `${url.origin}${url.pathname}${urlString}`);
|
|
3316
3478
|
};
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
const
|
|
3321
|
-
const
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3479
|
+
const $85f8ff1ff89899c7$var$DataTableToolbar = ({ resource: resource, id: id, columns: columns, defaultColumnOrder: defaultColumnOrder, isModal: isModal, closeFullScreenModal: closeFullScreenModal, datasetTableControls: datasetTableControls, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility })=>{
|
|
3480
|
+
const { limit: limit, offset: offset, count: count, conditions: conditions, setConditions: setConditions } = resource;
|
|
3481
|
+
const intCount = count ? count : 0;
|
|
3482
|
+
const hiddenColumns = Object.keys(columnVisibility).filter((key)=>columnVisibility[key] === false).length;
|
|
3483
|
+
const resetColumnVisibility = ()=>{
|
|
3484
|
+
const columns = {
|
|
3485
|
+
...columnVisibility
|
|
3486
|
+
};
|
|
3487
|
+
for(let key in columns)if (columns[key] === false) columns[key] = true;
|
|
3488
|
+
setColumnVisibility(columns);
|
|
3489
|
+
// save to localStorage
|
|
3490
|
+
const currentLocalStorage = JSON.parse(localStorage.getItem(id));
|
|
3491
|
+
const updatedLocalStorageData = {
|
|
3492
|
+
...currentLocalStorage,
|
|
3493
|
+
tableColumnVisibility: columns
|
|
3494
|
+
};
|
|
3495
|
+
localStorage.setItem(id, JSON.stringify(updatedLocalStorageData));
|
|
3496
|
+
};
|
|
3497
|
+
const removeCondition = (index)=>{
|
|
3498
|
+
// just removes the condition from the UI - "Apply Filters" must be clicked to change the data model
|
|
3499
|
+
let updatedConditions = JSON.parse(JSON.stringify(conditions));
|
|
3500
|
+
updatedConditions.splice(index, 1);
|
|
3501
|
+
setConditions(updatedConditions);
|
|
3502
|
+
$85f8ff1ff89899c7$var$updateBrowserURL(updatedConditions);
|
|
3503
|
+
};
|
|
3504
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3505
|
+
className: "ds-u-margin-top--2",
|
|
3325
3506
|
children: [
|
|
3326
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
3327
|
-
className: "
|
|
3328
|
-
children:
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3507
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3508
|
+
className: "dkan-filter-dataset-toolbar ds-u-fill--white ds-u-border--1",
|
|
3509
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3510
|
+
className: "ds-l-col--12 ds-u-display--flex ds-u-justify-content--between ds-u-align-items--center ds-u-flex-wrap--wrap ds-u-padding-x--0 ds-u-padding-y--2",
|
|
3511
|
+
children: [
|
|
3512
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3513
|
+
className: "ds-u-padding-x--2",
|
|
3514
|
+
children: !resource.loading && resource.count !== null && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2ed0091f7e32d1e6$export$2e2bcd8739ae039), {
|
|
3515
|
+
totalRows: intCount,
|
|
3516
|
+
limit: limit,
|
|
3517
|
+
offset: offset,
|
|
3518
|
+
className: "data-table-results ds-u-margin--0 ds-u-font-size--sm ds-u-padding-y--0 ds-u-md-padding-y--1 ds-u-padding-bottom--2 ds-u-md-padding-bottom--0"
|
|
3519
|
+
})
|
|
3520
|
+
}),
|
|
3521
|
+
datasetTableControls && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3522
|
+
className: "dkan-data-table-toolbar-controls ds-u-display--flex ds-u-flex-wrap--wrap ds-u-align-items--center ds-l-md-col--auto ds-l-col--12 ds-u-padding-x--2 ds-u-padding-top--2 ds-u-md-padding-top--0",
|
|
3332
3523
|
children: [
|
|
3333
|
-
|
|
3334
|
-
|
|
3524
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $6f4318b1e14124e5$export$2e2bcd8739ae039), {}),
|
|
3525
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
|
|
3526
|
+
id: id,
|
|
3527
|
+
columns: columns,
|
|
3528
|
+
defaultColumnOrder: defaultColumnOrder
|
|
3529
|
+
}),
|
|
3530
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $dae856e97a09bcd6$export$2e2bcd8739ae039), {}),
|
|
3531
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $16bd41951b91f02d$export$2e2bcd8739ae039), {
|
|
3532
|
+
isModal: isModal,
|
|
3533
|
+
closeFullScreenModal: closeFullScreenModal
|
|
3534
|
+
})
|
|
3335
3535
|
]
|
|
3336
3536
|
})
|
|
3537
|
+
]
|
|
3538
|
+
})
|
|
3539
|
+
}),
|
|
3540
|
+
(conditions.length > 0 || hiddenColumns > 0) && /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3541
|
+
className: "ds-u-fill--white ds-u-padding-x--0 ds-u-md-padding-x--2 ds-u-padding-top--2",
|
|
3542
|
+
children: [
|
|
3543
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("h2", {
|
|
3544
|
+
className: "ds-u-margin--0 ds-u-margin-bottom--2 ds-u-font-size--lg ds-u-font-weight--bold",
|
|
3545
|
+
children: "Selected filters"
|
|
3337
3546
|
}),
|
|
3338
3547
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3548
|
+
className: "ds-u-display--flex ds-u-justify-content--between ds-u-md-align-items--end ds-u-flex-direction--column ds-u-md-flex-direction--row",
|
|
3339
3549
|
children: [
|
|
3340
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("
|
|
3341
|
-
|
|
3342
|
-
className: "ds-c-button ds-c-button--ghost ds-u-margin-y--1",
|
|
3343
|
-
onClick: ()=>{
|
|
3344
|
-
setManageColumnsModalOpen(true);
|
|
3345
|
-
},
|
|
3550
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3551
|
+
className: "ds-u-display--flex ds-u-padding-right--0 ds-u-md-padding-right--4 ds-u-flex-wrap--wrap",
|
|
3346
3552
|
children: [
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3553
|
+
conditions.length > 0 ? conditions.map((condition, index)=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $c5b172e8d1a8197c$export$2e2bcd8739ae039), {
|
|
3554
|
+
iconClass: "far fa-filter",
|
|
3555
|
+
text: `"${condition.property}" ${condition.operator} ${condition.value}`,
|
|
3556
|
+
onClick: ()=>{
|
|
3557
|
+
removeCondition(index);
|
|
3558
|
+
}
|
|
3559
|
+
}, index)) : null,
|
|
3560
|
+
hiddenColumns > 0 ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $c5b172e8d1a8197c$export$2e2bcd8739ae039), {
|
|
3561
|
+
iconClass: "fa fa-columns",
|
|
3562
|
+
text: `${hiddenColumns} Column${hiddenColumns === 1 ? "" : "s"} Hidden`,
|
|
3563
|
+
onClick: ()=>{
|
|
3564
|
+
resetColumnVisibility();
|
|
3565
|
+
}
|
|
3566
|
+
}) : null
|
|
3351
3567
|
]
|
|
3352
3568
|
}),
|
|
3353
|
-
/*#__PURE__*/ (0, $hgUW1$
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
isModal ? "Exit Full Screen" : "Full Screen"
|
|
3365
|
-
]
|
|
3569
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3570
|
+
className: "ds-l-col--auto ds-u-padding--0 ds-u-display--flex ds-u-justify-content--end",
|
|
3571
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
|
|
3572
|
+
className: "dkan-clear-all-filters-button ds-u-color--primary ds-u-font-size--md ds-u-font-weight--bold ds-u-border--0 ds-u-padding--0 ds-u-margin--0 ds-u-fill--transparent ds-u-text-decoration--underline ds-u-margin-bottom--1",
|
|
3573
|
+
onClick: ()=>{
|
|
3574
|
+
setConditions([]);
|
|
3575
|
+
$85f8ff1ff89899c7$var$updateBrowserURL([]);
|
|
3576
|
+
resetColumnVisibility();
|
|
3577
|
+
},
|
|
3578
|
+
children: "Clear all filters"
|
|
3579
|
+
})
|
|
3366
3580
|
})
|
|
3367
3581
|
]
|
|
3368
3582
|
})
|
|
3369
3583
|
]
|
|
3370
|
-
}),
|
|
3371
|
-
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3372
|
-
children: [
|
|
3373
|
-
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $5d9e2ce238d53d29$export$2e2bcd8739ae039), {
|
|
3374
|
-
id: id,
|
|
3375
|
-
columns: columns,
|
|
3376
|
-
defaultColumnOrder: defaultColumnOrder,
|
|
3377
|
-
modalOpen: manageColumnsModalOpen,
|
|
3378
|
-
setModalOpen: setManageColumnsModalOpen
|
|
3379
|
-
}),
|
|
3380
|
-
!isModal && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $16bd41951b91f02d$export$2e2bcd8739ae039), {
|
|
3381
|
-
modalOpen: fullScreenModalOpen,
|
|
3382
|
-
setModalOpen: setFullScreenModalOpen
|
|
3383
|
-
})
|
|
3384
|
-
]
|
|
3385
3584
|
})
|
|
3386
3585
|
]
|
|
3387
3586
|
});
|
|
3388
3587
|
};
|
|
3389
|
-
var $
|
|
3390
|
-
|
|
3391
|
-
|
|
3588
|
+
var $85f8ff1ff89899c7$export$2e2bcd8739ae039 = $85f8ff1ff89899c7$var$DataTableToolbar;
|
|
3392
3589
|
|
|
3393
3590
|
|
|
3394
|
-
const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
|
|
3395
|
-
const { id: id, resource: resource, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3396
|
-
const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $
|
|
3591
|
+
const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal, downloadURL: downloadURL, unfilteredDownloadURL: unfilteredDownloadURL, setPage: setPage, showCopyLinkButton: showCopyLinkButton, showDownloadFilteredDataButton: showDownloadFilteredDataButton, showDownloadFullDataButton: showDownloadFullDataButton, showStoredQueryDownloadButton: showStoredQueryDownloadButton })=>{
|
|
3592
|
+
const { id: id, resource: resource, datasetTableControls: datasetTableControls, dataDictionaryBanner: dataDictionaryBanner } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
3593
|
+
const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $ee0d4d4f34048447$export$f814ea079e65d8fe));
|
|
3594
|
+
const { conditions: conditions } = resource;
|
|
3397
3595
|
const data = resource.values;
|
|
3398
3596
|
const [sorting, setSorting] = (0, $hgUW1$useState)([]);
|
|
3399
3597
|
const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
|
|
@@ -3455,17 +3653,142 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sort
|
|
|
3455
3653
|
]);
|
|
3456
3654
|
return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
|
|
3457
3655
|
children: [
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3656
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3657
|
+
className: "ds-u-margin-bottom--3",
|
|
3658
|
+
children: showDownloadFullDataButton && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3659
|
+
className: "dkan-data-table-download-full-dataset-button ds-u-fill--primary ds-u-color--white ds-u-text-align--center ds-u-padding-x--3 ds-u-margin-x--0 ds-u-margin-y--0",
|
|
3660
|
+
href: unfilteredDownloadURL,
|
|
3661
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3662
|
+
className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-margin-x--0 ds-u-padding--0",
|
|
3663
|
+
children: [
|
|
3664
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3665
|
+
className: "fas fa-file-csv"
|
|
3666
|
+
}),
|
|
3667
|
+
" Download full dataset (CSV)"
|
|
3668
|
+
]
|
|
3669
|
+
})
|
|
3465
3670
|
})
|
|
3466
3671
|
}),
|
|
3672
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $85f8ff1ff89899c7$export$2e2bcd8739ae039), {
|
|
3673
|
+
id: id,
|
|
3674
|
+
columns: table.getAllLeafColumns(),
|
|
3675
|
+
defaultColumnOrder: defaultColumnOrder,
|
|
3676
|
+
isModal: isModal,
|
|
3677
|
+
closeFullScreenModal: closeFullScreenModal,
|
|
3678
|
+
resource: resource,
|
|
3679
|
+
datasetTableControls: datasetTableControls,
|
|
3680
|
+
columnVisibility: columnVisibility,
|
|
3681
|
+
setColumnVisibility: setColumnVisibility
|
|
3682
|
+
}),
|
|
3683
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3684
|
+
className: "ds-u-display--flex ds-l-col--12 ds-l-md-col--11 ds-u-justify-content--between ds-u-padding--0 ds-u-margin-y--2 ds-u-md-margin-y--3 ds-u-flex-direction--column ds-u-md-flex-direction--row",
|
|
3685
|
+
children: [
|
|
3686
|
+
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3687
|
+
className: "dkan-data-table-info-container ds-u-padding-right--0 ds-u-md-padding-right--4",
|
|
3688
|
+
children: [
|
|
3689
|
+
dataDictionaryBanner && !isModal && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3690
|
+
className: "ds-u-margin-bottom--3",
|
|
3691
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Alert), {
|
|
3692
|
+
children: 'Click on the "Data Dictionary" tab above for full column definitions'
|
|
3693
|
+
})
|
|
3694
|
+
}),
|
|
3695
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
3696
|
+
className: "ds-u-margin--0",
|
|
3697
|
+
children: "Activate the column resize button and use the right and left arrow keys to resize a column or use your mouse to drag/resize. Press escape to cancel the resizing."
|
|
3698
|
+
})
|
|
3699
|
+
]
|
|
3700
|
+
}),
|
|
3701
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3702
|
+
className: "dkan-data-table-share-container ds-l-col--auto ds-u-padding--0 ds-u-margin-bottom--2 ds-u-md-margin-bottom--0",
|
|
3703
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Tooltip), {
|
|
3704
|
+
className: "dkan-data-table-share-button ds-u-display--flex ds-u-align-items--center ds-u-fill--primary ds-u-radius--pill ds-u-color--white ds-u-border--0 ds-u-padding-x--3 ds-u-padding-y--1 ds-u-font-weight--bold ds-l-col--12 ds-l-md-col--auto ds-u-justify-content--center",
|
|
3705
|
+
activeClassName: "dkan-data-table-share-tooltip-open",
|
|
3706
|
+
dialog: true,
|
|
3707
|
+
offset: [
|
|
3708
|
+
0,
|
|
3709
|
+
5
|
|
3710
|
+
],
|
|
3711
|
+
placement: "bottom-start",
|
|
3712
|
+
maxWidth: "320px",
|
|
3713
|
+
title: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3714
|
+
className: "dc-c-resource-header--buttons ds-u-display--flex ds-u-flex-direction--column ds-l-col--12 ds-u-padding-x--0",
|
|
3715
|
+
children: [
|
|
3716
|
+
showCopyLinkButton && /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
3717
|
+
children: conditions && conditions.length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
|
|
3718
|
+
onOpen: ()=>{
|
|
3719
|
+
navigator.clipboard.writeText(window.location.href);
|
|
3720
|
+
},
|
|
3721
|
+
className: "dkan-data-table-download-button ds-c-button ds-u-text-align--center ds-l-col--12 ds-u-padding-x--2 ds-u-margin-x--0 ds-u-margin-bottom--1",
|
|
3722
|
+
placement: "bottom",
|
|
3723
|
+
dialog: true,
|
|
3724
|
+
ariaLabel: "Copy link to filtered data",
|
|
3725
|
+
title: "Link copied to clipboard",
|
|
3726
|
+
"aria-disabled": !conditions || conditions.length === 0,
|
|
3727
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3728
|
+
className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-margin-x--0 ds-u-padding--0",
|
|
3729
|
+
children: [
|
|
3730
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3731
|
+
className: "fas fa-copy"
|
|
3732
|
+
}),
|
|
3733
|
+
" Copy link to filtered data"
|
|
3734
|
+
]
|
|
3735
|
+
})
|
|
3736
|
+
}) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3737
|
+
"aria-disabled": true,
|
|
3738
|
+
"aria-label": "Copy link to filtered data",
|
|
3739
|
+
className: "dkan-data-table-download-button ds-c-button ds-u-text-align--center ds-l-col--12 ds-u-padding-x--2 ds-u-margin-x--0 ds-u-margin-bottom--1",
|
|
3740
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3741
|
+
className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-padding--0",
|
|
3742
|
+
children: [
|
|
3743
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3744
|
+
className: "fas fa-copy"
|
|
3745
|
+
}),
|
|
3746
|
+
" Copy link to filtered data"
|
|
3747
|
+
]
|
|
3748
|
+
})
|
|
3749
|
+
})
|
|
3750
|
+
}),
|
|
3751
|
+
(showDownloadFilteredDataButton || showStoredQueryDownloadButton) && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
|
|
3752
|
+
className: "ds-l-col--12 ds-u-padding-x--0 ds-u-margin-x--0",
|
|
3753
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
|
|
3754
|
+
className: "dkan-data-table-download-button ds-u-text-align--center ds-u-display--inline-block ds-l-col--12 ds-u-padding-x--2 ds-u-margin-x--0 ds-u-margin-bottom--1",
|
|
3755
|
+
href: downloadURL,
|
|
3756
|
+
"aria-disabled": !conditions || conditions.length === 0,
|
|
3757
|
+
children: /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
3758
|
+
className: "ds-u-font-weight--normal ds-u-font-size--md ds-u-padding--0",
|
|
3759
|
+
children: [
|
|
3760
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3761
|
+
className: "fas fa-file-csv"
|
|
3762
|
+
}),
|
|
3763
|
+
" ",
|
|
3764
|
+
showDownloadFilteredDataButton ? `Download filtered data (CSV)` : `Download stored query data (CSV)`
|
|
3765
|
+
]
|
|
3766
|
+
})
|
|
3767
|
+
})
|
|
3768
|
+
})
|
|
3769
|
+
]
|
|
3770
|
+
}),
|
|
3771
|
+
children: [
|
|
3772
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3773
|
+
className: "far fa-share-alt"
|
|
3774
|
+
}),
|
|
3775
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
3776
|
+
className: "ds-u-margin-x--05",
|
|
3777
|
+
children: "Share"
|
|
3778
|
+
}),
|
|
3779
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3780
|
+
className: "fa fa-chevron-down"
|
|
3781
|
+
}),
|
|
3782
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("i", {
|
|
3783
|
+
className: "fa fa-chevron-up"
|
|
3784
|
+
})
|
|
3785
|
+
]
|
|
3786
|
+
})
|
|
3787
|
+
})
|
|
3788
|
+
]
|
|
3789
|
+
}),
|
|
3467
3790
|
/*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
|
|
3468
|
-
className: "dc-c-datatable-wrapper",
|
|
3791
|
+
className: "dc-c-datatable-wrapper ds-u-border-x--1 ds-u-border-bottom--1",
|
|
3469
3792
|
tabIndex: 0,
|
|
3470
3793
|
ref: dataTableWrapperElement,
|
|
3471
3794
|
children: [
|
|
@@ -5895,32 +6218,9 @@ var $6012b86ffcaf3f71$export$2e2bcd8739ae039 = (0, $61ff88fb3f6ee2c8$export$2e2b
|
|
|
5895
6218
|
|
|
5896
6219
|
|
|
5897
6220
|
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
const { id: id, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $43a30d745a7bbc86$export$2e2bcd8739ae039));
|
|
5901
|
-
// a wrapper component to keep column state synced between full screen and regular modes
|
|
5902
|
-
const localStorageData = id ? JSON.parse(localStorage.getItem(id)) : null;
|
|
5903
|
-
const defaultPage = 1;
|
|
5904
|
-
const [page, setPage] = (0, $hgUW1$useState)(defaultPage);
|
|
5905
|
-
const [columnOrder, setColumnOrder] = (0, $hgUW1$useState)(()=>{
|
|
5906
|
-
if (datasetTableControls && localStorageData) return localStorageData.tableColumnOrder;
|
|
5907
|
-
else return [];
|
|
5908
|
-
});
|
|
5909
|
-
const [columnVisibility, setColumnVisibility] = (0, $hgUW1$useState)(()=>{
|
|
5910
|
-
if (datasetTableControls && localStorageData) return localStorageData.tableColumnVisibility;
|
|
5911
|
-
else return {};
|
|
5912
|
-
});
|
|
5913
|
-
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ebda441784d176a5$export$2e2bcd8739ae039).Provider, {
|
|
5914
|
-
value: {
|
|
5915
|
-
columnOrder: columnOrder,
|
|
5916
|
-
setColumnOrder: setColumnOrder,
|
|
5917
|
-
columnVisibility: columnVisibility,
|
|
5918
|
-
setColumnVisibility: setColumnVisibility,
|
|
5919
|
-
page: page,
|
|
5920
|
-
setPage: setPage
|
|
5921
|
-
},
|
|
6221
|
+
const $39bc4d98030a5599$var$DataTableStateWrapper = ({ showCopyLinkButton: showCopyLinkButton = true, showDownloadFilteredDataButton: showDownloadFilteredDataButton = true, showDownloadFullDataButton: showDownloadFullDataButton = true, showStoredQueryDownloadButton: showStoredQueryDownloadButton = false })=>{
|
|
6222
|
+
return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $ee0d4d4f34048447$export$2e2bcd8739ae039), {
|
|
5922
6223
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a35cf16d1488f54e$export$2e2bcd8739ae039), {
|
|
5923
|
-
showQueryBuilder: showQueryBuilder,
|
|
5924
6224
|
showCopyLinkButton: showCopyLinkButton,
|
|
5925
6225
|
showDownloadFilteredDataButton: showDownloadFilteredDataButton,
|
|
5926
6226
|
showDownloadFullDataButton: showDownloadFullDataButton,
|
|
@@ -7018,7 +7318,6 @@ function $8b67b7ee3fcfb629$export$2e2bcd8739ae039({ id: id, rootUrl: rootUrl, cu
|
|
|
7018
7318
|
datasetTableControls: !disableTableControls
|
|
7019
7319
|
},
|
|
7020
7320
|
children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $39bc4d98030a5599$export$2e2bcd8739ae039), {
|
|
7021
|
-
showQueryBuilder: false,
|
|
7022
7321
|
showCopyLinkButton: false,
|
|
7023
7322
|
showDownloadFilteredDataButton: false,
|
|
7024
7323
|
showDownloadFullDataButton: false,
|
|
@@ -7168,6 +7467,78 @@ var $374c4669b044ddf8$export$2e2bcd8739ae039 = $374c4669b044ddf8$var$QueryRow;
|
|
|
7168
7467
|
|
|
7169
7468
|
|
|
7170
7469
|
|
|
7470
|
+
|
|
7471
|
+
const $bef7bff2823feea2$var$QueryTitle = ({ conditions: conditions, schema: schema, customColumns: customColumns })=>{
|
|
7472
|
+
const { fields: fields } = schema;
|
|
7473
|
+
const prependedMessage = /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Fragment), {
|
|
7474
|
+
children: "Data filters: "
|
|
7475
|
+
});
|
|
7476
|
+
if (!conditions || !conditions.length) return /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
|
|
7477
|
+
className: "ds-u-margin-y--0",
|
|
7478
|
+
children: [
|
|
7479
|
+
prependedMessage,
|
|
7480
|
+
" none"
|
|
7481
|
+
]
|
|
7482
|
+
});
|
|
7483
|
+
function formatValue(text, property) {
|
|
7484
|
+
if (customColumns && customColumns.length > 0) {
|
|
7485
|
+
let newValue = text;
|
|
7486
|
+
let customColumn = customColumns.find((c)=>c.accessor === property);
|
|
7487
|
+
if (customColumn && customColumn.cell) return customColumn.cell({
|
|
7488
|
+
value: text
|
|
7489
|
+
});
|
|
7490
|
+
return text;
|
|
7491
|
+
} else return text;
|
|
7492
|
+
}
|
|
7493
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
7494
|
+
className: "dc-querybuilder-title",
|
|
7495
|
+
children: [
|
|
7496
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("p", {
|
|
7497
|
+
className: "ds-u-margin-y--0",
|
|
7498
|
+
children: prependedMessage
|
|
7499
|
+
}),
|
|
7500
|
+
conditions.map((c)=>{
|
|
7501
|
+
const field = fields[c.property];
|
|
7502
|
+
const description = field && field.description ? field.description : c.property;
|
|
7503
|
+
const operator = (0, $7264a673914aa746$export$5f89a5ae87bc48e1).find((op)=>op.value === c.operator);
|
|
7504
|
+
const cleanedText = (0, $7264a673914aa746$export$6b5e57d20078142b)(c.value);
|
|
7505
|
+
const formattedText = formatValue(cleanedText, c.property);
|
|
7506
|
+
return /*#__PURE__*/ (0, $hgUW1$jsxs)("span", {
|
|
7507
|
+
className: "ds-u-fill--background ds-u-padding--1 ds-u-margin-y--1 ds-u-display--inline-block ds-u-font-weight--semibold",
|
|
7508
|
+
children: [
|
|
7509
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
7510
|
+
className: "ds-u-font-weight--bold",
|
|
7511
|
+
children: description
|
|
7512
|
+
}),
|
|
7513
|
+
" ",
|
|
7514
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
7515
|
+
className: "ds-u-font-weight--normal",
|
|
7516
|
+
children: operator.label.toUpperCase()
|
|
7517
|
+
}),
|
|
7518
|
+
" ",
|
|
7519
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)("span", {
|
|
7520
|
+
className: "ds-u-color--success",
|
|
7521
|
+
children: formattedText
|
|
7522
|
+
})
|
|
7523
|
+
]
|
|
7524
|
+
});
|
|
7525
|
+
}).reduce((prev, curr)=>[
|
|
7526
|
+
prev,
|
|
7527
|
+
/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Badge), {
|
|
7528
|
+
className: "ds-u-margin-x--1",
|
|
7529
|
+
variation: "info",
|
|
7530
|
+
children: "AND"
|
|
7531
|
+
}),
|
|
7532
|
+
curr
|
|
7533
|
+
])
|
|
7534
|
+
]
|
|
7535
|
+
});
|
|
7536
|
+
};
|
|
7537
|
+
var $bef7bff2823feea2$export$2e2bcd8739ae039 = $bef7bff2823feea2$var$QueryTitle;
|
|
7538
|
+
|
|
7539
|
+
|
|
7540
|
+
|
|
7541
|
+
|
|
7171
7542
|
function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
|
|
7172
7543
|
let cond = condition;
|
|
7173
7544
|
delete cond.key;
|
|
@@ -7683,5 +8054,5 @@ var $90fb213ab8eeb2e7$export$2e2bcd8739ae039 = $90fb213ab8eeb2e7$var$useScrollTo
|
|
|
7683
8054
|
|
|
7684
8055
|
|
|
7685
8056
|
|
|
7686
|
-
export {$e49d4387bed21287$export$2e2bcd8739ae039 as ApiRowLimitNotice, $a8accc31bf9e0bda$export$2e2bcd8739ae039 as CMSTopNav, $c49454ea7d1c4579$export$2e2bcd8739ae039 as ErrorBoundary, $046ded0064bd0a3d$export$2e2bcd8739ae039 as FAQAccordion, $b939b31651e82908$export$2e2bcd8739ae039 as HeaderNav, $1555e1cb3eb7b3e3$export$2e2bcd8739ae039 as HeaderNavIconLink, $fea9297ba4dd394c$export$2e2bcd8739ae039 as HeaderSearch, $9a8892c5ac150556$export$2e2bcd8739ae039 as HeaderSiteTitle, $3c72c298c3a7f21f$export$2e2bcd8739ae039 as HeaderTagline, $403833a4b442d5df$export$2e2bcd8739ae039 as MobileMenuButton, $f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $953b286f7778640e$export$2e2bcd8739ae039 as SidebarNavigation, $b0968edc60d7d3a4$export$2e2bcd8739ae039 as SidebarPage, $4f153ca537d853e5$export$2e2bcd8739ae039 as SubMenu, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $c068004d499082cc$export$2e2bcd8739ae039 as DatasetListItem, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $17711e94d2ce0ee4$export$2e2bcd8739ae039 as DatasetDateItem, $20de4fedf33d4f9a$export$2e2bcd8739ae039 as DatasetDate, $10bc3aae21fc1572$export$2e2bcd8739ae039 as DatasetListSubmenu, $789279954d8eff7f$export$2e2bcd8739ae039 as ApiDocumentation, $af099c546cb226c7$export$2e2bcd8739ae039 as ResourceHeader, $626282d9a03c51d5$export$2e2bcd8739ae039 as ResourcePreview, $072291d44ce1834a$export$2e2bcd8739ae039 as ResourceFooter, $ec3e23baa005dc03$export$2e2bcd8739ae039 as Breadcrumb, $bd76a91923d7e8a7$export$2e2bcd8739ae039 as TransformedDate, $d98f94c79ddf4e0e$export$2e2bcd8739ae039 as DataTable, $bdb071ea3a6d3466$export$2e2bcd8739ae039 as SearchInput, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults, $1a2bf34e2a8f6b80$export$59a943b34a82e690 as truncateText, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $550bcc185f420ff5$export$2e2bcd8739ae039 as DatasetList, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $b9af6ce5e2c06331$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $8b67b7ee3fcfb629$export$2e2bcd8739ae039 as StoredQueryPage, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $bef7bff2823feea2$export$2e2bcd8739ae039 as QueryTitle, $7264a673914aa746$export$2b9377795161999 as buildOperatorOptions, $7264a673914aa746$export$e284ae5d89467c8f as convertUTCToLocalDate, $7264a673914aa746$export$6b5e57d20078142b as cleanText, $7264a673914aa746$export$8049e8f40a9bdfb8 as buildCustomColHeaders, $11500a65bd7d9cf1$export$2e2bcd8739ae039 as HeaderContext, $43a30d745a7bbc86$export$2e2bcd8739ae039 as DataTableContext, $
|
|
8057
|
+
export {$e49d4387bed21287$export$2e2bcd8739ae039 as ApiRowLimitNotice, $a8accc31bf9e0bda$export$2e2bcd8739ae039 as CMSTopNav, $c49454ea7d1c4579$export$2e2bcd8739ae039 as ErrorBoundary, $046ded0064bd0a3d$export$2e2bcd8739ae039 as FAQAccordion, $b939b31651e82908$export$2e2bcd8739ae039 as HeaderNav, $1555e1cb3eb7b3e3$export$2e2bcd8739ae039 as HeaderNavIconLink, $fea9297ba4dd394c$export$2e2bcd8739ae039 as HeaderSearch, $9a8892c5ac150556$export$2e2bcd8739ae039 as HeaderSiteTitle, $3c72c298c3a7f21f$export$2e2bcd8739ae039 as HeaderTagline, $403833a4b442d5df$export$2e2bcd8739ae039 as MobileMenuButton, $f57121650539d8c5$export$2e2bcd8739ae039 as NavBar, $953b286f7778640e$export$2e2bcd8739ae039 as SidebarNavigation, $b0968edc60d7d3a4$export$2e2bcd8739ae039 as SidebarPage, $4f153ca537d853e5$export$2e2bcd8739ae039 as SubMenu, $59a079354baa335c$export$2e2bcd8739ae039 as Hero, $c068004d499082cc$export$2e2bcd8739ae039 as DatasetListItem, $52c6454cae137465$export$2e2bcd8739ae039 as DatasetSearchListItem, $17711e94d2ce0ee4$export$2e2bcd8739ae039 as DatasetDateItem, $20de4fedf33d4f9a$export$2e2bcd8739ae039 as DatasetDate, $10bc3aae21fc1572$export$2e2bcd8739ae039 as DatasetListSubmenu, $789279954d8eff7f$export$2e2bcd8739ae039 as ApiDocumentation, $af099c546cb226c7$export$2e2bcd8739ae039 as ResourceHeader, $626282d9a03c51d5$export$2e2bcd8739ae039 as ResourcePreview, $072291d44ce1834a$export$2e2bcd8739ae039 as ResourceFooter, $ec3e23baa005dc03$export$2e2bcd8739ae039 as Breadcrumb, $bd76a91923d7e8a7$export$2e2bcd8739ae039 as TransformedDate, $d98f94c79ddf4e0e$export$2e2bcd8739ae039 as DataTable, $bdb071ea3a6d3466$export$2e2bcd8739ae039 as SearchInput, $5644ebd2c3dbfd7b$export$eea3a12df15499ca as buildRows, $2ed0091f7e32d1e6$export$2e2bcd8739ae039 as DataTablePageResults, $1a2bf34e2a8f6b80$export$59a943b34a82e690 as truncateText, $c96c4b9ef7203c1f$export$2e2bcd8739ae039 as APIPage, $026cb986f9fea2b1$export$2e2bcd8739ae039 as PageNotFound, $e873081a6e8f024e$export$2e2bcd8739ae039 as DatasetSearch, $550bcc185f420ff5$export$2e2bcd8739ae039 as DatasetList, $a0f13962e513caa1$export$2e2bcd8739ae039 as Dataset, $a35cf16d1488f54e$export$2e2bcd8739ae039 as DatasetTable, $b9af6ce5e2c06331$export$2e2bcd8739ae039 as Header, $a6df0aa147323304$export$2e2bcd8739ae039 as Footer, $669d2782ec2e2250$export$2e2bcd8739ae039 as SpecsAndLimits, $8b67b7ee3fcfb629$export$2e2bcd8739ae039 as StoredQueryPage, $f61ecf9f84951a61$export$2e2bcd8739ae039 as FilteredResource, $bef7bff2823feea2$export$2e2bcd8739ae039 as QueryTitle, $7264a673914aa746$export$2b9377795161999 as buildOperatorOptions, $7264a673914aa746$export$e284ae5d89467c8f as convertUTCToLocalDate, $7264a673914aa746$export$6b5e57d20078142b as cleanText, $7264a673914aa746$export$8049e8f40a9bdfb8 as buildCustomColHeaders, $11500a65bd7d9cf1$export$2e2bcd8739ae039 as HeaderContext, $43a30d745a7bbc86$export$2e2bcd8739ae039 as DataTableContext, $ee0d4d4f34048447$export$2e2bcd8739ae039 as DataTableActionsProvider, $844981eac9b63865$export$eccc29c8d0ff408 as ACAContext, $efc410f5f7ac5ef3$export$2e2bcd8739ae039 as useSearchAPI, $1d3d480a9cfaabe0$export$2e2bcd8739ae039 as useDatastore, $aa4450dcbeef3ac0$export$385a5aba38cc3325 as transformTableSortToQuerySort, $eb7821d186b1a389$export$2e2bcd8739ae039 as useAddLoginLink, $90fb213ab8eeb2e7$export$2e2bcd8739ae039 as useScrollToTop, $b4aa9c66f2e86959$export$2e2bcd8739ae039 as useMetastoreDataset, $61ff88fb3f6ee2c8$export$2e2bcd8739ae039 as withQueryProvider, $6d5c0212e738499b$export$34e95918366a058e as acaToParams, $6da0396069e23175$export$bc27cf7ecf44639d as defaultMetadataMapping};
|
|
7687
8058
|
//# sourceMappingURL=main.js.map
|