datastake-daf 0.6.169 → 0.6.171
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/components/index.js +163 -146
- package/dist/utils/index.js +42 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Filters/FloatingFilters/index.js +35 -41
- package/src/@daf/core/components/Filters/selectFilters/index.jsx +4 -3
- package/src/@daf/core/components/Header/Header.stories.js +117 -0
- package/src/@daf/core/components/Header/hook.js +110 -75
- package/src/@daf/core/components/Header/index.jsx +4 -1
- package/src/@daf/core/components/UI/SDGIcon/index.jsx +3 -11
- package/src/@daf/core/components/UI/SDGIcon/styles.js +0 -2
- package/src/index.js +1 -3
- package/.env +0 -8
- package/.vscode/settings.json +0 -13
- package/src/@daf/core/components/Filters/FloatingFilters/FloatingFilters.stories.jsx +0 -64
package/dist/components/index.js
CHANGED
|
@@ -9859,7 +9859,8 @@ const SelectFilters = _ref => {
|
|
|
9859
9859
|
apiUrl,
|
|
9860
9860
|
t = s => s,
|
|
9861
9861
|
language = 'en',
|
|
9862
|
-
type = 'default'
|
|
9862
|
+
type = 'default',
|
|
9863
|
+
isHeader = false
|
|
9863
9864
|
} = _ref;
|
|
9864
9865
|
const [filters, setFilters] = React.useState(selectedFilters || {});
|
|
9865
9866
|
const [initFilters, setInitFilters] = React.useState(selectedFilters || {});
|
|
@@ -9926,7 +9927,7 @@ const SelectFilters = _ref => {
|
|
|
9926
9927
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9927
9928
|
className: formatClassname([className, 'daf-select-filters', type]),
|
|
9928
9929
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
9929
|
-
className: formatClassname(['filters', entries.length === 0 && 'empty']),
|
|
9930
|
+
className: formatClassname(['filters', entries.length === 0 && 'empty', isHeader && 'px-0 pt-1']),
|
|
9930
9931
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9931
9932
|
className: "filters-cont",
|
|
9932
9933
|
children: entries.filter(_ref4 => {
|
|
@@ -9934,17 +9935,10 @@ const SelectFilters = _ref => {
|
|
|
9934
9935
|
return !(typeof v.show === 'function' ? v.show(filters) : false);
|
|
9935
9936
|
}).map((_ref5, i) => {
|
|
9936
9937
|
let [k, v] = _ref5;
|
|
9937
|
-
return /*#__PURE__*/jsxRuntime.
|
|
9938
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9938
9939
|
style: v.style,
|
|
9939
9940
|
className: "cont",
|
|
9940
|
-
children:
|
|
9941
|
-
children: typeof v.label === 'function' ? v.label({
|
|
9942
|
-
filters,
|
|
9943
|
-
options,
|
|
9944
|
-
t,
|
|
9945
|
-
language
|
|
9946
|
-
}) : t(v.label)
|
|
9947
|
-
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
9941
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
9948
9942
|
children: [v.type === 'select' && options[k] && /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
9949
9943
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomSelect$1, {
|
|
9950
9944
|
config: v,
|
|
@@ -9983,7 +9977,7 @@ const SelectFilters = _ref => {
|
|
|
9983
9977
|
onChange: e => onChange(e.target.value, k)
|
|
9984
9978
|
})
|
|
9985
9979
|
})]
|
|
9986
|
-
})
|
|
9980
|
+
})
|
|
9987
9981
|
}, i.toString());
|
|
9988
9982
|
})
|
|
9989
9983
|
}), showFilters && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -12398,25 +12392,29 @@ function Loading(_ref) {
|
|
|
12398
12392
|
const {
|
|
12399
12393
|
Paragraph
|
|
12400
12394
|
} = antd.Typography;
|
|
12401
|
-
const useHeader =
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
|
|
12407
|
-
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12419
|
-
|
|
12395
|
+
const useHeader = _ref => {
|
|
12396
|
+
let {
|
|
12397
|
+
title = '',
|
|
12398
|
+
tooltip = '',
|
|
12399
|
+
supportText = '',
|
|
12400
|
+
tags = [],
|
|
12401
|
+
actionButtons: _actionButtons = [],
|
|
12402
|
+
titleTooltip,
|
|
12403
|
+
className,
|
|
12404
|
+
addedHeader = null,
|
|
12405
|
+
addedHeaderFirst,
|
|
12406
|
+
extraButtons: _extraButtons = [],
|
|
12407
|
+
onDownload,
|
|
12408
|
+
downloadDisabled,
|
|
12409
|
+
goBackTo,
|
|
12410
|
+
loading,
|
|
12411
|
+
renderExtraComponents,
|
|
12412
|
+
app = '',
|
|
12413
|
+
isViewMode = false,
|
|
12414
|
+
filtersConfig = {}
|
|
12415
|
+
} = _ref;
|
|
12416
|
+
const [showFilters, setShowFilters] = React.useState(false);
|
|
12417
|
+
const hasFilters = !!filtersConfig;
|
|
12420
12418
|
const downloadButtonAction = app && app === 'sbg' && isViewMode ? null : {
|
|
12421
12419
|
onClick: onDownload,
|
|
12422
12420
|
disabled: downloadDisabled,
|
|
@@ -12436,15 +12434,24 @@ const useHeader = ({
|
|
|
12436
12434
|
noMinWidth: true,
|
|
12437
12435
|
className: 'download-btn'
|
|
12438
12436
|
};
|
|
12439
|
-
const
|
|
12437
|
+
const filterButton = [{
|
|
12438
|
+
icon: 'Filter',
|
|
12439
|
+
key: 'filters',
|
|
12440
|
+
noMinWidth: true,
|
|
12441
|
+
squareIconButton: true,
|
|
12442
|
+
onClick: () => {
|
|
12443
|
+
setShowFilters(p => !p);
|
|
12444
|
+
}
|
|
12445
|
+
}];
|
|
12446
|
+
const actionButtons = onDownload && _actionButtons.length < 3 ? [..._actionButtons, ...(hasFilters ? filterButton : []), downloadButton] : _actionButtons;
|
|
12440
12447
|
const extraButtons = onDownload && _actionButtons.length >= 3 ? [..._extraButtons, downloadButtonAction] : _extraButtons;
|
|
12441
12448
|
const mainCont = React.useRef();
|
|
12442
12449
|
const buttonCont = React.useRef();
|
|
12443
12450
|
const [mainContWidth, setMainContWidth] = React.useState(600);
|
|
12444
12451
|
const [buttonContWidth, setButtonContWidth] = React.useState(0);
|
|
12445
|
-
const hasSupportText = !!supportText
|
|
12446
|
-
const hasTags = !!tags
|
|
12447
|
-
const hasButtons = !!(actionButtons
|
|
12452
|
+
const hasSupportText = !!(supportText !== null && supportText !== void 0 && supportText.length);
|
|
12453
|
+
const hasTags = !!(tags !== null && tags !== void 0 && tags.length);
|
|
12454
|
+
const hasButtons = !!(actionButtons !== null && actionButtons !== void 0 && actionButtons.length || extraButtons !== null && extraButtons !== void 0 && extraButtons.length);
|
|
12448
12455
|
React.useEffect(() => {
|
|
12449
12456
|
const mainContObserver = new ResizeObserver(entries => {
|
|
12450
12457
|
const _mainEntry = entries[0];
|
|
@@ -12476,99 +12483,120 @@ const useHeader = ({
|
|
|
12476
12483
|
}, []);
|
|
12477
12484
|
const maxWidth = React.useMemo(() => mainContWidth - buttonContWidth - 24, [mainContWidth, buttonContWidth]);
|
|
12478
12485
|
const renderMainCont = () => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12479
|
-
className: formatClassname(["main-cont flex", className]),
|
|
12480
|
-
ref: mainCont,
|
|
12481
12486
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12482
|
-
className: "
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
},
|
|
12489
|
-
children: [goBackTo && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
12490
|
-
className: "flex mr-xs no-min-width",
|
|
12491
|
-
onClick: () => goBackTo(),
|
|
12487
|
+
className: formatClassname(["main-cont flex", className]),
|
|
12488
|
+
ref: mainCont,
|
|
12489
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12490
|
+
className: "flex-1 flex flex-column justify-content-center",
|
|
12491
|
+
children: [typeof title === "string" ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12492
|
+
className: formatClassname(["title flex", hasSupportText && "mb-1"]),
|
|
12492
12493
|
style: {
|
|
12493
|
-
|
|
12494
|
-
|
|
12495
|
-
minWidth: "25px",
|
|
12496
|
-
borderRadius: "4px",
|
|
12497
|
-
opacity: loading ? 0 : 1
|
|
12494
|
+
maxWidth,
|
|
12495
|
+
alignItems: "center"
|
|
12498
12496
|
},
|
|
12499
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
12500
|
-
|
|
12497
|
+
children: [goBackTo && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
12498
|
+
className: "flex mr-xs no-min-width",
|
|
12499
|
+
onClick: () => goBackTo(),
|
|
12500
|
+
style: {
|
|
12501
|
+
padding: 2,
|
|
12502
|
+
height: "25px",
|
|
12503
|
+
minWidth: "25px",
|
|
12504
|
+
borderRadius: "4px",
|
|
12505
|
+
opacity: loading ? 0 : 1
|
|
12506
|
+
},
|
|
12507
|
+
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
12508
|
+
name: "Right",
|
|
12509
|
+
style: {
|
|
12510
|
+
transform: "rotate(180deg)",
|
|
12511
|
+
width: "12px",
|
|
12512
|
+
color: "var(--base-gray-70)"
|
|
12513
|
+
}
|
|
12514
|
+
})
|
|
12515
|
+
}), loading ? /*#__PURE__*/jsxRuntime.jsx(antd.Skeleton, {
|
|
12516
|
+
active: true,
|
|
12517
|
+
title: false,
|
|
12518
|
+
paragraph: {
|
|
12519
|
+
rows: 1
|
|
12520
|
+
},
|
|
12501
12521
|
style: {
|
|
12502
|
-
|
|
12503
|
-
width: "12px",
|
|
12504
|
-
color: "var(--base-gray-70)"
|
|
12522
|
+
marginTop: '10px'
|
|
12505
12523
|
}
|
|
12506
|
-
})
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
},
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Icons.InfoCircleOutlined, {})
|
|
12529
|
-
}) : typeof tooltip === "object" ? /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
|
|
12530
|
-
rootClassName: formatClassname(["header-tooltip", tooltip.className]),
|
|
12531
|
-
title: tooltip.title,
|
|
12532
|
-
content: tooltip.content,
|
|
12533
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Icons.InfoCircleOutlined, {})
|
|
12534
|
-
}) : null
|
|
12535
|
-
}), typeof renderExtraComponents === "function" ? renderExtraComponents() : null, hasTags && /*#__PURE__*/jsxRuntime.jsx(Tags, {
|
|
12536
|
-
tags: tags
|
|
12524
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
12525
|
+
title: titleTooltip || title,
|
|
12526
|
+
children: /*#__PURE__*/jsxRuntime.jsx("h2", {
|
|
12527
|
+
className: formatClassname(["mb-0 mr-1", hasButtons && "limited"]),
|
|
12528
|
+
children: title
|
|
12529
|
+
})
|
|
12530
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12531
|
+
className: "flex",
|
|
12532
|
+
children: [!!tooltip && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12533
|
+
className: "flex flex-column justify-content-center",
|
|
12534
|
+
children: typeof tooltip === "string" ? /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
12535
|
+
title: tooltip,
|
|
12536
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icons.InfoCircleOutlined, {})
|
|
12537
|
+
}) : typeof tooltip === "object" ? /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
|
|
12538
|
+
rootClassName: formatClassname(["header-tooltip", tooltip.className]),
|
|
12539
|
+
title: tooltip.title,
|
|
12540
|
+
content: tooltip.content,
|
|
12541
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Icons.InfoCircleOutlined, {})
|
|
12542
|
+
}) : null
|
|
12543
|
+
}), typeof renderExtraComponents === "function" ? renderExtraComponents() : null, hasTags && /*#__PURE__*/jsxRuntime.jsx(Tags, {
|
|
12544
|
+
tags: tags
|
|
12545
|
+
})]
|
|
12537
12546
|
})]
|
|
12538
|
-
})
|
|
12539
|
-
}) : typeof title === "function" ? title(maxWidth) : title, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12540
|
-
style: {
|
|
12541
|
-
marginLeft: goBackTo ? "33px" : 0
|
|
12542
|
-
},
|
|
12543
|
-
className: "support-text",
|
|
12544
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Paragraph, {
|
|
12545
|
-
ellipsis: {
|
|
12546
|
-
tooltip: supportText,
|
|
12547
|
-
rows: 1
|
|
12548
|
-
},
|
|
12547
|
+
}) : typeof title === "function" ? title(maxWidth) : title, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12549
12548
|
style: {
|
|
12550
|
-
|
|
12549
|
+
marginLeft: goBackTo ? "33px" : 0
|
|
12551
12550
|
},
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12551
|
+
className: "support-text",
|
|
12552
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Paragraph, {
|
|
12553
|
+
ellipsis: {
|
|
12554
|
+
tooltip: supportText,
|
|
12555
|
+
rows: 1
|
|
12556
|
+
},
|
|
12557
|
+
style: {
|
|
12558
|
+
maxWidth: maxWidth
|
|
12559
|
+
},
|
|
12560
|
+
children: supportText
|
|
12561
|
+
})
|
|
12562
|
+
})]
|
|
12563
|
+
}), addedHeaderFirst ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12564
|
+
className: "flex gap-2",
|
|
12565
|
+
children: [addedHeader, hasButtons && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12566
|
+
ref: buttonCont,
|
|
12567
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Buttons, {
|
|
12568
|
+
extraButtons: extraButtons,
|
|
12569
|
+
actionButtons: actionButtons
|
|
12570
|
+
})
|
|
12571
|
+
})]
|
|
12572
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
12573
|
+
children: [hasButtons && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12574
|
+
ref: buttonCont,
|
|
12575
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Buttons, {
|
|
12576
|
+
extraButtons: extraButtons,
|
|
12577
|
+
actionButtons: actionButtons
|
|
12578
|
+
})
|
|
12579
|
+
}), addedHeader]
|
|
12563
12580
|
})]
|
|
12564
|
-
})
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12581
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12582
|
+
style: {
|
|
12583
|
+
marginLeft: goBackTo ? "33px" : 0,
|
|
12584
|
+
width: '100%'
|
|
12585
|
+
},
|
|
12586
|
+
children: hasFilters && /*#__PURE__*/jsxRuntime.jsx(SelectFilters, {
|
|
12587
|
+
t: filtersConfig.t,
|
|
12588
|
+
apiUrl: filtersConfig.apiUrl,
|
|
12589
|
+
showFilters: showFilters,
|
|
12590
|
+
onApply: filtersConfig.onApply,
|
|
12591
|
+
options: filtersConfig.options,
|
|
12592
|
+
setShowFilters: setShowFilters,
|
|
12593
|
+
language: filtersConfig.language,
|
|
12594
|
+
type: filtersConfig.type,
|
|
12595
|
+
filtersConfig: filtersConfig.filtersConfig,
|
|
12596
|
+
selectedFilters: filtersConfig.selectedFilters,
|
|
12597
|
+
className: filtersConfig.className,
|
|
12598
|
+
isHeader: true
|
|
12599
|
+
})
|
|
12572
12600
|
})]
|
|
12573
12601
|
});
|
|
12574
12602
|
return {
|
|
@@ -12692,7 +12720,8 @@ function DAFHeader(_ref) {
|
|
|
12692
12720
|
loading,
|
|
12693
12721
|
renderExtraComponents,
|
|
12694
12722
|
app = "",
|
|
12695
|
-
isViewMode = false
|
|
12723
|
+
isViewMode = false,
|
|
12724
|
+
filtersConfig = {}
|
|
12696
12725
|
} = _ref;
|
|
12697
12726
|
const showBreadcrumbs = !!breadcrumbs.length;
|
|
12698
12727
|
const {
|
|
@@ -12714,7 +12743,8 @@ function DAFHeader(_ref) {
|
|
|
12714
12743
|
loading,
|
|
12715
12744
|
renderExtraComponents,
|
|
12716
12745
|
app,
|
|
12717
|
-
isViewMode
|
|
12746
|
+
isViewMode,
|
|
12747
|
+
filtersConfig
|
|
12718
12748
|
});
|
|
12719
12749
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12720
12750
|
className: "daf-header",
|
|
@@ -12735,7 +12765,8 @@ DAFHeader.propTypes = {
|
|
|
12735
12765
|
tags: PropTypes__default["default"].any,
|
|
12736
12766
|
actionButtons: PropTypes__default["default"].array,
|
|
12737
12767
|
extraButtons: PropTypes__default["default"].array,
|
|
12738
|
-
downloadDisabled: PropTypes__default["default"].any
|
|
12768
|
+
downloadDisabled: PropTypes__default["default"].any,
|
|
12769
|
+
filtersConfig: PropTypes__default["default"].any
|
|
12739
12770
|
};
|
|
12740
12771
|
|
|
12741
12772
|
const _excluded$m = ["tabs", "onChange", "value", "className"];
|
|
@@ -18244,12 +18275,6 @@ function Filters({
|
|
|
18244
18275
|
})
|
|
18245
18276
|
})]
|
|
18246
18277
|
});
|
|
18247
|
-
// case "slider":
|
|
18248
|
-
// return (
|
|
18249
|
-
// <div className="form-row">
|
|
18250
|
-
// <label>{filter.label}</label>
|
|
18251
|
-
// </div>
|
|
18252
|
-
// );
|
|
18253
18278
|
default:
|
|
18254
18279
|
return null;
|
|
18255
18280
|
}
|
|
@@ -20481,18 +20506,15 @@ const SDGList = dt.ul`
|
|
|
20481
20506
|
justify-content: center;
|
|
20482
20507
|
background: var(--base-gray-30);
|
|
20483
20508
|
color: var(--base-gray-90);
|
|
20484
|
-
border-radius: 8px;
|
|
20485
|
-
border: 1px solid var(--base-gray-30);
|
|
20486
20509
|
}
|
|
20487
20510
|
`;
|
|
20488
20511
|
|
|
20489
20512
|
const GAP_BETWEEN_SDGS = 4;
|
|
20490
|
-
function SDGIcons(
|
|
20491
|
-
|
|
20492
|
-
|
|
20493
|
-
|
|
20494
|
-
|
|
20495
|
-
} = _ref;
|
|
20513
|
+
function SDGIcons({
|
|
20514
|
+
sdgList = [],
|
|
20515
|
+
t = str => str,
|
|
20516
|
+
iconSize = 24
|
|
20517
|
+
}) {
|
|
20496
20518
|
const containerRef = React__default["default"].useRef(null);
|
|
20497
20519
|
const [width, setWidth] = React__default["default"].useState(0);
|
|
20498
20520
|
React__default["default"].useEffect(() => {
|
|
@@ -20533,10 +20555,10 @@ function SDGIcons(_ref) {
|
|
|
20533
20555
|
children: [visibleSdgs.map((sdg, index) => /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
20534
20556
|
className: "project-widget-item",
|
|
20535
20557
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20536
|
-
title: t(
|
|
20558
|
+
title: t(`SDGS::${sdg}`),
|
|
20537
20559
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20538
20560
|
style: {
|
|
20539
|
-
backgroundImage:
|
|
20561
|
+
backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
|
|
20540
20562
|
height: iconSize,
|
|
20541
20563
|
width: iconSize
|
|
20542
20564
|
},
|
|
@@ -20555,25 +20577,21 @@ function SDGIcons(_ref) {
|
|
|
20555
20577
|
maxWidth: 200
|
|
20556
20578
|
},
|
|
20557
20579
|
children: sdgList.slice(visibleSdgs.length).map((sdg, idx) => /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20558
|
-
title: t(
|
|
20580
|
+
title: t(`SDGS::${sdg}`),
|
|
20559
20581
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20560
20582
|
style: {
|
|
20561
20583
|
width: iconSize,
|
|
20562
20584
|
height: iconSize,
|
|
20563
|
-
backgroundImage:
|
|
20585
|
+
backgroundImage: `url(${SDG_IMAGES[sdg].img})`,
|
|
20564
20586
|
backgroundSize: "cover",
|
|
20565
20587
|
borderRadius: 4
|
|
20566
20588
|
},
|
|
20567
|
-
title: t(
|
|
20589
|
+
title: t(`SDGS::${sdg}`)
|
|
20568
20590
|
})
|
|
20569
20591
|
}, idx))
|
|
20570
20592
|
}),
|
|
20571
20593
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
20572
20594
|
className: "sdg-item-image sdg-item-more",
|
|
20573
|
-
style: {
|
|
20574
|
-
height: iconSize,
|
|
20575
|
-
width: iconSize
|
|
20576
|
-
},
|
|
20577
20595
|
children: ["+", hiddenCount]
|
|
20578
20596
|
})
|
|
20579
20597
|
})
|
|
@@ -60236,7 +60254,6 @@ exports.ProjectVisualisationSelect = CustomSelect;
|
|
|
60236
60254
|
exports.ProjectWidget = ProjectWidget;
|
|
60237
60255
|
exports.RadarChart = RadarChart;
|
|
60238
60256
|
exports.RadialBarChart = RadialBarChart;
|
|
60239
|
-
exports.SDGIcons = SDGIcons;
|
|
60240
60257
|
exports.SDGWidget = SDGWidget;
|
|
60241
60258
|
exports.SearchFilters = SearchFilters;
|
|
60242
60259
|
exports.Segment = Segment;
|
package/dist/utils/index.js
CHANGED
|
@@ -4946,6 +4946,48 @@ dt.div`
|
|
|
4946
4946
|
}
|
|
4947
4947
|
`;
|
|
4948
4948
|
|
|
4949
|
+
({
|
|
4950
|
+
value: PropTypes__default["default"].object,
|
|
4951
|
+
filterSelectOptions: PropTypes__default["default"].func,
|
|
4952
|
+
placeholder: PropTypes__default["default"].string,
|
|
4953
|
+
onChange: PropTypes__default["default"].func,
|
|
4954
|
+
disabled: PropTypes__default["default"].bool,
|
|
4955
|
+
options: PropTypes__default["default"].any,
|
|
4956
|
+
i: PropTypes__default["default"].number,
|
|
4957
|
+
k: PropTypes__default["default"].string,
|
|
4958
|
+
filters: PropTypes__default["default"].object,
|
|
4959
|
+
config: PropTypes__default["default"].object
|
|
4960
|
+
});
|
|
4961
|
+
|
|
4962
|
+
({
|
|
4963
|
+
t: PropTypes__default["default"].func,
|
|
4964
|
+
value: PropTypes__default["default"].string,
|
|
4965
|
+
disabled: PropTypes__default["default"].bool,
|
|
4966
|
+
onChange: PropTypes__default["default"].func
|
|
4967
|
+
});
|
|
4968
|
+
|
|
4969
|
+
({
|
|
4970
|
+
config: PropTypes__default["default"].object,
|
|
4971
|
+
filters: PropTypes__default["default"].object,
|
|
4972
|
+
k: PropTypes__default["default"].string,
|
|
4973
|
+
setValue: PropTypes__default["default"].func,
|
|
4974
|
+
isEdit: PropTypes__default["default"].bool,
|
|
4975
|
+
placeholder: PropTypes__default["default"].string
|
|
4976
|
+
});
|
|
4977
|
+
|
|
4978
|
+
({
|
|
4979
|
+
t: PropTypes__default["default"].func,
|
|
4980
|
+
onApply: PropTypes__default["default"].func,
|
|
4981
|
+
options: PropTypes__default["default"].object,
|
|
4982
|
+
className: PropTypes__default["default"].string,
|
|
4983
|
+
showFilters: PropTypes__default["default"].bool,
|
|
4984
|
+
setShowFilters: PropTypes__default["default"].func,
|
|
4985
|
+
filtersConfig: PropTypes__default["default"].object,
|
|
4986
|
+
selectedFilters: PropTypes__default["default"].object,
|
|
4987
|
+
language: PropTypes__default["default"].string,
|
|
4988
|
+
apiUrl: PropTypes__default["default"].string
|
|
4989
|
+
});
|
|
4990
|
+
|
|
4949
4991
|
({
|
|
4950
4992
|
tabs: PropTypes__default["default"].array,
|
|
4951
4993
|
onChange: PropTypes__default["default"].func,
|
package/package.json
CHANGED
|
@@ -4,48 +4,42 @@ import { Fragment, useState } from "react";
|
|
|
4
4
|
import Style from "./style.js";
|
|
5
5
|
|
|
6
6
|
export default function Filters({ t, filtersConfig, onFilterChange }) {
|
|
7
|
-
|
|
7
|
+
const [opened, setOpened] = useState(false);
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// </div>
|
|
29
|
-
// );
|
|
30
|
-
default:
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
9
|
+
const renderFilter = (filter) => {
|
|
10
|
+
switch (filter.type) {
|
|
11
|
+
case "select":
|
|
12
|
+
return (
|
|
13
|
+
<div className="form-row">
|
|
14
|
+
<label>{filter.label}</label>
|
|
15
|
+
<Select
|
|
16
|
+
allowClear
|
|
17
|
+
placeholder={filter.placeholder}
|
|
18
|
+
value={filter.value}
|
|
19
|
+
options={filter.options}
|
|
20
|
+
onChange={(c) => onFilterChange({ [filter.key]: c })}
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
default:
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
return (
|
|
30
|
+
<Style>
|
|
31
|
+
<Button onClick={() => setOpened((p) => !p)}>
|
|
32
|
+
{t("Filter")}
|
|
33
|
+
<CustomIcon width={16} height={16} name="Filter" />
|
|
34
|
+
</Button>
|
|
41
35
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
{opened ? (
|
|
37
|
+
<div className="filters">
|
|
38
|
+
{filtersConfig?.map((filter) => (
|
|
39
|
+
<Fragment key={filter.key}>{renderFilter(filter)}</Fragment>
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
) : null}
|
|
43
|
+
</Style>
|
|
44
|
+
);
|
|
51
45
|
}
|
|
@@ -21,6 +21,7 @@ const SelectFilters = ({
|
|
|
21
21
|
t = (s) => s,
|
|
22
22
|
language = 'en',
|
|
23
23
|
type = 'default',
|
|
24
|
+
isHeader = false,
|
|
24
25
|
}) => {
|
|
25
26
|
const [filters, setFilters] = useState(selectedFilters || {});
|
|
26
27
|
const [initFilters, setInitFilters] = useState(selectedFilters || {})
|
|
@@ -101,17 +102,17 @@ const SelectFilters = ({
|
|
|
101
102
|
|
|
102
103
|
return (
|
|
103
104
|
<div className={formatClassname([className, 'daf-select-filters', type])}>
|
|
104
|
-
<div className={formatClassname(['filters', entries.length === 0 && 'empty'])}>
|
|
105
|
+
<div className={formatClassname(['filters', entries.length === 0 && 'empty', isHeader && 'px-0 pt-1'])}>
|
|
105
106
|
<div className="filters-cont">
|
|
106
107
|
{entries.filter(([, v]) => !(typeof v.show === 'function' ? v.show(filters) : false)).map(([k, v], i) => (
|
|
107
108
|
<div key={i.toString()} style={v.style} className="cont">
|
|
108
|
-
<label>
|
|
109
|
+
{/* <label>
|
|
109
110
|
{
|
|
110
111
|
typeof v.label === 'function' ?
|
|
111
112
|
v.label({ filters, options, t, language })
|
|
112
113
|
: t(v.label)
|
|
113
114
|
}
|
|
114
|
-
</label>
|
|
115
|
+
</label> */}
|
|
115
116
|
<div>
|
|
116
117
|
{(v.type === 'select' && options[k]) && (
|
|
117
118
|
<>
|
|
@@ -97,3 +97,120 @@ export const Primary = {
|
|
|
97
97
|
addedHeaderFirst: true,
|
|
98
98
|
},
|
|
99
99
|
};
|
|
100
|
+
|
|
101
|
+
export const WithFilters = {
|
|
102
|
+
name: "Filters Header",
|
|
103
|
+
args: {
|
|
104
|
+
breadcrumbs: [
|
|
105
|
+
{
|
|
106
|
+
label: "Level 1",
|
|
107
|
+
onClick: () => {
|
|
108
|
+
alert(1);
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
label: "Level Level 2",
|
|
113
|
+
onClick: () => {
|
|
114
|
+
alert(2);
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
label: "Level Level Level 3",
|
|
119
|
+
onClick: () => {
|
|
120
|
+
alert(3);
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "Level Level Level Level 4",
|
|
125
|
+
onClick: () => {
|
|
126
|
+
alert(4);
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
label: "Level Level Level Level Level 5",
|
|
131
|
+
onClick: () => {
|
|
132
|
+
alert(5);
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "Level Level Level Level Level Level 6",
|
|
137
|
+
onClick: () => {
|
|
138
|
+
alert(6);
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
title: "GGGGGGGGGGGGGGGGGGG",
|
|
143
|
+
// supportText:
|
|
144
|
+
// "Supporting text (explanation, DS ID, etc..)Supporting text (explanation, DS ID, etc..)",
|
|
145
|
+
// tags: [
|
|
146
|
+
// { color: "green", label: "Tag 1" },
|
|
147
|
+
// { color: "green", label: "Tag 2" },
|
|
148
|
+
// { color: "green", label: "Tag 3" },
|
|
149
|
+
// { color: "green", label: "Tag 4" },
|
|
150
|
+
// { color: "green", label: "Tag 5" },
|
|
151
|
+
// ],
|
|
152
|
+
loading: false,
|
|
153
|
+
// actionButtons: [
|
|
154
|
+
// {
|
|
155
|
+
// // label: "Primary",
|
|
156
|
+
// type: "primary",
|
|
157
|
+
// onClick: () => {},
|
|
158
|
+
// icon: "Edit",
|
|
159
|
+
// noMinWidth: true,
|
|
160
|
+
// },
|
|
161
|
+
// { onClick: () => {}, icon: "Edit", noMinWidth: true },
|
|
162
|
+
// ],
|
|
163
|
+
// extraButtons: [{ label: "Extra", onClick: () => {} }],
|
|
164
|
+
// goBackTo: () => {
|
|
165
|
+
// alert("Go back to this location");
|
|
166
|
+
// },
|
|
167
|
+
// renderExtraComponents: () => (
|
|
168
|
+
// <div
|
|
169
|
+
// style={{
|
|
170
|
+
// width: "100px",
|
|
171
|
+
// marginLeft: 30,
|
|
172
|
+
// }}
|
|
173
|
+
// >
|
|
174
|
+
// Extra
|
|
175
|
+
// </div>
|
|
176
|
+
// ),
|
|
177
|
+
addedHeader: "Added Header",
|
|
178
|
+
addedHeaderFirst: true,
|
|
179
|
+
filtersConfig: {
|
|
180
|
+
"language": "en",
|
|
181
|
+
"filtersConfig": {
|
|
182
|
+
"country": {
|
|
183
|
+
"type": "select",
|
|
184
|
+
"label": "Country",
|
|
185
|
+
"style": {
|
|
186
|
+
"flex": 1
|
|
187
|
+
},
|
|
188
|
+
"labelStyle": {
|
|
189
|
+
"flex": 1
|
|
190
|
+
},
|
|
191
|
+
"isMulti": true
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"options": {
|
|
195
|
+
"country": [
|
|
196
|
+
{
|
|
197
|
+
"label": "Peru",
|
|
198
|
+
"value": "PE"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"label": "Colombia",
|
|
202
|
+
"value": "CO"
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
"selectedFilters": {
|
|
207
|
+
"country": [
|
|
208
|
+
"PE",
|
|
209
|
+
"CO"
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
"type": "small",
|
|
213
|
+
onApply: () => {}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
};
|
|
@@ -7,6 +7,7 @@ import { formatClassname } from '../../../../helpers/ClassesHelper'
|
|
|
7
7
|
import CustomIcon from '../Icon/CustomIcon.jsx'
|
|
8
8
|
import Loading from '../Loading/index.jsx'
|
|
9
9
|
import { truncateString } from '../../../../helpers/StringHelper.js'
|
|
10
|
+
import SelectFilters from '../Filters/selectFilters/index.jsx'
|
|
10
11
|
|
|
11
12
|
const { Paragraph } = Typography
|
|
12
13
|
|
|
@@ -28,7 +29,10 @@ export const useHeader = ({
|
|
|
28
29
|
renderExtraComponents,
|
|
29
30
|
app = '',
|
|
30
31
|
isViewMode = false,
|
|
32
|
+
filtersConfig = {},
|
|
31
33
|
}) => {
|
|
34
|
+
const [showFilters, setShowFilters] = useState(false)
|
|
35
|
+
const hasFilters = !!filtersConfig
|
|
32
36
|
const downloadButtonAction = app && app === 'sbg' && isViewMode ? null : {
|
|
33
37
|
onClick: onDownload,
|
|
34
38
|
disabled: downloadDisabled,
|
|
@@ -44,9 +48,20 @@ export const useHeader = ({
|
|
|
44
48
|
noMinWidth: true,
|
|
45
49
|
className: 'download-btn',
|
|
46
50
|
}
|
|
51
|
+
|
|
52
|
+
const filterButton = [{
|
|
53
|
+
icon: 'Filter',
|
|
54
|
+
key: 'filters',
|
|
55
|
+
noMinWidth: true,
|
|
56
|
+
squareIconButton: true,
|
|
57
|
+
onClick: () => {
|
|
58
|
+
setShowFilters((p) => !p)
|
|
59
|
+
}
|
|
60
|
+
}]
|
|
47
61
|
|
|
48
62
|
const actionButtons = onDownload && _actionButtons.length < 3 ? [
|
|
49
63
|
..._actionButtons,
|
|
64
|
+
...(hasFilters ? filterButton : []),
|
|
50
65
|
downloadButton
|
|
51
66
|
] : _actionButtons;
|
|
52
67
|
|
|
@@ -103,87 +118,107 @@ export const useHeader = ({
|
|
|
103
118
|
mainContWidth - buttonContWidth - 24, [mainContWidth, buttonContWidth])
|
|
104
119
|
|
|
105
120
|
const renderMainCont = () => (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{goBackTo && (
|
|
114
|
-
<Button
|
|
115
|
-
className="flex mr-xs no-min-width"
|
|
116
|
-
onClick={() => goBackTo()}
|
|
117
|
-
style={{ padding: 2, height: "25px", minWidth: "25px", borderRadius: "4px", opacity: loading ? 0 : 1 }}
|
|
121
|
+
<div>
|
|
122
|
+
<div className={formatClassname(["main-cont flex", className])} ref={mainCont}>
|
|
123
|
+
<div className="flex-1 flex flex-column justify-content-center">
|
|
124
|
+
{typeof title === "string" ? (
|
|
125
|
+
<div
|
|
126
|
+
className={formatClassname(["title flex", hasSupportText && "mb-1"])}
|
|
127
|
+
style={{ maxWidth, alignItems: "center" }}
|
|
118
128
|
>
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
{goBackTo && (
|
|
130
|
+
<Button
|
|
131
|
+
className="flex mr-xs no-min-width"
|
|
132
|
+
onClick={() => goBackTo()}
|
|
133
|
+
style={{ padding: 2, height: "25px", minWidth: "25px", borderRadius: "4px", opacity: loading ? 0 : 1 }}
|
|
134
|
+
>
|
|
135
|
+
<CustomIcon
|
|
136
|
+
name="Right"
|
|
137
|
+
style={{
|
|
138
|
+
transform: "rotate(180deg)",
|
|
139
|
+
width: "12px",
|
|
140
|
+
color: "var(--base-gray-70)",
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
</Button>
|
|
144
|
+
)}
|
|
145
|
+
{loading ? (
|
|
146
|
+
<Skeleton active title={false} paragraph={{ rows: 1 }} style={{ marginTop: '10px' }} />
|
|
147
|
+
) : (
|
|
148
|
+
<Tooltip title={titleTooltip || title}>
|
|
149
|
+
<h2 className={formatClassname(["mb-0 mr-1", hasButtons && "limited"])}>{title}</h2>
|
|
150
|
+
</Tooltip>
|
|
151
|
+
)}
|
|
152
|
+
<div className="flex">
|
|
153
|
+
{!!tooltip && (
|
|
154
|
+
<div className="flex flex-column justify-content-center">
|
|
155
|
+
{typeof tooltip === "string" ? (
|
|
156
|
+
<Tooltip title={tooltip}>
|
|
157
|
+
<InfoCircleOutlined />
|
|
158
|
+
</Tooltip>
|
|
159
|
+
) : typeof tooltip === "object" ? (
|
|
160
|
+
<Popover
|
|
161
|
+
rootClassName={formatClassname(["header-tooltip", tooltip.className])}
|
|
162
|
+
title={tooltip.title}
|
|
163
|
+
content={tooltip.content}
|
|
164
|
+
>
|
|
165
|
+
<InfoCircleOutlined />
|
|
166
|
+
</Popover>
|
|
167
|
+
) : null}
|
|
168
|
+
</div>
|
|
169
|
+
)}
|
|
170
|
+
{typeof renderExtraComponents === "function" ? renderExtraComponents() : null}
|
|
171
|
+
{hasTags && <Tags tags={tags} />}
|
|
172
|
+
</div>
|
|
173
|
+
</div>
|
|
174
|
+
) : typeof title === "function" ? (
|
|
175
|
+
title(maxWidth)
|
|
131
176
|
) : (
|
|
132
|
-
|
|
133
|
-
<h2 className={formatClassname(["mb-0 mr-1", hasButtons && "limited"])}>{title}</h2>
|
|
134
|
-
</Tooltip>
|
|
177
|
+
title
|
|
135
178
|
)}
|
|
136
|
-
<div className="
|
|
137
|
-
{
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<Tooltip title={tooltip}>
|
|
141
|
-
<InfoCircleOutlined />
|
|
142
|
-
</Tooltip>
|
|
143
|
-
) : typeof tooltip === "object" ? (
|
|
144
|
-
<Popover
|
|
145
|
-
rootClassName={formatClassname(["header-tooltip", tooltip.className])}
|
|
146
|
-
title={tooltip.title}
|
|
147
|
-
content={tooltip.content}
|
|
148
|
-
>
|
|
149
|
-
<InfoCircleOutlined />
|
|
150
|
-
</Popover>
|
|
151
|
-
) : null}
|
|
152
|
-
</div>
|
|
153
|
-
)}
|
|
154
|
-
{typeof renderExtraComponents === "function" ? renderExtraComponents() : null}
|
|
155
|
-
{hasTags && <Tags tags={tags} />}
|
|
179
|
+
<div style={{ marginLeft: goBackTo ? "33px" : 0 }} className="support-text">
|
|
180
|
+
<Paragraph ellipsis={{ tooltip: supportText, rows: 1 }} style={{ maxWidth: maxWidth }}>
|
|
181
|
+
{supportText}
|
|
182
|
+
</Paragraph>
|
|
156
183
|
</div>
|
|
157
184
|
</div>
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
185
|
+
{addedHeaderFirst ?
|
|
186
|
+
<div className="flex gap-2">
|
|
187
|
+
{addedHeader}
|
|
188
|
+
{hasButtons && (
|
|
189
|
+
<div ref={buttonCont}>
|
|
190
|
+
<Buttons extraButtons={extraButtons} actionButtons={actionButtons} />
|
|
191
|
+
</div>
|
|
192
|
+
)}
|
|
193
|
+
</div> :
|
|
194
|
+
<>
|
|
195
|
+
{hasButtons && (
|
|
196
|
+
<div ref={buttonCont}>
|
|
197
|
+
<Buttons extraButtons={extraButtons} actionButtons={actionButtons} />
|
|
198
|
+
</div>
|
|
199
|
+
)}
|
|
200
|
+
{addedHeader}
|
|
201
|
+
</>
|
|
202
|
+
}
|
|
168
203
|
</div>
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
204
|
+
<div style={{ marginLeft: goBackTo ? "33px" : 0, width: '100%' }}>
|
|
205
|
+
{hasFilters && (
|
|
206
|
+
<SelectFilters
|
|
207
|
+
t={filtersConfig.t}
|
|
208
|
+
apiUrl={filtersConfig.apiUrl}
|
|
209
|
+
showFilters={showFilters}
|
|
210
|
+
onApply={filtersConfig.onApply}
|
|
211
|
+
options={filtersConfig.options}
|
|
212
|
+
setShowFilters={setShowFilters}
|
|
213
|
+
language={filtersConfig.language}
|
|
214
|
+
type={filtersConfig.type}
|
|
215
|
+
filtersConfig={filtersConfig.filtersConfig}
|
|
216
|
+
selectedFilters={filtersConfig.selectedFilters}
|
|
217
|
+
className={filtersConfig.className}
|
|
218
|
+
isHeader={true}
|
|
219
|
+
/>
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
187
222
|
</div>
|
|
188
223
|
);
|
|
189
224
|
|
|
@@ -92,7 +92,7 @@ export default function DAFHeader({
|
|
|
92
92
|
titleTooltip,
|
|
93
93
|
supportText = "",
|
|
94
94
|
tags = [],
|
|
95
|
-
addedHeader = null,
|
|
95
|
+
addedHeader = null,
|
|
96
96
|
addedHeaderFirst = false,
|
|
97
97
|
actionButtons = [],
|
|
98
98
|
extraButtons = [],
|
|
@@ -103,6 +103,7 @@ export default function DAFHeader({
|
|
|
103
103
|
renderExtraComponents,
|
|
104
104
|
app = "",
|
|
105
105
|
isViewMode = false,
|
|
106
|
+
filtersConfig = {},
|
|
106
107
|
}) {
|
|
107
108
|
const showBreadcrumbs = !!breadcrumbs.length;
|
|
108
109
|
const { renderMainCont, mainContWidth } = useHeader({
|
|
@@ -122,6 +123,7 @@ export default function DAFHeader({
|
|
|
122
123
|
renderExtraComponents,
|
|
123
124
|
app,
|
|
124
125
|
isViewMode,
|
|
126
|
+
filtersConfig,
|
|
125
127
|
});
|
|
126
128
|
|
|
127
129
|
return (
|
|
@@ -146,4 +148,5 @@ DAFHeader.propTypes = {
|
|
|
146
148
|
actionButtons: PropTypes.array,
|
|
147
149
|
extraButtons: PropTypes.array,
|
|
148
150
|
downloadDisabled: PropTypes.any,
|
|
151
|
+
filtersConfig: PropTypes.any,
|
|
149
152
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Tooltip, Popover } from "antd";
|
|
3
|
-
import { SDG_IMAGES } from "../../../../../constants/SDGs
|
|
4
|
-
import { SDGList } from "./styles
|
|
3
|
+
import { SDG_IMAGES } from "../../../../../constants/SDGs";
|
|
4
|
+
import { SDGList } from "./styles";
|
|
5
5
|
|
|
6
6
|
const GAP_BETWEEN_SDGS = 4;
|
|
7
7
|
|
|
@@ -90,15 +90,7 @@ export default function SDGIcons({
|
|
|
90
90
|
</div>
|
|
91
91
|
}
|
|
92
92
|
>
|
|
93
|
-
<div
|
|
94
|
-
className="sdg-item-image sdg-item-more"
|
|
95
|
-
style={{
|
|
96
|
-
height: iconSize,
|
|
97
|
-
width: iconSize,
|
|
98
|
-
}}
|
|
99
|
-
>
|
|
100
|
-
+{hiddenCount}
|
|
101
|
-
</div>
|
|
93
|
+
<div className="sdg-item-image sdg-item-more">+{hiddenCount}</div>
|
|
102
94
|
</Popover>
|
|
103
95
|
</li>
|
|
104
96
|
)}
|
package/src/index.js
CHANGED
|
@@ -23,6 +23,7 @@ export { default as Badge } from "./@daf/core/components/Badge/index.jsx";
|
|
|
23
23
|
// Icons
|
|
24
24
|
export { default as GetIcon } from "./@daf/core/components/Icon/index.jsx";
|
|
25
25
|
export { default as CustomIcon } from "./@daf/core/components/Icon/CustomIcon.jsx";
|
|
26
|
+
|
|
26
27
|
// Filters
|
|
27
28
|
export {
|
|
28
29
|
default as SelectFilters,
|
|
@@ -161,6 +162,3 @@ export { default as InformationChannelsSubject } from "./@daf/core/components/Sc
|
|
|
161
162
|
export { default as InformationChannelsView } from "./@daf/core/components/Screens/InformationChannels/InformationChannel/index.js";
|
|
162
163
|
export { default as InformationChannelsDataPoint } from "./@daf/core/components/Screens/InformationChannels/DataPoint/index.js";
|
|
163
164
|
export { InformationChannelProvider } from "./@daf/core/components/Screens/InformationChannels/context/index.js";
|
|
164
|
-
|
|
165
|
-
// UI
|
|
166
|
-
export { default as SDGIcons } from "./@daf/core/components/UI/SDGIcon/index.jsx";
|
package/.env
DELETED
package/.vscode/settings.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"cSpell.words": ["cukura"],
|
|
3
|
-
"files.autoSave": "afterDelay",
|
|
4
|
-
"editor.wordWrap": "on",
|
|
5
|
-
"editor.autoClosingBrackets": "always",
|
|
6
|
-
"editor.autoClosingComments": "always",
|
|
7
|
-
"editor.autoClosingQuotes": "always",
|
|
8
|
-
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
9
|
-
"editor.formatOnPaste": true,
|
|
10
|
-
"editor.formatOnSave": true,
|
|
11
|
-
"notebook.defaultFormatter": "esbenp.prettier-vscode",
|
|
12
|
-
"javascript.format.semicolons": "insert"
|
|
13
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import SearchFilters from "./index";
|
|
2
|
-
import ThemeLayout from "../../ThemeLayout";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: "Core/Filters/FloatingFilters",
|
|
6
|
-
component: SearchFilters,
|
|
7
|
-
tags: ["autodocs"],
|
|
8
|
-
decorators: [
|
|
9
|
-
(Story) => (
|
|
10
|
-
<ThemeLayout>
|
|
11
|
-
<Story />
|
|
12
|
-
</ThemeLayout>
|
|
13
|
-
),
|
|
14
|
-
],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const Primary = {
|
|
18
|
-
name: "Search Filters",
|
|
19
|
-
args: {
|
|
20
|
-
t: (key) => key,
|
|
21
|
-
filtersConfig: [
|
|
22
|
-
{
|
|
23
|
-
type: "select",
|
|
24
|
-
label: "Category",
|
|
25
|
-
placeholder: "Select a category",
|
|
26
|
-
key: "category",
|
|
27
|
-
options: [
|
|
28
|
-
{ label: "Books", value: "books" },
|
|
29
|
-
{ label: "Electronics", value: "electronics" },
|
|
30
|
-
{ label: "Clothing", value: "clothing" },
|
|
31
|
-
],
|
|
32
|
-
value: null,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: "select",
|
|
36
|
-
label: "Price Range",
|
|
37
|
-
placeholder: "Select a price range",
|
|
38
|
-
key: "priceRange",
|
|
39
|
-
options: [
|
|
40
|
-
{ label: "$0 - $50", value: "0-50" },
|
|
41
|
-
{ label: "$51 - $100", value: "51-100" },
|
|
42
|
-
{ label: "$101 - $200", value: "101-200" },
|
|
43
|
-
],
|
|
44
|
-
value: null,
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
type: "slider",
|
|
48
|
-
label: "Rating",
|
|
49
|
-
key: "rating",
|
|
50
|
-
min: 1,
|
|
51
|
-
max: 5,
|
|
52
|
-
value: 3,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
onFilterChange: (changedFilter) => {
|
|
56
|
-
console.log("Filter changed:", changedFilter);
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
render: (args) => (
|
|
60
|
-
<div style={{ position: "relative", height: "400px" }}>
|
|
61
|
-
<SearchFilters {...args} />
|
|
62
|
-
</div>
|
|
63
|
-
),
|
|
64
|
-
};
|