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

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
@@ -3012,7 +3012,7 @@ var $71b4324f265dec16$export$2e2bcd8739ae039 = $71b4324f265dec16$var$DataTableCo
3012
3012
 
3013
3013
 
3014
3014
 
3015
- const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, setSort: setSort, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3015
+ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, sortTransform: sortTransform, tablePadding: tablePadding, canResize: canResize, loading: loading = false, isModal: isModal, closeFullScreenModal: closeFullScreenModal })=>{
3016
3016
  const { id: id, resource: resource, datasetTableControls: datasetTableControls } = (0, $hgUW1$useContext)((0, $a0f13962e513caa1$export$a7997ae78b143b));
3017
3017
  const { columnOrder: columnOrder, setColumnOrder: setColumnOrder, columnVisibility: columnVisibility, setColumnVisibility: setColumnVisibility } = (0, $hgUW1$useContext)((0, $39bc4d98030a5599$export$a5806b00c0db0089));
3018
3018
  const data = resource.values;
@@ -3059,7 +3059,7 @@ const $d98f94c79ddf4e0e$var$DataTable = ({ columns: columns, setSort: setSort, s
3059
3059
  });
3060
3060
  (0, $hgUW1$useEffect)(()=>{
3061
3061
  const normalizedSort = sortTransform ? sortTransform(sorting) : filters;
3062
- setSort(normalizedSort);
3062
+ resource.setSort(normalizedSort);
3063
3063
  }, [
3064
3064
  sorting
3065
3065
  ]);
@@ -3916,7 +3916,6 @@ const $a35cf16d1488f54e$var$DatasetTable = ({ isModal: isModal = false, closeFul
3916
3916
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
3917
3917
  canResize: true,
3918
3918
  columns: columns,
3919
- setSort: resource.setSort,
3920
3919
  sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
3921
3920
  tablePadding: "ds-u-padding-y--2",
3922
3921
  loading: resource.loading,
@@ -5847,6 +5846,7 @@ var $af099c546cb226c7$export$2e2bcd8739ae039 = $af099c546cb226c7$var$ResourceHea
5847
5846
 
5848
5847
 
5849
5848
 
5849
+
5850
5850
  function $626282d9a03c51d5$export$1147582dfae658c6(columns, schema) {
5851
5851
  return columns.map((column)=>({
5852
5852
  header: schema && schema.fields[column].description ? schema.fields[column].description : column,
@@ -5864,35 +5864,18 @@ function $626282d9a03c51d5$var$DefaultColumnFilter({ column: { Header: Header, a
5864
5864
  value: filterValue || ""
5865
5865
  });
5866
5866
  }
5867
- const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding, id: id, options: options, resource: resource, defaultSort: defaultSort, customColumns: customColumns, canResize: canResize })=>{
5867
+ const $626282d9a03c51d5$var$ResourcePreview = ({ tablePadding: tablePadding, id: id, canResize: canResize })=>{
5868
+ const { resource: resource, customColumns: customColumns } = (0, $hgUW1$useContext)((0, $a0f13962e513caa1$export$a7997ae78b143b));
5868
5869
  return /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
5869
5870
  id: "resource-preview",
5870
5871
  className: "ds-u-overflow--auto ds-u-border-x--1 ds-u-border-bottom--1",
5871
5872
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $d98f94c79ddf4e0e$export$2e2bcd8739ae039), {
5872
- data: resource.values,
5873
5873
  canResize: canResize,
5874
- sortDefaults: defaultSort,
5875
5874
  columns: customColumns ? customColumns : $626282d9a03c51d5$export$1147582dfae658c6(resource.columns, resource.schema[id]),
5876
- setSort: resource.setSort,
5877
5875
  sortTransform: (0, $aa4450dcbeef3ac0$export$385a5aba38cc3325),
5878
5876
  tablePadding: tablePadding,
5879
5877
  className: "dc-c-datatable",
5880
- customColumnFilter: $626282d9a03c51d5$var$DefaultColumnFilter,
5881
- options: options,
5882
- CustomLoadingComponent: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
5883
- className: "ds-u-display--flex ds-u-padding--3",
5884
- children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
5885
- className: "ds-u-valign--middle",
5886
- role: "status",
5887
- "aria-valuetext": "Datatable loading"
5888
- })
5889
- }),
5890
- CustomNoResults: /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
5891
- className: "ds-u-display--flex ds-u-padding--3",
5892
- children: /*#__PURE__*/ (0, $hgUW1$jsx)("p", {
5893
- children: "No results returned."
5894
- })
5895
- })
5878
+ customColumnFilter: $626282d9a03c51d5$var$DefaultColumnFilter
5896
5879
  })
5897
5880
  });
5898
5881
  };
@@ -6290,15 +6273,14 @@ var $de780c924c98fa31$export$2e2bcd8739ae039 = $de780c924c98fa31$var$FilteredRes
6290
6273
 
6291
6274
 
6292
6275
 
6276
+
6277
+
6293
6278
  const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset, distIndex: distIndex, location: location, additionalParams: additionalParams, customColumns: customColumns, columnSettings: columnSettings, columnWidths: columnWidths, customTitle: customTitle, rootUrl: rootUrl })=>{
6294
- const navigate = (0, $hgUW1$useNavigate)();
6295
6279
  const [tablePadding, setTablePadding] = (0, $hgUW1$react).useState("ds-u-padding-y--1");
6296
6280
  let apiDocs = (0, $hgUW1$useRef)();
6297
- const [filtersOpen, setFiltersOpen] = (0, $hgUW1$react).useState(false);
6298
6281
  let distribution = {};
6299
6282
  let distribution_array = dataset.distribution ? dataset.distribution : [];
6300
6283
  if (distribution_array.length) distribution = distribution_array.find((dist)=>dist.identifier === distribution_array[distIndex].identifier);
6301
- let buttonRef = null;
6302
6284
  const options = location.search ? {
6303
6285
  ...(0, $hgUW1$qs).parse(location.search, {
6304
6286
  ignoreQueryPrefix: true
@@ -6306,7 +6288,6 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset,
6306
6288
  } : {
6307
6289
  conditions: []
6308
6290
  };
6309
- let conditions = options.conditions.length ? options.conditions : [];
6310
6291
  const resource = (0, $1d3d480a9cfaabe0$export$2e2bcd8739ae039)("", rootUrl, {
6311
6292
  ...options,
6312
6293
  limit: 25
@@ -6365,7 +6346,7 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset,
6365
6346
  dataset: dataset
6366
6347
  })
6367
6348
  }),
6368
- resource.columns && Object.keys(resource.schema).length && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
6349
+ Object.keys(resource).length && resource.columns && Object.keys(resource.schema).length && /*#__PURE__*/ (0, $hgUW1$jsx)("div", {
6369
6350
  className: "ds-l-md-col--12",
6370
6351
  children: /*#__PURE__*/ (0, $hgUW1$jsx)((0, $3b6ca952e79f0695$export$2e2bcd8739ae039), {
6371
6352
  resource: resource,
@@ -6373,36 +6354,49 @@ const $dd6eb2b30d7ad75d$var$FilteredResourceBody = ({ id: id, dataset: dataset,
6373
6354
  customColumns: customColumns
6374
6355
  })
6375
6356
  }),
6376
- resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
6377
- className: "ds-l-md-col--12",
6378
- children: [
6379
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
6380
- includeDensity: true,
6381
- setTablePadding: setTablePadding,
6382
- distribution: distribution,
6383
- resource: resource,
6384
- downloadUrl: downloadUrl,
6385
- tablePadding: tablePadding,
6386
- includeDownload: true
6387
- }),
6388
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
6389
- id: distribution.identifier,
6390
- tablePadding: tablePadding,
6391
- resource: resource,
6392
- customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[distIndex].identifier]),
6393
- columnSettings: columnSettings,
6394
- options: {
6395
- layout: "flex",
6396
- columnFilter: false,
6397
- columnSort: true,
6398
- columnResize: true
6399
- },
6400
- columnWidths: columnWidths
6401
- }),
6402
- /*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
6403
- resource: resource
6404
- })
6405
- ]
6357
+ Object.keys(resource).length && resource.columns && Object.keys(resource.schema).length ? /*#__PURE__*/ (0, $hgUW1$jsx)((0, $a0f13962e513caa1$export$a7997ae78b143b).Provider, {
6358
+ value: {
6359
+ id: id,
6360
+ resource: resource,
6361
+ distribution: distribution,
6362
+ rootUrl: rootUrl,
6363
+ customColumns: (0, $7264a673914aa746$export$8049e8f40a9bdfb8)(customColumns, resource.columns, resource.schema[distribution_array[distIndex].identifier])
6364
+ },
6365
+ children: /*#__PURE__*/ (0, $hgUW1$jsxs)("div", {
6366
+ className: "ds-l-md-col--12",
6367
+ children: [
6368
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $af099c546cb226c7$export$2e2bcd8739ae039), {
6369
+ includeDensity: true,
6370
+ setTablePadding: setTablePadding,
6371
+ distribution: distribution,
6372
+ resource: resource,
6373
+ downloadUrl: downloadUrl,
6374
+ tablePadding: tablePadding,
6375
+ includeDownload: true
6376
+ }),
6377
+ /*#__PURE__*/ (0, $hgUW1$jsxs)((0, $39bc4d98030a5599$export$a5806b00c0db0089).Provider, {
6378
+ value: {
6379
+ columnOrder: [],
6380
+ setColumnOrder: ()=>{},
6381
+ columnVisibility: {},
6382
+ setColumnVisibility: ()=>{},
6383
+ page: 1,
6384
+ setPage: ()=>{}
6385
+ },
6386
+ children: [
6387
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $626282d9a03c51d5$export$2e2bcd8739ae039), {
6388
+ id: distribution.identifier,
6389
+ tablePadding: tablePadding,
6390
+ columnSettings: columnSettings,
6391
+ columnWidths: columnWidths
6392
+ }),
6393
+ /*#__PURE__*/ (0, $hgUW1$jsx)((0, $072291d44ce1834a$export$2e2bcd8739ae039), {
6394
+ resource: resource
6395
+ })
6396
+ ]
6397
+ })
6398
+ ]
6399
+ })
6406
6400
  }) : /*#__PURE__*/ (0, $hgUW1$jsx)((0, $hgUW1$Spinner), {
6407
6401
  role: "status",
6408
6402
  "aria-valuetext": "Resource loading"