@civicactions/cmsds-open-data-components 3.2.0-alpha.1 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./main.css";
2
2
  import {jsxs as $hgUW1$jsxs, jsx as $hgUW1$jsx, Fragment as $hgUW1$Fragment} from "react/jsx-runtime";
3
- import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect} from "react";
4
- import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, AddIcon as $hgUW1$AddIcon, RemoveIcon as $hgUW1$RemoveIcon, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Tooltip as $hgUW1$Tooltip, Badge as $hgUW1$Badge, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead, TooltipIcon as $hgUW1$TooltipIcon} from "@cmsgov/design-system";
3
+ import $hgUW1$react, {useState as $hgUW1$useState, useRef as $hgUW1$useRef, useEffect as $hgUW1$useEffect, useMemo as $hgUW1$useMemo} from "react";
4
+ import {Button as $hgUW1$Button, Accordion as $hgUW1$Accordion, AccordionItem as $hgUW1$AccordionItem, TextField as $hgUW1$TextField, Spinner as $hgUW1$Spinner, Dropdown as $hgUW1$Dropdown, Alert as $hgUW1$Alert, Pagination as $hgUW1$Pagination, Dialog as $hgUW1$Dialog, Choice as $hgUW1$Choice, Tabs as $hgUW1$Tabs, TabPanel as $hgUW1$TabPanel, Tooltip as $hgUW1$Tooltip, Badge as $hgUW1$Badge, Table as $hgUW1$Table, TableBody as $hgUW1$TableBody, TableRow as $hgUW1$TableRow, TableCell as $hgUW1$TableCell, TableHead as $hgUW1$TableHead, TooltipIcon as $hgUW1$TooltipIcon} from "@cmsgov/design-system";
5
5
  import $hgUW1$proptypes from "prop-types";
6
6
  import {NavLink as $hgUW1$NavLink, useLocation as $hgUW1$useLocation, useSearchParams as $hgUW1$useSearchParams, Link as $hgUW1$Link, useNavigate as $hgUW1$useNavigate} from "react-router-dom";
7
7
  import $hgUW1$qs from "qs";
@@ -12,7 +12,7 @@ import {useQuery as $hgUW1$useQuery, QueryClient as $hgUW1$QueryClient, QueryCli
12
12
  import {useMediaQuery as $hgUW1$useMediaQuery} from "react-responsive";
13
13
  import $hgUW1$dompurify from "dompurify";
14
14
  import $hgUW1$lodashtruncate from "lodash.truncate";
15
- import {createColumnHelper as $hgUW1$createColumnHelper, useReactTable as $hgUW1$useReactTable, getCoreRowModel as $hgUW1$getCoreRowModel, getSortedRowModel as $hgUW1$getSortedRowModel, flexRender as $hgUW1$flexRender, getPaginationRowModel as $hgUW1$getPaginationRowModel} from "@tanstack/react-table";
15
+ import {createColumnHelper as $hgUW1$createColumnHelper, useReactTable as $hgUW1$useReactTable, getCoreRowModel as $hgUW1$getCoreRowModel, getSortedRowModel as $hgUW1$getSortedRowModel, flexRender as $hgUW1$flexRender, getFilteredRowModel as $hgUW1$getFilteredRowModel, getPaginationRowModel as $hgUW1$getPaginationRowModel} from "@tanstack/react-table";
16
16
  import $hgUW1$reactdatepicker from "react-datepicker";
17
17
  import "react-datepicker/dist/react-datepicker.css";
18
18
  import {usePopper as $hgUW1$usePopper} from "react-popper";
@@ -669,12 +669,6 @@ const $e011250e8a3bd5e5$var$SearchFacets = (props)=>{
669
669
  const filteredFacets = facets.filter((f)=>{
670
670
  return Number(f.total) > 0 || selectedFacets.findIndex((i)=>i === f.name) !== -1;
671
671
  });
672
- const hiddenAddIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AddIcon), {
673
- ariaHidden: true
674
- });
675
- const hiddenCloseIcon = ()=>/*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$RemoveIcon), {
676
- ariaHidden: true
677
- });
678
672
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
679
673
  className: "dkan-dataset-search--facet-container ds-u-margin-bottom--4",
680
674
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Accordion), {
@@ -682,8 +676,6 @@ const $e011250e8a3bd5e5$var$SearchFacets = (props)=>{
682
676
  contentClassName: "ds-u-padding-left--1 ds-u-padding-right--0",
683
677
  heading: title,
684
678
  defaultOpen: true,
685
- openIconComponent: hiddenAddIcon,
686
- closeIconComponent: hiddenCloseIcon,
687
679
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("ul", {
688
680
  children: filteredFacets.length ? filteredFacets.map((f)=>{
689
681
  return /*#__PURE__*/ (0, $hgUW1$jsx)("li", {
@@ -1640,6 +1632,7 @@ const $64a351d3fd8413c3$var$HeaderResizeElement = ({ table: table, header: heade
1640
1632
  style: {
1641
1633
  maxWidth: header.getSize() - 16
1642
1634
  },
1635
+ title: header.column.columnDef.header,
1643
1636
  children: header.isPlaceholder ? null : (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
1644
1637
  }),
1645
1638
  sortElement && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
@@ -2332,7 +2325,7 @@ const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: i
2332
2325
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2333
2326
  variation: "ghost",
2334
2327
  size: "small",
2335
- className: "ds-u-margin-top--3 ds-u-padding-right--0",
2328
+ className: "ds-u-margin-top--6 ds-u-padding-right--0",
2336
2329
  "aria-label": "Delete filter",
2337
2330
  onClick: ()=>remove(index),
2338
2331
  children: /*#__PURE__*/ (0, $hgUW1$jsx)("span", {
@@ -2347,6 +2340,26 @@ const $6369abf590ca298f$var$QueryRow = ({ id: id, condition: condition, index: i
2347
2340
  var $6369abf590ca298f$export$2e2bcd8739ae039 = $6369abf590ca298f$var$QueryRow;
2348
2341
 
2349
2342
 
2343
+
2344
+
2345
+
2346
+
2347
+ const $2eec38d4d0dbf714$var$ClearFiltersButton = ({ disabled: disabled = false, clearFiltersFn: clearFiltersFn })=>{
2348
+ const small = (0, $hgUW1$useMediaQuery)({
2349
+ minWidth: 0,
2350
+ maxWidth: 544
2351
+ });
2352
+ return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2353
+ disabled: disabled,
2354
+ className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
2355
+ variation: small ? "ghost" : undefined,
2356
+ onClick: ()=>clearFiltersFn(),
2357
+ children: small ? "Clear all" : "Clear all filters"
2358
+ });
2359
+ };
2360
+ var $2eec38d4d0dbf714$export$2e2bcd8739ae039 = $2eec38d4d0dbf714$var$ClearFiltersButton;
2361
+
2362
+
2350
2363
  function $ee4ad47aa483e5b5$var$updateQueryForDatastore(condition) {
2351
2364
  let cond = condition;
2352
2365
  delete cond.key;
@@ -2502,16 +2515,13 @@ const $ee4ad47aa483e5b5$var$QueryBuilder = (props)=>{
2502
2515
  variation: "solid",
2503
2516
  children: "Apply filters"
2504
2517
  }),
2505
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Button), {
2518
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
2506
2519
  disabled: queryConditions.length === 0,
2507
- className: "ds-u-float--right ds-l-md-col--6 ds-l-col--5",
2508
- variation: small ? "ghost" : undefined,
2509
- onClick: ()=>{
2520
+ clearFiltersFn: ()=>{
2510
2521
  setQueryConditions([]);
2511
2522
  setTitleConditions([]);
2512
2523
  setConditionsCleared(true);
2513
- },
2514
- children: small ? "Clear all" : "Clear all filters"
2524
+ }
2515
2525
  })
2516
2526
  ]
2517
2527
  })
@@ -2781,7 +2791,7 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
2781
2791
  className: "ds-u-font-weight--bold ds-u-font-size--lg ds-l-col--12 ds-l-md-col--6 ds-u-padding-left--0 ds-u-align-items--center ds-u-display--flex",
2782
2792
  children: [
2783
2793
  /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
2784
- className: "fa ds-u-color--primary ds-u-padding-right--1 ds-u-font-size--3xl fa-file-" + (fileFormat == "xlsx" ? "excel" : fileFormat)
2794
+ className: "fa ds-u-color--primary ds-u-padding-right--1 ds-u-font-size--3xl fa-file-" + (fileFormat == "xlsx" ? "xls" : fileFormat)
2785
2795
  }),
2786
2796
  /*#__PURE__*/ (0, $hgUW1$jsxs)("p", {
2787
2797
  className: "ds-u-margin-top--0",
@@ -2800,7 +2810,7 @@ const $7357cc0f79f9c514$var$Resource = ({ distributions: distributions, resource
2800
2810
  order: sm ? "1" : "0",
2801
2811
  width: sm ? "100%" : "auto"
2802
2812
  },
2803
- "aria-label": "Download " + title + " " + fileFormat,
2813
+ "aria-label": `Download ${dist.data.title || title} ${fileFormat}`,
2804
2814
  className: "ds-c-button",
2805
2815
  children: [
2806
2816
  /*#__PURE__*/ (0, $hgUW1$jsx)("i", {
@@ -2966,25 +2976,99 @@ var $cf6eaefd6b928de3$export$2e2bcd8739ae039 = $cf6eaefd6b928de3$var$DatasetAPI;
2966
2976
 
2967
2977
 
2968
2978
 
2969
- const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, count: count, pageSize: pageSize })=>{
2970
- const [pagination, setPagination] = (0, $hgUW1$useState)({
2971
- pageIndex: 1,
2972
- pageSize: pageSize
2973
- });
2979
+
2980
+ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns, tableData: tableData, pageSize: pageSize, columnFilters: columnFilters })=>{
2981
+ const [sorting, setSorting] = (0, $hgUW1$useState)([]);
2974
2982
  const [ariaLiveFeedback, setAriaLiveFeedback] = (0, $hgUW1$useState)("");
2983
+ const mobile = (0, $hgUW1$useMediaQuery)({
2984
+ minWidth: 0,
2985
+ maxWidth: 544
2986
+ });
2987
+ const sortElement = (isSorted)=>{
2988
+ if (isSorted === "asc") return "dc-c-sort--asc";
2989
+ if (isSorted === "desc") return "dc-c-sort--desc";
2990
+ return "dc-c-sort--default";
2991
+ };
2975
2992
  const table = (0, $hgUW1$useReactTable)({
2976
2993
  data: tableData,
2977
2994
  columns: tableColumns,
2978
2995
  columnResizeMode: "onChange",
2979
2996
  getCoreRowModel: (0, $hgUW1$getCoreRowModel)(),
2997
+ getFilteredRowModel: (0, $hgUW1$getFilteredRowModel)(),
2980
2998
  getPaginationRowModel: (0, $hgUW1$getPaginationRowModel)(),
2981
- onPaginationChange: setPagination,
2999
+ getSortedRowModel: (0, $hgUW1$getSortedRowModel)(),
3000
+ onSortingChange: setSorting,
2982
3001
  state: {
2983
- pagination: pagination
3002
+ sorting: sorting,
3003
+ columnFilters: columnFilters
2984
3004
  }
2985
3005
  });
3006
+ const sortOptions = [
3007
+ {
3008
+ value: "default",
3009
+ label: "No Sort"
3010
+ },
3011
+ {
3012
+ value: "titleasc",
3013
+ label: "Title A-Z"
3014
+ },
3015
+ {
3016
+ value: "titledesc",
3017
+ label: "Title Z-A"
3018
+ },
3019
+ {
3020
+ value: "typeasc",
3021
+ label: "Type A-Z"
3022
+ },
3023
+ {
3024
+ value: "typedesc",
3025
+ label: "Type Z-A"
3026
+ }
3027
+ ];
3028
+ const sortStatesLookup = {
3029
+ default: [],
3030
+ titleasc: [
3031
+ {
3032
+ id: "titleResizable",
3033
+ desc: false
3034
+ }
3035
+ ],
3036
+ titledesc: [
3037
+ {
3038
+ id: "titleResizable",
3039
+ desc: true
3040
+ }
3041
+ ],
3042
+ typeasc: [
3043
+ {
3044
+ id: "type",
3045
+ desc: false
3046
+ }
3047
+ ],
3048
+ typedesc: [
3049
+ {
3050
+ id: "type",
3051
+ desc: true
3052
+ }
3053
+ ]
3054
+ };
2986
3055
  return /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2987
3056
  children: [
3057
+ mobile && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3058
+ className: "ds-u-margin-bottom--3 ds-l-col--12 ds-l-sm-col--6",
3059
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3060
+ labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
3061
+ options: sortOptions,
3062
+ label: "Sort",
3063
+ value: Object.keys(sortStatesLookup).find((key)=>{
3064
+ return JSON.stringify(sortStatesLookup[key]) == JSON.stringify(sorting);
3065
+ }),
3066
+ name: "dc-data-dictionary-type",
3067
+ onChange: (e)=>{
3068
+ setSorting(sortStatesLookup[e.target.value]);
3069
+ }
3070
+ })
3071
+ }),
2988
3072
  /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
2989
3073
  className: "dc-c-datadictionary-table",
2990
3074
  children: [
@@ -2993,6 +3077,7 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
2993
3077
  style: {
2994
3078
  width: "100%"
2995
3079
  },
3080
+ stackable: true,
2996
3081
  children: [
2997
3082
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableHead), {
2998
3083
  className: "dc-thead--truncated dc-thead--resizeable",
@@ -3001,11 +3086,20 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3001
3086
  return header.id === "titleResizable" ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $64a351d3fd8413c3$export$2e2bcd8739ae039), {
3002
3087
  table: table,
3003
3088
  header: header,
3004
- setAriaLiveFeedback: setAriaLiveFeedback
3005
- }, header.id + "_resize") : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3089
+ setAriaLiveFeedback: setAriaLiveFeedback,
3090
+ sortElement: sortElement
3091
+ }, header.id + "_resize") : /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$TableCell), {
3006
3092
  key: header.id,
3007
- className: "ds-u-border-y--2 ds-u-border--dark ds-u-border-x--0",
3008
- children: (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext())
3093
+ className: `ds-u-border-y--2 ds-u-border--dark ds-u-border-x--0`,
3094
+ id: "dataDictionary_" + header.id,
3095
+ children: [
3096
+ (0, $hgUW1$flexRender)(header.column.columnDef.header, header.getContext()),
3097
+ header.id === "type" && /*#__PURE__*/ (0, $hgUW1$jsx)("button", {
3098
+ onClick: header.column.getToggleSortingHandler(),
3099
+ className: header.column.getCanSort() ? `cursor-pointer select-none ds-u-focus-visible ${sortElement(header.column.getIsSorted())}` : "",
3100
+ "aria-label": `${header.column.columnDef.header} sort order`
3101
+ })
3102
+ ]
3009
3103
  });
3010
3104
  })
3011
3105
  }, "header" + headerGroup.id))
@@ -3017,9 +3111,12 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3017
3111
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TableCell), {
3018
3112
  key: cell.id,
3019
3113
  style: {
3020
- maxWidth: cell.column.getSize()
3114
+ maxWidth: mobile ? "100%" : cell.column.getSize(),
3115
+ whiteSpace: cell.column.id === "description" ? "pre-wrap" : "normal"
3021
3116
  },
3022
3117
  className: `${cell.column.id === "titleResizable" ? "ds-u-word-break" : ""}`,
3118
+ headers: "dataDictionary_" + cell.column.id,
3119
+ stackedTitle: cell.column.id === "titleResizable" ? "Title" : cell.column.columnDef.header,
3023
3120
  children: (0, $hgUW1$flexRender)(cell.column.columnDef.cell, cell.getContext())
3024
3121
  });
3025
3122
  })
@@ -3036,15 +3133,12 @@ const $6765a74df807d015$var$DataDictionaryTable = ({ tableColumns: tableColumns,
3036
3133
  })
3037
3134
  ]
3038
3135
  }),
3039
- count > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3040
- totalPages: Math.ceil(count / pagination.pageSize),
3041
- currentPage: pagination.pageIndex + 1,
3136
+ table.getRowCount() > pageSize ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Pagination), {
3137
+ totalPages: table.getPageCount(),
3138
+ currentPage: table.getState().pagination.pageIndex + 1,
3042
3139
  onPageChange: (evt, page)=>{
3043
3140
  evt.preventDefault();
3044
- setPagination({
3045
- pageIndex: page - 1,
3046
- pageSize: pageSize
3047
- });
3141
+ table.setPageIndex(page - 1);
3048
3142
  },
3049
3143
  renderHref: (page)=>{
3050
3144
  return "";
@@ -3075,7 +3169,6 @@ const $a24829b27758fe6c$var$SitewideDataDictionaryTable = ({ datasetDictionary:
3075
3169
  return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3076
3170
  tableColumns: tableColumns,
3077
3171
  tableData: datasetDictionary,
3078
- count: datasetDictionary.length,
3079
3172
  pageSize: pageSize
3080
3173
  });
3081
3174
  };
@@ -3088,7 +3181,23 @@ var $a24829b27758fe6c$export$2e2bcd8739ae039 = $a24829b27758fe6c$var$SitewideDat
3088
3181
 
3089
3182
 
3090
3183
 
3184
+
3091
3185
  const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datasetDictionary, pageSize: pageSize })=>{
3186
+ const [titleFilter, setTitleFilter] = (0, $hgUW1$useState)("");
3187
+ const [typeFilter, setTypeFilter] = (0, $hgUW1$useState)("all");
3188
+ const columnFilters = (0, $hgUW1$useMemo)(()=>[
3189
+ {
3190
+ id: "titleResizable",
3191
+ value: titleFilter
3192
+ },
3193
+ {
3194
+ id: "type",
3195
+ value: typeFilter === "all" ? "" : typeFilter
3196
+ }
3197
+ ], [
3198
+ titleFilter,
3199
+ typeFilter
3200
+ ]);
3092
3201
  const tableData = datasetDictionary.map((item)=>{
3093
3202
  return {
3094
3203
  titleResizable: item.title,
@@ -3104,7 +3213,7 @@ const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datas
3104
3213
  children: [
3105
3214
  "Title",
3106
3215
  /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Tooltip), {
3107
- title: "Title represents the column headers of the data file (e.g., Change_Type)",
3216
+ title: "Title represents the column headers of the data file",
3108
3217
  // @ts-ignore
3109
3218
  style: {
3110
3219
  border: "none",
@@ -3127,11 +3236,95 @@ const $a6e312940f7003ef$var$DatasetDictionaryTable = ({ datasetDictionary: datas
3127
3236
  enableResizing: false
3128
3237
  })
3129
3238
  ];
3130
- return /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3131
- tableColumns: tableColumns,
3132
- tableData: tableData,
3133
- count: datasetDictionary.length,
3134
- pageSize: pageSize
3239
+ const typeOptions = [
3240
+ {
3241
+ value: "all",
3242
+ label: "All Types"
3243
+ },
3244
+ {
3245
+ value: "string",
3246
+ label: "String"
3247
+ },
3248
+ {
3249
+ value: "date",
3250
+ label: "Date"
3251
+ },
3252
+ {
3253
+ value: "datetime",
3254
+ label: "Datetime"
3255
+ },
3256
+ {
3257
+ value: "year",
3258
+ label: "Year"
3259
+ },
3260
+ {
3261
+ value: "integer",
3262
+ label: "Integer"
3263
+ },
3264
+ {
3265
+ value: "number",
3266
+ label: "Number"
3267
+ },
3268
+ {
3269
+ value: "boolean",
3270
+ label: "Boolean"
3271
+ }
3272
+ ];
3273
+ return /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $hgUW1$Fragment), {
3274
+ children: [
3275
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3276
+ className: "dc-query-builder ds-u-margin-bottom--3",
3277
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3278
+ className: "ds-c-accordion ds-c-accordion--bordered",
3279
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$AccordionItem), {
3280
+ heading: "Data Dictionary Filters",
3281
+ defaultOpen: true,
3282
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
3283
+ className: "ds-u-display--flex ds-u-flex-wrap--wrap",
3284
+ children: [
3285
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$TextField), {
3286
+ className: "ds-l-col--12 ds-l-sm-col--6",
3287
+ labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
3288
+ label: "Title",
3289
+ value: titleFilter,
3290
+ name: "dc-data-dictionary-title",
3291
+ onChange: (e)=>setTitleFilter(e.target.value)
3292
+ }),
3293
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3294
+ className: "ds-l-col--12 ds-l-sm-col--6",
3295
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Dropdown), {
3296
+ labelClassName: "ds-u-margin-top--1 ds-u-sm-margin-top--0",
3297
+ options: typeOptions,
3298
+ label: "Type",
3299
+ value: typeFilter,
3300
+ name: "dc-data-dictionary-type",
3301
+ onChange: (e)=>setTypeFilter(e.target.value)
3302
+ })
3303
+ }),
3304
+ /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3305
+ className: "ds-u-float--right ds-u-padding-y--2 ds-l-col--12 ds-u-display--flex ds-u-flex-wrap--wrap ds-u-justify-content--end",
3306
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
3307
+ className: "ds-u-display--flex ds-u-justify-content--end ds-l-col--12 ds-l-md-col--6 ds-u-padding-x--0",
3308
+ children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $2eec38d4d0dbf714$export$2e2bcd8739ae039), {
3309
+ clearFiltersFn: ()=>{
3310
+ setTitleFilter("");
3311
+ setTypeFilter("all");
3312
+ }
3313
+ })
3314
+ })
3315
+ })
3316
+ ]
3317
+ })
3318
+ })
3319
+ })
3320
+ }),
3321
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $6765a74df807d015$export$2e2bcd8739ae039), {
3322
+ tableColumns: tableColumns,
3323
+ tableData: tableData,
3324
+ pageSize: pageSize,
3325
+ columnFilters: columnFilters
3326
+ })
3327
+ ]
3135
3328
  });
3136
3329
  };
3137
3330
  var $a6e312940f7003ef$export$2e2bcd8739ae039 = $a6e312940f7003ef$var$DatasetDictionaryTable;
@@ -5057,45 +5250,10 @@ var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHea
5057
5250
 
5058
5251
 
5059
5252
 
5060
- // OPERATORS
5061
- // =
5062
- // <> not equal to
5063
- // BETWEEN
5064
- // IN
5065
- // NOT IN
5066
- // >=
5067
- // <=
5068
- // like
5069
- function $ead72e621d62e6fc$export$64030b8086b23b59(filterArray) {
5070
- const conditions = filterArray.map((f)=>{
5071
- return {
5072
- resource: "t",
5073
- property: f.id,
5074
- value: `%${f.value}%`,
5075
- operator: "LIKE"
5076
- };
5077
- });
5078
- return conditions;
5079
- }
5080
- function $ead72e621d62e6fc$export$5bccb6115193eb03(filterArray) {
5081
- if (!filterArray || filterArray.length === 0) return "";
5082
- const where_clauses = [];
5083
- filterArray.forEach((v, i)=>{
5084
- // Switch delimiter to, and strip any double-quote for Dkan2's sql query.
5085
- let value = `%25${v.value}%25`;
5086
- where_clauses[i] = `${v.id} = "${v.value.replace('"', "")}"`;
5087
- });
5088
- return `[WHERE ${where_clauses.join(" AND ")}]`;
5089
- }
5090
5253
 
5091
5254
 
5092
5255
 
5093
5256
 
5094
-
5095
-
5096
- function $626282d9a03c51d5$var$calculateMaxWidth(previewSize) {
5097
- return Math.floor(previewSize * 0.84);
5098
- }
5099
5257
  function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
5100
5258
  return columns.map((column)=>({
5101
5259
  header: schema && schema.fields[column].description ? schema.fields[column].description : column,
@@ -5113,24 +5271,16 @@ function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header, a
5113
5271
  value: filterValue || ""
5114
5272
  });
5115
5273
  }
5116
- const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding, id: id, options: options, resource: resource, defaultSort: defaultSort, customColumns: customColumns, truncateCellHeader: truncateCellHeader, columnSettings: columnSettings, columnWidths: columnWidths, customClasses: customClasses, canResize: canResize })=>{
5274
+ const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding, id: id, options: options, resource: resource, defaultSort: defaultSort, customColumns: customColumns, canResize: canResize })=>{
5117
5275
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
5118
5276
  id: "resource-preview",
5119
5277
  className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
5120
5278
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
5121
- // filterTitle="Filter columns"
5122
5279
  data: resource.values,
5123
5280
  canResize: canResize,
5124
5281
  sortDefaults: defaultSort,
5125
5282
  columns: customColumns ? customColumns : $626282d9a03c51d5$export$1147582dfae658c6(resource.columns, resource.schema[id]),
5126
- // schema={resource.schema}
5127
- // totalRows={parseInt(resource.totalRows)}
5128
- // limit={resource.limit}
5129
- // offset={resource.offset}
5130
- // loading={resource.loading}
5131
5283
  setSort: resource.setSort,
5132
- // setConditions={resource.setConditions}
5133
- // conditionsTransform={transformTableFilterToQueryCondition}
5134
5284
  sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
5135
5285
  tablePadding: tablePadding,
5136
5286
  className: "dc-c-datatable",
@@ -5400,8 +5550,6 @@ function $3b6ca952e79f0695$var$updateQueryForDatastore(condition) {
5400
5550
  const $3b6ca952e79f0695$var$QueryBuilder = ({ resource: resource, id: id, includeSearchParams: includeSearchParams, customColumns: customColumns })=>{
5401
5551
  const { conditions: conditions, schema: schema, setConditions: setConditions } = resource;
5402
5552
  const fields = Object.keys(schema[id].fields);
5403
- const hasConditions = conditions.length > 0;
5404
- const [queryCount, setQueryCount] = (0, $hgUW1$useState)(0);
5405
5553
  const [queryConditions, setQueryConditions] = (0, $hgUW1$useState)([]);
5406
5554
  const [titleConditions, setTitleConditions] = (0, $hgUW1$useState)([]); // Add use effect to load conditions on first load if needed
5407
5555
  const [conditionsChanged, setConditionsChanged] = (0, $hgUW1$useState)(false);